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