xref: /php-src/ext/intl/config.m4 (revision fbacc0f9)
1PHP_ARG_ENABLE([intl],
2  [whether to enable internationalization support],
3  [AS_HELP_STRING([--enable-intl],
4    [Enable internationalization support])])
5
6if test "$PHP_INTL" != "no"; then
7  PHP_SETUP_ICU([INTL_SHARED_LIBADD])
8  PHP_SUBST([INTL_SHARED_LIBADD])
9  INTL_COMMON_FLAGS="$ICU_CFLAGS -Wno-write-strings -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
10  PHP_NEW_EXTENSION([intl], m4_normalize([
11      collator/collator_attr.c
12      collator/collator_class.c
13      collator/collator_compare.c
14      collator/collator_convert.c
15      collator/collator_create.c
16      collator/collator_error.c
17      collator/collator_is_numeric.c
18      collator/collator_locale.c
19      collator/collator_sort.c
20      common/common_error.c
21      converter/converter.c
22      dateformat/dateformat_attr.c
23      dateformat/dateformat_class.c
24      dateformat/dateformat_data.c
25      dateformat/dateformat_format.c
26      dateformat/dateformat_parse.c
27      dateformat/dateformat.c
28      formatter/formatter_attr.c
29      formatter/formatter_class.c
30      formatter/formatter_data.c
31      formatter/formatter_format.c
32      formatter/formatter_main.c
33      formatter/formatter_parse.c
34      grapheme/grapheme_string.c
35      grapheme/grapheme_util.c
36      idn/idn.c
37      intl_convert.c
38      intl_error.c
39      locale/locale_class.c
40      locale/locale_methods.c
41      locale/locale.c
42      msgformat/msgformat_attr.c
43      msgformat/msgformat_class.c
44      msgformat/msgformat_data.c
45      msgformat/msgformat_format.c
46      msgformat/msgformat_parse.c
47      msgformat/msgformat.c
48      normalizer/normalizer_class.c
49      normalizer/normalizer_normalize.c
50      php_intl.c
51      resourcebundle/resourcebundle_class.c
52      resourcebundle/resourcebundle_iterator.c
53      resourcebundle/resourcebundle.c
54      spoofchecker/spoofchecker_class.c
55      spoofchecker/spoofchecker_create.c
56      spoofchecker/spoofchecker_main.c
57      transliterator/transliterator_class.c
58      transliterator/transliterator_methods.c
59      uchar/uchar.c
60    ]),
61    [$ext_shared],,
62    [$INTL_COMMON_FLAGS],
63    [cxx])
64
65  PHP_INTL_CXX_SOURCES="intl_convertcpp.cpp \
66    common/common_enum.cpp \
67    common/common_date.cpp \
68    dateformat/dateformat_format_object.cpp \
69    dateformat/dateformat_create.cpp \
70    dateformat/dateformat_attrcpp.cpp \
71    dateformat/dateformat_helpers.cpp \
72    dateformat/datepatterngenerator_class.cpp \
73    dateformat/datepatterngenerator_methods.cpp \
74    msgformat/msgformat_helpers.cpp \
75    timezone/timezone_class.cpp \
76    timezone/timezone_methods.cpp \
77    calendar/calendar_class.cpp \
78    calendar/calendar_methods.cpp \
79    calendar/gregoriancalendar_methods.cpp \
80    breakiterator/breakiterator_class.cpp \
81    breakiterator/breakiterator_iterators.cpp \
82    breakiterator/breakiterator_methods.cpp \
83    breakiterator/rulebasedbreakiterator_methods.cpp \
84    breakiterator/codepointiterator_internal.cpp \
85    breakiterator/codepointiterator_methods.cpp"
86
87  PHP_REQUIRE_CXX()
88
89  AC_MSG_CHECKING([if intl requires -std=gnu++17])
90  AS_IF([$PKG_CONFIG icu-uc --atleast-version=74],[
91    AC_MSG_RESULT([yes])
92    PHP_CXX_COMPILE_STDCXX([17], [mandatory], [PHP_INTL_STDCXX])
93  ],[
94    AC_MSG_RESULT([no])
95    PHP_CXX_COMPILE_STDCXX([11], [mandatory], [PHP_INTL_STDCXX])
96  ])
97
98  PHP_INTL_CXX_FLAGS="$INTL_COMMON_FLAGS $PHP_INTL_STDCXX $ICU_CXXFLAGS"
99  AS_CASE([$host_alias], [*cygwin*],
100    [PHP_INTL_CXX_FLAGS="$PHP_INTL_CXX_FLAGS -D_POSIX_C_SOURCE=200809L"])
101  AS_VAR_IF([ext_shared], [no],
102    [PHP_ADD_SOURCES([$ext_dir],
103      [$PHP_INTL_CXX_SOURCES],
104      [$PHP_INTL_CXX_FLAGS])],
105    [PHP_ADD_SOURCES_X([$ext_dir],
106      [$PHP_INTL_CXX_SOURCES],
107      [$PHP_INTL_CXX_FLAGS],
108      [shared_objects_intl],
109      [yes])])
110
111  PHP_ADD_BUILD_DIR([
112    $ext_builddir/breakiterator
113    $ext_builddir/calendar
114    $ext_builddir/collator
115    $ext_builddir/common
116    $ext_builddir/converter
117    $ext_builddir/dateformat
118    $ext_builddir/formatter
119    $ext_builddir/grapheme
120    $ext_builddir/idn
121    $ext_builddir/locale
122    $ext_builddir/msgformat
123    $ext_builddir/normalizer
124    $ext_builddir/resourcebundle
125    $ext_builddir/spoofchecker
126    $ext_builddir/timezone
127    $ext_builddir/transliterator
128    $ext_builddir/uchar
129  ])
130
131  PHP_ADD_EXTENSION_DEP(intl, date)
132fi
133