Permalink
Browse files

* added --enable-thread-safety switch

* now generating internal_functions.c
  • Loading branch information...
1 parent 9a4031a commit 9a66ffbaeec378acabd6f2f64b10dc0b9e2374a5 Stig Bakken committed May 3, 1999
View
@@ -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
View
@@ -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 */
View
@@ -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)
View
@@ -24,5 +24,5 @@ else
echo created or modified configure
fi
-cd libzend; ./buildconf libzend/
-
+(cd libzend; ./buildconf libzend/)
+(cd TSRM; ./buildconf TSRM/)
View
@@ -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
View
@@ -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
View
@@ -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
@@ -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 */
View
@@ -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
@@ -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:
View
14 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
View
@@ -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);
@@ -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@
};
@@ -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 */
View
@@ -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

0 comments on commit 9a66ffb

Please sign in to comment.