Annotation of embedaddon/php/ext/mbstring/config.m4, revision 1.1
1.1 ! misho 1: dnl
! 2: dnl $Id: config.m4 296101 2010-03-12 04:55:37Z moriyoshi $
! 3: dnl
! 4:
! 5: AC_DEFUN([PHP_MBSTRING_ADD_SOURCES], [
! 6: PHP_MBSTRING_SOURCES="$PHP_MBSTRING_SOURCES $1"
! 7: ])
! 8:
! 9: AC_DEFUN([PHP_MBSTRING_ADD_BASE_SOURCES], [
! 10: PHP_MBSTRING_BASE_SOURCES="$PHP_MBSTRING_BASE_SOURCES $1"
! 11: ])
! 12:
! 13: AC_DEFUN([PHP_MBSTRING_ADD_BUILD_DIR], [
! 14: PHP_MBSTRING_EXTRA_BUILD_DIRS="$PHP_MBSTRING_EXTRA_BUILD_DIRS $1"
! 15: ])
! 16:
! 17: AC_DEFUN([PHP_MBSTRING_ADD_INCLUDE], [
! 18: PHP_MBSTRING_EXTRA_INCLUDES="$PHP_MBSTRING_EXTRA_INCLUDES $1"
! 19: ])
! 20:
! 21: AC_DEFUN([PHP_MBSTRING_ADD_CONFIG_HEADER], [
! 22: PHP_MBSTRING_EXTRA_CONFIG_HEADERS="$PHP_MBSTRING_EXTRA_CONFIG_HEADERS $1"
! 23: ])
! 24:
! 25: AC_DEFUN([PHP_MBSTRING_ADD_CFLAG], [
! 26: PHP_MBSTRING_CFLAGS="$PHP_MBSTRING_CFLAGS $1"
! 27: ])
! 28:
! 29: AC_DEFUN([PHP_MBSTRING_ADD_INSTALL_HEADERS], [
! 30: PHP_MBSTRING_INSTALL_HEADERS="$PHP_MBSTRING_INSTALL_HEADERS $1"
! 31: ])
! 32:
! 33: AC_DEFUN([PHP_MBSTRING_EXTENSION], [
! 34: PHP_NEW_EXTENSION(mbstring, $PHP_MBSTRING_SOURCES, $ext_shared,, $PHP_MBSTRING_CFLAGS)
! 35: PHP_SUBST(MBSTRING_SHARED_LIBADD)
! 36:
! 37: for dir in $PHP_MBSTRING_EXTRA_BUILD_DIRS; do
! 38: PHP_ADD_BUILD_DIR([$ext_builddir/$dir], 1)
! 39: done
! 40:
! 41: for dir in $PHP_MBSTRING_EXTRA_INCLUDES; do
! 42: PHP_ADD_INCLUDE([$ext_srcdir/$dir])
! 43: PHP_ADD_INCLUDE([$ext_builddir/$dir])
! 44: done
! 45:
! 46: if test "$ext_shared" = "no"; then
! 47: PHP_ADD_SOURCES(PHP_EXT_DIR(mbstring), $PHP_MBSTRING_BASE_SOURCES)
! 48: out="php_config.h"
! 49: else
! 50: PHP_ADD_SOURCES_X(PHP_EXT_DIR(mbstring),$PHP_MBSTRING_BASE_SOURCES,,shared_objects_mbstring,yes)
! 51: if test -f "$ext_builddir/config.h.in"; then
! 52: out="$abs_builddir/config.h"
! 53: else
! 54: out="php_config.h"
! 55: fi
! 56: fi
! 57:
! 58: for cfg in $PHP_MBSTRING_EXTRA_CONFIG_HEADERS; do
! 59: cat > $ext_builddir/$cfg <<EOF
! 60: #include "$out"
! 61: EOF
! 62: done
! 63: PHP_MBSTRING_ADD_INSTALL_HEADERS([mbstring.h])
! 64: PHP_INSTALL_HEADERS([ext/mbstring], [$PHP_MBSTRING_INSTALL_HEADERS])
! 65: ])
! 66:
! 67: AC_DEFUN([PHP_MBSTRING_SETUP_MBREGEX], [
! 68: if test "$PHP_MBREGEX" = "yes"; then
! 69: if test "$PHP_ONIG" = "yes" || test "$PHP_ONIG" = "no"; then
! 70: dnl
! 71: dnl Bundled oniguruma
! 72: dnl
! 73: if test "$PHP_MBREGEX_BACKTRACK" != "no"; then
! 74: AC_DEFINE([USE_COMBINATION_EXPLOSION_CHECK],1,[whether to check multibyte regex backtrack])
! 75: fi
! 76:
! 77: AC_CACHE_CHECK(for variable length prototypes and stdarg.h, php_cv_mbstring_stdarg, [
! 78: AC_TRY_RUN([
! 79: #include <stdarg.h>
! 80: int foo(int x, ...) {
! 81: va_list va;
! 82: va_start(va, x);
! 83: va_arg(va, int);
! 84: va_arg(va, char *);
! 85: va_arg(va, double);
! 86: return 0;
! 87: }
! 88: int main() { return foo(10, "", 3.14); }
! 89: ], [php_cv_mbstring_stdarg=yes], [php_cv_mbstring_stdarg=no], [
! 90: dnl cross-compile needs something here
! 91: case $host_alias in
! 92: *netware*)
! 93: php_cv_mbstring_stdarg=yes
! 94: ;;
! 95: *)
! 96: php_cv_mbstring_stdarg=no
! 97: ;;
! 98: esac
! 99: ])
! 100: ])
! 101:
! 102: AC_CHECK_HEADERS([stdlib.h string.h strings.h unistd.h sys/time.h sys/times.h stdarg.h])
! 103: AC_CHECK_SIZEOF(int, 4)
! 104: AC_CHECK_SIZEOF(short, 2)
! 105: AC_CHECK_SIZEOF(long, 4)
! 106: AC_C_CONST
! 107: AC_HEADER_TIME
! 108: AC_FUNC_ALLOCA
! 109: AC_FUNC_MEMCMP
! 110: AC_CHECK_HEADER([stdarg.h], [
! 111: AC_DEFINE([HAVE_STDARG_PROTOTYPES], [1], [Define to 1 if you have the <stdarg.h> header file.])
! 112: ], [])
! 113: AC_DEFINE([PHP_ONIG_BUNDLED], [1], [Define to 1 if the bundled oniguruma is used])
! 114: AC_DEFINE([HAVE_ONIG], [1], [Define to 1 if the oniguruma library is available])
! 115: PHP_MBSTRING_ADD_CFLAG([-DNOT_RUBY])
! 116: PHP_MBSTRING_ADD_BUILD_DIR([oniguruma])
! 117: PHP_MBSTRING_ADD_BUILD_DIR([oniguruma/enc])
! 118: PHP_MBSTRING_ADD_INCLUDE([oniguruma])
! 119: PHP_MBSTRING_ADD_CONFIG_HEADER([oniguruma/config.h])
! 120: PHP_MBSTRING_ADD_SOURCES([
! 121: oniguruma/regcomp.c
! 122: oniguruma/regerror.c
! 123: oniguruma/regexec.c
! 124: oniguruma/reggnu.c
! 125: oniguruma/regparse.c
! 126: oniguruma/regenc.c
! 127: oniguruma/regext.c
! 128: oniguruma/regsyntax.c
! 129: oniguruma/regtrav.c
! 130: oniguruma/regversion.c
! 131: oniguruma/st.c
! 132: oniguruma/enc/unicode.c
! 133: oniguruma/enc/ascii.c
! 134: oniguruma/enc/utf8.c
! 135: oniguruma/enc/euc_jp.c
! 136: oniguruma/enc/euc_tw.c
! 137: oniguruma/enc/euc_kr.c
! 138: oniguruma/enc/sjis.c
! 139: oniguruma/enc/iso8859_1.c
! 140: oniguruma/enc/iso8859_2.c
! 141: oniguruma/enc/iso8859_3.c
! 142: oniguruma/enc/iso8859_4.c
! 143: oniguruma/enc/iso8859_5.c
! 144: oniguruma/enc/iso8859_6.c
! 145: oniguruma/enc/iso8859_7.c
! 146: oniguruma/enc/iso8859_8.c
! 147: oniguruma/enc/iso8859_9.c
! 148: oniguruma/enc/iso8859_10.c
! 149: oniguruma/enc/iso8859_11.c
! 150: oniguruma/enc/iso8859_13.c
! 151: oniguruma/enc/iso8859_14.c
! 152: oniguruma/enc/iso8859_15.c
! 153: oniguruma/enc/iso8859_16.c
! 154: oniguruma/enc/koi8.c
! 155: oniguruma/enc/koi8_r.c
! 156: oniguruma/enc/big5.c
! 157: oniguruma/enc/utf16_be.c
! 158: oniguruma/enc/utf16_le.c
! 159: oniguruma/enc/utf32_be.c
! 160: oniguruma/enc/utf32_le.c
! 161: ])
! 162: PHP_MBSTRING_ADD_INSTALL_HEADERS([oniguruma/oniguruma.h])
! 163: else
! 164: dnl
! 165: dnl External oniguruma
! 166: dnl
! 167: if test ! -f "$PHP_ONIG/include/oniguruma.h"; then
! 168: AC_MSG_ERROR([oniguruma.h not found in $PHP_ONIG/include])
! 169: fi
! 170: PHP_ADD_INCLUDE([$PHP_ONIG/include])
! 171:
! 172: PHP_CHECK_LIBRARY(onig, onig_init, [
! 173: PHP_ADD_LIBRARY_WITH_PATH(onig, $PHP_ONIG/$PHP_LIBDIR, MBSTRING_SHARED_LIBADD)
! 174: AC_DEFINE([HAVE_ONIG], [1], [Define to 1 if the oniguruma library is available])
! 175: ],[
! 176: AC_MSG_ERROR([Problem with oniguruma. Please check config.log for more information.])
! 177: ], [
! 178: -L$PHP_ONIG/$PHP_LIBDIR
! 179: ])
! 180:
! 181: save_old_LDFLAGS=$LDFLAGS
! 182: PHP_EVAL_LIBLINE([$MBSTRING_SHARED_LIBADD], LDFLAGS)
! 183: AC_MSG_CHECKING([if oniguruma has an invalid entry for KOI8 encoding])
! 184: AC_TRY_LINK([
! 185: #include <oniguruma.h>
! 186: ], [
! 187: return (int)(ONIG_ENCODING_KOI8 + 1);
! 188: ], [
! 189: AC_MSG_RESULT([no])
! 190: ], [
! 191: AC_MSG_RESULT([yes])
! 192: AC_DEFINE([PHP_ONIG_BAD_KOI8_ENTRY], [1], [define to 1 if oniguruma has an invalid entry for KOI8 encoding])
! 193: ])
! 194: LDFLAGS=$save_old_LDFLAGS
! 195: fi
! 196:
! 197: PHP_MBSTRING_ADD_CFLAG([-DONIG_ESCAPE_UCHAR_COLLISION=1])
! 198: PHP_MBSTRING_ADD_CFLAG([-DUChar=OnigUChar])
! 199:
! 200: AC_DEFINE([HAVE_MBREGEX], 1, [whether to have multibyte regex support])
! 201:
! 202: PHP_MBSTRING_ADD_BASE_SOURCES([php_mbregex.c])
! 203: PHP_MBSTRING_ADD_INSTALL_HEADERS([php_mbregex.h php_onig_compat.h])
! 204: fi
! 205: ])
! 206:
! 207: AC_DEFUN([PHP_MBSTRING_SETUP_LIBMBFL], [
! 208: dnl libmbfl is required and can not be disabled
! 209: if test "$PHP_LIBMBFL" = "yes" || test "$PHP_LIBMBFL" = "no"; then
! 210: dnl
! 211: dnl Bundled libmbfl
! 212: dnl
! 213: PHP_MBSTRING_ADD_BUILD_DIR([libmbfl])
! 214: PHP_MBSTRING_ADD_BUILD_DIR([libmbfl/mbfl])
! 215: PHP_MBSTRING_ADD_BUILD_DIR([libmbfl/filters])
! 216: PHP_MBSTRING_ADD_BUILD_DIR([libmbfl/nls])
! 217: PHP_MBSTRING_ADD_INCLUDE([libmbfl])
! 218: PHP_MBSTRING_ADD_INCLUDE([libmbfl/mbfl])
! 219: PHP_MBSTRING_ADD_CONFIG_HEADER([libmbfl/config.h])
! 220:
! 221: PHP_MBSTRING_ADD_SOURCES([
! 222: libmbfl/filters/html_entities.c
! 223: libmbfl/filters/mbfilter_7bit.c
! 224: libmbfl/filters/mbfilter_ascii.c
! 225: libmbfl/filters/mbfilter_base64.c
! 226: libmbfl/filters/mbfilter_big5.c
! 227: libmbfl/filters/mbfilter_byte2.c
! 228: libmbfl/filters/mbfilter_byte4.c
! 229: libmbfl/filters/mbfilter_cp1251.c
! 230: libmbfl/filters/mbfilter_cp1252.c
! 231: libmbfl/filters/mbfilter_cp1254.c
! 232: libmbfl/filters/mbfilter_cp5022x.c
! 233: libmbfl/filters/mbfilter_cp51932.c
! 234: libmbfl/filters/mbfilter_cp850.c
! 235: libmbfl/filters/mbfilter_cp866.c
! 236: libmbfl/filters/mbfilter_cp932.c
! 237: libmbfl/filters/mbfilter_cp936.c
! 238: libmbfl/filters/mbfilter_euc_cn.c
! 239: libmbfl/filters/mbfilter_euc_jp.c
! 240: libmbfl/filters/mbfilter_euc_jp_win.c
! 241: libmbfl/filters/mbfilter_euc_kr.c
! 242: libmbfl/filters/mbfilter_euc_tw.c
! 243: libmbfl/filters/mbfilter_htmlent.c
! 244: libmbfl/filters/mbfilter_hz.c
! 245: libmbfl/filters/mbfilter_iso2022_jp_ms.c
! 246: libmbfl/filters/mbfilter_iso2022_kr.c
! 247: libmbfl/filters/mbfilter_iso8859_1.c
! 248: libmbfl/filters/mbfilter_iso8859_10.c
! 249: libmbfl/filters/mbfilter_iso8859_13.c
! 250: libmbfl/filters/mbfilter_iso8859_14.c
! 251: libmbfl/filters/mbfilter_iso8859_15.c
! 252: libmbfl/filters/mbfilter_iso8859_16.c
! 253: libmbfl/filters/mbfilter_iso8859_2.c
! 254: libmbfl/filters/mbfilter_iso8859_3.c
! 255: libmbfl/filters/mbfilter_iso8859_4.c
! 256: libmbfl/filters/mbfilter_iso8859_5.c
! 257: libmbfl/filters/mbfilter_iso8859_6.c
! 258: libmbfl/filters/mbfilter_iso8859_7.c
! 259: libmbfl/filters/mbfilter_iso8859_8.c
! 260: libmbfl/filters/mbfilter_iso8859_9.c
! 261: libmbfl/filters/mbfilter_jis.c
! 262: libmbfl/filters/mbfilter_koi8r.c
! 263: libmbfl/filters/mbfilter_armscii8.c
! 264: libmbfl/filters/mbfilter_qprint.c
! 265: libmbfl/filters/mbfilter_sjis.c
! 266: libmbfl/filters/mbfilter_sjis_open.c
! 267: libmbfl/filters/mbfilter_tl_jisx0201_jisx0208.c
! 268: libmbfl/filters/mbfilter_ucs2.c
! 269: libmbfl/filters/mbfilter_ucs4.c
! 270: libmbfl/filters/mbfilter_uhc.c
! 271: libmbfl/filters/mbfilter_utf16.c
! 272: libmbfl/filters/mbfilter_utf32.c
! 273: libmbfl/filters/mbfilter_utf7.c
! 274: libmbfl/filters/mbfilter_utf7imap.c
! 275: libmbfl/filters/mbfilter_utf8.c
! 276: libmbfl/filters/mbfilter_uuencode.c
! 277: libmbfl/filters/mbfilter_koi8u.c
! 278: libmbfl/mbfl/mbfilter.c
! 279: libmbfl/mbfl/mbfilter_8bit.c
! 280: libmbfl/mbfl/mbfilter_pass.c
! 281: libmbfl/mbfl/mbfilter_wchar.c
! 282: libmbfl/mbfl/mbfl_convert.c
! 283: libmbfl/mbfl/mbfl_encoding.c
! 284: libmbfl/mbfl/mbfl_filter_output.c
! 285: libmbfl/mbfl/mbfl_ident.c
! 286: libmbfl/mbfl/mbfl_language.c
! 287: libmbfl/mbfl/mbfl_memory_device.c
! 288: libmbfl/mbfl/mbfl_string.c
! 289: libmbfl/mbfl/mbfl_allocators.c
! 290: libmbfl/nls/nls_de.c
! 291: libmbfl/nls/nls_en.c
! 292: libmbfl/nls/nls_ja.c
! 293: libmbfl/nls/nls_kr.c
! 294: libmbfl/nls/nls_neutral.c
! 295: libmbfl/nls/nls_ru.c
! 296: libmbfl/nls/nls_uni.c
! 297: libmbfl/nls/nls_zh.c
! 298: libmbfl/nls/nls_hy.c
! 299: libmbfl/nls/nls_tr.c
! 300: libmbfl/nls/nls_ua.c
! 301: ])
! 302: PHP_MBSTRING_ADD_CFLAG([-DHAVE_CONFIG_H])
! 303: 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])
! 304: else
! 305: dnl
! 306: dnl External libmfl
! 307: dnl
! 308: for inc in include include/mbfl-1.0 include/mbfl; do
! 309: if test -f "$PHP_LIBMBFL/$inc/mbfilter.h"; then
! 310: PHP_LIBMBFL_INCLUDE="$inc"
! 311: break
! 312: fi
! 313: done
! 314:
! 315: if test -z "$PHP_LIBMBFL_INCLUDE"; then
! 316: AC_MSG_ERROR([mbfilter.h not found. Please reinstall libmbfl library.])
! 317: else
! 318: PHP_ADD_INCLUDE([$PHP_LIBMBFL_INCLUDE])
! 319: fi
! 320:
! 321: PHP_CHECK_LIBRARY(mbfl, mbfl_buffer_converter_new, [
! 322: PHP_ADD_LIBRARY_WITH_PATH(mbfl, $PHP_LIBMBFL/$PHP_LIBDIR, MBSTRING_SHARED_LIBADD)
! 323: ],[
! 324: AC_MSG_ERROR([Problem with libmbfl. Please check config.log for more information.])
! 325: ], [
! 326: -L$PHP_LIBMBFL/$PHP_LIBDIR
! 327: ])
! 328: fi
! 329: ])
! 330:
! 331: dnl
! 332: dnl Main config
! 333: dnl
! 334:
! 335: PHP_ARG_ENABLE(mbstring, whether to enable multibyte string support,
! 336: [ --enable-mbstring Enable multibyte string support])
! 337:
! 338: PHP_ARG_ENABLE([mbregex], [whether to enable multibyte regex support],
! 339: [ --disable-mbregex MBSTRING: Disable multibyte regex support], yes, no)
! 340:
! 341: PHP_ARG_ENABLE([mbregex_backtrack], [whether to check multibyte regex backtrack],
! 342: [ --disable-mbregex-backtrack
! 343: MBSTRING: Disable multibyte regex backtrack check], yes, no)
! 344:
! 345: PHP_ARG_WITH(libmbfl, [for external libmbfl],
! 346: [ --with-libmbfl[=DIR] MBSTRING: Use external libmbfl. DIR is the libmbfl base
! 347: install directory [BUNDLED]], no, no)
! 348:
! 349: PHP_ARG_WITH(onig, [for external oniguruma],
! 350: [ --with-onig[=DIR] MBSTRING: Use external oniguruma. DIR is the oniguruma install prefix.
! 351: If DIR is not set, the bundled oniguruma will be used], no, no)
! 352:
! 353: if test "$PHP_MBSTRING" != "no"; then
! 354: AC_DEFINE([HAVE_MBSTRING],1,[whether to have multibyte string support])
! 355:
! 356: PHP_MBSTRING_ADD_BASE_SOURCES([mbstring.c php_unicode.c mb_gpc.c])
! 357:
! 358: if test "$PHP_MBREGEX" != "no"; then
! 359: PHP_MBSTRING_SETUP_MBREGEX
! 360: fi
! 361:
! 362: dnl libmbfl is required
! 363: PHP_MBSTRING_SETUP_LIBMBFL
! 364: PHP_MBSTRING_EXTENSION
! 365: fi
! 366:
! 367: # vim600: sts=2 sw=2 et
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>