1dnl This file becomes configure.in for self-contained extensions. 2 3AC_PREREQ(2.59) 4AC_INIT(config.m4) 5ifdef([AC_PRESERVE_HELP_ORDER], [AC_PRESERVE_HELP_ORDER], []) 6 7PHP_CONFIG_NICE(config.nice) 8 9dnl 10AC_DEFUN([PHP_EXT_BUILDDIR],[.])dnl 11AC_DEFUN([PHP_EXT_DIR],[""])dnl 12AC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir])dnl 13AC_DEFUN([PHP_ALWAYS_SHARED],[ 14 ext_output="yes, shared" 15 ext_shared=yes 16 test "[$]$1" = "no" && $1=yes 17])dnl 18dnl 19 20test -z "$CFLAGS" && auto_cflags=1 21 22abs_srcdir=`(cd $srcdir && pwd)` 23abs_builddir=`pwd` 24 25AC_PROG_CC([cc gcc]) 26PHP_DETECT_ICC 27PHP_DETECT_SUNCC 28AC_PROG_CC_C_O 29 30dnl Support systems with system libraries in e.g. /usr/lib64 31PHP_ARG_WITH(libdir, for system library directory, 32[ --with-libdir=NAME Look for libraries in .../NAME rather than .../lib], lib, no) 33 34PHP_RUNPATH_SWITCH 35PHP_SHLIB_SUFFIX_NAMES 36 37dnl Find php-config script 38PHP_ARG_WITH(php-config,, 39[ --with-php-config=PATH Path to php-config [php-config]], php-config, no) 40 41dnl For BC 42PHP_CONFIG=$PHP_PHP_CONFIG 43prefix=`$PHP_CONFIG --prefix 2>/dev/null` 44phpincludedir=`$PHP_CONFIG --include-dir 2>/dev/null` 45INCLUDES=`$PHP_CONFIG --includes 2>/dev/null` 46EXTENSION_DIR=`$PHP_CONFIG --extension-dir 2>/dev/null` 47PHP_EXECUTABLE=`$PHP_CONFIG --php-binary 2>/dev/null` 48 49if test -z "$prefix"; then 50 AC_MSG_ERROR([Cannot find php-config. Please use --with-php-config=PATH]) 51fi 52 53php_shtool=$srcdir/build/shtool 54PHP_INIT_BUILD_SYSTEM 55 56AC_MSG_CHECKING([for PHP prefix]) 57AC_MSG_RESULT([$prefix]) 58AC_MSG_CHECKING([for PHP includes]) 59AC_MSG_RESULT([$INCLUDES]) 60AC_MSG_CHECKING([for PHP extension directory]) 61AC_MSG_RESULT([$EXTENSION_DIR]) 62AC_MSG_CHECKING([for PHP installed headers prefix]) 63AC_MSG_RESULT([$phpincludedir]) 64 65dnl Checks for PHP_DEBUG / ZEND_DEBUG / ZTS 66AC_MSG_CHECKING([if debug is enabled]) 67old_CPPFLAGS=$CPPFLAGS 68CPPFLAGS="-I$phpincludedir" 69AC_EGREP_CPP(php_debug_is_enabled,[ 70#include <main/php_config.h> 71#if ZEND_DEBUG 72php_debug_is_enabled 73#endif 74],[ 75 PHP_DEBUG=yes 76],[ 77 PHP_DEBUG=no 78]) 79CPPFLAGS=$old_CPPFLAGS 80AC_MSG_RESULT([$PHP_DEBUG]) 81 82AC_MSG_CHECKING([if zts is enabled]) 83old_CPPFLAGS=$CPPFLAGS 84CPPFLAGS="-I$phpincludedir" 85AC_EGREP_CPP(php_zts_is_enabled,[ 86#include <main/php_config.h> 87#if ZTS 88php_zts_is_enabled 89#endif 90],[ 91 PHP_THREAD_SAFETY=yes 92],[ 93 PHP_THREAD_SAFETY=no 94]) 95CPPFLAGS=$old_CPPFLAGS 96AC_MSG_RESULT([$PHP_THREAD_SAFETY]) 97 98dnl Support for building and testing Zend extensions 99ZEND_EXT_TYPE="zend_extension" 100PHP_SUBST(ZEND_EXT_TYPE) 101 102dnl Discard optimization flags when debugging is enabled 103if test "$PHP_DEBUG" = "yes"; then 104 PHP_DEBUG=1 105 ZEND_DEBUG=yes 106 changequote({,}) 107 CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'` 108 CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'` 109 changequote([,]) 110 dnl add -O0 only if GCC or ICC is used 111 if test "$GCC" = "yes" || test "$ICC" = "yes"; then 112 CFLAGS="$CFLAGS -O0" 113 CXXFLAGS="$CXXFLAGS -g -O0" 114 fi 115 if test "$SUNCC" = "yes"; then 116 if test -n "$auto_cflags"; then 117 CFLAGS="-g" 118 CXXFLAGS="-g" 119 else 120 CFLAGS="$CFLAGS -g" 121 CXXFLAGS="$CFLAGS -g" 122 fi 123 fi 124else 125 PHP_DEBUG=0 126 ZEND_DEBUG=no 127fi 128 129dnl Always shared 130PHP_BUILD_SHARED 131 132dnl Required programs 133PHP_PROG_RE2C 134PHP_PROG_AWK 135 136sinclude(config.m4) 137 138enable_static=no 139enable_shared=yes 140 141dnl Only allow AC_PROG_CXX and AC_PROG_CXXCPP if they are explicitly called (by PHP_REQUIRE_CXX). 142dnl Otherwise AC_PROG_LIBTOOL fails if there is no working C++ compiler. 143AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [ 144 undefine([AC_PROG_CXX]) 145 AC_DEFUN([AC_PROG_CXX], []) 146 undefine([AC_PROG_CXXCPP]) 147 AC_DEFUN([AC_PROG_CXXCPP], [php_prog_cxxcpp=disabled]) 148]) 149AC_PROG_LIBTOOL 150 151all_targets='$(PHP_MODULES) $(PHP_ZEND_EX)' 152install_targets="install-modules install-headers" 153phplibdir="`pwd`/modules" 154CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H" 155CFLAGS_CLEAN='$(CFLAGS)' 156CXXFLAGS_CLEAN='$(CXXFLAGS)' 157 158test "$prefix" = "NONE" && prefix="/usr/local" 159test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)' 160 161PHP_SUBST(PHP_MODULES) 162PHP_SUBST(PHP_ZEND_EX) 163 164PHP_SUBST(all_targets) 165PHP_SUBST(install_targets) 166 167PHP_SUBST(prefix) 168PHP_SUBST(exec_prefix) 169PHP_SUBST(libdir) 170PHP_SUBST(prefix) 171PHP_SUBST(phplibdir) 172PHP_SUBST(phpincludedir) 173 174PHP_SUBST(CC) 175PHP_SUBST(CFLAGS) 176PHP_SUBST(CFLAGS_CLEAN) 177PHP_SUBST(CPP) 178PHP_SUBST(CPPFLAGS) 179PHP_SUBST(CXX) 180PHP_SUBST(CXXFLAGS) 181PHP_SUBST(CXXFLAGS_CLEAN) 182PHP_SUBST(EXTENSION_DIR) 183PHP_SUBST(PHP_EXECUTABLE) 184PHP_SUBST(EXTRA_LDFLAGS) 185PHP_SUBST(EXTRA_LIBS) 186PHP_SUBST(INCLUDES) 187PHP_SUBST(LFLAGS) 188PHP_SUBST(LDFLAGS) 189PHP_SUBST(SHARED_LIBTOOL) 190PHP_SUBST(LIBTOOL) 191PHP_SUBST(SHELL) 192PHP_SUBST(INSTALL_HEADERS) 193 194PHP_GEN_BUILD_DIRS 195PHP_GEN_GLOBAL_MAKEFILE 196 197test -d modules || $php_shtool mkdir modules 198touch .deps 199 200AC_CONFIG_HEADER(config.h) 201 202AC_OUTPUT() 203