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