2008/01/25

configure.in for libiconv ( iconv ) checking.




As the title states, use this with your autoconf and automake under
both Linux ( where iconv_open() is a libc built-in function )
and Solaris ( where iconv_open() is a part of GNU libiconv ).

#
# Checks for iconv
#
AC_MSG_CHECKING([for a usable iconv])
ICONV_LIBS=""
AC_TRY_LINK([#include ],
[iconv_open ("from", "to");],
[use_iconv=1],
[use_iconv=0])
if test x$use_iconv = x1; then
AC_MSG_RESULT([libc])
else
# try using libiconv
fontconfig_save_libs="$LIBS"
LIBS="$LIBS -liconv"

AC_TRY_LINK([#include ],
[iconv_open ("from", "to");],
[use_iconv=1],
[use_iconv=0])

if test x$use_iconv = x1; then
ICONV_LIBS="-liconv"
AC_MSG_RESULT([libiconv])
else
AC_MSG_RESULT([no])
fi

LIBS="$fontconfig_save_libs"
fi
AC_SUBST(ICONV_LIBS)
AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])

0 件のコメント: