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