File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / ereg / config0.m4
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:37 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

dnl $Id: config0.m4,v 1.1.1.2 2012/05/29 12:34:37 misho Exp $
dnl config.m4 for extension ereg

dnl
dnl Check for regex library type
dnl
PHP_ARG_WITH(regex,,
[  --with-regex=TYPE       regex library type: system, php. [TYPE=php]
                          WARNING: Do NOT use unless you know what you are doing!], php, no)

case $PHP_REGEX in
  system)
    if test "$PHP_SAPI" = "apache" || test "$PHP_SAPI" = "apache2filter" || test "$PHP_SAPI" = "apache2handler"; then
      REGEX_TYPE=php
    else
      REGEX_TYPE=system
    fi
    ;;
  yes | php)
    REGEX_TYPE=php
    ;;
  *)
    REGEX_TYPE=php
    AC_MSG_WARN([Invalid regex library type selected. Using default value: php])
    ;;
esac

AC_MSG_CHECKING([which regex library to use])
AC_MSG_RESULT([$REGEX_TYPE])

if test "$REGEX_TYPE" = "php"; then
  ereg_regex_sources="regex/regcomp.c regex/regexec.c regex/regerror.c regex/regfree.c"
  ereg_regex_headers="regex/"
  PHP_EREG_CFLAGS="-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp"
fi

PHP_NEW_EXTENSION(ereg, ereg.c $ereg_regex_sources, no,,$PHP_EREG_CFLAGS)
PHP_INSTALL_HEADERS([ext/ereg], [php_ereg.h php_regex.h $ereg_regex_headers])

if test "$REGEX_TYPE" = "php"; then
  AC_DEFINE(HAVE_REGEX_T_RE_MAGIC, 1, [ ])
  AC_DEFINE(HSREGEX,1,[ ])
  AC_DEFINE(REGEX,1,[ ])  
  PHP_ADD_BUILD_DIR([$ext_builddir/regex], 1)
  PHP_ADD_INCLUDE([$ext_srcdir/regex])
elif test "$REGEX_TYPE" = "system"; then
  AC_DEFINE(REGEX,0,[ ])
  dnl Check if field re_magic exists in struct regex_t
  AC_CACHE_CHECK([whether field re_magic exists in struct regex_t], ac_cv_regex_t_re_magic, [
  AC_TRY_COMPILE([#include <sys/types.h>
#include <regex.h>], [regex_t rt; rt.re_magic;],
  [ac_cv_regex_t_re_magic=yes], [ac_cv_regex_t_re_magic=no])])
  if test "$ac_cv_regex_t_re_magic" = "yes"; then
    AC_DEFINE([HAVE_REGEX_T_RE_MAGIC], [ ], 1)   
  fi 
fi   

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>