1 dnl Process this file with autoconf to produce configure.
3 . $srcdir/GUILE-VERSION
4 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
6 AM_CONFIG_HEADER(libguile/scmconfig.h)
8 #--------------------------------------------------------------------
12 #--------------------------------------------------------------------
14 AC_ARG_ENABLE(dynamic-linking,
15 [ --enable-dynamic-linking Include support for dynamic linking],,
16 enable_dynamic_linking=yes)
18 AC_ARG_ENABLE(guile-debug,
19 [ --enable-guile-debug Include internal debugging functions])
20 if test "$enableval" = y || test "$enableval" = yes; then
21 AC_DEFINE(GUILE_DEBUG)
24 dnl The --disable-debug used to control these two. But now they are
25 dnl a required part of the distribution.
26 AC_DEFINE(DEBUG_EXTENSIONS)
27 AC_DEFINE(READER_EXTENSIONS)
29 #--------------------------------------------------------------------
45 AC_CHECK_HEADERS(libc.h limits.h malloc.h memory.h string.h regex.h rxposix.h rx/rxposix.h sys/ioctl.h sys/select.h sys/time.h sys/timeb.h sys/times.h sys/types.h sys/utime.h time.h unistd.h utime.h)
46 GUILE_HEADER_LIBC_WITH_UNISTD
53 AC_CHECK_FUNCS(gethostbyname)
54 if test $ac_cv_func_gethostbyname = no; then
55 AC_CHECK_LIB(nsl, gethostbyname)
57 AC_CHECK_FUNCS(connect)
58 if test $ac_cv_func_connect = no; then
59 AC_CHECK_LIB(socket, connect)
61 AC_CHECK_LIB(termcap, tgoto)
62 AC_CHECK_LIB(readline, readline)
63 AC_CHECK_FUNCS(rl_getc_function rl_clear_signals rl_cleanup_after_signal)
64 if test $ac_cv_lib_readline_readline = yes -a $ac_cv_func_rl_getc_function = no; then
65 echo 'Warning: libreadline is too old on your system. Need >= 2.1.'
68 # Checks for dynamic linking
70 if test "$enable_dynamic_linking" = "yes"; then
72 AC_CHECK_LIB(dl,dlopen)
73 if test "$ac_cv_lib_dl_dlopen" = "yes"; then
74 AC_CHECK_FUNCS(dlopen)
75 AC_DEFINE(DYNAMIC_LINKING)
77 AC_CHECK_LIB(dld,dld_link)
78 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
79 AC_DEFINE(DYNAMIC_LINKING)
81 AC_CHECK_FUNCS(shl_load)
82 if test "$ac_cv_func_shl_load" = "yes"; then
83 AC_DEFINE(DYNAMIC_LINKING)
85 AC_CHECK_FUNCS(dlopen)
86 if test "$ac_cv_func_dlopen" = "yes"; then
87 AC_DEFINE(DYNAMIC_LINKING)
97 AC_CHECK_FUNCS(ctermid ftime getcwd geteuid gethostent gettimeofday lstat mkdir mknod nice readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction strftime strptime symlink sync tcgetpgrp tcsetpgrp times uname waitpid bzero strdup system usleep)
99 # Determine the host we are working on
102 # Some operating systems don't declare all functions
105 AC_DEFINE(DECLARE_BZERO)
106 AC_DEFINE(DECLARE_USLEEP)
110 # On some systems usleep has no return value
111 AC_EGREP_HEADER(changequote(<, >)<void[ ][ ]*usleep>changequote([, ]),
112 /usr/include/unistd.h,
113 AC_DEFINE(USLEEP_RETURNS_VOID)
117 dnl <GNU-WIN32 hacks>
119 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
120 if test -n "$have_sys_un_h" ; then
121 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
124 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
126 dnl I don't know what this prefixing of cygwin32_ is for.
127 dnl scmconfig.h wasn't updated with the test results.
128 dnl so use AC_CHECK_FUNCS for now.
132 dnl if test $ac_cv_cigwin = yes; then
133 dnl modify confdefs.h
135 dnl AC_CHECK_FUNCS...
136 dnl restore confdefs.h
138 dnl cp confdefs.h confdefs.h.bak
139 dnl for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
140 dnl cp confdefs.h.bak confdefs.h
141 dnl cat >> confdefs.h << EOF
142 dnl #ifdef __CYGWIN32__
143 dnl #define $func cygwin32_$func
146 dnl AC_CHECK_FUNC($func)
148 dnl cp confdefs.h.bak confdefs.h
150 AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
152 dnl </GNU-WIN32 hacks>
154 AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts,
155 if test $ac_cv_func_sigaction = yes; then
156 [AC_TRY_COMPILE([#include <signal.h>],
157 [int a = SA_RESTART],
163 if test $scm_cv_restarts = yes; then
164 AC_DEFINE(HAVE_RESTARTS)
167 if test "$ac_cv_header_regex_h" = yes ||
168 test "$ac_cv_header_rxposix_h" = yes ||
169 test "$ac_cv_header_rx_rxposix_h" = yes; then
170 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [LIBOBJS="regex-posix.o $LIBOBJS"],
171 [AC_CHECK_LIB(rx, main)
172 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [LIBOBJS="regex-posix.o $LIBOBJS"])]
174 dnl The following should not be necessary, but for some reason
175 dnl autoheader misses it if we don't include it!
176 if test "$ac_cv_func_regcomp_norx" = yes ||
177 test "$ac_cv_func_regcomp_rx" = yes; then
178 AC_DEFINE(HAVE_REGCOMP)
182 AC_REPLACE_FUNCS(inet_aton putenv strerror)
184 # When testing for the presence of alloca, we need to add alloca.o
185 # explicitly to LIBOBJS to make sure that it is translated to
186 # `alloca.lo' for libtool later on. This can and should be done more cleanly.
188 if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
193 # We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to
194 # LIBOBJS, which we don't need. This seems more direct.
195 AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
196 [AC_TRY_COMPILE([#include <sys/types.h>
197 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
198 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
199 if test $ac_cv_struct_st_blocks = yes; then
200 AC_DEFINE(HAVE_ST_BLOCKS)
206 #--------------------------------------------------------------------
208 # Which way does the stack grow?
210 #--------------------------------------------------------------------
212 AC_TRY_RUN(aux (l) unsigned long l;
213 { int x; exit (l >= ((unsigned long)&x)); }
214 main () { int q; aux((unsigned long)&q); },
215 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
218 AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
219 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
220 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
222 AC_MSG_CHECKING(for struct linger)
223 AC_CACHE_VAL(scm_cv_struct_linger,
225 #include <sys/types.h>
226 #include <sys/socket.h>],
227 [struct linger lgr; lgr.l_linger = 100],
228 scm_cv_struct_linger="yes",
229 scm_cv_struct_linger="no"))
230 AC_MSG_RESULT($scm_cv_struct_linger)
231 if test $scm_cv_struct_linger = yes; then
232 AC_DEFINE(HAVE_STRUCT_LINGER)
235 #--------------------------------------------------------------------
237 # How can you violate a stdio abstraction by setting a stream's fd?
239 #--------------------------------------------------------------------
241 AC_MSG_CHECKING(how to set a stream file descriptor)
242 AC_CACHE_VAL(scm_cv_fd_setter,
243 AC_TRY_COMPILE([#include <stdio.h>],
245 scm_cv_fd_setter="_file",
246 AC_TRY_COMPILE([#include <stdio.h>],
247 [stdout->_fileno = 1],
248 scm_cv_fd_setter="_fileno",
249 scm_cv_fd_setter="")))
251 if test "$scm_cv_fd_setter"; then
252 AC_MSG_RESULT($scm_cv_fd_setter)
253 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
255 AC_MSG_RESULT(we couldn't do it!)
258 #--------------------------------------------------------------------
259 # How to find out whether a FILE structure contains buffered data.
260 # From Tk we have the following list:
261 # _cnt: Most UNIX systems
265 # Or, in GNU libc there are two fields, _gptr and _egptr, which
266 # have to be compared.
267 # These can also be known as _IO_read_ptr and _IO_read_end.
268 #--------------------------------------------------------------------
270 AC_MSG_CHECKING(how to get buffer char count from FILE structure)
271 AC_CACHE_VAL(scm_cv_struct_file_count,
272 AC_TRY_COMPILE([#include <stdio.h>],
273 [FILE *f = stdin; f->_cnt = 0],
274 scm_cv_struct_file_count="_cnt",
275 AC_TRY_COMPILE([#include <stdio.h>],
276 [FILE *f = stdin; f->_r = 0],
277 scm_cv_struct_file_count="_r",
278 AC_TRY_COMPILE([#include <stdio.h>],
279 [FILE *f = stdin; f->readCount = 0],
280 scm_cv_struct_file_count="readCount",
281 scm_cv_struct_file_count=""))))
282 if test "$scm_cv_struct_file_count"; then
283 AC_MSG_RESULT($scm_cv_struct_file_count)
284 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
286 AC_CACHE_VAL(scm_cv_struct_file_gptr,
287 AC_TRY_COMPILE([#include <stdio.h>],
288 [FILE *f = stdin; f->_gptr = f->egptr;],
289 scm_cv_struct_file_gptr=1,
290 scm_cv_struct_file_gptr=""))
291 if test "$scm_cv_struct_gptr"; then
293 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
295 AC_CACHE_VAL(scm_cv_struct_file_readptr,
296 AC_TRY_COMPILE([#include <stdio.h>],
297 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
298 scm_cv_struct_file_readptr=1))
299 if test "$scm_cv_struct_file_readptr"; then
300 AC_MSG_RESULT(read_ptr)
301 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
303 AC_MSG_RESULT(we couldn't do it!)
308 #--------------------------------------------------------------------
310 # Flags for thread support
312 #--------------------------------------------------------------------
314 ### What thread package has the user asked for?
315 AC_ARG_WITH(threads, [ --with-threads thread interface],
318 ### Turn $with_threads into either the name of a threads package, like
319 ### `qt', or `no', meaning that threads should not be supported.
320 AC_MSG_CHECKING(whether to support threads)
321 case "$with_threads" in
322 "yes" | "qt" | "coop" | "")
328 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
331 AC_MSG_RESULT($with_threads)
333 ## Make sure the threads package we've chosen is actually supported on
334 ## the present platform.
335 case "${with_threads}" in
337 ## This configures the QuickThreads package, and sets or clears
338 ## the THREAD_PACKAGE variable if qthreads don't configure
344 ## If we're using threads, bring in some other parts of Guile which
346 if test "${THREAD_PACKAGE}" != "" ; then
347 AC_DEFINE(USE_THREADS, 1)
349 ## Include the Guile thread interface in the library...
350 LIBOBJS="$LIBOBJS threads.o"
352 ## ... and tell it which package to talk to.
353 case "${THREAD_PACKAGE}" in
355 AC_DEFINE(USE_COOP_THREADS, 1)
358 AC_MSG_ERROR(invalid value for THREAD_PACKAGE: ${THREAD_PACKAGE})
362 ## Bring in scm_internal_select, if appropriate.
363 if test $ac_cv_func_gettimeofday = yes &&
364 test $ac_cv_func_select = yes; then
365 LIBOBJS="$LIBOBJS iselect.o"
366 AC_DEFINE(GUILE_ISELECT, 1)
370 ## If we're using GCC, ask for aggressive warnings.
373 ## We had -Wstrict-prototypes in here for a bit, but Guile does too
374 ## much stuff with generic function pointers for that to really be
375 ## less than exasperating.
376 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wmissing-prototypes" ;;
381 ## If we're creating a shared library (using libtool!), then we'll
382 ## need to generate a list of .lo files corresponding to the .o files
383 ## given in LIBOBJS. We'll call it LIBLOBJS.
384 LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
386 AC_SUBST(GUILE_MAJOR_VERSION)
387 AC_SUBST(GUILE_MINOR_VERSION)
388 AC_SUBST(GUILE_VERSION)
390 dnl Tell build-guile what flags guile users should link against.
391 GUILE_LIBS="$LDFLAGS $THREAD_LIBS_INSTALLED $LIBS"
394 dnl timestamping the interpreter and scheme libraries:
396 dnl Help us notice when we're running one version of the Guile
397 dnl interpreter against a different version of the ice-9 Scheme code.
398 dnl This will definitely detect version skew due to differing
399 dnl snapshots and releases, but may not catch skew for the developers.
400 dnl Hopefully it will not detect skew when there is none; if that
401 dnl happens, the warnings will be useless, and we should remove this.
403 AC_SUBST(GUILE_STAMP)
408 AC_OUTPUT([Makefile libguile/Makefile libguile/guile-snarf ice-9/Makefile ice-9/version.scm qt/Makefile qt/qt.h qt/md/Makefile qt/time/Makefile build/Makefile], [chmod +x libguile/guile-snarf])
411 dnl comment-start: "dnl "
413 dnl comment-start-skip: "\\bdnl\\b\\s *"