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