summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2000-03-19 12:38:53 +0000
committerSascha Schumann <sas@php.net>2000-03-19 12:38:53 +0000
commite5ceb99a1e517b797a31ddf040e27f6bbfa9f38d (patch)
treed58fd652aa35d1ce0e2dd959a953568136981b11 /ext
parent5366478e18860eb6c3afeb4349f5f5a110b18575 (diff)
downloadphp-git-e5ceb99a1e517b797a31ddf040e27f6bbfa9f38d.tar.gz
Fix build problems with UCD-SNMP 4.1.x.
First, we need to include default_store.h. Second, UCD-SNMP supports OpenSSL now, so we additionally need to link against that. The changes should be completely backwards-compatible. Partly suggested by: thor2001@gmx.net PR: #3451, #3668, #3868
Diffstat (limited to 'ext')
-rw-r--r--ext/snmp/config.m454
-rw-r--r--ext/snmp/snmp.c3
2 files changed, 56 insertions, 1 deletions
diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4
index 9d59f2501e..c1d35fc4e7 100644
--- a/ext/snmp/config.m4
+++ b/ext/snmp/config.m4
@@ -1,5 +1,37 @@
dnl $Id$
+AC_ARG_WITH(openssl,
+[ --with-openssl[=DIR] Include OpenSSL support in SNMP.],[
+ PHP_OPENSSL=$withval
+],[
+ PHP_OPENSSL=no
+])
+
+AC_DEFUN(PHP_SETUP_OPENSSL,[
+ for i in /usr/local/ssl /usr/local /usr /usr/local/openssl $PHP_OPENSSL; do
+ if test -r $i/include/openssl/evp.h; then
+ OPENSSL_DIR=$i
+ OPENSSL_INC=$i/include/openssl
+ elif test -r $i/include/evp.h; then
+ OPENSSL_DIR=$i
+ OPENSSL_INC=$i/include
+ fi
+ done
+
+ AC_MSG_CHECKING(for OpenSSL)
+
+ if test -z "$OPENSSL_DIR"; then
+ AC_MSG_ERROR(Cannot find OpenSSL's <evp.h>)
+ fi
+
+ AC_MSG_RESULT($OPENSSL_DIR, Include files in $OPENSSL_INC)
+
+ AC_ADD_LIBPATH($OPENSSL_DIR/lib)
+ AC_ADD_LIBRARY(ssl, yes)
+ AC_ADD_LIBRARY(crypto, yes)
+ AC_ADD_INCLUDE($OPENSSL_INC)
+])
+
AC_MSG_CHECKING(for SNMP support)
AC_ARG_WITH(snmp,
[ --with-snmp[=DIR] Include SNMP support. DIR is the SNMP base
@@ -51,7 +83,27 @@ AC_ARG_WITH(snmp,
AC_ADD_INCLUDE($SNMP_INCDIR)
SNMP_STATIC="libphpext_snmp.la"
fi
- PHP_EXTENSION(snmp,$shared)
+ old_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$INCLUDES $CPPFLAGS"
+ AC_CHECK_HEADERS(default_store.h)
+ if test "$ac_cv_header_default_store_h" = "yes"; then
+ dnl UCD SNMP 4.1.x
+ AC_TRY_RUN([
+#include <ucd-snmp-config.h>
+main() { exit(USE_OPENSSL != 1); }
+ ],[
+ SNMP_SSL=yes
+ ],[
+ SNMP_SSL=no
+ ],[
+ SNMP_SSL=no
+ ])
+ if test "$SNMP_SSL" = "yes"; then
+ PHP_SETUP_OPENSSL
+ fi
+ fi
+ CPPFLAGS="$old_CPPFLAGS"
+ PHP_EXTENSION(snmp,$shared)
AC_CHECK_LIB(kstat, kstat_read, [
if test "$shared" = yes; then
KSTAT_LIBS="-lkstat"
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 1a075c70a2..90649a4c39 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -54,6 +54,9 @@
#endif
#endif
+#ifdef HAVE_DEFAULT_STORE_H
+#include "default_store.h"
+#endif
#include "asn1.h"
#include "snmp_api.h"
#include "snmp_client.h"