1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 03:30:27 +02:00

Turn the libunistring/iconv configure check into a macro.

* acinclude.m4 (GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT): New macro.

* configure.ac: Use it.
This commit is contained in:
Ludovic Courtès 2011-04-22 16:58:18 +02:00
parent a508fbdb01
commit 969bb92e9b
2 changed files with 33 additions and 20 deletions

View file

@ -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])])

View file

@ -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.