X-Git-Url: https://git.hcoop.net/bpt/guile.git/blobdiff_plain/731dd0ce191bf4f3ba8fedfe0e08c0e67a966ce4..1f47b6975a4acc980a95ba477b9d90835a7e331c:/acinclude.m4 diff --git a/acinclude.m4 b/acinclude.m4 index 43a227bc9..6a1470f24 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,5 +1,26 @@ dnl -*- Autoconf -*- +dnl Copyright (C) 1997, 1999, 2000, 2001, 2002, 2004, 2006, +dnl 2007, 2008, 2009, 2010, 2011, 2013 Free Software Foundation, Inc. +dnl +dnl This file is part of GUILE +dnl +dnl GUILE is free software; you can redistribute it and/or modify it under +dnl the terms of the GNU Lesser General Public License as published by the +dnl Free Software Foundation; either version 3, or (at your option) any +dnl later version. +dnl +dnl GUILE is distributed in the hope that it will be useful, but WITHOUT +dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +dnl License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with GUILE; see the file COPYING.LESSER. If not, write +dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth +dnl Floor, Boston, MA 02110-1301, USA. + + dnl On the NeXT, #including doesn't give you a definition for dnl struct utime, unless you #define _POSIX_SOURCE. @@ -57,7 +78,7 @@ AC_DEFUN([GUILE_HEADER_LIBC_WITH_UNISTD], ] ) if test "$guile_cv_header_libc_with_unistd" = yes; then - AC_DEFINE(LIBC_H_WITH_UNISTD_H, 1, + AC_DEFINE([LIBC_H_WITH_UNISTD_H], 1, [Define this if we should include when we've already included . On some systems, they conflict, and libc.h should be omitted. See GUILE_HEADER_LIBC_WITH_UNISTD in @@ -267,7 +288,7 @@ if test "x$acx_pthread_ok" = xyes; then done AC_MSG_RESULT($attr_name) if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then - AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], $attr_name, [Define to necessary symbol if this constant uses a non-standard name on your system.]) fi @@ -302,7 +323,7 @@ AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + ifelse([$1],,AC_DEFINE([HAVE_PTHREAD],1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else acx_pthread_ok=no @@ -339,15 +360,37 @@ dnl GUILE_THREAD_LOCAL_STORAGE dnl dnl Check for compiler thread-local storage (TLS) support. AC_DEFUN([GUILE_THREAD_LOCAL_STORAGE], [ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether the `__thread' storage class is available], [ac_cv_have_thread_storage_class], [dnl On some systems, e.g., NetBSD 5.0 with GCC 4.1, `__thread' is dnl properly compiled but fails to link due to the lack of TLS - dnl support in the C library. Thus we try to link, not just compile. - AC_LINK_IFELSE([AC_LANG_PROGRAM([__thread int tls_integer;], - [tls_integer = 123;])], - [ac_cv_have_thread_storage_class="yes"], - [ac_cv_have_thread_storage_class="no"])]) + dnl support in the C library. Thus we try to link, not just + dnl compile. Unfortunately, this test is not enough, so we + dnl explicitly check for known-broken systems. See + dnl http://lists.gnu.org/archive/html/guile-devel/2009-10/msg00138.html + dnl for details. + dnl + dnl Known broken systems includes: + dnl - x86_64-unknown-netbsd5.0. + dnl - x86_64-unknown-netbsd5.1 + dnl - sparc-sun-solaris2.8 + dnl + dnl On `x86_64-unknown-freebsd8.0', thread-local storage appears to + dnl be reclaimed at the wrong time, leading to a segfault when + dnl running `threads.test'. So disable it. + case "$enable_shared--$host_os" in + [yes--netbsd[0-5].[0-9]*|yes--solaris2.8|yes--freebsd[0-8]*]) + ac_cv_have_thread_storage_class="no" + ;; + *) + AC_LINK_IFELSE([AC_LANG_PROGRAM([__thread int tls_integer;], + [tls_integer = 123;])], + [ac_cv_have_thread_storage_class="yes"], + [ac_cv_have_thread_storage_class="no"]) + ;; + esac]) if test "x$ac_cv_have_thread_storage_class" = "xyes"; then SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS=1 @@ -363,7 +406,7 @@ dnl dnl Check all the things needed by `guile-readline', the Readline dnl bindings. AC_DEFUN([GUILE_READLINE], [ - for termlib in ncurses curses termcap terminfo termlib ; do + for termlib in ncurses curses termcap terminfo termlib pdcurses ; do AC_CHECK_LIB(${termlib}, [tgoto], [READLINE_LIBS="-l${termlib} $READLINE_LIBS"; break]) done @@ -380,6 +423,9 @@ AC_DEFUN([GUILE_READLINE], [ dnl Check for modern readline naming AC_CHECK_FUNCS([rl_filename_completion_function]) + AC_CHECK_DECLS([rl_catch_signals, rl_catch_sigwinch], [], [], + [[#include ] + [#include ]]) dnl Check for rl_get_keymap. We only use this for deciding whether to dnl install paren matching on the Guile command line (when using @@ -416,11 +462,117 @@ AC_DEFUN([GUILE_READLINE], [ AC_CHECK_FUNCS([strdup]) AC_SUBST([READLINE_LIBS]) +]) - . $srcdir/guile-readline/LIBGUILEREADLINE-VERSION - AC_SUBST(LIBGUILEREADLINE_MAJOR) - AC_SUBST(LIBGUILEREADLINE_INTERFACE_CURRENT) - AC_SUBST(LIBGUILEREADLINE_INTERFACE_REVISION) - AC_SUBST(LIBGUILEREADLINE_INTERFACE_AGE) - AC_SUBST(LIBGUILEREADLINE_INTERFACE) +dnl GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT +dnl +dnl Check whether libunistring has iconv support. When it lacks iconv +dnl support, `mem_iconveh' returns -1 (ENOSYS) and conversions from one +dnl codeset to another do not work. +AC_DEFUN([GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT], [ + AC_CACHE_CHECK([whether libunistring was built with iconv support], + [ac_cv_libunistring_with_iconv_support], [ + save_LIBS=$LIBS + LIBS="$LIBS $LIBUNISTRING" + AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #include + int + main (int argc, char *argv[]) + { + size_t result_size; + return (NULL == u32_conv_from_encoding ("ASCII", iconveh_question_mark, + "a", 1, + NULL, NULL, &result_size)); + } + ]])], + [ac_cv_libunistring_with_iconv_support=yes], + [ac_cv_libunistring_with_iconv_support=no], + [ac_cv_libunistring_with_iconv_support=yes]) + LIBS=$save_LIBS + ]) +]) + +dnl GUILE_UNISTRING_CONSTANT NAME +dnl +dnl Determine the compile-time value of NAME and define/substitute +dnl `SCM_I_GSC_NAME'. +AC_DEFUN([GUILE_UNISTRING_CONSTANT], [ + m4_pushdef([UPPER_CASE_NAME], + [m4_translit([$1],[abcdefghijklmnopqrstuvwxyz], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ])]) + + AC_CACHE_CHECK([the value of `$1'], [ac_cv_]$1, [ + AC_COMPUTE_INT([ac_cv_]$1, [$1], + [AC_INCLUDES_DEFAULT +#include +], + [AC_MSG_ERROR([failed to determine the value of `$1'])]) + ]) + + [SCM_I_GSC_]UPPER_CASE_NAME="$ac_cv_[]$1" + AC_SUBST([SCM_I_GSC_]UPPER_CASE_NAME) + m4_popdef([UPPER_CASE_NAME])]) + +dnl GUILE_UNISTRING_ICONVEH_VALUES +dnl +dnl Determine the values of the `iconveh_' libunistring constants. +AC_DEFUN([GUILE_UNISTRING_ICONVEH_VALUES], [ + GUILE_UNISTRING_CONSTANT([iconveh_error]) + GUILE_UNISTRING_CONSTANT([iconveh_question_mark]) + GUILE_UNISTRING_CONSTANT([iconveh_escape_sequence]) ]) + +dnl GUILE_CHECK_VERSION +dnl +dnl Ensure that $GUILE_FOR_BUILD has the same version as ourselves. +AC_DEFUN([GUILE_CHECK_VERSION], [ + if ! "$GUILE_FOR_BUILD" --version > /dev/null 2>&1; then + AC_MSG_ERROR([failed to run `$GUILE_FOR_BUILD']) + fi + + dnl Use MAJOR.MINOR.MICRO instead of (version) so that developers can + dnl freely shoot themselves in the foot by using, say, 2.0.3.80 and + dnl 2.0.3.42. + AC_CACHE_CHECK([the version of $GUILE_FOR_BUILD], + [ac_cv_guile_for_build_version], + [ac_cv_guile_for_build_version="`"$GUILE_FOR_BUILD" \ + -c '(format #t "~a.~a.~a" (major-version) (minor-version) (micro-version))'`" + ]) + + if test "$ac_cv_guile_for_build_version" != \ + "$GUILE_MAJOR_VERSION.$GUILE_MINOR_VERSION.$GUILE_MICRO_VERSION" + then + AC_MSG_ERROR([building Guile $PACKAGE_VERSION but `$GUILE_FOR_BUILD' has version $ac_cv_guile_for_build_version"]) + fi +]) + +dnl GUILE_CHECK_GUILE_FOR_BUILD +dnl +dnl When cross-compiling, ensure that $GUILE_FOR_BUILD is suitable. +AC_DEFUN([GUILE_CHECK_GUILE_FOR_BUILD], [ + if test "$cross_compiling" = "yes"; then + if test "x$GUILE_FOR_BUILD" = "x"; then + AC_PATH_PROG([GUILE_FOR_BUILD], [guile], [not-found]) + if test "$GUILE_FOR_BUILD" = "not-found"; then + AC_MSG_ERROR([a native Guile $PACKAGE_VERSION is required to cross-build Guile]) + fi + fi + AC_MSG_CHECKING([guile for build]) + AC_MSG_RESULT([$GUILE_FOR_BUILD]) + + dnl Since there is currently no distinction between the run-time + dnl search path, %load-path, and the compiler's search path, + dnl $GUILE_FOR_BUILD must be a native build of the very same version. + GUILE_CHECK_VERSION + else + GUILE_FOR_BUILD='this-value-will-never-be-used' + fi + + AC_ARG_VAR([GUILE_FOR_BUILD], [guile for the build system]) + AM_SUBST_NOTMAKE([GUILE_FOR_BUILD]) +]) + +dnl Declare file $1 to be a script that needs configuring, +dnl and arrange to make it executable in the process. +AC_DEFUN([GUILE_CONFIG_SCRIPT],[AC_CONFIG_FILES([$1],[chmod +x $1])])