Skip to content

Commit d03537b

Browse files
committed
Based on the following upstream commits:
php/php-src@9a8e7b5 php/php-src#3701 php/php-src@2bd299f
1 parent d7a69f1 commit d03537b

File tree

2 files changed

+31
-59
lines changed

2 files changed

+31
-59
lines changed

acinclude.m4

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,49 +2201,16 @@ dnl
22012201
dnl Common setup macro for ICU
22022202
dnl
22032203
AC_DEFUN([PHP_SETUP_ICU],[
2204-
PHP_ARG_WITH(icu-dir,,
2205-
[ --with-icu-dir=DIR Specify where ICU libraries and headers can be found], DEFAULT, no)
2204+
PKG_CHECK_MODULES([ICU], [icu-io >= 50.1])
22062205
2207-
if test "$PHP_ICU_DIR" = "no"; then
2208-
PHP_ICU_DIR=DEFAULT
2209-
fi
2210-
2211-
if test "$PHP_ICU_DIR" = "DEFAULT"; then
2212-
dnl Try to find icu-config
2213-
AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
2214-
else
2215-
ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config"
2216-
fi
2217-
2218-
AC_MSG_CHECKING([for location of ICU headers and libraries])
2219-
2220-
dnl Trust icu-config to know better what the install prefix is..
2221-
icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null`
2222-
if test "$?" != "0" || test -z "$icu_install_prefix"; then
2223-
AC_MSG_RESULT([not found])
2224-
AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.])
2225-
else
2226-
AC_MSG_RESULT([$icu_install_prefix])
2227-
2228-
dnl Check ICU version
2229-
AC_MSG_CHECKING([for ICU 4.0 or greater])
2230-
icu_version_full=`$ICU_CONFIG --version`
2231-
ac_IFS=$IFS
2232-
IFS="."
2233-
set $icu_version_full
2234-
IFS=$ac_IFS
2235-
icu_version=`expr [$]1 \* 1000 + [$]2`
2236-
AC_MSG_RESULT([found $icu_version_full])
2206+
PHP_EVAL_INCLINE($ICU_CFLAGS)
2207+
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
22372208
2238-
if test "$icu_version" -lt "4000"; then
2239-
AC_MSG_ERROR([ICU version 4.0 or later is required])
2240-
fi
2209+
ICU_CFLAGS="$ICU_CFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
2210+
ICU_CXXFLAGS="$ICU_CXXFLAGS -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit"
22412211
2242-
ICU_VERSION=$icu_version
2243-
ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
2244-
ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
2245-
PHP_EVAL_INCLINE($ICU_INCS)
2246-
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
2212+
if test "$PKG_CONFIG icu-io --atleast-version=60"; then
2213+
ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"
22472214
fi
22482215
])
22492216

ext/intl/config.m4

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,10 @@ if test "$PHP_INTL" != "no"; then
99
PHP_SETUP_ICU(INTL_SHARED_LIBADD)
1010
PHP_SUBST(INTL_SHARED_LIBADD)
1111
PHP_REQUIRE_CXX()
12-
if test "$icu_version" -ge "4002"; then
13-
icu_spoof_src=" spoofchecker/spoofchecker_class.c \
14-
spoofchecker/spoofchecker.c\
15-
spoofchecker/spoofchecker_create.c\
16-
spoofchecker/spoofchecker_main.c"
17-
else
18-
icu_spoof_src=""
19-
fi
12+
INTL_COMMON_FLAGS="$ICU_CFLAGS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
2013
PHP_NEW_EXTENSION(intl, php_intl.c \
2114
intl_error.c \
2215
intl_convert.c \
23-
intl_convertcpp.cpp \
2416
collator/collator.c \
2517
collator/collator_class.c \
2618
collator/collator_sort.c \
@@ -32,8 +24,6 @@ if test "$PHP_INTL" != "no"; then
3224
collator/collator_is_numeric.c \
3325
collator/collator_error.c \
3426
common/common_error.c \
35-
common/common_enum.cpp \
36-
common/common_date.cpp \
3727
converter/converter.c \
3828
formatter/formatter.c \
3929
formatter/formatter_main.c \
@@ -53,17 +43,12 @@ if test "$PHP_INTL" != "no"; then
5343
dateformat/dateformat_attr.c \
5444
dateformat/dateformat_data.c \
5545
dateformat/dateformat_format.c \
56-
dateformat/dateformat_format_object.cpp \
5746
dateformat/dateformat_parse.c \
58-
dateformat/dateformat_create.cpp \
59-
dateformat/dateformat_attrcpp.cpp \
60-
dateformat/dateformat_helpers.cpp \
6147
msgformat/msgformat.c \
6248
msgformat/msgformat_attr.c \
6349
msgformat/msgformat_class.c \
6450
msgformat/msgformat_data.c \
6551
msgformat/msgformat_format.c \
66-
msgformat/msgformat_helpers.cpp \
6752
msgformat/msgformat_parse.c \
6853
grapheme/grapheme_string.c \
6954
grapheme/grapheme_util.c \
@@ -73,6 +58,20 @@ if test "$PHP_INTL" != "no"; then
7358
transliterator/transliterator.c \
7459
transliterator/transliterator_class.c \
7560
transliterator/transliterator_methods.c \
61+
idn/idn.c \
62+
spoofchecker/spoofchecker_class.c \
63+
spoofchecker/spoofchecker.c\
64+
spoofchecker/spoofchecker_create.c\
65+
spoofchecker/spoofchecker_main.c, $ext_shared,,$INTL_COMMON_FLAGS,cxx)
66+
67+
PHP_INTL_CPP_SOURCES="intl_convertcpp.cpp \
68+
common/common_enum.cpp \
69+
common/common_date.cpp \
70+
dateformat/dateformat_format_object.cpp \
71+
dateformat/dateformat_create.cpp \
72+
dateformat/dateformat_attrcpp.cpp \
73+
dateformat/dateformat_helpers.cpp \
74+
msgformat/msgformat_helpers.cpp \
7675
timezone/timezone_class.cpp \
7776
timezone/timezone_methods.cpp \
7877
calendar/calendar_class.cpp \
@@ -83,9 +82,15 @@ if test "$PHP_INTL" != "no"; then
8382
breakiterator/breakiterator_methods.cpp \
8483
breakiterator/rulebasedbreakiterator_methods.cpp \
8584
breakiterator/codepointiterator_internal.cpp \
86-
breakiterator/codepointiterator_methods.cpp \
87-
idn/idn.c \
88-
$icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings)
85+
breakiterator/codepointiterator_methods.cpp"
86+
87+
PHP_INTL_CPP_FLAGS="$ICU_CXXFLAGS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
88+
if test "$ext_shared" = "no"; then
89+
PHP_ADD_SOURCES(PHP_EXT_DIR(intl), $PHP_INTL_CPP_SOURCES, $PHP_INTL_CPP_FLAGS)
90+
else
91+
PHP_ADD_SOURCES_X(PHP_EXT_DIR(intl), $PHP_INTL_CPP_SOURCES, $PHP_INTL_CPP_FLAGS, shared_objects_intl, yes)
92+
fi
93+
8994
PHP_ADD_BUILD_DIR($ext_builddir/collator)
9095
PHP_ADD_BUILD_DIR($ext_builddir/converter)
9196
PHP_ADD_BUILD_DIR($ext_builddir/common)

0 commit comments

Comments
 (0)