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