configure.ac 53 KB

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