Merge PR #32 (Use pkg-config to detect icu)

This commit is contained in:
Ivan Vučica 2019-01-06 19:46:56 +00:00
commit 8637bce8dc
2 changed files with 5 additions and 86 deletions

View file

@ -1,41 +0,0 @@
AC_DEFUN([AC_CHECK_ICU], [
ok=no
if test -z "$ICU_CONFIG"; then
AC_PATH_PROG(ICU_CONFIG, icu-config, no)
fi
if test "$ICU_CONFIG" = "no" ; then
echo "Could not find the icu-config script."
echo "Please ensure that it is in your path."
echo "See http://site.icu-project.org/ for help."
else
ICU_VERSION=`$ICU_CONFIG --version`
AC_MSG_CHECKING(for ICU >= $1)
found=`expr $ICU_VERSION \>= $1`
if test "$found" = "1" ; then
AC_MSG_RESULT(yes)
ok=yes
AC_MSG_CHECKING(ICU_LIBS)
ICU_LIBS=`$ICU_CONFIG --ldflags-libsonly`
AC_MSG_RESULT($ICU_LIBS)
AC_MSG_CHECKING(ICU_LDFLAGS)
ICU_LDFLAGS=`$ICU_CONFIG --ldflags-searchpath`
AC_MSG_RESULT($ICU_LDFLAGS)
else
ICU_LIBS=""
ICU_LDFLAGS=""
## Either perform custom action or print error message
ifelse([$3], ,echo "can't find ICU >= $1 (got $ICU_VERSION)",)
fi
AC_SUBST(ICU_LIBS)
fi
if test $ok = yes; then
ifelse([$2], , :, [$2])
else
ifelse([$3], , AC_MSG_ERROR([Library requirements (ICU) not met.]), [$3])
fi
])

View file

@ -70,7 +70,6 @@ builtin(include, config/pathxml.m4)dnl
builtin(include, config/pathtls.m4)dnl
builtin(include, config/codeset.m4)dnl
builtin(include, config/addlibrarypath.m4)dnl
builtin(include, config/icu.m4)dnl
builtin(include, config/pkg.m4)dnl
AC_INIT
@ -3336,50 +3335,11 @@ AC_ARG_ENABLE(icu,
[ --disable-icu Disable International Components for Unicode],,
enable_icu=yes)
AC_ARG_ENABLE(icu-config,
[ --disable-icu-config Do not use the icu-config script to check
for ICU.],,
enable_icu_config=yes)
AC_ARG_WITH(icu-library,
[ --with-icu-library=PATH library path for ICU libraries (only checked
if not using icu-config)],
icu_libdir="$withval", icu_libdir="no")
if test $enable_icu = yes; then
if test "$enable_icu_config" = "yes"; then
AC_CHECK_ICU(50, have_icu=yes, have_icu=no)
else
have_icu=no;
AC_CHECKING([for libicu (icu-config disabled)])
if test "$icu_libdir" != "no"; then
ICU_LDFLAGS="-L$icu_libdir";
fi
saved_LDFLAGS="$LDFLAGS";
LDFLAGS="$LDFLAGS $LIBS $ICU_LDFLAGS -licui18n -licuuc -licudata -lm"
AC_TRY_LINK([],[], have_icu="yes", have_icu="no");
AC_CHECK_DECL([UDAT_PATTERN], [have_icu=yes], [have_icu=no],
[#include <unicode/udat.h>])
LDFLAGS="$saved_LDFLAGS";
ICU_LIBS="-licui18n -licuuc -licudata -lm"
fi
if test "$have_icu" = "yes"; then
AC_MSG_RESULT(yes)
AC_CHECK_HEADERS(unicode/uloc.h unicode/ulocdata.h unicode/ucol.h unicode/ucurr.h unicode/uregex.h unicode/ucal.h unicode/unorm2.h unicode/unum.h unicode/udat.h unicode/udatpg.h unicode/ustring.h unicode/usearch.h unicode/ucnv.h)
LIBS="$LIBS $ICU_LIBS"
LDFLAGS="$LDFLAGS $ICU_LDFLAGS"
LDIR_FLAGS="$LDIR_FLAGS $ICU_LDFLAGS"
HAVE_ICU=1
else
AC_MSG_RESULT(no)
echo
echo "You do not appear to have usable ICU headers/libraries."
echo "Building without them will disable major functionality."
echo "If you really want to build gnustep-base without ICU,"
echo "add --disable-icu to the configure arguments."
AC_MSG_ERROR([Missing support for International Components for Unicode (ICU).])
fi
if test "$enable_icu" = "yes"; then
PKG_CHECK_MODULES([ICU], [icu-i18n > 4.6])
AC_CHECK_HEADERS(unicode/uloc.h unicode/ulocdata.h unicode/ucol.h unicode/ucurr.h unicode/uregex.h unicode/ucal.h unicode/unorm2.h unicode/unum.h unicode/udat.h unicode/udatpg.h unicode/ustring.h unicode/usearch.h unicode/ucnv.h)
LIBS="$LIBS $ICU_LIBS"
HAVE_ICU=1
fi
AC_SUBST(HAVE_ICU)