Add build system fallback to icu-config

Ubuntu doesn't (or didn't until recently?) ship icu pkg-config
files.  That's quite unfortunate.  Work around it.

Bug 57608 - ICU Detection fallback for non-pkgconfig systems
This commit is contained in:
Behdad Esfahbod 2013-03-11 19:53:44 -04:00
parent 190e19e684
commit 14cfab52da
1 changed files with 37 additions and 0 deletions

View File

@ -173,6 +173,25 @@ AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
dnl ==========================================================================
PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, have_icu=false)
dnl Fallback to icu-config if ICU pkg-config files could not be found
if test "$have_icu" != "true"; then
AC_PATH_PROG(icu_config, icu-config, no)
AC_MSG_CHECKING([for ICU by using icu-config fallback])
if test "$icu_config" != "no"; then
have_icu=true
# We don't use --cflags as this gives us a lot of things that we don't
# necessarily want, like debugging and optimization flags
# See man (1) icu-config for more info.
ICU_CFLAGS=`$icu_config --cppflags`
ICU_LIBS=`$icu_config --ldflags-libsonly`
AC_SUBST(ICU_CFLAGS)
AC_SUBST(ICU_LIBS)
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
if $have_icu; then
CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
@ -182,6 +201,24 @@ AM_CONDITIONAL(HAVE_ICU, $have_icu)
dnl ==========================================================================
PKG_CHECK_MODULES(ICU_LE, icu-le icu-uc, have_icu_le=true, have_icu_le=false)
dnl Fallback to icu-config if ICU pkg-config files could not be found
if test "$have_icu_le" != "true"; then
AC_PATH_PROG(icu_config, icu-config, no)
AC_MSG_CHECKING([for ICU_LE by using icu-config fallback])
if test "$icu_config" != "no"; then
have_icu_le=true
# We don't use --cflags as this gives us a lot of things that we don't
# necessarily want, like debugging and optimization flags
# See man (1) icu-config for more info.
ICU_LE_CFLAGS=`$icu_config --cppflags`
ICU_LE_LIBS=`$icu_config --ldflags-libsonly --ldflags-layout`
AC_SUBST(ICU_LE_CFLAGS)
AC_SUBST(ICU_LE_LIBS)
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
if $have_icu_le; then
AC_DEFINE(HAVE_ICU_LE, 1, [Have ICU Layout Engine library])
fi