configure.ac 52 KB

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