acinclude.m4 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. dnl -*- Autoconf -*-
  2. dnl Copyright (C) 1997, 1999, 2000, 2001, 2002, 2004, 2006,
  3. dnl 2007, 2008, 2009, 2010, 2011, 2013 Free Software Foundation, Inc.
  4. dnl
  5. dnl This file is part of GUILE
  6. dnl
  7. dnl GUILE is free software; you can redistribute it and/or modify it under
  8. dnl the terms of the GNU Lesser General Public License as published by the
  9. dnl Free Software Foundation; either version 3, or (at your option) any
  10. dnl later version.
  11. dnl
  12. dnl GUILE is distributed in the hope that it will be useful, but WITHOUT
  13. dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  15. dnl License for more details.
  16. dnl
  17. dnl You should have received a copy of the GNU Lesser General Public
  18. dnl License along with GUILE; see the file COPYING.LESSER. If not, write
  19. dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  20. dnl Floor, Boston, MA 02110-1301, USA.
  21. dnl On the NeXT, #including <utime.h> doesn't give you a definition for
  22. dnl struct utime, unless you #define _POSIX_SOURCE.
  23. AC_DEFUN([GUILE_STRUCT_UTIMBUF], [
  24. AC_CACHE_CHECK([whether we need POSIX to get struct utimbuf],
  25. guile_cv_struct_utimbuf_needs_posix,
  26. [AC_TRY_CPP([
  27. #ifdef __EMX__
  28. #include <sys/utime.h>
  29. #else
  30. #include <utime.h>
  31. #endif
  32. struct utime blah;
  33. ],
  34. guile_cv_struct_utimbuf_needs_posix=no,
  35. guile_cv_struct_utimbuf_needs_posix=yes)])
  36. if test "$guile_cv_struct_utimbuf_needs_posix" = yes; then
  37. AC_DEFINE([UTIMBUF_NEEDS_POSIX], 1,
  38. [Define this if <utime.h> doesn't define struct utimbuf unless
  39. _POSIX_SOURCE is defined. See GUILE_STRUCT_UTIMBUF in aclocal.m4.])
  40. fi])
  41. dnl
  42. dnl Apparently, at CMU they have a weird version of libc.h that is
  43. dnl installed in /usr/local/include and conflicts with unistd.h.
  44. dnl In these situations, we should not #include libc.h.
  45. dnl This test arranges to #define LIBC_H_WITH_UNISTD_H iff libc.h is
  46. dnl present on the system, and is safe to #include.
  47. dnl
  48. AC_DEFUN([GUILE_HEADER_LIBC_WITH_UNISTD],
  49. [
  50. AC_CHECK_HEADERS(libc.h unistd.h)
  51. AC_CACHE_CHECK(
  52. [whether libc.h and unistd.h can be included together],
  53. guile_cv_header_libc_with_unistd,
  54. [
  55. if test "$ac_cv_header_libc_h" = "no"; then
  56. guile_cv_header_libc_with_unistd="no"
  57. elif test "$ac_cv_header_unistd_h" = "no"; then
  58. guile_cv_header_libc_with_unistd="yes"
  59. else
  60. AC_TRY_COMPILE(
  61. [
  62. # include <libc.h>
  63. # include <unistd.h>
  64. ],
  65. [],
  66. [guile_cv_header_libc_with_unistd=yes],
  67. [guile_cv_header_libc_with_unistd=no]
  68. )
  69. fi
  70. ]
  71. )
  72. if test "$guile_cv_header_libc_with_unistd" = yes; then
  73. AC_DEFINE([LIBC_H_WITH_UNISTD_H], 1,
  74. [Define this if we should include <libc.h> when we've already
  75. included <unistd.h>. On some systems, they conflict, and libc.h
  76. should be omitted. See GUILE_HEADER_LIBC_WITH_UNISTD in
  77. aclocal.m4.])
  78. fi
  79. ]
  80. )
  81. dnl This is needed when we want to check for the same function repeatedly
  82. dnl with other parameters, such as libraries, varying.
  83. dnl
  84. dnl GUILE_NAMED_CHECK_FUNC(FUNCTION, TESTNAME,
  85. dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  86. AC_DEFUN([GUILE_NAMED_CHECK_FUNC],
  87. [AC_MSG_CHECKING([for $1])
  88. AC_CACHE_VAL(ac_cv_func_$1_$2,
  89. [AC_TRY_LINK(
  90. dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
  91. dnl which includes <sys/select.h> which contains a prototype for
  92. dnl select. Similarly for bzero.
  93. [/* System header to define __stub macros and hopefully few prototypes,
  94. which can conflict with char $1(); below. */
  95. #include <assert.h>
  96. /* Override any gcc2 internal prototype to avoid an error. */
  97. #ifdef __cplusplus
  98. extern "C"
  99. #endif
  100. /* We use char because int might match the return type of a gcc2
  101. builtin and then its argument prototype would still apply. */
  102. char $1();
  103. ], [
  104. /* The GNU C library defines this for functions which it implements
  105. to always fail with ENOSYS. Some functions are actually named
  106. something starting with __ and the normal name is an alias. */
  107. #if defined (__stub_$1) || defined (__stub___$1)
  108. choke me
  109. #else
  110. $1();
  111. #endif
  112. ], eval "ac_cv_func_$1_$2=yes", eval "ac_cv_func_$1_$2=no")])
  113. if eval "test \"`echo '$ac_cv_func_'$1'_'$2`\" = yes"; then
  114. AC_MSG_RESULT(yes)
  115. ifelse([$3], , :, [$3])
  116. else
  117. AC_MSG_RESULT(no)
  118. ifelse([$4], , , [$4
  119. ])dnl
  120. fi
  121. ])
  122. dnl Available from the Autoconf Macro Archive at:
  123. dnl http://autoconf-archive.cryp.to/acx_pthread.html
  124. dnl
  125. AC_DEFUN([ACX_PTHREAD], [
  126. AC_REQUIRE([AC_CANONICAL_HOST])
  127. AC_LANG_SAVE
  128. AC_LANG_C
  129. acx_pthread_ok=no
  130. # We used to check for pthread.h first, but this fails if pthread.h
  131. # requires special compiler flags (e.g. on True64 or Sequent).
  132. # It gets checked for in the link test anyway.
  133. # First of all, check if the user has set any of the PTHREAD_LIBS,
  134. # etcetera environment variables, and if threads linking works using
  135. # them:
  136. if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
  137. save_CFLAGS="$CFLAGS"
  138. CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  139. save_LIBS="$LIBS"
  140. LIBS="$PTHREAD_LIBS $LIBS"
  141. AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
  142. AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
  143. AC_MSG_RESULT($acx_pthread_ok)
  144. if test x"$acx_pthread_ok" = xno; then
  145. PTHREAD_LIBS=""
  146. PTHREAD_CFLAGS=""
  147. fi
  148. LIBS="$save_LIBS"
  149. CFLAGS="$save_CFLAGS"
  150. fi
  151. # We must check for the threads library under a number of different
  152. # names; the ordering is very important because some systems
  153. # (e.g. DEC) have both -lpthread and -lpthreads, where one of the
  154. # libraries is broken (non-POSIX).
  155. # Create a list of thread flags to try. Items starting with a "-" are
  156. # C compiler flags, and other items are library names, except for "none"
  157. # which indicates that we try without any flags at all, and "pthread-config"
  158. # which is a program returning the flags for the Pth emulation library.
  159. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
  160. # The ordering *is* (sometimes) important. Some notes on the
  161. # individual items follow:
  162. # pthreads: AIX (must check this before -lpthread)
  163. # none: in case threads are in libc; should be tried before -Kthread and
  164. # other compiler flags to prevent continual compiler warnings
  165. # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
  166. # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
  167. # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
  168. # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
  169. # -pthreads: Solaris/gcc
  170. # -mthreads: Mingw32/gcc, Lynx/gcc
  171. # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
  172. # doesn't hurt to check since this sometimes defines pthreads too;
  173. # also defines -D_REENTRANT)
  174. # ... -mt is also the pthreads flag for HP/aCC
  175. # pthread: Linux, etcetera
  176. # --thread-safe: KAI C++
  177. # pthread-config: use pthread-config program (for GNU Pth library)
  178. case "${host_cpu}-${host_os}" in
  179. *solaris*)
  180. # On Solaris (at least, for some versions), libc contains stubbed
  181. # (non-functional) versions of the pthreads routines, so link-based
  182. # tests will erroneously succeed. (We need to link with -pthreads/-mt/
  183. # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
  184. # a function called by this macro, so we could check for that, but
  185. # who knows whether they'll stub that too in a future libc.) So,
  186. # we'll just look for -pthreads and -lpthread first:
  187. acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
  188. ;;
  189. esac
  190. if test x"$acx_pthread_ok" = xno; then
  191. for flag in $acx_pthread_flags; do
  192. case $flag in
  193. none)
  194. AC_MSG_CHECKING([whether pthreads work without any flags])
  195. ;;
  196. -*)
  197. AC_MSG_CHECKING([whether pthreads work with $flag])
  198. PTHREAD_CFLAGS="$flag"
  199. ;;
  200. pthread-config)
  201. AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
  202. if test x"$acx_pthread_config" = xno; then continue; fi
  203. PTHREAD_CFLAGS="`pthread-config --cflags`"
  204. PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
  205. ;;
  206. *)
  207. AC_MSG_CHECKING([for the pthreads library -l$flag])
  208. PTHREAD_LIBS="-l$flag"
  209. ;;
  210. esac
  211. save_LIBS="$LIBS"
  212. save_CFLAGS="$CFLAGS"
  213. LIBS="$PTHREAD_LIBS $LIBS"
  214. CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  215. # Check for various functions. We must include pthread.h,
  216. # since some functions may be macros. (On the Sequent, we
  217. # need a special flag -Kthread to make this header compile.)
  218. # We check for pthread_join because it is in -lpthread on IRIX
  219. # while pthread_create is in libc. We check for pthread_attr_init
  220. # due to DEC craziness with -lpthreads. We check for
  221. # pthread_cleanup_push because it is one of the few pthread
  222. # functions on Solaris that doesn't have a non-functional libc stub.
  223. # We try pthread_create on general principles.
  224. AC_TRY_LINK([#include <pthread.h>],
  225. [pthread_t th; pthread_join(th, 0);
  226. pthread_attr_init(0); pthread_cleanup_push(0, 0);
  227. pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
  228. [acx_pthread_ok=yes])
  229. LIBS="$save_LIBS"
  230. CFLAGS="$save_CFLAGS"
  231. AC_MSG_RESULT($acx_pthread_ok)
  232. if test "x$acx_pthread_ok" = xyes; then
  233. break;
  234. fi
  235. PTHREAD_LIBS=""
  236. PTHREAD_CFLAGS=""
  237. done
  238. fi
  239. # Various other checks:
  240. if test "x$acx_pthread_ok" = xyes; then
  241. save_LIBS="$LIBS"
  242. LIBS="$PTHREAD_LIBS $LIBS"
  243. save_CFLAGS="$CFLAGS"
  244. CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  245. # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
  246. AC_MSG_CHECKING([for joinable pthread attribute])
  247. attr_name=unknown
  248. for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
  249. AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
  250. [attr_name=$attr; break])
  251. done
  252. AC_MSG_RESULT($attr_name)
  253. if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
  254. AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], $attr_name,
  255. [Define to necessary symbol if this constant
  256. uses a non-standard name on your system.])
  257. fi
  258. AC_MSG_CHECKING([if more special flags are required for pthreads])
  259. flag=no
  260. case "${host_cpu}-${host_os}" in
  261. *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
  262. *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
  263. esac
  264. AC_MSG_RESULT(${flag})
  265. if test "x$flag" != xno; then
  266. PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
  267. fi
  268. LIBS="$save_LIBS"
  269. CFLAGS="$save_CFLAGS"
  270. # More AIX lossage: must compile with xlc_r or cc_r
  271. if test x"$GCC" != xyes; then
  272. AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
  273. else
  274. PTHREAD_CC=$CC
  275. fi
  276. else
  277. PTHREAD_CC="$CC"
  278. fi
  279. AC_SUBST(PTHREAD_LIBS)
  280. AC_SUBST(PTHREAD_CFLAGS)
  281. AC_SUBST(PTHREAD_CC)
  282. # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
  283. if test x"$acx_pthread_ok" = xyes; then
  284. ifelse([$1],,AC_DEFINE([HAVE_PTHREAD],1,[Define if you have POSIX threads libraries and header files.]),[$1])
  285. :
  286. else
  287. acx_pthread_ok=no
  288. $2
  289. fi
  290. AC_LANG_RESTORE
  291. ])dnl ACX_PTHREAD
  292. dnl GUILE_GNU_LD_RELRO
  293. dnl
  294. dnl Check whether GNU ld's read-only relocations (the `PT_GNU_RELRO'
  295. dnl ELF segment header) are supported. This allows things like
  296. dnl statically allocated cells (1) to eventually be remapped read-only
  297. dnl by the loader, and (2) to be identified as pointerless by the
  298. dnl garbage collector. Substitute `GNU_LD_FLAGS' with the relevant
  299. dnl flags.
  300. AC_DEFUN([GUILE_GNU_LD_RELRO], [
  301. AC_MSG_CHECKING([whether the linker understands `-z relro'])
  302. GNU_LD_FLAGS="-Wl,-z -Wl,relro"
  303. save_LDFLAGS="$LDFLAGS"
  304. LDFLAGS="$LDFLAGS $GNU_LD_FLAGS"
  305. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
  306. [AC_MSG_RESULT([yes])],
  307. [AC_MSG_RESULT([no])
  308. GNU_LD_FLAGS=""])
  309. LDFLAGS="$save_LDFLAGS"
  310. AC_SUBST([GNU_LD_FLAGS])
  311. ])
  312. dnl GUILE_THREAD_LOCAL_STORAGE
  313. dnl
  314. dnl Check for compiler thread-local storage (TLS) support.
  315. AC_DEFUN([GUILE_THREAD_LOCAL_STORAGE], [
  316. AC_REQUIRE([AC_CANONICAL_HOST])
  317. AC_CACHE_CHECK([whether the `__thread' storage class is available],
  318. [ac_cv_have_thread_storage_class],
  319. [dnl On some systems, e.g., NetBSD 5.0 with GCC 4.1, `__thread' is
  320. dnl properly compiled but fails to link due to the lack of TLS
  321. dnl support in the C library. Thus we try to link, not just
  322. dnl compile. Unfortunately, this test is not enough, so we
  323. dnl explicitly check for known-broken systems. See
  324. dnl http://lists.gnu.org/archive/html/guile-devel/2009-10/msg00138.html
  325. dnl for details.
  326. dnl
  327. dnl Known broken systems includes:
  328. dnl - x86_64-unknown-netbsd5.0.
  329. dnl - x86_64-unknown-netbsd5.1
  330. dnl - sparc-sun-solaris2.8
  331. dnl
  332. dnl On `x86_64-unknown-freebsd8.0', thread-local storage appears to
  333. dnl be reclaimed at the wrong time, leading to a segfault when
  334. dnl running `threads.test'. So disable it.
  335. case "$enable_shared--$host_os" in
  336. [yes--netbsd[0-5].[0-9]*|yes--solaris2.8|yes--freebsd[0-8]*])
  337. ac_cv_have_thread_storage_class="no"
  338. ;;
  339. *)
  340. AC_LINK_IFELSE([AC_LANG_PROGRAM([__thread int tls_integer;],
  341. [tls_integer = 123;])],
  342. [ac_cv_have_thread_storage_class="yes"],
  343. [ac_cv_have_thread_storage_class="no"])
  344. ;;
  345. esac])
  346. if test "x$ac_cv_have_thread_storage_class" = "xyes"; then
  347. SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS=1
  348. else
  349. SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS=0
  350. fi
  351. AC_SUBST([SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS])
  352. ])
  353. dnl GUILE_READLINE
  354. dnl
  355. dnl Check all the things needed by `guile-readline', the Readline
  356. dnl bindings.
  357. AC_DEFUN([GUILE_READLINE], [
  358. for termlib in ncurses curses termcap terminfo termlib pdcurses ; do
  359. AC_CHECK_LIB(${termlib}, [tgoto],
  360. [READLINE_LIBS="-l${termlib} $READLINE_LIBS"; break])
  361. done
  362. AC_LIB_LINKFLAGS([readline])
  363. if test "x$LTLIBREADLINE" = "x"; then
  364. AC_MSG_WARN([GNU Readline was not found on your system.])
  365. else
  366. rl_save_LIBS="$LIBS"
  367. LIBS="$LIBREADLINE $READLINE_LIBS $LIBS"
  368. AC_CHECK_FUNCS([siginterrupt rl_clear_signals rl_cleanup_after_signal])
  369. dnl Check for modern readline naming
  370. AC_CHECK_FUNCS([rl_filename_completion_function])
  371. AC_CHECK_DECLS([rl_catch_signals, rl_catch_sigwinch], [], [],
  372. [[#include <stdio.h>]
  373. [#include <readline/readline.h>]])
  374. dnl Check for rl_get_keymap. We only use this for deciding whether to
  375. dnl install paren matching on the Guile command line (when using
  376. dnl readline for input), so it's completely optional.
  377. AC_CHECK_FUNCS([rl_get_keymap])
  378. AC_CACHE_CHECK([for rl_getc_function pointer in readline],
  379. ac_cv_var_rl_getc_function,
  380. [AC_TRY_LINK([
  381. #include <stdio.h>
  382. #include <readline/readline.h>],
  383. [printf ("%ld", (long) rl_getc_function)],
  384. [ac_cv_var_rl_getc_function=yes],
  385. [ac_cv_var_rl_getc_function=no])])
  386. if test "${ac_cv_var_rl_getc_function}" = "yes"; then
  387. AC_DEFINE([HAVE_RL_GETC_FUNCTION], 1,
  388. [Define if your readline library has the rl_getc_function variable.])
  389. fi
  390. if test $ac_cv_var_rl_getc_function = no; then
  391. AC_MSG_WARN([*** GNU Readline is too old on your system.])
  392. AC_MSG_WARN([*** You need readline version 2.1 or later.])
  393. LTLIBREADLINE=""
  394. LIBREADLINE=""
  395. fi
  396. LIBS="$rl_save_LIBS"
  397. READLINE_LIBS="$LTLIBREADLINE $READLINE_LIBS"
  398. fi
  399. AM_CONDITIONAL([HAVE_READLINE], [test "x$LTLIBREADLINE" != "x"])
  400. AC_CHECK_FUNCS([strdup])
  401. AC_SUBST([READLINE_LIBS])
  402. ])
  403. dnl GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT
  404. dnl
  405. dnl Check whether libunistring has iconv support. When it lacks iconv
  406. dnl support, `mem_iconveh' returns -1 (ENOSYS) and conversions from one
  407. dnl codeset to another do not work.
  408. AC_DEFUN([GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT], [
  409. AC_CACHE_CHECK([whether libunistring was built with iconv support],
  410. [ac_cv_libunistring_with_iconv_support], [
  411. save_LIBS=$LIBS
  412. LIBS="$LIBS $LIBUNISTRING"
  413. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  414. #include <uniconv.h>
  415. #include <unistring/iconveh.h>
  416. int
  417. main (int argc, char *argv[])
  418. {
  419. size_t result_size;
  420. return (NULL == u32_conv_from_encoding ("ASCII", iconveh_question_mark,
  421. "a", 1,
  422. NULL, NULL, &result_size));
  423. }
  424. ]])],
  425. [ac_cv_libunistring_with_iconv_support=yes],
  426. [ac_cv_libunistring_with_iconv_support=no],
  427. [ac_cv_libunistring_with_iconv_support=yes])
  428. LIBS=$save_LIBS
  429. ])
  430. ])
  431. dnl GUILE_UNISTRING_CONSTANT NAME
  432. dnl
  433. dnl Determine the compile-time value of NAME and define/substitute
  434. dnl `SCM_I_GSC_NAME'.
  435. AC_DEFUN([GUILE_UNISTRING_CONSTANT], [
  436. m4_pushdef([UPPER_CASE_NAME],
  437. [m4_translit([$1],[abcdefghijklmnopqrstuvwxyz],
  438. [ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
  439. AC_CACHE_CHECK([the value of `$1'], [ac_cv_]$1, [
  440. AC_COMPUTE_INT([ac_cv_]$1, [$1],
  441. [AC_INCLUDES_DEFAULT
  442. #include <uniconv.h>
  443. ],
  444. [AC_MSG_ERROR([failed to determine the value of `$1'])])
  445. ])
  446. [SCM_I_GSC_]UPPER_CASE_NAME="$ac_cv_[]$1"
  447. AC_SUBST([SCM_I_GSC_]UPPER_CASE_NAME)
  448. m4_popdef([UPPER_CASE_NAME])])
  449. dnl GUILE_UNISTRING_ICONVEH_VALUES
  450. dnl
  451. dnl Determine the values of the `iconveh_' libunistring constants.
  452. AC_DEFUN([GUILE_UNISTRING_ICONVEH_VALUES], [
  453. GUILE_UNISTRING_CONSTANT([iconveh_error])
  454. GUILE_UNISTRING_CONSTANT([iconveh_question_mark])
  455. GUILE_UNISTRING_CONSTANT([iconveh_escape_sequence])
  456. ])
  457. dnl GUILE_CHECK_VERSION
  458. dnl
  459. dnl Ensure that $GUILE_FOR_BUILD has the same version as ourselves.
  460. AC_DEFUN([GUILE_CHECK_VERSION], [
  461. if ! "$GUILE_FOR_BUILD" --version > /dev/null 2>&1; then
  462. AC_MSG_ERROR([failed to run `$GUILE_FOR_BUILD'])
  463. fi
  464. dnl Use MAJOR.MINOR.MICRO instead of (version) so that developers can
  465. dnl freely shoot themselves in the foot by using, say, 2.0.3.80 and
  466. dnl 2.0.3.42.
  467. AC_CACHE_CHECK([the version of $GUILE_FOR_BUILD],
  468. [ac_cv_guile_for_build_version],
  469. [ac_cv_guile_for_build_version="`"$GUILE_FOR_BUILD" \
  470. -c '(format #t "~a.~a.~a" (major-version) (minor-version) (micro-version))'`"
  471. ])
  472. if test "$ac_cv_guile_for_build_version" != \
  473. "$GUILE_MAJOR_VERSION.$GUILE_MINOR_VERSION.$GUILE_MICRO_VERSION"
  474. then
  475. AC_MSG_ERROR([building Guile $PACKAGE_VERSION but `$GUILE_FOR_BUILD' has version $ac_cv_guile_for_build_version"])
  476. fi
  477. ])
  478. dnl GUILE_CHECK_GUILE_FOR_BUILD
  479. dnl
  480. dnl When cross-compiling, ensure that $GUILE_FOR_BUILD is suitable.
  481. AC_DEFUN([GUILE_CHECK_GUILE_FOR_BUILD], [
  482. if test "$cross_compiling" = "yes"; then
  483. if test "x$GUILE_FOR_BUILD" = "x"; then
  484. AC_PATH_PROG([GUILE_FOR_BUILD], [guile], [not-found])
  485. if test "$GUILE_FOR_BUILD" = "not-found"; then
  486. AC_MSG_ERROR([a native Guile $PACKAGE_VERSION is required to cross-build Guile])
  487. fi
  488. fi
  489. AC_MSG_CHECKING([guile for build])
  490. AC_MSG_RESULT([$GUILE_FOR_BUILD])
  491. dnl Since there is currently no distinction between the run-time
  492. dnl search path, %load-path, and the compiler's search path,
  493. dnl $GUILE_FOR_BUILD must be a native build of the very same version.
  494. GUILE_CHECK_VERSION
  495. else
  496. GUILE_FOR_BUILD='this-value-will-never-be-used'
  497. fi
  498. AC_ARG_VAR([GUILE_FOR_BUILD], [guile for the build system])
  499. AM_SUBST_NOTMAKE([GUILE_FOR_BUILD])
  500. ])
  501. dnl Declare file $1 to be a script that needs configuring,
  502. dnl and arrange to make it executable in the process.
  503. AC_DEFUN([GUILE_CONFIG_SCRIPT],[AC_CONFIG_FILES([$1],[chmod +x $1])])