xref: /PHP-8.3/ext/intl/config.m4 (revision 4e21a26d)
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, php_intl.c \
11    intl_error.c \
12    intl_convert.c \
13    collator/collator_class.c \
14    collator/collator_sort.c \
15    collator/collator_convert.c \
16    collator/collator_locale.c \
17    collator/collator_compare.c \
18    collator/collator_attr.c \
19    collator/collator_create.c \
20    collator/collator_is_numeric.c \
21    collator/collator_error.c \
22    common/common_error.c \
23    converter/converter.c \
24    formatter/formatter_main.c \
25    formatter/formatter_class.c \
26    formatter/formatter_attr.c \
27    formatter/formatter_data.c \
28    formatter/formatter_format.c \
29    formatter/formatter_parse.c \
30    normalizer/normalizer_class.c \
31    normalizer/normalizer_normalize.c \
32    locale/locale.c \
33    locale/locale_class.c \
34    locale/locale_methods.c \
35    dateformat/dateformat.c \
36    dateformat/dateformat_class.c \
37    dateformat/dateformat_attr.c \
38    dateformat/dateformat_data.c \
39    dateformat/dateformat_format.c \
40    dateformat/dateformat_parse.c \
41    msgformat/msgformat.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    grapheme/grapheme_string.c \
48    grapheme/grapheme_util.c \
49    resourcebundle/resourcebundle.c \
50    resourcebundle/resourcebundle_class.c \
51    resourcebundle/resourcebundle_iterator.c \
52    transliterator/transliterator_class.c \
53    transliterator/transliterator_methods.c \
54    uchar/uchar.c \
55    idn/idn.c \
56    spoofchecker/spoofchecker_class.c \
57    spoofchecker/spoofchecker_create.c\
58    spoofchecker/spoofchecker_main.c, $ext_shared,,$INTL_COMMON_FLAGS,cxx)
59
60  PHP_INTL_CXX_SOURCES="intl_convertcpp.cpp \
61    common/common_enum.cpp \
62    common/common_date.cpp \
63    dateformat/dateformat_format_object.cpp \
64    dateformat/dateformat_create.cpp \
65    dateformat/dateformat_attrcpp.cpp \
66    dateformat/dateformat_helpers.cpp \
67    dateformat/datepatterngenerator_class.cpp \
68    dateformat/datepatterngenerator_methods.cpp \
69    msgformat/msgformat_helpers.cpp \
70    timezone/timezone_class.cpp \
71    timezone/timezone_methods.cpp \
72    calendar/calendar_class.cpp \
73    calendar/calendar_methods.cpp \
74    calendar/gregoriancalendar_methods.cpp \
75    breakiterator/breakiterator_class.cpp \
76    breakiterator/breakiterator_iterators.cpp \
77    breakiterator/breakiterator_methods.cpp \
78    breakiterator/rulebasedbreakiterator_methods.cpp \
79    breakiterator/codepointiterator_internal.cpp \
80    breakiterator/codepointiterator_methods.cpp"
81
82  PHP_REQUIRE_CXX()
83
84  AC_MSG_CHECKING([if intl requires -std=gnu++17])
85  AS_IF([$PKG_CONFIG icu-uc --atleast-version=74],[
86    AC_MSG_RESULT([yes])
87    PHP_CXX_COMPILE_STDCXX(17, mandatory, PHP_INTL_STDCXX)
88  ],[
89    AC_MSG_RESULT([no])
90    PHP_CXX_COMPILE_STDCXX(11, mandatory, PHP_INTL_STDCXX)
91  ])
92
93  PHP_INTL_CXX_FLAGS="$INTL_COMMON_FLAGS $PHP_INTL_STDCXX $ICU_CXXFLAGS"
94  case $host_alias in
95  *cygwin*) PHP_INTL_CXX_FLAGS="$PHP_INTL_CXX_FLAGS -D_POSIX_C_SOURCE=200809L"
96  esac
97  if test "$ext_shared" = "no"; then
98    PHP_ADD_SOURCES(PHP_EXT_DIR(intl), $PHP_INTL_CXX_SOURCES, $PHP_INTL_CXX_FLAGS)
99  else
100    PHP_ADD_SOURCES_X(PHP_EXT_DIR(intl), $PHP_INTL_CXX_SOURCES, $PHP_INTL_CXX_FLAGS, shared_objects_intl, yes)
101  fi
102
103  PHP_ADD_BUILD_DIR($ext_builddir/collator)
104  PHP_ADD_BUILD_DIR($ext_builddir/converter)
105  PHP_ADD_BUILD_DIR($ext_builddir/common)
106  PHP_ADD_BUILD_DIR($ext_builddir/formatter)
107  PHP_ADD_BUILD_DIR($ext_builddir/normalizer)
108  PHP_ADD_BUILD_DIR($ext_builddir/dateformat)
109  PHP_ADD_BUILD_DIR($ext_builddir/locale)
110  PHP_ADD_BUILD_DIR($ext_builddir/msgformat)
111  PHP_ADD_BUILD_DIR($ext_builddir/grapheme)
112  PHP_ADD_BUILD_DIR($ext_builddir/resourcebundle)
113  PHP_ADD_BUILD_DIR($ext_builddir/transliterator)
114  PHP_ADD_BUILD_DIR($ext_builddir/timezone)
115  PHP_ADD_BUILD_DIR($ext_builddir/calendar)
116  PHP_ADD_BUILD_DIR($ext_builddir/idn)
117  PHP_ADD_BUILD_DIR($ext_builddir/spoofchecker)
118  PHP_ADD_BUILD_DIR($ext_builddir/breakiterator)
119  PHP_ADD_BUILD_DIR($ext_builddir/uchar)
120fi
121