cvs: /php4/ext/snmp config.m4 snmp.c
| From: | Sascha Schumann | Date: | Sun, 19 Mar 2000 12:39:23 +0000 |
| Subject: | cvs: /php4/ext/snmp config.m4 snmp.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-12399@lists.php.net to get a copy of this message | ||
sas Sun Mar 19 04:39:23 2000 EDT
Modified files:
/php4/ext/snmp config.m4 snmp.c
Log:
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
Index: php4/ext/snmp/config.m4
diff -u php4/ext/snmp/config.m4:1.12 php4/ext/snmp/config.m4:1.13
--- php4/ext/snmp/config.m4:1.12 Wed Dec 29 20:52:11 1999
+++ php4/ext/snmp/config.m4 Sun Mar 19 04:38:53 2000
@@ -1,5 +1,37 @@
-dnl $Id: config.m4,v 1.12 1999/12/30 04:52:11 sas Exp $
+dnl $Id: config.m4,v 1.13 2000/03/19 12:38:53 sas Exp $
+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_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"
Index: php4/ext/snmp/snmp.c
diff -u php4/ext/snmp/snmp.c:1.21 php4/ext/snmp/snmp.c:1.22
--- php4/ext/snmp/snmp.c:1.21 Mon Mar 6 10:41:16 2000
+++ php4/ext/snmp/snmp.c Sun Mar 19 04:38:53 2000
@@ -17,7 +17,7 @@
| Steven Lawrance <slawrance@technologist.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: snmp.c,v 1.21 2000/03/06 18:41:16 ssb Exp $ */
+/* $Id: snmp.c,v 1.22 2000/03/19 12:38:53 sas Exp $ */
#include "php.h"
#if defined(COMPILE_DL)
@@ -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"