1 dnl configuration script for Guile
2 dnl Process this file with autoconf to produce configure.
5 define(GUILE_CONFIGURE_COPYRIGHT,[[
7 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
9 This file is part of GUILE
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.
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.
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.
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
35 AC_INIT(patsubst(m4_esyscmd(. ./GUILE-VERSION && echo ${PACKAGE}),[
37 patsubst(m4_esyscmd(. ./GUILE-VERSION && echo ${GUILE_VERSION}),[
40 AC_CONFIG_AUX_DIR([build-aux])
41 AC_CONFIG_MACRO_DIR([m4])
42 AC_CONFIG_SRCDIR(GUILE-VERSION)
44 AM_INIT_AUTOMAKE([gnu no-define check-news -Wall -Wno-override])
46 AC_COPYRIGHT(GUILE_CONFIGURE_COPYRIGHT)
47 AC_CONFIG_SRCDIR([GUILE-VERSION])
49 . $srcdir/GUILE-VERSION
51 AC_CONFIG_HEADERS([config.h])
52 AH_TOP(/*GUILE_CONFIGURE_COPYRIGHT*/)
54 #--------------------------------------------------------------------
56 # Independent Subdirectories
58 #--------------------------------------------------------------------
60 AC_CONFIG_SUBDIRS(guile-readline)
62 #--------------------------------------------------------------------
66 dnl Some more checks for Win32
78 AC_USE_SYSTEM_EXTENSIONS
82 # for per-target cflags in the libguile subdir
87 AC_CHECK_LIB([ltdl], [lt_dlinit], ,
88 [AC_MSG_ERROR([libltdl not found. See README.])])
89 AC_CHECK_HEADER([ltdl.h], [],
90 [AC_MSG_ERROR([<ltdl.h> not found. See README.])])
92 AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
93 AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
97 #--------------------------------------------------------------------
99 # User options (after above tests that may set default CFLAGS etc.)
101 #--------------------------------------------------------------------
103 GUILE_ERROR_ON_WARNING="yes"
105 AC_ARG_ENABLE(error-on-warning,
106 [ --enable-error-on-warning treat compile warnings as errors],
107 [case "${enableval}" in
108 yes | y) GUILE_ERROR_ON_WARNING="yes" ;;
109 no | n) GUILE_ERROR_ON_WARNING="no" ;;
110 *) AC_MSG_ERROR(bad value ${enableval} for --enable-error-on-warning) ;;
113 SCM_I_GSC_GUILE_DEBUG_FREELIST=0
114 AC_ARG_ENABLE(debug-freelist,
115 [ --enable-debug-freelist include garbage collector freelist debugging code],
116 if test "$enable_debug_freelist" = y \
117 || test "$enable_debug_freelist" = yes; then
118 SCM_I_GSC_GUILE_DEBUG_FREELIST=1
121 AC_ARG_ENABLE(debug-malloc,
122 [ --enable-debug-malloc include malloc debugging code],
123 if test "$enable_debug_malloc" = y || test "$enable_debug_malloc" = yes; then
124 AC_DEFINE(GUILE_DEBUG_MALLOC, 1,
125 [Define this if you want to debug scm_must_malloc/realloc/free calls.])
128 SCM_I_GSC_GUILE_DEBUG=0
129 AC_ARG_ENABLE(guile-debug,
130 [AS_HELP_STRING([--enable-guile-debug],
131 [include internal debugging functions])],
132 if test "$enable_guile_debug" = y || test "$enable_guile_debug" = yes; then
133 SCM_I_GSC_GUILE_DEBUG=1
137 [ --disable-posix omit posix interfaces],,
140 AC_ARG_ENABLE(networking,
141 [ --disable-networking omit networking interfaces],,
142 enable_networking=yes)
145 [ --disable-regex omit regular expression interfaces],,
148 AC_ARG_ENABLE([discouraged],
149 AS_HELP_STRING([--disable-discouraged],[omit discouraged features]))
151 if test "$enable_discouraged" = no; then
152 SCM_I_GSC_ENABLE_DISCOURAGED=0
154 SCM_I_GSC_ENABLE_DISCOURAGED=1
157 AC_ARG_ENABLE([deprecated],
158 AS_HELP_STRING([--disable-deprecated],[omit deprecated features]))
160 if test "$enable_deprecated" = no; then
161 SCM_I_GSC_ENABLE_DEPRECATED=0
164 if test "$enable_deprecated" = yes || test "$enable_deprecated" = ""; then
166 elif test "$enable_deprecated" = shutup; then
169 warn_default=$enable_deprecated
171 SCM_I_GSC_ENABLE_DEPRECATED=1
173 AC_DEFINE_UNQUOTED(SCM_WARN_DEPRECATED_DEFAULT, "$warn_default",
174 [Define this to control the default warning level for deprecated features.])
177 [ --disable-elisp omit Emacs Lisp support],,
180 dnl Added the following configure option in January 2008 following
181 dnl investigation of problems with "64" system and library calls on
182 dnl Darwin (MacOS X). The libguile code (_scm.h) assumes that if a
183 dnl system has stat64, it will have all the other 64 APIs too; but on
184 dnl Darwin, stat64 is there but other APIs are missing.
186 dnl It also appears, from the Darwin docs, that most system call APIs
187 dnl there (i.e. the traditional ones _without_ "64" in their names) have
188 dnl been 64-bit-capable for a long time now, so it isn't necessary to
189 dnl use "64" versions anyway. For example, Darwin's off_t is 64-bit.
191 dnl A similar problem has been reported for HP-UX:
192 dnl http://www.nabble.com/Building-guile-1.8.2-on-hpux-td13106681.html
194 dnl Therefore, and also because a Guile without LARGEFILE64 support is
195 dnl better than no Guile at all, we provide this option to suppress
196 dnl trying to use "64" calls.
198 dnl It may be that for some 64-bit function on Darwin/HP-UX we do need
199 dnl to use a "64" call, and hence that by using --without-64-calls we're
200 dnl missing out on that. If so, someone can work on that in the future.
201 dnl For now, --without-64-calls allows Guile to build on OSs where it
202 dnl wasn't building before.
203 AC_MSG_CHECKING([whether to use system and library "64" calls])
204 AC_ARG_WITH([64-calls],
205 AS_HELP_STRING([--without-64-calls],
206 [don't attempt to use system and library calls with "64" in their names]),
207 [use_64_calls=$withval],
217 AC_MSG_RESULT($use_64_calls)
218 case "$use_64_calls" in
220 AC_DEFINE(GUILE_USE_64_CALLS, 1,
221 [Define to 1 in order to try to use "64" versions of system and library calls.])
225 AC_MSG_CHECKING([whether the compiler defaults to IEEE floating point behavior])
226 # The following snippet was taken from Gnulib's `fpieee'. See also the definition
227 # of `guile_NaN' in `numbers.c'.
229 # IEEE behaviour is the default on all CPUs except Alpha and SH
230 # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4
231 # and the GCC 4.1.2 manual).
234 # On Alpha systems, a compiler option provides the behaviour.
235 # See the ieee(3) manual page, also available at
236 # <http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/0600____.HTM>
238 if test -n "$GCC"; then
239 # GCC has the option -mieee.
240 CPPFLAGS="$CPPFLAGS -mieee"
242 # Compaq (ex-DEC) C has the option -ieee.
243 CPPFLAGS="$CPPFLAGS -ieee"
248 if test -n "$GCC"; then
249 # GCC has the option -mieee.
250 CPPFLAGS="$CPPFLAGS -mieee"
259 #--------------------------------------------------------------------
261 dnl Check for dynamic linking
265 [ --with-modules[=FILES] Add support for dynamic modules],
266 use_modules="$withval")
267 test -z "$use_modules" && use_modules=yes
269 if test "$use_modules" != no; then
270 if test "$use_modules" = yes; then
271 DLPREOPEN="-dlpreopen force"
273 DLPREOPEN="-export-dynamic"
274 for module in $use_modules; do
275 DLPREOPEN="$DLPREOPEN -dlopen $module"
280 dnl files which are destined for separate modules.
282 if test "$use_modules" != no; then
286 if test "$enable_posix" = yes; then
289 AC_DEFINE(HAVE_POSIX, 1,
290 [Define this if you want support for POSIX system calls in Guile.])
293 if test "$enable_networking" = yes; then
296 AC_DEFINE(HAVE_NETWORKING, 1,
297 [Define this if you want support for networking in Guile.])
300 if test "$enable_debug_malloc" = yes; then
301 AC_LIBOBJ([debug-malloc])
304 if test "$enable_elisp" = yes; then
305 SCM_I_GSC_ENABLE_ELISP=1
307 SCM_I_GSC_ENABLE_ELISP=0
309 AC_CHECK_LIB(uca, __uc_get_ar_bsp)
313 # "volatile" is used in a couple of tests below.
317 if test "$ac_cv_c_inline" != no; then
318 SCM_I_GSC_C_INLINE="\"${ac_cv_c_inline}\""
320 SCM_I_GSC_C_INLINE=NULL
322 AC_CHECK_LIB(uca, __uc_get_ar_bsp)
326 AC_CHECK_SIZEOF(char)
327 AC_CHECK_SIZEOF(unsigned char)
328 AC_CHECK_SIZEOF(short)
329 AC_CHECK_SIZEOF(unsigned short)
331 AC_CHECK_SIZEOF(unsigned int)
332 AC_CHECK_SIZEOF(long)
333 AC_CHECK_SIZEOF(unsigned long)
334 AC_CHECK_SIZEOF(size_t)
335 AC_CHECK_SIZEOF(long long)
336 AC_CHECK_SIZEOF(unsigned long long)
337 AC_CHECK_SIZEOF(__int64)
338 AC_CHECK_SIZEOF(unsigned __int64)
339 AC_CHECK_SIZEOF(void *)
340 AC_CHECK_SIZEOF(intptr_t)
341 AC_CHECK_SIZEOF(uintptr_t)
342 AC_CHECK_SIZEOF(ptrdiff_t)
343 AC_CHECK_SIZEOF(size_t)
344 AC_CHECK_SIZEOF(off_t)
346 if test "$ac_cv_sizeof_long" -ne "$ac_cv_sizeof_void_p"; then
347 AC_MSG_ERROR(sizes of long and void* are not identical)
350 if test "$ac_cv_sizeof_ptrdiff_t" -ne 0; then
351 SCM_I_GSC_T_PTRDIFF='"ptrdiff_t"'
353 SCM_I_GSC_T_PTRDIFF='"long"'
355 AC_SUBST([SCM_I_GSC_T_PTRDIFF])
357 AC_CHECK_HEADERS([stdint.h])
358 AC_CHECK_HEADERS([inttypes.h])
360 AC_CHECK_SIZEOF(intmax_t)
362 SCM_I_GSC_NEEDS_STDINT_H=0
363 SCM_I_GSC_NEEDS_INTTYPES_H=0
365 ### intptr and uintptr (try not to use inttypes if we don't have to)
366 if test "$ac_cv_header_inttypes_h" = yes; then
367 if test "$ac_cv_sizeof_intptr_t" -eq 0; then
368 AC_CHECK_SIZEOF([intptr_t],,[#include <inttypes.h>
370 if test "$ac_cv_sizeof_intptr_t" -ne 0; then
371 SCM_I_GSC_NEEDS_INTTYPES_H=1
374 if test "$ac_cv_sizeof_uintptr_t" -eq 0; then
375 AC_CHECK_SIZEOF([uintptr_t],,[#include <inttypes.h>
377 if test "$ac_cv_sizeof_uintptr_t" -ne 0; then
378 SCM_I_GSC_NEEDS_INTTYPES_H=1
383 ### See what's provided by stdint.h
384 if test "$ac_cv_header_stdint_h" = yes; then
385 AC_CHECK_TYPE([int8_t],[scm_stdint_has_int8=1],,[#include <stdint.h>])
386 AC_CHECK_TYPE([uint8_t],[scm_stdint_has_uint8=1],,[#include <stdint.h>])
387 AC_CHECK_TYPE([int16_t],[scm_stdint_has_int16=1],,[#include <stdint.h>])
388 AC_CHECK_TYPE([uint16_t],[scm_stdint_has_uint16=1],,[#include <stdint.h>])
389 AC_CHECK_TYPE([int32_t],[scm_stdint_has_int32=1],,[#include <stdint.h>])
390 AC_CHECK_TYPE([uint32_t],[scm_stdint_has_uint32=1],,[#include <stdint.h>])
391 AC_CHECK_TYPE([int64_t],[scm_stdint_has_int64=1],,[#include <stdint.h>])
392 AC_CHECK_TYPE([uint64_t],[scm_stdint_has_uint64=1],,[#include <stdint.h>])
393 AC_CHECK_TYPE([intmax_t],[scm_stdint_has_intmax=1],,[#include <stdint.h>])
394 AC_CHECK_TYPE([uintmax_t],[scm_stdint_has_uintmax=1],,[#include <stdint.h>])
397 # so we don't get confused by the cache (wish there was a better way
398 # to check particular headers for the same type...)
400 unset ac_cv_type_int8_t
401 unset ac_cv_type_uint8_t
402 unset ac_cv_type_int16_t
403 unset ac_cv_type_uint16_t
404 unset ac_cv_type_int32_t
405 unset ac_cv_type_uint32_t
406 unset ac_cv_type_int64_t
407 unset ac_cv_type_uint64_t
408 unset ac_cv_type_intmax_t
409 unset ac_cv_type_uintmax_t
411 ### See what's provided by inttypes.h
412 if test "$ac_cv_header_inttypes_h" = yes; then
413 AC_CHECK_TYPE([int8_t],[scm_inttypes_has_int8=1],,[#include <inttypes.h>])
414 AC_CHECK_TYPE([uint8_t],[scm_inttypes_has_uint8=1],,[#include <inttypes.h>])
415 AC_CHECK_TYPE([int16_t],[scm_inttypes_has_int16=1],,[#include <inttypes.h>])
416 AC_CHECK_TYPE([uint16_t],[scm_inttypes_has_uint16=1],,[#include <inttypes.h>])
417 AC_CHECK_TYPE([int32_t],[scm_inttypes_has_int32=1],,[#include <inttypes.h>])
418 AC_CHECK_TYPE([uint32_t],[scm_inttypes_has_uint32=1],,[#include <inttypes.h>])
419 AC_CHECK_TYPE([int64_t],[scm_inttypes_has_int64=1],,[#include <inttypes.h>])
420 AC_CHECK_TYPE([uint64_t],[scm_inttypes_has_uint64=1],,[#include <inttypes.h>])
421 AC_CHECK_TYPE([intmax_t],[scm_inttypes_has_intmax=1],,[#include <inttypes.h>])
422 AC_CHECK_TYPE([uintmax_t],[scm_inttypes_has_uintmax=1],,[#include <inttypes.h>])
425 # Try hard to find definitions for some required scm_t_*int* types.
427 ### Required type scm_t_int8
428 if test "$scm_stdint_has_int8"; then
429 SCM_I_GSC_T_INT8='"int8_t"'
430 SCM_I_GSC_NEEDS_STDINT_H=1
431 elif test "$scm_inttypes_has_int8"; then
432 SCM_I_GSC_T_INT8='"int8_t"'
433 SCM_I_GSC_NEEDS_INTTYPES_H=1
434 elif test "$ac_cv_sizeof_char" -eq 1; then
435 SCM_I_GSC_T_INT8='"signed char"'
437 AC_MSG_ERROR([Can't find appropriate type for scm_t_int8.])
439 AC_SUBST([SCM_I_GSC_T_INT8])
441 ### Required type scm_t_uint8
442 if test "$scm_stdint_has_uint8"; then
443 SCM_I_GSC_T_UINT8='"uint8_t"'
444 SCM_I_GSC_NEEDS_STDINT_H=1
445 elif test "$scm_inttypes_has_uint8"; then
446 SCM_I_GSC_T_UINT8='"uint8_t"'
447 SCM_I_GSC_NEEDS_INTTYPES_H=1
448 elif test "$ac_cv_sizeof_unsigned_char" -eq 1; then
449 SCM_I_GSC_T_UINT8='"unsigned char"'
451 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint8.])
453 AC_SUBST([SCM_I_GSC_T_UINT8])
455 ### Required type scm_t_int16 (ANSI C says int or short might work)
456 if test "$scm_stdint_has_int16"; then
457 SCM_I_GSC_T_INT16='"int16_t"'
458 SCM_I_GSC_NEEDS_STDINT_H=1
459 elif test "$scm_inttypes_has_int16"; then
460 SCM_I_GSC_T_INT16='"int16_t"'
461 SCM_I_GSC_NEEDS_INTTYPES_H=1
462 elif test "$ac_cv_sizeof_int" -eq 2; then
463 SCM_I_GSC_T_INT16='"int"'
464 elif test "$ac_cv_sizeof_short" -eq 2; then
465 SCM_I_GSC_T_INT16='"short"'
467 AC_MSG_ERROR([Can't find appropriate type for scm_t_int16.])
469 AC_SUBST([SCM_I_GSC_T_INT16])
471 ### Required type scm_t_uint16 (ANSI C says int or short might work)
472 if test "$scm_stdint_has_uint16"; then
473 SCM_I_GSC_T_UINT16='"uint16_t"'
474 SCM_I_GSC_NEEDS_STDINT_H=1
475 elif test "$scm_inttypes_has_uint16"; then
476 SCM_I_GSC_T_UINT16='"uint16_t"'
477 SCM_I_GSC_NEEDS_INTTYPES_H=1
478 elif test "$ac_cv_sizeof_unsigned_int" -eq 2; then
479 SCM_I_GSC_T_UINT16='"unsigned int"'
480 elif test "$ac_cv_sizeof_unsigned_short" -eq 2; then
481 SCM_I_GSC_T_UINT16='"unsigned short"'
483 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint16.])
485 AC_SUBST([SCM_I_GSC_T_UINT16])
488 ### Required type scm_t_int32 (ANSI C says int, short, or long might work)
489 if test "$scm_stdint_has_int32"; then
490 SCM_I_GSC_T_INT32='"int32_t"'
491 SCM_I_GSC_NEEDS_STDINT_H=1
492 elif test "$scm_inttypes_has_int32"; then
493 SCM_I_GSC_T_INT32='"int32_t"'
494 SCM_I_GSC_NEEDS_INTTYPES_H=1
495 elif test "$ac_cv_sizeof_int" -eq 4; then
496 SCM_I_GSC_T_INT32='"int"'
497 elif test "$ac_cv_sizeof_long" -eq 4; then
498 SCM_I_GSC_T_INT32='"long"'
499 elif test "$ac_cv_sizeof_short" -eq 4; then
500 SCM_I_GSC_T_INT32='"short"'
502 AC_MSG_ERROR([Can't find appropriate type for scm_t_int32.])
504 AC_SUBST([SCM_I_GSC_T_INT32])
506 ### Required type scm_t_uint32 (ANSI C says int, short, or long might work)
507 if test "$scm_stdint_has_uint32"; then
508 SCM_I_GSC_T_UINT32='"uint32_t"'
509 SCM_I_GSC_NEEDS_STDINT_H=1
510 elif test "$scm_inttypes_has_uint32"; then
511 SCM_I_GSC_T_UINT32='"uint32_t"'
512 SCM_I_GSC_NEEDS_INTTYPES_H=1
513 elif test "$ac_cv_sizeof_unsigned_int" -eq 4; then
514 SCM_I_GSC_T_UINT32='"unsigned int"'
515 elif test "$ac_cv_sizeof_unsigned_long" -eq 4; then
516 SCM_I_GSC_T_UINT32='"unsigned long"'
517 elif test "$ac_cv_sizeof_unsigned_short" -eq 4; then
518 SCM_I_GSC_T_UINT32='"unsigned short"'
520 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint32.])
522 AC_SUBST([SCM_I_GSC_T_UINT32])
524 ### Optional type scm_t_int64 (ANSI C says int, short, or long might work)
525 ### Also try 'long long' and '__int64' if we have it.
527 if test "$scm_stdint_has_int64"; then
528 SCM_I_GSC_T_INT64='"int64_t"'
529 SCM_I_GSC_NEEDS_STDINT_H=1
530 elif test "$scm_inttypes_has_int64"; then
531 SCM_I_GSC_T_INT64='"int64_t"'
532 SCM_I_GSC_NEEDS_INTTYPES_H=1
533 elif test "$ac_cv_sizeof_int" -eq 8; then
534 SCM_I_GSC_T_INT64='"int"'
535 elif test "$ac_cv_sizeof_long" -eq 8; then
536 SCM_I_GSC_T_INT64='"long"'
537 elif test "$ac_cv_sizeof_short" -eq 8; then
538 SCM_I_GSC_T_INT64='"short"'
539 elif test "$ac_cv_sizeof_long_long" -eq 8; then
540 SCM_I_GSC_T_INT64='"long long"'
541 elif test "$ac_cv_sizeof___int64" -eq 8; then
542 SCM_I_GSC_T_INT64='"__int64"'
544 AC_MSG_ERROR([Can't find appropriate type for scm_t_int64.])
546 AC_SUBST([SCM_I_GSC_T_INT64])
549 ### Optional type scm_t_uint64 (ANSI C says int, short, or long might work)
550 ### Also try 'long long' and '__int64' if we have it.
552 if test "$scm_stdint_has_uint64"; then
553 SCM_I_GSC_T_UINT64='"uint64_t"'
554 SCM_I_GSC_NEEDS_STDINT_H=1
555 elif test "$scm_inttypes_has_uint64"; then
556 SCM_I_GSC_T_UINT64='"uint64_t"'
557 SCM_I_GSC_NEEDS_INTTYPES_H=1
558 elif test "$ac_cv_sizeof_unsigned_int" -eq 8; then
559 SCM_I_GSC_T_UINT64='"unsigned int"'
560 elif test "$ac_cv_sizeof_unsigned_long" -eq 8; then
561 SCM_I_GSC_T_UINT64='"unsigned long"'
562 elif test "$ac_cv_sizeof_unsigned_short" -eq 8; then
563 SCM_I_GSC_T_UINT64='"unsigned short"'
564 elif test "$ac_cv_sizeof_unsigned_long_long" -eq 8; then
565 SCM_I_GSC_T_UINT64='"unsigned long long"'
566 elif test "$ac_cv_sizeof_unsigned___int64" -eq 8; then
567 SCM_I_GSC_T_UINT64='"unsigned __int64"'
569 AC_MSG_ERROR([Can't find appropriate type for scm_t_uint64.])
571 AC_SUBST([SCM_I_GSC_T_UINT64])
573 ### Required type scm_t_intmax
575 ### We try 'intmax_t', '__int64', 'long long' in this order. When
576 ### none of them is available, we use 'long'.
579 if test "$scm_stdint_has_intmax"; then
580 SCM_I_GSC_T_INTMAX='"intmax_t"'
581 SCM_I_GSC_NEEDS_STDINT_H=1
582 elif test "$scm_inttypes_has_intmax"; then
583 SCM_I_GSC_T_INTMAX='"intmax_t"'
584 SCM_I_GSC_NEEDS_INTTYPES_H=1
585 elif test "$ac_cv_sizeof___int64" -ne 0; then
586 SCM_I_GSC_T_INTMAX='"__int64"'
587 elif test "$ac_cv_sizeof_long_long" -ne 0; then
588 SCM_I_GSC_T_INTMAX='"long long"'
590 SCM_I_GSC_T_INTMAX='"long"'
592 AC_SUBST([SCM_I_GSC_T_INTMAX])
594 ### Required type scm_t_uintmax
596 ### We try 'uintmax_t', 'unsigned __int64', 'unsigned long long' in
597 ### this order. When none of them is available, we use 'unsigned long'.
599 SCM_I_GSC_T_UINTMAX=0
600 if test "$scm_stdint_has_uintmax"; then
601 SCM_I_GSC_T_UINTMAX='"uintmax_t"'
602 SCM_I_GSC_NEEDS_STDINT_H=1
603 elif test "$scm_inttypes_has_uintmax"; then
604 SCM_I_GSC_T_UINTMAX='"uintmax_t"'
605 SCM_I_GSC_NEEDS_INTTYPES_H=1
606 elif test "$ac_cv_sizeof_unsigned___int64" -ne 0; then
607 SCM_I_GSC_T_UINTMAX='"unsigned __int64"'
608 elif test "$ac_cv_sizeof_unsigned_long_long" -ne 0; then
609 SCM_I_GSC_T_UINTMAX='"unsigned long long"'
611 SCM_I_GSC_T_UINTMAX='"unsigned long"'
613 AC_SUBST([SCM_I_GSC_T_UINTMAX])
616 AC_SUBST([SCM_I_GSC_NEEDS_STDINT_H])
617 AC_SUBST([SCM_I_GSC_NEEDS_INTTYPES_H])
624 # Reason for checking:
626 # HP-UX 11.11 (at least) doesn't provide `struct dirent64', even
627 # with `_LARGEFILE64_SOURCE', so check whether it's available.
629 AC_CHECK_MEMBER([struct dirent64.d_name],
630 [SCM_I_GSC_HAVE_STRUCT_DIRENT64=1], [SCM_I_GSC_HAVE_STRUCT_DIRENT64=0],
631 [ #ifndef _LARGEFILE64_SOURCE
632 # define _LARGEFILE64_SOURCE
635 /* Per Autoconf manual. */
636 #include <sys/types.h>
640 # define dirent direct
641 # ifdef HAVE_SYS_NDIR_H
642 # include <sys/ndir.h>
644 # ifdef HAVE_SYS_DIR_H
645 # include <sys/dir.h>
651 AC_SUBST([SCM_I_GSC_HAVE_STRUCT_DIRENT64])
653 # Reasons for testing:
654 # complex.h - new in C99
655 # fenv.h - available in C99, but not older systems
656 # machine/fpu.h - on Tru64 5.1b, the declaration of fesetround(3) is in
657 # this file instead of <fenv.h>
658 # process.h - mingw specific
660 AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h malloc.h memory.h process.h string.h \
661 regex.h rxposix.h rx/rxposix.h sys/dir.h sys/ioctl.h sys/select.h \
662 sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
663 sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
664 direct.h strings.h machine/fpu.h])
666 # "complex double" is new in C99, and "complex" is only a keyword if
667 # <complex.h> is included
668 AC_CHECK_TYPES(complex double,,,
673 # On MacOS X <sys/socklen.h> contains socklen_t, so must include that
675 AC_CHECK_TYPE(socklen_t, ,
676 [AC_DEFINE_UNQUOTED(socklen_t, int,
677 [Define to `int' if <sys/socket.h> does not define.])],
678 [#if HAVE_SYS_TYPES_H
679 #include <sys/types.h>
681 #include <sys/socket.h>
683 AC_CHECK_TYPE(struct ip_mreq)
685 GUILE_HEADER_LIBC_WITH_UNISTD
691 # On mingw -lm is empty, so this test is unnecessary, but it's
692 # harmless so we don't hard-code to suppress it.
696 AC_CHECK_FUNCS(gethostbyname)
697 if test $ac_cv_func_gethostbyname = no; then
698 AC_CHECK_LIB(nsl, gethostbyname)
701 AC_CHECK_FUNCS(connect)
702 if test $ac_cv_func_connect = no; then
703 AC_CHECK_LIB(socket, connect)
707 dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
712 AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCK2_H], 1,
713 [Define if you have the <winsock2.h> header file.])])
714 AC_CHECK_LIB(ws2_32, main)
715 AC_LIBOBJ([win32-uname])
716 AC_LIBOBJ([win32-dirent])
717 if test "$enable_networking" = yes ; then
718 AC_LIBOBJ([win32-socket])
720 if test "$enable_shared" = yes ; then
721 EXTRA_DEFS="-DSCM_IMPORT"
722 AC_DEFINE(USE_DLL_IMPORT, 1,
723 [Define if you need additional CPP macros on Win32 platforms.])
729 # Reasons for testing:
730 # crt_externs.h - Darwin specific
732 AC_CHECK_HEADERS([assert.h crt_externs.h])
734 # Reasons for testing:
735 # DINFINITY - OSF specific
736 # DQNAN - OSF specific
737 # (DINFINITY and DQNAN are actually global variables, not functions)
738 # chsize - an MS-DOS-ism, found in mingw
739 # cexp, clog - not in various pre-c99 systems, and note that it's possible
740 # for gcc to provide the "complex double" type but the system to not
741 # have functions like cexp and clog
742 # clog10 - not in mingw (though others like clog and csqrt are)
743 # fesetround - available in C99, but not older systems
744 # ftruncate - posix, but probably not older systems (current mingw
745 # has it as an inline for chsize)
746 # ioctl - not in mingw.
747 # gmtime_r - recent posix, not on old systems
748 # pipe - not in mingw
749 # _pipe - specific to mingw, taking 3 args
750 # readdir_r - recent posix, not on old systems
751 # readdir64_r - not available on HP-UX 11.11
752 # stat64 - SuS largefile stuff, not on old systems
753 # sysconf - not on old systems
754 # truncate - not in mingw
755 # isblank - available as a GNU extension or in C99
756 # _NSGetEnviron - Darwin specific
758 AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe readdir_r readdir64_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])
760 # Reasons for testing:
761 # netdb.h - not in mingw
762 # sys/param.h - not in mingw
763 # pthread.h - only available with pthreads. ACX_PTHREAD doesn't
764 # check this specifically, we need it for the timespec test below.
765 # sethostname - the function itself check because it's not in mingw,
766 # the DECL is checked because Solaris 10 doens't have in any header
767 # strncasecmp - on NetBSD 1.6 the symbol is available in libc but the
768 # declaration cannot be found
769 # unsetenv - on Tru64 5.1b the symbol is available in libc but the
770 # declaration is only found if `_BSD' is defined; it's marked as
771 # discouraged in <stdlib.h> and has type `void' instead of `int'
773 # hstrerror - on Tru64 5.1b the symbol is available in libc but the
774 # declaration isn't anywhere.
775 # cuserid - on Tru64 5.1b the declaration is documented to be available
776 # only with `_XOPEN_SOURCE' or some such.
777 # flock - on Tru64 5.1b the declaration is available from <sys/fcntl.h>
778 # but only if `_BSD' is defined.
779 # vsnprintf - on AIX 5.3, the declaration is only visible with
780 # `_XOPEN_SOURCE >= 500' or `_ISOC99_SOURCE'.
782 AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h)
783 AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
784 AC_CHECK_DECLS([sethostname, strncasecmp, unsetenv, hstrerror, cuserid, flock, vsnprintf])
786 # crypt() may or may not be available, for instance in some countries there
787 # are restrictions on cryptography.
789 # crypt() might be in libc (eg. OpenBSD), or it might be in a separate
790 # -lcrypt library (eg. Debian GNU/Linux).
792 # On HP-UX 11, crypt() is in libc and there's a dummy libcrypt.a. We must
793 # be careful to avoid -lcrypt in this case, since libtool will see there's
794 # only a static libcrypt and decide to build only a static libguile.
796 # AC_SEARCH_LIBS lets us add -lcrypt to LIBS only if crypt() is not in the
797 # libraries already in that list.
799 AC_SEARCH_LIBS(crypt, crypt,
800 [AC_DEFINE(HAVE_CRYPT,1,
801 [Define to 1 if you have the `crypt' function.])])
803 # When compiling with GCC on some OSs (Solaris, AIX), _Complex_I doesn't
804 # work; in the reported cases so far, 1.0fi works well instead. According
805 # to the C99 spec, the complex.h header must provide a working definition
806 # of _Complex_I, so we always try _Complex_I first. The 1.0fi fallback
807 # is a workaround for the failure of some systems to conform to C99.
808 if test "$ac_cv_type_complex_double" = yes; then
809 AC_MSG_CHECKING([for i])
810 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
818 [AC_DEFINE(GUILE_I,_Complex_I,[The imaginary unit (positive square root of -1).])
819 AC_MSG_RESULT([_Complex_I])],
820 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
828 [AC_DEFINE(GUILE_I,1.0fi)
829 AC_MSG_RESULT([1.0fi])],
830 [ac_cv_type_complex_double=no
831 AC_MSG_RESULT([not available])])])
834 # glibc 2.3.6 (circa 2006) and various prior versions had a bug where
835 # csqrt(-i) returned a negative real part, when it should be positive
836 # for the principal root.
838 if test "$ac_cv_type_complex_double" = yes; then
839 AC_CACHE_CHECK([whether csqrt is usable],
841 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
843 /* "volatile" is meant to prevent gcc from calculating the sqrt as a
844 constant, we want to test libc. */
845 volatile complex double z = - _Complex_I;
855 [guile_cv_use_csqrt=yes],
856 [guile_cv_use_csqrt="no, glibc 2.3 bug"],
857 [guile_cv_use_csqrt="yes, hopefully (cross-compiling)"])])
858 case $guile_cv_use_csqrt in
860 AC_DEFINE(HAVE_USABLE_CSQRT, 1, [Define to 1 if csqrt is bug-free])
867 AC_CHECK_LIB([gmp], [__gmpz_init], ,
868 [AC_MSG_ERROR([GNU MP not found, see README])])
870 # mpz_import is a macro so we need to include <gmp.h>
871 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>]],
872 [[mpz_import (0, 0, 0, 0, 0, 0, 0); ]])],
874 [AC_MSG_ERROR([At least GNU MP 4.1 is required, see README])])
877 #AC_CHECK_HEADERS([libintl.h])
878 #AC_CHECK_FUNCS(gettext)
879 #if test $ac_cv_func_gettext = no; then
880 # AC_CHECK_LIB(intl, gettext)
882 #AC_CHECK_FUNCS([bindtextdomain textdomain])
883 AM_GNU_GETTEXT([external], [need-ngettext])
885 ### Some systems don't declare some functions. On such systems, we
886 ### need to at least provide our own K&R-style declarations.
888 ### GUILE_FUNC_DECLARED(function, headerfile)
890 ### Check for a declaration of FUNCTION in HEADERFILE; if it is
891 ### not there, #define MISSING_FUNCTION_DECL.
892 AC_DEFUN([GUILE_FUNC_DECLARED], [
893 AC_CACHE_CHECK(for $1 declaration, guile_cv_func_$1_declared,
894 AC_EGREP_HEADER($1, $2,
895 guile_cv_func_$1_declared=yes,
896 guile_cv_func_$1_declared=no))
897 if test [x$guile_cv_func_]$1[_declared] = xno; then
898 AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL], 1,
899 [Define if the operating system supplies $1 without declaring it.])
903 GUILE_FUNC_DECLARED(sleep, unistd.h)
904 GUILE_FUNC_DECLARED(usleep, unistd.h)
906 AC_CHECK_DECLS([strptime],,,
907 [#define _GNU_SOURCE /* ask glibc to give strptime prototype */
910 ### On some systems usleep has no return value. If it does have one,
911 ### we'd like to return it; otherwise, we'll fake it.
912 AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type,
913 [AC_EGREP_HEADER(changequote(<, >)<void[ ]+usleep>changequote([, ]),
915 [guile_cv_func_usleep_return_type=void],
916 [guile_cv_func_usleep_return_type=int])])
917 case "$guile_cv_func_usleep_return_type" in
919 AC_DEFINE(USLEEP_RETURNS_VOID, 1,
920 [Define if the system headers declare usleep to return void.])
924 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
925 if test -n "$have_sys_un_h" ; then
926 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS, 1,
927 [Define if the system supports Unix-domain (file-domain) sockets.])
930 AC_CHECK_FUNCS(socketpair getgroups setgroups setpwent pause tzset)
932 AC_CHECK_FUNCS(sethostent gethostent endhostent dnl
933 setnetent getnetent endnetent dnl
934 setprotoent getprotoent endprotoent dnl
935 setservent getservent endservent dnl
936 getnetbyaddr getnetbyname dnl
937 inet_lnaof inet_makeaddr inet_netof hstrerror dnl
940 # struct sockaddr field sin_len is only present on BSD systems.
941 # On 4.4BSD apparently a #define SIN_LEN exists, but on other BSD systems
942 # (eg. FreeBSD 4.9) it doesn't and we must use this configure check
943 AC_CHECK_MEMBERS([struct sockaddr.sin_len],,,
944 [#ifdef HAVE_SYS_TYPES_H
945 #include <sys/types.h>
947 #include <netinet/in.h>])
949 AC_MSG_CHECKING(for __libc_stack_end)
950 AC_CACHE_VAL(guile_cv_have_libc_stack_end,
951 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
952 extern char *__libc_stack_end;]],
953 [[printf("%p", (char*) __libc_stack_end);]])],
954 [guile_cv_have_libc_stack_end=yes],
955 [guile_cv_have_libc_stack_end=no])])
956 AC_MSG_RESULT($guile_cv_have_libc_stack_end)
958 if test $guile_cv_have_libc_stack_end = yes; then
959 AC_DEFINE(HAVE_LIBC_STACK_END, 1,
960 [Define if you have the __libc_stack_end variable.])
963 dnl Some systems do not declare this. Some systems do declare it, as a
964 dnl macro. With cygwin it may be in a DLL.
966 AC_MSG_CHECKING(whether netdb.h declares h_errno)
967 AC_CACHE_VAL(guile_cv_have_h_errno,
968 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
969 [[int a = h_errno;]])],
970 [guile_cv_have_h_errno=yes],
971 [guile_cv_have_h_errno=no])])
972 AC_MSG_RESULT($guile_cv_have_h_errno)
973 if test $guile_cv_have_h_errno = yes; then
974 AC_DEFINE(HAVE_H_ERRNO, 1, [Define if h_errno is declared in netdb.h.])
977 AC_MSG_CHECKING(whether uint32_t is defined)
978 AC_CACHE_VAL(guile_cv_have_uint32_t,
979 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
987 [guile_cv_have_uint32_t=yes],
988 [guile_cv_have_uint32_t=no])])
989 AC_MSG_RESULT($guile_cv_have_uint32_t)
990 if test $guile_cv_have_uint32_t = yes; then
991 AC_DEFINE(HAVE_UINT32_T, 1,
992 [Define if uint32_t typedef is defined when netdb.h is include.])
995 AC_MSG_CHECKING(for working IPv6 support)
996 AC_CACHE_VAL(guile_cv_have_ipv6,
997 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
998 #ifdef HAVE_SYS_TYPES_H
999 #include <sys/types.h>
1001 #include <netinet/in.h>
1002 #include <sys/socket.h>]],
1003 [[struct sockaddr_in6 a; a.sin6_family = AF_INET6;]])],
1004 [guile_cv_have_ipv6=yes],
1005 [guile_cv_have_ipv6=no])])
1006 AC_MSG_RESULT($guile_cv_have_ipv6)
1007 if test $guile_cv_have_ipv6 = yes; then
1008 AC_DEFINE(HAVE_IPV6, 1, [Define if you want support for IPv6.])
1011 # included in rfc2553 but not in older implementations, e.g., glibc 2.1.3.
1012 AC_MSG_CHECKING(whether sockaddr_in6 has sin6_scope_id)
1013 AC_CACHE_VAL(guile_cv_have_sin6_scope_id,
1014 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1015 #ifdef HAVE_SYS_TYPES_H
1016 #include <sys/types.h>
1018 #include <netinet/in.h>]],
1019 [[struct sockaddr_in6 sok; sok.sin6_scope_id = 0;]])],
1020 [guile_cv_have_sin6_scope_id=yes],
1021 [guile_cv_have_sin6_scope_id=no])])
1022 AC_MSG_RESULT($guile_cv_have_sin6_scope_id)
1023 if test $guile_cv_have_sin6_scope_id = yes; then
1024 AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1,
1025 [Define this if your IPv6 has sin6_scope_id in sockaddr_in6 struct.])
1028 # struct sockaddr_in6 field sin_len is only present on BSD systems
1029 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_len],,,
1030 [#ifdef HAVE_SYS_TYPES_H
1031 #include <sys/types.h>
1033 #include <netinet/in.h>])
1035 AC_MSG_CHECKING(whether localtime caches TZ)
1036 AC_CACHE_VAL(guile_cv_localtime_cache,
1037 [if test x$ac_cv_func_tzset = xyes; then
1038 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
1040 # include <stdlib.h>
1042 extern char **environ;
1046 for (to = from = environ; (*to = *from); from++)
1047 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
1050 char TZ_GMT0[] = "TZ=GMT0";
1051 char TZ_PST8[] = "TZ=PST8";
1054 time_t now = time ((time_t *) 0);
1055 int hour_GMT0, hour_unset;
1056 if (putenv (TZ_GMT0) != 0)
1058 hour_GMT0 = localtime (&now)->tm_hour;
1060 hour_unset = localtime (&now)->tm_hour;
1061 if (putenv (TZ_PST8) != 0)
1063 if (localtime (&now)->tm_hour == hour_GMT0)
1066 if (localtime (&now)->tm_hour != hour_unset)
1070 [guile_cv_localtime_cache=no],
1071 [guile_cv_localtime_cache=yes],
1072 [# If we have tzset, assume the worst when cross-compiling.
1073 guile_cv_localtime_cache=yes])
1075 # If we lack tzset, report that localtime does not cache TZ,
1076 # since we can't invalidate the cache if we don't have tzset.
1077 guile_cv_localtime_cache=no
1079 AC_MSG_RESULT($guile_cv_localtime_cache)
1080 if test $guile_cv_localtime_cache = yes; then
1081 AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.])
1084 if test "$enable_regex" = yes; then
1085 if test "$ac_cv_header_regex_h" = yes ||
1086 test "$ac_cv_header_rxposix_h" = yes ||
1087 test "$ac_cv_header_rx_rxposix_h" = yes; then
1088 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [AC_LIBOBJ([regex-posix])],
1089 [AC_CHECK_LIB(rx, main)
1090 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [AC_LIBOBJ([regex-posix])],
1091 [AC_CHECK_LIB(regex, main)
1092 GUILE_NAMED_CHECK_FUNC(regcomp, regex, [AC_LIBOBJ([regex-posix])])])]
1094 dnl The following should not be necessary, but for some reason
1095 dnl autoheader misses it if we don't include it!
1096 if test "$ac_cv_func_regcomp_norx" = yes ||
1097 test "$ac_cv_func_regcomp_regex" = yes ||
1098 test "$ac_cv_func_regcomp_rx" = yes; then
1099 AC_DEFINE(HAVE_REGCOMP, 1,
1100 [This is included as part of a workaround for a autoheader bug.])
1105 AC_REPLACE_FUNCS(inet_aton putenv strerror memmove mkstemp)
1107 AC_CHECK_HEADERS(floatingpoint.h ieeefp.h nan.h)
1109 # Reasons for testing:
1110 # asinh, acosh, atanh, trunc - C99 standard, generally not available on
1112 # sincos - GLIBC extension
1114 AC_CHECK_FUNCS(asinh acosh atanh copysign finite sincos trunc)
1116 # C99 specifies isinf and isnan as macros.
1117 # HP-UX provides only macros, no functions.
1118 # glibc 2.3.2 provides both macros and functions.
1119 # IRIX 6.5 and Solaris 8 only provide functions.
1121 # The following tests detect isinf and isnan either as functions or as
1122 # macros from <math.h>. Plain AC_CHECK_FUNCS is insufficient, it doesn't
1123 # use <math.h> so doesn't detect on macro-only systems like HP-UX.
1125 AC_MSG_CHECKING([for isinf])
1126 AC_LINK_IFELSE(AC_LANG_SOURCE(
1128 volatile double x = 0.0;
1129 int main () { return (isinf(x) != 0); }]]),
1130 [AC_MSG_RESULT([yes])
1131 AC_DEFINE(HAVE_ISINF, 1,
1132 [Define to 1 if you have the `isinf' macro or function.])],
1133 [AC_MSG_RESULT([no])])
1134 AC_MSG_CHECKING([for isnan])
1135 AC_LINK_IFELSE(AC_LANG_SOURCE(
1137 volatile double x = 0.0;
1138 int main () { return (isnan(x) != 0); }]]),
1139 [AC_MSG_RESULT([yes])
1140 AC_DEFINE(HAVE_ISNAN, 1,
1141 [Define to 1 if you have the `isnan' macro or function.])],
1142 [AC_MSG_RESULT([no])])
1144 # We must have a proper stack-using alloca in order for stack-copying
1145 # continuations to work properly. If we don't find a native one,
1149 if test "$ALLOCA" = "alloca.o"
1151 AC_ERROR([No native alloca found.])
1154 # Reasons for checking:
1158 # st_blocks not in mingw
1159 # tm_gmtoff BSD+GNU, not in C99
1161 # Note AC_STRUCT_ST_BLOCKS is not used here because we don't want the
1162 # AC_LIBOBJ(fileblocks) replacement which that macro gives.
1164 AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize, struct stat.st_blocks])
1167 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,
1169 #ifdef TIME_WITH_SYS_TIME
1170 # include <sys/time.h>
1173 # if HAVE_SYS_TIME_H
1174 # include <sys/time.h>
1180 GUILE_STRUCT_UTIMBUF
1183 #--------------------------------------------------------------------
1185 # Which way does the stack grow?
1187 # Following code comes from Autoconf 2.61's internal _AC_LIBOBJ_ALLOCA
1188 # macro (/usr/share/autoconf/autoconf/functions.m4). Gnulib has
1189 # very similar code, so in future we could look at using that.
1191 # An important detail is that the code involves find_stack_direction
1192 # calling _itself_ - which means that find_stack_direction (or at
1193 # least the second find_stack_direction() call) cannot be inlined.
1194 # If the code could be inlined, that might cause the test to give
1195 # an incorrect answer.
1196 #--------------------------------------------------------------------
1198 SCM_I_GSC_STACK_GROWS_UP=0
1199 AC_RUN_IFELSE([AC_LANG_SOURCE(
1200 [AC_INCLUDES_DEFAULT
1202 find_stack_direction ()
1204 static char *addr = 0;
1209 return find_stack_direction ();
1212 return (&dummy > addr) ? 1 : -1;
1218 return find_stack_direction () < 0;
1220 [SCM_I_GSC_STACK_GROWS_UP=1],
1222 [AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h)])
1224 AC_CHECK_SIZEOF(float)
1225 if test "$ac_cv_sizeof_float" -le "$ac_cv_sizeof_long"; then
1226 AC_DEFINE(SCM_SINGLES, 1,
1227 [Define this if floats are the same size as longs.])
1230 AC_MSG_CHECKING(for struct linger)
1231 AC_CACHE_VAL(scm_cv_struct_linger,
1232 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1233 #include <sys/types.h>
1234 #include <sys/socket.h>]],
1235 [[struct linger lgr; lgr.l_linger = 100]])],
1236 [scm_cv_struct_linger="yes"],
1237 [scm_cv_struct_linger="no"]))
1238 AC_MSG_RESULT($scm_cv_struct_linger)
1239 if test $scm_cv_struct_linger = yes; then
1240 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
1241 [Define this if your system defines struct linger, for use with the
1242 getsockopt and setsockopt system calls.])
1246 # On mingw, struct timespec is in <pthread.h>.
1248 AC_MSG_CHECKING(for struct timespec)
1249 AC_CACHE_VAL(scm_cv_struct_timespec,
1250 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1253 #include <pthread.h>
1254 #endif]], [[struct timespec t; t.tv_nsec = 100]])],
1255 [scm_cv_struct_timespec="yes"],
1256 [scm_cv_struct_timespec="no"]))
1257 AC_MSG_RESULT($scm_cv_struct_timespec)
1258 if test $scm_cv_struct_timespec = yes; then
1259 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
1260 [Define this if your system defines struct timespec via either <time.h> or <pthread.h>.])
1263 #--------------------------------------------------------------------
1265 # Flags for thread support
1267 #--------------------------------------------------------------------
1269 SCM_I_GSC_USE_PTHREAD_THREADS=0
1270 SCM_I_GSC_USE_NULL_THREADS=0
1271 AC_SUBST([SCM_I_GSC_USE_PTHREAD_THREADS])
1272 AC_SUBST([SCM_I_GSC_USE_NULL_THREADS])
1274 ### What thread package has the user asked for?
1275 AC_ARG_WITH(threads, [ --with-threads thread interface],
1278 AC_SUBST(SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT, 0)
1279 AC_SUBST(SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER, 0)
1281 case "$with_threads" in
1282 "yes" | "pthread" | "pthreads" | "pthread-threads" | "")
1284 build_pthread_support="yes"
1286 ACX_PTHREAD([CC="$PTHREAD_CC"
1287 LIBS="$PTHREAD_LIBS $LIBS"
1288 SCM_I_GSC_USE_PTHREAD_THREADS=1
1289 with_threads="pthreads"],
1290 [with_threads="null"
1291 build_pthread_support="no"])
1293 old_CFLAGS="$CFLAGS"
1294 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
1296 # Reasons for testing:
1297 # pthread_getattr_np - "np" meaning "non portable" says it
1298 # all; not present on MacOS X or Solaris 10
1299 # pthread_get_stackaddr_np - "np" meaning "non portable" says it
1300 # all; specific to MacOS X
1301 # pthread_sigmask - not available on mingw
1303 AC_CHECK_FUNCS(pthread_attr_getstack pthread_getattr_np pthread_get_stackaddr_np pthread_sigmask)
1305 # On past versions of Solaris, believe 8 through 10 at least, you
1306 # had to write "pthread_once_t foo = { PTHREAD_ONCE_INIT };".
1307 # This is contrary to POSIX:
1308 # http://www.opengroup.org/onlinepubs/000095399/functions/pthread_once.html
1309 # Check here if this style is required.
1311 # glibc (2.3.6 at least) works both with or without braces, so the
1312 # test checks whether it works without.
1315 if test "$GCC" = "yes"; then
1316 # Since GCC only issues a warning for missing braces, so we need
1317 # `-Werror' to catch it.
1318 CFLAGS="-Werror -Wmissing-braces $CFLAGS"
1321 AC_CACHE_CHECK([whether PTHREAD_ONCE_INIT needs braces],
1322 guile_cv_need_braces_on_pthread_once_init,
1323 [AC_COMPILE_IFELSE([#include <pthread.h>
1324 pthread_once_t foo = PTHREAD_ONCE_INIT;],
1325 [guile_cv_need_braces_on_pthread_once_init=no],
1326 [guile_cv_need_braces_on_pthread_once_init=yes])])
1327 if test "$guile_cv_need_braces_on_pthread_once_init" = yes; then
1328 SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT=1
1331 # Same problem with `PTHREAD_MUTEX_INITIALIZER', e.g., on IRIX
1332 # 6.5.30m with GCC 3.3.
1333 AC_CACHE_CHECK([whether PTHREAD_MUTEX_INITIALIZER needs braces],
1334 guile_cv_need_braces_on_pthread_mutex_initializer,
1335 [AC_COMPILE_IFELSE([#include <pthread.h>
1336 pthread_mutex_t foo = PTHREAD_MUTEX_INITIALIZER;],
1337 [guile_cv_need_braces_on_pthread_mutex_initializer=no],
1338 [guile_cv_need_braces_on_pthread_mutex_initializer=yes])])
1339 if test "$guile_cv_need_braces_on_pthread_mutex_initializer" = yes; then
1340 SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER=1
1343 CFLAGS="$old_CFLAGS"
1345 # On Solaris, sched_yield lives in -lrt.
1346 AC_SEARCH_LIBS(sched_yield, rt)
1351 case "$with_threads" in
1355 SCM_I_GSC_USE_NULL_THREADS=1
1356 with_threads="null-threads"
1359 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
1363 AC_MSG_CHECKING(what kind of threads to support)
1364 AC_MSG_RESULT($with_threads)
1366 AM_CONDITIONAL([BUILD_PTHREAD_SUPPORT],
1367 [test "x$build_pthread_support" = "xyes"])
1370 ## Check whether pthread_attr_getstack works for the main thread
1372 if test "$with_threads" = pthreads; then
1374 AC_MSG_CHECKING(whether pthread_attr_getstack works for the main thread)
1375 old_CFLAGS="$CFLAGS"
1376 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
1377 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1378 #if HAVE_PTHREAD_ATTR_GETSTACK
1379 #include <pthread.h>
1383 pthread_attr_t attr;
1387 pthread_getattr_np (pthread_self (), &attr);
1388 pthread_attr_getstack (&attr, &start, &size);
1389 end = (char *)start + size;
1391 if ((void *)&attr < start || (void *)&attr >= end)
1404 AC_DEFINE(PTHREAD_ATTR_GETSTACK_WORKS, [1], [Define when pthread_att_get_stack works for the main thread])],
1407 CFLAGS="$old_CFLAGS"
1408 AC_MSG_RESULT($works)
1410 fi # with_threads=pthreads
1414 if test "$cross_compiling" = "yes"; then
1415 AC_MSG_CHECKING(cc for build)
1416 ## /usr/bin/cc still uses wrong assembler
1417 ## CC_FOR_BUILD="${CC_FOR_BUILD-/usr/bincc}"
1418 CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}"
1420 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
1423 ## AC_MSG_CHECKING("if we are cross compiling")
1424 ## AC_MSG_RESULT($cross_compiling)
1425 if test "$cross_compiling" = "yes"; then
1426 AC_MSG_RESULT($CC_FOR_BUILD)
1429 ## No need as yet to be more elaborate
1430 CCLD_FOR_BUILD="$CC_FOR_BUILD"
1432 AC_SUBST(cross_compiling)
1433 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
1434 AC_SUBST(CCLD_FOR_BUILD)
1436 ## libtool erroneously calls CC_FOR_BUILD HOST_CC;
1437 ## --HOST is the platform that PACKAGE is compiled for.
1438 HOST_CC="$CC_FOR_BUILD"
1441 if test "$cross_compiling" = "yes"; then
1442 AC_MSG_CHECKING(guile for build)
1443 GUILE_FOR_BUILD="${GUILE_FOR_BUILD-guile}"
1445 GUILE_FOR_BUILD='$(preinstguile)'
1448 ## AC_MSG_CHECKING("if we are cross compiling")
1449 ## AC_MSG_RESULT($cross_compiling)
1450 if test "$cross_compiling" = "yes"; then
1451 AC_MSG_RESULT($GUILE_FOR_BUILD)
1453 AC_ARG_VAR(GUILE_FOR_BUILD,[guile for build system])
1454 AC_SUBST(GUILE_FOR_BUILD)
1456 ## If we're using GCC, ask for aggressive warnings.
1459 ## We had -Wstrict-prototypes in here for a bit, but Guile does too
1460 ## much stuff with generic function pointers for that to really be
1461 ## less than exasperating.
1462 ## -Wpointer-arith was here too, but something changed in gcc/glibc
1463 ## and it became equally exasperating (gcc 2.95 and/or glibc 2.1.2).
1464 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
1465 # Do this here so we don't screw up any of the tests above that might
1466 # not be "warning free"
1467 if test "${GUILE_ERROR_ON_WARNING}" = yes
1469 CFLAGS="${CFLAGS} -Werror"
1470 enable_compile_warnings=no
1475 ## If we're creating a shared library (using libtool!), then we'll
1476 ## need to generate a list of .lo files corresponding to the .o files
1477 ## given in LIBOBJS. We'll call it LIBLOBJS.
1478 LIBLOBJS="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`"
1480 ## We also need to create corresponding .doc and .x files
1481 EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`"
1482 EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`"
1484 AC_SUBST(GUILE_MAJOR_VERSION)
1485 AC_SUBST(GUILE_MINOR_VERSION)
1486 AC_SUBST(GUILE_MICRO_VERSION)
1487 AC_SUBST(GUILE_EFFECTIVE_VERSION)
1488 AC_SUBST(GUILE_VERSION)
1490 #######################################################################
1491 # library versioning
1493 AC_SUBST(LIBGUILE_INTERFACE_CURRENT)
1494 AC_SUBST(LIBGUILE_INTERFACE_REVISION)
1495 AC_SUBST(LIBGUILE_INTERFACE_AGE)
1496 AC_SUBST(LIBGUILE_INTERFACE)
1498 AC_SUBST(LIBGUILE_SRFI_SRFI_1_MAJOR)
1499 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_CURRENT)
1500 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_REVISION)
1501 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_AGE)
1502 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE)
1504 AC_SUBST(LIBGUILE_SRFI_SRFI_4_MAJOR)
1505 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT)
1506 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION)
1507 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE)
1508 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE)
1510 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_MAJOR)
1511 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT)
1512 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION)
1513 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE)
1514 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE)
1516 AC_SUBST(LIBGUILE_SRFI_SRFI_60_MAJOR)
1517 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_CURRENT)
1518 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_REVISION)
1519 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_AGE)
1520 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE)
1522 #######################################################################
1524 dnl Tell guile-config what flags guile users should compile and link with.
1525 GUILE_LIBS="$LDFLAGS $LIBS"
1526 GUILE_CFLAGS="$CPPFLAGS $PTHREAD_CFLAGS"
1527 AC_SUBST(GUILE_LIBS)
1528 AC_SUBST(GUILE_CFLAGS)
1532 AC_SUBST(EXTRA_DOT_DOC_FILES)
1533 AC_SUBST(EXTRA_DOT_X_FILES)
1535 dnl See also top_builddir in info node: (libtool)AC_PROG_LIBTOOL
1536 top_builddir_absolute=`pwd`
1537 AC_SUBST(top_builddir_absolute)
1538 top_srcdir_absolute=`(cd $srcdir && pwd)`
1539 AC_SUBST(top_srcdir_absolute)
1541 dnl We need `sitedir' in `guile-1.8.pc'.
1542 dnl Note: `sitedir' must be kept in sync with `GUILE_SITE_DIR' in `guile.m4'.
1543 pkgdatadir="$datadir/guile"
1544 sitedir="$pkgdatadir/site"
1547 # Additional SCM_I_GSC definitions are above.
1548 AC_SUBST([SCM_I_GSC_GUILE_DEBUG])
1549 AC_SUBST([SCM_I_GSC_GUILE_DEBUG_FREELIST])
1550 AC_SUBST([SCM_I_GSC_ENABLE_DISCOURAGED])
1551 AC_SUBST([SCM_I_GSC_ENABLE_DEPRECATED])
1552 AC_SUBST([SCM_I_GSC_ENABLE_ELISP])
1553 AC_SUBST([SCM_I_GSC_STACK_GROWS_UP])
1554 AC_SUBST([SCM_I_GSC_C_INLINE])
1555 AC_CONFIG_FILES([libguile/gen-scmconfig.h])
1560 benchmark-suite/Makefile
1565 doc/tutorial/Makefile
1568 guile-config/Makefile
1577 test-suite/standalone/Makefile
1580 AC_CONFIG_FILES([guile-1.8.pc])
1581 AC_CONFIG_FILES([check-guile], [chmod +x check-guile])
1582 AC_CONFIG_FILES([benchmark-guile], [chmod +x benchmark-guile])
1583 AC_CONFIG_FILES([guile-tools], [chmod +x guile-tools])
1584 AC_CONFIG_FILES([pre-inst-guile], [chmod +x pre-inst-guile])
1585 AC_CONFIG_FILES([pre-inst-guile-env], [chmod +x pre-inst-guile-env])
1586 AC_CONFIG_FILES([libguile/guile-snarf],
1587 [chmod +x libguile/guile-snarf])
1588 AC_CONFIG_FILES([libguile/guile-doc-snarf],
1589 [chmod +x libguile/guile-doc-snarf])
1590 AC_CONFIG_FILES([libguile/guile-func-name-check],
1591 [chmod +x libguile/guile-func-name-check])
1592 AC_CONFIG_FILES([libguile/guile-snarf-docs],
1593 [chmod +x libguile/guile-snarf-docs])
1594 AC_CONFIG_FILES([test-suite/standalone/test-use-srfi],
1595 [chmod +x test-suite/standalone/test-use-srfi])
1596 AC_CONFIG_FILES([test-suite/standalone/test-fast-slot-ref],
1597 [chmod +x test-suite/standalone/test-fast-slot-ref])
1601 dnl Local Variables:
1602 dnl comment-start: "dnl "
1604 dnl comment-start-skip: "\\bdnl\\b\\s *"