From b21f1582dd33b99ec6c44244a61b71ddb51cc91b Mon Sep 17 00:00:00 2001 From: foobar Date: Wed, 27 Aug 2003 17:57:32 +0000 Subject: [PATCH] - Backported several improvements/cleanups for the build/configure stuff. . PEAR dependancies checked during configure . OpenSSL config moved from configure.in to ext/openssl/config0.m4 (and also improved the PHP_OPENSSL_SETUP macro a bit) + Some other minor issues --- acinclude.m4 | 147 +++++++++++++++++++++++------------------ configure.in | 124 +++++++++++++++++++--------------- ext/openssl/config.m4 | 10 --- ext/openssl/config0.m4 | 2 +- ext/snmp/config.m4 | 20 ++++-- ext/standard/config.m4 | 4 +- scan_makefile_in.awk | 32 --------- scripts/Makefile.frag | 2 +- scripts/phpize.in | 6 +- scripts/phpize.m4 | 12 ---- 10 files changed, 175 insertions(+), 184 deletions(-) delete mode 100644 ext/openssl/config.m4 delete mode 100644 scan_makefile_in.awk diff --git a/acinclude.m4 b/acinclude.m4 index 733bf2323b..f29dc29622 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -184,66 +184,6 @@ AC_DEFUN([PHP_REMOVE_USR_LIB],[ $1=[$]ac_new_flags ]) -AC_DEFUN([PHP_SETUP_OPENSSL],[ - if test "$PHP_OPENSSL" = "yes"; then - PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl" - fi - - for i in $PHP_OPENSSL; do - if test -r $i/include/openssl/evp.h; then - OPENSSL_INCDIR=$i/include - fi - if test -r $i/lib/libssl.a -o -r $i/lib/libssl.$SHLIB_SUFFIX_NAME; then - OPENSSL_LIBDIR=$i/lib - fi - done - - if test -z "$OPENSSL_INCDIR"; then - AC_MSG_ERROR([Cannot find OpenSSL's ]) - fi - - if test -z "$OPENSSL_LIBDIR"; then - AC_MSG_ERROR([Cannot find OpenSSL's libraries]) - fi - - old_CPPFLAGS=$CPPFLAGS - CPPFLAGS=-I$OPENSSL_INCDIR - AC_MSG_CHECKING([for OpenSSL version]) - AC_EGREP_CPP(yes,[ -#include -#if OPENSSL_VERSION_NUMBER >= 0x0090600fL - yes -#endif - ],[ - AC_MSG_RESULT([>= 0.9.6]) - ],[ - AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.]) - ]) - CPPFLAGS=$old_CPPFLAGS - - PHP_ADD_INCLUDE($OPENSSL_INCDIR) - PHP_ADD_LIBPATH($OPENSSL_LIBDIR) - - PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [ - PHP_ADD_LIBRARY(crypto) - ],[ - AC_MSG_ERROR([libcrypto not found!]) - ],[ - -L$OPENSSL_LIBDIR - ]) - - PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [ - PHP_ADD_LIBRARY(ssl) - ],[ - AC_MSG_ERROR([libssl not found!]) - ],[ - -L$OPENSSL_LIBDIR - ]) - - OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR - AC_SUBST(OPENSSL_INCDIR_OPT) -]) - dnl PHP_EVAL_LIBLINE(LINE, SHARED-LIBADD) dnl dnl Use this macro, if you need to add libraries and or library search @@ -1209,7 +1149,7 @@ main() { fi ]) -dnl PHP_SHARED_MODULE(module-name, object-var, build-dir) +dnl PHP_SHARED_MODULE(module-name, object-var, build-dir, cxx) dnl dnl Basically sets up the link-stage for building module-name dnl from object_var in build-dir. @@ -1222,7 +1162,7 @@ AC_DEFUN([PHP_SHARED_MODULE],[ \$(LIBTOOL) --mode=install cp $3/$1.la \$(phplibdir) $3/$1.la: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES) - \$(LIBTOOL) --mode=link \$(CC) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) + \$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) EOF ]) @@ -1249,7 +1189,7 @@ AC_DEFUN([PHP_SELECT_SAPI],[ dnl deprecated AC_DEFUN([PHP_EXTENSION],[ - sources=`$AWK -f $abs_srcdir/scan_makefile_in.awk < []PHP_EXT_SRCDIR($1)[]/Makefile.in` + sources=`$AWK -f $abs_srcdir/build/scan_makefile_in.awk < []PHP_EXT_SRCDIR($1)[]/Makefile.in` PHP_NEW_EXTENSION($1, $sources, $2, $3) @@ -1267,7 +1207,7 @@ AC_DEFUN([PHP_GEN_BUILD_DIRS],[ ]) dnl -dnl PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags]]]) +dnl PHP_NEW_EXTENSION(extname, sources [, shared [,sapi_class[, extra-cflags[, cxx]]]]) dnl dnl Includes an extension in the build. dnl @@ -1297,7 +1237,7 @@ dnl ---------------------------------------------- Static module if test "$3" = "shared" || test "$3" = "yes"; then dnl ---------------------------------------------- Shared module PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes) - PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir) + PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6) AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module) fi fi @@ -1596,7 +1536,7 @@ main() { dnl -dnl PHP_CHECK_LIBRARY(library, function [, action-found [, action-not-found [, extra-ldflags]]]) +dnl PHP_CHECK_LIBRARY(library, function [, action-found [, action-not-found [, extra-libs]]]) dnl dnl Wrapper for AC_CHECK_LIB dnl @@ -1639,6 +1579,81 @@ AC_DEFUN([PHP_CHECK_FRAMEWORK], [ ]) ]) +dnl +dnl PHP_SETUP_OPENSSL(shared-add [, action-found [, action-not-found]]) +dnl +dnl Common setup macro for openssl +dnl +AC_DEFUN([PHP_SETUP_OPENSSL],[ + found_openssl=no + unset OPENSSL_INCDIR + unset OPENSSL_LIBDIR + + if test "$PHP_OPENSSL" = "yes"; then + PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl" + fi + + for i in $PHP_OPENSSL; do + if test -r $i/include/openssl/evp.h; then + OPENSSL_INCDIR=$i/include + fi + if test -r $i/lib/libssl.a -o -r $i/lib/libssl.$SHLIB_SUFFIX_NAME; then + OPENSSL_LIBDIR=$i/lib + fi + done + + if test -z "$OPENSSL_INCDIR"; then + AC_MSG_ERROR([Cannot find OpenSSL's ]) + fi + + if test -z "$OPENSSL_LIBDIR"; then + AC_MSG_ERROR([Cannot find OpenSSL's libraries]) + fi + + old_CPPFLAGS=$CPPFLAGS + CPPFLAGS=-I$OPENSSL_INCDIR + AC_MSG_CHECKING([for OpenSSL version]) + AC_EGREP_CPP(yes,[ +#include +#if OPENSSL_VERSION_NUMBER >= 0x0090600fL + yes +#endif + ],[ + AC_MSG_RESULT([>= 0.9.6]) + ],[ + AC_MSG_ERROR([OpenSSL version 0.9.6 or greater required.]) + ]) + CPPFLAGS=$old_CPPFLAGS + + PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [ + PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [ + found_openssl=yes + ], [ + AC_MSG_ERROR([libssl not found!]) + ],[ + -L$OPENSSL_LIBDIR -lcrypto + ]) + ], [ + AC_MSG_ERROR([libcrypto not found!]) + ],[ + -L$OPENSSL_LIBDIR + ]) + + OPENSSL_INCDIR_OPT=-I$OPENSSL_INCDIR + AC_SUBST(OPENSSL_INCDIR_OPT) + + if test "$found_openssl" = "yes"; then + if test -n "$OPENSSL_INCDIR" && test -n "$OPENSSL_LIBDIR"; then + PHP_ADD_INCLUDE($OPENSSL_INCDIR) + PHP_ADD_LIBPATH($OPENSSL_LIBDIR, $1) + PHP_ADD_LIBRARY(crypto,,$1) + PHP_ADD_LIBRARY(ssl,, $1) + fi + $2 +ifelse([$3],[],,[else $3]) + fi +]) + dnl dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]]) dnl diff --git a/configure.in b/configure.in index 4dd78a584e..6c9dd27a3a 100644 --- a/configure.in +++ b/configure.in @@ -618,27 +618,6 @@ if test "$PHP_CONFIG_FILE_SCAN_DIR" = "DEFAULT"; then PHP_CONFIG_FILE_SCAN_DIR="" fi -# compatibility -if test -z "$with_pear" && test "$enable_pear" = "no"; then - with_pear=no -fi - -PHP_ARG_WITH(pear, [whether to install PEAR, and where], -[ --with-pear=DIR Install PEAR in DIR (default PREFIX/lib/php) - --without-pear Do not install PEAR], DEFAULT, yes) - -if test "$PHP_PEAR" != "no" && test "$disable_cli" != "1"; then - install_pear="install-pear" - PEAR_INSTALLDIR=$PHP_PEAR -fi - -if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then - case $PHP_LAYOUT in - GNU) PEAR_INSTALLDIR=$datadir/pear;; - *) PEAR_INSTALLDIR=$libdir/php;; - esac -fi - test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS" PHP_ARG_ENABLE(safe-mode, whether to enable safe mode by default, @@ -736,17 +715,19 @@ if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support]) fi - -dnl -dnl OpenSSL configure -dnl -PHP_ARG_WITH(openssl,for OpenSSL support, -[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6) ]) - -if test "$PHP_OPENSSL" != "no"; then - ext_openssl_shared=$ext_shared - PHP_SETUP_OPENSSL -fi +AC_MSG_CHECKING([whether to enable versioning]) +AC_ARG_ENABLE(versioning, +[ --enable-versioning Export only required symbols. + See INSTALL for more information], [ + if test "x$APXS" != "x"; then + PHP_VERSIONING=$enableval + else + PHP_VERSIONING=no + fi +],[ + PHP_VERSIONING=no +]) +AC_MSG_RESULT([$PHP_VERSIONING]) divert(5) @@ -783,26 +764,9 @@ AC_ARG_ENABLE(all, # reading config stubs esyscmd(./build/config-stubs ext) - -dnl Other settings. +dnl Extensions post-config dnl ------------------------------------------------------------------------- -PHP_HELP_SEPARATOR([Other settings:]) - -AC_MSG_CHECKING([whether to enable versioning]) -AC_ARG_ENABLE(versioning, -[ --enable-versioning Export only required symbols. - See INSTALL for more information], [ - if test "x$APXS" != "x"; then - PHP_VERSIONING=$enableval - else - PHP_VERSIONING=no - fi -],[ - PHP_VERSIONING=no -]) -AC_MSG_RESULT([$PHP_VERSIONING]) - if test "$PHP_VERSIONING" = "yes"; then test -z "$PHP_SYM_FILE" && PHP_SYM_FILE="$abs_srcdir/sapi/$PHP_SAPI/php.sym" if test -f "$PHP_SYM_FILE"; then @@ -828,8 +792,6 @@ shared) ;; esac -PHP_REGEX - EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS" dnl this has to be here to prevent the openssl crypt() from @@ -840,6 +802,64 @@ fi unset LIBS LDFLAGS +dnl PEAR +dnl ------------------------------------------------------------------------- + +PHP_HELP_SEPARATOR([PEAR:]) +PHP_CONFIGURE_PART(Configuring PEAR) + +# compatibility +if test -z "$with_pear" && test "$enable_pear" = "no"; then + with_pear=no +fi + +PHP_ARG_WITH(pear, [whether to install PEAR], +[ --with-pear=DIR Install PEAR in DIR (default PREFIX/lib/php) + --without-pear Do not install PEAR], DEFAULT, yes) + +if test "$PHP_PEAR" != "no"; then + + dnl + dnl PEAR dependancies + dnl + if test "$PHP_SAPI_CLI" = "no"; then + pear_error_msg="$pear_error_msg + PEAR requires CLI to be enabled. Add --enable-cli to the configure line." + fi + if test "$PHP_PCRE_REGEX" = "no"; then + pear_error_msg="$pear_error_msg + PEAR requires PCRE to be enabled. Add --with-pcre-regex to the configure line." + fi + if test "$PHP_XML" = "no"; then + pear_error_msg="$pear_error_msg + PEAR requires XML to be enabled. Add --enable-xml to the configure line." + fi + +dnl +dnl ext/xmlrpc is not really there yet to be a requirement.. +dnl +dnl if test "$PHP_XMLRPC" = "no"; then +dnl pear_error_msg="$pear_error_msg +dnl PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line." +dnl fi +dnl + + if test "$pear_error_msg"; then + AC_MSG_ERROR([$pear_error_msg]) + fi + + install_pear="install-pear" + PEAR_INSTALLDIR=$PHP_PEAR + + if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then + case $PHP_LAYOUT in + GNU) PEAR_INSTALLDIR=$datadir/pear;; + *) PEAR_INSTALLDIR=$libdir/php;; + esac + fi +fi + + dnl Configuring Zend and TSRM. dnl ------------------------------------------------------------------------- diff --git a/ext/openssl/config.m4 b/ext/openssl/config.m4 deleted file mode 100644 index 93c5d052fd..0000000000 --- a/ext/openssl/config.m4 +++ /dev/null @@ -1,10 +0,0 @@ -dnl -dnl $Id$ -dnl - -if test "$PHP_OPENSSL" != "no"; then - PHP_NEW_EXTENSION(openssl, openssl.c, $ext_openssl_shared) - OPENSSL_SHARED_LIBADD="-lcrypto -lssl" - PHP_SUBST(OPENSSL_SHARED_LIBADD) - AC_DEFINE(HAVE_OPENSSL_EXT,1,[ ]) -fi diff --git a/ext/openssl/config0.m4 b/ext/openssl/config0.m4 index 157c35b66b..595c7f966b 100644 --- a/ext/openssl/config0.m4 +++ b/ext/openssl/config0.m4 @@ -8,7 +8,7 @@ PHP_ARG_WITH(openssl, for OpenSSL support, if test "$PHP_OPENSSL" != "no"; then PHP_SETUP_OPENSSL(OPENSSL_SHARED_LIBADD, [ - PHP_NEW_EXTENSION(openssl, openssl.c xp_ssl.c, $ext_shared) + PHP_NEW_EXTENSION(openssl, openssl.c, $ext_shared) PHP_SUBST(OPENSSL_SHARED_LIBADD) AC_DEFINE(HAVE_OPENSSL_EXT,1,[ ]) ], [ diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4 index d8a5ad5d3e..e9641569af 100644 --- a/ext/snmp/config.m4 +++ b/ext/snmp/config.m4 @@ -5,6 +5,9 @@ dnl PHP_ARG_WITH(snmp,for SNMP support, [ --with-snmp[=DIR] Include SNMP support.]) +PHP_ARG_WITH(openssl-dir,OpenSSL dir for SNMP, +[ --with-openssl-dir[=DIR] SNMP: openssl install prefix.], no, no) + if test "$PHP_SNMP" != "no"; then dnl @@ -77,13 +80,18 @@ if test "$PHP_SNMP" != "no"; then AC_MSG_RESULT($SNMP_SSL) if test "$SNMP_SSL" = "yes"; then - if test "$PHP_OPENSSL" != "no"; then - PHP_ADD_LIBRARY(ssl, 1, SNMP_SHARED_LIBADD) - PHP_ADD_LIBRARY(crypto,1, SNMP_SHARED_LIBADD) - else - AC_MSG_ERROR(The UCD-SNMP in this system is built with SSL support. + if test "$PHP_OPENSSL_DIR" != "no"; then + PHP_OPENSSL=$PHP_OPENSSL_DIR + fi + + if test "$PHP_OPENSSL" = "no"; then + AC_MSG_ERROR([The UCD-SNMP in this system is built with SSL support. - Add --with-openssl<=DIR> to your configure line.) + Add --with-openssl-dir=DIR to your configure line.]) + else + PHP_SETUP_OPENSSL(SNMP_SHARED_LIBADD, [], [ + AC_MSG_ERROR([SNMP: OpenSSL check failed. Please check config.log for more information.]) + ]) fi fi diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index bf84dcfe40..136ce213c3 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -6,7 +6,7 @@ dnl dnl Check if flush should be called explicitly after buffered io dnl AC_DEFUN(AC_FLUSH_IO,[ - AC_CACHE_CHECK([whether flush should be called explicitly after a bufferered io], ac_cv_flush_io,[ + AC_CACHE_CHECK([whether flush should be called explicitly after a buffered io], ac_cv_flush_io,[ AC_TRY_RUN( [ #include #include @@ -226,6 +226,8 @@ AC_ARG_WITH(regex, REGEX_TYPE=php ]) +PHP_REGEX + dnl dnl round fuzz dnl diff --git a/scan_makefile_in.awk b/scan_makefile_in.awk deleted file mode 100644 index 0c6d20398f..0000000000 --- a/scan_makefile_in.awk +++ /dev/null @@ -1,32 +0,0 @@ -BEGIN { - mode=0 - sources="" -} - -mode == 0 && /^LTLIBRARY_SOURCES.*\\$/ { - if (match($0, "[^=]*$")) { - sources=substr($0, RSTART, RLENGTH-1) - } - mode=1 - next -} - -mode == 0 && /^LTLIBRARY_SOURCES.*/ { - if (match($0, "[^=]*$")) { - sources=substr($0, RSTART, RLENGTH) - } -} - -mode == 1 && /.*\\$/ { - sources=sources substr($0, 0, length - 1) - next -} - -mode == 1 { - sources=sources $0 - mode=0 -} - -END { - print sources -} diff --git a/scripts/Makefile.frag b/scripts/Makefile.frag index 5490752d91..b4c61f6dcb 100644 --- a/scripts/Makefile.frag +++ b/scripts/Makefile.frag @@ -10,8 +10,8 @@ BUILD_FILES = \ scripts/phpize.m4 \ build/mkdep.awk \ build/shtool \ + build/scan_makefile_in.awk \ Makefile.global \ - scan_makefile_in.awk \ acinclude.m4 bin_SCRIPTS = phpize php-config diff --git a/scripts/phpize.in b/scripts/phpize.in index ce20a6d228..a2e3631303 100644 --- a/scripts/phpize.in +++ b/scripts/phpize.in @@ -5,8 +5,8 @@ phpdir="$prefix/lib/php/build" includedir="$prefix/include/php" builddir="`pwd`" -FILES_BUILD="mkdep.awk shtool" -FILES="acinclude.m4 Makefile.global scan_makefile_in.awk" +FILES_BUILD="mkdep.awk scan_makefile_in.awk shtool" +FILES="acinclude.m4 Makefile.global" CLEAN_FILES="$FILES *.lo *.la *.o .deps .libs/ build/ include/ modules/ install-sh \ mkinstalldirs missing config.nice config.sub config.guess configure configure.in \ aclocal.m4 config.h config.h.in conftest* ltmain.sh libtool config.cache \ @@ -57,7 +57,7 @@ touch install-sh mkinstalldirs missing aclocal || exit 1 autoconf || exit 1 autoheader || exit 1 -libtoolize=`$phpdir/shtool path glibtoolize libtoolize` +libtoolize=`$builddir/build/shtool path glibtoolize libtoolize` $libtoolize -f -c || exit 1 # dumping API NOs: diff --git a/scripts/phpize.m4 b/scripts/phpize.m4 index 147d80fda3..d60d3df0c0 100644 --- a/scripts/phpize.m4 +++ b/scripts/phpize.m4 @@ -54,18 +54,6 @@ PHP_BUILD_SHARED AC_PREFIX_DEFAULT() -AC_ARG_WITH(openssl, -[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.5) ], -[ - if test "$withval" != "no"; then - PHP_WITH_SHARED - PHP_OPENSSL=$withval - ext_openssl_shared=yes - ext_shared=yes - PHP_SETUP_OPENSSL - fi -]) - AC_PROG_AWK sinclude(config.m4) -- 2.50.1