|
2 | 2 | dnl $Id$
|
3 | 3 | dnl
|
4 | 4 |
|
5 |
| -PHP_ARG_ENABLE(mbstring, whether to enable multibyte string support, |
6 |
| -[ --enable-mbstring Enable multibyte string support]) |
| 5 | +AC_DEFUN([PHP_MBSTRING_INIT], [ |
| 6 | + PHP_MBSTRING_SOURCES="" |
| 7 | + PHP_MBSTRING_EXTRA_BUILD_DIRS="" |
| 8 | + PHP_MBSTRING_EXTRA_CONFIG_HEADERS="" |
| 9 | + PHP_MBSTRING="" |
| 10 | + PHP_MBREGEX="" |
| 11 | + PHP_MBSTRING_CFLAGS="" |
| 12 | +]) |
7 | 13 |
|
8 |
| -if test "$PHP_MBSTRING" != "no"; then |
9 |
| - AC_DEFINE(HAVE_MBSTRING,1,[whether to have multibyte string support]) |
| 14 | +AC_DEFUN([PHP_MBSTRING_ADD_SOURCES], [ |
| 15 | + PHP_MBSTRING_SOURCES="$PHP_MBSTRING_SOURCES $1" |
| 16 | +]) |
10 | 17 |
|
11 |
| - if test "$PHP_MBSTRING" != "no" -o "$PHP_MBSTRING" = "ja"; then |
12 |
| - AC_DEFINE(HAVE_MBSTR_JA,1,[whether to have japanese support]) |
13 |
| - fi |
14 |
| - if test "$PHP_MBSTRING" = "cn"; then |
15 |
| - AC_DEFINE(HAVE_MBSTR_CN,1,[whether to have simplified chinese support]) |
16 |
| - fi |
17 |
| - if test "$PHP_MBSTRING" = "tw"; then |
18 |
| - AC_DEFINE(HAVE_MBSTR_TW,1,[whether to have traditional chinese support]) |
19 |
| - fi |
20 |
| - if test "$PHP_MBSTRING" = "kr"; then |
21 |
| - AC_DEFINE(HAVE_MBSTR_KR,1,[whether to have korean support]) |
| 18 | +AC_DEFUN([PHP_MBSTRING_ADD_BUILD_DIR], [ |
| 19 | + PHP_MBSTRING_EXTRA_BUILD_DIRS="$PHP_MBSTRING_EXTRA_BUILD_DIRS $1" |
| 20 | +]) |
| 21 | + |
| 22 | +AC_DEFUN([PHP_MBSTRING_CONFIG_HEADER], [ |
| 23 | + PHP_MBSTRING_EXTRA_CONFIG_HEADERS="$PHP_MBSTRING_EXTRA_CONFIG_HEADERS $1" |
| 24 | +]) |
| 25 | + |
| 26 | +AC_DEFUN([PHP_MBSTRING_EXTENSION], [ |
| 27 | + PHP_NEW_EXTENSION(mbstring, $PHP_MBSTRING_SOURCES, $ext_shared,, \\$(PHP_MBSTRING_CFLAGS)) |
| 28 | + for dir in $PHP_MBSTRING_EXTRA_BUILD_DIRS; do |
| 29 | + PHP_ADD_BUILD_DIR([$ext_builddir/$dir]) |
| 30 | + done |
| 31 | + for cfg in $PHP_MBSTRING_EXTRA_CONFIG_HEADERS; do |
| 32 | + AC_CONFIG_HEADER([$ext_builddir/$cfg]) |
| 33 | + done |
| 34 | +
|
| 35 | + if test "$LIBMBFL_MODULE_TYPE" = "builtin"; then |
| 36 | + PHP_MBSTRING_CFLAGS="-I$ext_srcdir/libmbfl/mbfl $PHP_MBSTRING_CFLAGS" |
| 37 | + PHP_MBSTRING_CFLAGS="-I$ext_srcdir/libmbfl $PHP_MBSTRING_CFLAGS" |
22 | 38 | fi
|
23 |
| - if test "$PHP_MBSTRING" = "ru"; then |
24 |
| - AC_DEFINE(HAVE_MBSTR_RU,1,[whether to have russian support]) |
| 39 | + PHP_SUBST(PHP_MBSTRING_CFLAGS) |
| 40 | +]) |
| 41 | + |
| 42 | + |
| 43 | +AC_DEFUN([PHP_MBSTRING_SETUP], [ |
| 44 | + PHP_ARG_ENABLE(mbstring, whether to enable multibyte string support, |
| 45 | + [ --enable-mbstring Enable multibyte string support]) |
| 46 | +
|
| 47 | + if test "$PHP_MBSTRING" != "no"; then |
| 48 | + AC_DEFINE([HAVE_MBSTRING],1,[whether to have multibyte string support]) |
| 49 | +
|
| 50 | + if test -z "$PHP_MBSTRING" -o "$PHP_MBSTRING" = "all" -o "$PHP_MBSTRING" = "ja"; then |
| 51 | + AC_DEFINE([HAVE_MBSTR_JA],1,[whether to have japanese support]) |
| 52 | + fi |
| 53 | + if test "$PHP_MBSTRING" = "all" -o "$PHP_MBSTRING" = "cn"; then |
| 54 | + AC_DEFINE([HAVE_MBSTR_CN],1,[whether to have simplified chinese support]) |
| 55 | + fi |
| 56 | + if test "$PHP_MBSTRING" = "all" -o "$PHP_MBSTRING" = "tw"; then |
| 57 | + AC_DEFINE([HAVE_MBSTR_TW],1,[whether to have traditional chinese support]) |
| 58 | + fi |
| 59 | + if test "$PHP_MBSTRING" = "all" -o "$PHP_MBSTIRNG" = "kr"; then |
| 60 | + AC_DEFINE([HAVE_MBSTR_KR],1,[whether to have korean support]) |
| 61 | + fi |
| 62 | + if test "$PHP_MBSTRING" = "all" -o "$PHP_MBSTRING" = "ru"; then |
| 63 | + AC_DEFINE([HAVE_MBSTR_RU],1,[whether to have russian support]) |
| 64 | + fi |
| 65 | + |
| 66 | + PHP_MBSTRING_ADD_SOURCES([ |
| 67 | + mbstring.c php_unicode.c mb_gpc.c php_mbfl_allocators.c |
| 68 | + ]) |
25 | 69 | fi
|
26 |
| - if test "$PHP_MBSTRING" = "all"; then |
27 |
| - AC_DEFINE(HAVE_MBSTR_JA,1,[whether to have japanese support]) |
28 |
| - AC_DEFINE(HAVE_MBSTR_CN,1,[whether to have simplified chinese support]) |
29 |
| - AC_DEFINE(HAVE_MBSTR_TW,1,[whether to have traditional chinese support]) |
30 |
| - AC_DEFINE(HAVE_MBSTR_KR,1,[whether to have korean support]) |
31 |
| - AC_DEFINE(HAVE_MBSTR_RU,1,[whether to have russian support]) |
| 70 | +]) |
| 71 | + |
| 72 | +AC_DEFUN([PHP_MBSTRING_SETUP_MBREGEX], [ |
| 73 | + PHP_ARG_ENABLE([mbregex], [whether to enable multibyte regex support], |
| 74 | + [ --disable-mbregex Disable multibyte regex support], yes, no) |
| 75 | +
|
| 76 | + if test "$PHP_MBREGEX" != "no" -a "$PHP_MBSTRING" != "no"; then |
| 77 | + AC_CACHE_CHECK(for variable length prototypes and stdarg.h, cv_php_mbstring_stdarg, [ |
| 78 | + AC_TRY_COMPILE([#include <stdarg.h>], [ |
| 79 | +int foo(int x, ...) { |
| 80 | + va_list va; |
| 81 | + va_start(va, x); |
| 82 | + va_arg(va, int); |
| 83 | + va_arg(va, char *); |
| 84 | + va_arg(va, double); |
| 85 | + return 0; |
| 86 | +} |
| 87 | +int main() { return foo(10, "", 3.14); } |
| 88 | + ], [cv_php_mbstring_stdarg=yes], [cv_php_mbstring_stdarg=no]) |
| 89 | + ]) |
| 90 | + if test "$cv_php_mbstring_stdarg" = "yes"; then |
| 91 | + AC_DEFINE([HAVE_STDARG_PROTOTYPES], 1, [Define if stdarg.h is available]) |
| 92 | + fi |
| 93 | + AC_DEFINE([HAVE_MBREGEX], 1, [whether to have multibyte regex support]) |
| 94 | + PHP_MBSTRING_CFLAGS="-DNOT_RUBY $PHP_MBSTRING_CFLAGS" |
| 95 | +
|
| 96 | + PHP_MBSTRING_ADD_BUILD_DIR([oniguruma]) |
| 97 | + PHP_MBSTRING_CONFIG_HEADER([oniguruma/config.h]) |
| 98 | + PHP_MBSTRING_ADD_SOURCES([ |
| 99 | + php_mbregex.c |
| 100 | + oniguruma/regcomp.c |
| 101 | + oniguruma/regerror.c |
| 102 | + oniguruma/regexec.c |
| 103 | + oniguruma/reggnu.c |
| 104 | + oniguruma/regparse.c |
| 105 | + oniguruma/regposerr.c |
| 106 | + ]) |
32 | 107 | fi
|
| 108 | +]) |
| 109 | + |
| 110 | +AC_DEFUN([PHP_MBSTRING_SETUP_LIBMBFL], [ |
| 111 | + PHP_ARG_WITH(libmbfl, [ include libmbfl support], |
| 112 | + [ --with-libmbfl[=DIR] Include libmbfl support where DIR is libmbfl install prefix. |
| 113 | + If DIR is not set, the bundled libmbfl will be used.], no, no) |
33 | 114 |
|
34 |
| - PHP_NEW_EXTENSION(mbstring, mbfilter_ja.c mbfilter_cn.c mbfilter_tw.c mbfilter_kr.c mbfilter_ru.c mbfilter.c mbstring.c mbregex.c php_mbregex.c html_entities.c php_unicode.c mb_gpc.c, $ext_shared) |
35 |
| -fi |
| 115 | + if test "$PHP_MBSTRING" != "no"; then |
| 116 | + LIBMBFL_MODULE_TYPE=builtin |
| 117 | + AC_DEFINE([HAVE_LIBMBFL], 1, [whether to have libmbfl support]) |
| 118 | + PHP_MBSTRING_ADD_BUILD_DIR([libmbfl]) |
| 119 | + PHP_MBSTRING_CONFIG_HEADER([libmbfl/config.h]) |
| 120 | + PHP_MBSTRING_ADD_SOURCES([ |
| 121 | + libmbfl/filters/html_entities.c |
| 122 | + libmbfl/filters/mbfilter_7bit.c |
| 123 | + libmbfl/filters/mbfilter_ascii.c |
| 124 | + libmbfl/filters/mbfilter_base64.c |
| 125 | + libmbfl/filters/mbfilter_big5.c |
| 126 | + libmbfl/filters/mbfilter_byte2.c |
| 127 | + libmbfl/filters/mbfilter_byte4.c |
| 128 | + libmbfl/filters/mbfilter_cp1251.c |
| 129 | + libmbfl/filters/mbfilter_cp1252.c |
| 130 | + libmbfl/filters/mbfilter_cp866.c |
| 131 | + libmbfl/filters/mbfilter_cp932.c |
| 132 | + libmbfl/filters/mbfilter_cp936.c |
| 133 | + libmbfl/filters/mbfilter_euc_cn.c |
| 134 | + libmbfl/filters/mbfilter_euc_jp.c |
| 135 | + libmbfl/filters/mbfilter_euc_jp_win.c |
| 136 | + libmbfl/filters/mbfilter_euc_kr.c |
| 137 | + libmbfl/filters/mbfilter_euc_tw.c |
| 138 | + libmbfl/filters/mbfilter_htmlent.c |
| 139 | + libmbfl/filters/mbfilter_hz.c |
| 140 | + libmbfl/filters/mbfilter_iso2022_kr.c |
| 141 | + libmbfl/filters/mbfilter_iso8859_1.c |
| 142 | + libmbfl/filters/mbfilter_iso8859_10.c |
| 143 | + libmbfl/filters/mbfilter_iso8859_13.c |
| 144 | + libmbfl/filters/mbfilter_iso8859_14.c |
| 145 | + libmbfl/filters/mbfilter_iso8859_15.c |
| 146 | + libmbfl/filters/mbfilter_iso8859_2.c |
| 147 | + libmbfl/filters/mbfilter_iso8859_3.c |
| 148 | + libmbfl/filters/mbfilter_iso8859_4.c |
| 149 | + libmbfl/filters/mbfilter_iso8859_5.c |
| 150 | + libmbfl/filters/mbfilter_iso8859_6.c |
| 151 | + libmbfl/filters/mbfilter_iso8859_7.c |
| 152 | + libmbfl/filters/mbfilter_iso8859_8.c |
| 153 | + libmbfl/filters/mbfilter_iso8859_9.c |
| 154 | + libmbfl/filters/mbfilter_jis.c |
| 155 | + libmbfl/filters/mbfilter_koi8r.c |
| 156 | + libmbfl/filters/mbfilter_qprint.c |
| 157 | + libmbfl/filters/mbfilter_sjis.c |
| 158 | + libmbfl/filters/mbfilter_ucs2.c |
| 159 | + libmbfl/filters/mbfilter_ucs4.c |
| 160 | + libmbfl/filters/mbfilter_uhc.c |
| 161 | + libmbfl/filters/mbfilter_utf16.c |
| 162 | + libmbfl/filters/mbfilter_utf32.c |
| 163 | + libmbfl/filters/mbfilter_utf7.c |
| 164 | + libmbfl/filters/mbfilter_utf7imap.c |
| 165 | + libmbfl/filters/mbfilter_utf8.c |
| 166 | + libmbfl/filters/mbfilter_uuencode.c |
| 167 | + libmbfl/mbfl/mbfilter.c |
| 168 | + libmbfl/mbfl/mbfilter_8bit.c |
| 169 | + libmbfl/mbfl/mbfilter_pass.c |
| 170 | + libmbfl/mbfl/mbfilter_wchar.c |
| 171 | + libmbfl/mbfl/mbfl_convert.c |
| 172 | + libmbfl/mbfl/mbfl_encoding.c |
| 173 | + libmbfl/mbfl/mbfl_filter_output.c |
| 174 | + libmbfl/mbfl/mbfl_ident.c |
| 175 | + libmbfl/mbfl/mbfl_language.c |
| 176 | + libmbfl/mbfl/mbfl_memory_device.c |
| 177 | + libmbfl/mbfl/mbfl_string.c |
| 178 | + libmbfl/nls/nls_de.c |
| 179 | + libmbfl/nls/nls_en.c |
| 180 | + libmbfl/nls/nls_ja.c |
| 181 | + libmbfl/nls/nls_kr.c |
| 182 | + libmbfl/nls/nls_neutral.c |
| 183 | + libmbfl/nls/nls_ru.c |
| 184 | + libmbfl/nls/nls_uni.c |
| 185 | + libmbfl/nls/nls_zh.c |
| 186 | + ]) |
| 187 | + fi |
| 188 | +]) |
36 | 189 |
|
37 |
| -PHP_ARG_ENABLE(mbregex, whether to enable multibyte regex support, |
38 |
| -[ --disable-mbregex Disable multibyte regex support], yes, no) |
| 190 | +PHP_MBSTRING_INIT |
| 191 | +PHP_MBSTRING_SETUP |
| 192 | +PHP_MBSTRING_SETUP_MBREGEX |
| 193 | +PHP_MBSTRING_SETUP_LIBMBFL |
| 194 | +PHP_MBSTRING_EXTENSION |
39 | 195 |
|
40 |
| -if test "$PHP_MBREGEX" != "no" -a "$PHP_MBSTRING" != "no"; then |
41 |
| - AC_DEFINE(HAVE_MBREGEX, 1, [whether to have multibyte regex support]) |
42 |
| -fi |
|
0 commit comments