2015-11-12 04:08:15 +08:00
|
|
|
dnl This file becomes configure.ac for self-contained extensions.
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2018-10-10 03:06:10 +08:00
|
|
|
AC_PREREQ([2.68])
|
2002-03-07 22:20:02 +08:00
|
|
|
AC_INIT(config.m4)
|
2011-06-08 09:25:35 +08:00
|
|
|
ifdef([AC_PRESERVE_HELP_ORDER], [AC_PRESERVE_HELP_ORDER], [])
|
2002-03-07 22:20:02 +08:00
|
|
|
|
2005-05-27 21:15:47 +08:00
|
|
|
PHP_CONFIG_NICE(config.nice)
|
|
|
|
|
2018-07-29 09:43:45 +08:00
|
|
|
dnl
|
2004-12-30 15:08:39 +08:00
|
|
|
AC_DEFUN([PHP_EXT_BUILDDIR],[.])dnl
|
|
|
|
AC_DEFUN([PHP_EXT_DIR],[""])dnl
|
|
|
|
AC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir])dnl
|
|
|
|
AC_DEFUN([PHP_ALWAYS_SHARED],[
|
2002-03-13 20:30:49 +08:00
|
|
|
ext_output="yes, shared"
|
|
|
|
ext_shared=yes
|
|
|
|
test "[$]$1" = "no" && $1=yes
|
|
|
|
])dnl
|
2002-03-13 17:20:49 +08:00
|
|
|
dnl
|
2008-12-04 03:52:59 +08:00
|
|
|
|
|
|
|
test -z "$CFLAGS" && auto_cflags=1
|
|
|
|
|
2000-05-03 05:20:56 +08:00
|
|
|
abs_srcdir=`(cd $srcdir && pwd)`
|
2002-03-07 22:20:02 +08:00
|
|
|
abs_builddir=`pwd`
|
2000-05-03 05:20:56 +08:00
|
|
|
|
2008-12-04 03:52:59 +08:00
|
|
|
AC_PROG_CC([cc gcc])
|
2008-07-31 07:56:05 +08:00
|
|
|
PHP_DETECT_ICC
|
2008-12-04 03:52:59 +08:00
|
|
|
PHP_DETECT_SUNCC
|
1999-12-30 10:59:53 +08:00
|
|
|
AC_PROG_CC_C_O
|
|
|
|
|
2005-01-20 08:54:18 +08:00
|
|
|
dnl Support systems with system libraries in e.g. /usr/lib64
|
2007-07-18 23:04:22 +08:00
|
|
|
PHP_ARG_WITH(libdir, for system library directory,
|
|
|
|
[ --with-libdir=NAME Look for libraries in .../NAME rather than .../lib], lib, no)
|
2005-01-20 08:54:18 +08:00
|
|
|
|
2002-10-17 13:05:01 +08:00
|
|
|
PHP_RUNPATH_SWITCH
|
2006-04-10 20:16:17 +08:00
|
|
|
PHP_SHLIB_SUFFIX_NAMES
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2007-07-18 23:04:22 +08:00
|
|
|
dnl Find php-config script
|
2007-07-25 17:41:06 +08:00
|
|
|
PHP_ARG_WITH(php-config,,
|
2007-07-18 23:04:22 +08:00
|
|
|
[ --with-php-config=PATH Path to php-config [php-config]], php-config, no)
|
2002-03-07 22:20:02 +08:00
|
|
|
|
2007-08-14 16:43:41 +08:00
|
|
|
dnl For BC
|
|
|
|
PHP_CONFIG=$PHP_PHP_CONFIG
|
|
|
|
prefix=`$PHP_CONFIG --prefix 2>/dev/null`
|
|
|
|
phpincludedir=`$PHP_CONFIG --include-dir 2>/dev/null`
|
|
|
|
INCLUDES=`$PHP_CONFIG --includes 2>/dev/null`
|
|
|
|
EXTENSION_DIR=`$PHP_CONFIG --extension-dir 2>/dev/null`
|
|
|
|
PHP_EXECUTABLE=`$PHP_CONFIG --php-binary 2>/dev/null`
|
2018-07-29 09:43:45 +08:00
|
|
|
|
2007-07-18 23:04:22 +08:00
|
|
|
if test -z "$prefix"; then
|
|
|
|
AC_MSG_ERROR([Cannot find php-config. Please use --with-php-config=PATH])
|
|
|
|
fi
|
|
|
|
|
|
|
|
php_shtool=$srcdir/build/shtool
|
|
|
|
PHP_INIT_BUILD_SYSTEM
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for PHP prefix])
|
|
|
|
AC_MSG_RESULT([$prefix])
|
|
|
|
AC_MSG_CHECKING([for PHP includes])
|
|
|
|
AC_MSG_RESULT([$INCLUDES])
|
|
|
|
AC_MSG_CHECKING([for PHP extension directory])
|
|
|
|
AC_MSG_RESULT([$EXTENSION_DIR])
|
|
|
|
AC_MSG_CHECKING([for PHP installed headers prefix])
|
|
|
|
AC_MSG_RESULT([$phpincludedir])
|
|
|
|
|
2008-07-31 08:45:17 +08:00
|
|
|
dnl Checks for PHP_DEBUG / ZEND_DEBUG / ZTS
|
2008-07-31 07:56:05 +08:00
|
|
|
AC_MSG_CHECKING([if debug is enabled])
|
|
|
|
old_CPPFLAGS=$CPPFLAGS
|
|
|
|
CPPFLAGS="-I$phpincludedir"
|
|
|
|
AC_EGREP_CPP(php_debug_is_enabled,[
|
|
|
|
#include <main/php_config.h>
|
|
|
|
#if ZEND_DEBUG
|
|
|
|
php_debug_is_enabled
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
PHP_DEBUG=yes
|
|
|
|
],[
|
|
|
|
PHP_DEBUG=no
|
|
|
|
])
|
2009-06-03 03:54:03 +08:00
|
|
|
CPPFLAGS=$old_CPPFLAGS
|
2008-07-31 08:45:17 +08:00
|
|
|
AC_MSG_RESULT([$PHP_DEBUG])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if zts is enabled])
|
|
|
|
old_CPPFLAGS=$CPPFLAGS
|
|
|
|
CPPFLAGS="-I$phpincludedir"
|
|
|
|
AC_EGREP_CPP(php_zts_is_enabled,[
|
|
|
|
#include <main/php_config.h>
|
|
|
|
#if ZTS
|
|
|
|
php_zts_is_enabled
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
PHP_THREAD_SAFETY=yes
|
|
|
|
],[
|
|
|
|
PHP_THREAD_SAFETY=no
|
|
|
|
])
|
2008-07-31 07:56:05 +08:00
|
|
|
CPPFLAGS=$old_CPPFLAGS
|
2015-05-12 17:32:01 +08:00
|
|
|
AC_MSG_RESULT([$PHP_THREAD_SAFETY])
|
2008-07-31 07:56:05 +08:00
|
|
|
|
2008-07-31 08:45:17 +08:00
|
|
|
dnl Support for building and testing Zend extensions
|
2009-05-19 05:33:38 +08:00
|
|
|
ZEND_EXT_TYPE="zend_extension"
|
2008-07-31 08:45:17 +08:00
|
|
|
PHP_SUBST(ZEND_EXT_TYPE)
|
|
|
|
|
|
|
|
dnl Discard optimization flags when debugging is enabled
|
2008-07-31 07:56:05 +08:00
|
|
|
if test "$PHP_DEBUG" = "yes"; then
|
|
|
|
PHP_DEBUG=1
|
|
|
|
ZEND_DEBUG=yes
|
|
|
|
changequote({,})
|
|
|
|
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
|
|
|
|
CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
|
|
|
|
changequote([,])
|
|
|
|
dnl add -O0 only if GCC or ICC is used
|
|
|
|
if test "$GCC" = "yes" || test "$ICC" = "yes"; then
|
|
|
|
CFLAGS="$CFLAGS -O0"
|
2010-11-02 17:58:08 +08:00
|
|
|
CXXFLAGS="$CXXFLAGS -g -O0"
|
2008-07-31 07:56:05 +08:00
|
|
|
fi
|
2008-12-04 03:52:59 +08:00
|
|
|
if test "$SUNCC" = "yes"; then
|
|
|
|
if test -n "$auto_cflags"; then
|
|
|
|
CFLAGS="-g"
|
|
|
|
CXXFLAGS="-g"
|
|
|
|
else
|
|
|
|
CFLAGS="$CFLAGS -g"
|
|
|
|
CXXFLAGS="$CFLAGS -g"
|
|
|
|
fi
|
|
|
|
fi
|
2008-07-31 07:56:05 +08:00
|
|
|
else
|
|
|
|
PHP_DEBUG=0
|
|
|
|
ZEND_DEBUG=no
|
|
|
|
fi
|
|
|
|
|
2007-07-18 23:04:22 +08:00
|
|
|
dnl Always shared
|
|
|
|
PHP_BUILD_SHARED
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2007-07-18 23:04:22 +08:00
|
|
|
dnl Required programs
|
2003-09-03 03:42:17 +08:00
|
|
|
PHP_PROG_RE2C
|
2005-02-25 02:11:36 +08:00
|
|
|
PHP_PROG_AWK
|
2008-07-31 06:55:08 +08:00
|
|
|
|
1999-12-30 10:59:53 +08:00
|
|
|
sinclude(config.m4)
|
|
|
|
|
|
|
|
enable_static=no
|
|
|
|
enable_shared=yes
|
|
|
|
|
2008-07-25 20:36:34 +08:00
|
|
|
dnl Only allow AC_PROG_CXX and AC_PROG_CXXCPP if they are explicitly called (by PHP_REQUIRE_CXX).
|
|
|
|
dnl Otherwise AC_PROG_LIBTOOL fails if there is no working C++ compiler.
|
|
|
|
AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [
|
|
|
|
undefine([AC_PROG_CXX])
|
|
|
|
AC_DEFUN([AC_PROG_CXX], [])
|
|
|
|
undefine([AC_PROG_CXXCPP])
|
2008-07-28 04:43:40 +08:00
|
|
|
AC_DEFUN([AC_PROG_CXXCPP], [php_prog_cxxcpp=disabled])
|
2008-07-25 20:36:34 +08:00
|
|
|
])
|
1999-12-30 10:59:53 +08:00
|
|
|
AC_PROG_LIBTOOL
|
|
|
|
|
2008-07-31 08:45:17 +08:00
|
|
|
all_targets='$(PHP_MODULES) $(PHP_ZEND_EX)'
|
2005-11-22 07:08:02 +08:00
|
|
|
install_targets="install-modules install-headers"
|
1999-12-30 10:59:53 +08:00
|
|
|
phplibdir="`pwd`/modules"
|
2001-05-20 13:29:54 +08:00
|
|
|
CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
|
2003-09-03 16:08:12 +08:00
|
|
|
CFLAGS_CLEAN='$(CFLAGS)'
|
2007-06-01 23:12:29 +08:00
|
|
|
CXXFLAGS_CLEAN='$(CXXFLAGS)'
|
1999-12-30 10:59:53 +08:00
|
|
|
|
|
|
|
test "$prefix" = "NONE" && prefix="/usr/local"
|
|
|
|
test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
|
|
|
|
|
2002-03-07 22:20:02 +08:00
|
|
|
PHP_SUBST(PHP_MODULES)
|
2008-07-31 08:45:17 +08:00
|
|
|
PHP_SUBST(PHP_ZEND_EX)
|
|
|
|
|
2002-03-07 22:20:02 +08:00
|
|
|
PHP_SUBST(all_targets)
|
|
|
|
PHP_SUBST(install_targets)
|
|
|
|
|
1999-12-30 10:59:53 +08:00
|
|
|
PHP_SUBST(prefix)
|
|
|
|
PHP_SUBST(exec_prefix)
|
|
|
|
PHP_SUBST(libdir)
|
|
|
|
PHP_SUBST(prefix)
|
|
|
|
PHP_SUBST(phplibdir)
|
2005-11-22 07:08:02 +08:00
|
|
|
PHP_SUBST(phpincludedir)
|
1999-12-30 10:59:53 +08:00
|
|
|
|
|
|
|
PHP_SUBST(CC)
|
|
|
|
PHP_SUBST(CFLAGS)
|
2002-12-16 21:39:27 +08:00
|
|
|
PHP_SUBST(CFLAGS_CLEAN)
|
1999-12-30 10:59:53 +08:00
|
|
|
PHP_SUBST(CPP)
|
|
|
|
PHP_SUBST(CPPFLAGS)
|
|
|
|
PHP_SUBST(CXX)
|
2005-03-04 22:34:24 +08:00
|
|
|
PHP_SUBST(CXXFLAGS)
|
2007-06-01 23:12:29 +08:00
|
|
|
PHP_SUBST(CXXFLAGS_CLEAN)
|
2000-05-03 04:10:46 +08:00
|
|
|
PHP_SUBST(EXTENSION_DIR)
|
2005-08-09 00:06:49 +08:00
|
|
|
PHP_SUBST(PHP_EXECUTABLE)
|
1999-12-30 10:59:53 +08:00
|
|
|
PHP_SUBST(EXTRA_LDFLAGS)
|
|
|
|
PHP_SUBST(EXTRA_LIBS)
|
|
|
|
PHP_SUBST(INCLUDES)
|
|
|
|
PHP_SUBST(LFLAGS)
|
2002-03-20 10:07:11 +08:00
|
|
|
PHP_SUBST(LDFLAGS)
|
2000-05-03 04:10:46 +08:00
|
|
|
PHP_SUBST(SHARED_LIBTOOL)
|
1999-12-30 10:59:53 +08:00
|
|
|
PHP_SUBST(LIBTOOL)
|
|
|
|
PHP_SUBST(SHELL)
|
2005-11-22 07:08:02 +08:00
|
|
|
PHP_SUBST(INSTALL_HEADERS)
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2002-03-07 22:20:02 +08:00
|
|
|
PHP_GEN_BUILD_DIRS
|
|
|
|
PHP_GEN_GLOBAL_MAKEFILE
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2005-05-07 10:51:53 +08:00
|
|
|
test -d modules || $php_shtool mkdir modules
|
2000-05-03 04:56:03 +08:00
|
|
|
touch .deps
|
2000-05-03 04:10:46 +08:00
|
|
|
|
2018-07-05 09:06:06 +08:00
|
|
|
AC_CONFIG_HEADERS([config.h])
|
1999-12-30 10:59:53 +08:00
|
|
|
|
2018-07-29 05:09:06 +08:00
|
|
|
AC_OUTPUT
|