diff options
author | Ludovic Courtès <ludo@gnu.org> | 2011-04-22 16:58:18 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2011-04-22 16:59:08 +0200 |
commit | 969bb92e9b13068abadb22eb7ab13c7f6616d266 (patch) | |
tree | 1ef3fb2ed78f8176b8cbec956535e454af1144d8 | |
parent | a508fbdb01373aed4aed5378806454672e8e702c (diff) | |
download | guile-969bb92e9b13068abadb22eb7ab13c7f6616d266.tar.gz |
Turn the libunistring/iconv configure check into a macro.
* acinclude.m4 (GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT): New macro.
* configure.ac: Use it.
-rw-r--r-- | acinclude.m4 | 29 | ||||
-rw-r--r-- | configure.ac | 24 |
2 files changed, 33 insertions, 20 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 3dbea2a0b..0938671c0 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -470,6 +470,35 @@ AC_DEFUN([GUILE_READLINE], [ 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 <uniconv.h> + #include <unistring/iconveh.h> + 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 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])]) diff --git a/configure.ac b/configure.ac index 7708fb4f8..685f9c18b 100644 --- a/configure.ac +++ b/configure.ac @@ -874,26 +874,10 @@ if test "x$LTLIBUNISTRING" = "x"; then AC_MSG_ERROR([GNU libunistring is required, please install it.]) fi -AC_MSG_CHECKING([that libunistring was built with iconv support]) -save_LIBS=$LIBS -LIBS="$LIBS $LIBUNISTRING" -AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include <uniconv.h> -#include <unistring/iconveh.h> -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_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([No iconv support. Please recompile libunistring with iconv enabled.])], - [AC_MSG_RESULT([yes, hopefully (cross-compiling)])]) -LIBS=$save_LIBS +GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT +if test "x$ac_cv_libunistring_with_iconv_support" != "xyes"; then + AC_MSG_ERROR([No iconv support. Please recompile libunistring with iconv enabled.]) +fi dnl Libffi is needed to compile Guile's foreign function interface, but its dnl interface isn't exposed in Guile's API. |