1dnl configuration script for Guile 2dnl Process this file with autoconf to produce configure. 3dnl 4 5define(GUILE_CONFIGURE_COPYRIGHT,[[ 6Copyright 1998-2021 Free Software Foundation, Inc. 7 8This file is part of Guile. 9 10Guile is free software: you can redistribute it and/or modify it 11under the terms of the GNU Lesser General Public License as published 12by the Free Software Foundation, either version 3 of the License, or 13(at your option) any later version. 14 15Guile is distributed in the hope that it will be useful, but WITHOUT 16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 18License for more details. 19 20You should have received a copy of the GNU Lesser General Public 21License along with Guile. If not, see 22<https://www.gnu.org/licenses/>. 23]]) 24 25AC_PREREQ(2.64) 26 27AC_INIT([GNU Guile], 28 m4_esyscmd([build-aux/git-version-gen --match v3.0.\* .tarball-version]), 29 [bug-guile@gnu.org]) 30AC_CONFIG_AUX_DIR([build-aux]) 31AC_CONFIG_MACRO_DIR([m4]) 32AC_CONFIG_SRCDIR(GUILE-VERSION) 33 34AC_CANONICAL_TARGET 35 36dnl Use `serial-tests' so the output `check-guile' is not hidden 37dnl (`parallel-tests' is the default in Automake 1.13.) 38dnl `serial-tests' was introduced in Automake 1.12. 39AM_INIT_AUTOMAKE([1.12 gnu no-define -Wall -Wno-override \ 40 serial-tests color-tests dist-lzip dist-xz]) 41m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY],1)]) 42 43AC_COPYRIGHT(GUILE_CONFIGURE_COPYRIGHT) 44AC_CONFIG_SRCDIR([GUILE-VERSION]) 45 46. $srcdir/GUILE-VERSION 47GUILE_VERSION="$PACKAGE_VERSION" 48 49AC_CONFIG_HEADERS([config.h]) 50AH_TOP(/*GUILE_CONFIGURE_COPYRIGHT*/) 51 52dnl We require the pkg.m4 set of macros from pkg-config. 53dnl Make sure it's available. 54m4_pattern_forbid([PKG_CHECK_MODULES]) 55 56#-------------------------------------------------------------------- 57 58AC_LANG([C]) 59 60dnl Some more checks for Win32 61AC_CANONICAL_HOST 62 63AC_LIBTOOL_WIN32_DLL 64 65AC_PROG_INSTALL 66AC_PROG_CC 67 68# Sadly, there is no released version of Autoconf with a nice 69# C11-ensuring macro. This should work for gcc/clang within the last 5 70# years though. 71AC_MSG_CHECKING([how to enable C11 support]) 72if test "$GCC" = yes; then 73 AC_MSG_RESULT([-std=gnu11]) 74 CC="$CC -std=gnu11" 75else 76 dnl Guile requires C99 or later. 77 AC_PROG_CC_C99 78 if test "$ac_cv_prog_cc_c99" = "xno"; then 79 AC_MSG_ERROR([Support for C99 required but not found.]) 80 fi 81fi 82 83gl_EARLY 84AC_PROG_CPP 85AC_PROG_SED 86AC_PROG_AWK 87AC_PROG_LN_S 88AM_PROG_AR 89 90dnl Gnulib. 91gl_INIT 92 93dnl We provide our own lib/glthread/lock.h, so let other Gnulib modules 94dnl know that we have it. This allows them to be compiled with adequate 95dnl locking support. See <http://bugs.gnu.org/14404>. 96AC_DEFINE([GNULIB_LOCK], [1], 97 [Define to allow Gnulib modules to use Guile's locks.]) 98 99 100# for per-target cflags in the libguile subdir 101AM_PROG_CC_C_O 102 103AC_LIBTOOL_DLOPEN 104AC_PROG_LIBTOOL 105 106AM_CONDITIONAL([HAVE_SHARED_LIBRARIES], [test "x$enable_shared" = "xyes"]) 107 108# Some systems provide dlopen via libc; others require -ldl. 109AC_SEARCH_LIBS([dlopen], [dl]) 110 111AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no) 112AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes) 113 114AM_PATH_LISPDIR 115 116AC_DEFINE_UNQUOTED([HOST_TYPE], ["$host"], 117 [Define to the host's GNU triplet.]) 118 119#-------------------------------------------------------------------- 120# 121# User options (after above tests that may set default CFLAGS etc.) 122# 123#-------------------------------------------------------------------- 124 125GUILE_ERROR_ON_WARNING="no" 126 127AC_ARG_ENABLE(error-on-warning, 128 [ --enable-error-on-warning treat compile warnings as errors], 129 [case "${enableval}" in 130 yes | y) GUILE_ERROR_ON_WARNING="yes" ;; 131 no | n) GUILE_ERROR_ON_WARNING="no" ;; 132 *) AC_MSG_ERROR(bad value ${enableval} for --enable-error-on-warning) ;; 133 esac]) 134 135AC_ARG_ENABLE(debug-malloc, 136 [ --enable-debug-malloc include malloc debugging code], 137 if test "$enable_debug_malloc" = y || test "$enable_debug_malloc" = yes; then 138 AC_DEFINE([GUILE_DEBUG_MALLOC], 1, 139 [Define this if you want to debug scm_must_malloc/realloc/free calls.]) 140 fi) 141 142# Check if JIT is available. 143GUILE_ENABLE_JIT 144 145SCM_I_GSC_GUILE_DEBUG=0 146AC_ARG_ENABLE(guile-debug, 147 [AS_HELP_STRING([--enable-guile-debug], 148 [include internal debugging functions])], 149 if test "$enable_guile_debug" = y || test "$enable_guile_debug" = yes; then 150 SCM_I_GSC_GUILE_DEBUG=1 151 fi) 152 153AC_ARG_ENABLE(posix, 154 [ --disable-posix omit non-essential POSIX interfaces],, 155 enable_posix=yes) 156 157AC_ARG_ENABLE(networking, 158 [ --disable-networking omit networking interfaces],, 159 enable_networking=yes) 160 161AC_ARG_ENABLE(regex, 162 [ --disable-regex omit regular expression interfaces],, 163 enable_regex=yes) 164 165AC_ARG_ENABLE(tmpnam, 166 AS_HELP_STRING([--disable-tmpnam],[omit POSIX tmpnam]),, 167 enable_tmpnam=yes) 168 169AC_ARG_ENABLE([deprecated], 170 AS_HELP_STRING([--disable-deprecated],[omit deprecated features])) 171 172if test "$enable_deprecated" = no; then 173 SCM_I_GSC_ENABLE_DEPRECATED=0 174 warn_default=no 175else 176 if test "$enable_deprecated" = yes || test "$enable_deprecated" = ""; then 177 warn_default=summary 178 elif test "$enable_deprecated" = shutup; then 179 warn_default=no 180 else 181 warn_default=$enable_deprecated 182 fi 183 SCM_I_GSC_ENABLE_DEPRECATED=1 184fi 185AC_DEFINE_UNQUOTED([SCM_WARN_DEPRECATED_DEFAULT], "$warn_default", 186[Define this to control the default warning level for deprecated features.]) 187 188dnl Added the following configure option in January 2008 following 189dnl investigation of problems with "64" system and library calls on 190dnl Darwin (MacOS X). The libguile code (_scm.h) assumes that if a 191dnl system has stat64, it will have all the other 64 APIs too; but on 192dnl Darwin, stat64 is there but other APIs are missing. 193dnl 194dnl It also appears, from the Darwin docs, that most system call APIs 195dnl there (i.e. the traditional ones _without_ "64" in their names) have 196dnl been 64-bit-capable for a long time now, so it isn't necessary to 197dnl use "64" versions anyway. For example, Darwin's off_t is 64-bit. 198dnl 199dnl A similar problem has been reported for HP-UX: 200dnl http://www.nabble.com/Building-guile-1.8.2-on-hpux-td13106681.html 201dnl 202dnl Therefore, and also because a Guile without LARGEFILE64 support is 203dnl better than no Guile at all, we provide this option to suppress 204dnl trying to use "64" calls. 205dnl 206dnl It may be that for some 64-bit function on Darwin/HP-UX we do need 207dnl to use a "64" call, and hence that by using --without-64-calls we're 208dnl missing out on that. If so, someone can work on that in the future. 209dnl For now, --without-64-calls allows Guile to build on OSs where it 210dnl wasn't building before. 211AC_MSG_CHECKING([whether to use system and library "64" calls]) 212AC_ARG_WITH([64-calls], 213 AS_HELP_STRING([--without-64-calls], 214 [don't attempt to use system and library calls with "64" in their names]), 215 [use_64_calls=$withval], 216 [use_64_calls=yes 217 case $host in 218 *-apple-darwin* ) 219 use_64_calls=no 220 ;; 221 powerpc-ibm-aix* ) 222 use_64_calls=no 223 ;; 224 esac]) 225AC_MSG_RESULT($use_64_calls) 226case "$use_64_calls" in 227 y* ) 228 AC_DEFINE([GUILE_USE_64_CALLS], 1, 229 [Define to 1 in order to try to use "64" versions of system and library calls.]) 230 ;; 231esac 232 233#-------------------------------------------------------------------- 234 235dnl Check for dynamic linking 236 237use_modules=yes 238AC_ARG_WITH(modules, 239[ --with-modules[=FILES] Add support for dynamic modules], 240use_modules="$withval") 241test -z "$use_modules" && use_modules=yes 242DLPREOPEN= 243if test "$use_modules" != no; then 244 if test "$use_modules" = yes; then 245 DLPREOPEN="-dlpreopen force" 246 else 247 DLPREOPEN="-export-dynamic" 248 for module in $use_modules; do 249 DLPREOPEN="$DLPREOPEN -dlopen $module" 250 done 251 fi 252fi 253 254dnl files which are destined for separate modules. 255 256if test "$use_modules" != no; then 257 AC_LIBOBJ([dynl]) 258 AC_DEFINE([HAVE_MODULES], 1, 259 [Define this if you want support for dynamically loaded modules in Guile.]) 260fi 261 262if test "$enable_posix" = yes; then 263 AC_LIBOBJ([posix]) 264 AC_DEFINE([HAVE_POSIX], 1, 265 [Define this if you want support for non-essential POSIX system calls in Guile.]) 266fi 267 268if test "$enable_networking" = yes; then 269 AC_LIBOBJ([net_db]) 270 AC_LIBOBJ([socket]) 271 AC_DEFINE([HAVE_NETWORKING], 1, 272 [Define this if you want support for networking in Guile.]) 273fi 274 275if test "$enable_debug_malloc" = yes; then 276 AC_LIBOBJ([debug-malloc]) 277fi 278 279AC_CHECK_LIB(uca, __uc_get_ar_bsp) 280 281AC_C_CONST 282 283# "volatile" is used in a couple of tests below. 284AC_C_VOLATILE 285 286AC_C_INLINE 287if test "$ac_cv_c_inline" != no; then 288 SCM_I_GSC_C_INLINE="\"${ac_cv_c_inline}\"" 289else 290 SCM_I_GSC_C_INLINE=NULL 291fi 292AC_CHECK_LIB(uca, __uc_get_ar_bsp) 293 294AC_C_BIGENDIAN 295 296AC_C_LABELS_AS_VALUES 297 298AC_CHECK_SIZEOF(char) 299AC_CHECK_SIZEOF(unsigned char) 300AC_CHECK_SIZEOF(short) 301AC_CHECK_SIZEOF(unsigned short) 302AC_CHECK_SIZEOF(int) 303AC_CHECK_SIZEOF(unsigned int) 304AC_CHECK_SIZEOF(long) 305AC_CHECK_SIZEOF(unsigned long) 306AC_CHECK_SIZEOF(size_t) 307AC_CHECK_SIZEOF(long long) 308AC_CHECK_SIZEOF(unsigned long long) 309AC_CHECK_SIZEOF(__int64) 310AC_CHECK_SIZEOF(unsigned __int64) 311AC_CHECK_SIZEOF(void *) 312AC_CHECK_SIZEOF(intptr_t) 313AC_CHECK_SIZEOF(uintptr_t) 314AC_CHECK_SIZEOF(ptrdiff_t) 315AC_CHECK_SIZEOF(size_t) 316AC_CHECK_SIZEOF(off_t) 317 318if test "$ac_cv_sizeof_long" -gt "$ac_cv_sizeof_void_p"; then 319 AC_MSG_ERROR(long does not fit into a void*) 320fi 321 322if test "$ac_cv_sizeof_ptrdiff_t" -ne 0; then 323 SCM_I_GSC_T_PTRDIFF='"ptrdiff_t"' 324else 325 SCM_I_GSC_T_PTRDIFF='"long"' 326fi 327AC_SUBST([SCM_I_GSC_T_PTRDIFF]) 328 329AC_CHECK_HEADERS([stdatomic.h]) 330 331AC_MSG_CHECKING([for which prebuilt binary set to use during bootstrap]) 332SCM_PREBUILT_BINARIES= 333case "$ac_cv_c_bigendian-$ac_cv_sizeof_void_p" in 334 yes-8) SCM_PREBUILT_BINARIES=64-bit-big-endian;; 335 yes-4) SCM_PREBUILT_BINARIES=32-bit-big-endian;; 336 no-8) SCM_PREBUILT_BINARIES=64-bit-little-endian;; 337 no-4) SCM_PREBUILT_BINARIES=32-bit-little-endian;; 338 *) AC_MSG_ERROR([Unexpected endianness+pointer size combination.]) 339esac 340AC_MSG_RESULT($SCM_PREBUILT_BINARIES) 341AC_SUBST([SCM_PREBUILT_BINARIES]) 342 343AC_HEADER_STDC 344AC_HEADER_TIME 345AC_HEADER_SYS_WAIT 346AC_HEADER_DIRENT 347 348# Reason for checking: 349# 350# HP-UX 11.11 (at least) doesn't provide `struct dirent64', even 351# with `_LARGEFILE64_SOURCE', so check whether it's available. 352# 353AC_CHECK_MEMBER([struct dirent64.d_name], 354 [SCM_I_GSC_HAVE_STRUCT_DIRENT64=1], [SCM_I_GSC_HAVE_STRUCT_DIRENT64=0], 355 [ #ifndef _LARGEFILE64_SOURCE 356 # define _LARGEFILE64_SOURCE 357 #endif 358 359 /* Per Autoconf manual. */ 360 #include <sys/types.h> 361 #ifdef HAVE_DIRENT_H 362 # include <dirent.h> 363 #else 364 # define dirent direct 365 # ifdef HAVE_SYS_NDIR_H 366 # include <sys/ndir.h> 367 # endif 368 # ifdef HAVE_SYS_DIR_H 369 # include <sys/dir.h> 370 # endif 371 # ifdef HAVE_NDIR_H 372 # include <ndir.h> 373 # endif 374 #endif ]) 375AC_SUBST([SCM_I_GSC_HAVE_STRUCT_DIRENT64]) 376 377# Reasons for testing: 378# complex.h - new in C99 379# fenv.h - available in C99, but not older systems 380# machine/fpu.h - on Tru64 5.1b, the declaration of fesetround(3) is in 381# this file instead of <fenv.h> 382# process.h - mingw specific 383# sched.h - missing on MinGW 384# sys/sendfile.h - non-POSIX, found in glibc 385# 386AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h memory.h process.h string.h \ 387sys/dir.h sys/ioctl.h sys/select.h \ 388sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \ 389sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \ 390direct.h machine/fpu.h sched.h sys/sendfile.h]) 391 392# "complex double" is new in C99, and "complex" is only a keyword if 393# <complex.h> is included 394AC_CHECK_TYPES(complex double,,, 395[#if HAVE_COMPLEX_H 396#include <complex.h> 397#endif]) 398 399# On MacOS X <sys/socklen.h> contains socklen_t, so must include that 400# when testing. 401AC_CHECK_TYPE(socklen_t, , 402 [AC_DEFINE_UNQUOTED([socklen_t], int, 403 [Define to `int' if <sys/socket.h> does not define.])], 404 [#if HAVE_SYS_TYPES_H 405#include <sys/types.h> 406#endif 407#include <sys/socket.h> 408]) 409 410AC_CHECK_TYPES([struct ip_mreq], , , [#include <netinet/in.h>]) 411 412GUILE_HEADER_LIBC_WITH_UNISTD 413 414AC_TYPE_GETGROUPS 415AC_TYPE_SIGNAL 416AC_TYPE_MODE_T 417 418dnl Check whether we need -lm. 419LT_LIB_M 420LIBS="$LIBS $LIBM" 421 422AC_CHECK_FUNCS(gethostbyname) 423if test $ac_cv_func_gethostbyname = no; then 424 AC_CHECK_LIB(nsl, gethostbyname) 425fi 426 427AC_CHECK_FUNCS(connect) 428if test $ac_cv_func_connect = no; then 429 AC_CHECK_LIB(socket, connect) 430fi 431 432dnl 433dnl Check for Winsock and other functionality on Win32 (*not* CygWin) 434dnl 435EXTRA_DEFS="" 436mingw_libpath=false 437case $host in 438 *-*-mingw*) 439 AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCK2_H], 1, 440 [Define if you have the <winsock2.h> header file.])]) 441 AC_CHECK_LIB(ws2_32, main) 442 AC_LIBOBJ([posix-w32]) 443 if test "$enable_shared" = yes ; then 444 EXTRA_DEFS="-DSCM_IMPORT" 445 AC_DEFINE([USE_DLL_IMPORT], 1, 446 [Define if you need additional CPP macros on Win32 platforms.]) 447 fi 448 mingw_libpath=true 449 ;; 450esac 451AC_SUBST(EXTRA_DEFS) 452AM_CONDITIONAL([MINGW_LIBPATH], [test x$mingw_libpath = xtrue]) 453 454# Reasons for testing: 455# crt_externs.h - Darwin specific 456# 457AC_CHECK_HEADERS([assert.h crt_externs.h]) 458 459# Reasons for testing: 460# DINFINITY - OSF specific 461# DQNAN - OSF specific 462# (DINFINITY and DQNAN are actually global variables, not functions) 463# chsize - an MS-DOS-ism, found in mingw 464# cexp, clog - not in various pre-c99 systems, and note that it's possible 465# for gcc to provide the "complex double" type but the system to not 466# have functions like cexp and clog 467# clog10 - not in mingw (though others like clog and csqrt are) 468# fesetround - available in C99, but not older systems 469# ftruncate - posix, but probably not older systems (current mingw 470# has it as an inline for chsize) 471# ioctl - not in mingw. 472# gmtime_r - recent posix, not on old systems 473# readdir_r - recent posix, not on old systems 474# readdir64_r - not available on HP-UX 11.11 475# stat64 - SuS largefile stuff, not on old systems 476# sysconf - not on old systems 477# truncate - not in mingw 478# isblank - available as a GNU extension or in C99 479# _NSGetEnviron - Darwin specific 480# strcoll_l, newlocale, uselocale, utimensat - POSIX.1-2008 481# strtol_l - non-POSIX, found in glibc 482# fork - unavailable on Windows 483# sched_getaffinity, sched_setaffinity - GNU extensions (glibc) 484# sendfile - non-POSIX, found in glibc 485# 486AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid \ 487 fesetround ftime ftruncate fchown fchmod getcwd geteuid getsid \ 488 gettimeofday getuid getgid gmtime_r ioctl lstat mkdir mkdtemp mknod \ 489 nice readlink rename rmdir setegid seteuid \ 490 setlocale setuid setgid setpgid setsid sigaction siginterrupt stat64 \ 491 strptime symlink sync sysconf tcgetpgrp tcsetpgrp uname waitpid \ 492 strdup system usleep atexit on_exit chown link fcntl ttyname getpwent \ 493 getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp \ 494 index bcopy memcpy rindex truncate isblank _NSGetEnviron \ 495 strcoll strcoll_l strtod_l strtol_l newlocale uselocale utimensat \ 496 sched_getaffinity sched_setaffinity sendfile]) 497 498# The newlib C library uses _NL_ prefixed locale langinfo constants. 499AC_CHECK_DECLS([_NL_NUMERIC_GROUPING], [], [], [[#include <langinfo.h>]]) 500 501# Reasons for testing: 502# netdb.h - not in mingw 503# sys/param.h - not in mingw 504# pthread.h - only available with pthreads. ACX_PTHREAD doesn't 505# check this specifically, we need it for the timespec test below. 506# pthread_np.h - available on FreeBSD 507# sethostname - the function itself check because it's not in mingw, 508# the DECL is checked because Solaris 10 doens't have in any header 509# hstrerror - on Tru64 5.1b the symbol is available in libc but the 510# declaration isn't anywhere. 511# cuserid - on Tru64 5.1b the declaration is documented to be available 512# only with `_XOPEN_SOURCE' or some such. 513# 514AC_CHECK_HEADERS([crypt.h netdb.h pthread.h pthread_np.h sys/param.h sys/resource.h sys/file.h sys/mman.h]) 515AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname) 516AC_CHECK_DECLS([sethostname, hstrerror, cuserid]) 517 518# crypt() may or may not be available, for instance in some countries there 519# are restrictions on cryptography. 520# 521# crypt() might be in libc (eg. OpenBSD), or it might be in a separate 522# -lcrypt library (eg. Debian GNU/Linux). 523# 524# On HP-UX 11, crypt() is in libc and there's a dummy libcrypt.a. We must 525# be careful to avoid -lcrypt in this case, since libtool will see there's 526# only a static libcrypt and decide to build only a static libguile. 527# 528# AC_SEARCH_LIBS lets us add -lcrypt to LIBS only if crypt() is not in the 529# libraries already in that list. 530# 531AC_SEARCH_LIBS(crypt, crypt, 532 [AC_DEFINE([HAVE_CRYPT],1, 533 [Define to 1 if you have the `crypt' function.])]) 534 535# When compiling with GCC on some OSs (Solaris, AIX), _Complex_I doesn't 536# work; in the reported cases so far, 1.0fi works well instead. According 537# to the C99 spec, the complex.h header must provide a working definition 538# of _Complex_I, so we always try _Complex_I first. The 1.0fi fallback 539# is a workaround for the failure of some systems to conform to C99. 540if test "$ac_cv_type_complex_double" = yes; then 541 AC_MSG_CHECKING([for i]) 542 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 543#if HAVE_COMPLEX_H 544#include <complex.h> 545#endif 546complex double z; 547]], [[ 548z = _Complex_I; 549]])], 550 [AC_DEFINE([GUILE_I],_Complex_I,[The imaginary unit (positive square root of -1).]) 551 AC_MSG_RESULT([_Complex_I])], 552 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 553#if HAVE_COMPLEX_H 554#include <complex.h> 555#endif 556complex double z; 557]],[[ 558z = 1.0fi; 559]])], 560 [AC_DEFINE([GUILE_I],1.0fi) 561 AC_MSG_RESULT([1.0fi])], 562 [ac_cv_type_complex_double=no 563 AC_MSG_RESULT([not available])])]) 564fi 565 566# glibc 2.3.6 (circa 2006) and various prior versions had a bug where 567# csqrt(-i) returned a negative real part, when it should be positive 568# for the principal root. 569# 570if test "$ac_cv_type_complex_double" = yes; then 571 572 AC_CACHE_CHECK([whether csqrt is usable], 573 guile_cv_use_csqrt, 574 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ 575#include <complex.h> 576/* "volatile" is meant to prevent gcc from calculating the sqrt as a 577 constant, we want to test libc. */ 578volatile complex double z = - _Complex_I; 579int 580main (void) 581{ 582 z = csqrt (z); 583 if (creal (z) > 0.0) 584 return 0; /* good */ 585 else 586 return 1; /* bad */ 587}]])], 588 [guile_cv_use_csqrt=yes], 589 [guile_cv_use_csqrt="no, glibc 2.3 bug"], 590 [guile_cv_use_csqrt="yes, hopefully (cross-compiling)"])]) 591 case $guile_cv_use_csqrt in 592 yes*) 593 AC_DEFINE([HAVE_USABLE_CSQRT], 1, [Define to 1 if csqrt is bug-free]) 594 ;; 595 esac 596fi 597 598# Cygwin and Hurd (circa 2017) and various prior versions defined stub 599# versions of the virtual and profiling itimers that would always fail 600# when called. 601if test "$ac_cv_func_getitimer" = yes; then 602 603 AC_CACHE_CHECK([whether getitimer(ITIMER_PROF) is usable], 604 guile_cv_use_getitimer_prof, 605 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ 606#include <sys/time.h> 607int 608main (void) 609{ 610 struct itimerval I; 611 if (getitimer (ITIMER_PROF, &I) == 0) 612 return 0; /* good */ 613 else 614 return 1; /* bad */ 615}]])], 616 [guile_cv_use_getitimer_prof=yes], 617 [guile_cv_use_getitimer_prof=no], 618 [guile_cv_use_getitimer_prof="yes, hopefully (cross-compiling)"])]) 619 case $guile_cv_use_getitimer_prof in 620 yes*) 621 AC_DEFINE([HAVE_USABLE_GETITIMER_PROF], 1, [Define to 1 if getitimer(ITIMER_PROF, ...) is functional]) 622 ;; 623 esac 624 625 AC_CACHE_CHECK([whether getitimer(ITIMER_VIRTUAL) is usable], 626 guile_cv_use_getitimer_virtual, 627 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ 628#include <sys/time.h> 629int 630main (void) 631{ 632 struct itimerval I; 633 if (getitimer (ITIMER_VIRTUAL, &I) == 0) 634 return 0; /* good */ 635 else 636 return 1; /* bad */ 637}]])], 638 [guile_cv_use_getitimer_virtual=yes], 639 [guile_cv_use_getitimer_virtual=no], 640 [guile_cv_use_getitimer_virtual="yes, hopefully (cross-compiling)"])]) 641 case $guile_cv_use_getitimer_virtual in 642 yes*) 643 AC_DEFINE([HAVE_USABLE_GETITIMER_VIRTUAL], 1, [Define to 1 if getitimer(ITIMER_VIRTUAL, ...) is functional]) 644 ;; 645 esac 646fi 647 648 649AC_CACHE_SAVE 650 651dnl GMP tests 652 653SCM_I_GSC_ENABLE_MINI_GMP=0 654AC_ARG_ENABLE(mini-gmp, 655 [AS_HELP_STRING([--enable-mini-gmp], 656 [use mini-gmp instead of the full GMP library])]) 657 658if test "x$enable_mini_gmp" = xyes || test "x$enable_mini_gmp" = xy; then 659 SCM_I_GSC_ENABLE_MINI_GMP=1 660else 661 AC_LIB_HAVE_LINKFLAGS([gmp],[],[#include <gmp.h>], [mpz_import (0,0,0,0,0,0,0);]) 662 if test "x$HAVE_LIBGMP" != "xyes"; then 663 AC_MSG_ERROR([GNU MP 4.1 or greater not found; either install it, or pass '--enable-mini-gmp' to use included less-optimal arbitrary-precision integer support.]) 664 fi 665 if test "x$LIBGMP_PREFIX" != "x"; then 666 CPPFLAGS="-I$LIBGMP_PREFIX $CPPFLAGS" 667 fi 668 AC_CHECK_DECLS([mpz_inits], [], [], [[#include <gmp.h>]]) 669fi 670AC_SUBST([SCM_I_GSC_ENABLE_MINI_GMP]) 671AM_CONDITIONAL([USE_MINI_GMP], [test "x$enable_mini_gmp" = "xyes"]) 672 673dnl GNU libunistring is checked for by Gnulib's `libunistring' module. 674if test "x$LTLIBUNISTRING" = "x"; then 675 AC_MSG_ERROR([GNU libunistring is required, please install it.]) 676fi 677 678dnl Sloppy check to make sure people aren't trying to use too-old libunistring. 679case "$LIBUNISTRING_VERSION" in 680 0.9.0 | 0.9.1 | 0.9.2 ) 681 AC_MSG_ERROR([libunistring too old. Please install a recent libunistring (>= 0.9.3).]) 682 ;; 683esac 684 685GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT 686if test "x$ac_cv_libunistring_with_iconv_support" != "xyes"; then 687 AC_MSG_ERROR([No iconv support. Please recompile libunistring with iconv enabled.]) 688fi 689 690dnl Libffi is needed to compile Guile's foreign function interface, but its 691dnl interface isn't exposed in Guile's API. 692PKG_CHECK_MODULES(LIBFFI, libffi) 693AC_SUBST(LIBFFI_CFLAGS) 694AC_SUBST(LIBFFI_LIBS) 695 696dnl figure out approriate ffi type for size_t 697AC_CHECK_SIZEOF(size_t) 698AC_CHECK_SIZEOF(ssize_t) 699ffi_size_type=uint$(($ac_cv_sizeof_size_t*8)) 700ffi_ssize_type=sint$(($ac_cv_sizeof_ssize_t*8)) 701AC_DEFINE_UNQUOTED([ffi_type_size_t], ffi_type_${ffi_size_type}, 702 [ffi type for size_t]) 703AC_DEFINE_UNQUOTED([ffi_type_ssize_t], ffi_type_${ffi_ssize_type}, 704 [ffi type for ssize_t]) 705 706dnl i18n tests 707#AC_CHECK_HEADERS([libintl.h]) 708#AC_CHECK_FUNCS(gettext) 709#if test $ac_cv_func_gettext = no; then 710# AC_CHECK_LIB(intl, gettext) 711#fi 712#AC_CHECK_FUNCS([bindtextdomain textdomain]) 713AM_GNU_GETTEXT([external], [need-ngettext]) 714AM_GNU_GETTEXT_VERSION([0.18.1]) 715 716### Some systems don't declare some functions. On such systems, we 717### need to at least provide our own K&R-style declarations. 718 719### GUILE_FUNC_DECLARED(function, headerfile) 720 721### Check for a declaration of FUNCTION in HEADERFILE; if it is 722### not there, #define MISSING_FUNCTION_DECL. 723AC_DEFUN([GUILE_FUNC_DECLARED], [ 724 AC_CACHE_CHECK(for $1 declaration, guile_cv_func_$1_declared, 725 AC_EGREP_HEADER($1, $2, 726 guile_cv_func_$1_declared=yes, 727 guile_cv_func_$1_declared=no)) 728 if test [x$guile_cv_func_]$1[_declared] = xno; then 729 AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL], 1, 730 [Define if the operating system supplies $1 without declaring it.]) 731 fi 732]) 733 734GUILE_FUNC_DECLARED(sleep, unistd.h) 735GUILE_FUNC_DECLARED(usleep, unistd.h) 736 737AC_CHECK_DECLS([getlogin, alarm]) 738 739AC_CHECK_DECLS([strptime],,, 740[#define _GNU_SOURCE /* ask glibc to give strptime prototype */ 741#include <time.h>]) 742 743### On some systems usleep has no return value. If it does have one, 744### we'd like to return it; otherwise, we'll fake it. 745AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type, 746 [AC_EGREP_HEADER(changequote(<, >)<void[ ]+usleep>changequote([, ]), 747 unistd.h, 748 [guile_cv_func_usleep_return_type=void], 749 [guile_cv_func_usleep_return_type=int])]) 750case "$guile_cv_func_usleep_return_type" in 751 "void" ) 752 AC_DEFINE([USLEEP_RETURNS_VOID], 1, 753 [Define if the system headers declare usleep to return void.]) 754 ;; 755esac 756 757AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1) 758if test -n "$have_sys_un_h" ; then 759 AC_DEFINE([HAVE_UNIX_DOMAIN_SOCKETS], 1, 760 [Define if the system supports Unix-domain (file-domain) sockets.]) 761fi 762 763AC_CHECK_FUNCS(getrlimit setrlimit) 764 765AC_CHECK_FUNCS(socketpair getgroups setgroups setpwent pause tzset) 766 767AC_CHECK_FUNCS(sethostent gethostent endhostent dnl 768 setnetent getnetent endnetent dnl 769 setprotoent getprotoent endprotoent dnl 770 setservent getservent endservent dnl 771 getnetbyaddr getnetbyname dnl 772 inet_lnaof inet_makeaddr inet_netof hstrerror) 773 774AC_CHECK_MEMBERS([struct sockaddr_in.sin_len],,, 775[#ifdef HAVE_SYS_TYPES_H 776#include <sys/types.h> 777#endif 778#include <netinet/in.h>]) 779 780AC_MSG_CHECKING(for __libc_stack_end) 781AC_CACHE_VAL(guile_cv_have_libc_stack_end, 782[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> 783extern char *__libc_stack_end;]], 784 [[printf("%p", (char*) __libc_stack_end);]])], 785 [guile_cv_have_libc_stack_end=yes], 786 [guile_cv_have_libc_stack_end=no])]) 787AC_MSG_RESULT($guile_cv_have_libc_stack_end) 788 789if test $guile_cv_have_libc_stack_end = yes; then 790 AC_DEFINE([HAVE_LIBC_STACK_END], 1, 791 [Define if you have the __libc_stack_end variable.]) 792fi 793 794dnl Some systems do not declare this. Some systems do declare it, as a 795dnl macro. With cygwin it may be in a DLL. 796 797AC_MSG_CHECKING(whether netdb.h declares h_errno) 798AC_CACHE_VAL(guile_cv_have_h_errno, 799 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], 800 [[int a = h_errno;]])], 801 [guile_cv_have_h_errno=yes], 802 [guile_cv_have_h_errno=no])]) 803AC_MSG_RESULT($guile_cv_have_h_errno) 804if test $guile_cv_have_h_errno = yes; then 805 AC_DEFINE([HAVE_H_ERRNO], 1, [Define if h_errno is declared in netdb.h.]) 806fi 807 808AC_MSG_CHECKING(whether uint32_t is defined) 809AC_CACHE_VAL(guile_cv_have_uint32_t, 810 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 811 #if HAVE_STDINT_H 812 #include <stdint.h> 813 #endif 814 #ifndef HAVE_NETDB_H 815 #include <netdb.h> 816 #endif]], 817 [[uint32_t a;]])], 818 [guile_cv_have_uint32_t=yes], 819 [guile_cv_have_uint32_t=no])]) 820AC_MSG_RESULT($guile_cv_have_uint32_t) 821if test $guile_cv_have_uint32_t = yes; then 822 AC_DEFINE([HAVE_UINT32_T], 1, 823 [Define if uint32_t typedef is defined when netdb.h is include.]) 824fi 825 826AC_MSG_CHECKING(for working IPv6 support) 827AC_CACHE_VAL(guile_cv_have_ipv6, 828[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 829#ifdef HAVE_SYS_TYPES_H 830#include <sys/types.h> 831#endif 832#include <netinet/in.h> 833#include <sys/socket.h>]], 834[[struct sockaddr_in6 a; a.sin6_family = AF_INET6;]])], 835[guile_cv_have_ipv6=yes], 836[guile_cv_have_ipv6=no])]) 837AC_MSG_RESULT($guile_cv_have_ipv6) 838if test $guile_cv_have_ipv6 = yes; then 839 AC_DEFINE([HAVE_IPV6], 1, [Define if you want support for IPv6.]) 840fi 841 842# included in rfc2553 but not in older implementations, e.g., glibc 2.1.3. 843AC_MSG_CHECKING(whether sockaddr_in6 has sin6_scope_id) 844AC_CACHE_VAL(guile_cv_have_sin6_scope_id, 845[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 846#ifdef HAVE_SYS_TYPES_H 847#include <sys/types.h> 848#endif 849#include <netinet/in.h>]], 850[[struct sockaddr_in6 sok; sok.sin6_scope_id = 0;]])], 851[guile_cv_have_sin6_scope_id=yes], 852[guile_cv_have_sin6_scope_id=no])]) 853AC_MSG_RESULT($guile_cv_have_sin6_scope_id) 854if test $guile_cv_have_sin6_scope_id = yes; then 855 AC_DEFINE([HAVE_SIN6_SCOPE_ID], 1, 856 [Define this if your IPv6 has sin6_scope_id in sockaddr_in6 struct.]) 857fi 858 859# struct sockaddr_in6 field sin_len is only present on BSD systems 860AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_len],,, 861[#ifdef HAVE_SYS_TYPES_H 862#include <sys/types.h> 863#endif 864#include <netinet/in.h>]) 865 866AC_MSG_CHECKING(whether localtime caches TZ) 867AC_CACHE_VAL(guile_cv_localtime_cache, 868[if test x$ac_cv_func_tzset = xyes; then 869AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h> 870#if STDC_HEADERS 871# include <stdlib.h> 872#endif 873extern char **environ; 874unset_TZ () 875{ 876 char **from, **to; 877 for (to = from = environ; (*to = *from); from++) 878 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '=')) 879 to++; 880} 881char TZ_GMT0[] = "TZ=GMT0"; 882char TZ_PST8[] = "TZ=PST8"; 883main() 884{ 885 time_t now = time ((time_t *) 0); 886 int hour_GMT0, hour_unset; 887 if (putenv (TZ_GMT0) != 0) 888 exit (1); 889 hour_GMT0 = localtime (&now)->tm_hour; 890 unset_TZ (); 891 hour_unset = localtime (&now)->tm_hour; 892 if (putenv (TZ_PST8) != 0) 893 exit (1); 894 if (localtime (&now)->tm_hour == hour_GMT0) 895 exit (1); 896 unset_TZ (); 897 if (localtime (&now)->tm_hour != hour_unset) 898 exit (1); 899 exit (0); 900}]])], 901[guile_cv_localtime_cache=no], 902[guile_cv_localtime_cache=yes], 903[# If we have tzset, assume the worst when cross-compiling. 904guile_cv_localtime_cache=yes]) 905else 906 # If we lack tzset, report that localtime does not cache TZ, 907 # since we can't invalidate the cache if we don't have tzset. 908 guile_cv_localtime_cache=no 909fi])dnl 910AC_MSG_RESULT($guile_cv_localtime_cache) 911if test $guile_cv_localtime_cache = yes; then 912 AC_DEFINE([LOCALTIME_CACHE], 1, [Define if localtime caches the TZ setting.]) 913fi 914 915if test "$enable_regex" = yes; then 916 AC_LIBOBJ([regex-posix]) 917 AC_DEFINE([ENABLE_REGEX], 1, [Define when regex support is enabled.]) 918fi 919 920if test "$enable_tmpnam" = yes; then 921 AC_DEFINE([ENABLE_TMPNAM], 1, [Define when tmpnam support is enabled.]) 922fi 923 924AC_REPLACE_FUNCS([strerror memmove]) 925 926# Reasons for testing: 927# asinh, acosh, atanh, trunc - C99 standard, generally not available on 928# older systems 929# sincos - GLIBC extension 930# __sincos - APPLE extension 931# 932AC_CHECK_FUNCS(asinh acosh atanh copysign finite sincos __sincos trunc) 933 934# C99 specifies isinf and isnan as macros. 935# HP-UX provides only macros, no functions. 936# glibc 2.3.2 provides both macros and functions. 937# IRIX 6.5 and Solaris 8 only provide functions. 938# 939# The following tests detect isinf and isnan either as functions or as 940# macros from <math.h>. Plain AC_CHECK_FUNCS is insufficient, it doesn't 941# use <math.h> so doesn't detect on macro-only systems like HP-UX. 942# 943AC_MSG_CHECKING([for isinf]) 944AC_LINK_IFELSE([AC_LANG_SOURCE( 945[[#include <math.h> 946volatile double x = 0.0; 947int main () { return (isinf(x) != 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([AC_LANG_SOURCE([[ 954#include <math.h> 955volatile double x = 0.0; 956int main () { return (isnan(x) != 0); }]])], 957 [AC_MSG_RESULT([yes]) 958 AC_DEFINE([HAVE_ISNAN], 1, 959 [Define to 1 if you have the `isnan' macro or function.])], 960 [AC_MSG_RESULT([no])]) 961 962# Reasons for checking: 963# 964# st_rdev 965# st_blksize 966# st_blocks not in mingw 967# tm_gmtoff BSD+GNU, not in C99 968# 969# Note AC_STRUCT_ST_BLOCKS is not used here because we don't want the 970# AC_LIBOBJ(fileblocks) replacement which that macro gives. 971# 972AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize, struct stat.st_blocks, struct stat.st_atim, struct stat.st_mtim, struct stat.st_ctim],,, 973 [#define _GNU_SOURCE 974AC_INCLUDES_DEFAULT 975]) 976 977AC_STRUCT_TIMEZONE 978AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,, 979[#include <time.h> 980#ifdef TIME_WITH_SYS_TIME 981# include <sys/time.h> 982# include <time.h> 983#else 984# if HAVE_SYS_TIME_H 985# include <sys/time.h> 986# else 987# include <time.h> 988# endif 989#endif 990]) 991GUILE_STRUCT_UTIMBUF 992 993 994#-------------------------------------------------------------------- 995# 996# What values do the iconv error handlers have? 997# 998# The only place that we need iconv in our public interfaces is for 999# the error handlers, which are just ints. So we weaken our 1000# dependency by looking up those values at configure-time. 1001#-------------------------------------------------------------------- 1002GUILE_UNISTRING_ICONVEH_VALUES 1003 1004#-------------------------------------------------------------------- 1005# 1006# Which way does the stack grow? 1007# 1008# Following code comes from Autoconf 2.69's internal _AC_LIBOBJ_ALLOCA 1009# macro (/usr/share/autoconf/autoconf/functions.m4). Gnulib has 1010# very similar code, so in future we could look at using that. 1011# 1012# An important detail is that the code involves find_stack_direction 1013# calling _itself_ - which means that find_stack_direction (or at 1014# least the second find_stack_direction() call) cannot be inlined. 1015# If the code could be inlined, that might cause the test to give 1016# an incorrect answer. 1017#-------------------------------------------------------------------- 1018 1019SCM_I_GSC_STACK_GROWS_UP=0 1020AC_RUN_IFELSE([AC_LANG_SOURCE( 1021[AC_INCLUDES_DEFAULT 1022int 1023find_stack_direction (int *addr, int depth) 1024{ 1025 int dir, dummy = 0; 1026 if (! addr) 1027 addr = &dummy; 1028 *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; 1029 dir = depth ? find_stack_direction (addr, depth - 1) : 0; 1030 return dir + dummy; 1031} 1032 1033int 1034main (int argc, char **argv) 1035{ 1036 return find_stack_direction (0, argc + !argv + 20) < 0; 1037}])], 1038 [SCM_I_GSC_STACK_GROWS_UP=1], 1039 [], 1040 [AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h)]) 1041 1042#-------------------------------------------------------------------- 1043# 1044# Boehm's GC library 1045# 1046#-------------------------------------------------------------------- 1047AC_MSG_CHECKING(for which bdw-gc pkg-config file to use) 1048AC_ARG_WITH(bdw_gc, [ --with-bdw-gc=PKG name of BDW-GC pkg-config file], 1049 [bdw_gc="$withval"], [bdw_gc=bdw-gc]) 1050AC_MSG_RESULT($bdw_gc) 1051PKG_CHECK_MODULES([BDW_GC], [$bdw_gc >= 7.2]) 1052 1053save_LIBS="$LIBS" 1054LIBS="$BDW_GC_LIBS $LIBS" 1055CFLAGS="$BDW_GC_CFLAGS $CFLAGS" 1056 1057# Functions that might not be defined, depending on configuration. 1058AC_CHECK_FUNCS([GC_pthread_exit GC_pthread_cancel GC_pthread_sigmask]) 1059 1060# Functions from GC 7.3. 1061AC_CHECK_FUNCS([GC_move_disappearing_link GC_is_heap_ptr]) 1062 1063# See if there's an auxiliary stack, as in ia64. 1064AC_CHECK_MEMBER([struct GC_stack_base.reg_base], 1065 [SCM_I_GSC_HAVE_AUXILIARY_STACK=1], [SCM_I_GSC_HAVE_AUXILIARY_STACK=0], 1066 [#include <gc/gc.h>]) 1067AC_SUBST([SCM_I_GSC_HAVE_AUXILIARY_STACK]) 1068 1069LIBS="$save_LIBS" 1070 1071 1072AC_CHECK_SIZEOF(float) 1073if test "$ac_cv_sizeof_float" -le "$ac_cv_sizeof_long"; then 1074 AC_DEFINE([SCM_SINGLES], 1, 1075 [Define this if floats are the same size as longs.]) 1076fi 1077 1078AC_MSG_CHECKING(for struct linger) 1079AC_CACHE_VAL(scm_cv_struct_linger, 1080 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1081#include <sys/types.h> 1082#include <sys/socket.h>]], 1083 [[struct linger lgr; lgr.l_linger = 100]])], 1084 [scm_cv_struct_linger="yes"], 1085 [scm_cv_struct_linger="no"])) 1086AC_MSG_RESULT($scm_cv_struct_linger) 1087if test $scm_cv_struct_linger = yes; then 1088 AC_DEFINE([HAVE_STRUCT_LINGER], 1, 1089 [Define this if your system defines struct linger, for use with the 1090 getsockopt and setsockopt system calls.]) 1091fi 1092 1093 1094dnl Check for `struct timespec', for the sake of `gen-scmconfig'. When 1095dnl building Guile, we always have it, thanks to Gnulib; but scmconfig.h 1096dnl must tell whether the system has it. 1097dnl 1098dnl On MinGW, struct timespec is in <pthread.h>. 1099AC_MSG_CHECKING(for struct timespec) 1100AC_CACHE_VAL(scm_cv_struct_timespec, 1101 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1102#include <time.h> 1103#if HAVE_PTHREAD_H 1104#include <pthread.h> 1105#endif]], [[struct timespec t; t.tv_nsec = 100]])], 1106 [scm_cv_struct_timespec="yes"], 1107 [scm_cv_struct_timespec="no"])) 1108AC_MSG_RESULT($scm_cv_struct_timespec) 1109if test $scm_cv_struct_timespec = yes; then 1110 dnl Don't call it `HAVE_STRUCT_TIMESPEC' because pthread-win32's 1111 dnl <pthread.h> checks whether that macro is defined. 1112 AC_DEFINE([HAVE_SYSTEM_STRUCT_TIMESPEC], 1, 1113 [Define this if your system defines struct timespec via either <time.h> or <pthread.h>.]) 1114fi 1115 1116#-------------------------------------------------------------------- 1117# 1118# Flags for thread support 1119# 1120#-------------------------------------------------------------------- 1121 1122SCM_I_GSC_USE_PTHREAD_THREADS=0 1123SCM_I_GSC_USE_NULL_THREADS=0 1124AC_SUBST([SCM_I_GSC_USE_PTHREAD_THREADS]) 1125AC_SUBST([SCM_I_GSC_USE_NULL_THREADS]) 1126 1127### What thread package has the user asked for? 1128AC_ARG_WITH(threads, [ --with-threads thread interface], 1129 , with_threads=yes) 1130 1131AC_SUBST(SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT, 0) 1132AC_SUBST(SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER, 0) 1133 1134case "$with_threads" in 1135 "yes" | "pthread" | "pthreads" | "pthread-threads" | "") 1136 1137 build_pthread_support="yes" 1138 1139 ACX_PTHREAD([CC="$PTHREAD_CC" 1140 LIBS="$PTHREAD_LIBS $LIBS" 1141 SCM_I_GSC_USE_PTHREAD_THREADS=1 1142 with_threads="pthreads"], 1143 [with_threads="null" 1144 build_pthread_support="no"]) 1145 1146 old_CFLAGS="$CFLAGS" 1147 CFLAGS="$PTHREAD_CFLAGS $CFLAGS" 1148 1149 # Reasons for testing: 1150 # pthread_getattr_np - "np" meaning "non portable" says it 1151 # all; not present on MacOS X or Solaris 10 1152 # pthread_get_stackaddr_np - "np" meaning "non portable" says it 1153 # all; specific to MacOS X 1154 # pthread_attr_get_np - "np" meaning "non portable" says it 1155 # all; specific to FreeBSD 1156 # pthread_sigmask - not available on mingw 1157 # pthread_cancel - not available on Android (Bionic libc) 1158 # 1159 AC_CHECK_FUNCS([pthread_attr_getstack pthread_getattr_np \ 1160 pthread_get_stackaddr_np pthread_attr_get_np pthread_sigmask \ 1161 pthread_cancel]) 1162 1163 # On past versions of Solaris, believe 8 through 10 at least, you 1164 # had to write "pthread_once_t foo = { PTHREAD_ONCE_INIT };". 1165 # This is contrary to POSIX: 1166 # http://www.opengroup.org/onlinepubs/000095399/functions/pthread_once.html 1167 # Check here if this style is required. 1168 # 1169 # glibc (2.3.6 at least) works both with or without braces, so the 1170 # test checks whether it works without. 1171 # 1172 1173 if test "$GCC" = "yes"; then 1174 # Since GCC only issues a warning for missing braces, so we need 1175 # `-Werror' to catch it. 1176 CFLAGS="-Werror -Wmissing-braces $CFLAGS" 1177 fi 1178 1179 AC_CACHE_CHECK([whether PTHREAD_ONCE_INIT needs braces], 1180 guile_cv_need_braces_on_pthread_once_init, 1181 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h> 1182 pthread_once_t foo = PTHREAD_ONCE_INIT;]])], 1183 [guile_cv_need_braces_on_pthread_once_init=no], 1184 [guile_cv_need_braces_on_pthread_once_init=yes])]) 1185 if test "$guile_cv_need_braces_on_pthread_once_init" = yes; then 1186 SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT=1 1187 fi 1188 1189 # Same problem with `PTHREAD_MUTEX_INITIALIZER', e.g., on IRIX 1190 # 6.5.30m with GCC 3.3. 1191 AC_CACHE_CHECK([whether PTHREAD_MUTEX_INITIALIZER needs braces], 1192 guile_cv_need_braces_on_pthread_mutex_initializer, 1193 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h> 1194 pthread_mutex_t foo = PTHREAD_MUTEX_INITIALIZER;]])], 1195 [guile_cv_need_braces_on_pthread_mutex_initializer=no], 1196 [guile_cv_need_braces_on_pthread_mutex_initializer=yes])]) 1197 if test "$guile_cv_need_braces_on_pthread_mutex_initializer" = yes; then 1198 SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER=1 1199 fi 1200 1201 CFLAGS="$old_CFLAGS" 1202 1203 # On Solaris, sched_yield lives in -lrt. 1204 AC_SEARCH_LIBS(sched_yield, rt) 1205 1206 ;; 1207esac 1208 1209case "$with_threads" in 1210 "pthreads") 1211 ;; 1212 "no" | "null") 1213 SCM_I_GSC_USE_NULL_THREADS=1 1214 SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS=0 1215 with_threads="null-threads" 1216 ;; 1217 * ) 1218 AC_MSG_ERROR(invalid value for --with-threads: $with_threads) 1219 ;; 1220esac 1221 1222AC_MSG_CHECKING(what kind of threads to support) 1223AC_MSG_RESULT($with_threads) 1224 1225AM_CONDITIONAL([BUILD_PTHREAD_SUPPORT], 1226 [test "x$build_pthread_support" = "xyes"]) 1227 1228 1229if test "$with_threads" = pthreads; then 1230 1231dnl Normally Gnulib's 'threadlib' module would define this macro, but 1232dnl since we don't use it, define it by ourselves. 1233AC_DEFINE([USE_POSIX_THREADS], [1], 1234 [Define to let Gnulib modules know that we use POSIX threads.]) 1235 1236AC_MSG_CHECKING([whether pthread_attr_getstack works for the main thread]) 1237old_CFLAGS="$CFLAGS" 1238CFLAGS="$PTHREAD_CFLAGS $CFLAGS" 1239if test "$cross_compiling" = "no"; then 1240 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 1241 #if HAVE_PTHREAD_ATTR_GETSTACK 1242 #include <pthread.h> 1243 1244 int main () 1245 { 1246 pthread_attr_t attr; 1247 void *start, *end; 1248 size_t size; 1249 1250 pthread_getattr_np (pthread_self (), &attr); 1251 pthread_attr_getstack (&attr, &start, &size); 1252 end = (char *)start + size; 1253 1254 if ((void *)&attr < start || (void *)&attr >= end) 1255 return 1; 1256 else 1257 return 0; 1258 } 1259 #else 1260 int main () 1261 { 1262 return 1; 1263 } 1264 #endif 1265 ]])], 1266 [works=yes 1267 AC_DEFINE([PTHREAD_ATTR_GETSTACK_WORKS], [1], [Define when pthread_att_get_stack works for the main thread])], 1268 [works=no], 1269 []) 1270else 1271 works="assuming it doesn't" 1272fi 1273CFLAGS="$old_CFLAGS" 1274AC_MSG_RESULT($works) 1275 1276GUILE_THREAD_LOCAL_STORAGE 1277 1278fi # with_threads=pthreads 1279 1280 1281## Cross building 1282if test "$cross_compiling" = "yes"; then 1283 AC_MSG_CHECKING(cc for build) 1284 ## /usr/bin/cc still uses wrong assembler 1285 ## CC_FOR_BUILD="${CC_FOR_BUILD-/usr/bincc}" 1286 CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}" 1287else 1288 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}" 1289fi 1290 1291## AC_MSG_CHECKING("if we are cross compiling") 1292## AC_MSG_RESULT($cross_compiling) 1293if test "$cross_compiling" = "yes"; then 1294 AC_MSG_RESULT($CC_FOR_BUILD) 1295fi 1296 1297## No need as yet to be more elaborate 1298CCLD_FOR_BUILD="$CC_FOR_BUILD" 1299 1300AC_SUBST(cross_compiling) 1301AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler]) 1302AC_SUBST(CCLD_FOR_BUILD) 1303 1304## libtool erroneously calls CC_FOR_BUILD HOST_CC; 1305## --HOST is the platform that PACKAGE is compiled for. 1306HOST_CC="$CC_FOR_BUILD" 1307AC_SUBST(HOST_CC) 1308 1309GUILE_CHECK_GUILE_FOR_BUILD 1310 1311## If we're using GCC, add flags to reduce strictness of undefined 1312## behavior, and ask for aggressive warnings. 1313GCC_CFLAGS="" 1314case "$GCC" in 1315 yes ) 1316 ## We had -Wstrict-prototypes in here for a bit, but Guile does too 1317 ## much stuff with generic function pointers for that to really be 1318 ## less than exasperating. 1319 ## -Wundef was removed because Gnulib prevented it (see 1320 ## <http://thread.gmane.org/gmane.lisp.guile.bugs/5329>.) 1321 1322 ## Build with `-fno-strict-aliasing' and `-fwrapv' to prevent 1323 ## miscompilation on some platforms. See 1324 ## <http://lists.gnu.org/archive/html/guile-devel/2012-01/msg00487.html>. 1325 1326 POTENTIAL_GCC_CFLAGS="-Wall -Wmissing-prototypes \ 1327 -Wpointer-arith -fno-strict-aliasing -fwrapv" 1328 # Do this here so we don't screw up any of the tests above that might 1329 # not be "warning free" 1330 if test "${GUILE_ERROR_ON_WARNING}" = yes 1331 then 1332 POTENTIAL_GCC_CFLAGS="${POTENTIAL_GCC_CFLAGS} -Werror" 1333 enable_compile_warnings=no 1334 fi 1335 1336 for flag in $POTENTIAL_GCC_CFLAGS 1337 do 1338 gl_WARN_ADD([$flag], [GCC_CFLAGS]) 1339 done 1340 ;; 1341esac 1342 1343AC_SUBST(GCC_CFLAGS) 1344 1345# Check for GNU ld's "-z relro". 1346GUILE_GNU_LD_RELRO 1347 1348 1349LIBLOBJS="" 1350for file in $LIBOBJS; do 1351 file=`echo "$file" | sed 's,\.[[^.]]*$,.lo,'` 1352 LIBLOBJS="$LIBLOBJS libguile_${GUILE_EFFECTIVE_VERSION}_la-$file" 1353done 1354 1355## We also need to create corresponding .doc and .x files 1356EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`" 1357EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`" 1358 1359# GNU Readline bindings. 1360GUILE_READLINE 1361 1362AC_SUBST(GUILE_MAJOR_VERSION) 1363AC_SUBST(GUILE_MINOR_VERSION) 1364AC_SUBST(GUILE_MICRO_VERSION) 1365AC_SUBST(GUILE_EFFECTIVE_VERSION) 1366AC_SUBST(GUILE_VERSION) 1367 1368####################################################################### 1369# library versioning 1370 1371AC_SUBST(LIBGUILE_INTERFACE_CURRENT) 1372AC_SUBST(LIBGUILE_INTERFACE_REVISION) 1373AC_SUBST(LIBGUILE_INTERFACE_AGE) 1374AC_SUBST(LIBGUILE_INTERFACE) 1375 1376AC_SUBST(LIBGUILE_I18N_MAJOR) 1377AC_SUBST(LIBGUILE_I18N_INTERFACE_CURRENT) 1378AC_SUBST(LIBGUILE_I18N_INTERFACE_REVISION) 1379AC_SUBST(LIBGUILE_I18N_INTERFACE_AGE) 1380AC_SUBST(LIBGUILE_I18N_INTERFACE) 1381 1382 1383####################################################################### 1384 1385dnl Tell guile-config what flags guile users should compile and link 1386dnl with, keeping only `-I' flags from $CPPFLAGS. 1387GUILE_CFLAGS="" 1388next_is_includedir=false 1389for flag in $CPPFLAGS 1390do 1391 if $next_is_includedir; then 1392 GUILE_CFLAGS="$GUILE_CFLAGS -I $flag" 1393 next_is_includedir=false 1394 else 1395 case "$flag" in 1396 -I) next_is_includedir=true;; 1397 -I*) GUILE_CFLAGS="$GUILE_CFLAGS $flag";; 1398 *) ;; 1399 esac 1400 fi 1401done 1402 1403GUILE_CFLAGS="$GUILE_CFLAGS $PTHREAD_CFLAGS" 1404GUILE_LIBS="$LIBS" 1405 1406AC_SUBST(GUILE_LIBS) 1407AC_SUBST(GUILE_CFLAGS) 1408 1409AC_SUBST(AWK) 1410AC_SUBST(LIBLOBJS) 1411AC_SUBST(EXTRA_DOT_DOC_FILES) 1412AC_SUBST(EXTRA_DOT_X_FILES) 1413 1414dnl See also top_builddir in info node: (libtool)AC_PROG_LIBTOOL 1415top_builddir_absolute=`pwd` 1416AC_SUBST(top_builddir_absolute) 1417top_srcdir_absolute=`(cd $srcdir && pwd)` 1418AC_SUBST(top_srcdir_absolute) 1419 1420dnl Add -I flag so that lib/glthread/lock.h finds <libguile/threads.h>. 1421CPPFLAGS="-I$top_srcdir_absolute $CPPFLAGS" 1422 1423dnl `sitedir' goes into libpath.h and the pkg-config file. 1424pkgdatadir="$datadir/$PACKAGE_TARNAME" 1425sitedir="$pkgdatadir/site/$GUILE_EFFECTIVE_VERSION" 1426AC_SUBST([sitedir]) 1427 1428# Additional SCM_I_GSC definitions are above. 1429AC_SUBST([SCM_I_GSC_GUILE_DEBUG]) 1430AC_SUBST([SCM_I_GSC_ENABLE_DEPRECATED]) 1431AC_SUBST([SCM_I_GSC_STACK_GROWS_UP]) 1432AC_SUBST([SCM_I_GSC_C_INLINE]) 1433AC_CONFIG_FILES([libguile/gen-scmconfig.h]) 1434 1435AC_CONFIG_FILES([ 1436 Makefile 1437 am/Makefile 1438 lib/Makefile 1439 benchmark-suite/Makefile 1440 gc-benchmarks/Makefile 1441 doc/Makefile 1442 doc/r5rs/Makefile 1443 doc/ref/Makefile 1444 emacs/Makefile 1445 examples/Makefile 1446 libguile/Makefile 1447 libguile/version.h 1448 guile-readline/Makefile 1449 test-suite/Makefile 1450 test-suite/standalone/Makefile 1451 meta/Makefile 1452 bootstrap/Makefile 1453 module/Makefile 1454 prebuilt/Makefile 1455 prebuilt/x86_64-unknown-linux-gnu/Makefile 1456 prebuilt/i686-pc-linux-gnu/Makefile 1457 prebuilt/mips-unknown-linux-gnu/Makefile 1458]) 1459 1460 1461GUILE_CONFIG_SCRIPT([check-guile]) 1462GUILE_CONFIG_SCRIPT([benchmark-guile]) 1463GUILE_CONFIG_SCRIPT([meta/guile]) 1464GUILE_CONFIG_SCRIPT([meta/build-env]) 1465GUILE_CONFIG_SCRIPT([meta/uninstalled-env]) 1466GUILE_CONFIG_SCRIPT([meta/gdb-uninstalled-guile]) 1467GUILE_CONFIG_SCRIPT([libguile/guile-snarf]) 1468GUILE_CONFIG_SCRIPT([libguile/guile-snarf-docs]) 1469GUILE_CONFIG_SCRIPT([test-suite/standalone/test-use-srfi]) 1470GUILE_CONFIG_SCRIPT([test-suite/standalone/test-fast-slot-ref]) 1471 1472AC_OUTPUT 1473 1474dnl Local Variables: 1475dnl comment-start: "dnl " 1476dnl comment-end: "" 1477dnl comment-start-skip: "\\bdnl\\b\\s *" 1478dnl End: 1479