configure.ac 55 KB

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