You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1067 lines
28 KiB

Generalized server-API build process on UNIX. Each SAPI implementation now has its own directory under sapi/, just like extensions have theirs under ext/. To make the final targets appear in the main dir, the top-level Makefile includes sapi/NN/Makefile.inc from the selected sapi backend. This is a plan Makefile stub without any autoconf substitutions. Each SAPI backend also has its own config.m4 like extensions (read at the end of diversion 2) and config.h.stub files. Each SAPI backend has to contain: config.m4: just like for extensions, this file contains autoconf/automake directives that end up in the configure script. The only difference is that the sapi config.m4 files are read in diversion (output block) 2 instead of 3. The sapi config.m4 files should set two variables: PHP_SAPI (which sapi backend to choose) and SAPI_TARGET (the name of the resulting library or program, previously BINNAME). If they are not specified, they will default to "cgi" and "php", respectively. Makefile.inc: has to exist, has to define "INSTALL_IT" to the command used to install the final target (or ":" for no operation). It also has to define a plain Makefile rule (without autoconf substitutions) to build $(SAPI_TARGET) Makefile.am: just what you think. Make sure your target is called "libphpsapi_NNN.a", where NNN is the value of PHP_SAPI. Some testing and fixing probably remains. To make everything hang together, I've done some ugly tricks that I can imagine causing some problems. I've built and run the CGI version and built the Apache DSO.
27 years ago
Generalized server-API build process on UNIX. Each SAPI implementation now has its own directory under sapi/, just like extensions have theirs under ext/. To make the final targets appear in the main dir, the top-level Makefile includes sapi/NN/Makefile.inc from the selected sapi backend. This is a plan Makefile stub without any autoconf substitutions. Each SAPI backend also has its own config.m4 like extensions (read at the end of diversion 2) and config.h.stub files. Each SAPI backend has to contain: config.m4: just like for extensions, this file contains autoconf/automake directives that end up in the configure script. The only difference is that the sapi config.m4 files are read in diversion (output block) 2 instead of 3. The sapi config.m4 files should set two variables: PHP_SAPI (which sapi backend to choose) and SAPI_TARGET (the name of the resulting library or program, previously BINNAME). If they are not specified, they will default to "cgi" and "php", respectively. Makefile.inc: has to exist, has to define "INSTALL_IT" to the command used to install the final target (or ":" for no operation). It also has to define a plain Makefile rule (without autoconf substitutions) to build $(SAPI_TARGET) Makefile.am: just what you think. Make sure your target is called "libphpsapi_NNN.a", where NNN is the value of PHP_SAPI. Some testing and fixing probably remains. To make everything hang together, I've done some ugly tricks that I can imagine causing some problems. I've built and run the CGI version and built the Apache DSO.
27 years ago
25 years ago
27 years ago
27 years ago
26 years ago
26 years ago
27 years ago
25 years ago
26 years ago
Generalized server-API build process on UNIX. Each SAPI implementation now has its own directory under sapi/, just like extensions have theirs under ext/. To make the final targets appear in the main dir, the top-level Makefile includes sapi/NN/Makefile.inc from the selected sapi backend. This is a plan Makefile stub without any autoconf substitutions. Each SAPI backend also has its own config.m4 like extensions (read at the end of diversion 2) and config.h.stub files. Each SAPI backend has to contain: config.m4: just like for extensions, this file contains autoconf/automake directives that end up in the configure script. The only difference is that the sapi config.m4 files are read in diversion (output block) 2 instead of 3. The sapi config.m4 files should set two variables: PHP_SAPI (which sapi backend to choose) and SAPI_TARGET (the name of the resulting library or program, previously BINNAME). If they are not specified, they will default to "cgi" and "php", respectively. Makefile.inc: has to exist, has to define "INSTALL_IT" to the command used to install the final target (or ":" for no operation). It also has to define a plain Makefile rule (without autoconf substitutions) to build $(SAPI_TARGET) Makefile.am: just what you think. Make sure your target is called "libphpsapi_NNN.a", where NNN is the value of PHP_SAPI. Some testing and fixing probably remains. To make everything hang together, I've done some ugly tricks that I can imagine causing some problems. I've built and run the CGI version and built the Apache DSO.
27 years ago
25 years ago
26 years ago
26 years ago
  1. dnl ## $Id$ -*- sh -*-
  2. dnl ## Process this file with autoconf to produce a configure script.
  3. divert(1)
  4. AC_INIT(README.CVS-RULES)
  5. PHP_FAST_OUTPUT(sapi/Makefile ext/Makefile Makefile pear/Makefile main/Makefile)
  6. if test "$with_shared_apache" != "no" && test -n "$with_shared_apache" ; then
  7. AC_MSG_ERROR(--with-shared-apache is not supported. Please refer to the documentation for using APXS)
  8. fi
  9. if test -n "$with_apache" && test -n "$with_apxs"; then
  10. AC_MSG_ERROR(--with-apache and --with-apxs cannot be used together)
  11. fi
  12. cwd=`pwd`
  13. PHP_CONFIG_NICE(config.nice)
  14. for arg in $0 "$@"; do
  15. CONFIGURE_COMMAND="$CONFIGURE_COMMAND '$arg'"
  16. done
  17. php_shtool=$srcdir/build/shtool
  18. T_MD=`$php_shtool echo -n -e %B`
  19. T_ME=`$php_shtool echo -n -e %b`
  20. dnl Because ``make install'' is often performed by the superuser,
  21. dnl we create the libs subdirectory as the user who configures PHP.
  22. dnl Otherwise, the current user will not be able to delete libs
  23. dnl or the contents of libs.
  24. $php_shtool mkdir -p libs
  25. rm -f libs/*
  26. dnl ## Diversion 2 is the initial checking of OS features, programs,
  27. dnl ## libraries and so on.
  28. dnl ## In diversion 3 we check for compile-time options to the PHP
  29. dnl ## core and how to deal with different system dependencies. This
  30. dnl ## includes what regex library is used and whether debugging or short
  31. dnl ## tags are enabled, and the default behaviour of php.ini options.
  32. dnl ## This is also where an SAPI interface is selected (choosing between
  33. dnl ## Apache module, CGI etc.)
  34. dnl ## In diversion 4 we check which extensions should be compiled.
  35. dnl ## All of these are normally in the extension directories.
  36. dnl ## Diversion 5 is the last one. Here we generate files and clean up.
  37. dnl ## This is where the version number is changed from now on!
  38. AM_INIT_AUTOMAKE(php, 4.0.7-dev, nodefine)
  39. PHP_VERSION=$VERSION
  40. echo "/* automatically generated by configure */" > php_version.h.new
  41. echo "/* edit configure.in to change version number */" >> php_version.h.new
  42. echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new
  43. cmp php_version.h.new php_version.h >/dev/null 2>&1
  44. if test $? -ne 0 ; then
  45. rm -f php_version.h && mv php_version.h.new php_version.h && \
  46. echo 'Updated php_version.h'
  47. else
  48. rm -f php_version.h.new
  49. fi
  50. AM_CONFIG_HEADER(main/php_config.h)
  51. AM_MAINTAINER_MODE
  52. AC_CANONICAL_HOST
  53. dnl We want this one before the checks, so the checks can modify CFLAGS.
  54. test -z "$CFLAGS" && auto_cflags=1
  55. dnl Checks for programs.
  56. AC_PROG_AWK
  57. AC_PROG_YACC
  58. if test "$YACC" != "bison -y"; then
  59. AC_MSG_WARN(You will need bison if you want to regenerate the PHP parsers.)
  60. else
  61. AC_MSG_CHECKING(bison version)
  62. oldIFS=$IFS; IFS=.
  63. set `bison -V | sed -e 's/^GNU Bison version //'`
  64. IFS=$oldIFS
  65. if test "$1" = "1" -a "$2" -lt "25"; then
  66. AC_MSG_WARN(Bison 1.25 or newer needed to regenerate parsers (found $1.$2).)
  67. fi
  68. AC_MSG_RESULT($1.$2 (ok))
  69. fi
  70. AC_PROG_CC
  71. AC_AIX
  72. BSD_MAKEFILE=no
  73. case $host_alias in
  74. *solaris*)
  75. CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
  76. if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then
  77. enable_libgcc=yes
  78. fi
  79. ;;
  80. *dgux*)
  81. CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR";;
  82. *darwin*|*rhapsody*)
  83. CPPFLAGS="$CPPFLAGS -traditional-cpp";;
  84. *bsdi*)
  85. BSD_MAKEFILE=yes;;
  86. *beos*)
  87. beos_threads=1
  88. LIBS="$LIBS -lbe -lroot";;
  89. esac
  90. AM_PROG_CC_STDC
  91. AC_PROG_RANLIB
  92. AC_PROG_CC_C_O
  93. AC_PROG_LN_S
  94. AC_PROG_LEX
  95. if test -n "$LEX"; then
  96. AC_DECL_YYTEXT
  97. fi
  98. dnl ## Make flex scanners use const if they can, even if __STDC__ is not
  99. dnl ## true, for compilers like Sun's that only set __STDC__ true in
  100. dnl ## "limit-to-ANSI-standard" mode, not in "ANSI-compatible" mode
  101. AC_C_CONST
  102. if test "$ac_cv_c_const" = "yes" ; then
  103. LEX_CFLAGS="-DYY_USE_CONST"
  104. fi
  105. abs_srcdir=`(cd $srcdir; pwd)`
  106. abs_builddir=`pwd`
  107. sinclude(Zend/acinclude.m4)
  108. sinclude(Zend/Zend.m4)
  109. sinclude(TSRM/tsrm.m4)
  110. divert(2)
  111. PTHREADS_CHECK
  112. PHP_SHLIB_SUFFIX_NAME
  113. PHP_SAPI=cgi
  114. PHP_BUILD_PROGRAM
  115. dnl paths to the targets are relative to the build directory
  116. SAPI_PROGRAM=php
  117. SAPI_SHARED=libs/libphp4.$SHLIB_SUFFIX_NAME
  118. SAPI_STATIC=libs/libphp4.a
  119. SAPI_LIBTOOL=libphp4.la
  120. PHP_CONFIGURE_PART(Configuring SAPI modules)
  121. esyscmd(./scripts/config-stubs sapi)
  122. AC_MSG_CHECKING(for chosen SAPI module)
  123. AC_MSG_RESULT($PHP_SAPI)
  124. if test "$enable_experimental_zts" = "yes"; then
  125. PTHREADS_ASSIGN_VARS
  126. PTHREADS_FLAGS
  127. fi
  128. divert(3)
  129. PHP_CONFIGURE_PART(Running system checks)
  130. PHP_MISSING_TIME_R_DECL
  131. dnl check for -R, etc. switch
  132. AC_MSG_CHECKING(whether compiler supports -R)
  133. AC_CACHE_VAL(php_cv_cc_dashr,[
  134. SAVE_LIBS=$LIBS
  135. LIBS="-R /usr/lib $LIBS"
  136. AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
  137. LIBS=$SAVE_LIBS])
  138. AC_MSG_RESULT($php_cv_cc_dashr)
  139. if test $php_cv_cc_dashr = "yes"; then
  140. ld_runpath_switch=-R
  141. else
  142. AC_MSG_CHECKING([whether compiler supports -Wl,-rpath,])
  143. AC_CACHE_VAL(php_cv_cc_rpath,[
  144. SAVE_LIBS=$LIBS
  145. LIBS="-Wl,-rpath,/usr/lib $LIBS"
  146. AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
  147. LIBS=$SAVE_LIBS])
  148. AC_MSG_RESULT($php_cv_cc_rpath)
  149. if test $php_cv_cc_rpath = "yes"; then
  150. ld_runpath_switch=-Wl,-rpath,
  151. else
  152. dnl something innocuous
  153. ld_runpath_switch=-L
  154. fi
  155. fi
  156. PHP_PROG_SENDMAIL
  157. dnl Check whether the system uses EBCDIC (not ASCII) as its native codeset
  158. PHP_EBCDIC
  159. dnl
  160. dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
  161. dnl and source packages. This should be harmless on other OSs.
  162. dnl
  163. if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
  164. CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
  165. LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
  166. fi
  167. INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
  168. AC_CHECK_LIB(socket, socket, [
  169. PHP_ADD_LIBRARY(socket)
  170. AC_DEFINE(HAVE_LIBSOCKET,1,[ ]) ], [
  171. AC_CHECK_LIB(socket, htonl, [
  172. PHP_ADD_LIBRARY(socket)
  173. ])])
  174. dnl Some systems (OpenServer 5) dislike -lsocket -lnsl, so we try
  175. dnl to avoid -lnsl checks, if we already have the functions which
  176. dnl are usually in libnsl
  177. unset ac_cv_func_yp_get_default_domain
  178. AC_CHECK_FUNC(yp_get_default_domain,
  179. [php_no_nsl_checks=yes],[ ])
  180. unset ac_cv_func_yp_get_default_domain
  181. if test "$php_no_nsl_checks" != "yes"; then
  182. AC_CHECK_LIB(nsl, gethostname, [
  183. PHP_ADD_LIBRARY(nsl)
  184. AC_DEFINE(HAVE_LIBNSL,1,[ ]) ],[
  185. AC_CHECK_LIB(nsl, gethostbyaddr, [
  186. PHP_ADD_LIBRARY(nsl)
  187. AC_DEFINE(HAVE_LIBNSL,1,[ ]) ], [])
  188. ])
  189. fi
  190. AC_CHECK_LIB(dl, dlopen,[PHP_ADD_LIBRARY(dl)])
  191. dnl The sin may be in a library which need not be specifed
  192. dnl as well as res_search resides in libsocket
  193. AC_CHECK_LIB(m, sin)
  194. dnl Only include libbind if inet_aton is not found in
  195. dnl libresolv.
  196. AC_CHECK_LIB(resolv, inet_aton, [], [
  197. AC_CHECK_LIB(bind, inet_aton, [], [
  198. AC_CHECK_LIB(bind, __inet_aton)
  199. ])
  200. ])
  201. dnl The res_search may be in libsocket as well, and if it is
  202. dnl make sure to check for dn_skipname in libresolv, or if res_search
  203. dnl is in neither of these libs, still check for dn_skipname in libresolv
  204. AC_CHECK_LIB(socket, res_search, [
  205. AC_CHECK_LIB(resolv, dn_skipname)
  206. AC_CHECK_LIB(resolv, __dn_skipname)
  207. LIBS="$LIBS -lsocket"
  208. AC_DEFINE(HAVE_LIBSOCKET,1,[ ]) ], [
  209. AC_CHECK_LIB(resolv, res_search, [
  210. LIBS="$LIBS -lresolv"
  211. AC_DEFINE(HAVE_LIBRESOLV,1,[ ])
  212. ], [
  213. AC_CHECK_LIB(resolv, dn_skipname)
  214. AC_CHECK_LIB(resolv, __dn_skipname)
  215. ])
  216. ])
  217. dnl Checks for header files.
  218. AC_HEADER_STDC
  219. dnl In QNX opendir resides in libc but dirent.h is still required
  220. if test "`uname -s 2>/dev/null`" != "QNX"; then
  221. AC_HEADER_DIRENT
  222. else
  223. AC_CHECK_HEADERS(dirent.h)
  224. fi
  225. PHP_MISSING_FCLOSE_DECL
  226. dnl QNX requires unix.h to allow functions in libunix to work properly
  227. AC_CHECK_HEADERS(
  228. alloca.h \
  229. arpa/inet.h \
  230. arpa/nameser.h \
  231. crypt.h \
  232. fcntl.h \
  233. grp.h \
  234. ieeefp.h \
  235. langinfo.h \
  236. limits.h \
  237. locale.h \
  238. netinet/in.h \
  239. pwd.h \
  240. resolv.h \
  241. signal.h \
  242. stdarg.h \
  243. stdlib.h \
  244. string.h \
  245. syslog.h \
  246. sysexits.h \
  247. sys/file.h \
  248. sys/mman.h \
  249. sys/mount.h \
  250. sys/resource.h \
  251. sys/select.h \
  252. sys/socket.h \
  253. sys/statfs.h \
  254. sys/statvfs.h \
  255. sys/sysexits.h \
  256. sys/time.h \
  257. sys/types.h \
  258. sys/varargs.h \
  259. sys/wait.h \
  260. unistd.h \
  261. unix.h \
  262. utime.h \
  263. )
  264. dnl Checks for typedefs, structures, and compiler characteristics.
  265. AC_STRUCT_TM
  266. AC_STRUCT_TIMEZONE
  267. PHP_TM_GMTOFF
  268. PHP_STRUCT_FLOCK
  269. PHP_SOCKLEN_T
  270. AC_CHECK_SIZEOF(long, 8)
  271. AC_CHECK_SIZEOF(int, 4)
  272. test -d /usr/ucblib && PHP_ADD_LIBPATH(/usr/ucblib)
  273. dnl Check for members of the stat structure
  274. AC_STRUCT_ST_BLKSIZE
  275. dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists
  276. dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument
  277. if test "`uname -s 2>/dev/null`" != "QNX"; then
  278. AC_STRUCT_ST_BLOCKS
  279. else
  280. AC_MSG_WARN(warnings level for cc set to 0)
  281. WARNING_LEVEL=0
  282. fi
  283. AC_STRUCT_ST_RDEV
  284. dnl Checks for types
  285. AC_TYPE_SIZE_T
  286. AC_TYPE_UID_T
  287. dnl Check for IPv6 support
  288. AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
  289. [AC_TRY_COMPILE([ #include <sys/types.h>
  290. #include <sys/socket.h>
  291. #include <netinet/in.h>], [struct sockaddr_in6 s; int i=AF_INET6; s],
  292. ac_cv_ipv6_support=yes, ac_cv_ipv6_support=no)])
  293. if test "$ac_cv_ipv6_support" = yes; then
  294. AC_DEFINE(HAVE_IPV6,1,[Whether you have IPv6 support])
  295. fi
  296. dnl Checks for library functions.
  297. AC_FUNC_VPRINTF
  298. AC_CHECK_FUNCS(
  299. asctime_r \
  300. chroot \
  301. ctime_r \
  302. cuserid \
  303. crypt \
  304. flock \
  305. gai_strerror \
  306. gcvt \
  307. getlogin \
  308. gethostbyaddr \
  309. getprotobyname \
  310. getprotobynumber \
  311. getservbyname \
  312. getservbyport \
  313. getrusage \
  314. gettimeofday \
  315. gmtime_r \
  316. inet_aton \
  317. isascii \
  318. link \
  319. localtime_r \
  320. lockf \
  321. lrand48 \
  322. memcpy \
  323. memmove \
  324. mkstemp \
  325. mmap \
  326. nl_langinfo \
  327. putenv \
  328. random \
  329. rand_r \
  330. regcomp \
  331. res_search \
  332. setitimer \
  333. setlocale \
  334. localeconv \
  335. setsockopt \
  336. setvbuf \
  337. shutdown \
  338. sin \
  339. snprintf \
  340. srand48 \
  341. srandom \
  342. statfs \
  343. statvfs \
  344. std_syslog \
  345. strcasecmp \
  346. strcoll \
  347. strdup \
  348. strerror \
  349. strftime \
  350. strstr \
  351. strtok_r \
  352. symlink \
  353. tempnam \
  354. tzset \
  355. unsetenv \
  356. usleep \
  357. utime \
  358. vsnprintf \
  359. )
  360. dnl Check for getaddrinfo, should be a better way, but...
  361. AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
  362. [AC_TRY_COMPILE([#include <netdb.h>],
  363. [struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
  364. ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no)])
  365. if test "$ac_cv_func_getaddrinfo" = yes; then
  366. AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
  367. fi
  368. AC_REPLACE_FUNCS(strlcat strlcpy getopt)
  369. AC_FUNC_UTIME_NULL
  370. AC_FUNC_ALLOCA
  371. PHP_AC_BROKEN_SPRINTF
  372. PHP_DECLARED_TIMEZONE
  373. PHP_TIME_R_TYPE
  374. PHP_READDIR_R_TYPE
  375. dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
  376. dnl AC_MSG_CHECKING(for in_addr_t)
  377. AC_CACHE_VAL(ac_cv_type_$1,
  378. [AC_EGREP_CPP(dnl
  379. changequote(<<,>>)dnl
  380. <<in_addr_t[^a-zA-Z_0-9]>>dnl
  381. changequote([,]), [#include <sys/types.h>
  382. #if STDC_HEADERS
  383. #include <stdlib.h>
  384. #include <stddef.h>
  385. #endif
  386. #ifdef HAVE_NETINET_IN_H
  387. #include <netinet/in.h>
  388. #endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl
  389. dnl AC_MSG_RESULT($ac_cv_type_in_addr_t)
  390. if test $ac_cv_type_in_addr_t = no; then
  391. AC_DEFINE(in_addr_t, u_int, [ ])
  392. fi
  393. divert(4)
  394. PHP_ARG_ENABLE(debug, whether to include debugging symbols,
  395. [ --enable-debug Compile with debugging symbols.], no)
  396. if test "$PHP_DEBUG" = "yes"; then
  397. PHP_DEBUG=1
  398. ZEND_DEBUG=yes
  399. else
  400. PHP_DEBUG=0
  401. ZEND_DEBUG=no
  402. fi
  403. PHP_ARG_WITH(layout,[layout of installed files],
  404. [ --with-layout=TYPE Sets how installed files will be laid out. Type is
  405. one of "PHP" (default) or "GNU"], PHP)
  406. PHP_ARG_WITH(config-file-path,[path to configuration file],
  407. [ --with-config-file-path=PATH
  408. Sets the path in which to look for php.ini,
  409. defaults to PREFIX/lib], DEFAULT)
  410. if test "$PHP_CONFIG_FILE_PATH" = "DEFAULT"; then
  411. case $PHP_LAYOUT in
  412. GNU)
  413. PHP_CONFIG_FILE_PATH=$sysconfdir
  414. oldstyleextdir=no;;
  415. *)
  416. PHP_CONFIG_FILE_PATH=$libdir
  417. oldstyleextdir=yes;;
  418. esac
  419. fi
  420. # compatibility
  421. if test "x$with_pear" = "x" -a "x$enable_pear" = "xno"; then
  422. with_pear=no
  423. fi
  424. PHP_ARG_WITH(pear, [whether to install PEAR, and where],
  425. [ --with-pear=DIR Install PEAR in DIR (default PREFIX/lib/php)
  426. --without-pear Do not install PEAR], DEFAULT)
  427. if test "$PHP_PEAR" != "no"; then
  428. PEAR_DIR=pear
  429. fi
  430. if test "$PHP_PEAR" = "DEFAULT"; then
  431. case $PHP_LAYOUT in
  432. GNU) PEAR_INSTALLDIR=$datadir/pear;;
  433. *) PEAR_INSTALLDIR=$libdir/php;;
  434. esac
  435. fi
  436. test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
  437. PHP_ARG_ENABLE(safe-mode, whether to enable safe mode by default,
  438. [ --enable-safe-mode Enable safe mode by default.])
  439. if test "$PHP_SAFE_MODE" = "yes"; then
  440. AC_DEFINE(PHP_SAFE_MODE,1,[ ])
  441. else
  442. AC_DEFINE(PHP_SAFE_MODE,0,[ ])
  443. fi
  444. AC_MSG_CHECKING(for safe mode exec dir)
  445. AC_ARG_WITH(exec-dir,
  446. [ --with-exec-dir[=DIR] Only allow executables in DIR when in safe mode
  447. defaults to /usr/local/php/bin],
  448. [
  449. if test "$withval" != "no"; then
  450. if test "$withval" = "yes"; then
  451. AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin", [ ])
  452. AC_MSG_RESULT(/usr/local/php/bin)
  453. else
  454. AC_DEFINE_UNQUOTED(PHP_SAFE_MODE_EXEC_DIR,"$withval", [ ])
  455. AC_MSG_RESULT($withval)
  456. fi
  457. else
  458. AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin", [ ])
  459. AC_MSG_RESULT(/usr/local/php/bin)
  460. fi
  461. ],[
  462. AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin", [ ])
  463. AC_MSG_RESULT(/usr/local/php/bin)
  464. ])
  465. PHP_ARG_WITH(openssl,for OpenSSL support,
  466. [ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.5) ])
  467. if test "$PHP_OPENSSL" = "yes"; then
  468. PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl"
  469. fi
  470. if test "$PHP_OPENSSL" != "no"; then
  471. PHP_SETUP_OPENSSL
  472. fi
  473. PHP_ARG_ENABLE(sigchild,whether to enable PHP's own SIGCHLD handler,
  474. [ --enable-sigchild Enable PHP's own SIGCHLD handler.],no)
  475. if test "$PHP_SIGCHILD" = "yes"; then
  476. AC_DEFINE(PHP_SIGCHILD, 1, [ ])
  477. else
  478. AC_DEFINE(PHP_SIGCHILD, 0, [ ])
  479. fi
  480. PHP_ARG_ENABLE(magic-quotes,whether to enable magic quotes by default,
  481. [ --enable-magic-quotes Enable magic quotes by default.])
  482. if test "$PHP_MAGIC_QUOTES" = "yes"; then
  483. AC_DEFINE(MAGIC_QUOTES, 1, [ ])
  484. else
  485. AC_DEFINE(MAGIC_QUOTES, 0, [ ])
  486. fi
  487. PHP_ARG_ENABLE(rpath, whether to enable runpaths,
  488. [ --disable-rpath Disable passing additional runtime library
  489. search paths], yes)
  490. PHP_ARG_ENABLE(libgcc, whether to explicitly link against libgcc,
  491. [ --enable-libgcc Enable explicitly linking against libgcc])
  492. if test "$PHP_LIBGCC" = "yes"; then
  493. PHP_LIBGCC_LIBPATH(gcc)
  494. if test -z "$libgcc_libpath"; then
  495. AC_MSG_ERROR(Cannot locate libgcc. Make sure that gcc is in your path)
  496. fi
  497. PHP_ADD_LIBPATH($libgcc_libpath)
  498. PHP_ADD_LIBRARY(gcc, yes)
  499. fi
  500. PHP_ARG_ENABLE(short-tags,whether to enable short tags by default,
  501. [ --disable-short-tags Disable the short-form <? start tag by default.],yes)
  502. if test "$PHP_SHORT_TAGS" = "yes"; then
  503. AC_DEFINE(DEFAULT_SHORT_OPEN_TAG,"1",[ ])
  504. else
  505. AC_DEFINE(DEFAULT_SHORT_OPEN_TAG,"0",[ ])
  506. fi
  507. PHP_ARG_ENABLE(dmalloc,whether to enable dmalloc,
  508. [ --enable-dmalloc Enable dmalloc])
  509. if test "$PHP_DMALLOC" = "yes"; then
  510. AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc])
  511. PHP_ADD_LIBRARY(dmalloc)
  512. CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
  513. fi
  514. # temporary until streams are better integrated
  515. PHP_ARG_ENABLE(php-streams,whether to enable php streams,
  516. [ --enable-php-streams Include experimental php streams.
  517. Do not use unless you are testing the code!])
  518. if test "$PHP_PHP_STREAMS" = "yes"; then
  519. AC_DEFINE(HAVE_PHP_STREAM, 1, [Whether to use php streams])
  520. fi
  521. AC_CHECK_LIB(crypt, crypt, [
  522. PHP_ADD_LIBRARY(crypt)
  523. AC_DEFINE(HAVE_CRYPT,1,[ ])
  524. ])
  525. divert(5)
  526. PHP_CONFIGURE_PART(Configuring extensions)
  527. # reading config stubs
  528. esyscmd(./scripts/config-stubs ext)
  529. PHP_FAST_OUTPUT(sapi/$PHP_SAPI/Makefile)
  530. AC_MSG_CHECKING(whether to enable versioning)
  531. AC_ARG_ENABLE(versioning,
  532. [ --enable-versioning Export only required symbols.
  533. See INSTALL for more information],[
  534. PHP_VERSIONING=$enableval
  535. ],[
  536. PHP_VERSIONING=no
  537. ])
  538. AC_MSG_RESULT($PHP_VERSIONING)
  539. if test "$PHP_VERSIONING" = "yes"; then
  540. test -z "$PHP_SYM_FILE" && PHP_SYM_FILE="$abs_srcdir/sapi/$PHP_SAPI/php.sym"
  541. if test -f "$PHP_SYM_FILE"; then
  542. EXTRA_LDFLAGS="-export-symbols $PHP_SYM_FILE"
  543. fi
  544. fi
  545. divert(6)
  546. enable_shared=yes
  547. enable_static=yes
  548. unset with_pic
  549. case $php_build_target in
  550. program|static)
  551. standard_libtool_flag='-prefer-non-pic -static'
  552. if test "$lib_build_shared" != "yes"; then
  553. enable_shared=no
  554. fi
  555. PHP_COMPILE='$(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -c $< && touch $@'
  556. CXX_PHP_COMPILE='$(CXX) $(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) -c $< && touch $@'
  557. ;;
  558. shared)
  559. enable_static=no
  560. standard_libtool_flag=-prefer-pic
  561. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version"
  562. ;;
  563. esac
  564. if test "$PHP_SAPI" = "cgi"; then
  565. PHP_PROGRAM=php
  566. fi
  567. if test "$PHP_SAPI" = "fastcgi"; then
  568. PHP_PROGRAM=php
  569. fi
  570. PHP_REGEX
  571. PHP_CONFIGURE_PART(Configuring Zend)
  572. LIBZEND_BASIC_CHECKS
  573. LIBZEND_OTHER_CHECKS
  574. TSRM_LIB='TSRM/libtsrm.la'
  575. TSRM_DIR=TSRM
  576. INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM"
  577. if test "$ZEND_EXPERIMENTAL_ZTS" = "yes"; then
  578. AC_DEFINE(ZTS,1,[ ])
  579. PHP_THREAD_SAFETY=yes
  580. else
  581. PHP_THREAD_SAFETY=no
  582. fi
  583. if test "$abs_srcdir" != "$abs_builddir"; then
  584. INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
  585. INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM"
  586. fi
  587. EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS"
  588. unset LIBS LDFLAGS
  589. PHP_CONFIGURE_PART(Configuring TSRM)
  590. TSRM_BASIC_CHECKS
  591. if test "$PHP_THREAD_SAFETY" = "yes"; then
  592. TSRM_THREADS_CHECKS
  593. fi
  594. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
  595. EXTRA_LIBS="$EXTRA_LIBS $LIBS"
  596. unset LIBS LDFLAGS
  597. test "$prefix" = "NONE" && prefix=/usr/local
  598. test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
  599. case $libdir in
  600. '${exec_prefix}/lib')
  601. libdir=$libdir/php
  602. ;;
  603. esac
  604. case $datadir in
  605. '${prefix}/share')
  606. datadir=$datadir/php
  607. ;;
  608. *) ;;
  609. esac
  610. phplibdir=`pwd`/modules
  611. $php_shtool mkdir -p $phplibdir
  612. phptempdir=`pwd`/libs
  613. old_exec_prefix=$exec_prefix
  614. old_libdir=$libdir
  615. old_datadir=$datadir
  616. exec_prefix=`eval echo $exec_prefix`
  617. libdir=`eval echo $libdir`
  618. datadir=`eval echo $datadir`
  619. dnl Build extension directory path
  620. ZEND_MODULE_API_NO=`egrep '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO //'`
  621. if test -z "$EXTENSION_DIR"; then
  622. extbasedir=$ZEND_MODULE_API_NO
  623. if test "$oldstyleextdir" = "yes"; then
  624. if test "$PHP_DEBUG" = "1"; then
  625. part1=debug
  626. else
  627. part1=no-debug
  628. fi
  629. if test "$enable_experimental_zts" = "yes"; then
  630. part2=zts
  631. else
  632. part2=non-zts
  633. fi
  634. extbasedir=$part1-$part2-$extbasedir
  635. EXTENSION_DIR=$libdir/extensions/$extbasedir
  636. else
  637. if test "$enable_experimental_zts" = "yes"; then
  638. extbasedir=$extbasedir-zts
  639. fi
  640. if test "$PHP_DEBUG" = "1"; then
  641. extbasedir=$extbasedir-debug
  642. fi
  643. EXTENSION_DIR=$libdir/$extbasedir
  644. fi
  645. fi
  646. dnl Expand all directory names for use in macros/constants
  647. EXPANDED_PEAR_INSTALLDIR=`eval echo $PEAR_INSTALLDIR`
  648. EXPANDED_EXTENSION_DIR=`eval echo $EXTENSION_DIR`
  649. EXPANDED_LOCALSTATEDIR=`eval echo $localstatedir`
  650. EXPANDED_BINDIR=`eval echo $bindir`
  651. EXPANDED_LIBDIR=$libdir
  652. EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
  653. EXPANDED_DATADIR=$datadir
  654. EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
  655. INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
  656. exec_prefix=$old_exec_prefix
  657. libdir=$old_libdir
  658. datadir=$old_datadir
  659. AC_SUBST(INCLUDE_PATH)
  660. AC_SUBST(EXPANDED_PEAR_INSTALLDIR)
  661. AC_SUBST(EXPANDED_EXTENSION_DIR)
  662. AC_SUBST(EXPANDED_BINDIR)
  663. AC_SUBST(EXPANDED_LIBDIR)
  664. AC_SUBST(EXPANDED_DATADIR)
  665. AC_SUBST(EXPANDED_SYSCONFDIR)
  666. AC_SUBST(EXPANDED_LOCALSTATEDIR)
  667. AC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH)
  668. PHP_BUILD_RPATH
  669. PHP_REMOVE_USR_LIB(PHP_LDFLAGS)
  670. PHP_REMOVE_USR_LIB(LDFLAGS)
  671. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
  672. PHP_BUILD_DATE=`date '+%Y-%m-%d'`
  673. AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date])
  674. PHP_UNAME=`uname -a`
  675. AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
  676. PHP_OS=`uname`
  677. AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
  678. PHP_SUBST_OLD(abs_builddir)
  679. PHP_SUBST_OLD(abs_srcdir)
  680. PHP_SUBST(bindir)
  681. PHP_SUBST(exec_prefix)
  682. PHP_SUBST(includedir)
  683. PHP_SUBST(libdir)
  684. PHP_SUBST(phplibdir)
  685. PHP_SUBST(phptempdir)
  686. PHP_SUBST(prefix)
  687. PHP_SUBST(localstatedir)
  688. PHP_SUBST(datadir)
  689. PHP_SUBST(sysconfdir)
  690. PHP_SUBST(AWK)
  691. PHP_SUBST(CC)
  692. PHP_SUBST(CFLAGS)
  693. PHP_SUBST(CFLAGS_CLEAN)
  694. PHP_SUBST_OLD(CONFIGURE_COMMAND)
  695. PHP_SUBST(CPP)
  696. PHP_SUBST(CPPFLAGS)
  697. PHP_SUBST(CXX)
  698. PHP_SUBST(CXXFLAGS)
  699. PHP_SUBST(CXXFLAGS_CLEAN)
  700. PHP_SUBST(CXX_PHP_COMPILE)
  701. PHP_SUBST_OLD(DEBUG_CFLAGS)
  702. PHP_SUBST(DEFS)
  703. PHP_SUBST_OLD(EXTENSION_DIR)
  704. PHP_SUBST(EXTRA_LDFLAGS)
  705. PHP_SUBST_OLD(EXTRA_LIBS)
  706. PHP_SUBST(INCLUDES)
  707. PHP_SUBST_OLD(INCLUDE_PATH)
  708. PHP_SUBST_OLD(INSTALL_IT)
  709. PHP_SUBST(LEX)
  710. PHP_SUBST(LEX_OUTPUT_ROOT)
  711. PHP_SUBST(LFLAGS)
  712. PHP_SUBST(LIBTOOL)
  713. PHP_SUBST(LN_S)
  714. PHP_SUBST_OLD(NATIVE_RPATHS)
  715. PHP_SUBST(PEAR_DIR)
  716. PHP_SUBST_OLD(PEAR_INSTALLDIR)
  717. PHP_SUBST(PHP_BUILD_DATE)
  718. PHP_SUBST(PHP_COMPILE)
  719. PHP_SUBST_OLD(PHP_LDFLAGS)
  720. PHP_SUBST_OLD(PHP_LIBS)
  721. PHP_SUBST(PHP_PROGRAM)
  722. PHP_SUBST(PHP_RPATHS)
  723. PHP_SUBST(PHP_SAPI)
  724. PHP_SUBST(PHP_VERSION)
  725. PHP_SUBST(PROG_SENDMAIL)
  726. PHP_SUBST(SHELL)
  727. PHP_SUBST(SHARED_LIBTOOL)
  728. PHP_SUBST(TSRM_DIR)
  729. PHP_SUBST(TSRM_LIB)
  730. PHP_SUBST(WARNING_LEVEL)
  731. PHP_SUBST_OLD(YACC)
  732. PHP_CONFIGURE_PART(Configuring libtool)
  733. old_CC=$CC
  734. if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
  735. CXXFLAGS="$CXXFLAGS $ac_cv_pthreads_cflags"
  736. INLINE_CFLAGS="$INLINE_CFLAGS $ac_cv_pthreads_cflags"
  737. cat >meta_ccld<<EOF
  738. #! /bin/sh
  739. exec $CC $ac_cv_pthreads_cflags \$@
  740. EOF
  741. CC="$abs_builddir/meta_ccld"
  742. chmod +x meta_ccld
  743. fi
  744. dnl This will go away, if we have a facility to run per-extension code
  745. dnl after the thread_safety decision was done
  746. if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then
  747. CPPFLAGS="$CPPFLAGS -DTHREAD=1"
  748. fi
  749. AM_PROG_LIBTOOL
  750. if test "$enable_debug" != "yes"; then
  751. AM_SET_LIBTOOL_VARIABLE([--silent])
  752. fi
  753. test -z "$PHP_COMPILE" && PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
  754. test -z "$CXX_PHP_COMPILE" && CXX_PHP_COMPILE='$(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $<'
  755. SHARED_LIBTOOL='$(LIBTOOL)'
  756. CC=$old_CC
  757. PHP_CONFIGURE_PART(Generating files)
  758. CXXFLAGS_CLEAN=$CXXFLAGS
  759. CFLAGS_CLEAN=$CFLAGS
  760. CFLAGS="$CFLAGS $standard_libtool_flag"
  761. INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
  762. CXXFLAGS="$CXXFLAGS $standard_libtool_flag"
  763. PHP_GEN_CONFIG_VARS
  764. $php_shtool mkdir -p pear/scripts
  765. ALL_OUTPUT_FILES="php4.spec Zend/Makefile main/build-defs.h \
  766. pear/scripts/pear pear/scripts/phpize pear/scripts/php-config \
  767. pear/scripts/pearize TSRM/Makefile $PHP_OUTPUT_FILES"
  768. AC_OUTPUT($ALL_OUTPUT_FILES, [], [
  769. if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES"; then
  770. REDO_ALL=yes
  771. fi
  772. if test -n "\$REDO_ALL"; then
  773. PHP_GEN_MAKEFILES($PHP_FAST_OUTPUT_FILES)
  774. fi
  775. if test ! -f $srcdir/ext/bcmath/number.c; then
  776. echo "creating number.c"
  777. echo "/* Dummy File */" > $srcdir/ext/bcmath/number.c
  778. echo "creating number.h"
  779. echo "/* Dummy File */" > $srcdir/ext/bcmath/number.h
  780. fi
  781. ################################################################
  782. # Create configuration headers
  783. #
  784. if test -d TSRM; then
  785. echo '#include "../main/php_config.h"' > TSRM/tsrm_config.h
  786. fi
  787. cat >Zend/zend_config.h <<FEO
  788. #include "../main/php_config.h"
  789. #if defined(APACHE) && defined(PHP_API_VERSION)
  790. #undef HAVE_DLFCN_H
  791. #endif
  792. FEO
  793. # run this only when generating all the files?
  794. if test -n "\$REDO_ALL"; then
  795. # Hacking while airborne considered harmful.
  796. #
  797. echo "creating main/internal_functions.c"
  798. extensions="$EXT_STATIC"
  799. dnl mv -f main/internal_functions.c main/internal_functions.c.old 2>/dev/null
  800. sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$extensions > main/internal_functions.c
  801. dnl if cmp main/internal_functions.c.old main/internal_functions.c > /dev/null 2>&1; then
  802. dnl echo "main/internal_functions.c is unchanged"
  803. dnl mv main/internal_functions.c.old main/internal_functions.c
  804. dnl else
  805. dnl rm -f main/internal_functions.c.old
  806. dnl fi
  807. if test -n "$PHP_APXS_BROKEN"; then
  808. echo "+--------------------------------------------------------------------+"
  809. echo "| WARNING: Your $APXS script is most likely broken."
  810. echo "| |"
  811. echo "| Please go read http://www.php.net/FAQ.php#6.11 and make the |"
  812. echo "| changes described there and try again. |"
  813. fi
  814. # Warn about CGI version with no extra security options.
  815. if test "$PHP_SAPI" = "cgi"; then
  816. if test "$REDIRECT" = "0"; then
  817. if test "$DISCARD_PATH" = "0"; then
  818. echo "+--------------------------------------------------------------------+"
  819. echo "| *** WARNING *** |"
  820. echo "| |"
  821. echo "| You will be compiling the CGI version of PHP without any |"
  822. echo "| redirection checking. By putting this cgi binary somewhere in |"
  823. echo "| your web space, users may be able to circumvent existing .htaccess |"
  824. echo "| security by loading files directly through the parser. See |"
  825. echo "| http://www.php.net/manual/security.php for more details. |"
  826. fi
  827. fi
  828. fi
  829. if test -n "$DEBUG_LOG"; then
  830. rm -f config.cache
  831. cat <<X
  832. +--------------------------------------------------------------------+
  833. | *** ATTENTION *** |
  834. | |
  835. | Something is likely to be messed up here, because the configure |
  836. | script was not able to detect a simple feature on your platform. |
  837. | This is often caused by incorrect configuration parameters. Please |
  838. | see the file debug.log for error messages. |
  839. | |
  840. | If you are unable to fix this, send the file debug.log to the |
  841. | php-install@lists.php.net mailing list and include appropiate |
  842. | information about your setup. |
  843. X
  844. fi
  845. if test "$MYSQL_MODULE_TYPE" = "builtin" ; then
  846. cat <<X
  847. +--------------------------------------------------------------------+
  848. | *** WARNING *** |
  849. | |
  850. | You chose to compile PHP with the built-in MySQL support. If you |
  851. | are compiling a server module, and intend to use other server |
  852. | modules that also use MySQL (e.g, mod_auth_mysql, PHP 3.0, |
  853. | mod_perl) you must NOT rely on PHP's built-in MySQL support, and |
  854. | instead build it with your local MySQL support files, by adding |
  855. | --with-mysql=/path/to/mysql to your configure line. |
  856. X
  857. fi
  858. # Warn about linking Apache with libpthread if oci8 extension is enabled on linux.
  859. if test "$PHP_OCI8" != "no" -o "$PHP_ORACLE" != "no"; then
  860. if test "$PHP_SAPI" = "apache"; then
  861. if test `uname` = "Linux"; then
  862. cat <<X
  863. +--------------------------------------------------------------------+
  864. | *** WARNING *** |
  865. | |
  866. | Please check that your Apache (httpd) is linked with libpthread. |
  867. | If not, you have to recompile Apache with pthread. For more |
  868. | details, see this page: http://www.php.net/manual/ref.oci8.php |
  869. X
  870. fi
  871. fi
  872. if test "$PHP_SIGCHILD" != "yes"; then
  873. cat <<X
  874. +--------------------------------------------------------------------+
  875. | Notice: |
  876. | If you encounter <defunc> processes when using a local Oracle-DB |
  877. | please recompile PHP and specify --enable-sigchild when configuring|
  878. | (This problem has been reported un Linux using Oracle >= 8.1.5) |
  879. X
  880. fi
  881. fi
  882. cat<<X
  883. +--------------------------------------------------------------------+
  884. | License: |
  885. | This software is subject to the PHP License, available in this |
  886. | distribution in the file LICENSE. By continuing this installation |
  887. | process, you are bound by the terms of this license agreement. |
  888. | If you do not agree with the terms of this license, you must abort |
  889. | the installation process at this point. |
  890. +--------------------------------------------------------------------+
  891. Thank you for using PHP.
  892. X
  893. fi
  894. ])
  895. dnl ## Local Variables:
  896. dnl ## tab-width: 4
  897. dnl ## End: