configure.ac 55 KB

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