* configure.in: turn on -Werror by default. We're now clean. I'd
[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, 2002 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 GUILE_ERROR_ON_WARNING="yes"
47
48 AC_ARG_ENABLE(error-on-warning,
49 [ --enable-error-on-warning treat compile warnings as errors],
50 [case "${enableval}" in
51 yes | y) GUILE_ERROR_ON_WARNING="yes" ;;
52 no | n) GUILE_ERROR_ON_WARNING="no" ;;
53 *) AC_MSG_ERROR(bad value ${enableval} for --enable-error-on-warning) ;;
54 esac])
55
56 AC_ARG_ENABLE(debug-freelist,
57 [ --enable-debug-freelist include garbage collector freelist debugging code],
58 if test "$enable_debug_freelist" = y || test "$enable_debug_freelist" = yes; then
59 AC_DEFINE(GUILE_DEBUG_FREELIST, 1,
60 [Define this if you want to debug the free list (helps w/ GC bugs).])
61 fi)
62
63 AC_ARG_ENABLE(debug-malloc,
64 [ --enable-debug-malloc include malloc debugging code],
65 if test "$enable_debug_malloc" = y || test "$enable_debug_malloc" = yes; then
66 AC_DEFINE(GUILE_DEBUG_MALLOC, 1,
67 [Define this if you want to debug scm_must_malloc/realloc/free calls.])
68 fi)
69
70 AC_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
73 AC_DEFINE(GUILE_DEBUG, 1,
74 [Define this to include various undocumented functions used to debug.])
75 fi)
76
77 AC_ARG_ENABLE(arrays,
78 [ --disable-arrays omit array and uniform array support],,
79 enable_arrays=yes)
80
81 AC_ARG_ENABLE(posix,
82 [ --disable-posix omit posix interfaces],,
83 enable_posix=yes)
84
85 AC_ARG_ENABLE(networking,
86 [ --disable-networking omit networking interfaces],,
87 enable_networking=yes)
88
89 AC_ARG_ENABLE(regex,
90 [ --disable-regex omit regular expression interfaces],,
91 enable_regex=yes)
92
93 AC_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
113 AM_CONDITIONAL(HTMLDOC, test x$htmldoc_enabled = xyes)
114
115 AC_ARG_ENABLE(deprecated,
116 [ --disable-deprecated omit deprecated features])
117
118 AH_TEMPLATE([SCM_ENABLE_DEPRECATED],
119 [Define this to 1 if you want to include deprecated features.])
120
121 if test "$enable_deprecated" = no; then
122 AC_DEFINE(SCM_ENABLE_DEPRECATED, 0)
123 else
124 if test "$enable_deprecated" = yes || test "$enable_deprecated" = ""; then
125 warn_default=summary
126 elif test "$enable_deprecated" = shutup; then
127 warn_default=no
128 else
129 warn_default=$enable_deprecated
130 fi
131 AC_DEFINE(SCM_ENABLE_DEPRECATED, 1)
132 AC_DEFINE_UNQUOTED(SCM_WARN_DEPRECATED_DEFAULT, "$warn_default",
133 [Define this to control the default warning level for deprecated features.])
134 fi
135
136 dnl The --disable-debug used to control these two. But now they are
137 dnl a required part of the distribution.
138 AC_DEFINE(DEBUG_EXTENSIONS, 1,
139 [Define if you want support for debugging Scheme programs.])
140 AC_DEFINE(READER_EXTENSIONS, 1,
141 [Define if you want support for debugging Scheme programs.])
142
143 AC_ARG_ENABLE(elisp,
144 [ --disable-elisp omit Emacs Lisp support],,
145 enable_elisp=yes)
146
147 #--------------------------------------------------------------------
148
149 dnl Some more checks for Win32
150 AC_CYGWIN
151 AC_MINGW32
152 AC_LIBTOOL_WIN32_DLL
153
154 AC_PROG_INSTALL
155 AC_PROG_CC
156 AC_PROG_CPP
157 AC_PROG_AWK
158
159 AC_AIX
160 AC_ISC_POSIX
161 AC_MINIX
162
163 AM_PROG_CC_STDC
164
165 AC_LIBTOOL_DLOPEN
166 AM_PROG_LIBTOOL
167 AC_LIB_LTDL
168
169 AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
170 AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
171
172 dnl Check for dynamic linking
173
174 use_modules=yes
175 AC_ARG_WITH(modules,
176 [ --with-modules[=FILES] Add support for dynamic modules],
177 use_modules="$withval")
178 test -z "$use_modules" && use_modules=yes
179 DLPREOPEN=
180 if 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
191 fi
192
193 dnl files which are destined for separate modules.
194
195 if test "$use_modules" != no; then
196 AC_LIBOBJ([dynl])
197 fi
198
199 if test "$enable_arrays" = yes; then
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.])
204 fi
205
206 if test "$enable_posix" = yes; then
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.])
211 fi
212
213 if test "$enable_networking" = yes; then
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.])
218 fi
219
220 if test "$enable_debug_malloc" = yes; then
221 AC_LIBOBJ([debug-malloc])
222 fi
223
224 if test "$enable_elisp" = yes; then
225 AC_DEFINE(SCM_ENABLE_ELISP, 1,
226 [Define this if you want Elisp support (in addition to Scheme).])
227 fi
228
229
230 AC_C_CONST
231 AC_C_INLINE
232 AC_C_BIGENDIAN
233
234 if test "$ac_cv_c_inline" != no; then
235 AC_DEFINE(HAVE_INLINE, 1,
236 [Define if the compiler supports inline functions.])
237 fi
238
239 AC_CHECK_SIZEOF(short)
240 AC_CHECK_SIZEOF(int)
241 AC_CHECK_SIZEOF(long)
242 AC_CHECK_SIZEOF(size_t)
243
244 dnl Check for integral types that can represent the range of pointers.
245 dnl If these types don't exist on this platform, they are replaced by
246 dnl "unsigned long" and "long", respectively.
247
248 AC_CHECK_HEADERS(stdint.h)
249 AC_CHECK_HEADERS(inttypes.h)
250 AC_CHECK_SIZEOF(uintptr_t)
251 AC_CHECK_SIZEOF(ptrdiff_t)
252
253 AC_CHECK_SIZEOF(long long)
254
255 AC_CHECK_SIZEOF(void *)
256
257 if test "$ac_cv_sizeof_long" -ne "$ac_cv_sizeof_void_p"; then
258 AC_MSG_ERROR(sizes of long and void* are not identical)
259 fi
260
261 AC_HEADER_STDC
262 AC_HEADER_DIRENT
263 AC_HEADER_TIME
264 AC_HEADER_SYS_WAIT
265
266 AC_CHECK_HEADERS([io.h libc.h limits.h malloc.h memory.h string.h \
267 regex.h rxposix.h rx/rxposix.h sys/dir.h sys/ioctl.h sys/select.h \
268 sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
269 sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
270 direct.h])
271
272 GUILE_HEADER_LIBC_WITH_UNISTD
273
274 AC_TYPE_GETGROUPS
275 AC_TYPE_SIGNAL
276 AC_TYPE_MODE_T
277
278 AC_CHECK_LIB(m, main)
279 AC_CHECK_FUNCS(gethostbyname)
280 if test $ac_cv_func_gethostbyname = no; then
281 AC_CHECK_LIB(nsl, gethostbyname)
282 fi
283
284 AC_CHECK_FUNCS(connect)
285 if test $ac_cv_func_connect = no; then
286 AC_CHECK_LIB(socket, connect)
287 fi
288
289 dnl
290 dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
291 dnl
292 EXTRA_DEFS=""
293 if test "$MINGW32" = "yes" ; then
294 AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCK2_H], 1,
295 [Define if you have the <winsock2.h> header file.])])
296 AC_CHECK_LIB(ws2_32, main)
297 AC_LIBOBJ([win32-uname])
298 AC_LIBOBJ([win32-dirent])
299 if test "$enable_networking" = yes ; then
300 AC_LIBOBJ([win32-socket])
301 fi
302 if test "$enable_shared" = yes ; then
303 EXTRA_DEFS="-DSCM_IMPORT"
304 AC_DEFINE(USE_DLL_IMPORT, 1,
305 [Define if you need additional CPP macros on Win32 platforms.])
306 fi
307 if test x"$enable_ltdl_install" = x"yes" ; then
308 INCLTDL="-DLIBLTDL_DLL_IMPORT $INCLTDL"
309 fi
310 fi
311 AC_SUBST(EXTRA_DEFS)
312
313 # FIXME: check to see if we still need these.
314 #AC_SUBST(INCLTDL)
315 #AC_SUBST(LIBLTDL)
316
317 AC_SUBST(DLPREOPEN)
318
319 AC_CHECK_HEADERS([assert.h])
320
321 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 strchr strcmp index bcopy memcpy rindex])
322
323 AC_CHECK_HEADERS(crypt.h sys/resource.h sys/file.h)
324 AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
325 AC_CHECK_LIB(crypt, crypt)
326
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.
334 AC_DEFUN(GUILE_FUNC_DECLARED, [
335 AC_CACHE_CHECK(for $1 declaration, guile_cv_func_$1_declared,
336 AC_EGREP_HEADER($1, $2,
337 guile_cv_func_$1_declared=yes,
338 guile_cv_func_$1_declared=no))
339 if test [x$guile_cv_func_]$1[_declared] = xno; then
340 AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL], 1,
341 [Define if the operating system supplies $1 without declaring it.])
342 fi
343 ])
344
345 GUILE_FUNC_DECLARED(strptime, time.h)
346 GUILE_FUNC_DECLARED(sleep, unistd.h)
347 GUILE_FUNC_DECLARED(usleep, unistd.h)
348
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.
351 AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type,
352 [AC_EGREP_HEADER(changequote(<, >)<void[ ]+usleep>changequote([, ]),
353 unistd.h,
354 [guile_cv_func_usleep_return_type=void],
355 [guile_cv_func_usleep_return_type=int])])
356 case "$guile_cv_func_usleep_return_type" in
357 "void" )
358 AC_DEFINE(USLEEP_RETURNS_VOID, 1,
359 [Define if the system headers declare usleep to return void.])
360 ;;
361 esac
362
363 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
364 if test -n "$have_sys_un_h" ; then
365 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS, 1,
366 [Define if the system supports Unix-domain (file-domain) sockets.])
367 fi
368
369 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
370
371 AC_CHECK_FUNCS(sethostent gethostent endhostent dnl
372 setnetent getnetent endnetent dnl
373 setprotoent getprotoent endprotoent dnl
374 setservent getservent endservent dnl
375 getnetbyaddr getnetbyname dnl
376 inet_lnaof inet_makeaddr inet_netof hstrerror dnl
377 inet_pton inet_ntop)
378
379 AC_MSG_CHECKING(for __libc_stack_end)
380 AC_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)
384 AC_MSG_RESULT($have_libc_stack_end)
385
386 if 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.])
389 fi
390
391 dnl Some systems do not declare this. Some systems do declare it, as a
392 dnl macro. With cygwin it may be in a DLL.
393
394 AC_MSG_CHECKING(whether netdb.h declares h_errno)
395 AC_CACHE_VAL(guile_cv_have_h_errno,
396 [AC_TRY_COMPILE([#include <netdb.h>],
397 [int a = h_errno;],
398 guile_cv_have_h_errno=yes, guile_cv_have_h_errno=no)])
399 AC_MSG_RESULT($guile_cv_have_h_errno)
400 if test $guile_cv_have_h_errno = yes; then
401 AC_DEFINE(HAVE_H_ERRNO, 1, [Define if h_errno is declared in netdb.h.])
402 fi
403
404 AC_MSG_CHECKING(whether uint32_t is defined)
405 AC_CACHE_VAL(guile_cv_have_uint32_t,
406 [AC_TRY_COMPILE([#include <sys/types.h>
407 #if HAVE_STDINT_H
408 #include <stdint.h>
409 #endif
410 #ifndef __MINGW32__
411 #include <netdb.h>
412 #endif],
413 [uint32_t a;],
414 guile_cv_have_uint32_t=yes, guile_cv_have_uint32_t=no)])
415 AC_MSG_RESULT($guile_cv_have_uint32_t)
416 if test $guile_cv_have_uint32_t = yes; then
417 AC_DEFINE(HAVE_UINT32_T, 1,
418 [Define if uint32_t typedef is defined when netdb.h is include.])
419 fi
420
421 AC_MSG_CHECKING(for working IPv6 support)
422 AC_CACHE_VAL(guile_cv_have_ipv6,
423 [AC_TRY_COMPILE([
424 #ifdef HAVE_SYS_TYPES_H
425 #include <sys/types.h>
426 #endif
427 #include <netinet/in.h>
428 #include <sys/socket.h>],
429 [struct sockaddr_in6 a; a.sin6_family = AF_INET6;],
430 guile_cv_have_ipv6=yes, guile_cv_have_ipv6=no)])
431 AC_MSG_RESULT($guile_cv_have_ipv6)
432 if test $guile_cv_have_ipv6 = yes; then
433 AC_DEFINE(HAVE_IPV6, 1, [Define if you want support for IPv6.])
434 fi
435
436 # included in rfc2553 but not in older implementations, e.g., glibc 2.1.3.
437 AC_MSG_CHECKING(whether sockaddr_in6 has sin6_scope_id)
438 AC_CACHE_VAL(guile_cv_have_sin6_scope_id,
439 [AC_TRY_COMPILE([
440 #ifdef HAVE_SYS_TYPES_H
441 #include <sys/types.h>
442 #endif
443 #include <netinet/in.h>],
444 [struct sockaddr_in6 sok; sok.sin6_scope_id = 0;],
445 guile_cv_have_sin6_scope_id=yes, guile_cv_have_sin6_scope_id=no)])
446 AC_MSG_RESULT($guile_cv_have_sin6_scope_id)
447 if test $guile_cv_have_sin6_scope_id = yes; then
448 AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1,
449 [Define this if your IPv6 has sin6_scope_id in sockaddr_in6 struct.])
450 fi
451
452 AC_MSG_CHECKING(whether localtime caches TZ)
453 AC_CACHE_VAL(guile_cv_localtime_cache,
454 [if test x$ac_cv_func_tzset = xyes; then
455 AC_TRY_RUN([#include <time.h>
456 #if STDC_HEADERS
457 # include <stdlib.h>
458 #endif
459 extern char **environ;
460 unset_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 }
467 char TZ_GMT0[] = "TZ=GMT0";
468 char TZ_PST8[] = "TZ=PST8";
469 main()
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.
488 guile_cv_localtime_cache=yes])
489 else
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
493 fi])dnl
494 AC_MSG_RESULT($guile_cv_localtime_cache)
495 if test $guile_cv_localtime_cache = yes; then
496 AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.])
497 fi
498
499 dnl Test whether system calls are restartable by default on the
500 dnl current system. If they are not, we put a loop around every system
501 dnl call to check for EINTR (see SCM_SYSCALL) and do not attempt to
502 dnl change from the default behaviour. On the other hand, if signals
503 dnl are restartable then the loop is not installed and when libguile
504 dnl initialises it also resets the behaviour of each signal to cause a
505 dnl restart (in case a different runtime had a different default
506 dnl behaviour for some reason: e.g., different versions of linux seem
507 dnl to behave differently.)
508
509 AC_SYS_RESTARTABLE_SYSCALLS
510
511 if 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
515 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [AC_LIBOBJ([regex-posix])],
516 [AC_CHECK_LIB(rx, main)
517 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [AC_LIBOBJ([regex-posix])],
518 [AC_CHECK_LIB(regex, main)
519 GUILE_NAMED_CHECK_FUNC(regcomp, regex, [AC_LIBOBJ([regex-posix])])])]
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 ||
524 test "$ac_cv_func_regcomp_regex" = yes ||
525 test "$ac_cv_func_regcomp_rx" = yes; then
526 AC_DEFINE(HAVE_REGCOMP, 1,
527 [This is included as part of a workaround for a autoheader bug.])
528 fi
529 fi
530 fi
531
532 AC_REPLACE_FUNCS(inet_aton putenv strerror memmove mkstemp)
533
534 AC_CHECK_HEADERS(floatingpoint.h ieeefp.h nan.h)
535
536 AC_CHECK_FUNCS(finite isinf isnan copysign)
537
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.
541 AC_FUNC_ALLOCA
542 if test "$ALLOCA" = "alloca.o"; then AC_LIBOBJ([alloca]); fi
543
544 AC_CHECK_MEMBERS([struct stat.st_rdev])
545 AC_CHECK_MEMBERS([struct stat.st_blksize])
546
547 AC_STRUCT_ST_BLOCKS
548
549 AC_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)])
556 if test $ac_cv_macro_S_ISLNK = yes; then
557 AC_DEFINE(HAVE_S_ISLNK, 1,
558 [Define this if your system defines S_ISLNK in sys/stat.h.])
559 fi
560
561 AC_STRUCT_TIMEZONE
562 GUILE_STRUCT_UTIMBUF
563
564 #--------------------------------------------------------------------
565 #
566 # Which way does the stack grow?
567 #
568 #--------------------------------------------------------------------
569
570 AC_TRY_RUN(aux (l) unsigned long l;
571 { int x; exit (l >= ((unsigned long)&x)); }
572 main () { int q; aux((unsigned long)&q); },
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
580 AH_TEMPLATE([SCM_SINGLES],
581 [Define this if floats are the same size as longs.])
582
583 AC_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])])
588 case $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 ;;
597 esac
598
599
600 AC_MSG_CHECKING(for struct linger)
601 AC_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"))
608 AC_MSG_RESULT($scm_cv_struct_linger)
609 if test $scm_cv_struct_linger = yes; then
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.])
613 fi
614
615
616 AC_MSG_CHECKING(for struct timespec)
617 AC_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"))
623 AC_MSG_RESULT($scm_cv_struct_timespec)
624 if test $scm_cv_struct_timespec = yes; then
625 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
626 [Define this if your system defines struct timespec via <time.h>.])
627 fi
628
629 #--------------------------------------------------------------------
630 #
631 # Flags for thread support
632 #
633 #--------------------------------------------------------------------
634
635 ### What thread package has the user asked for?
636 AC_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.
641 AC_MSG_CHECKING(whether to support threads)
642 case "$with_threads" in
643 "yes" | "qt" | "coop" | "")
644 with_threads=qt
645 ;;
646 "no" )
647 ;;
648 * )
649 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
650 ;;
651 esac
652 AC_MSG_RESULT($with_threads)
653
654 ## Make sure the threads package we've chosen is actually supported on
655 ## the present platform.
656 case "${with_threads}" in
657 "qt" )
658 ## This configures the QuickThreads package, and sets or clears
659 ## the THREAD_PACKAGE variable if qthreads don't configure
660 ## correctly.
661 QTHREADS_CONFIGURE
662 ;;
663 esac
664
665 ## If we're using threads, bring in some other parts of Guile which
666 ## work with them.
667 if test "${THREAD_PACKAGE}" != "" ; then
668 AC_DEFINE(USE_THREADS, 1, [Define if using any sort of threads.])
669
670 ## Include the Guile thread interface in the library...
671 AC_LIBOBJ([threads])
672
673 ## ... and tell it which package to talk to.
674 case "${THREAD_PACKAGE}" in
675 "QT" )
676 AC_DEFINE(USE_COOP_THREADS, 1,
677 [Define if using cooperative multithreading.])
678 ;;
679 * )
680 AC_MSG_ERROR(invalid value for THREAD_PACKAGE: ${THREAD_PACKAGE})
681 ;;
682 esac
683
684 ## Bring in scm_internal_select, if appropriate.
685 if test $ac_cv_func_gettimeofday = yes &&
686 test $ac_cv_func_select = yes; then
687 AC_DEFINE(GUILE_ISELECT, 1, [Define to implement scm_internal_select.])
688 fi
689
690 AC_ARG_ENABLE(linuxthreads,
691 [ --disable-linuxthreads disable linuxthreads workaround],,
692 enable_linuxthreads=yes)
693
694 ## Workaround for linuxthreads (optionally disabled)
695 if test $host_os = linux-gnu -a "$enable_linuxthreads" = yes; then
696 AC_DEFINE(GUILE_PTHREAD_COMPAT, 1,
697 [Define to enable workaround for COOP-linuxthreads compatibility.])
698 AC_CHECK_LIB(pthread, main)
699 fi
700 fi
701
702 ## Cross building
703 if test "$cross_compiling" = "yes"; then
704 AC_MSG_CHECKING(cc for build)
705 ## /usr/bin/cc still uses wrong assembler
706 ## CC_FOR_BUILD="${CC_FOR_BUILD-/usr/bincc}"
707 CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}"
708 else
709 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
710 fi
711 AC_ARG_WITH(cc-for-build,
712 [ --with-cc-for-build=CC native C compiler, to be used during build])
713 test -n "$with_cc_for_build" && CC_FOR_BUILD="$with_cc_for_build"
714
715 ## AC_MSG_CHECKING("if we are cross compiling")
716 ## AC_MSG_RESULT($cross_compiling)
717 if test "$cross_compiling" = "yes"; then
718 AC_MSG_RESULT($CC_FOR_BUILD)
719 fi
720
721 ## No need as yet to be more elaborate
722 CCLD_FOR_BUILD="$CC_FOR_BUILD"
723
724 AC_SUBST(cross_compiling)
725 AC_SUBST(CC_FOR_BUILD)
726 AC_SUBST(CCLD_FOR_BUILD)
727
728 ## libtool erroneously calls CC_FOR_BUILD HOST_CC;
729 ## --HOST is the platform that PACKAGE is compiled for.
730 HOST_CC="$CC_FOR_BUILD"
731 AC_SUBST(HOST_CC)
732
733 if test "$cross_compiling" = "yes"; then
734 AC_MSG_CHECKING(guile for build)
735 GUILE_FOR_BUILD="${GUILE_FOR_BUILD-guile}"
736 else
737 GUILE_FOR_BUILD='$(preinstguile)'
738 fi
739 AC_ARG_WITH(guile-for-build,
740 [ --with-guile-for-build=guile native guile executable, to be used during build])
741 test -n "$with_guile_for_build" && GUILE_FOR_BUILD="$with_guile_for_build"
742
743 ## AC_MSG_CHECKING("if we are cross compiling")
744 ## AC_MSG_RESULT($cross_compiling)
745 if test "$cross_compiling" = "yes"; then
746 AC_MSG_RESULT($GUILE_FOR_BUILD)
747 fi
748 AC_SUBST(GUILE_FOR_BUILD)
749
750 # Do this here so we don't screw up any of the tests above that might
751 # not be "warning free"
752
753 if test "${GUILE_ERROR_ON_WARNING}" = yes
754 then
755 CFLAGS="${CFLAGS} -Werror"
756 enable_compile_warnings=no
757 fi
758
759 ## If we're using GCC, ask for aggressive warnings.
760 case "$GCC" in
761 yes )
762 ## We had -Wstrict-prototypes in here for a bit, but Guile does too
763 ## much stuff with generic function pointers for that to really be
764 ## less than exasperating.
765 ## -Wpointer-arith was here too, but something changed in gcc/glibc
766 ## and it became equally exasperating (gcc 2.95 and/or glibc 2.1.2).
767 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" ;;
768 esac
769
770 ## NOTE the code below sets LIBOBJS directly and so is now forbidden
771 ## -- I'm disabling it for now in the hopes that the newer autoconf
772 ## will DTRT -- if not, we need to fix up the sed command to match the
773 ## others...
774 ##
775 ## Remove fileblocks.o from the object list. This file gets added by
776 ## the Autoconf macro AC_STRUCT_ST_BLOCKS. But there is no need.
777 #LIBOBJS="`echo ${LIBOBJS} | sed 's/fileblocks\.o//g'`"
778
779 ## If we're creating a shared library (using libtool!), then we'll
780 ## need to generate a list of .lo files corresponding to the .o files
781 ## given in LIBOBJS. We'll call it LIBLOBJS.
782 LIBLOBJS="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`"
783
784 ## We also need to create corresponding .doc and .x files
785 EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`"
786 EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`"
787
788 AC_SUBST(GUILE_MAJOR_VERSION)
789 AC_SUBST(GUILE_MINOR_VERSION)
790 AC_SUBST(GUILE_MICRO_VERSION)
791 AC_SUBST(GUILE_VERSION)
792
793 #######################################################################
794 # library versioning
795
796 AC_SUBST(LIBQTHREADS_INTERFACE_CURRENT)
797 AC_SUBST(LIBQTHREADS_INTERFACE_REVISION)
798 AC_SUBST(LIBQTHREADS_INTERFACE_AGE)
799 AC_SUBST(LIBQTHREADS_INTERFACE)
800
801 AC_SUBST(LIBGUILE_INTERFACE_CURRENT)
802 AC_SUBST(LIBGUILE_INTERFACE_REVISION)
803 AC_SUBST(LIBGUILE_INTERFACE_AGE)
804 AC_SUBST(LIBGUILE_INTERFACE)
805
806 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT)
807 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION)
808 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE)
809 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE)
810
811 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT)
812 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION)
813 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE)
814 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE)
815
816 #######################################################################
817
818 dnl Tell guile-config what flags guile users should link against.
819 GUILE_LIBS="$LDFLAGS $THREAD_LIBS_INSTALLED $LIBS"
820 AC_SUBST(GUILE_LIBS)
821
822 AC_SUBST(AWK)
823 AC_SUBST(LIBLOBJS)
824 AC_SUBST(EXTRA_DOT_DOC_FILES)
825 AC_SUBST(EXTRA_DOT_X_FILES)
826
827 dnl See also top_builddir in info node: (libtool)AC_PROG_LIBTOOL
828 top_builddir_absolute=`pwd`
829 AC_SUBST(top_builddir_absolute)
830 top_srcdir_absolute=`(cd $srcdir ; pwd)`
831 AC_SUBST(top_srcdir_absolute)
832
833 AC_CONFIG_FILES([
834 Makefile
835 am/Makefile
836 libguile/Makefile
837 libguile/guile-snarf
838 libguile/guile-doc-snarf
839 libguile/guile-func-name-check
840 libguile/guile-snarf-docs
841 libguile/version.h
842 libguile-ltdl/Makefile
843 libguile-ltdl/upstream/Makefile
844 ice-9/Makefile
845 lang/Makefile
846 lang/elisp/Makefile
847 lang/elisp/internals/Makefile
848 lang/elisp/primitives/Makefile
849 oop/Makefile
850 oop/goops/Makefile
851 scripts/Makefile
852 srfi/Makefile
853 qt/Makefile
854 qt/qt.h
855 qt/md/Makefile
856 qt/time/Makefile
857 guile-config/Makefile
858 doc/Makefile
859 doc/ref/Makefile
860 doc/tutorial/Makefile
861 doc/goops/Makefile
862 doc/r5rs/Makefile
863 examples/Makefile
864 examples/scripts/Makefile
865 examples/box/Makefile
866 examples/box-module/Makefile
867 examples/box-dynamic/Makefile
868 examples/box-dynamic-module/Makefile
869 examples/modules/Makefile
870 examples/safe/Makefile
871 test-suite/Makefile
872 check-guile
873 benchmark-suite/Makefile
874 benchmark-guile
875 guile-tools
876 pre-inst-guile])
877
878 AC_CONFIG_COMMANDS(default,
879 [ chmod +x libguile/guile-snarf \
880 libguile/guile-doc-snarf \
881 libguile/guile-func-name-check \
882 libguile/guile-snarf-docs \
883 check-guile \
884 benchmark-guile \
885 guile-tools \
886 pre-inst-guile])
887
888 AC_OUTPUT
889
890 dnl Local Variables:
891 dnl comment-start: "dnl "
892 dnl comment-end: ""
893 dnl comment-start-skip: "\\bdnl\\b\\s *"
894 dnl End: