Skip to content

Commit 71f5af6

Browse files
committed
- fix build with ICU < 4.2, add ICU_VERSION for m4 checks
1 parent b58c6f5 commit 71f5af6

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

acinclude.m4

+1
Original file line numberDiff line numberDiff line change
@@ -2243,6 +2243,7 @@ AC_DEFUN([PHP_SETUP_ICU],[
22432243
AC_MSG_ERROR([ICU version 3.4 or later is required])
22442244
fi
22452245
2246+
ICU_VERSION=$icu_version
22462247
ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
22472248
ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
22482249
PHP_EVAL_INCLINE($ICU_INCS)

ext/intl/config.m4

+9-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ if test "$PHP_INTL" != "no"; then
99
PHP_SETUP_ICU(INTL_SHARED_LIBADD)
1010
PHP_SUBST(INTL_SHARED_LIBADD)
1111
PHP_REQUIRE_CXX()
12-
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
1320
PHP_NEW_EXTENSION(intl, php_intl.c \
1421
intl_error.c \
1522
intl_convert.c \
@@ -59,11 +66,7 @@ if test "$PHP_INTL" != "no"; then
5966
transliterator/transliterator_class.c \
6067
transliterator/transliterator_methods.c \
6168
idn/idn.c \
62-
spoofchecker/spoofchecker_class.c \
63-
spoofchecker/spoofchecker.c\
64-
spoofchecker/spoofchecker_create.c\
65-
spoofchecker/spoofchecker_main.c, $ext_shared,,$ICU_INCS)
66-
69+
$icu_spoof_src, $ext_shared,,$ICU_INCS)
6770
PHP_ADD_BUILD_DIR($ext_builddir/collator)
6871
PHP_ADD_BUILD_DIR($ext_builddir/common)
6972
PHP_ADD_BUILD_DIR($ext_builddir/formatter)

ext/intl/php_intl.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@
7070

7171
#include "idn/idn.h"
7272

73-
#include "spoofchecker/spoofchecker_class.h"
74-
#include "spoofchecker/spoofchecker.h"
75-
#include "spoofchecker/spoofchecker_create.h"
76-
#include "spoofchecker/spoofchecker_main.h"
73+
#if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2
74+
# include "spoofchecker/spoofchecker_class.h"
75+
# include "spoofchecker/spoofchecker.h"
76+
# include "spoofchecker/spoofchecker_create.h"
77+
# include "spoofchecker/spoofchecker_main.h"
78+
#endif
7779

7880
#include "msgformat/msgformat.h"
7981
#include "common/common_error.h"
@@ -638,12 +640,13 @@ PHP_MINIT_FUNCTION( intl )
638640
/* Expose IDN constants to PHP scripts. */
639641
idn_register_constants(INIT_FUNC_ARGS_PASSTHRU);
640642

643+
#if U_ICU_VERSION_MAJOR_NUM > 3 && U_ICU_VERSION_MINOR_NUM >=2
641644
/* Register 'Spoofchecker' PHP class */
642645
spoofchecker_register_Spoofchecker_class( TSRMLS_C );
643646

644647
/* Expose Spoofchecker constants to PHP scripts */
645648
spoofchecker_register_constants( INIT_FUNC_ARGS_PASSTHRU );
646-
649+
#endif
647650
/* Global error handling. */
648651
intl_error_init( NULL TSRMLS_CC );
649652

0 commit comments

Comments
 (0)