configure.ac 52 KB

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