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