- dnl
- dnl HTTP_SHARED_DEP(name[, code-if-yes[, code-if-not]])
- dnl
- AC_DEFUN([HTTP_SHARED_DEP], [
- extname=$1
- haveext=$[PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)
-
- AC_MSG_CHECKING([whether to add a dependency on ext/$extname])
- if test "$PHP_HTTP_SHARED_DEPS" = "no"; then
- AC_MSG_RESULT([no])
- $3
- elif test "$haveext"; then
- AC_MSG_RESULT([yes])
- AC_DEFINE([PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__), [1], [ ])
- ifdef([PHP_ADD_EXTENSION_DEP], [
- PHP_ADD_EXTENSION_DEP([http], $1, true)
- ])
- $2
- else
- AC_MSG_RESULT([no])
- $3
- fi
- ])
-
- dnl
- dnl HTTP_HAVE_PHP_EXT(name[, code-if-yes[, code-if-not]])
- dnl
- AC_DEFUN([HTTP_HAVE_PHP_EXT], [
- extname=$1
- haveext=$[PHP_]translit($1,a-z_-,A-Z__)
- AC_MSG_CHECKING([for ext/$extname support])
- if test -x "$PHP_EXECUTABLE"; then
- grepext=`$PHP_EXECUTABLE -m | $EGREP ^$extname\$`
- if test "$grepext" = "$extname"; then
- [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=1
- AC_MSG_RESULT([yes])
- $2
- else
- [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=
- AC_MSG_RESULT([no])
- $3
- fi
- elif test "$haveext" != "no" && test "x$haveext" != "x"; then
- [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=1
- AC_MSG_RESULT([yes])
- $2
- else
- [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=
- AC_MSG_RESULT([no])
- $3
- fi
- ])
-
- dnl
- dnl HTTP_HAVE_VERSION(name, min-version[, code-if-yes[, code-if-not]])
- dnl
- AC_DEFUN([HTTP_HAVE_VERSION], [
- aversion=$(printf "%s" "$AS_TR_CPP([PHP_HTTP_]$1[_VERSION])" | $AWK '{print $[]1*1000000 + $[]2*10000 + $[]3*100 + $[]4}')
- mversion=$(printf "%s" "$2" | $AWK '{print $[]1*1000000 + $[]2*10000 + $[]3*100 + $[]4}')
- AC_MSG_CHECKING([whether $1 version $]AS_TR_CPP([PHP_HTTP_]$1[_VERSION])[ is at least $2])
- if test "$aversion" -lt "$mversion"; then
- ifelse($4,,AC_MSG_ERROR([$1 minimum version $mversion required; got $aversion]), [
- AC_MSG_RESULT([no])
- $4
- ])
- else
- AC_MSG_RESULT([ok])
- $3
- fi
- ])
-
- dnl
- dnl HTTP_CHECK_CUSTOM(name, path, header, lib, version)
- dnl
- AC_DEFUN([HTTP_CHECK_CUSTOM], [
- save_CPPFLAGS=$CPPFLAGS
- save_LDFLAGS=$LDFLAGS
- save_LIBS=$LIBS
-
- for path in $2 /usr/local /usr /opt; do
- if test "$path" = "" || test "$path" = "yes" || test "$path" = "no"; then
- continue
- fi
- AC_MSG_CHECKING([for $1 in $path])
- if test -f "$path/include/$3"; then
- CPPFLAGS="-I$path"
- LDFLAGS="-L$path"
- LIBS="-l$4"
-
- AS_TR_CPP([PHP_HTTP_][$1][_VERSION])=$5
- AC_MSG_RESULT([${AS_TR_CPP([PHP_HTTP_][$1][_VERSION]):-no}])
- AC_DEFINE_UNQUOTED(AS_TR_CPP([PHP_HTTP_][$1][_VERSION]), "$AS_TR_CPP([PHP_HTTP_][$1][_VERSION])", [ ])
- break
- fi
- AC_MSG_RESULT([no])
- done
- ])
-
- dnl
- dnl HTTP_CHECK_CONFIG(name, prog-config, version-flag, cppflags-flag, ldflags-flag, libs-flag)
- dnl
- AC_DEFUN([HTTP_CHECK_CONFIG], [
- AC_MSG_CHECKING([for $1])
-
- save_CPPFLAGS=$CPPFLAGS
- save_LDFLAGS=$LDFLAGS
- save_LIBS=$LIBS
- AS_TR_CPP([PHP_HTTP_][$1][_VERSION])=$($2 $3)
- CPPFLAGS=$($2 $4)
- LDFLAGS=$($2 $5)
- LIBS=$($2 $6)
-
- AC_MSG_RESULT([${AS_TR_CPP([PHP_HTTP_][$1][_VERSION]):-no}])
- AC_DEFINE_UNQUOTED(AS_TR_CPP([PHP_HTTP_][$1][_VERSION]), "$AS_TR_CPP([PHP_HTTP_][$1][_VERSION])", [ ])
- ])
-
- dnl
- dnl HTTP_CHECK_PKGCONFIG(pkg[, pkg_config_path])
- dnl
- AC_DEFUN([HTTP_CHECK_PKGCONFIG], [
- ifelse($2,,,PKG_CONFIG_PATH="$2/lib/pkgconfig:$PKG_CONFIG_PATH")
- if $($PKG_CONFIG $1 --exists); then
- AS_TR_CPP([PHP_HTTP_HAVE_$1])=true
- HTTP_CHECK_CONFIG([$1], [$PKG_CONFIG $1], [--modversion], [--cflags-only-I], [--libs-only-L], [--libs-only-l])
- else
- AS_TR_CPP([PHP_HTTP_HAVE_$1])=false
- fi
- ])
-
- dnl
- dnl HTTP_CHECK_DONE(name, success[, incline, libline])
- AC_DEFUN([HTTP_CHECK_DONE], [
- if $2; then
- incline=$CPPFLAGS
- libline="$LDFLAGS $LIBS"
- AC_DEFINE(AS_TR_CPP([PHP_HTTP_HAVE_$1]), [1], [ ])
- else
- incline=$3
- libline=$4