Bug 65053 - Add configure option to enable/disable ICU support

This commit is contained in:
Behdad Esfahbod 2013-05-27 19:04:40 -04:00
parent cf2c1c7eb8
commit 932b747147

View File

@ -166,26 +166,36 @@ AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
dnl ========================================================================== dnl ==========================================================================
PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, have_icu=false) AC_ARG_WITH(icu,
dnl Fallback to icu-config if ICU pkg-config files could not be found [AS_HELP_STRING([--with-icu=@<:@yes/no/auto@:>@],
if test "$have_icu" != "true"; then [Use ICU @<:@default=auto@:>@])],,
AC_CHECK_TOOL(ICU_CONFIG, icu-config, no) [with_icu=auto])
AC_MSG_CHECKING([for ICU by using icu-config fallback]) have_icu=false
if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then if test "x$with_icu" = "xyes" -o "x$with_icu" = "xauto"; then
have_icu=true PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, have_icu=false)
# We don't use --cflags as this gives us a lot of things that we don't
# necessarily want, like debugging and optimization flags dnl Fallback to icu-config if ICU pkg-config files could not be found
# See man (1) icu-config for more info. if test "$have_icu" != "true"; then
ICU_CFLAGS=`$ICU_CONFIG --cppflags` AC_CHECK_TOOL(ICU_CONFIG, icu-config, no)
ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly` AC_MSG_CHECKING([for ICU by using icu-config fallback])
AC_SUBST(ICU_CFLAGS) if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then
AC_SUBST(ICU_LIBS) have_icu=true
AC_MSG_RESULT([yes]) # We don't use --cflags as this gives us a lot of things that we don't
else # necessarily want, like debugging and optimization flags
AC_MSG_RESULT([no]) # See man (1) icu-config for more info.
ICU_CFLAGS=`$ICU_CONFIG --cppflags`
ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly`
AC_SUBST(ICU_CFLAGS)
AC_SUBST(ICU_LIBS)
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi fi
fi fi
if test "x$with_icu" = "xyes" -a "x$have_icu" != "xtrue"; then
AC_MSG_ERROR([icu support requested but icu-uc not found])
fi
if $have_icu; then if $have_icu; then
CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`" CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
AC_DEFINE(HAVE_ICU, 1, [Have ICU library]) AC_DEFINE(HAVE_ICU, 1, [Have ICU library])