summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in10
-rw-r--r--acconfig.h.in3
-rw-r--r--acinclude.m45
-rwxr-xr-xbuildconf4
-rw-r--r--configure.in.in33
-rw-r--r--ext/bcmath/php3_bcmath.h4
-rw-r--r--ext/db/db.c8
-rw-r--r--ext/db/php3_db.h (renamed from ext/db/db.h)10
-rw-r--r--ext/gd/php3_gd.h4
-rw-r--r--ext/standard/php3_standard.h2
-rw-r--r--foo14
-rw-r--r--genif.pl23
-rw-r--r--main/internal_functions.c.in (renamed from internal_functions.c)80
-rw-r--r--main/internal_functions_registry.h4
-rwxr-xr-xscripts/armerge2
15 files changed, 95 insertions, 111 deletions
diff --git a/Makefile.in b/Makefile.in
index 3fbb56bc96..a4c1fe73d2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -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
diff --git a/acconfig.h.in b/acconfig.h.in
index 99d9b69ba4..60dc64af86 100644
--- a/acconfig.h.in
+++ b/acconfig.h.in
@@ -120,3 +120,6 @@
/* Define if you have broken sprintf function like SunOS 4 */
#define BROKEN_SPRINTF 0
+
+/* Define to compile PHP/Zend thread safe */
+/* #undef ZTS */
diff --git a/acinclude.m4 b/acinclude.m4
index 04d7f17d10..12c4c6e2ba 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -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)
diff --git a/buildconf b/buildconf
index 8008eb73d5..90027ec3d8 100755
--- 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/)
diff --git a/configure.in.in b/configure.in.in
index c30f89f68e..c94509aaee 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -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
diff --git a/ext/bcmath/php3_bcmath.h b/ext/bcmath/php3_bcmath.h
index 68fb5fa911..8656f83339 100644
--- a/ext/bcmath/php3_bcmath.h
+++ b/ext/bcmath/php3_bcmath.h
@@ -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
diff --git a/ext/db/db.c b/ext/db/db.c
index d5400c819e..70ba058b03 100644
--- a/ext/db/db.c
+++ b/ext/db/db.c
@@ -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
diff --git a/ext/db/db.h b/ext/db/php3_db.h
index acda632ac8..ded7774ffd 100644
--- a/ext/db/db.h
+++ b/ext/db/php3_db.h
@@ -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 */
diff --git a/ext/gd/php3_gd.h b/ext/gd/php3_gd.h
index 912fa5d740..ea25c06aca 100644
--- a/ext/gd/php3_gd.h
+++ b/ext/gd/php3_gd.h
@@ -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
diff --git a/ext/standard/php3_standard.h b/ext/standard/php3_standard.h
index a3920e30e7..6d52439991 100644
--- a/ext/standard/php3_standard.h
+++ b/ext/standard/php3_standard.h
@@ -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 46111e204b..125c655b0f 100644
--- 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
index 0000000000..cf15e2eb92
--- /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);
diff --git a/internal_functions.c b/main/internal_functions.c.in
index dd2cd0925c..510dd37d61 100644
--- a/internal_functions.c
+++ b/main/internal_functions.c.in
@@ -40,88 +40,18 @@
#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@
};
diff --git a/main/internal_functions_registry.h b/main/internal_functions_registry.h
index 6e58de6ef1..bc23d37e1f 100644
--- a/main/internal_functions_registry.h
+++ b/main/internal_functions_registry.h
@@ -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 */
diff --git a/scripts/armerge b/scripts/armerge
index 2b9f4b61a0..48352e43bd 100755
--- a/scripts/armerge
+++ b/scripts/armerge
@@ -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