1dnl 2dnl $Id$ 3dnl 4 5dnl By default we'll compile and link against the bundled PCRE library 6dnl if DIR is supplied, we'll use that for linking 7 8PHP_ARG_WITH(pcre-regex,, 9[ --with-pcre-regex=DIR Include Perl Compatible Regular Expressions support. 10 DIR is the PCRE install prefix [BUNDLED]], yes, no) 11 12PHP_ARG_WITH(pcre-jit,,[ --with-pcre-jit Enable PCRE JIT functionality (BUNDLED only)], yes, no) 13 14 if test "$PHP_PCRE_REGEX" != "yes" && test "$PHP_PCRE_REGEX" != "no"; then 15 AC_MSG_CHECKING([for PCRE headers location]) 16 for i in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/include $PHP_PCRE_REGEX/include/pcre $PHP_PCRE_REGEX/local/include; do 17 test -f $i/pcre.h && PCRE_INCDIR=$i 18 done 19 20 if test -z "$PCRE_INCDIR"; then 21 AC_MSG_ERROR([Could not find pcre.h in $PHP_PCRE_REGEX]) 22 fi 23 AC_MSG_RESULT([$PCRE_INCDIR]) 24 25 AC_MSG_CHECKING([for PCRE library location]) 26 for j in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/$PHP_LIBDIR; do 27 test -f $j/libpcre.a || test -f $j/libpcre.$SHLIB_SUFFIX_NAME && PCRE_LIBDIR=$j 28 done 29 30 if test -z "$PCRE_LIBDIR" ; then 31 AC_MSG_ERROR([Could not find libpcre.(a|$SHLIB_SUFFIX_NAME) in $PHP_PCRE_REGEX]) 32 fi 33 AC_MSG_RESULT([$PCRE_LIBDIR]) 34 35 changequote({,}) 36 pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'` 37 pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'` 38 changequote([,]) 39 pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'` 40 if test "$pcre_minor_length" -eq 2 ; then 41 pcre_minor="$pcre_minor"0 42 fi 43 pcre_version=$pcre_major$pcre_minor 44 if test "$pcre_version" -lt 660; then 45 AC_MSG_ERROR([The PCRE extension requires PCRE library version >= 6.6]) 46 fi 47 48 PHP_CHECK_LIBRARY(pcre, pcre_jit_exec, 49 [ 50 AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ]) 51 ],[ 52 ],[ 53 -L$PCRE_LIBDIR 54 ]) 55 PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR) 56 57 AC_DEFINE(HAVE_PCRE, 1, [ ]) 58 PHP_ADD_INCLUDE($PCRE_INCDIR) 59 PHP_NEW_EXTENSION(pcre, php_pcre.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) 60 PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h]) 61 else 62 AC_MSG_CHECKING([for PCRE library to use]) 63 AC_MSG_RESULT([bundled]) 64 pcrelib_sources="pcrelib/pcre_chartables.c pcrelib/pcre_ucd.c \ 65 pcrelib/pcre_compile.c pcrelib/pcre_config.c pcrelib/pcre_exec.c \ 66 pcrelib/pcre_fullinfo.c pcrelib/pcre_get.c pcrelib/pcre_globals.c \ 67 pcrelib/pcre_maketables.c pcrelib/pcre_newline.c \ 68 pcrelib/pcre_ord2utf8.c pcrelib/pcre_refcount.c pcrelib/pcre_study.c \ 69 pcrelib/pcre_tables.c pcrelib/pcre_valid_utf8.c \ 70 pcrelib/pcre_version.c pcrelib/pcre_xclass.c \ 71 pcrelib/pcre_jit_compile.c" 72 PHP_PCRE_CFLAGS="-DHAVE_CONFIG_H -I@ext_srcdir@/pcrelib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1" 73 PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS) 74 PHP_ADD_BUILD_DIR($ext_builddir/pcrelib) 75 PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcrelib/]) 76 AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ]) 77 78 if test "$PHP_PCRE_REGEX" != "no"; then 79 AC_MSG_CHECKING([whether to enable PCRE JIT functionality]) 80 if test "$PHP_PCRE_JIT" != "no"; then 81 AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ]) 82 AC_MSG_RESULT([yes]) 83 else 84 AC_MSG_RESULT([no]) 85 fi 86 fi 87 fi 88 89PHP_ARG_WITH(pcre-valgrind,,[ --with-pcre-valgrind=DIR 90 Enable PCRE valgrind support. Developers only!], no, no) 91 if test "$PHP_PCRE_REGEX" != "yes" && test "$PHP_PCRE_REGEX" != "no"; then 92 AC_MSG_WARN([PHP is going to be linked with an external PCRE, --with-pcre-valgrind has no effect]) 93 else 94 if test "$PHP_PCRE_VALGRIND" != "no"; then 95 PHP_PCRE_VALGRIND_INCDIR= 96 AC_MSG_CHECKING([for Valgrind headers location]) 97 for i in $PHP_PCRE_VALGRIND $PHP_PCRE_VALGRIND/include $PHP_PCRE_VALGRIND/local/include /usr/include /usr/local/include; do 98 if test -f $i/valgrind/memcheck.h 99 then 100 PHP_PCRE_VALGRIND_INCDIR=$i 101 break 102 fi 103 done 104 if test -z "$PHP_PCRE_VALGRIND_INCDIR" 105 then 106 AC_MSG_ERROR([Could not find valgrind/memcheck.h]) 107 else 108 AC_DEFINE(HAVE_PCRE_VALGRIND_SUPPORT, 1, [ ]) 109 PHP_ADD_INCLUDE($PHP_PCRE_VALGRIND_INCDIR) 110 AC_MSG_RESULT([$PHP_PCRE_VALGRIND_INCDIR]) 111 fi 112 fi 113 fi 114