(process-groupings): Fix bug: Pass non-#f third arg to `add-hook!'.
[bpt/guile.git] / configure.in
CommitLineData
777b022a
JB
1dnl configuration script for Guile
2dnl Process this file with autoconf to produce configure.
50848747 3dnl
c0b2936e 4dnl Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
50848747
JB
5dnl
6dnl This file is part of GUILE
7dnl
8dnl GUILE is free software; you can redistribute it and/or modify it
9dnl under the terms of the GNU General Public License as published by
10dnl the Free Software Foundation; either version 2, or (at your
11dnl option) any later version.
12dnl
13dnl GUILE is distributed in the hope that it will be useful, but
14dnl WITHOUT ANY WARRANTY; without even the implied warranty of
15dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16dnl General Public License for more details.
17dnl
18dnl You should have received a copy of the GNU General Public License
19dnl along with GUILE; see the file COPYING. If not, write to the
20dnl Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21dnl Boston, MA 02111-1307, USA.
22
a44e61ac 23AC_PREREQ(2.53)
237b3247
RB
24
25AC_INIT
26AC_CONFIG_SRCDIR([Makefile.in])
2d26def0 27. $srcdir/GUILE-VERSION
3a629497 28AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
15ae1bee 29AM_MAINTAINER_MODE
3a629497 30AM_CONFIG_HEADER(libguile/scmconfig.h)
2d26def0 31
3a629497 32#--------------------------------------------------------------------
0e8a8468
MV
33#
34# Independent Subdirectories
35#
36#--------------------------------------------------------------------
37
38AC_CONFIG_SUBDIRS(guile-readline)
39
40#--------------------------------------------------------------------
3a629497
JB
41#
42# User options
43#
44#--------------------------------------------------------------------
86789f9b 45
8afd1a2a
RB
46AC_ARG_ENABLE(error-on-warning,
47 [ --enable-error-on-warning treat compile warnings as errors],
48 [case "${enableval}" in
49 yes | y) CFLAGS="${CFLAGS} -Werror"; enable_compile_warnings=no ;;
50 no | n) ;;
51 *) AC_MSG_ERROR(bad value ${enableval} for --enable-error-on-warning) ;;
52 esac])
53
eede3dbc 54
52b3923a 55AC_ARG_ENABLE(debug-freelist,
e73dd549 56 [ --enable-debug-freelist include garbage collector freelist debugging code],
52b3923a 57 if test "$enable_debug_freelist" = y || test "$enable_debug_freelist" = yes; then
eede3dbc
RB
58 AC_DEFINE(GUILE_DEBUG_FREELIST, 1,
59 [Define this if you want to debug the free list (helps w/ GC bugs).])
52b3923a
GB
60 fi)
61
cf890744 62AC_ARG_ENABLE(debug-malloc,
e73dd549 63 [ --enable-debug-malloc include malloc debugging code],
cf890744 64 if test "$enable_debug_malloc" = y || test "$enable_debug_malloc" = yes; then
eede3dbc
RB
65 AC_DEFINE(GUILE_DEBUG_MALLOC, 1,
66 [Define this if you want to debug scm_must_malloc/realloc/free calls.])
cf890744
MD
67 fi)
68
62002dcb
MD
69AC_ARG_ENABLE(guile-debug,
70 [ --enable-guile-debug include internal debugging functions],
71 if test "$enable_guile_debug" = y || test "$enable_guile_debug" = yes; then
eede3dbc
RB
72 AC_DEFINE(GUILE_DEBUG, 1,
73 [Define this to include various undocumented functions used to debug.])
62002dcb
MD
74 fi)
75
afe5177e
GH
76AC_ARG_ENABLE(arrays,
77 [ --disable-arrays omit array and uniform array support],,
78 enable_arrays=yes)
79
52cfc69b
GH
80AC_ARG_ENABLE(posix,
81 [ --disable-posix omit posix interfaces],,
82 enable_posix=yes)
83
84AC_ARG_ENABLE(networking,
dc914156 85 [ --disable-networking omit networking interfaces],,
52cfc69b
GH
86 enable_networking=yes)
87
88AC_ARG_ENABLE(regex,
89 [ --disable-regex omit regular expression interfaces],,
90 enable_regex=yes)
91
fff043ab
NJ
92AC_ARG_ENABLE(htmldoc,
93 [ --enable-htmldoc build HTML documentation as well as Info],
94 [if test "$enable_htmldoc" = "" || test "$enable_htmldoc" = y || test "$enable_htmldoc" = yes; then
95 htmldoc_enabled=yes
96 AC_PATH_PROG(TEXI2HTML, texi2html, not found)
97 if test "$TEXI2HTML" = "not found"; then
98 echo
99 echo Building HTML documentation requires the \`texi2html\' program,
100 echo which appears not to be present on your machine.
101 echo
102 echo \`texi2html\' is available from
103 echo 'http://www.mathematik.uni-kl.de/~obachman/Texi2html/.'
104 echo
105 echo In the meantime, to build the guile-doc distribution
106 echo without HTML enabled, please rerun \`./configure\' without
107 echo the \`--enable-htmldoc\' option.
108 exit -1
109 fi
110 fi])
111
112AM_CONDITIONAL(HTMLDOC, test x$htmldoc_enabled = xyes)
113
e73dd549
MV
114AC_ARG_ENABLE(deprecated,
115 [ --disable-deprecated omit deprecated features [no]])
116
eede3dbc
RB
117AH_TEMPLATE([SCM_ENABLE_DEPRECATED],
118 [Define this to 1 if you want to include deprecated features.])
119
e73dd549 120if test "$enable_deprecated" = no; then
8c494e99 121 AC_DEFINE(SCM_ENABLE_DEPRECATED, 0)
e73dd549
MV
122else
123 if test "$enable_deprecated" = yes || test "$enable_deprecated" = ""; then
94a0d885
MV
124 warn_default=summary
125 elif test "$enable_deprecated" = shutup; then
126 warn_default=no
127 else
128 warn_default=$enable_deprecated
e73dd549 129 fi
8c494e99 130 AC_DEFINE(SCM_ENABLE_DEPRECATED, 1)
eede3dbc
RB
131 AC_DEFINE_UNQUOTED(SCM_WARN_DEPRECATED_DEFAULT, "$warn_default",
132 [Define this to control the default warning level for deprecated features.])
e73dd549
MV
133fi
134
c176b92b
JB
135dnl The --disable-debug used to control these two. But now they are
136dnl a required part of the distribution.
eede3dbc
RB
137AC_DEFINE(DEBUG_EXTENSIONS, 1,
138 [Define if you want support for debugging Scheme programs.])
139AC_DEFINE(READER_EXTENSIONS, 1,
140 [Define if you want support for debugging Scheme programs.])
c176b92b 141
3d1a89b9
NJ
142AC_ARG_ENABLE(elisp,
143 [ --disable-elisp omit Emacs Lisp support],,
144 enable_elisp=yes)
145
a44e61ac
MV
146#--------------------------------------------------------------------
147
148dnl Some more checks for Win32
149AC_CYGWIN
150AC_MINGW32
151AC_LIBTOOL_WIN32_DLL
152
153AC_LIBLTDL_INSTALLABLE
154AC_CONFIG_SUBDIRS(libltdl)
155
156AC_PROG_INSTALL
157AC_PROG_CC
158AC_PROG_CPP
159AC_LIBTOOL_DLOPEN
160
161AC_AIX
162AC_ISC_POSIX
163AC_MINIX
164
165AM_PROG_CC_STDC
166AM_PROG_LIBTOOL
167
168AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
169AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
170
52cfc69b
GH
171dnl files which are destined for separate modules.
172
afe5177e 173if test "$enable_arrays" = yes; then
eede3dbc
RB
174 AC_LIBOBJ([ramap])
175 AC_LIBOBJ([unif])
176 AC_DEFINE(HAVE_ARRAYS, 1,
177 [Define this if you want support for arrays and uniform arrays.])
afe5177e
GH
178fi
179
52cfc69b 180if test "$enable_posix" = yes; then
eede3dbc
RB
181 AC_LIBOBJ([filesys])
182 AC_LIBOBJ([posix])
183 AC_DEFINE(HAVE_POSIX, 1,
184 [Define this if you want support for POSIX system calls in Guile.])
52cfc69b
GH
185fi
186
187if test "$enable_networking" = yes; then
eede3dbc
RB
188 AC_LIBOBJ([net_db])
189 AC_LIBOBJ([socket])
190 AC_DEFINE(HAVE_NETWORKING, 1,
191 [Define this if you want support for networking in Guile.])
52cfc69b
GH
192fi
193
cf890744 194if test "$enable_debug_malloc" = yes; then
eede3dbc 195 AC_LIBOBJ([debug-malloc])
cf890744
MD
196fi
197
3d1a89b9 198if test "$enable_elisp" = yes; then
eede3dbc
RB
199 AC_DEFINE(SCM_ENABLE_ELISP, 1,
200 [Define this if you want Elisp support (in addition to Scheme).])
3d1a89b9
NJ
201fi
202
a9d78896 203
3a629497 204AC_C_CONST
5e9345c3 205AC_C_INLINE
5b079b46
GH
206AC_C_BIGENDIAN
207
5bd732c9 208if test "$ac_cv_c_inline" != no; then
eede3dbc
RB
209 AC_DEFINE(HAVE_INLINE, 1,
210 [Define if the compiler supports inline functions.])
5bd732c9
MV
211fi
212
813b3dd4 213AC_CHECK_SIZEOF(short)
9dec9737
MD
214AC_CHECK_SIZEOF(int)
215AC_CHECK_SIZEOF(long)
813b3dd4 216AC_CHECK_SIZEOF(size_t)
1be6b49c 217
480cd4aa
MV
218dnl Check for integral types that can represent the range of pointers.
219dnl If these types don't exist on this platform, they are replaced by
220dnl "unsigned long" and "long", respectively.
221
222AC_CHECK_HEADERS(stdint.h)
f4d1173b 223AC_CHECK_HEADERS(inttypes.h)
813b3dd4
MV
224AC_CHECK_SIZEOF(uintptr_t)
225AC_CHECK_SIZEOF(ptrdiff_t)
226
227AC_CHECK_SIZEOF(long long)
1be6b49c
ML
228
229AC_CHECK_SIZEOF(void *)
230
f3f70257
ML
231if test "$ac_cv_sizeof_long" -ne "$ac_cv_sizeof_void_p"; then
232 AC_MSG_ERROR(sizes of long and void* are not identical)
9dec9737 233fi
3a629497
JB
234
235AC_HEADER_STDC
236AC_HEADER_DIRENT
237AC_HEADER_TIME
238AC_HEADER_SYS_WAIT
f9e5e096 239AC_CHECK_HEADERS(io.h 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/stdtypes.h sys/types.h sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h direct.h)
3a629497
JB
240GUILE_HEADER_LIBC_WITH_UNISTD
241
242AC_TYPE_GETGROUPS
243AC_TYPE_SIGNAL
244AC_TYPE_MODE_T
245
5852c051 246AC_CHECK_LIB(m, main)
4c787b52 247AC_CHECK_FUNCS(gethostbyname)
5852c051
JB
248if test $ac_cv_func_gethostbyname = no; then
249 AC_CHECK_LIB(nsl, gethostbyname)
250fi
4c787b52 251AC_CHECK_FUNCS(connect)
5852c051
JB
252if test $ac_cv_func_connect = no; then
253 AC_CHECK_LIB(socket, connect)
254fi
5ee74cec 255
f9e5e096
MV
256dnl
257dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
258dnl
259EXTRA_DEFS=""
f9e5e096 260if test "$MINGW32" = "yes" ; then
6812c28f 261 AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCK2_H], 1,
f9e5e096
MV
262 [Define if you have the <winsock2.h> header file.])])
263 AC_CHECK_LIB(ws2_32, main)
eede3dbc
RB
264 AC_LIBOBJ([win32-uname])
265 AC_LIBOBJ([win32-dirent])
b4e15479 266 if test "$enable_networking" = yes ; then
eede3dbc 267 AC_LIBOBJ([win32-socket])
b4e15479
SJ
268 fi
269 if test "$enable_shared" = yes ; then
8f99e3f3
SJ
270 EXTRA_DEFS="-DSCM_IMPORT"
271 AC_DEFINE(USE_DLL_IMPORT, 1,
272 [Define if you need additional CPP macros on Win32 platforms.])
f9e5e096 273 fi
1fa86ca5
SJ
274 if test x"$enable_ltdl_install" = x"yes" ; then
275 INCLTDL="-DLIBLTDL_DLL_IMPORT $INCLTDL"
276 fi
f9e5e096
MV
277fi
278AC_SUBST(EXTRA_DEFS)
f9e5e096
MV
279
280dnl Check for dynamic linking
5852c051 281
b7f27d64
MV
282use_modules=yes
283AC_ARG_WITH(modules,
284[ --with-modules[=FILES] Add support for dynamic modules],
285use_modules="$withval")
286test -z "$use_modules" && use_modules=yes
287DLPREOPEN=
288if test "$use_modules" != no; then
eede3dbc
RB
289 AC_DEFINE(DYNAMIC_LINKING, 1,
290 [Define if you want support for dynamic linking.])
b7f27d64
MV
291 if test "$use_modules" = yes; then
292 DLPREOPEN="-dlpreopen force"
293 else
294 DLPREOPEN="-export-dynamic"
295 for module in $use_modules; do
296 DLPREOPEN="$DLPREOPEN -dlopen $module"
297 done
298 fi
a4995389 299fi
1fa86ca5 300
b7f27d64
MV
301AC_SUBST(INCLTDL)
302AC_SUBST(LIBLTDL)
303AC_SUBST(DLPREOPEN)
5852c051 304
8afd1a2a 305AC_CHECK_FUNCS(ctermid ftime fchown getcwd geteuid gettimeofday lstat mkdir mknod nice readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt strftime strptime symlink sync tcgetpgrp tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill getppid getpgrp fork setitimer getitimer)
64e121dc 306
94e6d793
MG
307AC_CHECK_HEADERS(crypt.h sys/resource.h sys/file.h)
308AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
309AC_CHECK_LIB(crypt, crypt)
310
777b022a
JB
311### Some systems don't declare some functions. On such systems, we
312### need to at least provide our own K&R-style declarations.
313
314### GUILE_FUNC_DECLARED(function, headerfile)
315
316### Check for a declaration of FUNCTION in HEADERFILE; if it is
317### not there, #define MISSING_FUNCTION_DECL.
318AC_DEFUN(GUILE_FUNC_DECLARED, [
fc342a63 319 AC_CACHE_CHECK(for $1 declaration, guile_cv_func_$1_declared,
777b022a 320 AC_EGREP_HEADER($1, $2,
01e5e07e 321 guile_cv_func_$1_declared=yes,
fc342a63
JB
322 guile_cv_func_$1_declared=no))
323 if test [x$guile_cv_func_]$1[_declared] = xno; then
eede3dbc
RB
324 AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL], 1,
325 [Define if the operating system supplies $1 without declaring it.])
777b022a
JB
326 fi
327])
328
329GUILE_FUNC_DECLARED(strptime, time.h)
c31bfb85 330GUILE_FUNC_DECLARED(sleep, unistd.h)
777b022a 331GUILE_FUNC_DECLARED(usleep, unistd.h)
e1a191a8 332
da753252
JB
333### On some systems usleep has no return value. If it does have one,
334### we'd like to return it; otherwise, we'll fake it.
fc342a63 335AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type,
c43f86c1 336 [AC_EGREP_HEADER(changequote(<, >)<void[ ]+usleep>changequote([, ]),
4874dfc8 337 unistd.h,
fc342a63
JB
338 [guile_cv_func_usleep_return_type=void],
339 [guile_cv_func_usleep_return_type=int])])
340case "$guile_cv_func_usleep_return_type" in
341 "void" )
eede3dbc
RB
342 AC_DEFINE(USLEEP_RETURNS_VOID, 1,
343 [Define if the system headers declare usleep to return void.])
fc342a63
JB
344 ;;
345esac
346
da88f0cb
JB
347AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
348if test -n "$have_sys_un_h" ; then
eede3dbc
RB
349 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS, 1,
350 [Define if the system supports Unix-domain (file-domain) sockets.])
da88f0cb
JB
351fi
352
353AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
354
219a5a5b
JB
355AC_CHECK_FUNCS(sethostent gethostent endhostent dnl
356 setnetent getnetent endnetent dnl
357 setprotoent getprotoent endprotoent dnl
358 setservent getservent endservent dnl
5c11cc9d 359 getnetbyaddr getnetbyname dnl
2a0ef8b7
GH
360 inet_lnaof inet_makeaddr inet_netof hstrerror dnl
361 inet_pton inet_ntop)
da88f0cb 362
08f980a4
GH
363dnl Some systems do not declare this. Some systems do declare it, as a
364dnl macro. With cygwin it may be in a DLL.
365
366AC_MSG_CHECKING(whether netdb.h declares h_errno)
367AC_CACHE_VAL(guile_cv_have_h_errno,
368[AC_TRY_COMPILE([#include <netdb.h>],
369[int a = h_errno;],
370guile_cv_have_h_errno=yes, guile_cv_have_h_errno=no)])
371AC_MSG_RESULT($guile_cv_have_h_errno)
372if test $guile_cv_have_h_errno = yes; then
eede3dbc 373 AC_DEFINE(HAVE_H_ERRNO, 1, [Define if h_errno is declared in netdb.h.])
08f980a4 374fi
da88f0cb 375
4f522b6f 376AC_MSG_CHECKING(whether uint32_t is defined)
c5316ea3 377AC_CACHE_VAL(guile_cv_have_uint32_t,
4f522b6f 378 [AC_TRY_COMPILE([#include <sys/types.h>
af68e5e5
SJ
379 #if HAVE_STDINT_H
380 #include <stdint.h>
381 #endif
382 #ifndef __MINGW32__
383 #include <netdb.h>
384 #endif],
4f522b6f
GH
385 [uint32_t a;],
386 guile_cv_have_uint32_t=yes, guile_cv_have_uint32_t=no)])
c5316ea3
GH
387AC_MSG_RESULT($guile_cv_have_uint32_t)
388if test $guile_cv_have_uint32_t = yes; then
eede3dbc
RB
389 AC_DEFINE(HAVE_UINT32_T, 1,
390 [Define if uint32_t typedef is defined when netdb.h is include.])
c5316ea3
GH
391fi
392
018a53a1
GH
393AC_MSG_CHECKING(for working IPv6 support)
394AC_CACHE_VAL(guile_cv_have_ipv6,
8f16fe5a
MV
395[AC_TRY_COMPILE([
396#ifdef HAVE_SYS_TYPES_H
397#include <sys/types.h>
398#endif
399#include <netinet/in.h>
b6f04d92 400#include <sys/socket.h>],
018a53a1
GH
401[struct sockaddr_in6 a; a.sin6_family = AF_INET6;],
402guile_cv_have_ipv6=yes, guile_cv_have_ipv6=no)])
403AC_MSG_RESULT($guile_cv_have_ipv6)
404if test $guile_cv_have_ipv6 = yes; then
eede3dbc 405 AC_DEFINE(HAVE_IPV6, 1, [Define if you want support for IPv6.])
018a53a1
GH
406fi
407
67641981
GH
408# included in rfc2553 but not in older implementations, e.g., glibc 2.1.3.
409AC_MSG_CHECKING(whether sockaddr_in6 has sin6_scope_id)
410AC_CACHE_VAL(guile_cv_have_sin6_scope_id,
8f16fe5a
MV
411[AC_TRY_COMPILE([
412#ifdef HAVE_SYS_TYPES_H
413#include <sys/types.h>
414#endif
415#include <netinet/in.h>],
67641981
GH
416[struct sockaddr_in6 sok; sok.sin6_scope_id = 0;],
417guile_cv_have_sin6_scope_id=yes, guile_cv_have_sin6_scope_id=no)])
418AC_MSG_RESULT($guile_cv_have_sin6_scope_id)
419if test $guile_cv_have_sin6_scope_id = yes; then
eede3dbc
RB
420 AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1,
421 [Define this if your IPv6 has sin6_scope_id in sockaddr_in6 struct.])
67641981
GH
422fi
423
38c1d3c4
GH
424AC_MSG_CHECKING(whether localtime caches TZ)
425AC_CACHE_VAL(guile_cv_localtime_cache,
426[if test x$ac_cv_func_tzset = xyes; then
427AC_TRY_RUN([#include <time.h>
428#if STDC_HEADERS
429# include <stdlib.h>
430#endif
431extern char **environ;
432unset_TZ ()
433{
434 char **from, **to;
435 for (to = from = environ; (*to = *from); from++)
436 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
437 to++;
438}
439char TZ_GMT0[] = "TZ=GMT0";
440char TZ_PST8[] = "TZ=PST8";
441main()
442{
443 time_t now = time ((time_t *) 0);
444 int hour_GMT0, hour_unset;
445 if (putenv (TZ_GMT0) != 0)
446 exit (1);
447 hour_GMT0 = localtime (&now)->tm_hour;
448 unset_TZ ();
449 hour_unset = localtime (&now)->tm_hour;
450 if (putenv (TZ_PST8) != 0)
451 exit (1);
452 if (localtime (&now)->tm_hour == hour_GMT0)
453 exit (1);
454 unset_TZ ();
455 if (localtime (&now)->tm_hour != hour_unset)
456 exit (1);
457 exit (0);
458}], guile_cv_localtime_cache=no, guile_cv_localtime_cache=yes,
459[# If we have tzset, assume the worst when cross-compiling.
460guile_cv_localtime_cache=yes])
461else
462 # If we lack tzset, report that localtime does not cache TZ,
463 # since we can't invalidate the cache if we don't have tzset.
464 guile_cv_localtime_cache=no
465fi])dnl
466AC_MSG_RESULT($guile_cv_localtime_cache)
467if test $guile_cv_localtime_cache = yes; then
eede3dbc 468 AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.])
38c1d3c4
GH
469fi
470
7ee92fce
GH
471dnl Test whether system calls are restartable by default on the
472dnl current system. If they are not, we put a loop around every system
473dnl call to check for EINTR (see SCM_SYSCALL) and do not attempt to
474dnl change from the default behaviour. On the other hand, if signals
475dnl are restartable then the loop is not installed and when libguile
476dnl initialises it also resets the behaviour of each signal to cause a
477dnl restart (in case a different runtime had a different default
478dnl behaviour for some reason: e.g., different versions of linux seem
479dnl to behave differently.)
480
08b8c694 481AC_SYS_RESTARTABLE_SYSCALLS
e1a191a8 482
52cfc69b
GH
483if test "$enable_regex" = yes; then
484 if test "$ac_cv_header_regex_h" = yes ||
485 test "$ac_cv_header_rxposix_h" = yes ||
486 test "$ac_cv_header_rx_rxposix_h" = yes; then
eede3dbc 487 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [AC_LIBOBJ([regex-posix])],
52cfc69b 488 [AC_CHECK_LIB(rx, main)
eede3dbc 489 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [AC_LIBOBJ([regex-posix])],
f9e5e096 490 [AC_CHECK_LIB(regex, main)
eede3dbc 491 GUILE_NAMED_CHECK_FUNC(regcomp, regex, [AC_LIBOBJ([regex-posix])])])]
52cfc69b
GH
492 )
493 dnl The following should not be necessary, but for some reason
494 dnl autoheader misses it if we don't include it!
495 if test "$ac_cv_func_regcomp_norx" = yes ||
f9e5e096 496 test "$ac_cv_func_regcomp_regex" = yes ||
52cfc69b 497 test "$ac_cv_func_regcomp_rx" = yes; then
eede3dbc
RB
498 AC_DEFINE(HAVE_REGCOMP, 1,
499 [This is included as part of a workaround for a autoheader bug.])
52cfc69b
GH
500 fi
501 fi
da88f0cb 502fi
8e1bfcd0 503
5bbfbd1e 504AC_REPLACE_FUNCS(inet_aton putenv strerror memmove mkstemp)
3a629497 505
4a5fa91c
TP
506# When testing for the presence of alloca, we need to add alloca.o
507# explicitly to LIBOBJS to make sure that it is translated to
508# `alloca.lo' for libtool later on. This can and should be done more cleanly.
3a629497 509AC_FUNC_ALLOCA
eede3dbc 510if test "$ALLOCA" = "alloca.o"; then AC_LIBOBJ([alloca]); fi
3a629497 511
237b3247
RB
512AC_CHECK_MEMBERS([struct stat.st_rdev])
513AC_CHECK_MEMBERS([struct stat.st_blksize])
514
515AC_STRUCT_ST_BLOCKS
075edbde 516
fd02f2ad
MD
517AC_CACHE_CHECK([for S_ISLNK in sys/stat.h], ac_cv_macro_S_ISLNK,
518 [AC_TRY_CPP([#include <sys/stat.h>
519 #ifndef S_ISLNK
520 #error no S_ISLNK
521 #endif],
522 ac_cv_macro_S_ISLNK=yes,
523 ac_cv_macro_S_ISLNK=no)])
524if test $ac_cv_macro_S_ISLNK = yes; then
eede3dbc
RB
525 AC_DEFINE(HAVE_S_ISLNK, 1,
526 [Define this if your system defines S_ISLNK in sys/stat.h.])
fd02f2ad
MD
527fi
528
3a629497
JB
529AC_STRUCT_TIMEZONE
530GUILE_STRUCT_UTIMBUF
531
3a629497
JB
532#--------------------------------------------------------------------
533#
534# Which way does the stack grow?
535#
536#--------------------------------------------------------------------
537
538AC_TRY_RUN(aux (l) unsigned long l;
539 { int x; exit (l >= ((unsigned long)&x)); }
01e5e07e 540 main () { int q; aux((unsigned long)&q); },
eede3dbc
RB
541 [AC_DEFINE([SCM_STACK_GROWS_UP], 1,
542 [Define this if a callee's stack frame has a higher address
543 than the caller's stack frame. On most machines, this is
544 not the case.])],
545 [],
546 [AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in)])
547
548AH_TEMPLATE([SCM_SINGLES],
549 [Define this if floats are the same size as longs.])
3a629497 550
3a171311
JB
551AC_CACHE_CHECK([whether floats fit in longs], guile_cv_type_float_fits_long,
552 [AC_TRY_RUN([main () { exit (sizeof(float) > sizeof(long)); }],
553 [guile_cv_type_float_fits_long=yes],
554 [guile_cv_type_float_fits_long=no],
555 [guile_cv_type_float_fits_long=guess-yes])])
556case $guile_cv_type_float_fits_long in
557 "yes" )
558 AC_DEFINE(SCM_SINGLES)
559 ;;
560 "guess-yes" )
561 AC_DEFINE(SCM_SINGLES)
562 AC_MSG_WARN([guessing that sizeof(long) == sizeof(float)])
563 AC_MSG_WARN([see SCM_SINGLES in scmconfig.h.in])
564 ;;
565esac
3a629497 566
3a629497
JB
567
568AC_MSG_CHECKING(for struct linger)
569AC_CACHE_VAL(scm_cv_struct_linger,
570 AC_TRY_COMPILE([
571#include <sys/types.h>
572#include <sys/socket.h>],
573 [struct linger lgr; lgr.l_linger = 100],
574 scm_cv_struct_linger="yes",
575 scm_cv_struct_linger="no"))
576AC_MSG_RESULT($scm_cv_struct_linger)
577if test $scm_cv_struct_linger = yes; then
eede3dbc
RB
578 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
579 [Define this if your system defines struct linger, for use with the
580 getsockopt and setsockopt system calls.])
3a629497 581fi
3a629497 582
7534dfdc
MD
583
584AC_MSG_CHECKING(for struct timespec)
585AC_CACHE_VAL(scm_cv_struct_timespec,
586 AC_TRY_COMPILE([
587#include <time.h>],
588 [struct timespec t; t.tv_nsec = 100],
589 scm_cv_struct_timespec="yes",
590 scm_cv_struct_timespec="no"))
591AC_MSG_RESULT($scm_cv_struct_timespec)
592if test $scm_cv_struct_timespec = yes; then
eede3dbc
RB
593 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
594 [Define this if your system defines struct timespec via <time.h>.])
7534dfdc
MD
595fi
596
3a629497
JB
597#--------------------------------------------------------------------
598#
599# Flags for thread support
600#
601#--------------------------------------------------------------------
602
539c89a1
JB
603### What thread package has the user asked for?
604AC_ARG_WITH(threads, [ --with-threads thread interface],
605 , with_threads=no)
606
607### Turn $with_threads into either the name of a threads package, like
608### `qt', or `no', meaning that threads should not be supported.
e0f54bcc 609AC_MSG_CHECKING(whether to support threads)
539c89a1
JB
610case "$with_threads" in
611 "yes" | "qt" | "coop" | "")
612 with_threads=qt
613 ;;
614 "no" )
615 ;;
616 * )
617 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
618 ;;
619esac
e0f54bcc 620AC_MSG_RESULT($with_threads)
3a629497 621
539c89a1
JB
622## Make sure the threads package we've chosen is actually supported on
623## the present platform.
624case "${with_threads}" in
625 "qt" )
626 ## This configures the QuickThreads package, and sets or clears
627 ## the THREAD_PACKAGE variable if qthreads don't configure
628 ## correctly.
629 QTHREADS_CONFIGURE
630 ;;
631esac
3a629497 632
539c89a1
JB
633## If we're using threads, bring in some other parts of Guile which
634## work with them.
635if test "${THREAD_PACKAGE}" != "" ; then
eede3dbc 636 AC_DEFINE(USE_THREADS, 1, [Define if using any sort of threads.])
3a629497 637
539c89a1 638 ## Include the Guile thread interface in the library...
eede3dbc 639 AC_LIBOBJ([threads])
933a7411 640
539c89a1
JB
641 ## ... and tell it which package to talk to.
642 case "${THREAD_PACKAGE}" in
643 "QT" )
eede3dbc
RB
644 AC_DEFINE(USE_COOP_THREADS, 1,
645 [Define if using cooperative multithreading.])
539c89a1
JB
646 ;;
647 * )
648 AC_MSG_ERROR(invalid value for THREAD_PACKAGE: ${THREAD_PACKAGE})
649 ;;
650 esac
651
652 ## Bring in scm_internal_select, if appropriate.
653 if test $ac_cv_func_gettimeofday = yes &&
654 test $ac_cv_func_select = yes; then
eede3dbc 655 AC_DEFINE(GUILE_ISELECT, 1, [Define to implement scm_internal_select.])
539c89a1 656 fi
ed65453e 657
915bd263
MV
658 AC_ARG_ENABLE(linuxthreads,
659 [ --disable-linuxthreads disable linuxthreads workaround],,
660 enable_linuxthreads=yes)
661
662 ## Workaround for linuxthreads (optionally disabled)
663 if test $host_os = linux-gnu -a "$enable_linuxthreads" = yes; then
eede3dbc
RB
664 AC_DEFINE(GUILE_PTHREAD_COMPAT, 1,
665 [Define to enable workaround for COOP-linuxthreads compatibility.])
e4d2166f
MD
666 AC_CHECK_LIB(pthread, main)
667 fi
933a7411
MD
668fi
669
3a629497
JB
670## If we're using GCC, ask for aggressive warnings.
671case "$GCC" in
99be3450 672 yes )
0a1b8b15
JB
673 ## We had -Wstrict-prototypes in here for a bit, but Guile does too
674 ## much stuff with generic function pointers for that to really be
675 ## less than exasperating.
aee8ca3f
GH
676 ## -Wpointer-arith was here too, but something changed in gcc/glibc
677 ## and it became equally exasperating (gcc 2.95 and/or glibc 2.1.2).
678 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" ;;
3a629497
JB
679esac
680
681AC_PROG_AWK
682
eede3dbc
RB
683## NOTE the code below sets LIBOBJS directly and so is now forbidden
684## -- I'm disabling it for now in the hopes that the newer autoconf
685## will DTRT -- if not, we need to fix up the sed command to match the
686## others...
687##
8f99e3f3
SJ
688## Remove fileblocks.o from the object list. This file gets added by
689## the Autoconf macro AC_STRUCT_ST_BLOCKS. But there is no need.
eede3dbc 690#LIBOBJS="`echo ${LIBOBJS} | sed 's/fileblocks\.o//g'`"
8f99e3f3 691
3a629497
JB
692## If we're creating a shared library (using libtool!), then we'll
693## need to generate a list of .lo files corresponding to the .o files
694## given in LIBOBJS. We'll call it LIBLOBJS.
eede3dbc 695LIBLOBJS="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`"
3a629497 696
e9e225e5 697## We also need to create corresponding .doc and .x files
eede3dbc
RB
698EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`"
699EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`"
91411868 700
7c86ae05
JB
701AC_SUBST(GUILE_MAJOR_VERSION)
702AC_SUBST(GUILE_MINOR_VERSION)
df4a8db0 703AC_SUBST(GUILE_MICRO_VERSION)
7c86ae05 704AC_SUBST(GUILE_VERSION)
9e202853 705
22b7f585
RB
706#######################################################################
707# library versioning
708
709AC_SUBST(LIBQTHREADS_INTERFACE_CURRENT)
710AC_SUBST(LIBQTHREADS_INTERFACE_REVISION)
711AC_SUBST(LIBQTHREADS_INTERFACE_AGE)
712AC_SUBST(LIBQTHREADS_INTERFACE)
713
9e202853
RB
714AC_SUBST(LIBGUILE_INTERFACE_CURRENT)
715AC_SUBST(LIBGUILE_INTERFACE_REVISION)
716AC_SUBST(LIBGUILE_INTERFACE_AGE)
717AC_SUBST(LIBGUILE_INTERFACE)
539c89a1 718
22b7f585
RB
719AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT)
720AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION)
721AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE)
722AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE)
723
724AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT)
725AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION)
726AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE)
727AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE)
728
729#######################################################################
730
bcc695e3 731dnl Tell guile-config what flags guile users should link against.
539c89a1 732GUILE_LIBS="$LDFLAGS $THREAD_LIBS_INSTALLED $LIBS"
daa4f38c 733AC_SUBST(GUILE_LIBS)
7c86ae05 734
3a629497
JB
735AC_SUBST(AWK)
736AC_SUBST(LIBLOBJS)
91411868 737AC_SUBST(EXTRA_DOT_DOC_FILES)
e9e225e5 738AC_SUBST(EXTRA_DOT_X_FILES)
3a629497 739
6812c28f
TTN
740dnl See also top_builddir in info node: (libtool)AC_PROG_LIBTOOL
741top_builddir_absolute=`pwd`
742AC_SUBST(top_builddir_absolute)
2f13db9a
TTN
743top_srcdir_absolute=`(cd $srcdir ; pwd)`
744AC_SUBST(top_srcdir_absolute)
6812c28f 745
237b3247
RB
746AC_CONFIG_FILES([
747 Makefile
6812c28f 748 am/Makefile
237b3247 749 libguile/Makefile
1e4be672 750 libguile/guile-snarf
237b3247
RB
751 libguile/guile-doc-snarf
752 libguile/guile-func-name-check
753 libguile/guile-snarf-docs
70c07eed 754 libguile/version.h
237b3247 755 ice-9/Makefile
3d1a89b9
NJ
756 lang/Makefile
757 lang/elisp/Makefile
758 lang/elisp/internals/Makefile
759 lang/elisp/primitives/Makefile
237b3247
RB
760 oop/Makefile
761 oop/goops/Makefile
762 scripts/Makefile
763 srfi/Makefile
764 qt/Makefile
765 qt/qt.h
766 qt/md/Makefile
767 qt/time/Makefile
768 guile-config/Makefile
769 doc/Makefile
11ca8865
NJ
770 doc/ref/Makefile
771 doc/tutorial/Makefile
772 doc/goops/Makefile
773 doc/r5rs/Makefile
237b3247
RB
774 examples/Makefile
775 examples/scripts/Makefile
776 examples/box/Makefile
777 examples/box-module/Makefile
778 examples/box-dynamic/Makefile
e01970a5 779 examples/box-dynamic-module/Makefile
237b3247
RB
780 examples/modules/Makefile
781 examples/safe/Makefile
bc79995a 782 test-suite/Makefile
237b3247 783 check-guile
6812c28f
TTN
784 guile-tools
785 pre-inst-guile])
237b3247
RB
786
787AC_CONFIG_COMMANDS(default,
1e4be672
MV
788 [ chmod +x libguile/guile-snarf \
789 libguile/guile-doc-snarf \
237b3247
RB
790 libguile/guile-func-name-check \
791 libguile/guile-snarf-docs \
237b3247 792 check-guile \
6812c28f
TTN
793 guile-tools \
794 pre-inst-guile])
237b3247
RB
795
796AC_OUTPUT
0f2d19dd 797
3a629497
JB
798dnl Local Variables:
799dnl comment-start: "dnl "
800dnl comment-end: ""
801dnl comment-start-skip: "\\bdnl\\b\\s *"
d67c13f6 802dnl End: