extensions you are including. Got rid of configure.in.in.
Moved the last Apache-specific files into sapi/apache and made both
static and DSO build work again (it still doesn't run properly).
WARNING_LEVEL = @WARNING_LEVEL@
LEX_CFLAGS = -w$(WARNING_LEVEL) @LEX_CFLAGS@
EXT_SHARED = @EXT_SHARED@
-LIBOBJS=@LIBOBJS@
-REGEX_LIB=@REGEX_LIB@
-FHTTPD_LIB=@FHTTPD_LIB@
-TSRM_LIB=@TSRM_LIB@
+LIBOBJS = @LIBOBJS@
+REGEX_LIB = @REGEX_LIB@
+FHTTPD_LIB = @FHTTPD_LIB@
+TSRM_LIB = @TSRM_LIB@
+APACHE_INSTALL = @APACHE_INSTALL@
SOURCE = main.c internal_functions.c snprintf.c php3_sprintf.c \
configuration-parser.c configuration-scanner.c request_info.c \
/* Define when compiling with Zeus support */
#undef WITH_ZEUS
+/* Define if struct sockaddr contains the field sa_len */
+#undef HAVE_SOCKADDR_SA_LEN
])
dnl
-dnl Stuff to do when setting up a new extension.
-dnl XXX have to change the hardcoding of ".a" when we want to be able
-dnl to make dynamic libraries as well.
+dnl PHP_EXTENSION(extname [, shared])
+dnl
+dnl Includes an extension in the build.
+dnl
+dnl "extname" is the name of the ext/ subdir where the extension resides
+dnl "shared" can be set to "shared" or "yes" to build the extension as
+dnl a dynamically loadable library.
dnl
AC_DEFUN(PHP_EXTENSION,[
if test -d "$cwd/$srcdir/ext/$1" ; then
- EXT_SUBDIRS="$EXT_SUBDIRS $1"
- if test "$2" != "shared" -a "$2" != "yes"; then
- _extlib="libphpext_$1.a"
- EXT_LIBS="$EXT_LIBS $1/$_extlib"
- EXTINFO_DEPS="$EXTINFO_DEPS ../ext/$1/extinfo.c.stub"
- EXT_STATIC="$EXT_STATIC $1"
- else
- EXT_SHARED="$EXT_SHARED $1"
- fi
-dnl EXT_INCLUDE_CODE="\#include \"ext/$1/php3_$1.h\"\\n$EXT_INCLUDE_CODE"
-dnl EXT_MODULE_PTRS="phpext_$1_ptr, $EXT_MODULE_PTRS"
-dnl "
+ EXT_SUBDIRS="$EXT_SUBDIRS $1"
+ if test "$2" != "shared" -a "$2" != "yes"; then
+ _extlib="libphpext_$1.a"
+ EXT_LIBS="$EXT_LIBS $1/$_extlib"
+ EXT_STATIC="$EXT_STATIC $1"
+ else
+ EXT_SHARED="$EXT_SHARED $1"
+ fi
+ PHP_OUTPUT(ext/$1/Makefile)
fi
])
AC_SUBST(EXT_STATIC)
AC_SUBST(EXT_SHARED)
AC_SUBST(EXT_LIBS)
-AC_SUBST(EXTINFO_DEPS)
-dnl AC_SUBST(EXT_INCLUDE_CODE)
-dnl AC_SUBST(EXT_MODULES_PTRS)
dnl
dnl Solaris requires main code to be position independent in order
done ;;
esac
])
+
+AC_DEFUN(AC_SOCKADDR_SA_LEN,[
+ AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[
+ AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/socket.h>],
+ [struct sockaddr s; s.sa_len;],
+ [ac_cv_sockaddr_sa_len=yes
+ AC_DEFINE(HAVE_SOCKADDR_SA_LEN)],
+ [ac_cv_sockaddr_sa_len=no])
+ ])
+])
+
+dnl ## PHP_AC_OUTPUT(file)
+dnl ## adds "file" to the list of files generated by AC_OUTPUT
+dnl ## This macro can be used several times.
+AC_DEFUN(PHP_OUTPUT,[
+ PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1"
+])
autoheader
-automake --add-missing --include-deps $automake_flags
+find . -name Makefile.am -print|sed -e 's/\.am//' | \
+ xargs automake --add-missing --include-deps $automake_flags
+
mv configure configure.old 2>/dev/null
autoconf
if test "$no_recursion" != "yes"; then
cwd=`pwd`
- cachefile=$cwd/config.cache
- (set -x; test -d libzend || mkdir libzend; cd libzend; $cwd/$srcdir/libzend/configure --cache-file=$cachefile $@) || exit 1
+ (set -x; test -d libzend || mkdir libzend; cd libzend; $cwd/$srcdir/libzend/configure --cache-file=$cache_file $@) || exit 1
if test "$enable_thread_safety" = "yes"; then
- (set -x; test -d TSRM || mkdir TSRM; cd TSRM && $cwd/$srcdir/TSRM/configure --cache-file=$cachefile $@) || exit 1
+ (set -x; test -d TSRM || mkdir TSRM; cd TSRM && $cwd/$srcdir/TSRM/configure --cache-file=$cache_file $@) || exit 1
fi
- (set -x; cd $srcdir; sh ltconfig --disable-static --enable-dlopen --cache-file=$cachefile ltmain.sh)
+ (set -x; cd $srcdir; sh ltconfig --disable-static --enable-dlopen --cache-file=$cache_file ltmain.sh)
fi
dnl ## Diversion 1 is the initial checking of OS features, programs,
AC_MSG_CHECKING(whether to build PHP thread-safe)
AC_ARG_ENABLE(thread-safety,
[ --enable-thread-safety Whether to build PHP thread-safe.],[
- TSRM_LIB='TSRM/libtsrm.a'
- TSRM_DIR=TSRM
- EXTRA_LIBS="$EXTRA_LIBS \$(TSRM_DIR)/libtsrm.a \`\$(SHELL) \$(TSRM_DIR)/tsrm_config --libs\`"
- AC_DEFINE(ZTS)
+ if test "$enableval" = "yes"; then
+ TSRM_LIB='TSRM/libtsrm.a'
+ TSRM_DIR=TSRM
+ EXTRA_LIBS="$EXTRA_LIBS \$(TSRM_DIR)/libtsrm.a \`\$(SHELL) \$(TSRM_DIR)/tsrm_config --libs\`"
+ AC_DEFINE(ZTS)
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
],[
TSRM_DIR=""
+ TSRM_LIB=""
+ AC_MSG_RESULT(no)
])
AC_SUBST(TSRM_DIR)
AC_SUBST(TSRM_LIB)
AC_SUBST(PHP_SAPI)
AC_SUBST(SAPI_TARGET)
-AC_OUTPUT(Makefile libphp4.module php4.spec
- scripts/mkextlib regex/Makefile
- @@EXT_MAKEFILES@@ build-defs.h, [
-], [
+#libphp4.module
+AC_OUTPUT([Makefile php4.spec $PHP_OUTPUT_FILES
+ scripts/mkextlib regex/Makefile build-defs.h], [], [
if test ! -f $srcdir/ext/bcmath/number.c; then
echo "creating number.c"
echo "/* Dummy File */" > $srcdir/ext/bcmath/number.h
fi
-if test "" = ""; then
-
+# run this only when generating all the files?
+if true; then
chmod +x scripts/mkextlib
# Hacking while airborne considered harmful.
#
divert
-# Local Variables:
-# tab-width: 4
-# End:
+dnl ## Local Variables:
+dnl ## tab-width: 4
+dnl ## End:
APACHE_INCLUDE=@APACHE_INCLUDE@
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend $(APACHE_INCLUDE)
noinst_LIBRARIES=libphpsapi_apache.a
-libphpsapi_apache_a_SOURCES=mod_php4.c
+libphpsapi_apache_a_SOURCES=apache.c
# Apache 1.3 shared module
libphp4.so: libmodphp4-so.a $(REGEX_LIB)
+ (cd sapi/apache; $(MAKE) mod_php4.o)
$(APXS) $(INCLUDE) -c -o libphp4.so $(VERSION_SCRIPT) $(RPATHS) sapi/apache/mod_php4.c libmodphp4-so.a $(APXS_LDFLAGS) $(APXS_EXP)
--- /dev/null
+/*
+ +----------------------------------------------------------------------+
+ | PHP version 4.0 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997, 1998, 1999 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.0 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available at through the world-wide-web at |
+ | http://www.php.net/license/2_0.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Rasmus Lerdorf <rasmus@php.net> |
+ | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
+ | PHP 4.0 patches by: |
+ | Zeev Suraski <zeev@zend.com> |
+ | Stig Bakken <ssb@fast.no> |
+ +----------------------------------------------------------------------+
+ */
+/* $Id$ */
+
+#include "httpd.h"
+#include "http_config.h"
+#if MODULE_MAGIC_NUMBER > 19980712
+# include "ap_compat.h"
+#else
+# if MODULE_MAGIC_NUMBER > 19980324
+# include "compat.h"
+# endif
+#endif
+#include "http_core.h"
+#include "http_main.h"
+#include "http_protocol.h"
+#include "http_request.h"
+#include "http_log.h"
+
+#include "zend.h"
+#include "php.h"
+#include "php_ini.h"
+#include "php_globals.h"
+#include "SAPI.h"
+#include "main.h"
+#include "zend_compile.h"
+#include "zend_execute.h"
+#include "zend_highlight.h"
+#include "zend_indent.h"
+#include "ext/standard/php3_standard.h"
+#include "util_script.h"
+#include "php_version.h"
+/*#include "mod_php4.h"*/
+
+PHPAPI int apache_php_module_main(request_rec *r, int fd, int display_source_mode SLS_DC)
+{
+ zend_file_handle file_handle;
+#ifdef ZTS
+ zend_compiler_globals cg;
+ zend_executor_globals eg;
+ php_core_globals pcg;
+ zend_compiler_globals *compiler_globals=&cg;
+ zend_executor_globals *executor_globals=⪚
+ php_core_globals *core_globals=&pcg;
+#endif
+ SLS_FETCH();
+
+ if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
+ return FAILURE;
+ }
+ file_handle.type = ZEND_HANDLE_FD;
+ file_handle.handle.fd = fd;
+ file_handle.filename = SG(request_info).path_translated;
+
+ if (display_source_mode) {
+ zend_syntax_highlighter_ini syntax_highlighter_ini;
+
+ if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
+ php_get_highlight_struct(&syntax_highlighter_ini);
+ zend_highlight(&syntax_highlighter_ini);
+ fclose(file_handle.handle.fp);
+ return OK;
+ } else {
+ return NOT_FOUND;
+ }
+ } else {
+ (void) php_execute_script(&file_handle CLS_CC ELS_CC);
+ }
+
+ php3_header(); /* Make sure headers have been sent */
+ php_end_ob_buffering(1);
+ return (OK);
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
dnl ## -*- sh -*-
-divert(1)
-
-if test "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
- APXS_EXP="-bE:sapi/apache/mod_php4.exp"
-fi
-AC_SUBST(APXS_EXP)
-
-divert(2)
-
AC_MSG_CHECKING(for Apache module support via DSO through APXS)
AC_ARG_WITH(apxs,
[ --with-apxs[=FILE] Build shared Apache module. FILE is the optional
AC_MSG_RESULT(no)
])
-APACHE_INSTALL_FILES="$srcdir/mod_php4.* libphp4.module"
+APACHE_INSTALL_FILES="sapi/apache/mod_php4.* sapi/apache/libphp4.module"
+PHP_OUTPUT(sapi/apache/libphp4.module)
if test "$SAPI_TARGET" != "libmodphp4-so.a"; then
if test "$SAPI_TARGET" != "libphp4.so"; then
fi
fi
+if test "x$APXS" != "x" -a "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
+ APXS_EXP="-bE:sapi/apache/mod_php4.exp"
+fi
+
+AC_SUBST(APXS_EXP)
AC_SUBST(APACHE_INCLUDE)
AC_SUBST(APACHE_TARGET)
AC_SUBST(APXS)
/* some systems are missing these from their header files */
-PHPAPI int apache_php_module_main(request_rec *r, int fd, int display_source_mode SLS_DC)
-{
- zend_file_handle file_handle;
-#ifdef ZTS
- zend_compiler_globals cg;
- zend_executor_globals eg;
- php_core_globals pcg;
- zend_compiler_globals *compiler_globals=&cg;
- zend_executor_globals *executor_globals=⪚
- php_core_globals *core_globals=&pcg;
-#endif
- SLS_FETCH();
-
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
- return FAILURE;
- }
- file_handle.type = ZEND_HANDLE_FD;
- file_handle.handle.fd = fd;
- file_handle.filename = SG(request_info).path_translated;
-
- if (display_source_mode) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
- php_get_highlight_struct(&syntax_highlighter_ini);
- zend_highlight(&syntax_highlighter_ini);
- fclose(file_handle.handle.fp);
- return OK;
- } else {
- return NOT_FOUND;
- }
- } else {
- (void) php_execute_script(&file_handle CLS_CC ELS_CC);
- }
-
- php3_header(); /* Make sure headers have been sent */
- php_end_ob_buffering(1);
- return (OK);
-}
-
void php_save_umask()
{
saved_umask = umask(077);
disclaimer="Do NOT edit - this file is generated by preconfig"
# security check - simply overwriting existing files could be harmful
-if test -w configure.in.new || test -w acconfig.h.new ; then
- echo "Please remove the *.new files and rerun this command"
+if test -w acconfig.h.new ; then
+ echo "Please remove acconfig.h.new and rerun this command"
exit 1
fi
-makefileams=`find ext sapi -name Makefile.am -print | sort`
-makefiles=`echo $makefileams | sed -e 's/\.am//g'`
-echo "dnl $disclaimer" > configure.in.new
-sed -e "s#@@EXT_MAKEFILES@@#$makefiles#" configure.in.in >> configure.in.new
-cmp configure.in configure.in.new > /dev/null 2>&1
-if test $? -ne 0 ; then
- mv configure.in.new configure.in
-else
- rm -f configure.in.new
-fi
-
echo "/* $disclaimer */" > acconfig.h.new
cat acconfig.h.in >> acconfig.h.new
confighfiles=`echo ext/*/config.h.stub`