Skip to content

Commit

Permalink
Enable using Windows 10 ICU DLL for all Windows toolchains
Browse files Browse the repository at this point in the history
Also fixes logic error in configure when ICU was not found.
  • Loading branch information
triplef committed Aug 3, 2021
1 parent 2d3cb4b commit 0fb8770
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 83 deletions.
138 changes: 69 additions & 69 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -5413,10 +5413,72 @@ $as_echo "no" >&6; }
fi
if test x"$with_icu" != xno; then :
case "$target_os" in
mingw*|windows)
# check for ICU bundled with Windows 10
for ac_header in icu.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "icu.h" "ac_cv_header_icu_h" "$ac_includes_default"
if test "x$ac_cv_header_icu_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_ICU_H 1
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for udat_open in -licu" >&5
$as_echo_n "checking for udat_open in -licu... " >&6; }
if ${ac_cv_lib_icu_udat_open+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-licu $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char udat_open ();
int
main ()
{
return udat_open ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_icu_udat_open=yes
else
ac_cv_lib_icu_udat_open=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_icu_udat_open" >&5
$as_echo "$ac_cv_lib_icu_udat_open" >&6; }
if test "x$ac_cv_lib_icu_udat_open" = xyes; then :
HAVE_ICU=1
fi
fi
done
if test $HAVE_ICU = 1; then
ICU_LIBS=-licu
{ $as_echo "$as_me:${as_lineno-$LINENO}: Using ICU DLL from Windows 10 (requires version 1903 or later)" >&5
$as_echo "$as_me: Using ICU DLL from Windows 10 (requires version 1903 or later)" >&6;}
fi
;;
esac
if test $HAVE_ICU = 0; then
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for icu-i18n > 49.0" >&5
$as_echo_n "checking for icu-i18n > 49.0... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ICU" >&5
$as_echo_n "checking for ICU... " >&6; }
if test -n "$ICU_CFLAGS"; then
pkg_cv_ICU_CFLAGS="$ICU_CFLAGS"
Expand Down Expand Up @@ -5456,7 +5518,7 @@ fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
Expand All @@ -5472,18 +5534,18 @@ fi
# Put the nasty error message in config.log where it belongs
echo "$ICU_PKG_ERRORS" >&5
HAVE_ICU=1
HAVE_ICU=0
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
HAVE_ICU=1
HAVE_ICU=0
else
ICU_CFLAGS=$pkg_cv_ICU_CFLAGS
ICU_LIBS=$pkg_cv_ICU_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
for ac_header in unicode/ucal.h unicode/uchar.h unicode/ucnv.h unicode/ucol.h unicode/ucurr.h unicode/udat.h unicode/udatpg.h unicode/uloc.h unicode/ulocdata.h unicode/unorm.h unicode/unorm2.h unicode/unum.h unicode/usearch.h unicode/uset.h unicode/ustring.h unicode/utrans.h
for ac_header in unicode/ucal.h unicode/uchar.h unicode/ucnv.h unicode/ucol.h unicode/ucurr.h unicode/udat.h unicode/udatpg.h unicode/uloc.h unicode/ulocdata.h unicode/unorm.h unicode/unorm2.h unicode/unum.h unicode/usearch.h unicode/uset.h unicode/ustring.h unicode/utrans.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
Expand All @@ -5497,68 +5559,6 @@ fi
done
fi
if test $HAVE_ICU = 0; then
case "$target_os" in
windows)
# With MSVC we can use ICU bundled with Windows 10
for ac_header in icu.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "icu.h" "ac_cv_header_icu_h" "$ac_includes_default"
if test "x$ac_cv_header_icu_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_ICU_H 1
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for udat_open in -licu" >&5
$as_echo_n "checking for udat_open in -licu... " >&6; }
if ${ac_cv_lib_icu_udat_open+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-licu $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char udat_open ();
int
main ()
{
return udat_open ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_icu_udat_open=yes
else
ac_cv_lib_icu_udat_open=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_icu_udat_open" >&5
$as_echo "$ac_cv_lib_icu_udat_open" >&6; }
if test "x$ac_cv_lib_icu_udat_open" = xyes; then :
HAVE_ICU=1
fi
fi
done
if test $HAVE_ICU = 1; then
ICU_LIBS=-licu
{ $as_echo "$as_me:${as_lineno-$LINENO}: Using ICU DLL from Windows 10 (requires version 1903)" >&5
$as_echo "$as_me: Using ICU DLL from Windows 10 (requires version 1903)" >&6;}
fi
;;
esac
fi
if test $HAVE_ICU = 0; then
as_fn_error $? "No useable ICU installation found" "$LINENO" 5
Expand Down
28 changes: 14 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,21 @@ AC_ARG_WITH([icu],
AS_HELP_STRING([--without-icu],
[Disable Internation Components for Unicode. WARNING: Many components will stop working without ICU support!]), [], [with_icu=yes])
AS_IF([test x"$with_icu" != xno], [
PKG_CHECK_MODULES([ICU], [icu-i18n > 49.0], [
AC_CHECK_HEADERS([unicode/ucal.h unicode/uchar.h unicode/ucnv.h unicode/ucol.h unicode/ucurr.h unicode/udat.h unicode/udatpg.h unicode/uloc.h unicode/ulocdata.h unicode/unorm.h unicode/unorm2.h unicode/unum.h unicode/usearch.h unicode/uset.h unicode/ustring.h unicode/utrans.h ],
HAVE_ICU=1)], [HAVE_ICU=1])
case "$target_os" in
mingw*|windows)
# check for ICU bundled with Windows 10
AC_CHECK_HEADERS([icu.h],
AC_CHECK_LIB(icu, udat_open, HAVE_ICU=1))
if test $HAVE_ICU = 1; then
ICU_LIBS=-licu
AC_MSG_NOTICE([Using ICU DLL from Windows 10 (requires version 1903 or later)])
fi
;;
esac
if test $HAVE_ICU = 0; then
case "$target_os" in
windows)
# With MSVC we can use ICU bundled with Windows 10
AC_CHECK_HEADERS([icu.h],
AC_CHECK_LIB(icu, udat_open, HAVE_ICU=1))
if test $HAVE_ICU = 1; then
ICU_LIBS=-licu
AC_MSG_NOTICE([Using ICU DLL from Windows 10 (requires version 1903)])
fi
;;
esac
PKG_CHECK_MODULES([ICU], [icu-i18n > 49.0], [
AC_CHECK_HEADERS([unicode/ucal.h unicode/uchar.h unicode/ucnv.h unicode/ucol.h unicode/ucurr.h unicode/udat.h unicode/udatpg.h unicode/uloc.h unicode/ulocdata.h unicode/unorm.h unicode/unorm2.h unicode/unum.h unicode/usearch.h unicode/uset.h unicode/ustring.h unicode/utrans.h ],
HAVE_ICU=1)], [HAVE_ICU=0])
fi
if test $HAVE_ICU = 0; then
AC_MSG_ERROR([No useable ICU installation found])
Expand Down

0 comments on commit 0fb8770

Please sign in to comment.