1AC_DEFUN([PHP_MBSTRING_ADD_SOURCES], [ 2 PHP_MBSTRING_SOURCES="$PHP_MBSTRING_SOURCES $1" 3]) 4 5AC_DEFUN([PHP_MBSTRING_ADD_BASE_SOURCES], [ 6 PHP_MBSTRING_BASE_SOURCES="$PHP_MBSTRING_BASE_SOURCES $1" 7]) 8 9AC_DEFUN([PHP_MBSTRING_ADD_BUILD_DIR], [ 10 PHP_MBSTRING_EXTRA_BUILD_DIRS="$PHP_MBSTRING_EXTRA_BUILD_DIRS $1" 11]) 12 13AC_DEFUN([PHP_MBSTRING_ADD_INCLUDE], [ 14 PHP_MBSTRING_EXTRA_INCLUDES="$PHP_MBSTRING_EXTRA_INCLUDES $1" 15]) 16 17AC_DEFUN([PHP_MBSTRING_ADD_CFLAG], [ 18 PHP_MBSTRING_CFLAGS="$PHP_MBSTRING_CFLAGS $1" 19]) 20 21AC_DEFUN([PHP_MBSTRING_ADD_INSTALL_HEADERS], [ 22 PHP_MBSTRING_INSTALL_HEADERS="$PHP_MBSTRING_INSTALL_HEADERS $1" 23]) 24 25AC_DEFUN([PHP_MBSTRING_EXTENSION], [ 26 PHP_NEW_EXTENSION(mbstring, $PHP_MBSTRING_BASE_SOURCES $PHP_MBSTRING_SOURCES, $ext_shared,, $PHP_MBSTRING_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) 27 PHP_SUBST(MBSTRING_SHARED_LIBADD) 28 29 for dir in $PHP_MBSTRING_EXTRA_BUILD_DIRS; do 30 PHP_ADD_BUILD_DIR([$ext_builddir/$dir], 1) 31 done 32 33 for dir in $PHP_MBSTRING_EXTRA_INCLUDES; do 34 PHP_ADD_INCLUDE([$ext_srcdir/$dir]) 35 PHP_ADD_INCLUDE([$ext_builddir/$dir]) 36 done 37 38 out="php_config.h" 39 40 if test "$ext_shared" != "no" && test -f "$ext_builddir/config.h.in"; then 41 out="$abs_builddir/config.h" 42 fi 43 44 cat > $ext_builddir/libmbfl/config.h <<EOF 45#include "$out" 46EOF 47 48 PHP_MBSTRING_ADD_INSTALL_HEADERS([mbstring.h]) 49 PHP_INSTALL_HEADERS([ext/mbstring], [$PHP_MBSTRING_INSTALL_HEADERS]) 50]) 51 52AC_DEFUN([PHP_MBSTRING_SETUP_MBREGEX], [ 53 if test "$PHP_MBREGEX" = "yes"; then 54 PKG_CHECK_MODULES([ONIG], [oniguruma]) 55 PHP_EVAL_LIBLINE($ONIG_LIBS, MBSTRING_SHARED_LIBADD) 56 PHP_EVAL_INCLINE($ONIG_CFLAGS) 57 58 save_old_LDFLAGS=$LDFLAGS 59 PHP_EVAL_LIBLINE([$MBSTRING_SHARED_LIBADD], LDFLAGS) 60 AC_MSG_CHECKING([if oniguruma has an invalid entry for KOI8 encoding]) 61 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 62#include <oniguruma.h> 63 ]], [[ 64return (int)(ONIG_ENCODING_KOI8 + 1); 65 ]])], [ 66 AC_MSG_RESULT([no]) 67 ], [ 68 AC_MSG_RESULT([yes]) 69 AC_DEFINE([PHP_ONIG_BAD_KOI8_ENTRY], [1], [define to 1 if oniguruma has an invalid entry for KOI8 encoding]) 70 ]) 71 LDFLAGS=$save_old_LDFLAGS 72 73 PHP_MBSTRING_ADD_CFLAG([-DONIG_ESCAPE_UCHAR_COLLISION=1]) 74 PHP_MBSTRING_ADD_CFLAG([-DUChar=OnigUChar]) 75 76 AC_DEFINE([HAVE_MBREGEX], 1, [whether to have multibyte regex support]) 77 78 PHP_MBSTRING_ADD_BASE_SOURCES([php_mbregex.c]) 79 PHP_MBSTRING_ADD_INSTALL_HEADERS([php_mbregex.h php_onig_compat.h]) 80 fi 81]) 82 83AC_DEFUN([PHP_MBSTRING_SETUP_LIBMBFL], [ 84 dnl 85 dnl Bundled libmbfl is required and can not be disabled 86 dnl 87 PHP_MBSTRING_ADD_BUILD_DIR([libmbfl]) 88 PHP_MBSTRING_ADD_BUILD_DIR([libmbfl/mbfl]) 89 PHP_MBSTRING_ADD_BUILD_DIR([libmbfl/filters]) 90 PHP_MBSTRING_ADD_BUILD_DIR([libmbfl/nls]) 91 PHP_MBSTRING_ADD_INCLUDE([libmbfl]) 92 PHP_MBSTRING_ADD_INCLUDE([libmbfl/mbfl]) 93 94 PHP_MBSTRING_ADD_SOURCES([ 95 libmbfl/filters/html_entities.c 96 libmbfl/filters/mbfilter_7bit.c 97 libmbfl/filters/mbfilter_ascii.c 98 libmbfl/filters/mbfilter_base64.c 99 libmbfl/filters/mbfilter_big5.c 100 libmbfl/filters/mbfilter_byte2.c 101 libmbfl/filters/mbfilter_byte4.c 102 libmbfl/filters/mbfilter_cp1251.c 103 libmbfl/filters/mbfilter_cp1252.c 104 libmbfl/filters/mbfilter_cp1254.c 105 libmbfl/filters/mbfilter_cp5022x.c 106 libmbfl/filters/mbfilter_cp51932.c 107 libmbfl/filters/mbfilter_cp850.c 108 libmbfl/filters/mbfilter_cp866.c 109 libmbfl/filters/mbfilter_cp932.c 110 libmbfl/filters/mbfilter_cp936.c 111 libmbfl/filters/mbfilter_gb18030.c 112 libmbfl/filters/mbfilter_euc_cn.c 113 libmbfl/filters/mbfilter_euc_jp.c 114 libmbfl/filters/mbfilter_euc_jp_2004.c 115 libmbfl/filters/mbfilter_euc_jp_win.c 116 libmbfl/filters/mbfilter_euc_kr.c 117 libmbfl/filters/mbfilter_euc_tw.c 118 libmbfl/filters/mbfilter_htmlent.c 119 libmbfl/filters/mbfilter_hz.c 120 libmbfl/filters/mbfilter_iso2022_jp_ms.c 121 libmbfl/filters/mbfilter_iso2022jp_2004.c 122 libmbfl/filters/mbfilter_iso2022jp_mobile.c 123 libmbfl/filters/mbfilter_iso2022_kr.c 124 libmbfl/filters/mbfilter_iso8859_1.c 125 libmbfl/filters/mbfilter_iso8859_10.c 126 libmbfl/filters/mbfilter_iso8859_13.c 127 libmbfl/filters/mbfilter_iso8859_14.c 128 libmbfl/filters/mbfilter_iso8859_15.c 129 libmbfl/filters/mbfilter_iso8859_16.c 130 libmbfl/filters/mbfilter_iso8859_2.c 131 libmbfl/filters/mbfilter_iso8859_3.c 132 libmbfl/filters/mbfilter_iso8859_4.c 133 libmbfl/filters/mbfilter_iso8859_5.c 134 libmbfl/filters/mbfilter_iso8859_6.c 135 libmbfl/filters/mbfilter_iso8859_7.c 136 libmbfl/filters/mbfilter_iso8859_8.c 137 libmbfl/filters/mbfilter_iso8859_9.c 138 libmbfl/filters/mbfilter_jis.c 139 libmbfl/filters/mbfilter_koi8r.c 140 libmbfl/filters/mbfilter_armscii8.c 141 libmbfl/filters/mbfilter_qprint.c 142 libmbfl/filters/mbfilter_sjis.c 143 libmbfl/filters/mbfilter_sjis_open.c 144 libmbfl/filters/mbfilter_sjis_mobile.c 145 libmbfl/filters/mbfilter_sjis_mac.c 146 libmbfl/filters/mbfilter_sjis_2004.c 147 libmbfl/filters/mbfilter_tl_jisx0201_jisx0208.c 148 libmbfl/filters/mbfilter_ucs2.c 149 libmbfl/filters/mbfilter_ucs4.c 150 libmbfl/filters/mbfilter_uhc.c 151 libmbfl/filters/mbfilter_utf16.c 152 libmbfl/filters/mbfilter_utf32.c 153 libmbfl/filters/mbfilter_utf7.c 154 libmbfl/filters/mbfilter_utf7imap.c 155 libmbfl/filters/mbfilter_utf8.c 156 libmbfl/filters/mbfilter_utf8_mobile.c 157 libmbfl/filters/mbfilter_uuencode.c 158 libmbfl/filters/mbfilter_koi8u.c 159 libmbfl/mbfl/mbfilter.c 160 libmbfl/mbfl/mbfilter_8bit.c 161 libmbfl/mbfl/mbfilter_pass.c 162 libmbfl/mbfl/mbfilter_wchar.c 163 libmbfl/mbfl/mbfl_convert.c 164 libmbfl/mbfl/mbfl_encoding.c 165 libmbfl/mbfl/mbfl_filter_output.c 166 libmbfl/mbfl/mbfl_ident.c 167 libmbfl/mbfl/mbfl_language.c 168 libmbfl/mbfl/mbfl_memory_device.c 169 libmbfl/mbfl/mbfl_string.c 170 libmbfl/mbfl/mbfl_allocators.c 171 libmbfl/nls/nls_de.c 172 libmbfl/nls/nls_en.c 173 libmbfl/nls/nls_ja.c 174 libmbfl/nls/nls_kr.c 175 libmbfl/nls/nls_neutral.c 176 libmbfl/nls/nls_ru.c 177 libmbfl/nls/nls_uni.c 178 libmbfl/nls/nls_zh.c 179 libmbfl/nls/nls_hy.c 180 libmbfl/nls/nls_tr.c 181 libmbfl/nls/nls_ua.c 182 ]) 183 PHP_MBSTRING_ADD_CFLAG([-DHAVE_CONFIG_H]) 184 PHP_MBSTRING_ADD_INSTALL_HEADERS([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]) 185]) 186 187dnl 188dnl Main config 189dnl 190 191PHP_ARG_ENABLE([mbstring], 192 [whether to enable multibyte string support], 193 [AS_HELP_STRING([--enable-mbstring], 194 [Enable multibyte string support])]) 195 196PHP_ARG_ENABLE([mbregex], 197 [whether to enable multibyte regex support (requires oniguruma)], 198 [AS_HELP_STRING([--disable-mbregex], 199 [MBSTRING: Disable multibyte regex support])], 200 [yes], 201 [no]) 202 203if test "$PHP_MBSTRING" != "no"; then 204 AC_DEFINE([HAVE_MBSTRING],1,[whether to have multibyte string support]) 205 206 PHP_MBSTRING_ADD_BASE_SOURCES([mbstring.c php_unicode.c mb_gpc.c]) 207 208 if test "$PHP_MBREGEX" != "no"; then 209 PHP_MBSTRING_SETUP_MBREGEX 210 fi 211 212 dnl libmbfl is required 213 PHP_MBSTRING_SETUP_LIBMBFL 214 PHP_MBSTRING_EXTENSION 215fi 216