summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in9
-rw-r--r--acconfig.h.in2
-rw-r--r--acinclude.m452
-rwxr-xr-xbuildconf4
-rw-r--r--configure.in (renamed from configure.in.in)39
-rw-r--r--sapi/apache/Makefile.am2
-rw-r--r--sapi/apache/Makefile.inc1
-rw-r--r--sapi/apache/apache.c99
-rw-r--r--sapi/apache/config.m417
-rw-r--r--sapi/apache/libphp4.module.in (renamed from libphp4.module.in)0
-rw-r--r--sapi/apache/mod_php4.c40
-rwxr-xr-xscripts/preconfig15
12 files changed, 176 insertions, 104 deletions
diff --git a/Makefile.in b/Makefile.in
index fdbbe5677d..ed58baecd3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -72,10 +72,11 @@ APXS_EXP = @APXS_EXP@
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 \
diff --git a/acconfig.h.in b/acconfig.h.in
index c76094f1cf..a35e2e4a1b 100644
--- a/acconfig.h.in
+++ b/acconfig.h.in
@@ -122,3 +122,5 @@
/* Define when compiling with Zeus support */
#undef WITH_ZEUS
+/* Define if struct sockaddr contains the field sa_len */
+#undef HAVE_SOCKADDR_SA_LEN
diff --git a/acinclude.m4 b/acinclude.m4
index 5f168a373f..a97e523ee6 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -159,24 +159,25 @@ AC_DEFUN(AC_BROKEN_SPRINTF,[
])
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
])
@@ -184,9 +185,6 @@ AC_SUBST(EXT_SUBDIRS)
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
@@ -277,3 +275,21 @@ AC_DEFUN(AC_SYS_LFS,
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"
+])
diff --git a/buildconf b/buildconf
index b2de3c0c94..ac2e0d961f 100755
--- a/buildconf
+++ b/buildconf
@@ -136,7 +136,9 @@ fi
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
diff --git a/configure.in.in b/configure.in
index 231de7f4a4..13887eb562 100644
--- a/configure.in.in
+++ b/configure.in
@@ -14,12 +14,11 @@ fi
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,
@@ -614,12 +613,19 @@ AC_ARG_ENABLE(magic-quotes,
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)
@@ -735,10 +741,9 @@ AC_SUBST(PHP_LIBS)
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"
@@ -747,8 +752,8 @@ if test ! -f $srcdir/ext/bcmath/number.c; then
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.
#
@@ -793,6 +798,6 @@ fi
divert
-# Local Variables:
-# tab-width: 4
-# End:
+dnl ## Local Variables:
+dnl ## tab-width: 4
+dnl ## End:
diff --git a/sapi/apache/Makefile.am b/sapi/apache/Makefile.am
index 8661c36f80..e5c8b14a99 100644
--- a/sapi/apache/Makefile.am
+++ b/sapi/apache/Makefile.am
@@ -3,4 +3,4 @@
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
diff --git a/sapi/apache/Makefile.inc b/sapi/apache/Makefile.inc
index 8b62c74c35..69dc6237f1 100644
--- a/sapi/apache/Makefile.inc
+++ b/sapi/apache/Makefile.inc
@@ -20,4 +20,5 @@ libmodphp4-so.a: all-recursive $(OBJS) sapi/libphpsapi.a $(REGEX_LIB)
# 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)
diff --git a/sapi/apache/apache.c b/sapi/apache/apache.c
new file mode 100644
index 0000000000..0e8b8029af
--- /dev/null
+++ b/sapi/apache/apache.c
@@ -0,0 +1,99 @@
+/*
+ +----------------------------------------------------------------------+
+ | 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=&eg;
+ 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:
+ */
diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4
index b1bd590ed2..7489f25fd6 100644
--- a/sapi/apache/config.m4
+++ b/sapi/apache/config.m4
@@ -1,14 +1,5 @@
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
@@ -42,7 +33,8 @@ AC_ARG_WITH(apxs,
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
@@ -168,6 +160,11 @@ dnl## AC_SUBST(APACHE_INCLUDE)
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)
diff --git a/libphp4.module.in b/sapi/apache/libphp4.module.in
index 9b80f6c742..9b80f6c742 100644
--- a/libphp4.module.in
+++ b/sapi/apache/libphp4.module.in
diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c
index 2f844738f6..bb67e4a9f5 100644
--- a/sapi/apache/mod_php4.c
+++ b/sapi/apache/mod_php4.c
@@ -93,46 +93,6 @@ php_apache_info_struct php_apache_info; /* active config */
/* 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=&eg;
- 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);
diff --git a/scripts/preconfig b/scripts/preconfig
index 4813fb2687..95068a03c8 100755
--- a/scripts/preconfig
+++ b/scripts/preconfig
@@ -5,22 +5,11 @@
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`