configure.ac 52 KB

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