1// $Id$ 2// vim:ft=javascript 3 4ARG_WITH("libmbfl", "use external libmbfl", "no"); 5ARG_ENABLE("mbstring", "multibyte string functions", "no"); 6ARG_ENABLE("mbregex", "multibyte regex support", "no"); 7ARG_ENABLE("mbregex-backtrack", "check multibyte regex backtrack", "yes"); 8 9if (PHP_MBSTRING != "no") { 10 11 EXTENSION("mbstring", "mbstring.c php_unicode.c mb_gpc.c", PHP_MBSTRING_SHARED); 12 13 FSO.CopyFile("ext\\mbstring\\oniguruma\\src\\oniguruma.h", 14 "ext\\mbstring\\oniguruma\\oniguruma.h", true); 15 16 if (PHP_LIBMBFL != "no" && 17 CHECK_HEADER_ADD_INCLUDE("mbfl/mbfilter.h", "CFLAGS_LIBMBFL", PHP_LIBMBFL + "\\include") && 18 CHECK_LIB("mbfl.lib", "libmbfl", PHP_LIBMBFL + "\\lib")) { 19 20 ADD_FLAG("LIBS_MBSTRING", get_define("LIBS_LIBMBFL")); 21 ADD_FLAG("LDFLAGS_MBSTRING", get_define("LDFLAGS_LIBMBFL")); 22 ADD_FLAG("CFLAGS_MBSTRING", get_define("CFLAGS_LIBMBFL") + 23 " /I ext/mbstring/oniguruma /D NOT_RUBY=1 \ 24 /D HAVE_STDARG_PROTOTYPES=1 /D HAVE_STDLIB_H \ 25 /D HAVE_STRICMP /D EXPORT /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); 26 27 PHP_INSTALL_HEADERS("ext/mbstring", "mbstring.h oniguruma/oniguruma.h php_mbregex.h php_onig_compat.h"); 28 } else { 29 STDOUT.WriteLine("Using bundled libmbfl..."); 30 31 ADD_FLAG("CFLAGS_MBSTRING", "-Iext/mbstring/libmbfl -Iext/mbstring/libmbfl/mbfl \ 32 -Iext/mbstring/oniguruma /D NOT_RUBY=1 /D LIBMBFL_EXPORTS=1 \ 33 /D HAVE_STDARG_PROTOTYPES=1 /D HAVE_CONFIG_H /D HAVE_STDLIB_H \ 34 /D HAVE_STRICMP /D MBFL_DLL_EXPORT=1 /D EXPORT /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1") 35 36 FSO.CopyFile("ext\\mbstring\\libmbfl\\config.h.w32", 37 "ext\\mbstring\\libmbfl\\config.h", true); 38 39 ADD_SOURCES("ext/mbstring/libmbfl/filters", "html_entities.c \ 40 mbfilter_7bit.c mbfilter_ascii.c mbfilter_base64.c mbfilter_big5.c \ 41 mbfilter_byte2.c mbfilter_byte4.c mbfilter_cp1251.c mbfilter_cp1252.c \ 42 mbfilter_cp866.c mbfilter_cp932.c mbfilter_cp936.c mbfilter_cp51932.c \ 43 mbfilter_euc_cn.c mbfilter_euc_jp.c mbfilter_euc_jp_win.c mbfilter_euc_kr.c \ 44 mbfilter_euc_tw.c mbfilter_htmlent.c mbfilter_hz.c mbfilter_iso2022_kr.c \ 45 mbfilter_iso8859_1.c mbfilter_iso8859_10.c mbfilter_iso8859_13.c \ 46 mbfilter_iso8859_14.c mbfilter_iso8859_15.c mbfilter_iso8859_16.c \ 47 mbfilter_iso8859_2.c mbfilter_iso8859_3.c mbfilter_iso8859_4.c \ 48 mbfilter_iso8859_5.c mbfilter_iso8859_6.c mbfilter_iso8859_7.c \ 49 mbfilter_iso8859_8.c mbfilter_iso8859_9.c mbfilter_jis.c \ 50 mbfilter_iso2022_jp_ms.c mbfilter_gb18030.c mbfilter_sjis_2004.c \ 51 mbfilter_koi8r.c mbfilter_qprint.c mbfilter_sjis.c mbfilter_ucs2.c \ 52 mbfilter_ucs4.c mbfilter_uhc.c mbfilter_utf16.c mbfilter_utf32.c \ 53 mbfilter_utf7.c mbfilter_utf7imap.c mbfilter_utf8.c mbfilter_utf8_mobile.c \ 54 mbfilter_koi8u.c mbfilter_cp1254.c mbfilter_euc_jp_2004.c \ 55 mbfilter_uuencode.c mbfilter_armscii8.c mbfilter_cp850.c \ 56 mbfilter_cp5022x.c mbfilter_sjis_open.c mbfilter_sjis_mobile.c \ 57 mbfilter_sjis_mac.c \ 58 mbfilter_iso2022jp_2004.c mbfilter_iso2022jp_mobile.c \ 59 mbfilter_tl_jisx0201_jisx0208.c", "mbstring"); 60 61 ADD_SOURCES("ext/mbstring/libmbfl/mbfl", "mbfilter.c mbfilter_8bit.c \ 62 mbfilter_pass.c mbfilter_wchar.c mbfl_convert.c mbfl_encoding.c \ 63 mbfl_filter_output.c mbfl_ident.c mbfl_language.c mbfl_memory_device.c \ 64 mbfl_string.c mbfl_allocators.c", "mbstring"); 65 66 ADD_SOURCES("ext/mbstring/libmbfl/nls", "nls_de.c nls_en.c nls_ja.c \ 67 nls_kr.c nls_neutral.c nls_ru.c nls_uni.c nls_zh.c nls_hy.c \ 68 nls_ua.c nls_tr.c", "mbstring"); 69 70 PHP_INSTALL_HEADERS("ext/mbstring", "mbstring.h oniguruma/oniguruma.h php_mbregex.h php_onig_compat.h libmbfl/config.h libmbfl/mbfl/eaw_table.h libmbfl/mbfl/mbfilter.h libmbfl/mbfl/mbfilter_8bit.h libmbfl/mbfl/mbfilter_pass.h libmbfl/mbfl/mbfilter_wchar.h libmbfl/mbfl/mbfl_allocators.h libmbfl/mbfl/mbfl_consts.h libmbfl/mbfl/mbfl_convert.h libmbfl/mbfl/mbfl_defs.h libmbfl/mbfl/mbfl_encoding.h libmbfl/mbfl/mbfl_filter_output.h libmbfl/mbfl/mbfl_ident.h libmbfl/mbfl/mbfl_language.h libmbfl/mbfl/mbfl_memory_device.h libmbfl/mbfl/mbfl_string.h"); 71 } 72 73 AC_DEFINE('HAVE_MBSTRING', 1, 'Have mbstring support'); 74 AC_DEFINE('HAVE_MBSTR_CN', 1, 'CN'); 75 AC_DEFINE('HAVE_MBSTR_JA', 1, 'JA'); 76 AC_DEFINE('HAVE_MBSTR_KR', 1, 'KR'); 77 AC_DEFINE('HAVE_MBSTR_RU', 1, 'RU'); 78 AC_DEFINE('HAVE_MBSTR_TW', 1, 'TW'); 79 80 if (X64) { 81 FSO.CopyFile("ext\\mbstring\\oniguruma\\src\\config.h.win64", 82 "ext\\mbstring\\oniguruma\\src\\config.h", true); 83 } else { 84 FSO.CopyFile("ext\\mbstring\\oniguruma\\src\\config.h.win32", 85 "ext\\mbstring\\oniguruma\\src\\config.h", true); 86 } 87 88 if (PHP_MBREGEX != "no") { 89 AC_DEFINE('HAVE_STDARG_PROTOTYPES', 1, 'have stdarg.h'); 90 AC_DEFINE('HAVE_MBREGEX', 1); 91 AC_DEFINE('HAVE_ONIG', 1); 92 if (PHP_MBREGEX_BACKTRACK != "no") { 93 AC_DEFINE('USE_COMBINATION_EXPLOSION_CHECK', 1); 94 } 95 ADD_SOURCES("ext/mbstring/oniguruma/src", "ascii.c big5.c cp1251.c euc_jp.c euc_jp_prop.c euc_kr.c euc_tw.c gb18030.c iso8859_1.c iso8859_10.c iso8859_11.c iso8859_13.c iso8859_14.c iso8859_15.c iso8859_16.c iso8859_2.c iso8859_3.c iso8859_4.c iso8859_5.c iso8859_6.c iso8859_7.c iso8859_8.c iso8859_9.c koi8.c koi8_r.c mktable.c onig_init.c regcomp.c regenc.c regerror.c regexec.c regext.c reggnu.c regparse.c regposerr.c regposix.c regsyntax.c regtrav.c regversion.c sjis.c sjis_prop.c st.c unicode.c unicode_fold1_key.c unicode_fold2_key.c unicode_fold3_key.c unicode_unfold_key.c utf16_be.c utf16_le.c utf32_be.c utf32_le.c utf8.c", "mbstring"); 96 ADD_SOURCES("ext/mbstring", "php_mbregex.c", "mbstring"); 97 PHP_INSTALL_HEADERS("ext/mbstring", "php_mbregex.h"); 98 } 99} 100