1// vim:ft=javascript
2
3ARG_ENABLE("intl", "Enable internationalization support", "no");
4
5if (PHP_INTL != "no") {
6	if (CHECK_LIB("icuuc.lib", "intl", PHP_INTL) &&
7					CHECK_HEADER_ADD_INCLUDE("unicode/utf.h", "CFLAGS_INTL")) {
8		// always build as shared - zend_strtod.c/ICU type conflict
9		EXTENSION("intl", "php_intl.c intl_convert.c intl_convertcpp.cpp intl_error.c ", true,
10								"/I \"" + configure_module_dirname + "\" /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
11		ADD_SOURCES(configure_module_dirname + "/collator", "\
12				collator.c \
13				collator_attr.c \
14				collator_class.c \
15				collator_compare.c \
16				collator_convert.c \
17				collator_create.c \
18				collator_error.c \
19				collator_is_numeric.c \
20				collator_locale.c \
21				collator_sort.c \
22				", "intl");
23		ADD_SOURCES(configure_module_dirname + "/common", "\
24				common_error.c \
25				common_enum.cpp \
26				common_date.cpp \
27				", "intl");
28		ADD_SOURCES(configure_module_dirname + "/converter", "\
29				converter.c \
30				", "intl");
31		ADD_SOURCES(configure_module_dirname + "/formatter", "\
32				formatter.c \
33				formatter_attr.c \
34				formatter_class.c \
35				formatter_data.c \
36				formatter_format.c \
37				formatter_main.c \
38				formatter_parse.c \
39				", "intl");
40		ADD_SOURCES(configure_module_dirname + "/locale", "\
41				locale.c \
42				locale_class.c \
43				locale_methods.c \
44				", "intl");
45		ADD_SOURCES(configure_module_dirname + "/msgformat", "\
46				msgformat.c \
47				msgformat_attr.c \
48				msgformat_class.c \
49				msgformat_data.c \
50				msgformat_format.c \
51				msgformat_helpers.cpp \
52				msgformat_parse.c \
53				", "intl");
54		ADD_SOURCES(configure_module_dirname + "/grapheme", "\
55                                grapheme_string.c grapheme_util.c  \
56                                ", "intl");
57		ADD_SOURCES(configure_module_dirname + "/normalizer", "\
58				normalizer.c \
59				normalizer_class.c \
60				normalizer_normalize.c \
61				", "intl");
62		ADD_SOURCES(configure_module_dirname + "/dateformat", "\
63				dateformat.c \
64				dateformat_class.c \
65				dateformat_attr.c \
66				dateformat_format.c \
67				dateformat_format_object.cpp \
68				dateformat_parse.c \
69				dateformat_data.c \
70				dateformat_attrcpp.cpp \
71				dateformat_helpers.cpp \
72				dateformat_create.cpp \
73				", "intl");
74		ADD_SOURCES(configure_module_dirname + "/uchar", "\
75				uchar.c",
76				"intl");
77		ADD_SOURCES(configure_module_dirname + "/idn", "\
78				idn.c",
79				"intl");
80		ADD_SOURCES(configure_module_dirname + "/resourcebundle", "\
81				resourcebundle.c \
82				resourcebundle_class.c \
83				resourcebundle_iterator.c",
84				"intl");
85
86		if (CHECK_HEADER_ADD_INCLUDE("unicode/uspoof.h", "CFLAGS_INTL")) {
87			ADD_SOURCES(configure_module_dirname + "/spoofchecker", "\
88					spoofchecker.c \
89					spoofchecker_class.c \
90					spoofchecker_create.c \
91					spoofchecker_main.c",
92					"intl");
93		}
94
95		ADD_SOURCES(configure_module_dirname + "/transliterator", "\
96				transliterator.c \
97				transliterator_class.c \
98				transliterator_methods.c",
99				"intl");
100
101		ADD_SOURCES(configure_module_dirname + "/timezone", "\
102				timezone_class.cpp \
103				timezone_methods.cpp",
104				"intl");
105
106		ADD_SOURCES(configure_module_dirname + "/calendar", "\
107				calendar_methods.cpp \
108				gregoriancalendar_methods.cpp \
109				calendar_class.cpp",
110				"intl");
111
112		ADD_SOURCES(configure_module_dirname + "/breakiterator", "\
113				breakiterator_class.cpp \
114				breakiterator_methods.cpp \
115				breakiterator_iterators.cpp \
116				rulebasedbreakiterator_methods.cpp \
117				codepointiterator_internal.cpp \
118				codepointiterator_methods.cpp ",
119				"intl");
120
121		ADD_FLAG("LIBS_INTL", "icudt.lib icuin.lib icuio.lib");
122
123		/* Compat for ICU before 58.1.*/
124		if (CHECK_LIB("icule.lib", "intl", PHP_INTL)) {
125			ADD_FLAG("LIBS_INTL", "icule.lib");
126		}
127		if (CHECK_LIB("iculx.lib", "intl", PHP_INTL)) {
128			ADD_FLAG("LIBS_INTL", "iculx.lib");
129		}
130
131		ADD_FLAG("CFLAGS_INTL", "/EHsc /DUNISTR_FROM_CHAR_EXPLICIT=explicit /DUNISTR_FROM_STRING_EXPLICIT=explicit /DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 /DU_HIDE_OBSOLETE_UTF_OLD_H=1");
132		AC_DEFINE("HAVE_INTL", 1, "Internationalization support enabled");
133	} else {
134		WARNING("intl not enabled; libraries and/or headers not found");
135	}
136}
137