]> granicus.if.org Git - php/commitdiff
- Make it possible to build ext/openssl as shared extension
authorfoobar <sniper@php.net>
Wed, 20 Mar 2002 02:07:11 +0000 (02:07 +0000)
committerfoobar <sniper@php.net>
Wed, 20 Mar 2002 02:07:11 +0000 (02:07 +0000)
acinclude.m4
configure.in
ext/openssl/config.m4
pear/pear.m4

index 669a8bf9295d48de965693e3078ab04a3fa161fd..79f6408d3bdc94c065962ef2d9d4eb8b09d56944 100644 (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
index 0eb20776f89a67fe0a20564732aaf9dd2f6530c3..2dcaece071838d181b42e6a9e0dc0e5033f35ee9 100644 (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
 
index 3d61e86402965c13b37477389557c21f2d7485e1..93c5d052fd9b1f6b5bfb50eaf485f0a5c028450d 100644 (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
index baf18f0534a8d9cc0b18c7a29b524b36999dd1d1..a8c626b0242998b9a3328dc0cb5c2273842eccf8 100644 (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)