merge from 1.8 branch
[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 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 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 AC_CACHE_CHECK([whether csqrt is usable],
679 guile_cv_use_csqrt,
680 [AC_TRY_RUN([
681 #include <complex.h>
682 /* "volatile" is meant to prevent gcc from calculating the sqrt as a
683 constant, we want to test libc. */
684 volatile complex double z = - _Complex_I;
685 int
686 main (void)
687 {
688 z = csqrt (z);
689 if (creal (z) > 0.0)
690 return 0; /* good */
691 else
692 return 1; /* bad */
693 }],
694 [guile_cv_use_csqrt=yes],
695 [guile_cv_use_csqrt="no, glibc 2.3 bug"],
696 [guile_cv_use_csqrt="yes, hopefully (cross-compiling)"])])
697 case $guile_cv_use_csqrt in
698 yes*)
699 AC_DEFINE(HAVE_USABLE_CSQRT, 1, [Define to 1 if csqrt is bug-free])
700 ;;
701 esac
702 fi
703
704
705 dnl GMP tests
706 AC_CHECK_LIB([gmp], [__gmpz_init], ,
707 [AC_MSG_ERROR([GNU MP not found, see README])])
708
709 # mpz_import is a macro so we need to include <gmp.h>
710 AC_TRY_LINK([#include <gmp.h>],
711 [mpz_import (0, 0, 0, 0, 0, 0, 0);] , ,
712 [AC_MSG_ERROR([At least GNU MP 4.1 is required, see README])])
713
714 dnl i18n tests
715 #AC_CHECK_HEADERS([libintl.h])
716 #AC_CHECK_FUNCS(gettext)
717 #if test $ac_cv_func_gettext = no; then
718 # AC_CHECK_LIB(intl, gettext)
719 #fi
720 #AC_CHECK_FUNCS([bindtextdomain textdomain])
721 AM_GNU_GETTEXT([external], [need-ngettext])
722
723 ### Some systems don't declare some functions. On such systems, we
724 ### need to at least provide our own K&R-style declarations.
725
726 ### GUILE_FUNC_DECLARED(function, headerfile)
727
728 ### Check for a declaration of FUNCTION in HEADERFILE; if it is
729 ### not there, #define MISSING_FUNCTION_DECL.
730 AC_DEFUN([GUILE_FUNC_DECLARED], [
731 AC_CACHE_CHECK(for $1 declaration, guile_cv_func_$1_declared,
732 AC_EGREP_HEADER($1, $2,
733 guile_cv_func_$1_declared=yes,
734 guile_cv_func_$1_declared=no))
735 if test [x$guile_cv_func_]$1[_declared] = xno; then
736 AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL], 1,
737 [Define if the operating system supplies $1 without declaring it.])
738 fi
739 ])
740
741 GUILE_FUNC_DECLARED(sleep, unistd.h)
742 GUILE_FUNC_DECLARED(usleep, unistd.h)
743
744 AC_CHECK_DECLS([strptime],,,
745 [#define _GNU_SOURCE /* ask glibc to give strptime prototype */
746 #include <time.h>])
747
748 ### On some systems usleep has no return value. If it does have one,
749 ### we'd like to return it; otherwise, we'll fake it.
750 AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type,
751 [AC_EGREP_HEADER(changequote(<, >)<void[ ]+usleep>changequote([, ]),
752 unistd.h,
753 [guile_cv_func_usleep_return_type=void],
754 [guile_cv_func_usleep_return_type=int])])
755 case "$guile_cv_func_usleep_return_type" in
756 "void" )
757 AC_DEFINE(USLEEP_RETURNS_VOID, 1,
758 [Define if the system headers declare usleep to return void.])
759 ;;
760 esac
761
762 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
763 if test -n "$have_sys_un_h" ; then
764 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS, 1,
765 [Define if the system supports Unix-domain (file-domain) sockets.])
766 fi
767
768 AC_CHECK_FUNCS(socketpair getgroups setgroups setpwent pause tzset)
769
770 AC_CHECK_FUNCS(sethostent gethostent endhostent dnl
771 setnetent getnetent endnetent dnl
772 setprotoent getprotoent endprotoent dnl
773 setservent getservent endservent dnl
774 getnetbyaddr getnetbyname dnl
775 inet_lnaof inet_makeaddr inet_netof hstrerror dnl
776 inet_pton inet_ntop)
777
778 # struct sockaddr field sin_len is only present on BSD systems.
779 # On 4.4BSD apparently a #define SIN_LEN exists, but on other BSD systems
780 # (eg. FreeBSD 4.9) it doesn't and we must use this configure check
781 AC_CHECK_MEMBERS([struct sockaddr.sin_len],,,
782 [#ifdef HAVE_SYS_TYPES_H
783 #include <sys/types.h>
784 #endif
785 #include <netinet/in.h>])
786
787 AC_MSG_CHECKING(for __libc_stack_end)
788 AC_CACHE_VAL(guile_cv_have_libc_stack_end,
789 [AC_TRY_LINK([#include <stdio.h>
790 extern char *__libc_stack_end;],
791 [printf("%p", (char*) __libc_stack_end);],
792 guile_cv_have_libc_stack_end=yes,
793 guile_cv_have_libc_stack_end=no)])
794 AC_MSG_RESULT($guile_cv_have_libc_stack_end)
795
796 if test $guile_cv_have_libc_stack_end = yes; then
797 AC_DEFINE(HAVE_LIBC_STACK_END, 1,
798 [Define if you have the __libc_stack_end variable.])
799 fi
800
801 dnl Some systems do not declare this. Some systems do declare it, as a
802 dnl macro. With cygwin it may be in a DLL.
803
804 AC_MSG_CHECKING(whether netdb.h declares h_errno)
805 AC_CACHE_VAL(guile_cv_have_h_errno,
806 [AC_TRY_COMPILE([#include <netdb.h>],
807 [int a = h_errno;],
808 guile_cv_have_h_errno=yes, guile_cv_have_h_errno=no)])
809 AC_MSG_RESULT($guile_cv_have_h_errno)
810 if test $guile_cv_have_h_errno = yes; then
811 AC_DEFINE(HAVE_H_ERRNO, 1, [Define if h_errno is declared in netdb.h.])
812 fi
813
814 AC_MSG_CHECKING(whether uint32_t is defined)
815 AC_CACHE_VAL(guile_cv_have_uint32_t,
816 [AC_TRY_COMPILE([#include <sys/types.h>
817 #if HAVE_STDINT_H
818 #include <stdint.h>
819 #endif
820 #ifndef HAVE_NETDB_H
821 #include <netdb.h>
822 #endif],
823 [uint32_t a;],
824 guile_cv_have_uint32_t=yes, guile_cv_have_uint32_t=no)])
825 AC_MSG_RESULT($guile_cv_have_uint32_t)
826 if test $guile_cv_have_uint32_t = yes; then
827 AC_DEFINE(HAVE_UINT32_T, 1,
828 [Define if uint32_t typedef is defined when netdb.h is include.])
829 fi
830
831 AC_MSG_CHECKING(for working IPv6 support)
832 AC_CACHE_VAL(guile_cv_have_ipv6,
833 [AC_TRY_COMPILE([
834 #ifdef HAVE_SYS_TYPES_H
835 #include <sys/types.h>
836 #endif
837 #include <netinet/in.h>
838 #include <sys/socket.h>],
839 [struct sockaddr_in6 a; a.sin6_family = AF_INET6;],
840 guile_cv_have_ipv6=yes, guile_cv_have_ipv6=no)])
841 AC_MSG_RESULT($guile_cv_have_ipv6)
842 if test $guile_cv_have_ipv6 = yes; then
843 AC_DEFINE(HAVE_IPV6, 1, [Define if you want support for IPv6.])
844 fi
845
846 # included in rfc2553 but not in older implementations, e.g., glibc 2.1.3.
847 AC_MSG_CHECKING(whether sockaddr_in6 has sin6_scope_id)
848 AC_CACHE_VAL(guile_cv_have_sin6_scope_id,
849 [AC_TRY_COMPILE([
850 #ifdef HAVE_SYS_TYPES_H
851 #include <sys/types.h>
852 #endif
853 #include <netinet/in.h>],
854 [struct sockaddr_in6 sok; sok.sin6_scope_id = 0;],
855 guile_cv_have_sin6_scope_id=yes, guile_cv_have_sin6_scope_id=no)])
856 AC_MSG_RESULT($guile_cv_have_sin6_scope_id)
857 if test $guile_cv_have_sin6_scope_id = yes; then
858 AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1,
859 [Define this if your IPv6 has sin6_scope_id in sockaddr_in6 struct.])
860 fi
861
862 # struct sockaddr_in6 field sin_len is only present on BSD systems
863 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_len],,,
864 [#ifdef HAVE_SYS_TYPES_H
865 #include <sys/types.h>
866 #endif
867 #include <netinet/in.h>])
868
869 AC_MSG_CHECKING(whether localtime caches TZ)
870 AC_CACHE_VAL(guile_cv_localtime_cache,
871 [if test x$ac_cv_func_tzset = xyes; then
872 AC_TRY_RUN([#include <time.h>
873 #if STDC_HEADERS
874 # include <stdlib.h>
875 #endif
876 extern char **environ;
877 unset_TZ ()
878 {
879 char **from, **to;
880 for (to = from = environ; (*to = *from); from++)
881 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
882 to++;
883 }
884 char TZ_GMT0[] = "TZ=GMT0";
885 char TZ_PST8[] = "TZ=PST8";
886 main()
887 {
888 time_t now = time ((time_t *) 0);
889 int hour_GMT0, hour_unset;
890 if (putenv (TZ_GMT0) != 0)
891 exit (1);
892 hour_GMT0 = localtime (&now)->tm_hour;
893 unset_TZ ();
894 hour_unset = localtime (&now)->tm_hour;
895 if (putenv (TZ_PST8) != 0)
896 exit (1);
897 if (localtime (&now)->tm_hour == hour_GMT0)
898 exit (1);
899 unset_TZ ();
900 if (localtime (&now)->tm_hour != hour_unset)
901 exit (1);
902 exit (0);
903 }], guile_cv_localtime_cache=no, guile_cv_localtime_cache=yes,
904 [# If we have tzset, assume the worst when cross-compiling.
905 guile_cv_localtime_cache=yes])
906 else
907 # If we lack tzset, report that localtime does not cache TZ,
908 # since we can't invalidate the cache if we don't have tzset.
909 guile_cv_localtime_cache=no
910 fi])dnl
911 AC_MSG_RESULT($guile_cv_localtime_cache)
912 if test $guile_cv_localtime_cache = yes; then
913 AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.])
914 fi
915
916 dnl Test whether system calls are restartable by default on the
917 dnl current system. If they are not, we put a loop around every system
918 dnl call to check for EINTR (see SCM_SYSCALL) and do not attempt to
919 dnl change from the default behaviour. On the other hand, if signals
920 dnl are restartable then the loop is not installed and when libguile
921 dnl initialises it also resets the behaviour of each signal to cause a
922 dnl restart (in case a different runtime had a different default
923 dnl behaviour for some reason: e.g., different versions of linux seem
924 dnl to behave differently.)
925
926 AC_SYS_RESTARTABLE_SYSCALLS
927
928 if test "$enable_regex" = yes; then
929 if test "$ac_cv_header_regex_h" = yes ||
930 test "$ac_cv_header_rxposix_h" = yes ||
931 test "$ac_cv_header_rx_rxposix_h" = yes; then
932 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [AC_LIBOBJ([regex-posix])],
933 [AC_CHECK_LIB(rx, main)
934 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [AC_LIBOBJ([regex-posix])],
935 [AC_CHECK_LIB(regex, main)
936 GUILE_NAMED_CHECK_FUNC(regcomp, regex, [AC_LIBOBJ([regex-posix])])])]
937 )
938 dnl The following should not be necessary, but for some reason
939 dnl autoheader misses it if we don't include it!
940 if test "$ac_cv_func_regcomp_norx" = yes ||
941 test "$ac_cv_func_regcomp_regex" = yes ||
942 test "$ac_cv_func_regcomp_rx" = yes; then
943 AC_DEFINE(HAVE_REGCOMP, 1,
944 [This is included as part of a workaround for a autoheader bug.])
945 fi
946 fi
947 fi
948
949 AC_REPLACE_FUNCS(inet_aton putenv strerror memmove mkstemp)
950
951 AC_CHECK_HEADERS(floatingpoint.h ieeefp.h nan.h)
952
953 # Reasons for testing:
954 # asinh, acosh, atanh, trunc - C99 standard, generally not available on
955 # older systems
956 # sincos - GLIBC extension
957 #
958 AC_CHECK_FUNCS(asinh acosh atanh copysign finite sincos trunc)
959
960 # C99 specifies isinf and isnan as macros.
961 # HP-UX provides only macros, no functions.
962 # glibc 2.3.2 provides both macros and functions.
963 # IRIX 6.5 and Solaris 8 only provide functions.
964 #
965 # The following tests detect isinf and isnan either as functions or as
966 # macros from <math.h>. Plain AC_CHECK_FUNCS is insufficient, it doesn't
967 # use <math.h> so doesn't detect on macro-only systems like HP-UX.
968 #
969 AC_MSG_CHECKING([for isinf])
970 AC_LINK_IFELSE(AC_LANG_SOURCE(
971 [[#include <math.h>
972 volatile double x = 0.0;
973 int main () { return (isinf(x) != 0); }]]),
974 [AC_MSG_RESULT([yes])
975 AC_DEFINE(HAVE_ISINF, 1,
976 [Define to 1 if you have the `isinf' macro or function.])],
977 [AC_MSG_RESULT([no])])
978 AC_MSG_CHECKING([for isnan])
979 AC_LINK_IFELSE(AC_LANG_SOURCE(
980 [[#include <math.h>
981 volatile double x = 0.0;
982 int main () { return (isnan(x) != 0); }]]),
983 [AC_MSG_RESULT([yes])
984 AC_DEFINE(HAVE_ISNAN, 1,
985 [Define to 1 if you have the `isnan' macro or function.])],
986 [AC_MSG_RESULT([no])])
987
988 # We must have a proper stack-using alloca in order for stack-copying
989 # continuations to work properly. If we don't find a native one,
990 # abort.
991
992 AC_FUNC_ALLOCA
993 if test "$ALLOCA" = "alloca.o"
994 then
995 AC_ERROR([No native alloca found.])
996 fi
997
998 # Reasons for checking:
999 #
1000 # st_rdev
1001 # st_blksize
1002 # st_blocks not in mingw
1003 # tm_gmtoff BSD+GNU, not in C99
1004 #
1005 # Note AC_STRUCT_ST_BLOCKS is not used here because we don't want the
1006 # AC_LIBOBJ(fileblocks) replacement which that macro gives.
1007 #
1008 AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize, struct stat.st_blocks])
1009
1010 AC_STRUCT_TIMEZONE
1011 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,
1012 [#include <time.h>
1013 #ifdef TIME_WITH_SYS_TIME
1014 # include <sys/time.h>
1015 # include <time.h>
1016 #else
1017 # if HAVE_SYS_TIME_H
1018 # include <sys/time.h>
1019 # else
1020 # include <time.h>
1021 # endif
1022 #endif
1023 ])
1024 GUILE_STRUCT_UTIMBUF
1025
1026
1027 #--------------------------------------------------------------------
1028 #
1029 # Which way does the stack grow?
1030 #
1031 #--------------------------------------------------------------------
1032
1033 SCM_I_GSC_STACK_GROWS_UP=0
1034 AC_TRY_RUN(aux (l) unsigned long l;
1035 { int x; exit (l >= ((unsigned long)&x)); }
1036 main () { int q; aux((unsigned long)&q); },
1037 [SCM_I_GSC_STACK_GROWS_UP=1],
1038 [],
1039 [AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h)])
1040
1041 AC_CHECK_SIZEOF(float)
1042 if test "$ac_cv_sizeof_float" -le "$ac_cv_sizeof_long"; then
1043 AC_DEFINE(SCM_SINGLES, 1,
1044 [Define this if floats are the same size as longs.])
1045 fi
1046
1047 AC_MSG_CHECKING(for struct linger)
1048 AC_CACHE_VAL(scm_cv_struct_linger,
1049 AC_TRY_COMPILE([
1050 #include <sys/types.h>
1051 #include <sys/socket.h>],
1052 [struct linger lgr; lgr.l_linger = 100],
1053 scm_cv_struct_linger="yes",
1054 scm_cv_struct_linger="no"))
1055 AC_MSG_RESULT($scm_cv_struct_linger)
1056 if test $scm_cv_struct_linger = yes; then
1057 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
1058 [Define this if your system defines struct linger, for use with the
1059 getsockopt and setsockopt system calls.])
1060 fi
1061
1062
1063 # On mingw, struct timespec is in <pthread.h>.
1064 #
1065 AC_MSG_CHECKING(for struct timespec)
1066 AC_CACHE_VAL(scm_cv_struct_timespec,
1067 AC_TRY_COMPILE([
1068 #include <time.h>
1069 #if HAVE_PTHREAD_H
1070 #include <pthread.h>
1071 #endif],
1072 [struct timespec t; t.tv_nsec = 100],
1073 scm_cv_struct_timespec="yes",
1074 scm_cv_struct_timespec="no"))
1075 AC_MSG_RESULT($scm_cv_struct_timespec)
1076 if test $scm_cv_struct_timespec = yes; then
1077 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
1078 [Define this if your system defines struct timespec via either <time.h> or <pthread.h>.])
1079 fi
1080
1081 #--------------------------------------------------------------------
1082 #
1083 # Flags for thread support
1084 #
1085 #--------------------------------------------------------------------
1086
1087 SCM_I_GSC_USE_PTHREAD_THREADS=0
1088 SCM_I_GSC_USE_NULL_THREADS=0
1089 AC_SUBST([SCM_I_GSC_USE_PTHREAD_THREADS])
1090 AC_SUBST([SCM_I_GSC_USE_NULL_THREADS])
1091
1092 ### What thread package has the user asked for?
1093 AC_ARG_WITH(threads, [ --with-threads thread interface],
1094 , with_threads=yes)
1095
1096 AC_SUBST(SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT, 0)
1097
1098 case "$with_threads" in
1099 "yes" | "pthread" | "pthreads" | "pthread-threads" | "")
1100 ACX_PTHREAD(CC="$PTHREAD_CC"
1101 LIBS="$PTHREAD_LIBS $LIBS"
1102 SCM_I_GSC_USE_PTHREAD_THREADS=1
1103 with_threads="pthreads",
1104 with_threads="null")
1105
1106 old_CFLAGS="$CFLAGS"
1107 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
1108
1109 # Reasons for testing:
1110 # pthread_getattr_np - "np" meaning "non portable" says it
1111 # all; not present on MacOS X or Solaris 10
1112 # pthread_get_stackaddr_np - "np" meaning "non portable" says it
1113 # all; specific to MacOS X
1114 # pthread_sigmask - not available on mingw
1115 #
1116 AC_CHECK_FUNCS(pthread_attr_getstack pthread_getattr_np pthread_get_stackaddr_np pthread_sigmask)
1117
1118 # On past versions of Solaris, believe 8 through 10 at least, you
1119 # had to write "pthread_once_t foo = { PTHREAD_ONCE_INIT };".
1120 # This is contrary to posix:
1121 # http://www.opengroup.org/onlinepubs/000095399/functions/pthread_once.html
1122 # Check here if this style is required.
1123 #
1124 # glibc (2.3.6 at least) works both with or without braces, so the
1125 # test checks whether it works without.
1126 #
1127 AC_CACHE_CHECK([whether PTHREAD_ONCE_INIT needs braces],
1128 guile_cv_need_braces_on_pthread_once_init,
1129 [AC_TRY_COMPILE([#include <pthread.h>],
1130 [pthread_once_t foo = PTHREAD_ONCE_INIT;],
1131 [guile_cv_need_braces_on_pthread_once_init=no],
1132 [guile_cv_need_braces_on_pthread_once_init=yes])])
1133 if test "$guile_cv_need_braces_on_pthread_once_init" = yes; then
1134 SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT=1
1135 fi
1136
1137 CFLAGS="$old_CFLAGS"
1138
1139 # On Solaris, sched_yield lives in -lrt.
1140 AC_SEARCH_LIBS(sched_yield, rt)
1141
1142 ;;
1143 esac
1144
1145 case "$with_threads" in
1146 "pthreads")
1147 ;;
1148 "no" | "null")
1149 SCM_I_GSC_USE_NULL_THREADS=1
1150 with_threads="null-threads"
1151 ;;
1152 * )
1153 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
1154 ;;
1155 esac
1156
1157 AC_MSG_CHECKING(what kind of threads to support)
1158 AC_MSG_RESULT($with_threads)
1159
1160 ## Check whether pthread_attr_getstack works for the main thread
1161
1162 if test "$with_threads" = pthreads; then
1163
1164 AC_MSG_CHECKING(whether pthread_attr_getstack works for the main thread)
1165 old_CFLAGS="$CFLAGS"
1166 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
1167 AC_TRY_RUN(
1168 [
1169 #if HAVE_PTHREAD_ATTR_GETSTACK
1170 #include <pthread.h>
1171
1172 int main ()
1173 {
1174 pthread_attr_t attr;
1175 void *start, *end;
1176 size_t size;
1177
1178 pthread_getattr_np (pthread_self (), &attr);
1179 pthread_attr_getstack (&attr, &start, &size);
1180 end = (char *)start + size;
1181
1182 if ((void *)&attr < start || (void *)&attr >= end)
1183 return 1;
1184 else
1185 return 0;
1186 }
1187 #else
1188 int main ()
1189 {
1190 return 1;
1191 }
1192 #endif
1193 ],
1194 [works=yes
1195 AC_DEFINE(PTHREAD_ATTR_GETSTACK_WORKS, [1], [Define when pthread_att_get_stack works for the main thread])],
1196 [works=no])
1197 CFLAGS="$old_CFLAGS"
1198 AC_MSG_RESULT($works)
1199
1200 fi # with_threads=pthreads
1201
1202
1203 ## Cross building
1204 if test "$cross_compiling" = "yes"; then
1205 AC_MSG_CHECKING(cc for build)
1206 ## /usr/bin/cc still uses wrong assembler
1207 ## CC_FOR_BUILD="${CC_FOR_BUILD-/usr/bincc}"
1208 CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}"
1209 else
1210 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
1211 fi
1212
1213 ## AC_MSG_CHECKING("if we are cross compiling")
1214 ## AC_MSG_RESULT($cross_compiling)
1215 if test "$cross_compiling" = "yes"; then
1216 AC_MSG_RESULT($CC_FOR_BUILD)
1217 fi
1218
1219 ## No need as yet to be more elaborate
1220 CCLD_FOR_BUILD="$CC_FOR_BUILD"
1221
1222 AC_SUBST(cross_compiling)
1223 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
1224 AC_SUBST(CCLD_FOR_BUILD)
1225
1226 ## libtool erroneously calls CC_FOR_BUILD HOST_CC;
1227 ## --HOST is the platform that PACKAGE is compiled for.
1228 HOST_CC="$CC_FOR_BUILD"
1229 AC_SUBST(HOST_CC)
1230
1231 if test "$cross_compiling" = "yes"; then
1232 AC_MSG_CHECKING(guile for build)
1233 GUILE_FOR_BUILD="${GUILE_FOR_BUILD-guile}"
1234 else
1235 GUILE_FOR_BUILD='$(preinstguile)'
1236 fi
1237
1238 ## AC_MSG_CHECKING("if we are cross compiling")
1239 ## AC_MSG_RESULT($cross_compiling)
1240 if test "$cross_compiling" = "yes"; then
1241 AC_MSG_RESULT($GUILE_FOR_BUILD)
1242 fi
1243 AC_ARG_VAR(GUILE_FOR_BUILD,[guile for build system])
1244 AC_SUBST(GUILE_FOR_BUILD)
1245
1246 ## If we're using GCC, ask for aggressive warnings.
1247 case "$GCC" in
1248 yes )
1249 ## We had -Wstrict-prototypes in here for a bit, but Guile does too
1250 ## much stuff with generic function pointers for that to really be
1251 ## less than exasperating.
1252 ## -Wpointer-arith was here too, but something changed in gcc/glibc
1253 ## and it became equally exasperating (gcc 2.95 and/or glibc 2.1.2).
1254 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
1255 # Do this here so we don't screw up any of the tests above that might
1256 # not be "warning free"
1257 if test "${GUILE_ERROR_ON_WARNING}" = yes
1258 then
1259 CFLAGS="${CFLAGS} -Werror"
1260 enable_compile_warnings=no
1261 fi
1262 ;;
1263 esac
1264
1265 ## If we're creating a shared library (using libtool!), then we'll
1266 ## need to generate a list of .lo files corresponding to the .o files
1267 ## given in LIBOBJS. We'll call it LIBLOBJS.
1268 LIBLOBJS="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`"
1269
1270 ## We also need to create corresponding .doc and .x files
1271 EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`"
1272 EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`"
1273
1274 AC_SUBST(GUILE_MAJOR_VERSION)
1275 AC_SUBST(GUILE_MINOR_VERSION)
1276 AC_SUBST(GUILE_MICRO_VERSION)
1277 AC_SUBST(GUILE_EFFECTIVE_VERSION)
1278 AC_SUBST(GUILE_VERSION)
1279
1280 #######################################################################
1281 # library versioning
1282
1283 AC_SUBST(LIBGUILE_INTERFACE_CURRENT)
1284 AC_SUBST(LIBGUILE_INTERFACE_REVISION)
1285 AC_SUBST(LIBGUILE_INTERFACE_AGE)
1286 AC_SUBST(LIBGUILE_INTERFACE)
1287
1288 AC_SUBST(LIBGUILE_SRFI_SRFI_1_MAJOR)
1289 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_CURRENT)
1290 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_REVISION)
1291 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE_AGE)
1292 AC_SUBST(LIBGUILE_SRFI_SRFI_1_INTERFACE)
1293
1294 AC_SUBST(LIBGUILE_SRFI_SRFI_4_MAJOR)
1295 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT)
1296 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION)
1297 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE)
1298 AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE)
1299
1300 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_MAJOR)
1301 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT)
1302 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION)
1303 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE)
1304 AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE)
1305
1306 AC_SUBST(LIBGUILE_SRFI_SRFI_60_MAJOR)
1307 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_CURRENT)
1308 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_REVISION)
1309 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE_AGE)
1310 AC_SUBST(LIBGUILE_SRFI_SRFI_60_INTERFACE)
1311
1312 AC_SUBST(LIBGUILE_I18N_MAJOR)
1313 AC_SUBST(LIBGUILE_I18N_INTERFACE_CURRENT)
1314 AC_SUBST(LIBGUILE_I18N_INTERFACE_REVISION)
1315 AC_SUBST(LIBGUILE_I18N_INTERFACE_AGE)
1316 AC_SUBST(LIBGUILE_I18N_INTERFACE)
1317
1318
1319 #######################################################################
1320
1321 dnl Tell guile-config what flags guile users should compile and link with.
1322 GUILE_LIBS="$LDFLAGS $LIBS"
1323 GUILE_CFLAGS="$PTHREAD_CFLAGS"
1324 AC_SUBST(GUILE_LIBS)
1325 AC_SUBST(GUILE_CFLAGS)
1326
1327 AC_SUBST(AWK)
1328 AC_SUBST(LIBLOBJS)
1329 AC_SUBST(EXTRA_DOT_DOC_FILES)
1330 AC_SUBST(EXTRA_DOT_X_FILES)
1331
1332 dnl See also top_builddir in info node: (libtool)AC_PROG_LIBTOOL
1333 top_builddir_absolute=`pwd`
1334 AC_SUBST(top_builddir_absolute)
1335 top_srcdir_absolute=`(cd $srcdir && pwd)`
1336 AC_SUBST(top_srcdir_absolute)
1337
1338 # Additional SCM_I_GSC definitions are above.
1339 AC_SUBST([SCM_I_GSC_GUILE_DEBUG])
1340 AC_SUBST([SCM_I_GSC_GUILE_DEBUG_FREELIST])
1341 AC_SUBST([SCM_I_GSC_ENABLE_DISCOURAGED])
1342 AC_SUBST([SCM_I_GSC_ENABLE_DEPRECATED])
1343 AC_SUBST([SCM_I_GSC_ENABLE_ELISP])
1344 AC_SUBST([SCM_I_GSC_STACK_GROWS_UP])
1345 AC_SUBST([SCM_I_GSC_C_INLINE])
1346 AC_CONFIG_FILES([libguile/gen-scmconfig.h])
1347
1348 AC_CONFIG_FILES([
1349 Makefile
1350 am/Makefile
1351 benchmark-suite/Makefile
1352 doc/Makefile
1353 doc/goops/Makefile
1354 doc/r5rs/Makefile
1355 doc/ref/Makefile
1356 doc/tutorial/Makefile
1357 emacs/Makefile
1358 examples/Makefile
1359 examples/box-dynamic-module/Makefile
1360 examples/box-dynamic/Makefile
1361 examples/box-module/Makefile
1362 examples/box/Makefile
1363 examples/modules/Makefile
1364 examples/safe/Makefile
1365 examples/scripts/Makefile
1366 guile-config/Makefile
1367 ice-9/Makefile
1368 ice-9/debugger/Makefile
1369 ice-9/debugging/Makefile
1370 lang/Makefile
1371 lang/elisp/Makefile
1372 lang/elisp/internals/Makefile
1373 lang/elisp/primitives/Makefile
1374 libguile/Makefile
1375 oop/Makefile
1376 oop/goops/Makefile
1377 scripts/Makefile
1378 srfi/Makefile
1379 test-suite/Makefile
1380 test-suite/standalone/Makefile
1381 ])
1382
1383 AC_CONFIG_FILES([check-guile], [chmod +x check-guile])
1384 AC_CONFIG_FILES([benchmark-guile], [chmod +x benchmark-guile])
1385 AC_CONFIG_FILES([guile-tools], [chmod +x guile-tools])
1386 AC_CONFIG_FILES([pre-inst-guile], [chmod +x pre-inst-guile])
1387 AC_CONFIG_FILES([pre-inst-guile-env], [chmod +x pre-inst-guile-env])
1388 AC_CONFIG_FILES([libguile/guile-snarf],
1389 [chmod +x libguile/guile-snarf])
1390 AC_CONFIG_FILES([libguile/guile-doc-snarf],
1391 [chmod +x libguile/guile-doc-snarf])
1392 AC_CONFIG_FILES([libguile/guile-func-name-check],
1393 [chmod +x libguile/guile-func-name-check])
1394 AC_CONFIG_FILES([libguile/guile-snarf-docs],
1395 [chmod +x libguile/guile-snarf-docs])
1396
1397 AC_OUTPUT
1398
1399 dnl Local Variables:
1400 dnl comment-start: "dnl "
1401 dnl comment-end: ""
1402 dnl comment-start-skip: "\\bdnl\\b\\s *"
1403 dnl End: