Changes from arch/CVS synchronization
[bpt/guile.git] / configure.in
1 dnl configuration script for Guile
2 dnl Process this file with autoconf to produce configure.
3 dnl
4
5 define(GUILE_CONFIGURE_COPYRIGHT,[[
6
7 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
8
9 This file is part of GUILE
10
11 GUILE is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2, or (at your
14 option) any later version.
15
16 GUILE is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with GUILE; see the file COPYING. If not, write to the
23 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 Boston, MA 02110-1301, USA.
25
26 ]])
27
28 AC_PREREQ(2.53)
29
30 dnl `patsubst' here deletes the newline which "echo" prints. We can't use
31 dnl "echo -n" since -n is not portable (see autoconf manual "Limitations of
32 dnl Builtins"), in particular on solaris it results in a literal "-n" in
33 dnl the output.
34 dnl
35 AC_INIT(patsubst(m4_esyscmd(. ./GUILE-VERSION && echo ${PACKAGE}),[
36 ]),
37 patsubst(m4_esyscmd(. ./GUILE-VERSION && echo ${GUILE_VERSION}),[
38 ]),
39 [bug-guile@gnu.org])
40 AC_CONFIG_AUX_DIR([.])
41 AC_CONFIG_SRCDIR(GUILE-VERSION)
42 AM_INIT_AUTOMAKE([no-define])
43
44 AC_COPYRIGHT(GUILE_CONFIGURE_COPYRIGHT)
45 AC_CONFIG_SRCDIR([GUILE-VERSION])
46
47 . $srcdir/GUILE-VERSION
48
49 AM_MAINTAINER_MODE
50 AM_CONFIG_HEADER([config.h])
51 AH_TOP(/*GUILE_CONFIGURE_COPYRIGHT*/)
52
53 #--------------------------------------------------------------------
54 #
55 # Independent Subdirectories
56 #
57 #--------------------------------------------------------------------
58
59 AC_CONFIG_SUBDIRS(guile-readline)
60
61 #--------------------------------------------------------------------
62
63 dnl Some more checks for Win32
64 AC_CYGWIN
65 AC_LIBTOOL_WIN32_DLL
66
67 AC_PROG_INSTALL
68 AC_PROG_CC
69 AC_PROG_CPP
70 AC_PROG_AWK
71
72 AC_AIX
73 AC_ISC_POSIX
74 AC_MINIX
75
76 AM_PROG_CC_STDC
77 # for per-target cflags in the libguile subdir
78 AM_PROG_CC_C_O
79
80 AC_LIBTOOL_DLOPEN
81 AC_PROG_LIBTOOL
82 AC_CHECK_LIB([ltdl], [lt_dlinit], ,
83 [AC_MSG_ERROR([libltdl not found. See README.])])
84
85 AC_SUBST(DLPREOPEN)
86
87 AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
88 AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
89
90 AM_PATH_LISPDIR
91
92 #--------------------------------------------------------------------
93 #
94 # User options (after above tests that may set default CFLAGS etc.)
95 #
96 #--------------------------------------------------------------------
97
98 GUILE_ERROR_ON_WARNING="yes"
99
100 AC_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
108 SCM_I_GSC_GUILE_DEBUG_FREELIST=0
109 AC_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
116 AC_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
123 SCM_I_GSC_GUILE_DEBUG=0
124 AC_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
131 AC_ARG_ENABLE(posix,
132 [ --disable-posix omit posix interfaces],,
133 enable_posix=yes)
134
135 AC_ARG_ENABLE(networking,
136 [ --disable-networking omit networking interfaces],,
137 enable_networking=yes)
138
139 AC_ARG_ENABLE(regex,
140 [ --disable-regex omit regular expression interfaces],,
141 enable_regex=yes)
142
143 AC_ARG_ENABLE([discouraged],
144 AC_HELP_STRING([--disable-discouraged],[omit discouraged features]))
145
146 if test "$enable_discouraged" = no; then
147 SCM_I_GSC_ENABLE_DISCOURAGED=0
148 else
149 SCM_I_GSC_ENABLE_DISCOURAGED=1
150 fi
151
152 AC_ARG_ENABLE([deprecated],
153 AC_HELP_STRING([--disable-deprecated],[omit deprecated features]))
154
155 if test "$enable_deprecated" = no; then
156 SCM_I_GSC_ENABLE_DEPRECATED=0
157 else
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.])
168 fi
169
170 AC_ARG_ENABLE(elisp,
171 [ --disable-elisp omit Emacs Lisp support],,
172 enable_elisp=yes)
173
174 #--------------------------------------------------------------------
175
176 dnl Check for dynamic linking
177
178 use_modules=yes
179 AC_ARG_WITH(modules,
180 [ --with-modules[=FILES] Add support for dynamic modules],
181 use_modules="$withval")
182 test -z "$use_modules" && use_modules=yes
183 DLPREOPEN=
184 if 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
193 fi
194
195 dnl files which are destined for separate modules.
196
197 if test "$use_modules" != no; then
198 AC_LIBOBJ([dynl])
199 fi
200
201 if test "$enable_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.])
206 fi
207
208 if 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.])
213 fi
214
215 if test "$enable_debug_malloc" = yes; then
216 AC_LIBOBJ([debug-malloc])
217 fi
218
219 if test "$enable_elisp" = yes; then
220 SCM_I_GSC_ENABLE_ELISP=1
221 else
222 SCM_I_GSC_ENABLE_ELISP=0
223 fi
224 AC_CHECK_LIB(uca, __uc_get_ar_bsp)
225
226 AC_C_CONST
227
228 # "volatile" is used in a couple of tests below.
229 AC_C_VOLATILE
230
231 AC_C_INLINE
232 if test "$ac_cv_c_inline" != no; then
233 SCM_I_GSC_C_INLINE="\"${ac_cv_c_inline}\""
234 else
235 SCM_I_GSC_C_INLINE=NULL
236 fi
237 AC_CHECK_LIB(uca, __uc_get_ar_bsp)
238
239 AC_C_BIGENDIAN
240
241 AC_CHECK_SIZEOF(char)
242 AC_CHECK_SIZEOF(unsigned char)
243 AC_CHECK_SIZEOF(short)
244 AC_CHECK_SIZEOF(unsigned short)
245 AC_CHECK_SIZEOF(int)
246 AC_CHECK_SIZEOF(unsigned int)
247 AC_CHECK_SIZEOF(long)
248 AC_CHECK_SIZEOF(unsigned long)
249 AC_CHECK_SIZEOF(size_t)
250 AC_CHECK_SIZEOF(long long)
251 AC_CHECK_SIZEOF(unsigned long long)
252 AC_CHECK_SIZEOF(__int64)
253 AC_CHECK_SIZEOF(unsigned __int64)
254 AC_CHECK_SIZEOF(void *)
255 AC_CHECK_SIZEOF(intptr_t)
256 AC_CHECK_SIZEOF(uintptr_t)
257 AC_CHECK_SIZEOF(ptrdiff_t)
258 AC_CHECK_SIZEOF(size_t)
259 AC_CHECK_SIZEOF(off_t)
260
261 if test "$ac_cv_sizeof_long" -ne "$ac_cv_sizeof_void_p"; then
262 AC_MSG_ERROR(sizes of long and void* are not identical)
263 fi
264
265 if test "$ac_cv_sizeof_ptrdiff_t" -ne 0; then
266 SCM_I_GSC_T_PTRDIFF='"ptrdiff_t"'
267 else
268 SCM_I_GSC_T_PTRDIFF='"long"'
269 fi
270 AC_SUBST([SCM_I_GSC_T_PTRDIFF])
271
272 AC_CHECK_HEADERS([stdint.h])
273 AC_CHECK_HEADERS([inttypes.h])
274
275 AC_CHECK_SIZEOF(intmax_t)
276
277 SCM_I_GSC_NEEDS_STDINT_H=0
278 SCM_I_GSC_NEEDS_INTTYPES_H=0
279
280 ### intptr and uintptr (try not to use inttypes if we don't have to)
281 if 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
296 fi
297
298 ### See what's provided by stdint.h
299 if 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>])
310 fi
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
315 unset ac_cv_type_int8_t
316 unset ac_cv_type_uint8_t
317 unset ac_cv_type_int16_t
318 unset ac_cv_type_uint16_t
319 unset ac_cv_type_int32_t
320 unset ac_cv_type_uint32_t
321 unset ac_cv_type_int64_t
322 unset ac_cv_type_uint64_t
323 unset ac_cv_type_intmax_t
324 unset ac_cv_type_uintmax_t
325
326 ### See what's provided by inttypes.h
327 if 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>])
338 fi
339
340 # Try hard to find definitions for some required scm_t_*int* types.
341
342 ### Required type scm_t_int8
343 if test "$scm_stdint_has_int8"; then
344 SCM_I_GSC_T_INT8='"int8_t"'
345 SCM_I_GSC_NEEDS_STDINT_H=1
346 elif test "$scm_inttypes_has_int8"; then
347 SCM_I_GSC_T_INT8='"int8_t"'
348 SCM_I_GSC_NEEDS_INTTYPES_H=1
349 elif test "$ac_cv_sizeof_char" -eq 1; then
350 SCM_I_GSC_T_INT8='"signed char"'
351 else
352 AC_MSG_ERROR([Can't find appropriate type for scm_t_int8.])
353 fi
354 AC_SUBST([SCM_I_GSC_T_INT8])
355
356 ### Required type scm_t_uint8
357 if test "$scm_stdint_has_uint8"; then
358 SCM_I_GSC_T_UINT8='"uint8_t"'
359 SCM_I_GSC_NEEDS_STDINT_H=1
360 elif test "$scm_inttypes_has_uint8"; then
361 SCM_I_GSC_T_UINT8='"uint8_t"'
362 SCM_I_GSC_NEEDS_INTTYPES_H=1
363 elif test "$ac_cv_sizeof_unsigned_char" -eq 1; then
364 SCM_I_GSC_T_UINT8='"unsigned char"'
365 else
366 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint8.])
367 fi
368 AC_SUBST([SCM_I_GSC_T_UINT8])
369
370 ### Required type scm_t_int16 (ANSI C says int or short might work)
371 if test "$scm_stdint_has_int16"; then
372 SCM_I_GSC_T_INT16='"int16_t"'
373 SCM_I_GSC_NEEDS_STDINT_H=1
374 elif test "$scm_inttypes_has_int16"; then
375 SCM_I_GSC_T_INT16='"int16_t"'
376 SCM_I_GSC_NEEDS_INTTYPES_H=1
377 elif test "$ac_cv_sizeof_int" -eq 2; then
378 SCM_I_GSC_T_INT16='"int"'
379 elif test "$ac_cv_sizeof_short" -eq 2; then
380 SCM_I_GSC_T_INT16='"short"'
381 else
382 AC_MSG_ERROR([Can't find appropriate type for scm_t_int16.])
383 fi
384 AC_SUBST([SCM_I_GSC_T_INT16])
385
386 ### Required type scm_t_uint16 (ANSI C says int or short might work)
387 if test "$scm_stdint_has_uint16"; then
388 SCM_I_GSC_T_UINT16='"uint16_t"'
389 SCM_I_GSC_NEEDS_STDINT_H=1
390 elif test "$scm_inttypes_has_uint16"; then
391 SCM_I_GSC_T_UINT16='"uint16_t"'
392 SCM_I_GSC_NEEDS_INTTYPES_H=1
393 elif test "$ac_cv_sizeof_unsigned_int" -eq 2; then
394 SCM_I_GSC_T_UINT16='"unsigned int"'
395 elif test "$ac_cv_sizeof_unsigned_short" -eq 2; then
396 SCM_I_GSC_T_UINT16='"unsigned short"'
397 else
398 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint16.])
399 fi
400 AC_SUBST([SCM_I_GSC_T_UINT16])
401
402
403 ### Required type scm_t_int32 (ANSI C says int, short, or long might work)
404 if test "$scm_stdint_has_int32"; then
405 SCM_I_GSC_T_INT32='"int32_t"'
406 SCM_I_GSC_NEEDS_STDINT_H=1
407 elif test "$scm_inttypes_has_int32"; then
408 SCM_I_GSC_T_INT32='"int32_t"'
409 SCM_I_GSC_NEEDS_INTTYPES_H=1
410 elif test "$ac_cv_sizeof_int" -eq 4; then
411 SCM_I_GSC_T_INT32='"int"'
412 elif test "$ac_cv_sizeof_long" -eq 4; then
413 SCM_I_GSC_T_INT32='"long"'
414 elif test "$ac_cv_sizeof_short" -eq 4; then
415 SCM_I_GSC_T_INT32='"short"'
416 else
417 AC_MSG_ERROR([Can't find appropriate type for scm_t_int32.])
418 fi
419 AC_SUBST([SCM_I_GSC_T_INT32])
420
421 ### Required type scm_t_uint32 (ANSI C says int, short, or long might work)
422 if test "$scm_stdint_has_uint32"; then
423 SCM_I_GSC_T_UINT32='"uint32_t"'
424 SCM_I_GSC_NEEDS_STDINT_H=1
425 elif test "$scm_inttypes_has_uint32"; then
426 SCM_I_GSC_T_UINT32='"uint32_t"'
427 SCM_I_GSC_NEEDS_INTTYPES_H=1
428 elif test "$ac_cv_sizeof_unsigned_int" -eq 4; then
429 SCM_I_GSC_T_UINT32='"unsigned int"'
430 elif test "$ac_cv_sizeof_unsigned_long" -eq 4; then
431 SCM_I_GSC_T_UINT32='"unsigned long"'
432 elif test "$ac_cv_sizeof_unsigned_short" -eq 4; then
433 SCM_I_GSC_T_UINT32='"unsigned short"'
434 else
435 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint32.])
436 fi
437 AC_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.
441 SCM_I_GSC_T_INT64=0
442 if test "$scm_stdint_has_int64"; then
443 SCM_I_GSC_T_INT64='"int64_t"'
444 SCM_I_GSC_NEEDS_STDINT_H=1
445 elif test "$scm_inttypes_has_int64"; then
446 SCM_I_GSC_T_INT64='"int64_t"'
447 SCM_I_GSC_NEEDS_INTTYPES_H=1
448 elif test "$ac_cv_sizeof_int" -eq 8; then
449 SCM_I_GSC_T_INT64='"int"'
450 elif test "$ac_cv_sizeof_long" -eq 8; then
451 SCM_I_GSC_T_INT64='"long"'
452 elif test "$ac_cv_sizeof_short" -eq 8; then
453 SCM_I_GSC_T_INT64='"short"'
454 elif test "$ac_cv_sizeof_long_long" -eq 8; then
455 SCM_I_GSC_T_INT64='"long long"'
456 elif test "$ac_cv_sizeof___int64" -eq 8; then
457 SCM_I_GSC_T_INT64='"__int64"'
458 else
459 AC_MSG_ERROR([Can't find appropriate type for scm_t_int64.])
460 fi
461 AC_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.
466 SCM_I_GSC_T_UINT64=0
467 if test "$scm_stdint_has_uint64"; then
468 SCM_I_GSC_T_UINT64='"uint64_t"'
469 SCM_I_GSC_NEEDS_STDINT_H=1
470 elif test "$scm_inttypes_has_uint64"; then
471 SCM_I_GSC_T_UINT64='"uint64_t"'
472 SCM_I_GSC_NEEDS_INTTYPES_H=1
473 elif test "$ac_cv_sizeof_unsigned_int" -eq 8; then
474 SCM_I_GSC_T_UINT64='"unsigned int"'
475 elif test "$ac_cv_sizeof_unsigned_long" -eq 8; then
476 SCM_I_GSC_T_UINT64='"unsigned long"'
477 elif test "$ac_cv_sizeof_unsigned_short" -eq 8; then
478 SCM_I_GSC_T_UINT64='"unsigned short"'
479 elif test "$ac_cv_sizeof_unsigned_long_long" -eq 8; then
480 SCM_I_GSC_T_UINT64='"unsigned long long"'
481 elif test "$ac_cv_sizeof_unsigned___int64" -eq 8; then
482 SCM_I_GSC_T_UINT64='"unsigned __int64"'
483 else
484 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint64.])
485 fi
486 AC_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 ###
493 SCM_I_GSC_T_INTMAX=0
494 if test "$scm_stdint_has_intmax"; then
495 SCM_I_GSC_T_INTMAX='"intmax_t"'
496 SCM_I_GSC_NEEDS_STDINT_H=1
497 elif test "$scm_inttypes_has_intmax"; then
498 SCM_I_GSC_T_INTMAX='"intmax_t"'
499 SCM_I_GSC_NEEDS_INTTYPES_H=1
500 elif test "$ac_cv_sizeof___int64" -ne 0; then
501 SCM_I_GSC_T_INTMAX='"__int64"'
502 elif test "$ac_cv_sizeof_long_long" -ne 0; then
503 SCM_I_GSC_T_INTMAX='"long long"'
504 else
505 SCM_I_GSC_T_INTMAX='"long"'
506 fi
507 AC_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 ###
514 SCM_I_GSC_T_UINTMAX=0
515 if test "$scm_stdint_has_uintmax"; then
516 SCM_I_GSC_T_UINTMAX='"uintmax_t"'
517 SCM_I_GSC_NEEDS_STDINT_H=1
518 elif test "$scm_inttypes_has_uintmax"; then
519 SCM_I_GSC_T_UINTMAX='"uintmax_t"'
520 SCM_I_GSC_NEEDS_INTTYPES_H=1
521 elif test "$ac_cv_sizeof_unsigned___int64" -ne 0; then
522 SCM_I_GSC_T_UINTMAX='"unsigned __int64"'
523 elif test "$ac_cv_sizeof_unsigned_long_long" -ne 0; then
524 SCM_I_GSC_T_UINTMAX='"unsigned long long"'
525 else
526 SCM_I_GSC_T_UINTMAX='"unsigned long"'
527 fi
528 AC_SUBST([SCM_I_GSC_T_UINTMAX])
529
530
531 AC_SUBST([SCM_I_GSC_NEEDS_STDINT_H])
532 AC_SUBST([SCM_I_GSC_NEEDS_INTTYPES_H])
533
534 AC_HEADER_STDC
535 AC_HEADER_DIRENT
536 AC_HEADER_TIME
537 AC_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 #
545 AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h malloc.h memory.h process.h string.h \
546 regex.h rxposix.h rx/rxposix.h sys/dir.h sys/ioctl.h sys/select.h \
547 sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
548 sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
549 strings.h direct.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
553 AC_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.
560 AC_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 ])
568 AC_CHECK_TYPE(struct ip_mreq)
569
570 GUILE_HEADER_LIBC_WITH_UNISTD
571
572 AC_TYPE_GETGROUPS
573 AC_TYPE_SIGNAL
574 AC_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 #
579 AC_CHECK_LIB(m, cos)
580
581 AC_CHECK_FUNCS(gethostbyname)
582 if test $ac_cv_func_gethostbyname = no; then
583 AC_CHECK_LIB(nsl, gethostbyname)
584 fi
585
586 AC_CHECK_FUNCS(connect)
587 if test $ac_cv_func_connect = no; then
588 AC_CHECK_LIB(socket, connect)
589 fi
590
591 dnl
592 dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
593 dnl
594 EXTRA_DEFS=""
595 case $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 ;;
611 esac
612 AC_SUBST(EXTRA_DEFS)
613
614 # Reasons for testing:
615 # crt_externs.h - Darwin specific
616 #
617 AC_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 #
641 AC_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 strncasecmp 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 #
652 AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h xlocale.h)
653 AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
654 AC_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 #
669 AC_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 #
677 if 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. */
686 volatile complex double z = - _Complex_I;
687 int
688 main (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
704 fi
705
706
707 dnl GMP tests
708 AC_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>
712 AC_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
716 dnl 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])
723 AM_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.
732 AC_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
743 GUILE_FUNC_DECLARED(sleep, unistd.h)
744 GUILE_FUNC_DECLARED(usleep, unistd.h)
745
746 AC_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.
752 AC_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])])
757 case "$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 ;;
762 esac
763
764 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
765 if 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.])
768 fi
769
770 AC_CHECK_FUNCS(socketpair getgroups setgroups setpwent pause tzset)
771
772 AC_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
783 AC_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
789 AC_MSG_CHECKING(for __libc_stack_end)
790 AC_CACHE_VAL(guile_cv_have_libc_stack_end,
791 [AC_TRY_LINK([#include <stdio.h>
792 extern 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)])
796 AC_MSG_RESULT($guile_cv_have_libc_stack_end)
797
798 if 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.])
801 fi
802
803 dnl Some systems do not declare this. Some systems do declare it, as a
804 dnl macro. With cygwin it may be in a DLL.
805
806 AC_MSG_CHECKING(whether netdb.h declares h_errno)
807 AC_CACHE_VAL(guile_cv_have_h_errno,
808 [AC_TRY_COMPILE([#include <netdb.h>],
809 [int a = h_errno;],
810 guile_cv_have_h_errno=yes, guile_cv_have_h_errno=no)])
811 AC_MSG_RESULT($guile_cv_have_h_errno)
812 if test $guile_cv_have_h_errno = yes; then
813 AC_DEFINE(HAVE_H_ERRNO, 1, [Define if h_errno is declared in netdb.h.])
814 fi
815
816 AC_MSG_CHECKING(whether uint32_t is defined)
817 AC_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)])
827 AC_MSG_RESULT($guile_cv_have_uint32_t)
828 if 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.])
831 fi
832
833 AC_MSG_CHECKING(for working IPv6 support)
834 AC_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;],
842 guile_cv_have_ipv6=yes, guile_cv_have_ipv6=no)])
843 AC_MSG_RESULT($guile_cv_have_ipv6)
844 if test $guile_cv_have_ipv6 = yes; then
845 AC_DEFINE(HAVE_IPV6, 1, [Define if you want support for IPv6.])
846 fi
847
848 # included in rfc2553 but not in older implementations, e.g., glibc 2.1.3.
849 AC_MSG_CHECKING(whether sockaddr_in6 has sin6_scope_id)
850 AC_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;],
857 guile_cv_have_sin6_scope_id=yes, guile_cv_have_sin6_scope_id=no)])
858 AC_MSG_RESULT($guile_cv_have_sin6_scope_id)
859 if 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.])
862 fi
863
864 # struct sockaddr_in6 field sin_len is only present on BSD systems
865 AC_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
871 AC_MSG_CHECKING(whether localtime caches TZ)
872 AC_CACHE_VAL(guile_cv_localtime_cache,
873 [if test x$ac_cv_func_tzset = xyes; then
874 AC_TRY_RUN([#include <time.h>
875 #if STDC_HEADERS
876 # include <stdlib.h>
877 #endif
878 extern char **environ;
879 unset_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 }
886 char TZ_GMT0[] = "TZ=GMT0";
887 char TZ_PST8[] = "TZ=PST8";
888 main()
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.
907 guile_cv_localtime_cache=yes])
908 else
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
912 fi])dnl
913 AC_MSG_RESULT($guile_cv_localtime_cache)
914 if test $guile_cv_localtime_cache = yes; then
915 AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.])
916 fi
917
918 dnl Test whether system calls are restartable by default on the
919 dnl current system. If they are not, we put a loop around every system
920 dnl call to check for EINTR (see SCM_SYSCALL) and do not attempt to
921 dnl change from the default behaviour. On the other hand, if signals
922 dnl are restartable then the loop is not installed and when libguile
923 dnl initialises it also resets the behaviour of each signal to cause a
924 dnl restart (in case a different runtime had a different default
925 dnl behaviour for some reason: e.g., different versions of linux seem
926 dnl to behave differently.)
927
928 AC_SYS_RESTARTABLE_SYSCALLS
929
930 if 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
949 fi
950
951 AC_REPLACE_FUNCS(inet_aton putenv strerror memmove mkstemp)
952
953 AC_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 #
960 AC_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 #
971 AC_MSG_CHECKING([for isinf])
972 AC_LINK_IFELSE(AC_LANG_SOURCE(
973 [[#include <math.h>
974 volatile double x = 0.0;
975 int 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])])
980 AC_MSG_CHECKING([for isnan])
981 AC_LINK_IFELSE(AC_LANG_SOURCE(
982 [[#include <math.h>
983 volatile double x = 0.0;
984 int 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
994 AC_FUNC_ALLOCA
995 if test "$ALLOCA" = "alloca.o"
996 then
997 AC_ERROR([No native alloca found.])
998 fi
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 #
1010 AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize, struct stat.st_blocks])
1011
1012 AC_STRUCT_TIMEZONE
1013 AC_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 ])
1026 GUILE_STRUCT_UTIMBUF
1027
1028
1029 #--------------------------------------------------------------------
1030 #
1031 # Which way does the stack grow?
1032 #
1033 #--------------------------------------------------------------------
1034
1035 SCM_I_GSC_STACK_GROWS_UP=0
1036 AC_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
1043 AC_CHECK_SIZEOF(float)
1044 if 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.])
1047 fi
1048
1049 AC_MSG_CHECKING(for struct linger)
1050 AC_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"))
1057 AC_MSG_RESULT($scm_cv_struct_linger)
1058 if 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.])
1062 fi
1063
1064
1065 # On mingw, struct timespec is in <pthread.h>.
1066 #
1067 AC_MSG_CHECKING(for struct timespec)
1068 AC_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"))
1077 AC_MSG_RESULT($scm_cv_struct_timespec)
1078 if 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>.])
1081 fi
1082
1083 #--------------------------------------------------------------------
1084 #
1085 # Flags for thread support
1086 #
1087 #--------------------------------------------------------------------
1088
1089 SCM_I_GSC_USE_PTHREAD_THREADS=0
1090 SCM_I_GSC_USE_NULL_THREADS=0
1091 AC_SUBST([SCM_I_GSC_USE_PTHREAD_THREADS])
1092 AC_SUBST([SCM_I_GSC_USE_NULL_THREADS])
1093
1094 ### What thread package has the user asked for?
1095 AC_ARG_WITH(threads, [ --with-threads thread interface],
1096 , with_threads=yes)
1097
1098 AC_SUBST(SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT, 0)
1099
1100 case "$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 ;;
1145 esac
1146
1147 case "$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 ;;
1157 esac
1158
1159 AC_MSG_CHECKING(what kind of threads to support)
1160 AC_MSG_RESULT($with_threads)
1161
1162 ## Check whether pthread_attr_getstack works for the main thread
1163
1164 if test "$with_threads" = pthreads; then
1165
1166 AC_MSG_CHECKING(whether pthread_attr_getstack works for the main thread)
1167 old_CFLAGS="$CFLAGS"
1168 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
1169 AC_TRY_RUN(
1170 [
1171 #if HAVE_PTHREAD_ATTR_GETSTACK
1172 #include <pthread.h>
1173
1174 int 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
1190 int main ()
1191 {
1192 return 1;
1193 }
1194 #endif
1195 ],
1196 [works=yes
1197 AC_DEFINE(PTHREAD_ATTR_GETSTACK_WORKS, [1], [Define when pthread_att_get_stack works for the main thread])],
1198 [works=no])
1199 CFLAGS="$old_CFLAGS"
1200 AC_MSG_RESULT($works)
1201
1202 fi # with_threads=pthreads
1203
1204
1205 ## Cross building
1206 if 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}"
1211 else
1212 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
1213 fi
1214
1215 ## AC_MSG_CHECKING("if we are cross compiling")
1216 ## AC_MSG_RESULT($cross_compiling)
1217 if test "$cross_compiling" = "yes"; then
1218 AC_MSG_RESULT($CC_FOR_BUILD)
1219 fi
1220
1221 ## No need as yet to be more elaborate
1222 CCLD_FOR_BUILD="$CC_FOR_BUILD"
1223
1224 AC_SUBST(cross_compiling)
1225 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
1226 AC_SUBST(CCLD_FOR_BUILD)
1227
1228 ## libtool erroneously calls CC_FOR_BUILD HOST_CC;
1229 ## --HOST is the platform that PACKAGE is compiled for.
1230 HOST_CC="$CC_FOR_BUILD"
1231 AC_SUBST(HOST_CC)
1232
1233 if test "$cross_compiling" = "yes"; then
1234 AC_MSG_CHECKING(guile for build)
1235 GUILE_FOR_BUILD="${GUILE_FOR_BUILD-guile}"
1236 else
1237 GUILE_FOR_BUILD='$(preinstguile)'
1238 fi
1239
1240 ## AC_MSG_CHECKING("if we are cross compiling")
1241 ## AC_MSG_RESULT($cross_compiling)
1242 if test "$cross_compiling" = "yes"; then
1243 AC_MSG_RESULT($GUILE_FOR_BUILD)
1244 fi
1245 AC_ARG_VAR(GUILE_FOR_BUILD,[guile for build system])
1246 AC_SUBST(GUILE_FOR_BUILD)
1247
1248 ## If we're using GCC, ask for aggressive warnings.
1249 case "$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 ;;
1265 esac
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.
1270 LIBLOBJS="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`"
1271
1272 ## We also need to create corresponding .doc and .x files
1273 EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`"
1274 EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`"
1275
1276 AC_SUBST(GUILE_MAJOR_VERSION)
1277 AC_SUBST(GUILE_MINOR_VERSION)
1278 AC_SUBST(GUILE_MICRO_VERSION)
1279 AC_SUBST(GUILE_EFFECTIVE_VERSION)
1280 AC_SUBST(GUILE_VERSION)
1281
1282 #######################################################################
1283 # library versioning
1284
1285 AC_SUBST(LIBGUILE_INTERFACE_CURRENT)
1286 AC_SUBST(LIBGUILE_INTERFACE_REVISION)
1287 AC_SUBST(LIBGUILE_INTERFACE_AGE)
1288 AC_SUBST(LIBGUILE_INTERFACE)
1289
1290 AC_SUBST(LIBGUILE_SRFI_SRFI_1_MAJOR)
1291 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_CURRENT)
1292 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_REVISION)
1293 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_AGE)
1294 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE)
1295
1296 AC_SUBST(LIBGUILE_SRFI_SRFI_4_MAJOR)
1297 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT)
1298 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION)
1299 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE)
1300 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE)
1301
1302 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_MAJOR)
1303 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT)
1304 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION)
1305 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE)
1306 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE)
1307
1308 AC_SUBST(LIBGUILE_SRFI_SRFI_60_MAJOR)
1309 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_CURRENT)
1310 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_REVISION)
1311 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_AGE)
1312 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE)
1313
1314 AC_SUBST(LIBGUILE_I18N_MAJOR)
1315 AC_SUBST(LIBGUILE_I18N_INTERFACE_CURRENT)
1316 AC_SUBST(LIBGUILE_I18N_INTERFACE_REVISION)
1317 AC_SUBST(LIBGUILE_I18N_INTERFACE_AGE)
1318 AC_SUBST(LIBGUILE_I18N_INTERFACE)
1319
1320
1321 #######################################################################
1322
1323 dnl Tell guile-config what flags guile users should compile and link with.
1324 GUILE_LIBS="$LDFLAGS $LIBS"
1325 GUILE_CFLAGS="$PTHREAD_CFLAGS"
1326 AC_SUBST(GUILE_LIBS)
1327 AC_SUBST(GUILE_CFLAGS)
1328
1329 AC_SUBST(AWK)
1330 AC_SUBST(LIBLOBJS)
1331 AC_SUBST(EXTRA_DOT_DOC_FILES)
1332 AC_SUBST(EXTRA_DOT_X_FILES)
1333
1334 dnl See also top_builddir in info node: (libtool)AC_PROG_LIBTOOL
1335 top_builddir_absolute=`pwd`
1336 AC_SUBST(top_builddir_absolute)
1337 top_srcdir_absolute=`(cd $srcdir && pwd)`
1338 AC_SUBST(top_srcdir_absolute)
1339
1340 # Additional SCM_I_GSC definitions are above.
1341 AC_SUBST([SCM_I_GSC_GUILE_DEBUG])
1342 AC_SUBST([SCM_I_GSC_GUILE_DEBUG_FREELIST])
1343 AC_SUBST([SCM_I_GSC_ENABLE_DISCOURAGED])
1344 AC_SUBST([SCM_I_GSC_ENABLE_DEPRECATED])
1345 AC_SUBST([SCM_I_GSC_ENABLE_ELISP])
1346 AC_SUBST([SCM_I_GSC_STACK_GROWS_UP])
1347 AC_SUBST([SCM_I_GSC_C_INLINE])
1348 AC_CONFIG_FILES([libguile/gen-scmconfig.h])
1349
1350 AC_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
1385 AC_CONFIG_FILES([check-guile], [chmod +x check-guile])
1386 AC_CONFIG_FILES([benchmark-guile], [chmod +x benchmark-guile])
1387 AC_CONFIG_FILES([guile-tools], [chmod +x guile-tools])
1388 AC_CONFIG_FILES([pre-inst-guile], [chmod +x pre-inst-guile])
1389 AC_CONFIG_FILES([pre-inst-guile-env], [chmod +x pre-inst-guile-env])
1390 AC_CONFIG_FILES([libguile/guile-snarf],
1391 [chmod +x libguile/guile-snarf])
1392 AC_CONFIG_FILES([libguile/guile-doc-snarf],
1393 [chmod +x libguile/guile-doc-snarf])
1394 AC_CONFIG_FILES([libguile/guile-func-name-check],
1395 [chmod +x libguile/guile-func-name-check])
1396 AC_CONFIG_FILES([libguile/guile-snarf-docs],
1397 [chmod +x libguile/guile-snarf-docs])
1398
1399 AC_OUTPUT
1400
1401 dnl Local Variables:
1402 dnl comment-start: "dnl "
1403 dnl comment-end: ""
1404 dnl comment-start-skip: "\\bdnl\\b\\s *"
1405 dnl End: