fix php compilation when mysql is enabled
[tomato.git] / release / src / router / php / ext / mysqlnd / configure.in
blobd745ca744381eaaa39a3ba6040212df79bb0dc74
1 dnl This file becomes configure.in for self-contained extensions.
3 AC_PREREQ(2.59)
4 AC_INIT(config.m4)
5 ifdef([AC_PRESERVE_HELP_ORDER], [AC_PRESERVE_HELP_ORDER], [])
7 PHP_CONFIG_NICE(config.nice)
9 dnl 
10 AC_DEFUN([PHP_EXT_BUILDDIR],[.])dnl
11 AC_DEFUN([PHP_EXT_DIR],[""])dnl
12 AC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir])dnl
13 AC_DEFUN([PHP_ALWAYS_SHARED],[
14   ext_output="yes, shared"
15   ext_shared=yes
16   test "[$]$1" = "no" && $1=yes
17 ])dnl
18 dnl
20 test -z "$CFLAGS" && auto_cflags=1
22 abs_srcdir=`(cd $srcdir && pwd)`
23 abs_builddir=`pwd`
25 AC_PROG_CC([cc gcc])
26 PHP_DETECT_ICC
27 PHP_DETECT_SUNCC
28 AC_PROG_CC_C_O
30 dnl Support systems with system libraries in e.g. /usr/lib64
31 PHP_ARG_WITH(libdir, for system library directory,
32 [  --with-libdir=NAME      Look for libraries in .../NAME rather than .../lib], lib, no)
34 PHP_RUNPATH_SWITCH
35 PHP_SHLIB_SUFFIX_NAMES
37 dnl Find php-config script
38 PHP_ARG_WITH(php-config,,
39 [  --with-php-config=PATH  Path to php-config [php-config]], php-config, no)
41 dnl For BC
42 PHP_CONFIG=$PHP_PHP_CONFIG
43 prefix=`$PHP_CONFIG --prefix 2>/dev/null`
44 phpincludedir=`$PHP_CONFIG --include-dir 2>/dev/null`
45 INCLUDES=`$PHP_CONFIG --includes 2>/dev/null`
46 EXTENSION_DIR=`$PHP_CONFIG --extension-dir 2>/dev/null`
47 PHP_EXECUTABLE=`$PHP_CONFIG --php-binary 2>/dev/null`
49 if test -z "$prefix"; then
50   AC_MSG_ERROR([Cannot find php-config. Please use --with-php-config=PATH])
53 php_shtool=$srcdir/build/shtool
54 PHP_INIT_BUILD_SYSTEM
56 AC_MSG_CHECKING([for PHP prefix])
57 AC_MSG_RESULT([$prefix])
58 AC_MSG_CHECKING([for PHP includes])
59 AC_MSG_RESULT([$INCLUDES])
60 AC_MSG_CHECKING([for PHP extension directory])
61 AC_MSG_RESULT([$EXTENSION_DIR])
62 AC_MSG_CHECKING([for PHP installed headers prefix])
63 AC_MSG_RESULT([$phpincludedir])
65 dnl Checks for PHP_DEBUG / ZEND_DEBUG / ZTS
66 AC_MSG_CHECKING([if debug is enabled])
67 old_CPPFLAGS=$CPPFLAGS
68 CPPFLAGS="-I$phpincludedir"
69 AC_EGREP_CPP(php_debug_is_enabled,[
70 #include <main/php_config.h>
71 #if ZEND_DEBUG
72 php_debug_is_enabled
73 #endif
74 ],[
75   PHP_DEBUG=yes
76 ],[
77   PHP_DEBUG=no
79 CPPFLAGS=$old_CPPFLAGS
80 AC_MSG_RESULT([$PHP_DEBUG])
82 AC_MSG_CHECKING([if zts is enabled])
83 old_CPPFLAGS=$CPPFLAGS
84 CPPFLAGS="-I$phpincludedir"
85 AC_EGREP_CPP(php_zts_is_enabled,[
86 #include <main/php_config.h>
87 #if ZTS
88 php_zts_is_enabled
89 #endif
90 ],[
91   PHP_THREAD_SAFETY=yes
92 ],[
93   PHP_THREAD_SAFETY=no
95 CPPFLAGS=$old_CPPFLAGS
96 AC_MSG_RESULT([$PHP_DEBUG])
98 dnl Support for building and testing Zend extensions
99 ZEND_EXT_TYPE="zend_extension"
100 PHP_SUBST(ZEND_EXT_TYPE)
102 dnl Discard optimization flags when debugging is enabled
103 if 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
124 else
125   PHP_DEBUG=0
126   ZEND_DEBUG=no
129 dnl Always shared
130 PHP_BUILD_SHARED
132 dnl Required programs
133 PHP_PROG_RE2C
134 PHP_PROG_AWK
136 sinclude(config.m4)
138 enable_static=no
139 enable_shared=yes
141 dnl Only allow AC_PROG_CXX and AC_PROG_CXXCPP if they are explicitly called (by PHP_REQUIRE_CXX).
142 dnl Otherwise AC_PROG_LIBTOOL fails if there is no working C++ compiler.
143 AC_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])
149 AC_PROG_LIBTOOL
151 all_targets='$(PHP_MODULES) $(PHP_ZEND_EX)'
152 install_targets="install-modules install-headers"
153 phplibdir="`pwd`/modules"
154 CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
155 CFLAGS_CLEAN='$(CFLAGS)'
156 CXXFLAGS_CLEAN='$(CXXFLAGS)'
158 test "$prefix" = "NONE" && prefix="/usr/local"
159 test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
161 PHP_SUBST(PHP_MODULES)
162 PHP_SUBST(PHP_ZEND_EX)
164 PHP_SUBST(all_targets)
165 PHP_SUBST(install_targets)
167 PHP_SUBST(prefix)
168 PHP_SUBST(exec_prefix)
169 PHP_SUBST(libdir)
170 PHP_SUBST(prefix)
171 PHP_SUBST(phplibdir)
172 PHP_SUBST(phpincludedir)
174 PHP_SUBST(CC)
175 PHP_SUBST(CFLAGS)
176 PHP_SUBST(CFLAGS_CLEAN)
177 PHP_SUBST(CPP)
178 PHP_SUBST(CPPFLAGS)
179 PHP_SUBST(CXX)
180 PHP_SUBST(CXXFLAGS)
181 PHP_SUBST(CXXFLAGS_CLEAN)
182 PHP_SUBST(EXTENSION_DIR)
183 PHP_SUBST(PHP_EXECUTABLE)
184 PHP_SUBST(EXTRA_LDFLAGS)
185 PHP_SUBST(EXTRA_LIBS)
186 PHP_SUBST(INCLUDES)
187 PHP_SUBST(LFLAGS)
188 PHP_SUBST(LDFLAGS)
189 PHP_SUBST(SHARED_LIBTOOL)
190 PHP_SUBST(LIBTOOL)
191 PHP_SUBST(SHELL)
192 PHP_SUBST(INSTALL_HEADERS)
194 PHP_GEN_BUILD_DIRS
195 PHP_GEN_GLOBAL_MAKEFILE
197 test -d modules || $php_shtool mkdir modules
198 touch .deps
200 AC_CONFIG_HEADER(config.h)
202 AC_OUTPUT()