mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
- Make it possible to build ext/openssl as shared extension
This commit is contained in:
parent
00929ff9ac
commit
4a0291d238
33
acinclude.m4
33
acinclude.m4
@ -166,23 +166,29 @@ AC_DEFUN(PHP_REMOVE_USR_LIB,[
|
||||
])
|
||||
|
||||
AC_DEFUN(PHP_SETUP_OPENSSL,[
|
||||
if test "$PHP_OPENSSL" = "no"; then
|
||||
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_DIR=$i
|
||||
OPENSSL_INC=$i/include
|
||||
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_DIR"; then
|
||||
if test -z "$OPENSSL_INCDIR"; then
|
||||
AC_MSG_ERROR([Cannot find OpenSSL's <evp.h>])
|
||||
fi
|
||||
|
||||
if test -z "$OPENSSL_LIBDIR"; then
|
||||
AC_MSG_ERROR([Cannot find OpenSSL's libraries])
|
||||
fi
|
||||
|
||||
old_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS=-I$OPENSSL_INC
|
||||
CPPFLAGS=-I$OPENSSL_INCDIR
|
||||
AC_MSG_CHECKING([for OpenSSL version])
|
||||
AC_EGREP_CPP(yes,[
|
||||
#include <openssl/opensslv.h>
|
||||
@ -196,20 +202,24 @@ AC_DEFUN(PHP_SETUP_OPENSSL,[
|
||||
])
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
|
||||
PHP_ADD_LIBPATH($OPENSSL_DIR/lib)
|
||||
PHP_ADD_INCLUDE($OPENSSL_INCDIR)
|
||||
PHP_ADD_LIBPATH($OPENSSL_LIBDIR)
|
||||
|
||||
AC_CHECK_LIB(crypto, CRYPTO_free, [
|
||||
PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
|
||||
PHP_ADD_LIBRARY(crypto)
|
||||
],[
|
||||
AC_MSG_ERROR([libcrypto not found!])
|
||||
],[
|
||||
-L$OPENSSL_LIBDIR
|
||||
])
|
||||
|
||||
AC_CHECK_LIB(ssl, SSL_CTX_set_ssl_version, [
|
||||
PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
|
||||
PHP_ADD_LIBRARY(ssl)
|
||||
],[
|
||||
AC_MSG_ERROR([libssl not found!])
|
||||
],[
|
||||
-L$OPENSSL_LIBDIR
|
||||
])
|
||||
PHP_ADD_INCLUDE($OPENSSL_INC)
|
||||
])
|
||||
|
||||
dnl PHP_EVAL_LIBLINE(LINE, SHARED-LIBADD)
|
||||
@ -1331,14 +1341,13 @@ AC_DEFUN(PHP_CHECK_LIBRARY, [
|
||||
LDFLAGS="$5 $LDFLAGS"
|
||||
AC_CHECK_LIB([$1],[$2],[
|
||||
LDFLAGS=$save_old_LDFLAGS
|
||||
$3
|
||||
m4_default([$3], :)
|
||||
],[
|
||||
LDFLAGS=$save_old_LDFLAGS
|
||||
$4
|
||||
m4_default([$4], :)
|
||||
])dnl
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]])
|
||||
dnl
|
||||
|
@ -665,11 +665,9 @@ AC_ARG_WITH(exec-dir,
|
||||
|
||||
PHP_ARG_WITH(openssl,for OpenSSL support,
|
||||
[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.5) ])
|
||||
if test "$PHP_OPENSSL" = "yes"; then
|
||||
PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl"
|
||||
fi
|
||||
|
||||
if test "$PHP_OPENSSL" != "no"; then
|
||||
ext_openssl_shared=$ext_shared
|
||||
PHP_SETUP_OPENSSL
|
||||
fi
|
||||
|
||||
|
@ -2,7 +2,9 @@ dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
if test "$OPENSSL_DIR"; then
|
||||
PHP_NEW_EXTENSION(openssl, openssl.c, $ext_shared)
|
||||
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
|
||||
|
14
pear/pear.m4
14
pear/pear.m4
@ -43,12 +43,25 @@ PHP_CONFIG_NICE(config.nice)
|
||||
AC_PROG_CC
|
||||
AC_PROG_CC_C_O
|
||||
|
||||
PHP_SHLIB_SUFFIX_NAME
|
||||
PHP_WITH_PHP_CONFIG
|
||||
|
||||
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
|
||||
])
|
||||
|
||||
sinclude(config.m4)
|
||||
|
||||
enable_static=no
|
||||
@ -88,6 +101,7 @@ PHP_SUBST(INCLUDES)
|
||||
PHP_SUBST(LEX)
|
||||
PHP_SUBST(LEX_OUTPUT_ROOT)
|
||||
PHP_SUBST(LFLAGS)
|
||||
PHP_SUBST(LDFLAGS)
|
||||
PHP_SUBST(SHARED_LIBTOOL)
|
||||
PHP_SUBST(LIBTOOL)
|
||||
PHP_SUBST(SHELL)
|
||||
|
Loading…
Reference in New Issue
Block a user