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