From a481fddfb363d13ed28036bf94974c968197ca2b Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Mon, 1 May 2000 02:42:55 +0000 Subject: [PATCH] Improved in-tree shared libraries build system The following new/revived shared modules are available now: ... MySQL (*) ... PCRE (*) ... Session ... SWF (*) capable of using bundled library or external library All changes: The m4 macro PHP_EXTENSION was revamped. Uses LIB_BUILD now. This effectively means that all extensions have to use dynlib. ext/mysql/config.m4 was revamped. Uses LIB_BUILD for building bundled library. ext/pcre/config.m4 was revamped. Uses LIB_BUILD for building bundled library. ext/ext_skel was changed to reflect that more modules should be compileable as shared module. ext/Makefile.in has been simplified enormously. Dependencies are now stored in the build tree. Empty dependencies are not generated by buildconf anymore. They are now dynamically created during the build process. Implicit rules for .S were removed. The NO_RECURSION feature was removed. "libs.mk" has been added to all cvsignore files in ext. --- acinclude.m4 | 80 ++++++++++++++++----- build/build2.mk | 11 +-- build/dynlib.mk | 5 ++ build/rules.mk | 45 +++++------- configure.in | 10 +-- dynlib.m4 | 64 +++++++++++++++++ ext/Makefile.in | 14 +--- ext/aspell/Makefile.in | 2 +- ext/bcmath/Makefile.in | 2 +- ext/calendar/Makefile.in | 2 +- ext/cpdf/Makefile.in | 2 +- ext/cybercash/Makefile.in | 2 +- ext/dav/Makefile.in | 2 +- ext/db/Makefile.in | 2 +- ext/dba/Makefile.in | 2 +- ext/dbase/Makefile.in | 2 +- ext/domxml/Makefile.in | 2 +- ext/ext_skel | 10 +-- ext/fdf/Makefile.in | 2 +- ext/filepro/Makefile.in | 2 +- ext/ftp/Makefile.in | 2 +- ext/gd/Makefile.in | 2 +- ext/gettext/Makefile.in | 2 +- ext/hyperwave/Makefile.in | 2 +- ext/icap/Makefile.in | 2 +- ext/imap/Makefile.in | 2 +- ext/informix/Makefile.in | 2 +- ext/interbase/Makefile.in | 2 +- ext/java/Makefile.in | 2 +- ext/ldap/Makefile.in | 2 +- ext/mcal/Makefile.in | 2 +- ext/mcrypt/Makefile.in | 2 +- ext/mhash/Makefile.in | 2 +- ext/msql/Makefile.in | 2 +- ext/mysql/Makefile.in | 4 +- ext/mysql/config.m4 | 18 +++-- ext/mysql/libmysql/Makefile.in | 2 +- ext/oci8/Makefile.in | 2 +- ext/odbc/Makefile.in | 2 +- ext/oracle/Makefile.in | 2 +- ext/pcre/Makefile.in | 4 +- ext/pcre/config.m4 | 110 +++++++++++++---------------- ext/pcre/config0.m4 | 110 +++++++++++++---------------- ext/pcre/pcrelib/Makefile.in | 2 +- ext/pcre/php_pcre.c | 4 ++ ext/pdf/Makefile.in | 2 +- ext/pgsql/Makefile.in | 2 +- ext/posix/Makefile.in | 2 +- ext/readline/Makefile.in | 2 +- ext/recode/Makefile.in | 2 +- ext/rpc/Makefile.in | 2 +- ext/rpc/java/Makefile.in | 2 +- ext/session/Makefile.in | 4 +- ext/session/config.m4 | 19 +++-- ext/session/session.c | 4 ++ ext/snmp/Makefile.in | 2 +- ext/standard/Makefile.in | 2 +- ext/swf/Makefile.in | 4 +- ext/swf/config.m4 | 16 +++-- ext/swf/php_swf.h | 2 +- ext/swf/swf.c | 6 +- ext/sybase/Makefile.in | 2 +- ext/sybase_ct/Makefile.in | 2 +- ext/sysvsem/Makefile.in | 2 +- ext/sysvshm/Makefile.in | 2 +- ext/wddx/Makefile.in | 2 +- ext/xml/Makefile.in | 2 +- ext/xml/config.m4 | 26 +++---- ext/xml/expat/Makefile.in | 2 +- ext/xml/expat/xmlparse/Makefile.in | 2 +- ext/xml/expat/xmltok/Makefile.in | 2 +- ext/yp/Makefile.in | 2 +- ext/zlib/Makefile.in | 2 +- 73 files changed, 388 insertions(+), 284 deletions(-) create mode 100644 build/dynlib.mk create mode 100644 dynlib.m4 diff --git a/acinclude.m4 b/acinclude.m4 index bd95759a400..8abbc2f6293 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2,6 +2,8 @@ dnl $Id$ dnl dnl This file contains local autoconf functions. +sinclude(dynlib.m4) + dnl dnl PHP_LIBGCC_LIBPATH(gcc) dnl Stores the location of libgcc in libgcc_libpath @@ -11,15 +13,44 @@ AC_DEFUN(PHP_LIBGCC_LIBPATH,[ libgcc_libpath="`dirname $ac_data`" ]) +AC_DEFUN(PHP_ARG_ANALYZE,[ +case "[$]$1" in +shared,*) + ext_output="yes, shared" + ext_shared=yes + $1=`echo $ac_n "[$]$1$ac_c"|sed s/^shared,//` + ;; +shared) + ext_output="yes, shared" + ext_shared=yes + $1=yes + ;; +no) + ext_output="no" + ext_shared=no + ;; +*) + ext_output="yes" + ext_shared=no + ;; +esac + +AC_MSG_RESULT($ext_output) +]) + dnl dnl PHP_ARG_WITH(arg-name, check message, help text[, default-val]) dnl Sets PHP_ARG_NAME either to the user value or to the default value. dnl default-val defaults to no. dnl AC_DEFUN(PHP_ARG_WITH,[ +PHP_REAL_ARG_WITH([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_)) +]) + +AC_DEFUN(PHP_REAL_ARG_WITH,[ AC_MSG_CHECKING($2) -AC_ARG_WITH($1,[$3],PHP_[]translit($1,a-z-,A-Z_)=[$]withval,PHP_[]translit($1,a-z-,A-Z_)=ifelse($4,,no,$4)) -AC_MSG_RESULT([$]PHP_[]translit($1,a-z-,A-Z_)) +AC_ARG_WITH($1,[$3],$5=[$]withval,$5=ifelse($4,,no,$4)) +PHP_ARG_ANALYZE($5) ]) dnl @@ -28,9 +59,13 @@ dnl Sets PHP_ARG_NAME either to the user value or to the default value. dnl default-val defaults to no. dnl AC_DEFUN(PHP_ARG_ENABLE,[ +PHP_REAL_ARG_ENABLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_)) +]) + +AC_DEFUN(PHP_REAL_ARG_ENABLE,[ AC_MSG_CHECKING($2) -AC_ARG_ENABLE($1,[$3],PHP_[]translit($1,a-z-,A-Z_)=[$]enableval,PHP_[]translit($1,a-z-,A-Z_)=ifelse($4,,no,$4)) -AC_MSG_RESULT([$]PHP_[]translit($1,a-z-,A-Z_)) +AC_ARG_ENABLE($1,[$3],$5=[$]enableval,$5=ifelse($4,,no,$4)) +PHP_ARG_ANALYZE($5) ]) AC_DEFUN(PHP_MODULE_PTR,[ @@ -450,21 +485,30 @@ 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 "$abs_srcdir/ext/$1" ; then - ext_src_base="$abs_srcdir/ext/$1/" - ext_base="ext/$1/" - EXT_SUBDIRS="$EXT_SUBDIRS $1" - if test "$2" != "shared" && test "$2" != "yes" && test -z "$php_always_shared"; then - _extlib="lib$1.a" - EXT_LTLIBS="$EXT_LTLIBS ext/$1/lib$1.la" - EXT_LIBS="$EXT_LIBS $1/$_extlib" - EXT_STATIC="$EXT_STATIC $1" - else - AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z-,A-Z_), 1, Whether to build $1 as dynamic module) - EXT_SHARED="$EXT_SHARED $1" - fi - PHP_FAST_OUTPUT(ext/$1/Makefile) + EXT_SUBDIRS="$EXT_SUBDIRS $1" + + if test -d "$abs_srcdir/ext/$1"; then +dnl ---------------------------------------------- Internal Module + ext_builddir="ext/$1" + ext_srcdir="$abs_srcdir/ext/$1" + else +dnl ---------------------------------------------- External Module + ext_builddir="." + ext_srcdir="$abs_srcdir" fi + + if test "$2" != "shared" && test "$2" != "yes"; then +dnl ---------------------------------------------- Static module + LIB_BUILD($ext_builddir) + EXT_LTLIBS="$EXT_LTLIBS $ext_builddir/lib$1.la" + EXT_STATIC="$EXT_STATIC $1" + else +dnl ---------------------------------------------- Shared module + LIB_BUILD($ext_builddir,yes) + AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z-,A-Z_), 1, Whether to build $1 as dynamic module) + fi + + PHP_FAST_OUTPUT($ext_builddir/Makefile) ]) PHP_SUBST(EXT_SUBDIRS) diff --git a/build/build2.mk b/build/build2.mk index d74834355b7..b51f86ace40 100644 --- a/build/build2.mk +++ b/build/build2.mk @@ -39,14 +39,7 @@ acconfig_h_SOURCES = acconfig.h.in $(config_h_files) targets = $(TOUCH_FILES) $(makefile_in_files) configure $(config_h_in) -all: .deps Zend/Makefile.am TSRM/Makefile.am $(targets) - -.deps: - @echo creating empty dependencies - for i in `find ext sapi regex -type d \! -name \*CVS`; do \ - list="$$list $$i/.deps"; \ - done; \ - touch $$list pear/.deps ext/mysql/libmysql/.deps $@ +all: Zend/Makefile.am TSRM/Makefile.am $(targets) Zend/Makefile.am: test -d Zend || (test -d ../Zend && ln -s ../Zend Zend) @@ -71,7 +64,7 @@ $(makefile_in_files): $(makefile_am_files) aclocal.m4 configure.in $(config_m4_f || true >&2 @for i in $(LT_TARGETS); do mv $$i.bak $$i; done -aclocal.m4: configure.in acinclude.m4 +aclocal.m4: configure.in acinclude.m4 dynlib.m4 aclocal $(config_h_in): configure acconfig.h diff --git a/build/dynlib.mk b/build/dynlib.mk new file mode 100644 index 00000000000..d7e695cf180 --- /dev/null +++ b/build/dynlib.mk @@ -0,0 +1,5 @@ +all: all-recursive + +include $(builddir)/libs.mk + +include $(top_srcdir)/build/rules.mk diff --git a/build/rules.mk b/build/rules.mk index e034caaaf74..9e389efc217 100644 --- a/build/rules.mk +++ b/build/rules.mk @@ -33,13 +33,13 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@ mkinstalldirs = $(top_srcdir)/build/shtool mkdir -f -p INSTALL = $(top_srcdir)/build/shtool install -c INSTALL_DATA = $(INSTALL) -m 644 - +SHARED_COMPILE = $(SHARED_LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< && touch $@ DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I$(top_builddir) moduledir = $(libdir)/php/modules .SUFFIXES: -.SUFFIXES: .S .c .lo .o .s .y .l +.SUFFIXES: .slo .c .lo .o .s .y .l .c.o: $(COMPILE) -c $< @@ -47,17 +47,14 @@ moduledir = $(libdir)/php/modules .s.o: $(COMPILE) -c $< -.S.o: - $(COMPILE) -c $< - .c.lo: $(PHP_COMPILE) .s.lo: $(PHP_COMPILE) -.S.lo: - $(PHP_COMPILE) +.c.slo: + $(SHARED_COMPILE) .y.c: $(YACC) $(YFLAGS) $< && mv y.tab.c $*.c @@ -74,34 +71,30 @@ install: install-recursive distclean-recursive depend-recursive clean-recursive all-recursive install-recursive: @otarget=`echo $@|sed s/-recursive//`; \ - if test '$(NO_RECURSION)' != "$$otarget"; then \ - list='$(SUBDIRS)'; for i in $$list; do \ - target="$$otarget"; \ - echo "Making $$target in $$i"; \ - if test "$$i" = "."; then \ - ok=yes; \ - target="$$target-p"; \ - fi; \ - (cd $$i && $(MAKE) $$target) || exit 1; \ - done; \ - if test "$$otarget" = "all" && test -z '$(targets)'; then ok=yes; fi; \ - if test "$$ok" != "yes"; then $(MAKE) "$$otarget-p" || exit 1; fi; \ - fi; \ - if test -n '$(make_shared)'; then \ - $(MAKE) shared || exit 1; \ - fi; + list='$(SUBDIRS)'; for i in $$list; do \ + target="$$otarget"; \ + echo "Making $$target in $$i"; \ + if test "$$i" = "."; then \ + ok=yes; \ + target="$$target-p"; \ + fi; \ + if test ! -f $$i/.deps; then touch $$i/.deps; fi; \ + (cd $$i && $(MAKE) $$target) || exit 1; \ + done; \ + if test "$$otarget" = "all" && test -z '$(targets)'; then ok=yes; fi; \ + if test "$$ok" != "yes"; then $(MAKE) "$$otarget-p" || exit 1; fi all-p: $(targets) install-p: $(targets) $(install_targets) distclean-p depend-p clean-p: depend: depend-recursive - test "`echo *.c`" = '*.c' || perl $(top_srcdir)/build/mkdep.perl $(CPP) $(INCLUDES) $(EXTRA_INCLUDES) *.c > .deps + test "`echo *.c`" = '*.c' || perl $(top_srcdir)/build/mkdep.perl $(CPP) $(INCLUDES) $(EXTRA_INCLUDES) *.c > $(builddir)/.deps clean: clean-recursive clean-x clean-x: - rm -f $(targets) *.lo *.la *.o $(CLEANFILES) + rm -f $(targets) *.lo *.slo *.la *.o $(CLEANFILES) rm -rf .libs distclean: distclean-recursive clean-x @@ -115,7 +108,7 @@ install-modules: rm -f modules/*.la && \ cp modules/* $(moduledir) || true -include $(srcdir)/.deps +include $(builddir)/.deps .PHONY: all-recursive clean-recursive install-recursive \ $(install_targets) install all clean depend depend-recursive shared \ diff --git a/configure.in b/configure.in index 6f7cd86c397..bf4df292628 100644 --- a/configure.in +++ b/configure.in @@ -644,6 +644,7 @@ fi phplibdir="`pwd`/modules" +test -d $phplibdir || mkdir $phplibdir phptempdir="`pwd`/libs" AC_BUILD_RPATH @@ -697,7 +698,7 @@ PHP_SUBST(PHP_SAPI) PHP_SUBST(PHP_VERSION) PHP_SUBST(PROG_SENDMAIL) PHP_SUBST(SHELL) -PHP_SUBST(SHLIBTOOL) +PHP_SUBST(SHARED_LIBTOOL) PHP_SUBST(TSRM_DIR) PHP_SUBST(TSRM_LIB) PHP_SUBST(WARNING_LEVEL) @@ -732,12 +733,12 @@ fi PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<' if test "$enable_shared" = "yes"; then - SHLIBTOOL='$(LIBTOOL)' + SHARED_LIBTOOL='$(LIBTOOL)' else - if test -n "$EXT_SHARED"; then + if test "$lib_build_shared" = "yes"; then PHP_CONFIGURE_PART(Configuring shared libtool) $SHELL $srcdir/ltconfig --output=shlibtool --disable-static --srcdir=$srcdir --cache-file=./config.cache $srcdir/ltmain.sh - SHLIBTOOL='$(SHELL) $(top_builddir)/shlibtool' + SHARED_LIBTOOL='$(SHELL) $(top_builddir)/shlibtool' else PHP_COMPILE='$(COMPILE) -c $< && touch $@' fi @@ -763,6 +764,7 @@ test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)' PHP_CONFIGURE_PART(Generating files) PHP_FAST_GENERATE +touch .deps #libphp4.module AC_OUTPUT([php4.spec Zend/Makefile diff --git a/dynlib.m4 b/dynlib.m4 new file mode 100644 index 00000000000..fb3c70a7016 --- /dev/null +++ b/dynlib.m4 @@ -0,0 +1,64 @@ + + + +AC_DEFUN(LIB_SHARED_CONVENIENCE,[ + lib_target="\$(LTLIBRARY_NAME)" + cat >>$1<>$1<>$1<$lib_makefile<>$lib_makefile<Makefile.in <= 2.08) - fi - else - AC_MSG_ERROR(Could not find pcre.h in $withval) - fi +if test "$PHP_PCRE_REGEX" != "no"; then + PHP_EXTENSION(pcre, $ext_shared) + if test "$PHP_PCRE_REGEX" = "yes"; then + PCRE_LIBADD=pcrelib/libpcre.la + PCRE_SHARED_LIBADD=pcrelib/libpcre.la + PCRE_SUBDIRS=pcrelib + PHP_SUBST(PCRE_LIBADD) + PHP_SUBST(PCRE_SUBDIRS) + AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ]) + PHP_FAST_OUTPUT($ext_builddir/pcrelib/Makefile) + LIB_BUILD($ext_builddir/pcrelib,$ext_shared,yes) + else + test -f $PHP_PCRE_REGEX/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX + test -f $PHP_PCRE_REGEX/include/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX/include + + if test -z "$PCRE_INCDIR"; then + AC_MSG_RESULT(Could not find pcre.h in $PHP_PCRE_REGEX) + fi - test -f $withval/libpcre.a && PCRE_LIBDIR="$withval" - test -f $withval/lib/libpcre.a && PCRE_LIBDIR="$withval/lib" - if test -n "$PCRE_LIBDIR" ; then - AC_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR) - else - AC_MSG_ERROR(Could not find libpcre.a in $withval) - fi + changequote({,}) + pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'` + pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'` + changequote([,]) + pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'` + if test "$pcre_minor_length" -eq 2 ; then + pcre_minor="$pcre_minor"0 + fi + pcre_version=$pcre_major$pcre_minor + if test "$pcre_version" -lt 208; then + AC_MSG_ERROR(The PCRE extension requires PCRE library version >= 2.08) + fi + + test -f $PHP_PCRE_REGEX/libpcre.a && PCRE_LIBDIR="$PHP_PCRE_REGEX" + test -f $PHP_PCRE_REGEX/lib/libpcre.a && PCRE_LIBDIR="$PHP_PCRE_REGEX/lib" + + if test -z "$PCRE_LIBDIR" ; then + AC_MSG_ERROR(Could not find libpcre.a in $PHP_PCRE_REGEX) + fi + + if test "$ext_shared" = "yes"; then + PCRE_SHARED_LIBADD="-R$PCRE_LIBDIR -L$PCRE_LIBDIR -lpcre" + else + AC_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR) + fi + + AC_ADD_INCLUDE($PCRE_INCDIR) + AC_DEFINE(HAVE_PCRE, 1, [ ]) + fi +fi +PHP_SUBST(PCRE_SHARED_LIBADD) - AC_DEFINE(HAVE_PCRE, 1, [ ]) - AC_MSG_RESULT(yes) - PHP_EXTENSION(pcre) - ;; - esac -],[ - PCRE_LIBADD=pcrelib/libpcre.la - PCRE_SUBDIRS=pcrelib - AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ]) - AC_MSG_RESULT(yes) - PHP_EXTENSION(pcre) - PHP_FAST_OUTPUT(ext/pcre/pcrelib/Makefile) -]) -PHP_SUBST(PCRE_LIBADD) -PHP_SUBST(PCRE_SUBDIRS) AC_CHECK_FUNC(memmove, [], [AC_DEFINE(USE_BCOPY, 1, [ ])]) diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4 index 32eb634a8a4..076dde07523 100644 --- a/ext/pcre/config0.m4 +++ b/ext/pcre/config0.m4 @@ -4,70 +4,62 @@ dnl config.m4 for extension pcre dnl By default we'll compile and link against the bundled PCRE library dnl if DIR is supplied, we'll use that for linking -AC_MSG_CHECKING(whether to include PCRE support) -AC_ARG_WITH(pcre-regex, +PHP_ARG_WITH(pcre-regex,whether to include PCRE support, [ --without-pcre-regex Do not include Perl Compatible Regular Expressions support. Use --with-pcre-regex=DIR to specify DIR where PCRE's include and library files are located, - if not using bundled library.], -[ - case "$withval" in - no) - AC_MSG_RESULT(no) - ;; - yes) - EXTRA_LIBS="-L$abs_builddir/ext/pcre/pcrelib -lpcre $EXTRA_LIBS" - PCRE_SUBDIR="pcrelib" - AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ]) - AC_MSG_RESULT(yes) - PHP_EXTENSION(pcre) - PHP_FAST_OUTPUT(ext/pcre/pcrelib/Makefile) - ;; - *) - test -f $withval/pcre.h && PCRE_INCDIR="$withval" - test -f $withval/include/pcre.h && PCRE_INCDIR="$withval/include" + if not using bundled library.],yes) - if test -n "$PCRE_INCDIR" ; then - changequote({,}) - pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'` - pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'` - changequote([,]) - pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'` - if test "$pcre_minor_length" -eq 2 ; then - pcre_minor="$pcre_minor"0 - fi - pcre_version=$pcre_major$pcre_minor - if test "$pcre_version" -ge 208; then - AC_ADD_INCLUDE($PCRE_INCDIR) - else - AC_MSG_ERROR(PCRE extension requires PCRE library version >= 2.08) - fi - else - AC_MSG_ERROR(Could not find pcre.h in $withval) - fi +if test "$PHP_PCRE_REGEX" != "no"; then + PHP_EXTENSION(pcre, $ext_shared) + if test "$PHP_PCRE_REGEX" = "yes"; then + PCRE_LIBADD=pcrelib/libpcre.la + PCRE_SHARED_LIBADD=pcrelib/libpcre.la + PCRE_SUBDIRS=pcrelib + PHP_SUBST(PCRE_LIBADD) + PHP_SUBST(PCRE_SUBDIRS) + AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ]) + PHP_FAST_OUTPUT($ext_builddir/pcrelib/Makefile) + LIB_BUILD($ext_builddir/pcrelib,$ext_shared,yes) + else + test -f $PHP_PCRE_REGEX/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX + test -f $PHP_PCRE_REGEX/include/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX/include + + if test -z "$PCRE_INCDIR"; then + AC_MSG_RESULT(Could not find pcre.h in $PHP_PCRE_REGEX) + fi - test -f $withval/libpcre.a && PCRE_LIBDIR="$withval" - test -f $withval/lib/libpcre.a && PCRE_LIBDIR="$withval/lib" - if test -n "$PCRE_LIBDIR" ; then - AC_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR) - else - AC_MSG_ERROR(Could not find libpcre.a in $withval) - fi + changequote({,}) + pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'` + pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'` + changequote([,]) + pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'` + if test "$pcre_minor_length" -eq 2 ; then + pcre_minor="$pcre_minor"0 + fi + pcre_version=$pcre_major$pcre_minor + if test "$pcre_version" -lt 208; then + AC_MSG_ERROR(The PCRE extension requires PCRE library version >= 2.08) + fi + + test -f $PHP_PCRE_REGEX/libpcre.a && PCRE_LIBDIR="$PHP_PCRE_REGEX" + test -f $PHP_PCRE_REGEX/lib/libpcre.a && PCRE_LIBDIR="$PHP_PCRE_REGEX/lib" + + if test -z "$PCRE_LIBDIR" ; then + AC_MSG_ERROR(Could not find libpcre.a in $PHP_PCRE_REGEX) + fi + + if test "$ext_shared" = "yes"; then + PCRE_SHARED_LIBADD="-R$PCRE_LIBDIR -L$PCRE_LIBDIR -lpcre" + else + AC_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR) + fi + + AC_ADD_INCLUDE($PCRE_INCDIR) + AC_DEFINE(HAVE_PCRE, 1, [ ]) + fi +fi +PHP_SUBST(PCRE_SHARED_LIBADD) - AC_DEFINE(HAVE_PCRE, 1, [ ]) - AC_MSG_RESULT(yes) - PHP_EXTENSION(pcre) - ;; - esac -],[ - PCRE_LIBADD=pcrelib/libpcre.la - PCRE_SUBDIRS=pcrelib - AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ]) - AC_MSG_RESULT(yes) - PHP_EXTENSION(pcre) - PHP_FAST_OUTPUT(ext/pcre/pcrelib/Makefile) -]) -PHP_SUBST(PCRE_LIBADD) -PHP_SUBST(PCRE_SUBDIRS) AC_CHECK_FUNC(memmove, [], [AC_DEFINE(USE_BCOPY, 1, [ ])]) diff --git a/ext/pcre/pcrelib/Makefile.in b/ext/pcre/pcrelib/Makefile.in index 9f99bb5ba86..5adf8a3f107 100644 --- a/ext/pcre/pcrelib/Makefile.in +++ b/ext/pcre/pcrelib/Makefile.in @@ -2,5 +2,5 @@ LTLIBRARY_NAME = libpcre.la LTLIBRARY_SOURCES = maketables.c get.c study.c pcre.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index f8a19fb99cd..2c5bc262a58 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1210,6 +1210,10 @@ zend_module_entry pcre_module_entry = { STANDARD_MODULE_PROPERTIES }; +#ifdef COMPILE_DL_PCRE +ZEND_DLEXPORT zend_module_entry *get_module(void) { return &pcre_module_entry; } +#endif + /* }}} */ diff --git a/ext/pdf/Makefile.in b/ext/pdf/Makefile.in index e8fa3fd9fde..8577f1f2ff0 100644 --- a/ext/pdf/Makefile.in +++ b/ext/pdf/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = libpdf.la LTLIBRARY_SOURCES = pdf.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/pgsql/Makefile.in b/ext/pgsql/Makefile.in index cf484da2419..26b3f94f4a4 100644 --- a/ext/pgsql/Makefile.in +++ b/ext/pgsql/Makefile.in @@ -6,4 +6,4 @@ LTLIBRARY_SHARED_LIBADD = $(PGSQL_LFLAGS) $(PGSQL_LIBS) EXTRA_INCLUDES = $(PGSQL_INCLUDE) -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/posix/Makefile.in b/ext/posix/Makefile.in index 61fdd01d206..82f169b2d01 100644 --- a/ext/posix/Makefile.in +++ b/ext/posix/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = libposix.la LTLIBRARY_SOURCES = posix.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/readline/Makefile.in b/ext/readline/Makefile.in index 84006b07844..da1c0c71794 100644 --- a/ext/readline/Makefile.in +++ b/ext/readline/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = libreadline.la LTLIBRARY_SOURCES = readline.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/recode/Makefile.in b/ext/recode/Makefile.in index 715ae0319c1..1e02abb3d94 100644 --- a/ext/recode/Makefile.in +++ b/ext/recode/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = librecode.la LTLIBRARY_SOURCES = recode.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/rpc/Makefile.in b/ext/rpc/Makefile.in index 26fab50d02e..7d8960a34f6 100644 --- a/ext/rpc/Makefile.in +++ b/ext/rpc/Makefile.in @@ -11,7 +11,7 @@ EXTRA_INCLUDES = $(JAVA_INCLUDE) make_shared = yes -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk php_java.jar : reflect.java @test -d net || mkdir net diff --git a/ext/rpc/java/Makefile.in b/ext/rpc/java/Makefile.in index 26fab50d02e..7d8960a34f6 100644 --- a/ext/rpc/java/Makefile.in +++ b/ext/rpc/java/Makefile.in @@ -11,7 +11,7 @@ EXTRA_INCLUDES = $(JAVA_INCLUDE) make_shared = yes -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk php_java.jar : reflect.java @test -d net || mkdir net diff --git a/ext/session/Makefile.in b/ext/session/Makefile.in index cda14be6da6..4893b1be1fc 100644 --- a/ext/session/Makefile.in +++ b/ext/session/Makefile.in @@ -1,5 +1,7 @@ LTLIBRARY_NAME = libsession.la LTLIBRARY_SOURCES = session.c mod_files.c mod_mm.c mod_user.c +LTLIBRARY_SHARED_NAME = session.la +LTLIBRARY_SHARED_LIBADD = $(SESSION_LIBADD) -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/session/config.m4 b/ext/session/config.m4 index 89017871aee..8fdbcc4309c 100644 --- a/ext/session/config.m4 +++ b/ext/session/config.m4 @@ -3,12 +3,12 @@ dnl $Id$ PHP_ARG_WITH(mm,for mm support, [ --with-mm[=DIR] Include mm support for session storage]) -PHP_ARG_ENABLE(session, whether to enable session support, -[ --disable-session Disable session support], yes) - PHP_ARG_ENABLE(trans-sid,whether to enable transparent session id propagation, [ --enable-trans-sid Enable transparent session id propagation]) +PHP_ARG_ENABLE(session, whether to enable session support, +[ --disable-session Disable session support], yes) + if test "$PHP_MM" != "no"; then for i in /usr/local /usr $PHP_MM; do if test -f "$i/include/mm.h"; then @@ -19,8 +19,13 @@ if test "$PHP_MM" != "no"; then if test -z "$MM_DIR" ; then AC_MSG_ERROR(cannot find mm library) fi - - AC_ADD_LIBRARY_WITH_PATH(mm, $MM_DIR/lib) + + if test "$ext_shared" = "yes"; then + PHP_SUBST(SESSION_LIBADD) + SESSION_LIBADD="-R$MM_DIR/lib -L$MM_DIR/lib -lmm" + else + AC_ADD_LIBRARY_WITH_PATH(mm, $MM_DIR/lib) + fi AC_ADD_INCLUDE($MM_DIR/include) AC_DEFINE(HAVE_LIBMM, 1, [Whether you have libmm]) PHP_MODULE_PTR(phpext_ps_mm_ptr) @@ -30,6 +35,6 @@ if test "$PHP_TRANS_SID" = "yes"; then AC_DEFINE(TRANS_SID, 1, [Whether you want transparent session id propagation]) fi -if test "$PHP_SESSION" = "yes"; then - PHP_EXTENSION(session) +if test "$PHP_SESSION" != "no"; then + PHP_EXTENSION(session,$ext_shared) fi diff --git a/ext/session/session.c b/ext/session/session.c index 726310e69cc..2389584beb8 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -120,6 +120,10 @@ zend_module_entry session_module_entry = { STANDARD_MODULE_PROPERTIES }; +#ifdef COMPILE_DL_SESSION +ZEND_DLEXPORT zend_module_entry *get_module(void) { return &session_module_entry; } +#endif + typedef struct { char *name; void (*func)(PSLS_D); diff --git a/ext/snmp/Makefile.in b/ext/snmp/Makefile.in index a732d25b8b2..d71ed95789c 100644 --- a/ext/snmp/Makefile.in +++ b/ext/snmp/Makefile.in @@ -5,4 +5,4 @@ LTLIBRARY_SHARED_LIBADD = $(SNMP_LIBDIR) -lsnmp $(KSTAT_LIBS) EXTRA_INCLUDES = $(SNMP_INCLUDE) -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/standard/Makefile.in b/ext/standard/Makefile.in index e18866c0b4c..221922f52cb 100644 --- a/ext/standard/Makefile.in +++ b/ext/standard/Makefile.in @@ -9,7 +9,7 @@ LTLIBRARY_SOURCES=\ syslog.c type.c uniqid.c url.c url_scanner.c var.c output.c assert.c \ strnatcmp.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk parsedate.c: $(srcdir)/parsedate.y diff --git a/ext/swf/Makefile.in b/ext/swf/Makefile.in index b15d1f69423..fbeaf882f45 100644 --- a/ext/swf/Makefile.in +++ b/ext/swf/Makefile.in @@ -1,5 +1,7 @@ LTLIBRARY_NAME = libswf.la LTLIBRARY_SOURCES = swf.c +LTLIBRARY_SHARED_NAME = swf.la +LTLIBRARY_SHARED_LIBADD = $(SWF_SHARED_LIBADD) -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/swf/config.m4 b/ext/swf/config.m4 index cd728e6b243..117fe7c5680 100644 --- a/ext/swf/config.m4 +++ b/ext/swf/config.m4 @@ -5,11 +5,11 @@ dnl This file is a modified version of config.m4 dnl in php4/ext/mcrypt PHP_ARG_WITH(swf, for libswf support, -[ --with-swf[=DIR] Include swf support]) +[ --with-swf[=DIR] Include swf support]) if test "$PHP_SWF" != "no"; then for i in /usr/local /usr $PHP_SWF; do - if test -f $i/libswf.a; then + if test -r $i/libswf.a; then SWF_DIR=$i fi done @@ -17,10 +17,16 @@ if test "$PHP_SWF" != "no"; then if test -z "$SWF_DIR"; then AC_MSG_ERROR(Please reinstall libswf.a - I cannot find libswf.a) fi - AC_ADD_INCLUDE($SWF_DIR) - AC_ADD_LIBRARY_WITH_PATH(swf, $SWF_DIR) + AC_ADD_INCLUDE($SWF_DIR) + + if test "$ext_shared" = "yes"; then + SWF_SHARED_LIBADD="-R$SWF_DIR -L$SWF_DIR -lswf" + PHP_SUBST(SWF_SHARED_LIBADD) + else + AC_ADD_LIBRARY_WITH_PATH(swf, $SWF_DIR) + fi AC_DEFINE(HAVE_SWF,1,[ ]) - PHP_EXTENSION(swf) + PHP_EXTENSION(swf, $ext_shared) fi diff --git a/ext/swf/php_swf.h b/ext/swf/php_swf.h index f43dc8ef6e6..96b9e2f8a25 100644 --- a/ext/swf/php_swf.h +++ b/ext/swf/php_swf.h @@ -21,7 +21,7 @@ #ifndef _PHP_SWF_H #define _PHP_SWF_H -#if COMPILE_DL +#ifdef COMPILE_DL_SWF #undef HAVE_SWF #define HAVE_SWF 1 #endif diff --git a/ext/swf/swf.c b/ext/swf/swf.c index 28150048c23..560dd8442c8 100644 --- a/ext/swf/swf.c +++ b/ext/swf/swf.c @@ -106,6 +106,10 @@ zend_module_entry swf_module_entry = { STANDARD_MODULE_PROPERTIES }; +#ifdef COMPILE_DL_SWF +ZEND_DLEXPORT zend_module_entry *get_module(void) { return &swf_module_entry; } +#endif + PHP_MINFO_FUNCTION(swf) { php_info_print_table_start(); @@ -1067,4 +1071,4 @@ PHP_FUNCTION(swf_posround) } /* }}} */ -#endif \ No newline at end of file +#endif diff --git a/ext/sybase/Makefile.in b/ext/sybase/Makefile.in index 3b7437ab55a..fd33146fe35 100644 --- a/ext/sybase/Makefile.in +++ b/ext/sybase/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = libsybase.la LTLIBRARY_SOURCES = sybase.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/sybase_ct/Makefile.in b/ext/sybase_ct/Makefile.in index 965741c79d6..4b495e4a855 100644 --- a/ext/sybase_ct/Makefile.in +++ b/ext/sybase_ct/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = libsybase_ct.la LTLIBRARY_SOURCES = php_sybase_ct.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/sysvsem/Makefile.in b/ext/sysvsem/Makefile.in index 33a9bd54199..b92500b4768 100644 --- a/ext/sysvsem/Makefile.in +++ b/ext/sysvsem/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = libsysvsem.la LTLIBRARY_SOURCES = sysvsem.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/sysvshm/Makefile.in b/ext/sysvshm/Makefile.in index 599a11b1438..75e514c993a 100644 --- a/ext/sysvshm/Makefile.in +++ b/ext/sysvshm/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = libsysvshm.la LTLIBRARY_SOURCES = sysvshm.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/wddx/Makefile.in b/ext/wddx/Makefile.in index 06865e6afa2..a5ec87c5fbf 100644 --- a/ext/wddx/Makefile.in +++ b/ext/wddx/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = libwddx.la LTLIBRARY_SOURCES = wddx.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/xml/Makefile.in b/ext/xml/Makefile.in index e6a97e7b240..4a986da0c84 100644 --- a/ext/xml/Makefile.in +++ b/ext/xml/Makefile.in @@ -7,4 +7,4 @@ LTLIBRARY_SHARED_LIBADD = $(XML_LIBS) SUBDIRS = expat -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/xml/config.m4 b/ext/xml/config.m4 index eb1e723273f..e48ec51592c 100644 --- a/ext/xml/config.m4 +++ b/ext/xml/config.m4 @@ -12,25 +12,17 @@ else order=12 fi -AC_MSG_CHECKING(for XML support) -AC_ARG_ENABLE(xml, -[ --disable-xml Disable XML support using bundled expat lib],[ - PHP_XML=$enableval -],[ - PHP_XML=yes -]) -AC_MSG_RESULT($PHP_XML) +PHP_ARG_ENABLE(xml,for XML support, +[ --disable-xml Disable XML support using bundled expat lib], yes) if test "$PHP_XML" != "no"; then AC_DEFINE(HAVE_LIBEXPAT, 1, [ ]) CPPFLAGS="$CPPFLAGS -DXML_BYTE_ORDER=$order" - if test "$PHP_XML" = "shared"; then - shared=yes - else - shared= - fi - PHP_EXTENSION(xml, $shared) - AC_ADD_INCLUDE(${ext_src_base}expat/xmltok) - AC_ADD_INCLUDE(${ext_src_base}expat/xmlparse) - PHP_FAST_OUTPUT(${ext_base}expat/Makefile ${ext_base}expat/xmlparse/Makefile ${ext_base}expat/xmltok/Makefile) + PHP_EXTENSION(xml, $ext_shared) + LIB_BUILD($ext_builddir/expat,$ext_shared,yes) + LIB_BUILD($ext_builddir/expat/xmlparse,$ext_shared,yes) + LIB_BUILD($ext_builddir/expat/xmltok,$ext_shared,yes) + AC_ADD_INCLUDE($ext_srcdir/expat/xmltok) + AC_ADD_INCLUDE($ext_srcdir/expat/xmlparse) + PHP_FAST_OUTPUT($ext_builddir/expat/Makefile $ext_builddir/expat/xmlparse/Makefile $ext_builddir/expat/xmltok/Makefile) fi diff --git a/ext/xml/expat/Makefile.in b/ext/xml/expat/Makefile.in index ea7b1124175..6a109f1f98d 100644 --- a/ext/xml/expat/Makefile.in +++ b/ext/xml/expat/Makefile.in @@ -5,4 +5,4 @@ LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES) SUBDIRS = xmltok xmlparse -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/xml/expat/xmlparse/Makefile.in b/ext/xml/expat/xmlparse/Makefile.in index 52756529130..77df7598d07 100644 --- a/ext/xml/expat/xmlparse/Makefile.in +++ b/ext/xml/expat/xmlparse/Makefile.in @@ -4,4 +4,4 @@ LTLIBRARY_SOURCES = xmlparse.c hashtable.c EXTRA_INCLUDES = -I$(srcdir)/../xmltok -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/xml/expat/xmltok/Makefile.in b/ext/xml/expat/xmltok/Makefile.in index f9f02c863f3..73d1cab428e 100644 --- a/ext/xml/expat/xmltok/Makefile.in +++ b/ext/xml/expat/xmltok/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = libexpat_tok.la LTLIBRARY_SOURCES = xmltok.c xmlrole.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/yp/Makefile.in b/ext/yp/Makefile.in index 4fd1f482d37..e7db81ffb59 100644 --- a/ext/yp/Makefile.in +++ b/ext/yp/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = libyp.la LTLIBRARY_SOURCES = yp.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk diff --git a/ext/zlib/Makefile.in b/ext/zlib/Makefile.in index 62e7370a1fc..946ae5ce585 100644 --- a/ext/zlib/Makefile.in +++ b/ext/zlib/Makefile.in @@ -2,4 +2,4 @@ LTLIBRARY_NAME = libzlib.la LTLIBRARY_SOURCES = zlib.c -include $(top_srcdir)/build/ltlib.mk +include $(top_srcdir)/build/dynlib.mk