]> granicus.if.org Git - php/commitdiff
Decent configure speedup. Makefiles are now generated only for the
authorStig Bakken <ssb@php.net>
Wed, 29 Sep 1999 15:17:02 +0000 (15:17 +0000)
committerStig Bakken <ssb@php.net>
Wed, 29 Sep 1999 15:17:02 +0000 (15:17 +0000)
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).

12 files changed:
Makefile.in
acconfig.h.in
acinclude.m4
buildconf
configure.in [moved from configure.in.in with 96% similarity]
sapi/apache/Makefile.am
sapi/apache/Makefile.inc
sapi/apache/apache.c [new file with mode: 0644]
sapi/apache/config.m4
sapi/apache/libphp4.module.in [moved from libphp4.module.in with 100% similarity]
sapi/apache/mod_php4.c
scripts/preconfig

index fdbbe5677dbc2bc09b49a15d1cd9f46715bbf1cd..ed58baecd36e9bad9dd418b39947d035fa2002d2 100644 (file)
@@ -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 \
index c76094f1cfafa3a6f53450c904618dd9d2dc274b..a35e2e4a1bc2131b974efae4b65a4c9f105b7126 100644 (file)
 /* Define when compiling with Zeus support */
 #undef WITH_ZEUS
 
+/* Define if struct sockaddr contains the field sa_len */
+#undef HAVE_SOCKADDR_SA_LEN
index 5f168a373f0cf278c52cdcbcf09bc02bf5ef81cb..a97e523ee6de4a575b79183d68b1e86d0ac47a90 100644 (file)
@@ -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"
+])
index b2de3c0c948225ac8d58e1263d0b433f1c9d1c04..ac2e0d961f4b0cab023caf301414f19ea4c39a97 100755 (executable)
--- 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
similarity index 96%
rename from configure.in.in
rename to configure.in
index 231de7f4a45f246c95743a1f14d2f9583f4ef2c3..13887eb562b613f6510d93d3432b5fc2de05b4ed 100644 (file)
@@ -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:
index 8661c36f808cd86a39da8d3c7ef9655a4ad2cb7b..e5c8b14a996a799a57e77254651a082466691414 100644 (file)
@@ -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
index 8b62c74c35b763ed86259a49e160d22998d1cfe7..69dc6237f1c0330b807b2a8ea675eb7d8b403962 100644 (file)
@@ -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 (file)
index 0000000..0e8b802
--- /dev/null
@@ -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:
+ */
index b1bd590ed2ee0489e78262d356a95afc09936d50..7489f25fd60dba136477bd2b77e1610d13aa9618 100644 (file)
@@ -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)
index 2f844738f6fe8e0ad000942fbb18c3c86539b116..bb67e4a9f5d6c78e7903a5dd38e5331f192964da 100644 (file)
@@ -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);
index 4813fb26872ac96d4d1f89a6832e37a9ea0bdfb8..95068a03c8ddbf8158fc20ef52468231e27149f8 100755 (executable)
@@ -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`