Description: Use pkg-config to detect icu, as icu-config is deprecated and
 will be removed from Debian shortly
Bug: https://github.com/gnustep/libs-base/issues/31
Bug-Debian: https://bugs.debian.org/915714
Forwarded: https://github.com/gnustep/libs-base/pull/32
Author: Hugh McMaster <hugh.mcmaster@outlook.com>
Last-Update: 2019-01-01

--- a/configure.ac
+++ b/configure.ac
@@ -70,7 +70,6 @@
 builtin(include, config/pathtls.m4)dnl
 builtin(include, config/codeset.m4)dnl
 builtin(include, config/addlibrarypath.m4)dnl
-builtin(include, config/icu.m4)dnl
 
 AC_INIT
 AC_PREREQ([2.60])
@@ -3302,48 +3301,11 @@
   [  --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(4.6, 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");
-    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)
 
