- Make it possible to build ext/openssl as shared extension

This commit is contained in:
foobar 2002-03-20 02:07:11 +00:00
parent 00929ff9ac
commit 4a0291d238
4 changed files with 40 additions and 17 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)