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