* scmconfig.h.top: new file -- preamble for scmconfig.h.
[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
8907576f 26AC_CONFIG_SRCDIR([GUILE-VERSION])
2d26def0 27. $srcdir/GUILE-VERSION
3a629497 28AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
15ae1bee 29AM_MAINTAINER_MODE
8907576f 30AM_CONFIG_HEADER(config.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
bdcccc18
RB
46GUILE_ERROR_ON_WARNING="yes"
47
8afd1a2a
RB
48AC_ARG_ENABLE(error-on-warning,
49 [ --enable-error-on-warning treat compile warnings as errors],
50 [case "${enableval}" in
bdcccc18
RB
51 yes | y) GUILE_ERROR_ON_WARNING="yes" ;;
52 no | n) GUILE_ERROR_ON_WARNING="no" ;;
8afd1a2a
RB
53 *) AC_MSG_ERROR(bad value ${enableval} for --enable-error-on-warning) ;;
54 esac])
55
52b3923a 56AC_ARG_ENABLE(debug-freelist,
e73dd549 57 [ --enable-debug-freelist include garbage collector freelist debugging code],
52b3923a 58 if test "$enable_debug_freelist" = y || test "$enable_debug_freelist" = yes; then
eede3dbc
RB
59 AC_DEFINE(GUILE_DEBUG_FREELIST, 1,
60 [Define this if you want to debug the free list (helps w/ GC bugs).])
52b3923a
GB
61 fi)
62
cf890744 63AC_ARG_ENABLE(debug-malloc,
e73dd549 64 [ --enable-debug-malloc include malloc debugging code],
cf890744 65 if test "$enable_debug_malloc" = y || test "$enable_debug_malloc" = yes; then
eede3dbc
RB
66 AC_DEFINE(GUILE_DEBUG_MALLOC, 1,
67 [Define this if you want to debug scm_must_malloc/realloc/free calls.])
cf890744
MD
68 fi)
69
62002dcb
MD
70AC_ARG_ENABLE(guile-debug,
71 [ --enable-guile-debug include internal debugging functions],
72 if test "$enable_guile_debug" = y || test "$enable_guile_debug" = yes; then
eede3dbc
RB
73 AC_DEFINE(GUILE_DEBUG, 1,
74 [Define this to include various undocumented functions used to debug.])
62002dcb
MD
75 fi)
76
afe5177e
GH
77AC_ARG_ENABLE(arrays,
78 [ --disable-arrays omit array and uniform array support],,
79 enable_arrays=yes)
80
52cfc69b
GH
81AC_ARG_ENABLE(posix,
82 [ --disable-posix omit posix interfaces],,
83 enable_posix=yes)
84
85AC_ARG_ENABLE(networking,
dc914156 86 [ --disable-networking omit networking interfaces],,
52cfc69b
GH
87 enable_networking=yes)
88
89AC_ARG_ENABLE(regex,
90 [ --disable-regex omit regular expression interfaces],,
91 enable_regex=yes)
92
fff043ab
NJ
93AC_ARG_ENABLE(htmldoc,
94 [ --enable-htmldoc build HTML documentation as well as Info],
95 [if test "$enable_htmldoc" = "" || test "$enable_htmldoc" = y || test "$enable_htmldoc" = yes; then
96 htmldoc_enabled=yes
97 AC_PATH_PROG(TEXI2HTML, texi2html, not found)
98 if test "$TEXI2HTML" = "not found"; then
99 echo
100 echo Building HTML documentation requires the \`texi2html\' program,
101 echo which appears not to be present on your machine.
102 echo
103 echo \`texi2html\' is available from
104 echo 'http://www.mathematik.uni-kl.de/~obachman/Texi2html/.'
105 echo
106 echo In the meantime, to build the guile-doc distribution
107 echo without HTML enabled, please rerun \`./configure\' without
108 echo the \`--enable-htmldoc\' option.
109 exit -1
110 fi
111 fi])
112
113AM_CONDITIONAL(HTMLDOC, test x$htmldoc_enabled = xyes)
114
e73dd549 115AC_ARG_ENABLE(deprecated,
f5f45abe 116 [ --disable-deprecated omit deprecated features])
e73dd549 117
eede3dbc
RB
118AH_TEMPLATE([SCM_ENABLE_DEPRECATED],
119 [Define this to 1 if you want to include deprecated features.])
120
e73dd549 121if test "$enable_deprecated" = no; then
8c494e99 122 AC_DEFINE(SCM_ENABLE_DEPRECATED, 0)
e73dd549
MV
123else
124 if test "$enable_deprecated" = yes || test "$enable_deprecated" = ""; then
94a0d885
MV
125 warn_default=summary
126 elif test "$enable_deprecated" = shutup; then
127 warn_default=no
128 else
129 warn_default=$enable_deprecated
e73dd549 130 fi
8c494e99 131 AC_DEFINE(SCM_ENABLE_DEPRECATED, 1)
eede3dbc
RB
132 AC_DEFINE_UNQUOTED(SCM_WARN_DEPRECATED_DEFAULT, "$warn_default",
133 [Define this to control the default warning level for deprecated features.])
e73dd549
MV
134fi
135
c176b92b
JB
136dnl The --disable-debug used to control these two. But now they are
137dnl a required part of the distribution.
eede3dbc
RB
138AC_DEFINE(DEBUG_EXTENSIONS, 1,
139 [Define if you want support for debugging Scheme programs.])
140AC_DEFINE(READER_EXTENSIONS, 1,
141 [Define if you want support for debugging Scheme programs.])
c176b92b 142
d8db94d6
MV
143dnl These two used to be optional, too, but now they are always
144dnl defined.
145AC_DEFINE(USE_THREADS, 1, [Deprecated, always defined.])
146AC_DEFINE(GUILE_ISELECT, 1, [Deprecated, always defined.])
147
3d1a89b9
NJ
148AC_ARG_ENABLE(elisp,
149 [ --disable-elisp omit Emacs Lisp support],,
150 enable_elisp=yes)
151
a44e61ac
MV
152#--------------------------------------------------------------------
153
154dnl Some more checks for Win32
155AC_CYGWIN
156AC_MINGW32
157AC_LIBTOOL_WIN32_DLL
158
a44e61ac
MV
159AC_PROG_INSTALL
160AC_PROG_CC
161AC_PROG_CPP
bdcccc18 162AC_PROG_AWK
a44e61ac
MV
163
164AC_AIX
165AC_ISC_POSIX
166AC_MINIX
167
168AM_PROG_CC_STDC
0db83c04 169
bdcccc18 170AC_LIBTOOL_DLOPEN
a44e61ac 171AM_PROG_LIBTOOL
bdcccc18 172AC_LIB_LTDL
a44e61ac
MV
173
174AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
175AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
176
4f6f9ae3
GH
177dnl Check for dynamic linking
178
179use_modules=yes
180AC_ARG_WITH(modules,
181[ --with-modules[=FILES] Add support for dynamic modules],
182use_modules="$withval")
183test -z "$use_modules" && use_modules=yes
184DLPREOPEN=
185if test "$use_modules" != no; then
186 AC_DEFINE(DYNAMIC_LINKING, 1,
187 [Define if you want support for dynamic linking.])
188 if test "$use_modules" = yes; then
189 DLPREOPEN="-dlpreopen force"
190 else
191 DLPREOPEN="-export-dynamic"
192 for module in $use_modules; do
193 DLPREOPEN="$DLPREOPEN -dlopen $module"
194 done
195 fi
196fi
197
52cfc69b
GH
198dnl files which are destined for separate modules.
199
4f6f9ae3
GH
200if test "$use_modules" != no; then
201 AC_LIBOBJ([dynl])
202fi
203
afe5177e 204if test "$enable_arrays" = yes; then
eede3dbc
RB
205 AC_LIBOBJ([ramap])
206 AC_LIBOBJ([unif])
207 AC_DEFINE(HAVE_ARRAYS, 1,
208 [Define this if you want support for arrays and uniform arrays.])
afe5177e
GH
209fi
210
52cfc69b 211if test "$enable_posix" = yes; then
eede3dbc
RB
212 AC_LIBOBJ([filesys])
213 AC_LIBOBJ([posix])
214 AC_DEFINE(HAVE_POSIX, 1,
215 [Define this if you want support for POSIX system calls in Guile.])
52cfc69b
GH
216fi
217
218if test "$enable_networking" = yes; then
eede3dbc
RB
219 AC_LIBOBJ([net_db])
220 AC_LIBOBJ([socket])
221 AC_DEFINE(HAVE_NETWORKING, 1,
222 [Define this if you want support for networking in Guile.])
52cfc69b
GH
223fi
224
cf890744 225if test "$enable_debug_malloc" = yes; then
eede3dbc 226 AC_LIBOBJ([debug-malloc])
cf890744
MD
227fi
228
3d1a89b9 229if test "$enable_elisp" = yes; then
eede3dbc
RB
230 AC_DEFINE(SCM_ENABLE_ELISP, 1,
231 [Define this if you want Elisp support (in addition to Scheme).])
3d1a89b9
NJ
232fi
233
a9d78896 234
3a629497 235AC_C_CONST
5e9345c3 236AC_C_INLINE
5b079b46
GH
237AC_C_BIGENDIAN
238
5bd732c9 239if test "$ac_cv_c_inline" != no; then
eede3dbc
RB
240 AC_DEFINE(HAVE_INLINE, 1,
241 [Define if the compiler supports inline functions.])
5bd732c9
MV
242fi
243
813b3dd4 244AC_CHECK_SIZEOF(short)
9dec9737
MD
245AC_CHECK_SIZEOF(int)
246AC_CHECK_SIZEOF(long)
813b3dd4 247AC_CHECK_SIZEOF(size_t)
1be6b49c 248
480cd4aa
MV
249dnl Check for integral types that can represent the range of pointers.
250dnl If these types don't exist on this platform, they are replaced by
251dnl "unsigned long" and "long", respectively.
252
253AC_CHECK_HEADERS(stdint.h)
f4d1173b 254AC_CHECK_HEADERS(inttypes.h)
813b3dd4
MV
255AC_CHECK_SIZEOF(uintptr_t)
256AC_CHECK_SIZEOF(ptrdiff_t)
257
258AC_CHECK_SIZEOF(long long)
1be6b49c
ML
259
260AC_CHECK_SIZEOF(void *)
261
f3f70257
ML
262if test "$ac_cv_sizeof_long" -ne "$ac_cv_sizeof_void_p"; then
263 AC_MSG_ERROR(sizes of long and void* are not identical)
9dec9737 264fi
3a629497
JB
265
266AC_HEADER_STDC
267AC_HEADER_DIRENT
268AC_HEADER_TIME
269AC_HEADER_SYS_WAIT
bdcccc18
RB
270
271AC_CHECK_HEADERS([io.h libc.h limits.h malloc.h memory.h string.h \
272regex.h rxposix.h rx/rxposix.h sys/dir.h sys/ioctl.h sys/select.h \
273sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
274sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
275direct.h])
276
3a629497
JB
277GUILE_HEADER_LIBC_WITH_UNISTD
278
279AC_TYPE_GETGROUPS
280AC_TYPE_SIGNAL
281AC_TYPE_MODE_T
282
5852c051 283AC_CHECK_LIB(m, main)
4c787b52 284AC_CHECK_FUNCS(gethostbyname)
5852c051
JB
285if test $ac_cv_func_gethostbyname = no; then
286 AC_CHECK_LIB(nsl, gethostbyname)
287fi
39e8f371 288
4c787b52 289AC_CHECK_FUNCS(connect)
5852c051
JB
290if test $ac_cv_func_connect = no; then
291 AC_CHECK_LIB(socket, connect)
292fi
5ee74cec 293
f9e5e096
MV
294dnl
295dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
296dnl
297EXTRA_DEFS=""
f9e5e096 298if test "$MINGW32" = "yes" ; then
6812c28f 299 AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCK2_H], 1,
f9e5e096
MV
300 [Define if you have the <winsock2.h> header file.])])
301 AC_CHECK_LIB(ws2_32, main)
eede3dbc
RB
302 AC_LIBOBJ([win32-uname])
303 AC_LIBOBJ([win32-dirent])
b4e15479 304 if test "$enable_networking" = yes ; then
eede3dbc 305 AC_LIBOBJ([win32-socket])
b4e15479
SJ
306 fi
307 if test "$enable_shared" = yes ; then
8f99e3f3
SJ
308 EXTRA_DEFS="-DSCM_IMPORT"
309 AC_DEFINE(USE_DLL_IMPORT, 1,
310 [Define if you need additional CPP macros on Win32 platforms.])
f9e5e096 311 fi
1fa86ca5
SJ
312 if test x"$enable_ltdl_install" = x"yes" ; then
313 INCLTDL="-DLIBLTDL_DLL_IMPORT $INCLTDL"
314 fi
f9e5e096
MV
315fi
316AC_SUBST(EXTRA_DEFS)
f9e5e096 317
bdcccc18
RB
318# FIXME: check to see if we still need these.
319#AC_SUBST(INCLTDL)
320#AC_SUBST(LIBLTDL)
321
b7f27d64 322AC_SUBST(DLPREOPEN)
5852c051 323
bdcccc18
RB
324AC_CHECK_HEADERS([assert.h])
325
326AC_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 strchr strcmp index bcopy memcpy rindex])
64e121dc 327
94e6d793
MG
328AC_CHECK_HEADERS(crypt.h sys/resource.h sys/file.h)
329AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
330AC_CHECK_LIB(crypt, crypt)
331
777b022a
JB
332### Some systems don't declare some functions. On such systems, we
333### need to at least provide our own K&R-style declarations.
334
335### GUILE_FUNC_DECLARED(function, headerfile)
336
337### Check for a declaration of FUNCTION in HEADERFILE; if it is
338### not there, #define MISSING_FUNCTION_DECL.
339AC_DEFUN(GUILE_FUNC_DECLARED, [
fc342a63 340 AC_CACHE_CHECK(for $1 declaration, guile_cv_func_$1_declared,
777b022a 341 AC_EGREP_HEADER($1, $2,
01e5e07e 342 guile_cv_func_$1_declared=yes,
fc342a63
JB
343 guile_cv_func_$1_declared=no))
344 if test [x$guile_cv_func_]$1[_declared] = xno; then
eede3dbc
RB
345 AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL], 1,
346 [Define if the operating system supplies $1 without declaring it.])
777b022a
JB
347 fi
348])
349
350GUILE_FUNC_DECLARED(strptime, time.h)
c31bfb85 351GUILE_FUNC_DECLARED(sleep, unistd.h)
777b022a 352GUILE_FUNC_DECLARED(usleep, unistd.h)
e1a191a8 353
da753252
JB
354### On some systems usleep has no return value. If it does have one,
355### we'd like to return it; otherwise, we'll fake it.
fc342a63 356AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type,
c43f86c1 357 [AC_EGREP_HEADER(changequote(<, >)<void[ ]+usleep>changequote([, ]),
4874dfc8 358 unistd.h,
fc342a63
JB
359 [guile_cv_func_usleep_return_type=void],
360 [guile_cv_func_usleep_return_type=int])])
361case "$guile_cv_func_usleep_return_type" in
362 "void" )
eede3dbc
RB
363 AC_DEFINE(USLEEP_RETURNS_VOID, 1,
364 [Define if the system headers declare usleep to return void.])
fc342a63
JB
365 ;;
366esac
367
da88f0cb
JB
368AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
369if test -n "$have_sys_un_h" ; then
eede3dbc
RB
370 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS, 1,
371 [Define if the system supports Unix-domain (file-domain) sockets.])
da88f0cb
JB
372fi
373
374AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
375
219a5a5b
JB
376AC_CHECK_FUNCS(sethostent gethostent endhostent dnl
377 setnetent getnetent endnetent dnl
378 setprotoent getprotoent endprotoent dnl
379 setservent getservent endservent dnl
5c11cc9d 380 getnetbyaddr getnetbyname dnl
2a0ef8b7
GH
381 inet_lnaof inet_makeaddr inet_netof hstrerror dnl
382 inet_pton inet_ntop)
da88f0cb 383
d19c9767
MV
384AC_MSG_CHECKING(for __libc_stack_end)
385AC_TRY_LINK([extern char *__libc_stack_end;],
386 [char *p = __libc_stack_end;],
387 have_libc_stack_end=yes,
388 have_libc_stack_end=no)
389AC_MSG_RESULT($have_libc_stack_end)
390
391if test $have_libc_stack_end = yes; then
392 AC_DEFINE(HAVE_LIBC_STACK_END, 1,
393 [Define if you have the __libc_stack_end variable.])
394fi
395
08f980a4
GH
396dnl Some systems do not declare this. Some systems do declare it, as a
397dnl macro. With cygwin it may be in a DLL.
398
399AC_MSG_CHECKING(whether netdb.h declares h_errno)
400AC_CACHE_VAL(guile_cv_have_h_errno,
401[AC_TRY_COMPILE([#include <netdb.h>],
402[int a = h_errno;],
403guile_cv_have_h_errno=yes, guile_cv_have_h_errno=no)])
404AC_MSG_RESULT($guile_cv_have_h_errno)
405if test $guile_cv_have_h_errno = yes; then
eede3dbc 406 AC_DEFINE(HAVE_H_ERRNO, 1, [Define if h_errno is declared in netdb.h.])
08f980a4 407fi
da88f0cb 408
4f522b6f 409AC_MSG_CHECKING(whether uint32_t is defined)
c5316ea3 410AC_CACHE_VAL(guile_cv_have_uint32_t,
4f522b6f 411 [AC_TRY_COMPILE([#include <sys/types.h>
af68e5e5
SJ
412 #if HAVE_STDINT_H
413 #include <stdint.h>
414 #endif
415 #ifndef __MINGW32__
416 #include <netdb.h>
417 #endif],
4f522b6f
GH
418 [uint32_t a;],
419 guile_cv_have_uint32_t=yes, guile_cv_have_uint32_t=no)])
c5316ea3
GH
420AC_MSG_RESULT($guile_cv_have_uint32_t)
421if test $guile_cv_have_uint32_t = yes; then
eede3dbc
RB
422 AC_DEFINE(HAVE_UINT32_T, 1,
423 [Define if uint32_t typedef is defined when netdb.h is include.])
c5316ea3
GH
424fi
425
018a53a1
GH
426AC_MSG_CHECKING(for working IPv6 support)
427AC_CACHE_VAL(guile_cv_have_ipv6,
8f16fe5a
MV
428[AC_TRY_COMPILE([
429#ifdef HAVE_SYS_TYPES_H
430#include <sys/types.h>
431#endif
432#include <netinet/in.h>
b6f04d92 433#include <sys/socket.h>],
018a53a1
GH
434[struct sockaddr_in6 a; a.sin6_family = AF_INET6;],
435guile_cv_have_ipv6=yes, guile_cv_have_ipv6=no)])
436AC_MSG_RESULT($guile_cv_have_ipv6)
437if test $guile_cv_have_ipv6 = yes; then
eede3dbc 438 AC_DEFINE(HAVE_IPV6, 1, [Define if you want support for IPv6.])
018a53a1
GH
439fi
440
67641981
GH
441# included in rfc2553 but not in older implementations, e.g., glibc 2.1.3.
442AC_MSG_CHECKING(whether sockaddr_in6 has sin6_scope_id)
443AC_CACHE_VAL(guile_cv_have_sin6_scope_id,
8f16fe5a
MV
444[AC_TRY_COMPILE([
445#ifdef HAVE_SYS_TYPES_H
446#include <sys/types.h>
447#endif
448#include <netinet/in.h>],
67641981
GH
449[struct sockaddr_in6 sok; sok.sin6_scope_id = 0;],
450guile_cv_have_sin6_scope_id=yes, guile_cv_have_sin6_scope_id=no)])
451AC_MSG_RESULT($guile_cv_have_sin6_scope_id)
452if test $guile_cv_have_sin6_scope_id = yes; then
eede3dbc
RB
453 AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1,
454 [Define this if your IPv6 has sin6_scope_id in sockaddr_in6 struct.])
67641981
GH
455fi
456
38c1d3c4
GH
457AC_MSG_CHECKING(whether localtime caches TZ)
458AC_CACHE_VAL(guile_cv_localtime_cache,
459[if test x$ac_cv_func_tzset = xyes; then
460AC_TRY_RUN([#include <time.h>
461#if STDC_HEADERS
462# include <stdlib.h>
463#endif
464extern char **environ;
465unset_TZ ()
466{
467 char **from, **to;
468 for (to = from = environ; (*to = *from); from++)
469 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
470 to++;
471}
472char TZ_GMT0[] = "TZ=GMT0";
473char TZ_PST8[] = "TZ=PST8";
474main()
475{
476 time_t now = time ((time_t *) 0);
477 int hour_GMT0, hour_unset;
478 if (putenv (TZ_GMT0) != 0)
479 exit (1);
480 hour_GMT0 = localtime (&now)->tm_hour;
481 unset_TZ ();
482 hour_unset = localtime (&now)->tm_hour;
483 if (putenv (TZ_PST8) != 0)
484 exit (1);
485 if (localtime (&now)->tm_hour == hour_GMT0)
486 exit (1);
487 unset_TZ ();
488 if (localtime (&now)->tm_hour != hour_unset)
489 exit (1);
490 exit (0);
491}], guile_cv_localtime_cache=no, guile_cv_localtime_cache=yes,
492[# If we have tzset, assume the worst when cross-compiling.
493guile_cv_localtime_cache=yes])
494else
495 # If we lack tzset, report that localtime does not cache TZ,
496 # since we can't invalidate the cache if we don't have tzset.
497 guile_cv_localtime_cache=no
498fi])dnl
499AC_MSG_RESULT($guile_cv_localtime_cache)
500if test $guile_cv_localtime_cache = yes; then
eede3dbc 501 AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.])
38c1d3c4
GH
502fi
503
7ee92fce
GH
504dnl Test whether system calls are restartable by default on the
505dnl current system. If they are not, we put a loop around every system
506dnl call to check for EINTR (see SCM_SYSCALL) and do not attempt to
507dnl change from the default behaviour. On the other hand, if signals
508dnl are restartable then the loop is not installed and when libguile
509dnl initialises it also resets the behaviour of each signal to cause a
510dnl restart (in case a different runtime had a different default
511dnl behaviour for some reason: e.g., different versions of linux seem
512dnl to behave differently.)
513
08b8c694 514AC_SYS_RESTARTABLE_SYSCALLS
e1a191a8 515
52cfc69b
GH
516if test "$enable_regex" = yes; then
517 if test "$ac_cv_header_regex_h" = yes ||
518 test "$ac_cv_header_rxposix_h" = yes ||
519 test "$ac_cv_header_rx_rxposix_h" = yes; then
eede3dbc 520 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [AC_LIBOBJ([regex-posix])],
52cfc69b 521 [AC_CHECK_LIB(rx, main)
eede3dbc 522 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [AC_LIBOBJ([regex-posix])],
f9e5e096 523 [AC_CHECK_LIB(regex, main)
eede3dbc 524 GUILE_NAMED_CHECK_FUNC(regcomp, regex, [AC_LIBOBJ([regex-posix])])])]
52cfc69b
GH
525 )
526 dnl The following should not be necessary, but for some reason
527 dnl autoheader misses it if we don't include it!
528 if test "$ac_cv_func_regcomp_norx" = yes ||
f9e5e096 529 test "$ac_cv_func_regcomp_regex" = yes ||
52cfc69b 530 test "$ac_cv_func_regcomp_rx" = yes; then
eede3dbc
RB
531 AC_DEFINE(HAVE_REGCOMP, 1,
532 [This is included as part of a workaround for a autoheader bug.])
52cfc69b
GH
533 fi
534 fi
da88f0cb 535fi
8e1bfcd0 536
5bbfbd1e 537AC_REPLACE_FUNCS(inet_aton putenv strerror memmove mkstemp)
3a629497 538
594e69b7
MV
539AC_CHECK_HEADERS(floatingpoint.h ieeefp.h nan.h)
540
e9527dd6 541AC_CHECK_FUNCS(finite isinf isnan copysign)
594e69b7 542
4a5fa91c
TP
543# When testing for the presence of alloca, we need to add alloca.o
544# explicitly to LIBOBJS to make sure that it is translated to
545# `alloca.lo' for libtool later on. This can and should be done more cleanly.
3a629497 546AC_FUNC_ALLOCA
eede3dbc 547if test "$ALLOCA" = "alloca.o"; then AC_LIBOBJ([alloca]); fi
3a629497 548
237b3247
RB
549AC_CHECK_MEMBERS([struct stat.st_rdev])
550AC_CHECK_MEMBERS([struct stat.st_blksize])
551
552AC_STRUCT_ST_BLOCKS
075edbde 553
fd02f2ad
MD
554AC_CACHE_CHECK([for S_ISLNK in sys/stat.h], ac_cv_macro_S_ISLNK,
555 [AC_TRY_CPP([#include <sys/stat.h>
556 #ifndef S_ISLNK
557 #error no S_ISLNK
558 #endif],
559 ac_cv_macro_S_ISLNK=yes,
560 ac_cv_macro_S_ISLNK=no)])
561if test $ac_cv_macro_S_ISLNK = yes; then
eede3dbc
RB
562 AC_DEFINE(HAVE_S_ISLNK, 1,
563 [Define this if your system defines S_ISLNK in sys/stat.h.])
fd02f2ad
MD
564fi
565
3a629497
JB
566AC_STRUCT_TIMEZONE
567GUILE_STRUCT_UTIMBUF
568
3a629497
JB
569#--------------------------------------------------------------------
570#
571# Which way does the stack grow?
572#
573#--------------------------------------------------------------------
574
575AC_TRY_RUN(aux (l) unsigned long l;
576 { int x; exit (l >= ((unsigned long)&x)); }
01e5e07e 577 main () { int q; aux((unsigned long)&q); },
eede3dbc
RB
578 [AC_DEFINE([SCM_STACK_GROWS_UP], 1,
579 [Define this if a callee's stack frame has a higher address
580 than the caller's stack frame. On most machines, this is
581 not the case.])],
582 [],
583 [AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in)])
584
585AH_TEMPLATE([SCM_SINGLES],
586 [Define this if floats are the same size as longs.])
3a629497 587
3a171311
JB
588AC_CACHE_CHECK([whether floats fit in longs], guile_cv_type_float_fits_long,
589 [AC_TRY_RUN([main () { exit (sizeof(float) > sizeof(long)); }],
590 [guile_cv_type_float_fits_long=yes],
591 [guile_cv_type_float_fits_long=no],
592 [guile_cv_type_float_fits_long=guess-yes])])
593case $guile_cv_type_float_fits_long in
594 "yes" )
595 AC_DEFINE(SCM_SINGLES)
596 ;;
597 "guess-yes" )
598 AC_DEFINE(SCM_SINGLES)
599 AC_MSG_WARN([guessing that sizeof(long) == sizeof(float)])
600 AC_MSG_WARN([see SCM_SINGLES in scmconfig.h.in])
601 ;;
602esac
3a629497 603
3a629497
JB
604
605AC_MSG_CHECKING(for struct linger)
606AC_CACHE_VAL(scm_cv_struct_linger,
607 AC_TRY_COMPILE([
608#include <sys/types.h>
609#include <sys/socket.h>],
610 [struct linger lgr; lgr.l_linger = 100],
611 scm_cv_struct_linger="yes",
612 scm_cv_struct_linger="no"))
613AC_MSG_RESULT($scm_cv_struct_linger)
614if test $scm_cv_struct_linger = yes; then
eede3dbc
RB
615 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
616 [Define this if your system defines struct linger, for use with the
617 getsockopt and setsockopt system calls.])
3a629497 618fi
3a629497 619
7534dfdc
MD
620
621AC_MSG_CHECKING(for struct timespec)
622AC_CACHE_VAL(scm_cv_struct_timespec,
623 AC_TRY_COMPILE([
624#include <time.h>],
625 [struct timespec t; t.tv_nsec = 100],
626 scm_cv_struct_timespec="yes",
627 scm_cv_struct_timespec="no"))
628AC_MSG_RESULT($scm_cv_struct_timespec)
629if test $scm_cv_struct_timespec = yes; then
eede3dbc
RB
630 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
631 [Define this if your system defines struct timespec via <time.h>.])
7534dfdc
MD
632fi
633
3a629497
JB
634#--------------------------------------------------------------------
635#
636# Flags for thread support
637#
638#--------------------------------------------------------------------
639
539c89a1
JB
640### What thread package has the user asked for?
641AC_ARG_WITH(threads, [ --with-threads thread interface],
18622c4e 642 , with_threads=yes)
539c89a1 643
539c89a1 644case "$with_threads" in
9bc4701c 645 "yes" | "pthread" | "pthreads" | "pthread-threads" | "")
18622c4e
MV
646 AC_CHECK_LIB(pthread, main,
647 LIBS="-lpthread $LIBS"
9bc4701c
MD
648 AC_DEFINE(USE_PTHREAD_THREADS, 1,
649 [Define if using pthread multithreading.])
650 with_threads="pthreads",
18622c4e 651 with_threads="null")
09841c77
MD
652
653 if test $GCC = yes; then
654 AC_DEFINE(_THREAD_SAFE, 1,
655 [Use thread safe versions of GNU Libc functions.])
656 fi
657
658 AC_MSG_CHECKING(if pthread_mutexattr_settype is declared)
659 AC_CACHE_VAL(guile_cv_mutexattr_settype_declared,
660 [AC_TRY_COMPILE([#include <pthread.h>],
661 [int pthread_mutexattr_settype (int, int);],
662 guile_cv_mutexattr_settype_declared=no,
663 guile_cv_mutexattr_settype_declared=yes)])
664 AC_MSG_RESULT($guile_cv_mutexattr_settype_declared)
665 if test $guile_cv_mutexattr_settype_declared = yes; then
666 AC_DEFINE(SCM_MUTEXATTR_SETTYPE_DECLARED, 1,
667 [Define if pthread.h declares pthread_mutexattr_settype.])
668 fi
669
670 AC_MSG_CHECKING(how to get a fast mutex)
671 AC_CACHE_VAL(guile_cv_have_mutex_fast,
672 [AC_TRY_COMPILE([#include <pthread.h>],
673 [int a = PTHREAD_MUTEX_ADAPTIVE_NP;],
674 guile_cv_have_mutex_fast=PTHREAD_MUTEX_ADAPTIVE_NP,
675 guile_cv_have_mutex_fast=none)])
676 AC_MSG_RESULT($guile_cv_have_mutex_fast)
677 if test ! $guile_cv_have_mutex_fast = none; then
678 AC_DEFINE_UNQUOTED(SCM_MUTEX_FAST, $guile_cv_have_mutex_fast,
679 [The mutex kind enum for fast mutexes.])
680 fi
681
682 AC_MSG_CHECKING(how to get a recursive mutex)
683 AC_CACHE_VAL(guile_cv_have_mutex_recursive,
684 [AC_TRY_COMPILE([#include <pthread.h>],
685 [int a = PTHREAD_MUTEX_RECURSIVE_NP;],
686 guile_cv_have_mutex_recursive=PTHREAD_MUTEX_RECURSIVE_NP)
687 if test -z "$guile_cv_have_mutex_recursive"; then
688 AC_TRY_COMPILE([#include <pthread.h>],
689 [int a = PTHREAD_MUTEX_RECURSIVE;],
690 guile_cv_have_mutex_recursive=PTHREAD_MUTEX_RECURSIVE,
691 guile_cv_have_mutex_recursive=none)
692 fi])
693 AC_MSG_RESULT($guile_cv_have_mutex_recursive)
694 if test ! $guile_cv_have_mutex_recursive = none; then
695 AC_DEFINE_UNQUOTED(SCM_MUTEX_RECURSIVE, $guile_cv_have_mutex_recursive,
696 [The mutex kind enum for recursive mutexes.])
697 fi
539c89a1 698 ;;
539c89a1 699esac
3a629497 700
18622c4e 701case "$with_threads" in
9bc4701c 702 "pthreads")
585356dc 703 ;;
18622c4e 704 "no" | "null")
585356dc
MV
705 AC_DEFINE(USE_NULL_THREADS, 1,
706 [Define if using one-thread 'multi'threading.])
18622c4e 707 with_threads="null-threads"
18306183 708 ;;
585356dc 709 * )
18622c4e 710 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
585356dc
MV
711 ;;
712esac
539c89a1 713
18622c4e
MV
714AC_MSG_CHECKING(what kind of threads to support)
715AC_MSG_RESULT($with_threads)
933a7411 716
0db83c04
MV
717## Cross building
718if test "$cross_compiling" = "yes"; then
719 AC_MSG_CHECKING(cc for build)
720 ## /usr/bin/cc still uses wrong assembler
721 ## CC_FOR_BUILD="${CC_FOR_BUILD-/usr/bincc}"
722 CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}"
723else
724 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
725fi
726AC_ARG_WITH(cc-for-build,
727 [ --with-cc-for-build=CC native C compiler, to be used during build])
728test -n "$with_cc_for_build" && CC_FOR_BUILD="$with_cc_for_build"
729
730## AC_MSG_CHECKING("if we are cross compiling")
731## AC_MSG_RESULT($cross_compiling)
732if test "$cross_compiling" = "yes"; then
733 AC_MSG_RESULT($CC_FOR_BUILD)
734fi
735
736## No need as yet to be more elaborate
737CCLD_FOR_BUILD="$CC_FOR_BUILD"
738
739AC_SUBST(cross_compiling)
740AC_SUBST(CC_FOR_BUILD)
741AC_SUBST(CCLD_FOR_BUILD)
742
743## libtool erroneously calls CC_FOR_BUILD HOST_CC;
744## --HOST is the platform that PACKAGE is compiled for.
745HOST_CC="$CC_FOR_BUILD"
746AC_SUBST(HOST_CC)
747
748if test "$cross_compiling" = "yes"; then
749 AC_MSG_CHECKING(guile for build)
750 GUILE_FOR_BUILD="${GUILE_FOR_BUILD-guile}"
751else
752 GUILE_FOR_BUILD='$(preinstguile)'
753fi
754AC_ARG_WITH(guile-for-build,
755 [ --with-guile-for-build=guile native guile executable, to be used during build])
756test -n "$with_guile_for_build" && GUILE_FOR_BUILD="$with_guile_for_build"
757
758## AC_MSG_CHECKING("if we are cross compiling")
759## AC_MSG_RESULT($cross_compiling)
760if test "$cross_compiling" = "yes"; then
761 AC_MSG_RESULT($GUILE_FOR_BUILD)
762fi
763AC_SUBST(GUILE_FOR_BUILD)
764
bdcccc18
RB
765# Do this here so we don't screw up any of the tests above that might
766# not be "warning free"
767
768if test "${GUILE_ERROR_ON_WARNING}" = yes
769then
770 CFLAGS="${CFLAGS} -Werror"
771 enable_compile_warnings=no
772fi
773
3a629497
JB
774## If we're using GCC, ask for aggressive warnings.
775case "$GCC" in
99be3450 776 yes )
0a1b8b15
JB
777 ## We had -Wstrict-prototypes in here for a bit, but Guile does too
778 ## much stuff with generic function pointers for that to really be
779 ## less than exasperating.
aee8ca3f
GH
780 ## -Wpointer-arith was here too, but something changed in gcc/glibc
781 ## and it became equally exasperating (gcc 2.95 and/or glibc 2.1.2).
782 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" ;;
3a629497
JB
783esac
784
eede3dbc
RB
785## NOTE the code below sets LIBOBJS directly and so is now forbidden
786## -- I'm disabling it for now in the hopes that the newer autoconf
787## will DTRT -- if not, we need to fix up the sed command to match the
788## others...
789##
8f99e3f3
SJ
790## Remove fileblocks.o from the object list. This file gets added by
791## the Autoconf macro AC_STRUCT_ST_BLOCKS. But there is no need.
eede3dbc 792#LIBOBJS="`echo ${LIBOBJS} | sed 's/fileblocks\.o//g'`"
8f99e3f3 793
3a629497
JB
794## If we're creating a shared library (using libtool!), then we'll
795## need to generate a list of .lo files corresponding to the .o files
796## given in LIBOBJS. We'll call it LIBLOBJS.
eede3dbc 797LIBLOBJS="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`"
3a629497 798
e9e225e5 799## We also need to create corresponding .doc and .x files
eede3dbc
RB
800EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`"
801EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`"
91411868 802
7c86ae05
JB
803AC_SUBST(GUILE_MAJOR_VERSION)
804AC_SUBST(GUILE_MINOR_VERSION)
df4a8db0 805AC_SUBST(GUILE_MICRO_VERSION)
9e6e154e 806AC_SUBST(GUILE_EFFECTIVE_VERSION)
7c86ae05 807AC_SUBST(GUILE_VERSION)
9e202853 808
22b7f585
RB
809#######################################################################
810# library versioning
811
812AC_SUBST(LIBQTHREADS_INTERFACE_CURRENT)
813AC_SUBST(LIBQTHREADS_INTERFACE_REVISION)
814AC_SUBST(LIBQTHREADS_INTERFACE_AGE)
815AC_SUBST(LIBQTHREADS_INTERFACE)
816
9e202853
RB
817AC_SUBST(LIBGUILE_INTERFACE_CURRENT)
818AC_SUBST(LIBGUILE_INTERFACE_REVISION)
819AC_SUBST(LIBGUILE_INTERFACE_AGE)
820AC_SUBST(LIBGUILE_INTERFACE)
539c89a1 821
cfc7c7c0
MD
822AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_CURRENT)
823AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_REVISION)
824AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_AGE)
825AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE)
826
22b7f585
RB
827AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT)
828AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION)
829AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE)
830AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE)
831
832AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT)
833AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION)
834AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE)
835AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE)
836
837#######################################################################
838
bcc695e3 839dnl Tell guile-config what flags guile users should link against.
539c89a1 840GUILE_LIBS="$LDFLAGS $THREAD_LIBS_INSTALLED $LIBS"
daa4f38c 841AC_SUBST(GUILE_LIBS)
7c86ae05 842
3a629497
JB
843AC_SUBST(AWK)
844AC_SUBST(LIBLOBJS)
91411868 845AC_SUBST(EXTRA_DOT_DOC_FILES)
e9e225e5 846AC_SUBST(EXTRA_DOT_X_FILES)
3a629497 847
6812c28f
TTN
848dnl See also top_builddir in info node: (libtool)AC_PROG_LIBTOOL
849top_builddir_absolute=`pwd`
850AC_SUBST(top_builddir_absolute)
9e6e154e 851top_srcdir_absolute=`(cd $srcdir && pwd)`
2f13db9a 852AC_SUBST(top_srcdir_absolute)
6812c28f 853
237b3247
RB
854AC_CONFIG_FILES([
855 Makefile
6812c28f 856 am/Makefile
9e6e154e
RB
857 benchmark-suite/Makefile
858 doc/Makefile
859 doc/goops/Makefile
860 doc/r5rs/Makefile
861 doc/ref/Makefile
862 doc/tutorial/Makefile
863 examples/Makefile
864 examples/box-dynamic-module/Makefile
865 examples/box-dynamic/Makefile
866 examples/box-module/Makefile
867 examples/box/Makefile
868 examples/modules/Makefile
869 examples/safe/Makefile
870 examples/scripts/Makefile
871 guile-config/Makefile
237b3247 872 ice-9/Makefile
8ee7506b
NJ
873 ice-9/debugger/Makefile
874 ice-9/debugger/breakpoints/Makefile
3d1a89b9
NJ
875 lang/Makefile
876 lang/elisp/Makefile
877 lang/elisp/internals/Makefile
878 lang/elisp/primitives/Makefile
9e6e154e
RB
879 libguile-ltdl/Makefile
880 libguile-ltdl/upstream/Makefile
881 libguile/Makefile
237b3247
RB
882 oop/Makefile
883 oop/goops/Makefile
884 scripts/Makefile
885 srfi/Makefile
9e6e154e
RB
886 test-suite/Makefile])
887
888AC_CONFIG_FILES([check-guile], [chmod +x check-guile])
889AC_CONFIG_FILES([benchmark-guile], [chmod +x benchmark-guile])
890AC_CONFIG_FILES([guile-tools], [chmod +x guile-tools])
891AC_CONFIG_FILES([pre-inst-guile], [chmod +x pre-inst-guile])
892AC_CONFIG_FILES([libguile/guile-snarf],
893 [chmod +x libguile/guile-snarf])
894AC_CONFIG_FILES([libguile/guile-doc-snarf],
895 [chmod +x libguile/guile-doc-snarf])
896AC_CONFIG_FILES([libguile/guile-func-name-check],
897 [chmod +x libguile/guile-func-name-check])
898AC_CONFIG_FILES([libguile/guile-snarf-docs],
899 [chmod +x libguile/guile-snarf-docs])
237b3247
RB
900
901AC_OUTPUT
0f2d19dd 902
3a629497
JB
903dnl Local Variables:
904dnl comment-start: "dnl "
905dnl comment-end: ""
906dnl comment-start-skip: "\\bdnl\\b\\s *"
d67c13f6 907dnl End: