configure.ac 52 KB

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