* scheme-modules.texi (Compiled Code Modules): replace
[bpt/guile.git] / configure.in
1 dnl configuration script for Guile
2 dnl Process this file with autoconf to produce configure.
3 dnl
4 dnl Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
5 dnl
6 dnl This file is part of GUILE
7 dnl
8 dnl GUILE is free software; you can redistribute it and/or modify it
9 dnl under the terms of the GNU General Public License as published by
10 dnl the Free Software Foundation; either version 2, or (at your
11 dnl option) any later version.
12 dnl
13 dnl GUILE is distributed in the hope that it will be useful, but
14 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
15 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 dnl General Public License for more details.
17 dnl
18 dnl You should have received a copy of the GNU General Public License
19 dnl along with GUILE; see the file COPYING. If not, write to the
20 dnl Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 dnl Boston, MA 02111-1307, USA.
22
23 AC_PREREQ(2.53)
24
25 AC_INIT
26 AC_CONFIG_SRCDIR([Makefile.in])
27 . $srcdir/GUILE-VERSION
28 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
29 AM_MAINTAINER_MODE
30 AM_CONFIG_HEADER(libguile/scmconfig.h)
31
32 #--------------------------------------------------------------------
33 #
34 # Independent Subdirectories
35 #
36 #--------------------------------------------------------------------
37
38 AC_CONFIG_SUBDIRS(guile-readline)
39
40 #--------------------------------------------------------------------
41 #
42 # User options
43 #
44 #--------------------------------------------------------------------
45
46 AC_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
54
55 AC_ARG_ENABLE(debug-freelist,
56 [ --enable-debug-freelist include garbage collector freelist debugging code],
57 if test "$enable_debug_freelist" = y || test "$enable_debug_freelist" = yes; then
58 AC_DEFINE(GUILE_DEBUG_FREELIST, 1,
59 [Define this if you want to debug the free list (helps w/ GC bugs).])
60 fi)
61
62 AC_ARG_ENABLE(debug-malloc,
63 [ --enable-debug-malloc include malloc debugging code],
64 if test "$enable_debug_malloc" = y || test "$enable_debug_malloc" = yes; then
65 AC_DEFINE(GUILE_DEBUG_MALLOC, 1,
66 [Define this if you want to debug scm_must_malloc/realloc/free calls.])
67 fi)
68
69 AC_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
72 AC_DEFINE(GUILE_DEBUG, 1,
73 [Define this to include various undocumented functions used to debug.])
74 fi)
75
76 AC_ARG_ENABLE(arrays,
77 [ --disable-arrays omit array and uniform array support],,
78 enable_arrays=yes)
79
80 AC_ARG_ENABLE(posix,
81 [ --disable-posix omit posix interfaces],,
82 enable_posix=yes)
83
84 AC_ARG_ENABLE(networking,
85 [ --disable-networking omit networking interfaces],,
86 enable_networking=yes)
87
88 AC_ARG_ENABLE(regex,
89 [ --disable-regex omit regular expression interfaces],,
90 enable_regex=yes)
91
92 AC_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
112 AM_CONDITIONAL(HTMLDOC, test x$htmldoc_enabled = xyes)
113
114 AC_ARG_ENABLE(deprecated,
115 [ --disable-deprecated omit deprecated features])
116
117 AH_TEMPLATE([SCM_ENABLE_DEPRECATED],
118 [Define this to 1 if you want to include deprecated features.])
119
120 if test "$enable_deprecated" = no; then
121 AC_DEFINE(SCM_ENABLE_DEPRECATED, 0)
122 else
123 if test "$enable_deprecated" = yes || test "$enable_deprecated" = ""; then
124 warn_default=summary
125 elif test "$enable_deprecated" = shutup; then
126 warn_default=no
127 else
128 warn_default=$enable_deprecated
129 fi
130 AC_DEFINE(SCM_ENABLE_DEPRECATED, 1)
131 AC_DEFINE_UNQUOTED(SCM_WARN_DEPRECATED_DEFAULT, "$warn_default",
132 [Define this to control the default warning level for deprecated features.])
133 fi
134
135 dnl The --disable-debug used to control these two. But now they are
136 dnl a required part of the distribution.
137 AC_DEFINE(DEBUG_EXTENSIONS, 1,
138 [Define if you want support for debugging Scheme programs.])
139 AC_DEFINE(READER_EXTENSIONS, 1,
140 [Define if you want support for debugging Scheme programs.])
141
142 AC_ARG_ENABLE(elisp,
143 [ --disable-elisp omit Emacs Lisp support],,
144 enable_elisp=yes)
145
146 #--------------------------------------------------------------------
147
148 dnl Some more checks for Win32
149 AC_CYGWIN
150 AC_MINGW32
151 AC_LIBTOOL_WIN32_DLL
152
153 AC_LIBLTDL_INSTALLABLE
154 AC_CONFIG_SUBDIRS(libltdl)
155
156 AC_PROG_INSTALL
157 AC_PROG_CC
158 AC_PROG_CPP
159 AC_LIBTOOL_DLOPEN
160
161 AC_AIX
162 AC_ISC_POSIX
163 AC_MINIX
164
165 AM_PROG_CC_STDC
166
167 ## Needed for building DLLs on Cygwin, before AM_PROG_LIBTOOL
168 AC_LIBTOOL_WIN32_DLL
169 AM_PROG_LIBTOOL
170
171 AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
172 AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
173
174 dnl Check for dynamic linking
175
176 use_modules=yes
177 AC_ARG_WITH(modules,
178 [ --with-modules[=FILES] Add support for dynamic modules],
179 use_modules="$withval")
180 test -z "$use_modules" && use_modules=yes
181 DLPREOPEN=
182 if 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
193 fi
194
195 dnl files which are destined for separate modules.
196
197 if test "$use_modules" != no; then
198 AC_LIBOBJ([dynl])
199 fi
200
201 if test "$enable_arrays" = yes; then
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.])
206 fi
207
208 if test "$enable_posix" = yes; then
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.])
213 fi
214
215 if test "$enable_networking" = yes; then
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.])
220 fi
221
222 if test "$enable_debug_malloc" = yes; then
223 AC_LIBOBJ([debug-malloc])
224 fi
225
226 if test "$enable_elisp" = yes; then
227 AC_DEFINE(SCM_ENABLE_ELISP, 1,
228 [Define this if you want Elisp support (in addition to Scheme).])
229 fi
230
231
232 AC_C_CONST
233 AC_C_INLINE
234 AC_C_BIGENDIAN
235
236 if test "$ac_cv_c_inline" != no; then
237 AC_DEFINE(HAVE_INLINE, 1,
238 [Define if the compiler supports inline functions.])
239 fi
240
241 AC_CHECK_SIZEOF(short)
242 AC_CHECK_SIZEOF(int)
243 AC_CHECK_SIZEOF(long)
244 AC_CHECK_SIZEOF(size_t)
245
246 dnl Check for integral types that can represent the range of pointers.
247 dnl If these types don't exist on this platform, they are replaced by
248 dnl "unsigned long" and "long", respectively.
249
250 AC_CHECK_HEADERS(stdint.h)
251 AC_CHECK_HEADERS(inttypes.h)
252 AC_CHECK_SIZEOF(uintptr_t)
253 AC_CHECK_SIZEOF(ptrdiff_t)
254
255 AC_CHECK_SIZEOF(long long)
256
257 AC_CHECK_SIZEOF(void *)
258
259 if test "$ac_cv_sizeof_long" -ne "$ac_cv_sizeof_void_p"; then
260 AC_MSG_ERROR(sizes of long and void* are not identical)
261 fi
262
263 AC_HEADER_STDC
264 AC_HEADER_DIRENT
265 AC_HEADER_TIME
266 AC_HEADER_SYS_WAIT
267 AC_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)
268 GUILE_HEADER_LIBC_WITH_UNISTD
269
270 AC_TYPE_GETGROUPS
271 AC_TYPE_SIGNAL
272 AC_TYPE_MODE_T
273
274 AC_CHECK_LIB(m, main)
275 AC_CHECK_FUNCS(gethostbyname)
276 if test $ac_cv_func_gethostbyname = no; then
277 AC_CHECK_LIB(nsl, gethostbyname)
278 fi
279
280 AC_CHECK_FUNCS(connect)
281 if test $ac_cv_func_connect = no; then
282 AC_CHECK_LIB(socket, connect)
283 fi
284
285 dnl
286 dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
287 dnl
288 EXTRA_DEFS=""
289 if test "$MINGW32" = "yes" ; then
290 AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCK2_H], 1,
291 [Define if you have the <winsock2.h> header file.])])
292 AC_CHECK_LIB(ws2_32, main)
293 AC_LIBOBJ([win32-uname])
294 AC_LIBOBJ([win32-dirent])
295 if test "$enable_networking" = yes ; then
296 AC_LIBOBJ([win32-socket])
297 fi
298 if test "$enable_shared" = yes ; then
299 EXTRA_DEFS="-DSCM_IMPORT"
300 AC_DEFINE(USE_DLL_IMPORT, 1,
301 [Define if you need additional CPP macros on Win32 platforms.])
302 fi
303 if test x"$enable_ltdl_install" = x"yes" ; then
304 INCLTDL="-DLIBLTDL_DLL_IMPORT $INCLTDL"
305 fi
306 fi
307 AC_SUBST(EXTRA_DEFS)
308
309 AC_SUBST(INCLTDL)
310 AC_SUBST(LIBLTDL)
311 AC_SUBST(DLPREOPEN)
312
313 AC_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)
314
315 AC_CHECK_HEADERS(crypt.h sys/resource.h sys/file.h)
316 AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
317 AC_CHECK_LIB(crypt, crypt)
318
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.
326 AC_DEFUN(GUILE_FUNC_DECLARED, [
327 AC_CACHE_CHECK(for $1 declaration, guile_cv_func_$1_declared,
328 AC_EGREP_HEADER($1, $2,
329 guile_cv_func_$1_declared=yes,
330 guile_cv_func_$1_declared=no))
331 if test [x$guile_cv_func_]$1[_declared] = xno; then
332 AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL], 1,
333 [Define if the operating system supplies $1 without declaring it.])
334 fi
335 ])
336
337 GUILE_FUNC_DECLARED(strptime, time.h)
338 GUILE_FUNC_DECLARED(sleep, unistd.h)
339 GUILE_FUNC_DECLARED(usleep, unistd.h)
340
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.
343 AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type,
344 [AC_EGREP_HEADER(changequote(<, >)<void[ ]+usleep>changequote([, ]),
345 unistd.h,
346 [guile_cv_func_usleep_return_type=void],
347 [guile_cv_func_usleep_return_type=int])])
348 case "$guile_cv_func_usleep_return_type" in
349 "void" )
350 AC_DEFINE(USLEEP_RETURNS_VOID, 1,
351 [Define if the system headers declare usleep to return void.])
352 ;;
353 esac
354
355 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
356 if test -n "$have_sys_un_h" ; then
357 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS, 1,
358 [Define if the system supports Unix-domain (file-domain) sockets.])
359 fi
360
361 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
362
363 AC_CHECK_FUNCS(sethostent gethostent endhostent dnl
364 setnetent getnetent endnetent dnl
365 setprotoent getprotoent endprotoent dnl
366 setservent getservent endservent dnl
367 getnetbyaddr getnetbyname dnl
368 inet_lnaof inet_makeaddr inet_netof hstrerror dnl
369 inet_pton inet_ntop)
370
371 dnl Some systems do not declare this. Some systems do declare it, as a
372 dnl macro. With cygwin it may be in a DLL.
373
374 AC_MSG_CHECKING(whether netdb.h declares h_errno)
375 AC_CACHE_VAL(guile_cv_have_h_errno,
376 [AC_TRY_COMPILE([#include <netdb.h>],
377 [int a = h_errno;],
378 guile_cv_have_h_errno=yes, guile_cv_have_h_errno=no)])
379 AC_MSG_RESULT($guile_cv_have_h_errno)
380 if test $guile_cv_have_h_errno = yes; then
381 AC_DEFINE(HAVE_H_ERRNO, 1, [Define if h_errno is declared in netdb.h.])
382 fi
383
384 AC_MSG_CHECKING(whether uint32_t is defined)
385 AC_CACHE_VAL(guile_cv_have_uint32_t,
386 [AC_TRY_COMPILE([#include <sys/types.h>
387 #if HAVE_STDINT_H
388 #include <stdint.h>
389 #endif
390 #ifndef __MINGW32__
391 #include <netdb.h>
392 #endif],
393 [uint32_t a;],
394 guile_cv_have_uint32_t=yes, guile_cv_have_uint32_t=no)])
395 AC_MSG_RESULT($guile_cv_have_uint32_t)
396 if test $guile_cv_have_uint32_t = yes; then
397 AC_DEFINE(HAVE_UINT32_T, 1,
398 [Define if uint32_t typedef is defined when netdb.h is include.])
399 fi
400
401 AC_MSG_CHECKING(for working IPv6 support)
402 AC_CACHE_VAL(guile_cv_have_ipv6,
403 [AC_TRY_COMPILE([
404 #ifdef HAVE_SYS_TYPES_H
405 #include <sys/types.h>
406 #endif
407 #include <netinet/in.h>
408 #include <sys/socket.h>],
409 [struct sockaddr_in6 a; a.sin6_family = AF_INET6;],
410 guile_cv_have_ipv6=yes, guile_cv_have_ipv6=no)])
411 AC_MSG_RESULT($guile_cv_have_ipv6)
412 if test $guile_cv_have_ipv6 = yes; then
413 AC_DEFINE(HAVE_IPV6, 1, [Define if you want support for IPv6.])
414 fi
415
416 # included in rfc2553 but not in older implementations, e.g., glibc 2.1.3.
417 AC_MSG_CHECKING(whether sockaddr_in6 has sin6_scope_id)
418 AC_CACHE_VAL(guile_cv_have_sin6_scope_id,
419 [AC_TRY_COMPILE([
420 #ifdef HAVE_SYS_TYPES_H
421 #include <sys/types.h>
422 #endif
423 #include <netinet/in.h>],
424 [struct sockaddr_in6 sok; sok.sin6_scope_id = 0;],
425 guile_cv_have_sin6_scope_id=yes, guile_cv_have_sin6_scope_id=no)])
426 AC_MSG_RESULT($guile_cv_have_sin6_scope_id)
427 if test $guile_cv_have_sin6_scope_id = yes; then
428 AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1,
429 [Define this if your IPv6 has sin6_scope_id in sockaddr_in6 struct.])
430 fi
431
432 AC_MSG_CHECKING(whether localtime caches TZ)
433 AC_CACHE_VAL(guile_cv_localtime_cache,
434 [if test x$ac_cv_func_tzset = xyes; then
435 AC_TRY_RUN([#include <time.h>
436 #if STDC_HEADERS
437 # include <stdlib.h>
438 #endif
439 extern char **environ;
440 unset_TZ ()
441 {
442 char **from, **to;
443 for (to = from = environ; (*to = *from); from++)
444 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
445 to++;
446 }
447 char TZ_GMT0[] = "TZ=GMT0";
448 char TZ_PST8[] = "TZ=PST8";
449 main()
450 {
451 time_t now = time ((time_t *) 0);
452 int hour_GMT0, hour_unset;
453 if (putenv (TZ_GMT0) != 0)
454 exit (1);
455 hour_GMT0 = localtime (&now)->tm_hour;
456 unset_TZ ();
457 hour_unset = localtime (&now)->tm_hour;
458 if (putenv (TZ_PST8) != 0)
459 exit (1);
460 if (localtime (&now)->tm_hour == hour_GMT0)
461 exit (1);
462 unset_TZ ();
463 if (localtime (&now)->tm_hour != hour_unset)
464 exit (1);
465 exit (0);
466 }], guile_cv_localtime_cache=no, guile_cv_localtime_cache=yes,
467 [# If we have tzset, assume the worst when cross-compiling.
468 guile_cv_localtime_cache=yes])
469 else
470 # If we lack tzset, report that localtime does not cache TZ,
471 # since we can't invalidate the cache if we don't have tzset.
472 guile_cv_localtime_cache=no
473 fi])dnl
474 AC_MSG_RESULT($guile_cv_localtime_cache)
475 if test $guile_cv_localtime_cache = yes; then
476 AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.])
477 fi
478
479 dnl Test whether system calls are restartable by default on the
480 dnl current system. If they are not, we put a loop around every system
481 dnl call to check for EINTR (see SCM_SYSCALL) and do not attempt to
482 dnl change from the default behaviour. On the other hand, if signals
483 dnl are restartable then the loop is not installed and when libguile
484 dnl initialises it also resets the behaviour of each signal to cause a
485 dnl restart (in case a different runtime had a different default
486 dnl behaviour for some reason: e.g., different versions of linux seem
487 dnl to behave differently.)
488
489 AC_SYS_RESTARTABLE_SYSCALLS
490
491 if test "$enable_regex" = yes; then
492 if test "$ac_cv_header_regex_h" = yes ||
493 test "$ac_cv_header_rxposix_h" = yes ||
494 test "$ac_cv_header_rx_rxposix_h" = yes; then
495 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [AC_LIBOBJ([regex-posix])],
496 [AC_CHECK_LIB(rx, main)
497 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [AC_LIBOBJ([regex-posix])],
498 [AC_CHECK_LIB(regex, main)
499 GUILE_NAMED_CHECK_FUNC(regcomp, regex, [AC_LIBOBJ([regex-posix])])])]
500 )
501 dnl The following should not be necessary, but for some reason
502 dnl autoheader misses it if we don't include it!
503 if test "$ac_cv_func_regcomp_norx" = yes ||
504 test "$ac_cv_func_regcomp_regex" = yes ||
505 test "$ac_cv_func_regcomp_rx" = yes; then
506 AC_DEFINE(HAVE_REGCOMP, 1,
507 [This is included as part of a workaround for a autoheader bug.])
508 fi
509 fi
510 fi
511
512 AC_REPLACE_FUNCS(inet_aton putenv strerror memmove mkstemp)
513
514 AC_CHECK_HEADERS(floatingpoint.h ieeefp.h nan.h)
515
516 AC_CHECK_FUNCS(finite isinf isnan copysign)
517
518 # When testing for the presence of alloca, we need to add alloca.o
519 # explicitly to LIBOBJS to make sure that it is translated to
520 # `alloca.lo' for libtool later on. This can and should be done more cleanly.
521 AC_FUNC_ALLOCA
522 if test "$ALLOCA" = "alloca.o"; then AC_LIBOBJ([alloca]); fi
523
524 AC_CHECK_MEMBERS([struct stat.st_rdev])
525 AC_CHECK_MEMBERS([struct stat.st_blksize])
526
527 AC_STRUCT_ST_BLOCKS
528
529 AC_CACHE_CHECK([for S_ISLNK in sys/stat.h], ac_cv_macro_S_ISLNK,
530 [AC_TRY_CPP([#include <sys/stat.h>
531 #ifndef S_ISLNK
532 #error no S_ISLNK
533 #endif],
534 ac_cv_macro_S_ISLNK=yes,
535 ac_cv_macro_S_ISLNK=no)])
536 if test $ac_cv_macro_S_ISLNK = yes; then
537 AC_DEFINE(HAVE_S_ISLNK, 1,
538 [Define this if your system defines S_ISLNK in sys/stat.h.])
539 fi
540
541 AC_STRUCT_TIMEZONE
542 GUILE_STRUCT_UTIMBUF
543
544 #--------------------------------------------------------------------
545 #
546 # Which way does the stack grow?
547 #
548 #--------------------------------------------------------------------
549
550 AC_TRY_RUN(aux (l) unsigned long l;
551 { int x; exit (l >= ((unsigned long)&x)); }
552 main () { int q; aux((unsigned long)&q); },
553 [AC_DEFINE([SCM_STACK_GROWS_UP], 1,
554 [Define this if a callee's stack frame has a higher address
555 than the caller's stack frame. On most machines, this is
556 not the case.])],
557 [],
558 [AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in)])
559
560 AH_TEMPLATE([SCM_SINGLES],
561 [Define this if floats are the same size as longs.])
562
563 AC_CACHE_CHECK([whether floats fit in longs], guile_cv_type_float_fits_long,
564 [AC_TRY_RUN([main () { exit (sizeof(float) > sizeof(long)); }],
565 [guile_cv_type_float_fits_long=yes],
566 [guile_cv_type_float_fits_long=no],
567 [guile_cv_type_float_fits_long=guess-yes])])
568 case $guile_cv_type_float_fits_long in
569 "yes" )
570 AC_DEFINE(SCM_SINGLES)
571 ;;
572 "guess-yes" )
573 AC_DEFINE(SCM_SINGLES)
574 AC_MSG_WARN([guessing that sizeof(long) == sizeof(float)])
575 AC_MSG_WARN([see SCM_SINGLES in scmconfig.h.in])
576 ;;
577 esac
578
579
580 AC_MSG_CHECKING(for struct linger)
581 AC_CACHE_VAL(scm_cv_struct_linger,
582 AC_TRY_COMPILE([
583 #include <sys/types.h>
584 #include <sys/socket.h>],
585 [struct linger lgr; lgr.l_linger = 100],
586 scm_cv_struct_linger="yes",
587 scm_cv_struct_linger="no"))
588 AC_MSG_RESULT($scm_cv_struct_linger)
589 if test $scm_cv_struct_linger = yes; then
590 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
591 [Define this if your system defines struct linger, for use with the
592 getsockopt and setsockopt system calls.])
593 fi
594
595
596 AC_MSG_CHECKING(for struct timespec)
597 AC_CACHE_VAL(scm_cv_struct_timespec,
598 AC_TRY_COMPILE([
599 #include <time.h>],
600 [struct timespec t; t.tv_nsec = 100],
601 scm_cv_struct_timespec="yes",
602 scm_cv_struct_timespec="no"))
603 AC_MSG_RESULT($scm_cv_struct_timespec)
604 if test $scm_cv_struct_timespec = yes; then
605 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
606 [Define this if your system defines struct timespec via <time.h>.])
607 fi
608
609 #--------------------------------------------------------------------
610 #
611 # Flags for thread support
612 #
613 #--------------------------------------------------------------------
614
615 ### What thread package has the user asked for?
616 AC_ARG_WITH(threads, [ --with-threads thread interface],
617 , with_threads=no)
618
619 ### Turn $with_threads into either the name of a threads package, like
620 ### `qt', or `no', meaning that threads should not be supported.
621 AC_MSG_CHECKING(whether to support threads)
622 case "$with_threads" in
623 "yes" | "qt" | "coop" | "")
624 with_threads=qt
625 ;;
626 "no" )
627 ;;
628 * )
629 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
630 ;;
631 esac
632 AC_MSG_RESULT($with_threads)
633
634 ## Make sure the threads package we've chosen is actually supported on
635 ## the present platform.
636 case "${with_threads}" in
637 "qt" )
638 ## This configures the QuickThreads package, and sets or clears
639 ## the THREAD_PACKAGE variable if qthreads don't configure
640 ## correctly.
641 QTHREADS_CONFIGURE
642 ;;
643 esac
644
645 ## If we're using threads, bring in some other parts of Guile which
646 ## work with them.
647 if test "${THREAD_PACKAGE}" != "" ; then
648 AC_DEFINE(USE_THREADS, 1, [Define if using any sort of threads.])
649
650 ## Include the Guile thread interface in the library...
651 AC_LIBOBJ([threads])
652
653 ## ... and tell it which package to talk to.
654 case "${THREAD_PACKAGE}" in
655 "QT" )
656 AC_DEFINE(USE_COOP_THREADS, 1,
657 [Define if using cooperative multithreading.])
658 ;;
659 * )
660 AC_MSG_ERROR(invalid value for THREAD_PACKAGE: ${THREAD_PACKAGE})
661 ;;
662 esac
663
664 ## Bring in scm_internal_select, if appropriate.
665 if test $ac_cv_func_gettimeofday = yes &&
666 test $ac_cv_func_select = yes; then
667 AC_DEFINE(GUILE_ISELECT, 1, [Define to implement scm_internal_select.])
668 fi
669
670 AC_ARG_ENABLE(linuxthreads,
671 [ --disable-linuxthreads disable linuxthreads workaround],,
672 enable_linuxthreads=yes)
673
674 ## Workaround for linuxthreads (optionally disabled)
675 if test $host_os = linux-gnu -a "$enable_linuxthreads" = yes; then
676 AC_DEFINE(GUILE_PTHREAD_COMPAT, 1,
677 [Define to enable workaround for COOP-linuxthreads compatibility.])
678 AC_CHECK_LIB(pthread, main)
679 fi
680 fi
681
682 ## Cross building
683 if test "$cross_compiling" = "yes"; then
684 AC_MSG_CHECKING(cc for build)
685 ## /usr/bin/cc still uses wrong assembler
686 ## CC_FOR_BUILD="${CC_FOR_BUILD-/usr/bincc}"
687 CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}"
688 else
689 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
690 fi
691 AC_ARG_WITH(cc-for-build,
692 [ --with-cc-for-build=CC native C compiler, to be used during build])
693 test -n "$with_cc_for_build" && CC_FOR_BUILD="$with_cc_for_build"
694
695 ## AC_MSG_CHECKING("if we are cross compiling")
696 ## AC_MSG_RESULT($cross_compiling)
697 if test "$cross_compiling" = "yes"; then
698 AC_MSG_RESULT($CC_FOR_BUILD)
699 fi
700
701 ## No need as yet to be more elaborate
702 CCLD_FOR_BUILD="$CC_FOR_BUILD"
703
704 AC_SUBST(cross_compiling)
705 AC_SUBST(CC_FOR_BUILD)
706 AC_SUBST(CCLD_FOR_BUILD)
707
708 ## libtool erroneously calls CC_FOR_BUILD HOST_CC;
709 ## --HOST is the platform that PACKAGE is compiled for.
710 HOST_CC="$CC_FOR_BUILD"
711 AC_SUBST(HOST_CC)
712
713 if test "$cross_compiling" = "yes"; then
714 AC_MSG_CHECKING(guile for build)
715 GUILE_FOR_BUILD="${GUILE_FOR_BUILD-guile}"
716 else
717 GUILE_FOR_BUILD='$(preinstguile)'
718 fi
719 AC_ARG_WITH(guile-for-build,
720 [ --with-guile-for-build=guile native guile executable, to be used during build])
721 test -n "$with_guile_for_build" && GUILE_FOR_BUILD="$with_guile_for_build"
722
723 ## AC_MSG_CHECKING("if we are cross compiling")
724 ## AC_MSG_RESULT($cross_compiling)
725 if test "$cross_compiling" = "yes"; then
726 AC_MSG_RESULT($GUILE_FOR_BUILD)
727 fi
728 AC_SUBST(GUILE_FOR_BUILD)
729
730 ## If we're using GCC, ask for aggressive warnings.
731 case "$GCC" in
732 yes )
733 ## We had -Wstrict-prototypes in here for a bit, but Guile does too
734 ## much stuff with generic function pointers for that to really be
735 ## less than exasperating.
736 ## -Wpointer-arith was here too, but something changed in gcc/glibc
737 ## and it became equally exasperating (gcc 2.95 and/or glibc 2.1.2).
738 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" ;;
739 esac
740
741 AC_PROG_AWK
742
743 ## NOTE the code below sets LIBOBJS directly and so is now forbidden
744 ## -- I'm disabling it for now in the hopes that the newer autoconf
745 ## will DTRT -- if not, we need to fix up the sed command to match the
746 ## others...
747 ##
748 ## Remove fileblocks.o from the object list. This file gets added by
749 ## the Autoconf macro AC_STRUCT_ST_BLOCKS. But there is no need.
750 #LIBOBJS="`echo ${LIBOBJS} | sed 's/fileblocks\.o//g'`"
751
752 ## If we're creating a shared library (using libtool!), then we'll
753 ## need to generate a list of .lo files corresponding to the .o files
754 ## given in LIBOBJS. We'll call it LIBLOBJS.
755 LIBLOBJS="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`"
756
757 ## We also need to create corresponding .doc and .x files
758 EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`"
759 EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`"
760
761 AC_SUBST(GUILE_MAJOR_VERSION)
762 AC_SUBST(GUILE_MINOR_VERSION)
763 AC_SUBST(GUILE_MICRO_VERSION)
764 AC_SUBST(GUILE_VERSION)
765
766 #######################################################################
767 # library versioning
768
769 AC_SUBST(LIBQTHREADS_INTERFACE_CURRENT)
770 AC_SUBST(LIBQTHREADS_INTERFACE_REVISION)
771 AC_SUBST(LIBQTHREADS_INTERFACE_AGE)
772 AC_SUBST(LIBQTHREADS_INTERFACE)
773
774 AC_SUBST(LIBGUILE_INTERFACE_CURRENT)
775 AC_SUBST(LIBGUILE_INTERFACE_REVISION)
776 AC_SUBST(LIBGUILE_INTERFACE_AGE)
777 AC_SUBST(LIBGUILE_INTERFACE)
778
779 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT)
780 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION)
781 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE)
782 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE)
783
784 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT)
785 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION)
786 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE)
787 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE)
788
789 #######################################################################
790
791 dnl Tell guile-config what flags guile users should link against.
792 GUILE_LIBS="$LDFLAGS $THREAD_LIBS_INSTALLED $LIBS"
793 AC_SUBST(GUILE_LIBS)
794
795 AC_SUBST(AWK)
796 AC_SUBST(LIBLOBJS)
797 AC_SUBST(EXTRA_DOT_DOC_FILES)
798 AC_SUBST(EXTRA_DOT_X_FILES)
799
800 dnl See also top_builddir in info node: (libtool)AC_PROG_LIBTOOL
801 top_builddir_absolute=`pwd`
802 AC_SUBST(top_builddir_absolute)
803 top_srcdir_absolute=`(cd $srcdir ; pwd)`
804 AC_SUBST(top_srcdir_absolute)
805
806 AC_CONFIG_FILES([
807 Makefile
808 am/Makefile
809 libguile/Makefile
810 libguile/guile-snarf
811 libguile/guile-doc-snarf
812 libguile/guile-func-name-check
813 libguile/guile-snarf-docs
814 libguile/version.h
815 ice-9/Makefile
816 lang/Makefile
817 lang/elisp/Makefile
818 lang/elisp/internals/Makefile
819 lang/elisp/primitives/Makefile
820 oop/Makefile
821 oop/goops/Makefile
822 scripts/Makefile
823 srfi/Makefile
824 qt/Makefile
825 qt/qt.h
826 qt/md/Makefile
827 qt/time/Makefile
828 guile-config/Makefile
829 doc/Makefile
830 doc/ref/Makefile
831 doc/tutorial/Makefile
832 doc/goops/Makefile
833 doc/r5rs/Makefile
834 examples/Makefile
835 examples/scripts/Makefile
836 examples/box/Makefile
837 examples/box-module/Makefile
838 examples/box-dynamic/Makefile
839 examples/box-dynamic-module/Makefile
840 examples/modules/Makefile
841 examples/safe/Makefile
842 test-suite/Makefile
843 check-guile
844 benchmark-suite/Makefile
845 benchmark-guile
846 guile-tools
847 pre-inst-guile])
848
849 AC_CONFIG_COMMANDS(default,
850 [ chmod +x libguile/guile-snarf \
851 libguile/guile-doc-snarf \
852 libguile/guile-func-name-check \
853 libguile/guile-snarf-docs \
854 check-guile \
855 benchmark-guile \
856 guile-tools \
857 pre-inst-guile])
858
859 AC_OUTPUT
860
861 dnl Local Variables:
862 dnl comment-start: "dnl "
863 dnl comment-end: ""
864 dnl comment-start-skip: "\\bdnl\\b\\s *"
865 dnl End: