configure.ac 53 KB

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