From f4f41baf29c6835dca58e3aa22c56e9e7c7754de Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 5 Aug 2017 11:47:28 -0400 Subject: [PATCH] Improve configure's check for ICU presence. Without ICU's header files, "configure --with-icu" would succeed anyway, at least when using the non-pkgconfig-based setup. Then you got a bunch of ugly failures at build. Add an explicit header check to tighten that up. --- configure | 23 +++++++++++++++++------ configure.in | 17 +++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 8b24bf1128..e63496f591 100755 --- a/configure +++ b/configure @@ -13910,17 +13910,27 @@ done if test "$with_icu" = yes; then - # ICU functions are macros, so we need to do this the long way. + ac_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$ICU_CFLAGS $CPPFLAGS" - # ucol_strcollUTF8() appeared in ICU 50. + # Verify we have ICU's header files + ac_fn_c_check_header_mongrel "$LINENO" "unicode/ucol.h" "ac_cv_header_unicode_ucol_h" "$ac_includes_default" +if test "x$ac_cv_header_unicode_ucol_h" = xyes; then : + +else + as_fn_error $? "header file is required for ICU" "$LINENO" 5 +fi + + + + # ucol_strcollUTF8() appeared in ICU 50, so check if we have it. + # ICU functions are macros, so we need to do this the long way. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ucol_strcollUTF8" >&5 $as_echo_n "checking for ucol_strcollUTF8... " >&6; } if ${pgac_cv_func_ucol_strcollUTF8+:} false; then : $as_echo_n "(cached) " >&6 else - ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$ICU_CFLAGS $CPPFLAGS" -ac_save_LIBS=$LIBS + ac_save_LIBS=$LIBS LIBS="$ICU_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -13941,7 +13951,6 @@ else fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -CPPFLAGS=$ac_save_CPPFLAGS LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_func_ucol_strcollUTF8" >&5 @@ -13951,6 +13960,8 @@ $as_echo "$pgac_cv_func_ucol_strcollUTF8" >&6; } $as_echo "#define HAVE_UCOL_STRCOLLUTF8 1" >>confdefs.h fi + + CPPFLAGS=$ac_save_CPPFLAGS fi # Lastly, restore full LIBS list and check for readline/libedit symbols diff --git a/configure.in b/configure.in index a0f0f85add..99480d695c 100644 --- a/configure.in +++ b/configure.in @@ -1655,13 +1655,17 @@ AC_CHECK_FUNCS([strtoll strtoq], [break]) AC_CHECK_FUNCS([strtoull strtouq], [break]) if test "$with_icu" = yes; then - # ICU functions are macros, so we need to do this the long way. + ac_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$ICU_CFLAGS $CPPFLAGS" - # ucol_strcollUTF8() appeared in ICU 50. + # Verify we have ICU's header files + AC_CHECK_HEADER(unicode/ucol.h, [], + [AC_MSG_ERROR([header file is required for ICU])]) + + # ucol_strcollUTF8() appeared in ICU 50, so check if we have it. + # ICU functions are macros, so we need to do this the long way. AC_CACHE_CHECK([for ucol_strcollUTF8], [pgac_cv_func_ucol_strcollUTF8], -[ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$ICU_CFLAGS $CPPFLAGS" -ac_save_LIBS=$LIBS +[ac_save_LIBS=$LIBS LIBS="$ICU_LIBS $LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM( [#include @@ -1669,11 +1673,12 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM( [ucol_strcollUTF8(NULL, NULL, 0, NULL, 0, NULL);])], [pgac_cv_func_ucol_strcollUTF8=yes], [pgac_cv_func_ucol_strcollUTF8=no]) -CPPFLAGS=$ac_save_CPPFLAGS LIBS=$ac_save_LIBS]) if test "$pgac_cv_func_ucol_strcollUTF8" = yes ; then AC_DEFINE([HAVE_UCOL_STRCOLLUTF8], 1, [Define to 1 if you have the `ucol_strcollUTF8' function.]) fi + + CPPFLAGS=$ac_save_CPPFLAGS fi # Lastly, restore full LIBS list and check for readline/libedit symbols