source: trunk/server/common/oursrc/php_scripts/test/configure.in @ 1137

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