]> granicus.if.org Git - php/commitdiff
- Unified PHP_SETUP_OPENSSL with other PHP_SETUP_* macros.
authorfoobar <sniper@php.net>
Tue, 24 Jun 2003 14:05:26 +0000 (14:05 +0000)
committerfoobar <sniper@php.net>
Tue, 24 Jun 2003 14:05:26 +0000 (14:05 +0000)
acinclude.m4
configure.in
ext/openssl/config.m4 [deleted file]
ext/openssl/config0.m4 [new file with mode: 0644]
ext/snmp/config.m4
scripts/phpize.m4

index 0b4ca2226fd2643707110c33b4f3a8cd6c8c5b9b..54247c237349f1c201183229a7740cad8b3102b7 100644 (file)
@@ -177,66 +177,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 <evp.h>])
-  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 <openssl/opensslv.h>
-#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
@@ -1624,6 +1564,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 <evp.h>])
+  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 <openssl/opensslv.h>
+#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
+    ])
+  ], [
+    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
index b911974bedb3c4bbc9352f744702fb4d6722bfa5..6bc64aa4298e7a169e7fd989e2396dbaa0f407dd 100644 (file)
@@ -733,18 +733,6 @@ 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
-
 divert(5)
 
 dnl ## In diversion 5 we check which extensions should be compiled.
diff --git a/ext/openssl/config.m4 b/ext/openssl/config.m4
deleted file mode 100644 (file)
index 6cc9568..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-if test "$PHP_OPENSSL" != "no"; then
-  PHP_NEW_EXTENSION(openssl, openssl.c xp_ssl.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
new file mode 100644 (file)
index 0000000..157c35b
--- /dev/null
@@ -0,0 +1,17 @@
+dnl
+dnl $Id$
+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
+  PHP_SETUP_OPENSSL(OPENSSL_SHARED_LIBADD, 
+  [
+    PHP_NEW_EXTENSION(openssl, openssl.c xp_ssl.c, $ext_shared)
+    PHP_SUBST(OPENSSL_SHARED_LIBADD)
+    AC_DEFINE(HAVE_OPENSSL_EXT,1,[ ])
+  ], [
+    AC_MSG_ERROR([OpenSSL check failed. Please check config.log for more information.])
+  ])
+fi
index d8a5ad5d3eab974c71991c1e74bb034458cfa907..e9641569aff4ec4d2d2b09aeec9a7290c3d57daa 100644 (file)
@@ -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
 
index 476740317006b91a7643a5e1b9c55624f749467d..bc597f10790074bf2a3a7b1e719f2cd5c1726343 100644 (file)
@@ -52,18 +52,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)