Changes from arch/CVS synchronization
[bpt/guile.git] / configure.in
... / ...
CommitLineData
1dnl configuration script for Guile
2dnl Process this file with autoconf to produce configure.
3dnl
4
5define(GUILE_CONFIGURE_COPYRIGHT,[[
6
7Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
8
9This file is part of GUILE
10
11GUILE is free software; you can redistribute it and/or modify it
12under the terms of the GNU General Public License as published by
13the Free Software Foundation; either version 2, or (at your
14option) any later version.
15
16GUILE is distributed in the hope that it will be useful, but
17WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with GUILE; see the file COPYING. If not, write to the
23Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24Boston, MA 02110-1301, USA.
25
26]])
27
28AC_PREREQ(2.53)
29
30dnl `patsubst' here deletes the newline which "echo" prints. We can't use
31dnl "echo -n" since -n is not portable (see autoconf manual "Limitations of
32dnl Builtins"), in particular on solaris it results in a literal "-n" in
33dnl the output.
34dnl
35AC_INIT(patsubst(m4_esyscmd(. ./GUILE-VERSION && echo ${PACKAGE}),[
36]),
37 patsubst(m4_esyscmd(. ./GUILE-VERSION && echo ${GUILE_VERSION}),[
38]),
39 [bug-guile@gnu.org])
40AC_CONFIG_AUX_DIR([.])
41AC_CONFIG_SRCDIR(GUILE-VERSION)
42AM_INIT_AUTOMAKE([no-define])
43
44AC_COPYRIGHT(GUILE_CONFIGURE_COPYRIGHT)
45AC_CONFIG_SRCDIR([GUILE-VERSION])
46
47. $srcdir/GUILE-VERSION
48
49AM_MAINTAINER_MODE
50AM_CONFIG_HEADER([config.h])
51AH_TOP(/*GUILE_CONFIGURE_COPYRIGHT*/)
52
53#--------------------------------------------------------------------
54#
55# Independent Subdirectories
56#
57#--------------------------------------------------------------------
58
59AC_CONFIG_SUBDIRS(guile-readline)
60
61#--------------------------------------------------------------------
62
63dnl Some more checks for Win32
64AC_CYGWIN
65AC_LIBTOOL_WIN32_DLL
66
67AC_PROG_INSTALL
68AC_PROG_CC
69AC_PROG_CPP
70AC_PROG_AWK
71
72AC_AIX
73AC_ISC_POSIX
74AC_MINIX
75
76AM_PROG_CC_STDC
77# for per-target cflags in the libguile subdir
78AM_PROG_CC_C_O
79
80AC_LIBTOOL_DLOPEN
81AC_PROG_LIBTOOL
82AC_CHECK_LIB([ltdl], [lt_dlinit], ,
83 [AC_MSG_ERROR([libltdl not found. See README.])])
84
85AC_SUBST(DLPREOPEN)
86
87AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
88AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
89
90AM_PATH_LISPDIR
91
92#--------------------------------------------------------------------
93#
94# User options (after above tests that may set default CFLAGS etc.)
95#
96#--------------------------------------------------------------------
97
98GUILE_ERROR_ON_WARNING="yes"
99
100AC_ARG_ENABLE(error-on-warning,
101 [ --enable-error-on-warning treat compile warnings as errors],
102 [case "${enableval}" in
103 yes | y) GUILE_ERROR_ON_WARNING="yes" ;;
104 no | n) GUILE_ERROR_ON_WARNING="no" ;;
105 *) AC_MSG_ERROR(bad value ${enableval} for --enable-error-on-warning) ;;
106 esac])
107
108SCM_I_GSC_GUILE_DEBUG_FREELIST=0
109AC_ARG_ENABLE(debug-freelist,
110 [ --enable-debug-freelist include garbage collector freelist debugging code],
111 if test "$enable_debug_freelist" = y \
112 || test "$enable_debug_freelist" = yes; then
113 SCM_I_GSC_GUILE_DEBUG_FREELIST=1
114 fi)
115
116AC_ARG_ENABLE(debug-malloc,
117 [ --enable-debug-malloc include malloc debugging code],
118 if test "$enable_debug_malloc" = y || test "$enable_debug_malloc" = yes; then
119 AC_DEFINE(GUILE_DEBUG_MALLOC, 1,
120 [Define this if you want to debug scm_must_malloc/realloc/free calls.])
121 fi)
122
123SCM_I_GSC_GUILE_DEBUG=0
124AC_ARG_ENABLE(guile-debug,
125 [AC_HELP_STRING([--enable-guile-debug],
126 [include internal debugging functions])],
127 if test "$enable_guile_debug" = y || test "$enable_guile_debug" = yes; then
128 SCM_I_GSC_GUILE_DEBUG=1
129 fi)
130
131AC_ARG_ENABLE(posix,
132 [ --disable-posix omit posix interfaces],,
133 enable_posix=yes)
134
135AC_ARG_ENABLE(networking,
136 [ --disable-networking omit networking interfaces],,
137 enable_networking=yes)
138
139AC_ARG_ENABLE(regex,
140 [ --disable-regex omit regular expression interfaces],,
141 enable_regex=yes)
142
143AC_ARG_ENABLE([discouraged],
144 AC_HELP_STRING([--disable-discouraged],[omit discouraged features]))
145
146if test "$enable_discouraged" = no; then
147 SCM_I_GSC_ENABLE_DISCOURAGED=0
148else
149 SCM_I_GSC_ENABLE_DISCOURAGED=1
150fi
151
152AC_ARG_ENABLE([deprecated],
153 AC_HELP_STRING([--disable-deprecated],[omit deprecated features]))
154
155if test "$enable_deprecated" = no; then
156 SCM_I_GSC_ENABLE_DEPRECATED=0
157else
158 if test "$enable_deprecated" = yes || test "$enable_deprecated" = ""; then
159 warn_default=summary
160 elif test "$enable_deprecated" = shutup; then
161 warn_default=no
162 else
163 warn_default=$enable_deprecated
164 fi
165 SCM_I_GSC_ENABLE_DEPRECATED=1
166 AC_DEFINE_UNQUOTED(SCM_WARN_DEPRECATED_DEFAULT, "$warn_default",
167 [Define this to control the default warning level for deprecated features.])
168fi
169
170AC_ARG_ENABLE(elisp,
171 [ --disable-elisp omit Emacs Lisp support],,
172 enable_elisp=yes)
173
174#--------------------------------------------------------------------
175
176dnl Check for dynamic linking
177
178use_modules=yes
179AC_ARG_WITH(modules,
180[ --with-modules[=FILES] Add support for dynamic modules],
181use_modules="$withval")
182test -z "$use_modules" && use_modules=yes
183DLPREOPEN=
184if test "$use_modules" != no; then
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
193fi
194
195dnl files which are destined for separate modules.
196
197if test "$use_modules" != no; then
198 AC_LIBOBJ([dynl])
199fi
200
201if test "$enable_posix" = yes; then
202 AC_LIBOBJ([filesys])
203 AC_LIBOBJ([posix])
204 AC_DEFINE(HAVE_POSIX, 1,
205 [Define this if you want support for POSIX system calls in Guile.])
206fi
207
208if test "$enable_networking" = yes; then
209 AC_LIBOBJ([net_db])
210 AC_LIBOBJ([socket])
211 AC_DEFINE(HAVE_NETWORKING, 1,
212 [Define this if you want support for networking in Guile.])
213fi
214
215if test "$enable_debug_malloc" = yes; then
216 AC_LIBOBJ([debug-malloc])
217fi
218
219if test "$enable_elisp" = yes; then
220 SCM_I_GSC_ENABLE_ELISP=1
221else
222 SCM_I_GSC_ENABLE_ELISP=0
223fi
224AC_CHECK_LIB(uca, __uc_get_ar_bsp)
225
226AC_C_CONST
227
228# "volatile" is used in a couple of tests below.
229AC_C_VOLATILE
230
231AC_C_INLINE
232if test "$ac_cv_c_inline" != no; then
233 SCM_I_GSC_C_INLINE="\"${ac_cv_c_inline}\""
234else
235 SCM_I_GSC_C_INLINE=NULL
236fi
237AC_CHECK_LIB(uca, __uc_get_ar_bsp)
238
239AC_C_BIGENDIAN
240
241AC_CHECK_SIZEOF(char)
242AC_CHECK_SIZEOF(unsigned char)
243AC_CHECK_SIZEOF(short)
244AC_CHECK_SIZEOF(unsigned short)
245AC_CHECK_SIZEOF(int)
246AC_CHECK_SIZEOF(unsigned int)
247AC_CHECK_SIZEOF(long)
248AC_CHECK_SIZEOF(unsigned long)
249AC_CHECK_SIZEOF(size_t)
250AC_CHECK_SIZEOF(long long)
251AC_CHECK_SIZEOF(unsigned long long)
252AC_CHECK_SIZEOF(__int64)
253AC_CHECK_SIZEOF(unsigned __int64)
254AC_CHECK_SIZEOF(void *)
255AC_CHECK_SIZEOF(intptr_t)
256AC_CHECK_SIZEOF(uintptr_t)
257AC_CHECK_SIZEOF(ptrdiff_t)
258AC_CHECK_SIZEOF(size_t)
259AC_CHECK_SIZEOF(off_t)
260
261if test "$ac_cv_sizeof_long" -ne "$ac_cv_sizeof_void_p"; then
262 AC_MSG_ERROR(sizes of long and void* are not identical)
263fi
264
265if test "$ac_cv_sizeof_ptrdiff_t" -ne 0; then
266 SCM_I_GSC_T_PTRDIFF='"ptrdiff_t"'
267else
268 SCM_I_GSC_T_PTRDIFF='"long"'
269fi
270AC_SUBST([SCM_I_GSC_T_PTRDIFF])
271
272AC_CHECK_HEADERS([stdint.h])
273AC_CHECK_HEADERS([inttypes.h])
274
275AC_CHECK_SIZEOF(intmax_t)
276
277SCM_I_GSC_NEEDS_STDINT_H=0
278SCM_I_GSC_NEEDS_INTTYPES_H=0
279
280### intptr and uintptr (try not to use inttypes if we don't have to)
281if test "$ac_cv_header_inttypes_h" = yes; then
282 if test "$ac_cv_sizeof_intptr_t" -eq 0; then
283 AC_CHECK_SIZEOF([intptr_t],,[#include <inttypes.h>
284#include <stdio.h>])
285 if test "$ac_cv_sizeof_intptr_t" -ne 0; then
286 SCM_I_GSC_NEEDS_INTTYPES_H=1
287 fi
288 fi
289 if test "$ac_cv_sizeof_uintptr_t" -eq 0; then
290 AC_CHECK_SIZEOF([uintptr_t],,[#include <inttypes.h>
291#include <stdio.h>])
292 if test "$ac_cv_sizeof_uintptr_t" -ne 0; then
293 SCM_I_GSC_NEEDS_INTTYPES_H=1
294 fi
295 fi
296fi
297
298### See what's provided by stdint.h
299if test "$ac_cv_header_stdint_h" = yes; then
300 AC_CHECK_TYPE([int8_t],[scm_stdint_has_int8=1],,[#include <stdint.h>])
301 AC_CHECK_TYPE([uint8_t],[scm_stdint_has_uint8=1],,[#include <stdint.h>])
302 AC_CHECK_TYPE([int16_t],[scm_stdint_has_int16=1],,[#include <stdint.h>])
303 AC_CHECK_TYPE([uint16_t],[scm_stdint_has_uint16=1],,[#include <stdint.h>])
304 AC_CHECK_TYPE([int32_t],[scm_stdint_has_int32=1],,[#include <stdint.h>])
305 AC_CHECK_TYPE([uint32_t],[scm_stdint_has_uint32=1],,[#include <stdint.h>])
306 AC_CHECK_TYPE([int64_t],[scm_stdint_has_int64=1],,[#include <stdint.h>])
307 AC_CHECK_TYPE([uint64_t],[scm_stdint_has_uint64=1],,[#include <stdint.h>])
308 AC_CHECK_TYPE([intmax_t],[scm_stdint_has_intmax=1],,[#include <stdint.h>])
309 AC_CHECK_TYPE([uintmax_t],[scm_stdint_has_uintmax=1],,[#include <stdint.h>])
310fi
311
312# so we don't get confused by the cache (wish there was a better way
313# to check particular headers for the same type...)
314
315unset ac_cv_type_int8_t
316unset ac_cv_type_uint8_t
317unset ac_cv_type_int16_t
318unset ac_cv_type_uint16_t
319unset ac_cv_type_int32_t
320unset ac_cv_type_uint32_t
321unset ac_cv_type_int64_t
322unset ac_cv_type_uint64_t
323unset ac_cv_type_intmax_t
324unset ac_cv_type_uintmax_t
325
326### See what's provided by inttypes.h
327if test "$ac_cv_header_inttypes_h" = yes; then
328 AC_CHECK_TYPE([int8_t],[scm_inttypes_has_int8=1],,[#include <inttypes.h>])
329 AC_CHECK_TYPE([uint8_t],[scm_inttypes_has_uint8=1],,[#include <inttypes.h>])
330 AC_CHECK_TYPE([int16_t],[scm_inttypes_has_int16=1],,[#include <inttypes.h>])
331 AC_CHECK_TYPE([uint16_t],[scm_inttypes_has_uint16=1],,[#include <inttypes.h>])
332 AC_CHECK_TYPE([int32_t],[scm_inttypes_has_int32=1],,[#include <inttypes.h>])
333 AC_CHECK_TYPE([uint32_t],[scm_inttypes_has_uint32=1],,[#include <inttypes.h>])
334 AC_CHECK_TYPE([int64_t],[scm_inttypes_has_int64=1],,[#include <inttypes.h>])
335 AC_CHECK_TYPE([uint64_t],[scm_inttypes_has_uint64=1],,[#include <inttypes.h>])
336 AC_CHECK_TYPE([intmax_t],[scm_inttypes_has_intmax=1],,[#include <inttypes.h>])
337 AC_CHECK_TYPE([uintmax_t],[scm_inttypes_has_uintmax=1],,[#include <inttypes.h>])
338fi
339
340# Try hard to find definitions for some required scm_t_*int* types.
341
342### Required type scm_t_int8
343if test "$scm_stdint_has_int8"; then
344 SCM_I_GSC_T_INT8='"int8_t"'
345 SCM_I_GSC_NEEDS_STDINT_H=1
346elif test "$scm_inttypes_has_int8"; then
347 SCM_I_GSC_T_INT8='"int8_t"'
348 SCM_I_GSC_NEEDS_INTTYPES_H=1
349elif test "$ac_cv_sizeof_char" -eq 1; then
350 SCM_I_GSC_T_INT8='"signed char"'
351else
352 AC_MSG_ERROR([Can't find appropriate type for scm_t_int8.])
353fi
354AC_SUBST([SCM_I_GSC_T_INT8])
355
356### Required type scm_t_uint8
357if test "$scm_stdint_has_uint8"; then
358 SCM_I_GSC_T_UINT8='"uint8_t"'
359 SCM_I_GSC_NEEDS_STDINT_H=1
360elif test "$scm_inttypes_has_uint8"; then
361 SCM_I_GSC_T_UINT8='"uint8_t"'
362 SCM_I_GSC_NEEDS_INTTYPES_H=1
363elif test "$ac_cv_sizeof_unsigned_char" -eq 1; then
364 SCM_I_GSC_T_UINT8='"unsigned char"'
365else
366 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint8.])
367fi
368AC_SUBST([SCM_I_GSC_T_UINT8])
369
370### Required type scm_t_int16 (ANSI C says int or short might work)
371if test "$scm_stdint_has_int16"; then
372 SCM_I_GSC_T_INT16='"int16_t"'
373 SCM_I_GSC_NEEDS_STDINT_H=1
374elif test "$scm_inttypes_has_int16"; then
375 SCM_I_GSC_T_INT16='"int16_t"'
376 SCM_I_GSC_NEEDS_INTTYPES_H=1
377elif test "$ac_cv_sizeof_int" -eq 2; then
378 SCM_I_GSC_T_INT16='"int"'
379elif test "$ac_cv_sizeof_short" -eq 2; then
380 SCM_I_GSC_T_INT16='"short"'
381else
382 AC_MSG_ERROR([Can't find appropriate type for scm_t_int16.])
383fi
384AC_SUBST([SCM_I_GSC_T_INT16])
385
386### Required type scm_t_uint16 (ANSI C says int or short might work)
387if test "$scm_stdint_has_uint16"; then
388 SCM_I_GSC_T_UINT16='"uint16_t"'
389 SCM_I_GSC_NEEDS_STDINT_H=1
390elif test "$scm_inttypes_has_uint16"; then
391 SCM_I_GSC_T_UINT16='"uint16_t"'
392 SCM_I_GSC_NEEDS_INTTYPES_H=1
393elif test "$ac_cv_sizeof_unsigned_int" -eq 2; then
394 SCM_I_GSC_T_UINT16='"unsigned int"'
395elif test "$ac_cv_sizeof_unsigned_short" -eq 2; then
396 SCM_I_GSC_T_UINT16='"unsigned short"'
397else
398 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint16.])
399fi
400AC_SUBST([SCM_I_GSC_T_UINT16])
401
402
403### Required type scm_t_int32 (ANSI C says int, short, or long might work)
404if test "$scm_stdint_has_int32"; then
405 SCM_I_GSC_T_INT32='"int32_t"'
406 SCM_I_GSC_NEEDS_STDINT_H=1
407elif test "$scm_inttypes_has_int32"; then
408 SCM_I_GSC_T_INT32='"int32_t"'
409 SCM_I_GSC_NEEDS_INTTYPES_H=1
410elif test "$ac_cv_sizeof_int" -eq 4; then
411 SCM_I_GSC_T_INT32='"int"'
412elif test "$ac_cv_sizeof_long" -eq 4; then
413 SCM_I_GSC_T_INT32='"long"'
414elif test "$ac_cv_sizeof_short" -eq 4; then
415 SCM_I_GSC_T_INT32='"short"'
416else
417 AC_MSG_ERROR([Can't find appropriate type for scm_t_int32.])
418fi
419AC_SUBST([SCM_I_GSC_T_INT32])
420
421### Required type scm_t_uint32 (ANSI C says int, short, or long might work)
422if test "$scm_stdint_has_uint32"; then
423 SCM_I_GSC_T_UINT32='"uint32_t"'
424 SCM_I_GSC_NEEDS_STDINT_H=1
425elif test "$scm_inttypes_has_uint32"; then
426 SCM_I_GSC_T_UINT32='"uint32_t"'
427 SCM_I_GSC_NEEDS_INTTYPES_H=1
428elif test "$ac_cv_sizeof_unsigned_int" -eq 4; then
429 SCM_I_GSC_T_UINT32='"unsigned int"'
430elif test "$ac_cv_sizeof_unsigned_long" -eq 4; then
431 SCM_I_GSC_T_UINT32='"unsigned long"'
432elif test "$ac_cv_sizeof_unsigned_short" -eq 4; then
433 SCM_I_GSC_T_UINT32='"unsigned short"'
434else
435 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint32.])
436fi
437AC_SUBST([SCM_I_GSC_T_UINT32])
438
439### Optional type scm_t_int64 (ANSI C says int, short, or long might work)
440### Also try 'long long' and '__int64' if we have it.
441SCM_I_GSC_T_INT64=0
442if test "$scm_stdint_has_int64"; then
443 SCM_I_GSC_T_INT64='"int64_t"'
444 SCM_I_GSC_NEEDS_STDINT_H=1
445elif test "$scm_inttypes_has_int64"; then
446 SCM_I_GSC_T_INT64='"int64_t"'
447 SCM_I_GSC_NEEDS_INTTYPES_H=1
448elif test "$ac_cv_sizeof_int" -eq 8; then
449 SCM_I_GSC_T_INT64='"int"'
450elif test "$ac_cv_sizeof_long" -eq 8; then
451 SCM_I_GSC_T_INT64='"long"'
452elif test "$ac_cv_sizeof_short" -eq 8; then
453 SCM_I_GSC_T_INT64='"short"'
454elif test "$ac_cv_sizeof_long_long" -eq 8; then
455 SCM_I_GSC_T_INT64='"long long"'
456elif test "$ac_cv_sizeof___int64" -eq 8; then
457 SCM_I_GSC_T_INT64='"__int64"'
458else
459 AC_MSG_ERROR([Can't find appropriate type for scm_t_int64.])
460fi
461AC_SUBST([SCM_I_GSC_T_INT64])
462
463
464### Optional type scm_t_uint64 (ANSI C says int, short, or long might work)
465### Also try 'long long' and '__int64' if we have it.
466SCM_I_GSC_T_UINT64=0
467if test "$scm_stdint_has_uint64"; then
468 SCM_I_GSC_T_UINT64='"uint64_t"'
469 SCM_I_GSC_NEEDS_STDINT_H=1
470elif test "$scm_inttypes_has_uint64"; then
471 SCM_I_GSC_T_UINT64='"uint64_t"'
472 SCM_I_GSC_NEEDS_INTTYPES_H=1
473elif test "$ac_cv_sizeof_unsigned_int" -eq 8; then
474 SCM_I_GSC_T_UINT64='"unsigned int"'
475elif test "$ac_cv_sizeof_unsigned_long" -eq 8; then
476 SCM_I_GSC_T_UINT64='"unsigned long"'
477elif test "$ac_cv_sizeof_unsigned_short" -eq 8; then
478 SCM_I_GSC_T_UINT64='"unsigned short"'
479elif test "$ac_cv_sizeof_unsigned_long_long" -eq 8; then
480 SCM_I_GSC_T_UINT64='"unsigned long long"'
481elif test "$ac_cv_sizeof_unsigned___int64" -eq 8; then
482 SCM_I_GSC_T_UINT64='"unsigned __int64"'
483else
484 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint64.])
485fi
486AC_SUBST([SCM_I_GSC_T_UINT64])
487
488### Required type scm_t_intmax
489###
490### We try 'intmax_t', '__int64', 'long long' in this order. When
491### none of them is available, we use 'long'.
492###
493SCM_I_GSC_T_INTMAX=0
494if test "$scm_stdint_has_intmax"; then
495 SCM_I_GSC_T_INTMAX='"intmax_t"'
496 SCM_I_GSC_NEEDS_STDINT_H=1
497elif test "$scm_inttypes_has_intmax"; then
498 SCM_I_GSC_T_INTMAX='"intmax_t"'
499 SCM_I_GSC_NEEDS_INTTYPES_H=1
500elif test "$ac_cv_sizeof___int64" -ne 0; then
501 SCM_I_GSC_T_INTMAX='"__int64"'
502elif test "$ac_cv_sizeof_long_long" -ne 0; then
503 SCM_I_GSC_T_INTMAX='"long long"'
504else
505 SCM_I_GSC_T_INTMAX='"long"'
506fi
507AC_SUBST([SCM_I_GSC_T_INTMAX])
508
509### Required type scm_t_uintmax
510###
511### We try 'uintmax_t', 'unsigned __int64', 'unsigned long long' in
512### this order. When none of them is available, we use 'unsigned long'.
513###
514SCM_I_GSC_T_UINTMAX=0
515if test "$scm_stdint_has_uintmax"; then
516 SCM_I_GSC_T_UINTMAX='"uintmax_t"'
517 SCM_I_GSC_NEEDS_STDINT_H=1
518elif test "$scm_inttypes_has_uintmax"; then
519 SCM_I_GSC_T_UINTMAX='"uintmax_t"'
520 SCM_I_GSC_NEEDS_INTTYPES_H=1
521elif test "$ac_cv_sizeof_unsigned___int64" -ne 0; then
522 SCM_I_GSC_T_UINTMAX='"unsigned __int64"'
523elif test "$ac_cv_sizeof_unsigned_long_long" -ne 0; then
524 SCM_I_GSC_T_UINTMAX='"unsigned long long"'
525else
526 SCM_I_GSC_T_UINTMAX='"unsigned long"'
527fi
528AC_SUBST([SCM_I_GSC_T_UINTMAX])
529
530
531AC_SUBST([SCM_I_GSC_NEEDS_STDINT_H])
532AC_SUBST([SCM_I_GSC_NEEDS_INTTYPES_H])
533
534AC_HEADER_STDC
535AC_HEADER_DIRENT
536AC_HEADER_TIME
537AC_HEADER_SYS_WAIT
538
539# Reasons for testing:
540# complex.h - new in C99
541# fenv.h - available in C99, but not older systems
542# process.h - mingw specific
543# langinfo.h, nl_types.h - SuS v2
544#
545AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h malloc.h memory.h process.h string.h \
546regex.h rxposix.h rx/rxposix.h sys/dir.h sys/ioctl.h sys/select.h \
547sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
548sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
549direct.h langinfo.h nl_types.h])
550
551# "complex double" is new in C99, and "complex" is only a keyword if
552# <complex.h> is included
553AC_CHECK_TYPES(complex double,,,
554[#if HAVE_COMPLEX_H
555#include <complex.h>
556#endif])
557
558# On MacOS X <sys/socklen.h> contains socklen_t, so must include that
559# when testing.
560AC_CHECK_TYPE(socklen_t, ,
561 [AC_DEFINE_UNQUOTED(socklen_t, int,
562 [Define to `int' if <sys/socket.h> does not define.])],
563 [#if HAVE_SYS_TYPES_H
564#include <sys/types.h>
565#endif
566#include <sys/socket.h>
567])
568AC_CHECK_TYPE(struct ip_mreq)
569
570GUILE_HEADER_LIBC_WITH_UNISTD
571
572AC_TYPE_GETGROUPS
573AC_TYPE_SIGNAL
574AC_TYPE_MODE_T
575
576# On mingw -lm is empty, so this test is unnecessary, but it's
577# harmless so we don't hard-code to suppress it.
578#
579AC_CHECK_LIB(m, cos)
580
581AC_CHECK_FUNCS(gethostbyname)
582if test $ac_cv_func_gethostbyname = no; then
583 AC_CHECK_LIB(nsl, gethostbyname)
584fi
585
586AC_CHECK_FUNCS(connect)
587if test $ac_cv_func_connect = no; then
588 AC_CHECK_LIB(socket, connect)
589fi
590
591dnl
592dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
593dnl
594EXTRA_DEFS=""
595case $host in
596 *-*-mingw*)
597 AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCK2_H], 1,
598 [Define if you have the <winsock2.h> header file.])])
599 AC_CHECK_LIB(ws2_32, main)
600 AC_LIBOBJ([win32-uname])
601 AC_LIBOBJ([win32-dirent])
602 if test "$enable_networking" = yes ; then
603 AC_LIBOBJ([win32-socket])
604 fi
605 if test "$enable_shared" = yes ; then
606 EXTRA_DEFS="-DSCM_IMPORT"
607 AC_DEFINE(USE_DLL_IMPORT, 1,
608 [Define if you need additional CPP macros on Win32 platforms.])
609 fi
610 ;;
611esac
612AC_SUBST(EXTRA_DEFS)
613
614# Reasons for testing:
615# crt_externs.h - Darwin specific
616#
617AC_CHECK_HEADERS([assert.h crt_externs.h])
618
619# Reasons for testing:
620# DINFINITY - OSF specific
621# DQNAN - OSF specific
622# (DINFINITY and DQNAN are actually global variables, not functions)
623# chsize - an MS-DOS-ism, found in mingw
624# clog10 - not in mingw (though others like clog and csqrt are)
625# fesetround - available in C99, but not older systems
626# ftruncate - posix, but probably not older systems (current mingw
627# has it as an inline for chsize)
628# ioctl - not in mingw.
629# gmtime_r - recent posix, not on old systems
630# pipe - not in mingw
631# _pipe - specific to mingw, taking 3 args
632# readdir_r - recent posix, not on old systems
633# stat64 - SuS largefile stuff, not on old systems
634# sysconf - not on old systems
635# truncate - not in mingw
636# isblank - available as a GNU extension or in C99
637# _NSGetEnviron - Darwin specific
638# strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
639# nl_langinfo - X/Open, not available on Windows.
640#
641AC_CHECK_FUNCS([DINFINITY DQNAN chsize clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe readdir_r readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime strptime symlink sync sysconf 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 truncate unsetenv isblank _NSGetEnviron strcoll strcoll_l newlocale nl_langinfo])
642
643# Reasons for testing:
644# netdb.h - not in mingw
645# sys/param.h - not in mingw
646# pthread.h - only available with pthreads. ACX_PTHREAD doesn't
647# check this specifically, we need it for the timespec test below.
648# sethostname - the function itself check because it's not in mingw,
649# the DECL is checked because Solaris 10 doens't have in any header
650# xlocale.h - needed on Darwin for the `locale_t' API
651#
652AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h xlocale.h)
653AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
654AC_CHECK_DECLS([sethostname])
655
656# crypt() may or may not be available, for instance in some countries there
657# are restrictions on cryptography.
658#
659# crypt() might be in libc (eg. OpenBSD), or it might be in a separate
660# -lcrypt library (eg. Debian GNU/Linux).
661#
662# On HP-UX 11, crypt() is in libc and there's a dummy libcrypt.a. We must
663# be careful to avoid -lcrypt in this case, since libtool will see there's
664# only a static libcrypt and decide to build only a static libguile.
665#
666# AC_SEARCH_LIBS lets us add -lcrypt to LIBS only if crypt() is not in the
667# libraries already in that list.
668#
669AC_SEARCH_LIBS(crypt, crypt,
670 [AC_DEFINE(HAVE_CRYPT,1,
671 [Define to 1 if you have the `crypt' function.])])
672
673# glibc 2.3.6 (circa 2006) and various prior versions had a bug where
674# csqrt(-i) returned a negative real part, when it should be positive
675# for the principal root.
676#
677if test "$ac_cv_type_complex_double" = yes; then
678
679 AC_CHECK_FUNCS(cexp clog carg)
680 AC_CACHE_CHECK([whether csqrt is usable],
681 guile_cv_use_csqrt,
682 [AC_TRY_RUN([
683#include <complex.h>
684/* "volatile" is meant to prevent gcc from calculating the sqrt as a
685 constant, we want to test libc. */
686volatile complex double z = - _Complex_I;
687int
688main (void)
689{
690 z = csqrt (z);
691 if (creal (z) > 0.0)
692 return 0; /* good */
693 else
694 return 1; /* bad */
695}],
696 [guile_cv_use_csqrt=yes],
697 [guile_cv_use_csqrt="no, glibc 2.3 bug"],
698 [guile_cv_use_csqrt="yes, hopefully (cross-compiling)"])])
699 case $guile_cv_use_csqrt in
700 yes*)
701 AC_DEFINE(HAVE_USABLE_CSQRT, 1, [Define to 1 if csqrt is bug-free])
702 ;;
703 esac
704fi
705
706
707dnl GMP tests
708AC_CHECK_LIB([gmp], [__gmpz_init], ,
709 [AC_MSG_ERROR([GNU MP not found, see README])])
710
711# mpz_import is a macro so we need to include <gmp.h>
712AC_TRY_LINK([#include <gmp.h>],
713 [mpz_import (0, 0, 0, 0, 0, 0, 0);] , ,
714 [AC_MSG_ERROR([At least GNU MP 4.1 is required, see README])])
715
716dnl i18n tests
717#AC_CHECK_HEADERS([libintl.h])
718#AC_CHECK_FUNCS(gettext)
719#if test $ac_cv_func_gettext = no; then
720# AC_CHECK_LIB(intl, gettext)
721#fi
722#AC_CHECK_FUNCS([bindtextdomain textdomain])
723AM_GNU_GETTEXT([external], [need-ngettext])
724
725### Some systems don't declare some functions. On such systems, we
726### need to at least provide our own K&R-style declarations.
727
728### GUILE_FUNC_DECLARED(function, headerfile)
729
730### Check for a declaration of FUNCTION in HEADERFILE; if it is
731### not there, #define MISSING_FUNCTION_DECL.
732AC_DEFUN([GUILE_FUNC_DECLARED], [
733 AC_CACHE_CHECK(for $1 declaration, guile_cv_func_$1_declared,
734 AC_EGREP_HEADER($1, $2,
735 guile_cv_func_$1_declared=yes,
736 guile_cv_func_$1_declared=no))
737 if test [x$guile_cv_func_]$1[_declared] = xno; then
738 AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL], 1,
739 [Define if the operating system supplies $1 without declaring it.])
740 fi
741])
742
743GUILE_FUNC_DECLARED(sleep, unistd.h)
744GUILE_FUNC_DECLARED(usleep, unistd.h)
745
746AC_CHECK_DECLS([strptime],,,
747[#define _GNU_SOURCE /* ask glibc to give strptime prototype */
748#include <time.h>])
749
750### On some systems usleep has no return value. If it does have one,
751### we'd like to return it; otherwise, we'll fake it.
752AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type,
753 [AC_EGREP_HEADER(changequote(<, >)<void[ ]+usleep>changequote([, ]),
754 unistd.h,
755 [guile_cv_func_usleep_return_type=void],
756 [guile_cv_func_usleep_return_type=int])])
757case "$guile_cv_func_usleep_return_type" in
758 "void" )
759 AC_DEFINE(USLEEP_RETURNS_VOID, 1,
760 [Define if the system headers declare usleep to return void.])
761 ;;
762esac
763
764AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
765if test -n "$have_sys_un_h" ; then
766 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS, 1,
767 [Define if the system supports Unix-domain (file-domain) sockets.])
768fi
769
770AC_CHECK_FUNCS(socketpair getgroups setgroups setpwent pause tzset)
771
772AC_CHECK_FUNCS(sethostent gethostent endhostent dnl
773 setnetent getnetent endnetent dnl
774 setprotoent getprotoent endprotoent dnl
775 setservent getservent endservent dnl
776 getnetbyaddr getnetbyname dnl
777 inet_lnaof inet_makeaddr inet_netof hstrerror dnl
778 inet_pton inet_ntop)
779
780# struct sockaddr field sin_len is only present on BSD systems.
781# On 4.4BSD apparently a #define SIN_LEN exists, but on other BSD systems
782# (eg. FreeBSD 4.9) it doesn't and we must use this configure check
783AC_CHECK_MEMBERS([struct sockaddr.sin_len],,,
784[#ifdef HAVE_SYS_TYPES_H
785#include <sys/types.h>
786#endif
787#include <netinet/in.h>])
788
789AC_MSG_CHECKING(for __libc_stack_end)
790AC_CACHE_VAL(guile_cv_have_libc_stack_end,
791[AC_TRY_LINK([#include <stdio.h>
792extern char *__libc_stack_end;],
793 [printf("%p", (char*) __libc_stack_end);],
794 guile_cv_have_libc_stack_end=yes,
795 guile_cv_have_libc_stack_end=no)])
796AC_MSG_RESULT($guile_cv_have_libc_stack_end)
797
798if test $guile_cv_have_libc_stack_end = yes; then
799 AC_DEFINE(HAVE_LIBC_STACK_END, 1,
800 [Define if you have the __libc_stack_end variable.])
801fi
802
803dnl Some systems do not declare this. Some systems do declare it, as a
804dnl macro. With cygwin it may be in a DLL.
805
806AC_MSG_CHECKING(whether netdb.h declares h_errno)
807AC_CACHE_VAL(guile_cv_have_h_errno,
808[AC_TRY_COMPILE([#include <netdb.h>],
809[int a = h_errno;],
810guile_cv_have_h_errno=yes, guile_cv_have_h_errno=no)])
811AC_MSG_RESULT($guile_cv_have_h_errno)
812if test $guile_cv_have_h_errno = yes; then
813 AC_DEFINE(HAVE_H_ERRNO, 1, [Define if h_errno is declared in netdb.h.])
814fi
815
816AC_MSG_CHECKING(whether uint32_t is defined)
817AC_CACHE_VAL(guile_cv_have_uint32_t,
818 [AC_TRY_COMPILE([#include <sys/types.h>
819 #if HAVE_STDINT_H
820 #include <stdint.h>
821 #endif
822 #ifndef HAVE_NETDB_H
823 #include <netdb.h>
824 #endif],
825 [uint32_t a;],
826 guile_cv_have_uint32_t=yes, guile_cv_have_uint32_t=no)])
827AC_MSG_RESULT($guile_cv_have_uint32_t)
828if test $guile_cv_have_uint32_t = yes; then
829 AC_DEFINE(HAVE_UINT32_T, 1,
830 [Define if uint32_t typedef is defined when netdb.h is include.])
831fi
832
833AC_MSG_CHECKING(for working IPv6 support)
834AC_CACHE_VAL(guile_cv_have_ipv6,
835[AC_TRY_COMPILE([
836#ifdef HAVE_SYS_TYPES_H
837#include <sys/types.h>
838#endif
839#include <netinet/in.h>
840#include <sys/socket.h>],
841[struct sockaddr_in6 a; a.sin6_family = AF_INET6;],
842guile_cv_have_ipv6=yes, guile_cv_have_ipv6=no)])
843AC_MSG_RESULT($guile_cv_have_ipv6)
844if test $guile_cv_have_ipv6 = yes; then
845 AC_DEFINE(HAVE_IPV6, 1, [Define if you want support for IPv6.])
846fi
847
848# included in rfc2553 but not in older implementations, e.g., glibc 2.1.3.
849AC_MSG_CHECKING(whether sockaddr_in6 has sin6_scope_id)
850AC_CACHE_VAL(guile_cv_have_sin6_scope_id,
851[AC_TRY_COMPILE([
852#ifdef HAVE_SYS_TYPES_H
853#include <sys/types.h>
854#endif
855#include <netinet/in.h>],
856[struct sockaddr_in6 sok; sok.sin6_scope_id = 0;],
857guile_cv_have_sin6_scope_id=yes, guile_cv_have_sin6_scope_id=no)])
858AC_MSG_RESULT($guile_cv_have_sin6_scope_id)
859if test $guile_cv_have_sin6_scope_id = yes; then
860 AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1,
861 [Define this if your IPv6 has sin6_scope_id in sockaddr_in6 struct.])
862fi
863
864# struct sockaddr_in6 field sin_len is only present on BSD systems
865AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_len],,,
866[#ifdef HAVE_SYS_TYPES_H
867#include <sys/types.h>
868#endif
869#include <netinet/in.h>])
870
871AC_MSG_CHECKING(whether localtime caches TZ)
872AC_CACHE_VAL(guile_cv_localtime_cache,
873[if test x$ac_cv_func_tzset = xyes; then
874AC_TRY_RUN([#include <time.h>
875#if STDC_HEADERS
876# include <stdlib.h>
877#endif
878extern char **environ;
879unset_TZ ()
880{
881 char **from, **to;
882 for (to = from = environ; (*to = *from); from++)
883 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
884 to++;
885}
886char TZ_GMT0[] = "TZ=GMT0";
887char TZ_PST8[] = "TZ=PST8";
888main()
889{
890 time_t now = time ((time_t *) 0);
891 int hour_GMT0, hour_unset;
892 if (putenv (TZ_GMT0) != 0)
893 exit (1);
894 hour_GMT0 = localtime (&now)->tm_hour;
895 unset_TZ ();
896 hour_unset = localtime (&now)->tm_hour;
897 if (putenv (TZ_PST8) != 0)
898 exit (1);
899 if (localtime (&now)->tm_hour == hour_GMT0)
900 exit (1);
901 unset_TZ ();
902 if (localtime (&now)->tm_hour != hour_unset)
903 exit (1);
904 exit (0);
905}], guile_cv_localtime_cache=no, guile_cv_localtime_cache=yes,
906[# If we have tzset, assume the worst when cross-compiling.
907guile_cv_localtime_cache=yes])
908else
909 # If we lack tzset, report that localtime does not cache TZ,
910 # since we can't invalidate the cache if we don't have tzset.
911 guile_cv_localtime_cache=no
912fi])dnl
913AC_MSG_RESULT($guile_cv_localtime_cache)
914if test $guile_cv_localtime_cache = yes; then
915 AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.])
916fi
917
918dnl Test whether system calls are restartable by default on the
919dnl current system. If they are not, we put a loop around every system
920dnl call to check for EINTR (see SCM_SYSCALL) and do not attempt to
921dnl change from the default behaviour. On the other hand, if signals
922dnl are restartable then the loop is not installed and when libguile
923dnl initialises it also resets the behaviour of each signal to cause a
924dnl restart (in case a different runtime had a different default
925dnl behaviour for some reason: e.g., different versions of linux seem
926dnl to behave differently.)
927
928AC_SYS_RESTARTABLE_SYSCALLS
929
930if test "$enable_regex" = yes; then
931 if test "$ac_cv_header_regex_h" = yes ||
932 test "$ac_cv_header_rxposix_h" = yes ||
933 test "$ac_cv_header_rx_rxposix_h" = yes; then
934 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [AC_LIBOBJ([regex-posix])],
935 [AC_CHECK_LIB(rx, main)
936 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [AC_LIBOBJ([regex-posix])],
937 [AC_CHECK_LIB(regex, main)
938 GUILE_NAMED_CHECK_FUNC(regcomp, regex, [AC_LIBOBJ([regex-posix])])])]
939 )
940 dnl The following should not be necessary, but for some reason
941 dnl autoheader misses it if we don't include it!
942 if test "$ac_cv_func_regcomp_norx" = yes ||
943 test "$ac_cv_func_regcomp_regex" = yes ||
944 test "$ac_cv_func_regcomp_rx" = yes; then
945 AC_DEFINE(HAVE_REGCOMP, 1,
946 [This is included as part of a workaround for a autoheader bug.])
947 fi
948 fi
949fi
950
951AC_REPLACE_FUNCS(inet_aton putenv strerror memmove mkstemp)
952
953AC_CHECK_HEADERS(floatingpoint.h ieeefp.h nan.h)
954
955# Reasons for testing:
956# asinh, acosh, atanh, trunc - C99 standard, generally not available on
957# older systems
958# sincos - GLIBC extension
959#
960AC_CHECK_FUNCS(asinh acosh atanh copysign finite sincos trunc)
961
962# C99 specifies isinf and isnan as macros.
963# HP-UX provides only macros, no functions.
964# glibc 2.3.2 provides both macros and functions.
965# IRIX 6.5 and Solaris 8 only provide functions.
966#
967# The following tests detect isinf and isnan either as functions or as
968# macros from <math.h>. Plain AC_CHECK_FUNCS is insufficient, it doesn't
969# use <math.h> so doesn't detect on macro-only systems like HP-UX.
970#
971AC_MSG_CHECKING([for isinf])
972AC_LINK_IFELSE(AC_LANG_SOURCE(
973[[#include <math.h>
974volatile double x = 0.0;
975int main () { return (isinf(x) != 0); }]]),
976 [AC_MSG_RESULT([yes])
977 AC_DEFINE(HAVE_ISINF, 1,
978 [Define to 1 if you have the `isinf' macro or function.])],
979 [AC_MSG_RESULT([no])])
980AC_MSG_CHECKING([for isnan])
981AC_LINK_IFELSE(AC_LANG_SOURCE(
982[[#include <math.h>
983volatile double x = 0.0;
984int main () { return (isnan(x) != 0); }]]),
985 [AC_MSG_RESULT([yes])
986 AC_DEFINE(HAVE_ISNAN, 1,
987 [Define to 1 if you have the `isnan' macro or function.])],
988 [AC_MSG_RESULT([no])])
989
990# We must have a proper stack-using alloca in order for stack-copying
991# continuations to work properly. If we don't find a native one,
992# abort.
993
994AC_FUNC_ALLOCA
995if test "$ALLOCA" = "alloca.o"
996then
997 AC_ERROR([No native alloca found.])
998fi
999
1000# Reasons for checking:
1001#
1002# st_rdev
1003# st_blksize
1004# st_blocks not in mingw
1005# tm_gmtoff BSD+GNU, not in C99
1006#
1007# Note AC_STRUCT_ST_BLOCKS is not used here because we don't want the
1008# AC_LIBOBJ(fileblocks) replacement which that macro gives.
1009#
1010AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize, struct stat.st_blocks])
1011
1012AC_STRUCT_TIMEZONE
1013AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,
1014[#include <time.h>
1015#ifdef TIME_WITH_SYS_TIME
1016# include <sys/time.h>
1017# include <time.h>
1018#else
1019# if HAVE_SYS_TIME_H
1020# include <sys/time.h>
1021# else
1022# include <time.h>
1023# endif
1024#endif
1025])
1026GUILE_STRUCT_UTIMBUF
1027
1028
1029#--------------------------------------------------------------------
1030#
1031# Which way does the stack grow?
1032#
1033#--------------------------------------------------------------------
1034
1035SCM_I_GSC_STACK_GROWS_UP=0
1036AC_TRY_RUN(aux (l) unsigned long l;
1037 { int x; exit (l >= ((unsigned long)&x)); }
1038 main () { int q; aux((unsigned long)&q); },
1039 [SCM_I_GSC_STACK_GROWS_UP=1],
1040 [],
1041 [AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h)])
1042
1043AC_CHECK_SIZEOF(float)
1044if test "$ac_cv_sizeof_float" -le "$ac_cv_sizeof_long"; then
1045 AC_DEFINE(SCM_SINGLES, 1,
1046 [Define this if floats are the same size as longs.])
1047fi
1048
1049AC_MSG_CHECKING(for struct linger)
1050AC_CACHE_VAL(scm_cv_struct_linger,
1051 AC_TRY_COMPILE([
1052#include <sys/types.h>
1053#include <sys/socket.h>],
1054 [struct linger lgr; lgr.l_linger = 100],
1055 scm_cv_struct_linger="yes",
1056 scm_cv_struct_linger="no"))
1057AC_MSG_RESULT($scm_cv_struct_linger)
1058if test $scm_cv_struct_linger = yes; then
1059 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
1060 [Define this if your system defines struct linger, for use with the
1061 getsockopt and setsockopt system calls.])
1062fi
1063
1064
1065# On mingw, struct timespec is in <pthread.h>.
1066#
1067AC_MSG_CHECKING(for struct timespec)
1068AC_CACHE_VAL(scm_cv_struct_timespec,
1069 AC_TRY_COMPILE([
1070#include <time.h>
1071#if HAVE_PTHREAD_H
1072#include <pthread.h>
1073#endif],
1074 [struct timespec t; t.tv_nsec = 100],
1075 scm_cv_struct_timespec="yes",
1076 scm_cv_struct_timespec="no"))
1077AC_MSG_RESULT($scm_cv_struct_timespec)
1078if test $scm_cv_struct_timespec = yes; then
1079 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
1080 [Define this if your system defines struct timespec via either <time.h> or <pthread.h>.])
1081fi
1082
1083#--------------------------------------------------------------------
1084#
1085# Flags for thread support
1086#
1087#--------------------------------------------------------------------
1088
1089SCM_I_GSC_USE_PTHREAD_THREADS=0
1090SCM_I_GSC_USE_NULL_THREADS=0
1091AC_SUBST([SCM_I_GSC_USE_PTHREAD_THREADS])
1092AC_SUBST([SCM_I_GSC_USE_NULL_THREADS])
1093
1094### What thread package has the user asked for?
1095AC_ARG_WITH(threads, [ --with-threads thread interface],
1096 , with_threads=yes)
1097
1098AC_SUBST(SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT, 0)
1099
1100case "$with_threads" in
1101 "yes" | "pthread" | "pthreads" | "pthread-threads" | "")
1102 ACX_PTHREAD(CC="$PTHREAD_CC"
1103 LIBS="$PTHREAD_LIBS $LIBS"
1104 SCM_I_GSC_USE_PTHREAD_THREADS=1
1105 with_threads="pthreads",
1106 with_threads="null")
1107
1108 old_CFLAGS="$CFLAGS"
1109 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
1110
1111 # Reasons for testing:
1112 # pthread_getattr_np - "np" meaning "non portable" says it
1113 # all; not present on MacOS X or Solaris 10
1114 # pthread_get_stackaddr_np - "np" meaning "non portable" says it
1115 # all; specific to MacOS X
1116 # pthread_sigmask - not available on mingw
1117 #
1118 AC_CHECK_FUNCS(pthread_attr_getstack pthread_getattr_np pthread_get_stackaddr_np pthread_sigmask)
1119
1120 # On past versions of Solaris, believe 8 through 10 at least, you
1121 # had to write "pthread_once_t foo = { PTHREAD_ONCE_INIT };".
1122 # This is contrary to posix:
1123 # http://www.opengroup.org/onlinepubs/000095399/functions/pthread_once.html
1124 # Check here if this style is required.
1125 #
1126 # glibc (2.3.6 at least) works both with or without braces, so the
1127 # test checks whether it works without.
1128 #
1129 AC_CACHE_CHECK([whether PTHREAD_ONCE_INIT needs braces],
1130 guile_cv_need_braces_on_pthread_once_init,
1131 [AC_TRY_COMPILE([#include <pthread.h>],
1132 [pthread_once_t foo = PTHREAD_ONCE_INIT;],
1133 [guile_cv_need_braces_on_pthread_once_init=no],
1134 [guile_cv_need_braces_on_pthread_once_init=yes])])
1135 if test "$guile_cv_need_braces_on_pthread_once_init" = yes; then
1136 SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT=1
1137 fi
1138
1139 CFLAGS="$old_CFLAGS"
1140
1141 # On Solaris, sched_yield lives in -lrt.
1142 AC_SEARCH_LIBS(sched_yield, rt)
1143
1144 ;;
1145esac
1146
1147case "$with_threads" in
1148 "pthreads")
1149 ;;
1150 "no" | "null")
1151 SCM_I_GSC_USE_NULL_THREADS=1
1152 with_threads="null-threads"
1153 ;;
1154 * )
1155 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
1156 ;;
1157esac
1158
1159AC_MSG_CHECKING(what kind of threads to support)
1160AC_MSG_RESULT($with_threads)
1161
1162## Check whether pthread_attr_getstack works for the main thread
1163
1164if test "$with_threads" = pthreads; then
1165
1166AC_MSG_CHECKING(whether pthread_attr_getstack works for the main thread)
1167old_CFLAGS="$CFLAGS"
1168CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
1169AC_TRY_RUN(
1170[
1171#if HAVE_PTHREAD_ATTR_GETSTACK
1172#include <pthread.h>
1173
1174int main ()
1175{
1176 pthread_attr_t attr;
1177 void *start, *end;
1178 size_t size;
1179
1180 pthread_getattr_np (pthread_self (), &attr);
1181 pthread_attr_getstack (&attr, &start, &size);
1182 end = (char *)start + size;
1183
1184 if ((void *)&attr < start || (void *)&attr >= end)
1185 return 1;
1186 else
1187 return 0;
1188}
1189#else
1190int main ()
1191{
1192 return 1;
1193}
1194#endif
1195],
1196[works=yes
1197AC_DEFINE(PTHREAD_ATTR_GETSTACK_WORKS, [1], [Define when pthread_att_get_stack works for the main thread])],
1198[works=no])
1199CFLAGS="$old_CFLAGS"
1200AC_MSG_RESULT($works)
1201
1202fi # with_threads=pthreads
1203
1204
1205## Cross building
1206if test "$cross_compiling" = "yes"; then
1207 AC_MSG_CHECKING(cc for build)
1208 ## /usr/bin/cc still uses wrong assembler
1209 ## CC_FOR_BUILD="${CC_FOR_BUILD-/usr/bincc}"
1210 CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}"
1211else
1212 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
1213fi
1214
1215## AC_MSG_CHECKING("if we are cross compiling")
1216## AC_MSG_RESULT($cross_compiling)
1217if test "$cross_compiling" = "yes"; then
1218 AC_MSG_RESULT($CC_FOR_BUILD)
1219fi
1220
1221## No need as yet to be more elaborate
1222CCLD_FOR_BUILD="$CC_FOR_BUILD"
1223
1224AC_SUBST(cross_compiling)
1225AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
1226AC_SUBST(CCLD_FOR_BUILD)
1227
1228## libtool erroneously calls CC_FOR_BUILD HOST_CC;
1229## --HOST is the platform that PACKAGE is compiled for.
1230HOST_CC="$CC_FOR_BUILD"
1231AC_SUBST(HOST_CC)
1232
1233if test "$cross_compiling" = "yes"; then
1234 AC_MSG_CHECKING(guile for build)
1235 GUILE_FOR_BUILD="${GUILE_FOR_BUILD-guile}"
1236else
1237 GUILE_FOR_BUILD='$(preinstguile)'
1238fi
1239
1240## AC_MSG_CHECKING("if we are cross compiling")
1241## AC_MSG_RESULT($cross_compiling)
1242if test "$cross_compiling" = "yes"; then
1243 AC_MSG_RESULT($GUILE_FOR_BUILD)
1244fi
1245AC_ARG_VAR(GUILE_FOR_BUILD,[guile for build system])
1246AC_SUBST(GUILE_FOR_BUILD)
1247
1248## If we're using GCC, ask for aggressive warnings.
1249case "$GCC" in
1250 yes )
1251 ## We had -Wstrict-prototypes in here for a bit, but Guile does too
1252 ## much stuff with generic function pointers for that to really be
1253 ## less than exasperating.
1254 ## -Wpointer-arith was here too, but something changed in gcc/glibc
1255 ## and it became equally exasperating (gcc 2.95 and/or glibc 2.1.2).
1256 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
1257 # Do this here so we don't screw up any of the tests above that might
1258 # not be "warning free"
1259 if test "${GUILE_ERROR_ON_WARNING}" = yes
1260 then
1261 CFLAGS="${CFLAGS} -Werror"
1262 enable_compile_warnings=no
1263 fi
1264 ;;
1265esac
1266
1267## If we're creating a shared library (using libtool!), then we'll
1268## need to generate a list of .lo files corresponding to the .o files
1269## given in LIBOBJS. We'll call it LIBLOBJS.
1270LIBLOBJS="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`"
1271
1272## We also need to create corresponding .doc and .x files
1273EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`"
1274EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`"
1275
1276AC_SUBST(GUILE_MAJOR_VERSION)
1277AC_SUBST(GUILE_MINOR_VERSION)
1278AC_SUBST(GUILE_MICRO_VERSION)
1279AC_SUBST(GUILE_EFFECTIVE_VERSION)
1280AC_SUBST(GUILE_VERSION)
1281
1282#######################################################################
1283# library versioning
1284
1285AC_SUBST(LIBGUILE_INTERFACE_CURRENT)
1286AC_SUBST(LIBGUILE_INTERFACE_REVISION)
1287AC_SUBST(LIBGUILE_INTERFACE_AGE)
1288AC_SUBST(LIBGUILE_INTERFACE)
1289
1290AC_SUBST(LIBGUILE_SRFI_SRFI_1_MAJOR)
1291AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_CURRENT)
1292AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_REVISION)
1293AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_AGE)
1294AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE)
1295
1296AC_SUBST(LIBGUILE_SRFI_SRFI_4_MAJOR)
1297AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT)
1298AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION)
1299AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE)
1300AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE)
1301
1302AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_MAJOR)
1303AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT)
1304AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION)
1305AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE)
1306AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE)
1307
1308AC_SUBST(LIBGUILE_SRFI_SRFI_60_MAJOR)
1309AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_CURRENT)
1310AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_REVISION)
1311AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_AGE)
1312AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE)
1313
1314AC_SUBST(LIBGUILE_I18N_MAJOR)
1315AC_SUBST(LIBGUILE_I18N_INTERFACE_CURRENT)
1316AC_SUBST(LIBGUILE_I18N_INTERFACE_REVISION)
1317AC_SUBST(LIBGUILE_I18N_INTERFACE_AGE)
1318AC_SUBST(LIBGUILE_I18N_INTERFACE)
1319
1320
1321#######################################################################
1322
1323dnl Tell guile-config what flags guile users should compile and link with.
1324GUILE_LIBS="$LDFLAGS $LIBS"
1325GUILE_CFLAGS="$PTHREAD_CFLAGS"
1326AC_SUBST(GUILE_LIBS)
1327AC_SUBST(GUILE_CFLAGS)
1328
1329AC_SUBST(AWK)
1330AC_SUBST(LIBLOBJS)
1331AC_SUBST(EXTRA_DOT_DOC_FILES)
1332AC_SUBST(EXTRA_DOT_X_FILES)
1333
1334dnl See also top_builddir in info node: (libtool)AC_PROG_LIBTOOL
1335top_builddir_absolute=`pwd`
1336AC_SUBST(top_builddir_absolute)
1337top_srcdir_absolute=`(cd $srcdir && pwd)`
1338AC_SUBST(top_srcdir_absolute)
1339
1340# Additional SCM_I_GSC definitions are above.
1341AC_SUBST([SCM_I_GSC_GUILE_DEBUG])
1342AC_SUBST([SCM_I_GSC_GUILE_DEBUG_FREELIST])
1343AC_SUBST([SCM_I_GSC_ENABLE_DISCOURAGED])
1344AC_SUBST([SCM_I_GSC_ENABLE_DEPRECATED])
1345AC_SUBST([SCM_I_GSC_ENABLE_ELISP])
1346AC_SUBST([SCM_I_GSC_STACK_GROWS_UP])
1347AC_SUBST([SCM_I_GSC_C_INLINE])
1348AC_CONFIG_FILES([libguile/gen-scmconfig.h])
1349
1350AC_CONFIG_FILES([
1351 Makefile
1352 am/Makefile
1353 benchmark-suite/Makefile
1354 doc/Makefile
1355 doc/goops/Makefile
1356 doc/r5rs/Makefile
1357 doc/ref/Makefile
1358 doc/tutorial/Makefile
1359 emacs/Makefile
1360 examples/Makefile
1361 examples/box-dynamic-module/Makefile
1362 examples/box-dynamic/Makefile
1363 examples/box-module/Makefile
1364 examples/box/Makefile
1365 examples/modules/Makefile
1366 examples/safe/Makefile
1367 examples/scripts/Makefile
1368 guile-config/Makefile
1369 ice-9/Makefile
1370 ice-9/debugger/Makefile
1371 ice-9/debugging/Makefile
1372 lang/Makefile
1373 lang/elisp/Makefile
1374 lang/elisp/internals/Makefile
1375 lang/elisp/primitives/Makefile
1376 libguile/Makefile
1377 oop/Makefile
1378 oop/goops/Makefile
1379 scripts/Makefile
1380 srfi/Makefile
1381 test-suite/Makefile
1382 test-suite/standalone/Makefile
1383])
1384
1385AC_CONFIG_FILES([check-guile], [chmod +x check-guile])
1386AC_CONFIG_FILES([benchmark-guile], [chmod +x benchmark-guile])
1387AC_CONFIG_FILES([guile-tools], [chmod +x guile-tools])
1388AC_CONFIG_FILES([pre-inst-guile], [chmod +x pre-inst-guile])
1389AC_CONFIG_FILES([pre-inst-guile-env], [chmod +x pre-inst-guile-env])
1390AC_CONFIG_FILES([libguile/guile-snarf],
1391 [chmod +x libguile/guile-snarf])
1392AC_CONFIG_FILES([libguile/guile-doc-snarf],
1393 [chmod +x libguile/guile-doc-snarf])
1394AC_CONFIG_FILES([libguile/guile-func-name-check],
1395 [chmod +x libguile/guile-func-name-check])
1396AC_CONFIG_FILES([libguile/guile-snarf-docs],
1397 [chmod +x libguile/guile-snarf-docs])
1398
1399AC_OUTPUT
1400
1401dnl Local Variables:
1402dnl comment-start: "dnl "
1403dnl comment-end: ""
1404dnl comment-start-skip: "\\bdnl\\b\\s *"
1405dnl End: