]> granicus.if.org Git - php/commitdiff
* added --enable-thread-safety switch
authorStig Bakken <ssb@php.net>
Mon, 3 May 1999 11:11:23 +0000 (11:11 +0000)
committerStig Bakken <ssb@php.net>
Mon, 3 May 1999 11:11:23 +0000 (11:11 +0000)
* now generating internal_functions.c

15 files changed:
Makefile.in
acconfig.h.in
acinclude.m4
buildconf
configure.in.in
ext/bcmath/php3_bcmath.h
ext/db/db.c
ext/db/php3_db.h [moved from ext/db/db.h with 96% similarity]
ext/gd/php3_gd.h
ext/standard/php3_standard.h
foo
genif.pl [new file with mode: 0644]
main/internal_functions.c.in [moved from internal_functions.c with 60% similarity]
main/internal_functions_registry.h
scripts/armerge

index 3fbb56bc96d9917b67e6f1612904873dde8fa529..a4c1fe73d2da8cd3635f82570c4ce67c1cb127a6 100644 (file)
@@ -34,7 +34,7 @@ VPATH = @srcdir@
 bindir = @bindir@
 
 ZEND_DIR = $(srcdir)/libzend
-SUBDIRS=$(srcdir)/libzend ext
+SUBDIRS=$(srcdir)/libzend ext @TSRM_DIR@
 
 CC = @CC@
 AR = ar rc
@@ -43,7 +43,7 @@ INSTALL_IT = @INSTALL_IT@
 EXTRA_LIBS = @EXTRA_LIBS@
 EXT_LIBS = @EXT_LIBS@
 INCLUDES = @INCLUDES@
-INCLUDE = -I$(srcdir) -I. -I$(ZEND_DIR) $(INCLUDES)
+INCLUDE = -I$(srcdir) -I. -I$(ZEND_DIR) -I$(srcdir)/TSRM $(INCLUDES)
 PROF_CFLAGS =
 CFLAGS_SHLIB = @CFLAGS_SHLIB@
 LDFLAGS_SHLIB = @LDFLAGS_SHLIB@
@@ -83,20 +83,20 @@ maintainer-clean-depend-recursive:
        done && test -z "$$fail"
 
 # CGI binary or fhttpd module
-php: all-recursive $(OBJS) @REGEX_LIB@ @FHTTPD_LIB@
+php: all-recursive $(OBJS) @REGEX_LIB@ @FHTTPD_LIB@ @TSRM_LIB@
        $(CC) $(CFLAGS) -o $(BINNAME) $(LDFLAGS) $(OBJS) $(LIBS)
 
 # Apache modules
 libphp3.a libmodphp3.a: all-recursive $(OBJS)
        $(AR) $@.tmp $(OBJS)
-       $(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a $(srcdir)/libzend/libzend.a
+       $(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a libzend/libzend.a @TSRM_LIB@
        @rm -f $@.tmp
        $(RANLIB) $(BINNAME)
 
 # Apache modules
 libmodphp3-so.a: all-recursive $(OBJS)
        $(AR) $@.tmp $(OBJS)
-       $(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a $(srcdir)/libzend/libzend.a
+       $(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a libzend/libzend.a @TSRM_LIB@
        @rm -f $@.tmp
        $(RANLIB) libmodphp3-so.a
 
index 99d9b69ba47ed5b2ad4dd3d3c61d34fab4818969..60dc64af86f975170e1c4fb32ef6c91955c43a6d 100644 (file)
 
 /* Define if you have broken sprintf function like SunOS 4 */
 #define BROKEN_SPRINTF 0
+
+/* Define to compile PHP/Zend thread safe */
+/* #undef ZTS */
index 04d7f17d10d322e0c04d02202d46ff6172926265..12c4c6e2ba3134ddc624784dcf220867ba00024d 100644 (file)
@@ -71,8 +71,13 @@ AC_DEFUN(PHP_EXTENSION,[
   _extlib="libphpext_$1.a"
   EXT_LIBS="$EXT_LIBS $1/$_extlib"
   EXTINFO_DEPS="$EXTINFO_DEPS ../ext/$1/extinfo.c.stub"
+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 "
 ])
 
 AC_SUBST(EXT_SUBDIRS)
 AC_SUBST(EXT_LIBS)
 AC_SUBST(EXTINFO_DEPS)
+dnl AC_SUBST(EXT_INCLUDE_CODE)
+dnl AC_SUBST(EXT_MODULES_PTRS)
index 8008eb73d5214d49d45aa8df9f6f00b3e25a17a5..90027ec3d8caca9269b7f2138d167c79e0e25c52 100755 (executable)
--- a/buildconf
+++ b/buildconf
@@ -24,5 +24,5 @@ else
     echo created or modified configure
 fi
 
-cd libzend; ./buildconf libzend/
-
+(cd libzend; ./buildconf libzend/)
+(cd TSRM; ./buildconf TSRM/)
index c30f89f68e5772a67d0f566e0564cdc67cc45b90..c94509aaeef1e9da346de4b362284937913f1e8c 100644 (file)
@@ -11,12 +11,17 @@ for arg in $@; do
                ## This is to prevent "./config.status --recheck" from
                ## running configure in libzend again.
                --no-recursion) recurse=no;;
+               --enable-thread-safety) threadsafe=yes;;
                *) ;;
        esac
 done
 
 if test "$recurse" = "yes"; then
-       (cwd=`pwd`; set -x; cd $srcdir/libzend; ./configure --cache-file=$cwd/config.cache $@)
+       cwd=`pwd`
+       (set -x; cd $srcdir/libzend; ./configure --cache-file=$cwd/config.cache $@)
+       if test "$threadsafe" = "yes"; then
+               (set -x; cd $srcdir/TSRM; ./configure --cache-file=$cwd/config.cache $@)
+       fi
 fi
 
 dnl ## Diversion 1 is the initial checking of OS features, programs,
@@ -699,6 +704,18 @@ 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
+  AC_DEFINE(ZTS)
+],[
+  TSRM_DIR=""
+])
+AC_SUBST(TSRM_DIR)
+AC_SUBST(TSRM_LIB)
+
 dnl AC_MSG_CHECKING(whether to enable PHP RPC support)
 dnl AC_ARG_ENABLE(php-rpc,
 dnl [  --enable-php-rpc        Compile with PHP RPC support.],
@@ -854,6 +871,20 @@ AC_OUTPUT(Makefile build-defs.h libphp3.module
 chmod +x scripts/mkextlib
 ], [
 
+# Hacking while airborne considered harmful.
+#
+echo "creating internal_functions.c"
+extensions=\`grep '^s.@EXT_SUBDIRS@' \$0|sed -e 's/^.*@% *//' -e 's/%.*$//'\`
+mv -f internal_functions.c internal_functions.c.old 2>/dev/null
+perl genif.pl internal_functions.c.in \$extensions > internal_functions.c
+if cmp internal_functions.c.old internal_functions.c > /dev/null 2>&1; then
+    echo "internal_functions.c is unchanged"
+    mv internal_functions.c.old internal_functions.c
+else
+    rm -f internal_functions.c.old
+fi
+
+
 dnl Warn about CGI version with no extra security options.
 if test "$BINNAME" = "php"; then
        if test "$REDIRECT" = "0"; then
index 68fb5fa911b2a98f675020b62a87fd105d9cd31a..8656f833393cc6fbfee4f6db8e24a4a42840c548 100644 (file)
@@ -41,7 +41,7 @@
 #if WITH_BCMATH
 
 extern php3_module_entry bcmath_module_entry;
-#define bcmath_module_ptr &bcmath_module_entry
+#define phpext_bcmath_ptr &bcmath_module_entry
 
 extern int php3_rinit_bcmath(INIT_FUNC_ARGS);
 extern int php3_rend_bcmath(SHUTDOWN_FUNC_ARGS);
@@ -57,7 +57,7 @@ extern void php3_bcmath_set_scale(INTERNAL_FUNCTION_PARAMETERS);
 
 #else
 
-#define bcmath_module_ptr NULL
+#define phpext_bcmath_ptr NULL
 
 #endif
 
index d5400c819e3cb399e47277cf8f5f51a49f6089dc..70ba058b032e024dfc98b0f28f468c11d5c02fc4 100644 (file)
@@ -158,14 +158,10 @@ int flatfile_findkey(FILE *dbf, datum key);
 int flatfile_delete(FILE *dbf, datum key);
 datum flatfile_firstkey(FILE *dbf);
 datum flatfile_nextkey(FILE *dbf);
-#ifdef PHP_31
-#include "php3_db.h"
-#include "ext/standard/php3_string.h"
-#else
-#endif
 
 #endif
-#include "db.h"
+
+#include "php3_db.h"
 #include "ext/standard/php3_string.h"
 
 #if THREAD_SAFE
similarity index 96%
rename from ext/db/db.h
rename to ext/db/php3_db.h
index acda632ac8f1126ce033d6a7278fe9c1f0d9ec9e..ded7774ffd134d675be8351ef396afb9262f5605 100644 (file)
@@ -41,7 +41,7 @@
 
 
 extern php3_module_entry dbm_module_entry;
-#define dbm_module_ptr &dbm_module_entry
+#define phpext_db_ptr &dbm_module_entry
 
 
 
@@ -58,8 +58,8 @@ typedef struct dbm_info {
   do not want flatfile compiled staticly
 */
 #if defined(MSVC5) && !defined(COMPILE_DL)
-#undef dbm_module_ptr
-#define dbm_module_ptr NULL
+#undef phpext_db_ptr
+#define phpext_db_ptr NULL
 #endif
 
 dbm_info *_php3_finddbm(pval *id,HashTable *list);
@@ -88,7 +88,7 @@ extern void php3_dbmdelete(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_dbmfirstkey(INTERNAL_FUNCTION_PARAMETERS);
 extern void php3_dbmnextkey(INTERNAL_FUNCTION_PARAMETERS);
 
-#undef dbm_module_ptr
-#define dbm_module_ptr NULL
+#undef phpext_db_ptr
+#define phpext_db_ptr  NULL
 
 #endif /* _PHP3_DB_H */
index 912fa5d74020937ae3d96987bd730a6f6a3ab4ff..ea25c06aca67b0f1931c377e88a634c80ce3f240 100644 (file)
@@ -44,7 +44,7 @@
 #include <gd.h>
 
 extern php3_module_entry gd_module_entry;
-#define gd_module_ptr &gd_module_entry
+#define phpext_gd_ptr &gd_module_entry
 
 /* gd.c functions */
 extern void php3_info_gd(void);
@@ -95,7 +95,7 @@ extern void php3_imagettftext(INTERNAL_FUNCTION_PARAMETERS);
 #endif
 #else
 
-#define gd_module_ptr NULL
+#define phpext_gd_ptr NULL
 
 #endif
 
index a3920e30e705971c8d7c49429ffa038617f5d7ef..6d524399912f53a2cb2afd3ee2f23553e32909c7 100644 (file)
@@ -66,7 +66,7 @@
 #include "post.h"
 #include "mime.h"
 
-#define standard_module_ptr basic_functions_module_ptr
+#define phpext_standard_ptr basic_functions_module_ptr
 
 /*
  * Local variables:
diff --git a/foo b/foo
index 46111e204b9711e0991dce6a2b4aec0291a01b52..125c655b0fe11f7c9eb5518d5eb0567b830e00e3 100644 (file)
--- a/foo
+++ b/foo
@@ -1,9 +1,5 @@
-*** Testing assignments and variable aliasing: ***<br>
-<?php 
-  /* This test tests assignments to variables using other variables as variable-names */
-  $a = "b"; 
-       print "hey";
-  $$a = "test"; 
-  $$$a = "blah"; 
-       print "hey";
-?>
+a
+b
+@c@
+d
+e
diff --git a/genif.pl b/genif.pl
new file mode 100644 (file)
index 0000000..cf15e2e
--- /dev/null
+++ b/genif.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+
+$in_file = shift || die "Give .in file as first parameter";
+@extensions = @ARGV;
+
+open(IN, $in_file) or die "Could not open .in file $in_file";
+while (<IN>) {
+    if (/\@EXT_INCLUDE_CODE\@/) {
+       foreach $ext (@extensions) {
+           $hdr_file = "ext/$ext/php3_${ext}.h";
+           if (-f $hdr_file) {
+               print "#include \"ext/${ext}/php3_${ext}.h\"\n";
+           }
+       }
+    } elsif (/\@EXT_MODULE_PTRS\@/) {
+       foreach $ext (@extensions) {
+           print "    phpext_${ext}_ptr,\n";
+       }
+    } else {
+       print;
+    }
+}
+close(IN);
similarity index 60%
rename from internal_functions.c
rename to main/internal_functions.c.in
index dd2cd0925c36139db7bb61e1e5f06ab4efbb9982..510dd37d6164b7ab5eb85d10e937892fa89cab01 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 
-#include "ext/standard/php3_standard.h"
-#include "ext/gd/php3_gd.h"
-#include "ext/dbase/dbase.h"
-#include "ext/odbc/php3_odbc.h"
-#include "ext/gettext/php3_gettext.h"
+@EXT_INCLUDE_CODE@
 
-#include "ext/informix/php3_ifx.h"
-#include "ext/ldap/php3_ldap.h"
-#include "ext/mysql/php3_mysql.h"
-#include "ext/bcmath/php3_bcmath.h"
-#include "ext/msql/php3_msql.h"
-#include "ext/oracle/php3_oci8.h"
-#include "ext/oracle/oracle.h"
-#include "ext/pgsql/php3_pgsql.h"
-#include "ext/sybase/php3_sybase.h"
-#include "ext/sybase/php3_sybase-ct.h"
-#include "ext/imap/imap.h"
-#include "ext/standard/head.h"
-#include "ext/standard/post.h"
-#include "ext/hyperwave/hw.h"
-#include "ext/filepro/filepro.h"
-#include "ext/db/db.h"
-#include "dl/snmp/php3_snmp.h"
-#include "ext/zlib/php3_zlib.h"
-#include "ext/com/php3_COM.h"
-#include "ext/interbase/php3_interbase.h"
-#include "ext/xml/php3_xml.h"
-#include "ext/pdf/php3_pdf.h"
-#include "ext/fdf/php3_fdf.h"
-#include "ext/sysvsem/php3_sysvsem.h"
-#include "ext/sysvshm/php3_sysvshm.h"
-#include "ext/dav/php3_dav.h"
-#include "ext/mcrypt/php_mcrypt.h"
+/* SNMP has to be moved to ext */
+/* #include "dl/snmp/php3_snmp.h" */
 
 unsigned char first_arg_force_ref[] = { 1, BYREF_FORCE };
 unsigned char first_arg_allow_ref[] = { 1, BYREF_ALLOW };
 unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
 unsigned char second_arg_allow_ref[] = { 2, BYREF_NONE, BYREF_ALLOW };
 
-zend_module_entry *php3_builtin_modules[] = 
-{
-       basic_functions_module_ptr,
-       dl_module_ptr,
-       php3_dir_module_ptr,
-       php3_filestat_module_ptr,
-       php3_file_module_ptr,
-       php3_header_module_ptr,
-       mcrypt_module_ptr,
-       mail_module_ptr,
-       syslog_module_ptr,
-       mysql_module_ptr,
-       msql_module_ptr,
-       pgsql_module_ptr,
-       ifx_module_ptr,
-       ldap_module_ptr,
-       filepro_module_ptr,
-       sybase_module_ptr,
-       sybct_module_ptr,
-       odbc_module_ptr,
-       dbase_module_ptr,
-       hw_module_ptr,
-       regexp_module_ptr,
-       gd_module_ptr,
-       oci8_module_ptr,
-       oracle_module_ptr,
-       apache_module_ptr,
-       crypt_module_ptr,
-       dbm_module_ptr,
-       bcmath_module_ptr,
-       snmp_module_ptr,
-       pack_module_ptr,
-       php3_zlib_module_ptr,
-       COM_module_ptr,
-       php3_imap_module_ptr,
-       php3_ibase_module_ptr,
-       xml_module_ptr,
-       pdf_module_ptr,
-       fdf_module_ptr,
-       sysvsem_module_ptr,
-       sysvshm_module_ptr,
-       phpdav_module_ptr,
-       php3_gettext_module_ptr,
+zend_module_entry *php3_builtin_modules[] = {
+@EXT_MODULE_PTRS@
 };
 
        
index 6e58de6ef1ddf8cd5bd6343ea92cfefc6c950b66..bc23d37e1f65a0652d022ebf4804bac00f0b2d7e 100644 (file)
@@ -38,10 +38,10 @@ extern int php3_init_mime(INIT_FUNC_ARGS);
 
 #if APACHE
 extern php3_module_entry apache_module_entry;
-#define apache_module_ptr &apache_module_entry
+#define phpext_apache_ptr &apache_module_entry
 extern void php3_virtual(INTERNAL_FUNCTION_PARAMETERS);
 #else
-#define apache_module_ptr NULL
+#define phpext_apache_ptr NULL
 #endif
 
 /* environment functions */
index 2b9f4b61a0bc824e7476ecaf98f9d94c8135f2b8..48352e43bd1d7f7a251c68933f8f1cc75746b22d 100755 (executable)
@@ -65,7 +65,7 @@ for archive in $in_archives; do
     if test "$dir" = "."; then
        ext_files=$files
     else
-       prefix=`echo $dir | sed -e 's#/#_#g'`_
+       prefix=`echo $dir | sed -e 's#^\./##' -e 's#/#_#g'`_
        prefix=`echo $prefix | sed -e 's#^\.\._##g'`
        ext_files=""
        for file in $files; do