configure.ac 53 KB

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