Add --enable-iconv option to configure

Disable iconv support by default, which provide a feature to convert
non-Unicode SFNT names to UTF-8.
This commit is contained in:
Akira TAGOH 2012-04-24 11:40:51 +09:00
parent 06d6b7c312
commit 526f0da93f
1 changed files with 32 additions and 28 deletions

View File

@ -145,6 +145,9 @@ fi
# #
# Checks for iconv # Checks for iconv
# #
AC_ARG_ENABLE(iconv,
[AC_HELP_STRING([--enable-iconv],
[Use iconv to support non-Unicode SFNT name])])
AC_ARG_WITH(libiconv, AC_ARG_WITH(libiconv,
[AC_HELP_STRING([--with-libiconv=DIR], [AC_HELP_STRING([--with-libiconv=DIR],
[Use libiconv in DIR])], [Use libiconv in DIR])],
@ -186,38 +189,39 @@ if test "x$libiconv_cflags" != "x"; then
fi fi
use_iconv=0 use_iconv=0
AC_MSG_CHECKING([for a usable iconv]) if test "x$enable_iconv" != "xno"; then
if test "x$libiconv_cflags" != "x" -o "x$libiconv_libs" != "x"; then AC_MSG_CHECKING([for a usable iconv])
iconvsaved_CFLAGS="$CFLAGS" if test "x$libiconv_cflags" != "x" -o "x$libiconv_libs" != "x"; then
iconvsaved_LIBS="$LIBS" iconvsaved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $libiconv_cflags" iconvsaved_LIBS="$LIBS"
LIBS="$LIBS $libiconv_libs" CFLAGS="$CFLAGS $libiconv_cflags"
LIBS="$LIBS $libiconv_libs"
AC_TRY_LINK([#include <iconv.h>], AC_TRY_LINK([#include <iconv.h>],
[iconv_open ("from", "to");], [iconv_open ("from", "to");],
[iconv_type="libiconv" [iconv_type="libiconv"
use_iconv=1], use_iconv=1],
[use_iconv=0]) [use_iconv=0])
CFLAGS="$iconvsaved_CFLAGS" CFLAGS="$iconvsaved_CFLAGS"
LIBS="$iconvsaved_LIBS" LIBS="$iconvsaved_LIBS"
ICONV_CFLAGS="$libiconv_cflags" ICONV_CFLAGS="$libiconv_cflags"
ICONV_LIBS="$libiconv_libs" ICONV_LIBS="$libiconv_libs"
fi
if test "x$use_iconv" = "x0"; then
AC_TRY_LINK([#include <iconv.h>],
[iconv_open ("from", "to");],
[iconv_type="libc"
use_iconv=1],
[iconv_type="not found"
use_iconv=0])
fi
AC_MSG_RESULT([$iconv_type])
AC_SUBST(ICONV_CFLAGS)
AC_SUBST(ICONV_LIBS)
fi fi
if test "x$use_iconv" = "x0"; then
AC_TRY_LINK([#include <iconv.h>],
[iconv_open ("from", "to");],
[iconv_type="libc"
use_iconv=1],
[iconv_type="not found"
use_iconv=0])
fi
AC_MSG_RESULT([$iconv_type])
AC_SUBST(ICONV_CFLAGS)
AC_SUBST(ICONV_LIBS)
AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.]) AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
# #
# Checks for FreeType # Checks for FreeType
# #