* autogen.sh: remove support for libltdl sub-configure.
[bpt/guile.git] / configure.in
CommitLineData
777b022a
JB
1dnl configuration script for Guile
2dnl Process this file with autoconf to produce configure.
50848747 3dnl
d19c9767 4dnl Copyright (C) 1998, 1999, 2000, 2001, 2002 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 114AC_ARG_ENABLE(deprecated,
f5f45abe 115 [ --disable-deprecated omit deprecated features])
e73dd549 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
abd2bc18 153AC_LIBLTDL_CONVENIENCE
a44e61ac
MV
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
0db83c04
MV
166
167## Needed for building DLLs on Cygwin, before AM_PROG_LIBTOOL
168AC_LIBTOOL_WIN32_DLL
a44e61ac
MV
169AM_PROG_LIBTOOL
170
171AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
172AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
173
4f6f9ae3
GH
174dnl Check for dynamic linking
175
176use_modules=yes
177AC_ARG_WITH(modules,
178[ --with-modules[=FILES] Add support for dynamic modules],
179use_modules="$withval")
180test -z "$use_modules" && use_modules=yes
181DLPREOPEN=
182if test "$use_modules" != no; then
183 AC_DEFINE(DYNAMIC_LINKING, 1,
184 [Define if you want support for dynamic linking.])
185 if test "$use_modules" = yes; then
186 DLPREOPEN="-dlpreopen force"
187 else
188 DLPREOPEN="-export-dynamic"
189 for module in $use_modules; do
190 DLPREOPEN="$DLPREOPEN -dlopen $module"
191 done
192 fi
193fi
194
52cfc69b
GH
195dnl files which are destined for separate modules.
196
4f6f9ae3
GH
197if test "$use_modules" != no; then
198 AC_LIBOBJ([dynl])
199fi
200
afe5177e 201if test "$enable_arrays" = yes; then
eede3dbc
RB
202 AC_LIBOBJ([ramap])
203 AC_LIBOBJ([unif])
204 AC_DEFINE(HAVE_ARRAYS, 1,
205 [Define this if you want support for arrays and uniform arrays.])
afe5177e
GH
206fi
207
52cfc69b 208if test "$enable_posix" = yes; then
eede3dbc
RB
209 AC_LIBOBJ([filesys])
210 AC_LIBOBJ([posix])
211 AC_DEFINE(HAVE_POSIX, 1,
212 [Define this if you want support for POSIX system calls in Guile.])
52cfc69b
GH
213fi
214
215if test "$enable_networking" = yes; then
eede3dbc
RB
216 AC_LIBOBJ([net_db])
217 AC_LIBOBJ([socket])
218 AC_DEFINE(HAVE_NETWORKING, 1,
219 [Define this if you want support for networking in Guile.])
52cfc69b
GH
220fi
221
cf890744 222if test "$enable_debug_malloc" = yes; then
eede3dbc 223 AC_LIBOBJ([debug-malloc])
cf890744
MD
224fi
225
3d1a89b9 226if test "$enable_elisp" = yes; then
eede3dbc
RB
227 AC_DEFINE(SCM_ENABLE_ELISP, 1,
228 [Define this if you want Elisp support (in addition to Scheme).])
3d1a89b9
NJ
229fi
230
a9d78896 231
3a629497 232AC_C_CONST
5e9345c3 233AC_C_INLINE
5b079b46
GH
234AC_C_BIGENDIAN
235
5bd732c9 236if test "$ac_cv_c_inline" != no; then
eede3dbc
RB
237 AC_DEFINE(HAVE_INLINE, 1,
238 [Define if the compiler supports inline functions.])
5bd732c9
MV
239fi
240
813b3dd4 241AC_CHECK_SIZEOF(short)
9dec9737
MD
242AC_CHECK_SIZEOF(int)
243AC_CHECK_SIZEOF(long)
813b3dd4 244AC_CHECK_SIZEOF(size_t)
1be6b49c 245
480cd4aa
MV
246dnl Check for integral types that can represent the range of pointers.
247dnl If these types don't exist on this platform, they are replaced by
248dnl "unsigned long" and "long", respectively.
249
250AC_CHECK_HEADERS(stdint.h)
f4d1173b 251AC_CHECK_HEADERS(inttypes.h)
813b3dd4
MV
252AC_CHECK_SIZEOF(uintptr_t)
253AC_CHECK_SIZEOF(ptrdiff_t)
254
255AC_CHECK_SIZEOF(long long)
1be6b49c
ML
256
257AC_CHECK_SIZEOF(void *)
258
f3f70257
ML
259if test "$ac_cv_sizeof_long" -ne "$ac_cv_sizeof_void_p"; then
260 AC_MSG_ERROR(sizes of long and void* are not identical)
9dec9737 261fi
3a629497
JB
262
263AC_HEADER_STDC
264AC_HEADER_DIRENT
265AC_HEADER_TIME
266AC_HEADER_SYS_WAIT
f9e5e096 267AC_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
268GUILE_HEADER_LIBC_WITH_UNISTD
269
270AC_TYPE_GETGROUPS
271AC_TYPE_SIGNAL
272AC_TYPE_MODE_T
273
5852c051 274AC_CHECK_LIB(m, main)
4c787b52 275AC_CHECK_FUNCS(gethostbyname)
5852c051
JB
276if test $ac_cv_func_gethostbyname = no; then
277 AC_CHECK_LIB(nsl, gethostbyname)
278fi
39e8f371 279
4c787b52 280AC_CHECK_FUNCS(connect)
5852c051
JB
281if test $ac_cv_func_connect = no; then
282 AC_CHECK_LIB(socket, connect)
283fi
5ee74cec 284
f9e5e096
MV
285dnl
286dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
287dnl
288EXTRA_DEFS=""
f9e5e096 289if test "$MINGW32" = "yes" ; then
6812c28f 290 AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCK2_H], 1,
f9e5e096
MV
291 [Define if you have the <winsock2.h> header file.])])
292 AC_CHECK_LIB(ws2_32, main)
eede3dbc
RB
293 AC_LIBOBJ([win32-uname])
294 AC_LIBOBJ([win32-dirent])
b4e15479 295 if test "$enable_networking" = yes ; then
eede3dbc 296 AC_LIBOBJ([win32-socket])
b4e15479
SJ
297 fi
298 if test "$enable_shared" = yes ; then
8f99e3f3
SJ
299 EXTRA_DEFS="-DSCM_IMPORT"
300 AC_DEFINE(USE_DLL_IMPORT, 1,
301 [Define if you need additional CPP macros on Win32 platforms.])
f9e5e096 302 fi
1fa86ca5
SJ
303 if test x"$enable_ltdl_install" = x"yes" ; then
304 INCLTDL="-DLIBLTDL_DLL_IMPORT $INCLTDL"
305 fi
f9e5e096
MV
306fi
307AC_SUBST(EXTRA_DEFS)
f9e5e096 308
b7f27d64
MV
309AC_SUBST(INCLTDL)
310AC_SUBST(LIBLTDL)
311AC_SUBST(DLPREOPEN)
5852c051 312
8afd1a2a 313AC_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 314
94e6d793
MG
315AC_CHECK_HEADERS(crypt.h sys/resource.h sys/file.h)
316AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
317AC_CHECK_LIB(crypt, crypt)
318
777b022a
JB
319### Some systems don't declare some functions. On such systems, we
320### need to at least provide our own K&R-style declarations.
321
322### GUILE_FUNC_DECLARED(function, headerfile)
323
324### Check for a declaration of FUNCTION in HEADERFILE; if it is
325### not there, #define MISSING_FUNCTION_DECL.
326AC_DEFUN(GUILE_FUNC_DECLARED, [
fc342a63 327 AC_CACHE_CHECK(for $1 declaration, guile_cv_func_$1_declared,
777b022a 328 AC_EGREP_HEADER($1, $2,
01e5e07e 329 guile_cv_func_$1_declared=yes,
fc342a63
JB
330 guile_cv_func_$1_declared=no))
331 if test [x$guile_cv_func_]$1[_declared] = xno; then
eede3dbc
RB
332 AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL], 1,
333 [Define if the operating system supplies $1 without declaring it.])
777b022a
JB
334 fi
335])
336
337GUILE_FUNC_DECLARED(strptime, time.h)
c31bfb85 338GUILE_FUNC_DECLARED(sleep, unistd.h)
777b022a 339GUILE_FUNC_DECLARED(usleep, unistd.h)
e1a191a8 340
da753252
JB
341### On some systems usleep has no return value. If it does have one,
342### we'd like to return it; otherwise, we'll fake it.
fc342a63 343AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type,
c43f86c1 344 [AC_EGREP_HEADER(changequote(<, >)<void[ ]+usleep>changequote([, ]),
4874dfc8 345 unistd.h,
fc342a63
JB
346 [guile_cv_func_usleep_return_type=void],
347 [guile_cv_func_usleep_return_type=int])])
348case "$guile_cv_func_usleep_return_type" in
349 "void" )
eede3dbc
RB
350 AC_DEFINE(USLEEP_RETURNS_VOID, 1,
351 [Define if the system headers declare usleep to return void.])
fc342a63
JB
352 ;;
353esac
354
da88f0cb
JB
355AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
356if test -n "$have_sys_un_h" ; then
eede3dbc
RB
357 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS, 1,
358 [Define if the system supports Unix-domain (file-domain) sockets.])
da88f0cb
JB
359fi
360
361AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
362
219a5a5b
JB
363AC_CHECK_FUNCS(sethostent gethostent endhostent dnl
364 setnetent getnetent endnetent dnl
365 setprotoent getprotoent endprotoent dnl
366 setservent getservent endservent dnl
5c11cc9d 367 getnetbyaddr getnetbyname dnl
2a0ef8b7
GH
368 inet_lnaof inet_makeaddr inet_netof hstrerror dnl
369 inet_pton inet_ntop)
da88f0cb 370
d19c9767
MV
371AC_MSG_CHECKING(for __libc_stack_end)
372AC_TRY_LINK([extern char *__libc_stack_end;],
373 [char *p = __libc_stack_end;],
374 have_libc_stack_end=yes,
375 have_libc_stack_end=no)
376AC_MSG_RESULT($have_libc_stack_end)
377
378if test $have_libc_stack_end = yes; then
379 AC_DEFINE(HAVE_LIBC_STACK_END, 1,
380 [Define if you have the __libc_stack_end variable.])
381fi
382
08f980a4
GH
383dnl Some systems do not declare this. Some systems do declare it, as a
384dnl macro. With cygwin it may be in a DLL.
385
386AC_MSG_CHECKING(whether netdb.h declares h_errno)
387AC_CACHE_VAL(guile_cv_have_h_errno,
388[AC_TRY_COMPILE([#include <netdb.h>],
389[int a = h_errno;],
390guile_cv_have_h_errno=yes, guile_cv_have_h_errno=no)])
391AC_MSG_RESULT($guile_cv_have_h_errno)
392if test $guile_cv_have_h_errno = yes; then
eede3dbc 393 AC_DEFINE(HAVE_H_ERRNO, 1, [Define if h_errno is declared in netdb.h.])
08f980a4 394fi
da88f0cb 395
4f522b6f 396AC_MSG_CHECKING(whether uint32_t is defined)
c5316ea3 397AC_CACHE_VAL(guile_cv_have_uint32_t,
4f522b6f 398 [AC_TRY_COMPILE([#include <sys/types.h>
af68e5e5
SJ
399 #if HAVE_STDINT_H
400 #include <stdint.h>
401 #endif
402 #ifndef __MINGW32__
403 #include <netdb.h>
404 #endif],
4f522b6f
GH
405 [uint32_t a;],
406 guile_cv_have_uint32_t=yes, guile_cv_have_uint32_t=no)])
c5316ea3
GH
407AC_MSG_RESULT($guile_cv_have_uint32_t)
408if test $guile_cv_have_uint32_t = yes; then
eede3dbc
RB
409 AC_DEFINE(HAVE_UINT32_T, 1,
410 [Define if uint32_t typedef is defined when netdb.h is include.])
c5316ea3
GH
411fi
412
018a53a1
GH
413AC_MSG_CHECKING(for working IPv6 support)
414AC_CACHE_VAL(guile_cv_have_ipv6,
8f16fe5a
MV
415[AC_TRY_COMPILE([
416#ifdef HAVE_SYS_TYPES_H
417#include <sys/types.h>
418#endif
419#include <netinet/in.h>
b6f04d92 420#include <sys/socket.h>],
018a53a1
GH
421[struct sockaddr_in6 a; a.sin6_family = AF_INET6;],
422guile_cv_have_ipv6=yes, guile_cv_have_ipv6=no)])
423AC_MSG_RESULT($guile_cv_have_ipv6)
424if test $guile_cv_have_ipv6 = yes; then
eede3dbc 425 AC_DEFINE(HAVE_IPV6, 1, [Define if you want support for IPv6.])
018a53a1
GH
426fi
427
67641981
GH
428# included in rfc2553 but not in older implementations, e.g., glibc 2.1.3.
429AC_MSG_CHECKING(whether sockaddr_in6 has sin6_scope_id)
430AC_CACHE_VAL(guile_cv_have_sin6_scope_id,
8f16fe5a
MV
431[AC_TRY_COMPILE([
432#ifdef HAVE_SYS_TYPES_H
433#include <sys/types.h>
434#endif
435#include <netinet/in.h>],
67641981
GH
436[struct sockaddr_in6 sok; sok.sin6_scope_id = 0;],
437guile_cv_have_sin6_scope_id=yes, guile_cv_have_sin6_scope_id=no)])
438AC_MSG_RESULT($guile_cv_have_sin6_scope_id)
439if test $guile_cv_have_sin6_scope_id = yes; then
eede3dbc
RB
440 AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1,
441 [Define this if your IPv6 has sin6_scope_id in sockaddr_in6 struct.])
67641981
GH
442fi
443
38c1d3c4
GH
444AC_MSG_CHECKING(whether localtime caches TZ)
445AC_CACHE_VAL(guile_cv_localtime_cache,
446[if test x$ac_cv_func_tzset = xyes; then
447AC_TRY_RUN([#include <time.h>
448#if STDC_HEADERS
449# include <stdlib.h>
450#endif
451extern char **environ;
452unset_TZ ()
453{
454 char **from, **to;
455 for (to = from = environ; (*to = *from); from++)
456 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
457 to++;
458}
459char TZ_GMT0[] = "TZ=GMT0";
460char TZ_PST8[] = "TZ=PST8";
461main()
462{
463 time_t now = time ((time_t *) 0);
464 int hour_GMT0, hour_unset;
465 if (putenv (TZ_GMT0) != 0)
466 exit (1);
467 hour_GMT0 = localtime (&now)->tm_hour;
468 unset_TZ ();
469 hour_unset = localtime (&now)->tm_hour;
470 if (putenv (TZ_PST8) != 0)
471 exit (1);
472 if (localtime (&now)->tm_hour == hour_GMT0)
473 exit (1);
474 unset_TZ ();
475 if (localtime (&now)->tm_hour != hour_unset)
476 exit (1);
477 exit (0);
478}], guile_cv_localtime_cache=no, guile_cv_localtime_cache=yes,
479[# If we have tzset, assume the worst when cross-compiling.
480guile_cv_localtime_cache=yes])
481else
482 # If we lack tzset, report that localtime does not cache TZ,
483 # since we can't invalidate the cache if we don't have tzset.
484 guile_cv_localtime_cache=no
485fi])dnl
486AC_MSG_RESULT($guile_cv_localtime_cache)
487if test $guile_cv_localtime_cache = yes; then
eede3dbc 488 AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.])
38c1d3c4
GH
489fi
490
7ee92fce
GH
491dnl Test whether system calls are restartable by default on the
492dnl current system. If they are not, we put a loop around every system
493dnl call to check for EINTR (see SCM_SYSCALL) and do not attempt to
494dnl change from the default behaviour. On the other hand, if signals
495dnl are restartable then the loop is not installed and when libguile
496dnl initialises it also resets the behaviour of each signal to cause a
497dnl restart (in case a different runtime had a different default
498dnl behaviour for some reason: e.g., different versions of linux seem
499dnl to behave differently.)
500
08b8c694 501AC_SYS_RESTARTABLE_SYSCALLS
e1a191a8 502
52cfc69b
GH
503if test "$enable_regex" = yes; then
504 if test "$ac_cv_header_regex_h" = yes ||
505 test "$ac_cv_header_rxposix_h" = yes ||
506 test "$ac_cv_header_rx_rxposix_h" = yes; then
eede3dbc 507 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [AC_LIBOBJ([regex-posix])],
52cfc69b 508 [AC_CHECK_LIB(rx, main)
eede3dbc 509 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [AC_LIBOBJ([regex-posix])],
f9e5e096 510 [AC_CHECK_LIB(regex, main)
eede3dbc 511 GUILE_NAMED_CHECK_FUNC(regcomp, regex, [AC_LIBOBJ([regex-posix])])])]
52cfc69b
GH
512 )
513 dnl The following should not be necessary, but for some reason
514 dnl autoheader misses it if we don't include it!
515 if test "$ac_cv_func_regcomp_norx" = yes ||
f9e5e096 516 test "$ac_cv_func_regcomp_regex" = yes ||
52cfc69b 517 test "$ac_cv_func_regcomp_rx" = yes; then
eede3dbc
RB
518 AC_DEFINE(HAVE_REGCOMP, 1,
519 [This is included as part of a workaround for a autoheader bug.])
52cfc69b
GH
520 fi
521 fi
da88f0cb 522fi
8e1bfcd0 523
5bbfbd1e 524AC_REPLACE_FUNCS(inet_aton putenv strerror memmove mkstemp)
3a629497 525
594e69b7
MV
526AC_CHECK_HEADERS(floatingpoint.h ieeefp.h nan.h)
527
e9527dd6 528AC_CHECK_FUNCS(finite isinf isnan copysign)
594e69b7 529
4a5fa91c
TP
530# When testing for the presence of alloca, we need to add alloca.o
531# explicitly to LIBOBJS to make sure that it is translated to
532# `alloca.lo' for libtool later on. This can and should be done more cleanly.
3a629497 533AC_FUNC_ALLOCA
eede3dbc 534if test "$ALLOCA" = "alloca.o"; then AC_LIBOBJ([alloca]); fi
3a629497 535
237b3247
RB
536AC_CHECK_MEMBERS([struct stat.st_rdev])
537AC_CHECK_MEMBERS([struct stat.st_blksize])
538
539AC_STRUCT_ST_BLOCKS
075edbde 540
fd02f2ad
MD
541AC_CACHE_CHECK([for S_ISLNK in sys/stat.h], ac_cv_macro_S_ISLNK,
542 [AC_TRY_CPP([#include <sys/stat.h>
543 #ifndef S_ISLNK
544 #error no S_ISLNK
545 #endif],
546 ac_cv_macro_S_ISLNK=yes,
547 ac_cv_macro_S_ISLNK=no)])
548if test $ac_cv_macro_S_ISLNK = yes; then
eede3dbc
RB
549 AC_DEFINE(HAVE_S_ISLNK, 1,
550 [Define this if your system defines S_ISLNK in sys/stat.h.])
fd02f2ad
MD
551fi
552
3a629497
JB
553AC_STRUCT_TIMEZONE
554GUILE_STRUCT_UTIMBUF
555
3a629497
JB
556#--------------------------------------------------------------------
557#
558# Which way does the stack grow?
559#
560#--------------------------------------------------------------------
561
562AC_TRY_RUN(aux (l) unsigned long l;
563 { int x; exit (l >= ((unsigned long)&x)); }
01e5e07e 564 main () { int q; aux((unsigned long)&q); },
eede3dbc
RB
565 [AC_DEFINE([SCM_STACK_GROWS_UP], 1,
566 [Define this if a callee's stack frame has a higher address
567 than the caller's stack frame. On most machines, this is
568 not the case.])],
569 [],
570 [AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in)])
571
572AH_TEMPLATE([SCM_SINGLES],
573 [Define this if floats are the same size as longs.])
3a629497 574
3a171311
JB
575AC_CACHE_CHECK([whether floats fit in longs], guile_cv_type_float_fits_long,
576 [AC_TRY_RUN([main () { exit (sizeof(float) > sizeof(long)); }],
577 [guile_cv_type_float_fits_long=yes],
578 [guile_cv_type_float_fits_long=no],
579 [guile_cv_type_float_fits_long=guess-yes])])
580case $guile_cv_type_float_fits_long in
581 "yes" )
582 AC_DEFINE(SCM_SINGLES)
583 ;;
584 "guess-yes" )
585 AC_DEFINE(SCM_SINGLES)
586 AC_MSG_WARN([guessing that sizeof(long) == sizeof(float)])
587 AC_MSG_WARN([see SCM_SINGLES in scmconfig.h.in])
588 ;;
589esac
3a629497 590
3a629497
JB
591
592AC_MSG_CHECKING(for struct linger)
593AC_CACHE_VAL(scm_cv_struct_linger,
594 AC_TRY_COMPILE([
595#include <sys/types.h>
596#include <sys/socket.h>],
597 [struct linger lgr; lgr.l_linger = 100],
598 scm_cv_struct_linger="yes",
599 scm_cv_struct_linger="no"))
600AC_MSG_RESULT($scm_cv_struct_linger)
601if test $scm_cv_struct_linger = yes; then
eede3dbc
RB
602 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
603 [Define this if your system defines struct linger, for use with the
604 getsockopt and setsockopt system calls.])
3a629497 605fi
3a629497 606
7534dfdc
MD
607
608AC_MSG_CHECKING(for struct timespec)
609AC_CACHE_VAL(scm_cv_struct_timespec,
610 AC_TRY_COMPILE([
611#include <time.h>],
612 [struct timespec t; t.tv_nsec = 100],
613 scm_cv_struct_timespec="yes",
614 scm_cv_struct_timespec="no"))
615AC_MSG_RESULT($scm_cv_struct_timespec)
616if test $scm_cv_struct_timespec = yes; then
eede3dbc
RB
617 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
618 [Define this if your system defines struct timespec via <time.h>.])
7534dfdc
MD
619fi
620
3a629497
JB
621#--------------------------------------------------------------------
622#
623# Flags for thread support
624#
625#--------------------------------------------------------------------
626
539c89a1
JB
627### What thread package has the user asked for?
628AC_ARG_WITH(threads, [ --with-threads thread interface],
629 , with_threads=no)
630
631### Turn $with_threads into either the name of a threads package, like
632### `qt', or `no', meaning that threads should not be supported.
e0f54bcc 633AC_MSG_CHECKING(whether to support threads)
539c89a1
JB
634case "$with_threads" in
635 "yes" | "qt" | "coop" | "")
636 with_threads=qt
637 ;;
638 "no" )
639 ;;
640 * )
641 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
642 ;;
643esac
e0f54bcc 644AC_MSG_RESULT($with_threads)
3a629497 645
539c89a1
JB
646## Make sure the threads package we've chosen is actually supported on
647## the present platform.
648case "${with_threads}" in
649 "qt" )
650 ## This configures the QuickThreads package, and sets or clears
651 ## the THREAD_PACKAGE variable if qthreads don't configure
652 ## correctly.
653 QTHREADS_CONFIGURE
654 ;;
655esac
3a629497 656
539c89a1
JB
657## If we're using threads, bring in some other parts of Guile which
658## work with them.
659if test "${THREAD_PACKAGE}" != "" ; then
eede3dbc 660 AC_DEFINE(USE_THREADS, 1, [Define if using any sort of threads.])
3a629497 661
539c89a1 662 ## Include the Guile thread interface in the library...
eede3dbc 663 AC_LIBOBJ([threads])
933a7411 664
539c89a1
JB
665 ## ... and tell it which package to talk to.
666 case "${THREAD_PACKAGE}" in
667 "QT" )
eede3dbc
RB
668 AC_DEFINE(USE_COOP_THREADS, 1,
669 [Define if using cooperative multithreading.])
539c89a1
JB
670 ;;
671 * )
672 AC_MSG_ERROR(invalid value for THREAD_PACKAGE: ${THREAD_PACKAGE})
673 ;;
674 esac
675
676 ## Bring in scm_internal_select, if appropriate.
677 if test $ac_cv_func_gettimeofday = yes &&
678 test $ac_cv_func_select = yes; then
eede3dbc 679 AC_DEFINE(GUILE_ISELECT, 1, [Define to implement scm_internal_select.])
539c89a1 680 fi
ed65453e 681
915bd263
MV
682 AC_ARG_ENABLE(linuxthreads,
683 [ --disable-linuxthreads disable linuxthreads workaround],,
684 enable_linuxthreads=yes)
685
686 ## Workaround for linuxthreads (optionally disabled)
687 if test $host_os = linux-gnu -a "$enable_linuxthreads" = yes; then
eede3dbc
RB
688 AC_DEFINE(GUILE_PTHREAD_COMPAT, 1,
689 [Define to enable workaround for COOP-linuxthreads compatibility.])
e4d2166f
MD
690 AC_CHECK_LIB(pthread, main)
691 fi
933a7411
MD
692fi
693
0db83c04
MV
694## Cross building
695if test "$cross_compiling" = "yes"; then
696 AC_MSG_CHECKING(cc for build)
697 ## /usr/bin/cc still uses wrong assembler
698 ## CC_FOR_BUILD="${CC_FOR_BUILD-/usr/bincc}"
699 CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}"
700else
701 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
702fi
703AC_ARG_WITH(cc-for-build,
704 [ --with-cc-for-build=CC native C compiler, to be used during build])
705test -n "$with_cc_for_build" && CC_FOR_BUILD="$with_cc_for_build"
706
707## AC_MSG_CHECKING("if we are cross compiling")
708## AC_MSG_RESULT($cross_compiling)
709if test "$cross_compiling" = "yes"; then
710 AC_MSG_RESULT($CC_FOR_BUILD)
711fi
712
713## No need as yet to be more elaborate
714CCLD_FOR_BUILD="$CC_FOR_BUILD"
715
716AC_SUBST(cross_compiling)
717AC_SUBST(CC_FOR_BUILD)
718AC_SUBST(CCLD_FOR_BUILD)
719
720## libtool erroneously calls CC_FOR_BUILD HOST_CC;
721## --HOST is the platform that PACKAGE is compiled for.
722HOST_CC="$CC_FOR_BUILD"
723AC_SUBST(HOST_CC)
724
725if test "$cross_compiling" = "yes"; then
726 AC_MSG_CHECKING(guile for build)
727 GUILE_FOR_BUILD="${GUILE_FOR_BUILD-guile}"
728else
729 GUILE_FOR_BUILD='$(preinstguile)'
730fi
731AC_ARG_WITH(guile-for-build,
732 [ --with-guile-for-build=guile native guile executable, to be used during build])
733test -n "$with_guile_for_build" && GUILE_FOR_BUILD="$with_guile_for_build"
734
735## AC_MSG_CHECKING("if we are cross compiling")
736## AC_MSG_RESULT($cross_compiling)
737if test "$cross_compiling" = "yes"; then
738 AC_MSG_RESULT($GUILE_FOR_BUILD)
739fi
740AC_SUBST(GUILE_FOR_BUILD)
741
3a629497
JB
742## If we're using GCC, ask for aggressive warnings.
743case "$GCC" in
99be3450 744 yes )
0a1b8b15
JB
745 ## We had -Wstrict-prototypes in here for a bit, but Guile does too
746 ## much stuff with generic function pointers for that to really be
747 ## less than exasperating.
aee8ca3f
GH
748 ## -Wpointer-arith was here too, but something changed in gcc/glibc
749 ## and it became equally exasperating (gcc 2.95 and/or glibc 2.1.2).
750 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" ;;
3a629497
JB
751esac
752
753AC_PROG_AWK
754
eede3dbc
RB
755## NOTE the code below sets LIBOBJS directly and so is now forbidden
756## -- I'm disabling it for now in the hopes that the newer autoconf
757## will DTRT -- if not, we need to fix up the sed command to match the
758## others...
759##
8f99e3f3
SJ
760## Remove fileblocks.o from the object list. This file gets added by
761## the Autoconf macro AC_STRUCT_ST_BLOCKS. But there is no need.
eede3dbc 762#LIBOBJS="`echo ${LIBOBJS} | sed 's/fileblocks\.o//g'`"
8f99e3f3 763
3a629497
JB
764## If we're creating a shared library (using libtool!), then we'll
765## need to generate a list of .lo files corresponding to the .o files
766## given in LIBOBJS. We'll call it LIBLOBJS.
eede3dbc 767LIBLOBJS="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`"
3a629497 768
e9e225e5 769## We also need to create corresponding .doc and .x files
eede3dbc
RB
770EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`"
771EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`"
91411868 772
7c86ae05
JB
773AC_SUBST(GUILE_MAJOR_VERSION)
774AC_SUBST(GUILE_MINOR_VERSION)
df4a8db0 775AC_SUBST(GUILE_MICRO_VERSION)
7c86ae05 776AC_SUBST(GUILE_VERSION)
9e202853 777
22b7f585
RB
778#######################################################################
779# library versioning
780
781AC_SUBST(LIBQTHREADS_INTERFACE_CURRENT)
782AC_SUBST(LIBQTHREADS_INTERFACE_REVISION)
783AC_SUBST(LIBQTHREADS_INTERFACE_AGE)
784AC_SUBST(LIBQTHREADS_INTERFACE)
785
9e202853
RB
786AC_SUBST(LIBGUILE_INTERFACE_CURRENT)
787AC_SUBST(LIBGUILE_INTERFACE_REVISION)
788AC_SUBST(LIBGUILE_INTERFACE_AGE)
789AC_SUBST(LIBGUILE_INTERFACE)
539c89a1 790
22b7f585
RB
791AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT)
792AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION)
793AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE)
794AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE)
795
796AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT)
797AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION)
798AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE)
799AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE)
800
801#######################################################################
802
bcc695e3 803dnl Tell guile-config what flags guile users should link against.
539c89a1 804GUILE_LIBS="$LDFLAGS $THREAD_LIBS_INSTALLED $LIBS"
daa4f38c 805AC_SUBST(GUILE_LIBS)
7c86ae05 806
3a629497
JB
807AC_SUBST(AWK)
808AC_SUBST(LIBLOBJS)
91411868 809AC_SUBST(EXTRA_DOT_DOC_FILES)
e9e225e5 810AC_SUBST(EXTRA_DOT_X_FILES)
3a629497 811
6812c28f
TTN
812dnl See also top_builddir in info node: (libtool)AC_PROG_LIBTOOL
813top_builddir_absolute=`pwd`
814AC_SUBST(top_builddir_absolute)
2f13db9a
TTN
815top_srcdir_absolute=`(cd $srcdir ; pwd)`
816AC_SUBST(top_srcdir_absolute)
6812c28f 817
237b3247
RB
818AC_CONFIG_FILES([
819 Makefile
6812c28f 820 am/Makefile
237b3247 821 libguile/Makefile
1e4be672 822 libguile/guile-snarf
237b3247
RB
823 libguile/guile-doc-snarf
824 libguile/guile-func-name-check
825 libguile/guile-snarf-docs
70c07eed 826 libguile/version.h
237b3247 827 ice-9/Makefile
3d1a89b9
NJ
828 lang/Makefile
829 lang/elisp/Makefile
830 lang/elisp/internals/Makefile
831 lang/elisp/primitives/Makefile
237b3247
RB
832 oop/Makefile
833 oop/goops/Makefile
834 scripts/Makefile
835 srfi/Makefile
836 qt/Makefile
837 qt/qt.h
838 qt/md/Makefile
839 qt/time/Makefile
840 guile-config/Makefile
841 doc/Makefile
11ca8865
NJ
842 doc/ref/Makefile
843 doc/tutorial/Makefile
844 doc/goops/Makefile
845 doc/r5rs/Makefile
237b3247
RB
846 examples/Makefile
847 examples/scripts/Makefile
848 examples/box/Makefile
849 examples/box-module/Makefile
850 examples/box-dynamic/Makefile
e01970a5 851 examples/box-dynamic-module/Makefile
237b3247
RB
852 examples/modules/Makefile
853 examples/safe/Makefile
bc79995a 854 test-suite/Makefile
237b3247 855 check-guile
dd897aaf
DH
856 benchmark-suite/Makefile
857 benchmark-guile
6812c28f
TTN
858 guile-tools
859 pre-inst-guile])
237b3247
RB
860
861AC_CONFIG_COMMANDS(default,
1e4be672
MV
862 [ chmod +x libguile/guile-snarf \
863 libguile/guile-doc-snarf \
237b3247
RB
864 libguile/guile-func-name-check \
865 libguile/guile-snarf-docs \
237b3247 866 check-guile \
dd897aaf 867 benchmark-guile \
6812c28f
TTN
868 guile-tools \
869 pre-inst-guile])
237b3247
RB
870
871AC_OUTPUT
0f2d19dd 872
3a629497
JB
873dnl Local Variables:
874dnl comment-start: "dnl "
875dnl comment-end: ""
876dnl comment-start-skip: "\\bdnl\\b\\s *"
d67c13f6 877dnl End: