File: configure.ac

package info (click to toggle)
guile-reader 0.6.3%2B20240808-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,904 kB
  • sloc: sh: 5,963; ansic: 3,906; lisp: 795; makefile: 139
file content (188 lines) | stat: -rw-r--r-- 5,939 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.71])
AC_INIT([Guile-Reader],[0.6.3],[guile-reader-devel@nongnu.org],[guile-reader],[https://nongnu.org/guile-reader/])
AC_CONFIG_AUX_DIR(build-aux)

AM_INIT_AUTOMAKE([1.11 color-tests parallel-tests silent-rules \
  gnu no-define check-news -Wno-portability -Werror])

dnl Enable silent rules by default.
AM_SILENT_RULES([yes])

AC_CONFIG_SRCDIR([src/reader.c])
AC_CONFIG_HEADERS([config.h src/reader-config.h])

AC_ARG_WITH([guilemoduledir],
  [AS_HELP_STRING([--with-guilemoduledir=DIR],
    [install Guile modules under DIR])],
  [case "x$withval" in
     xyes|xno) guilemoduledir="";;
     *)        guilemoduledir="$withval";;
   esac],
  [guilemoduledir=""])
   

# Checks for programs.
AC_PROG_CC
AC_PROG_SED
AC_PROG_MKDIR_P
AM_PROG_AR

# Libtool.
LT_PREREQ([2.2.6])
LT_INIT([disable-static dlopen])

if test "x$GCC" = "xyes"; then
  # Enable useful GCC compilation flags.
  GCC_CFLAGS="-Wall"
  GCC_CFLAGS="-Wcast-align -Wpointer-arith $GCC_CFLAGS"
  GCC_CFLAGS="-Winline -Wdeclaration-after-statement $GCC_CFLAGS"
else
  GCC_CFLAGS=""
fi
AC_SUBST([GCC_CFLAGS])

# Checks for libraries.

# Checks for header files.
m4_warn([obsolete],
[The preprocessor macro `STDC_HEADERS' is obsolete.
  Except in unusual embedded environments, you can safely include all
  ISO C90 headers unconditionally.])dnl
# Autoupdate added the next two lines to ensure that your configure
# script's behavior did not change.  They are probably safe to remove.
AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP

AC_CHECK_HEADERS([stdlib.h string.h strings.h])

# GNU lightning.

# We don't bundle GNU lightning with Guile-Reader, as `lightningize'
# would do.  Instead we simply use the available version of lightning,
# if any.  This rules out use of `LIGHTNING_CONFIGURE_IF_NOT_FOUND'.
AC_CHECK_HEADER([lightning.h], [have_lightning=yes], [have_lightning=no])
if test "x$have_lightning" = "xyes"; then
   if test "x$GCC" = "xyes"; then
      # lightning's macros yield a lot of unused return values.  In addition,
      # `jit_get_ip ()' yields this warning:
      #
      #    dereferencing type-punned pointer will break strict-aliasing rules
      #
      # ... hence the `-fno-strict-aliasing'.
      GCC_CFLAGS="$GCC_CFLAGS -Wno-unused-value -fno-strict-aliasing"
   fi

   dnl The following test fails with lightning version < 1.2b and with
   dnl 2.x, which is not supported (yet?).
   AC_MSG_CHECKING([whether GNU lightning supports `jit_allocai'])
   AC_LINK_IFELSE(
     [AC_LANG_PROGRAM([[#include <lightning.h>]],
                      [[int x = jit_allocai (7);]])],
     [AC_MSG_RESULT([yes])],
     [AC_MSG_RESULT([no])
      AC_MSG_WARN([GNU lightning is too old or too recent (try version 1.2); not using it])
      have_lightning=no])
else
  AC_MSG_WARN([GNU lightning not found; GNU lightning enhancements not compiled.])
fi
if test "x$have_lightning" = "xyes"; then
   AC_DEFINE([HAVE_LIGHTNING], [1], [Define if GNU lightning can be used])
fi

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T

AC_CHECK_SIZEOF([void *])

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([strncasecmp])

# Gperf
AC_PATH_PROG([GPERF], [gperf], [not-found])
if test "x$GPERF" = "xnot-found"; then
   AC_MSG_ERROR([GNU Gperf not found.  Please install it first.])
fi

# Guile!
GUILE_PKG([3.0 2.2 2.0 1.8])
GUILE_PROGS
GUILE_FLAGS
AC_PATH_PROG([guile_snarf], [guile-snarf], [not-found])
if test "x$guile_snarf" = "xnot-found"; then
   AC_MSG_ERROR([`guile-snarf' not found.  Please install Guile 1.8.x or later.])
fi
AC_PATH_PROGS([GUILD], [guild guile-tools])
GUILE_SITE_DIR

clean_LIBS="$LIBS"
clean_CFLAGS="$CFLAGS"
LIBS="$LIBS $GUILE_LIBS"
CFLAGS="$CFLAGS $GUILE_CFLAGS"

AC_CHECK_FUNC([scm_take_u8vector], [have_guile_1_8=yes], [have_guile_1_8=no])
if test "x$have_guile_1_8" != "xyes"; then
  AC_MSG_ERROR([You need Guile 1.8.x or higher.])
fi

# `scm_c_locale_stringn_to_number ()' was introduced after 1.8.0.  It is
# equivalent to the former `scm_i_mem2number ()'.
AC_CHECK_FUNCS([scm_c_locale_stringn_to_number scm_i_mem2number])

# `scm_i_' functions may eventually be no longer exported, so avoid
# relying on it.
AC_CHECK_FUNCS([scm_i_input_error scm_i_read_array])

# These symbols (which are not actual functions) vanished in 1.9.3.
AC_CHECK_FUNCS([scm_charnames scm_charnums])

# Functions for Unicode support that appeared in Guile 2.0.
AC_CHECK_FUNCS([scm_from_stringn scm_get_byte_or_eof \
  scm_unget_byte scm_from_utf32_stringn scm_gc_malloc_pointerless])

AM_CONDITIONAL([HAVE_GUILE2], [test "x$ac_cv_func_scm_from_utf32_stringn" = "xyes"])

# This type appeared in Guile 2.0.
AC_CHECK_TYPE([scm_t_wchar],
  [AC_DEFINE([SCM_READER_HAVE_SCM_T_WCHAR], [1],
    [Define if the `scm_t_wchar' type exists.])], [:],
  [#include <libguile.h>])

CFLAGS="$clean_CFLAGS"
LIBS="$clean_LIBS"


pkgdatadir="$datadir/$PACKAGE_NAME"
if test "x$guilemoduledir" = "x"; then
  guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
  guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
else
  guileobjectdir="$guilemoduledir"
fi
AC_SUBST([guilemoduledir])
AC_SUBST([guileobjectdir])

if test "$guilemoduledir" != "$GUILE_SITE"; then
   # Guile won't be able to locate the module "out of the box", so
   # warn the user.
   AC_MSG_WARN([`guilemoduledir' ($guilemoduledir) is different from `GUILE_SITE' ($GUILE_SITE).])
   AC_MSG_WARN([Make sure to adjust the `GUILE_LOAD_PATH' environment variable accordingly,])
   AC_MSG_WARN([or re-run `configure' with `--with-guilemoduledir=$GUILE_SITE'.])
fi

AC_CONFIG_FILES([Makefile
		 pre-inst-guile
		 src/Makefile
		 tests/Makefile
	         modules/Makefile
		 doc/Makefile])

AC_CONFIG_COMMANDS([pre-inst-guile-exec], [chmod +x pre-inst-guile])

AC_OUTPUT