Skip to content

Commit abeb4bd

Browse files
author
foobar
committed
Cleaning. And made the check for SSL support in SNMP to really work.
1 parent 9294240 commit abeb4bd

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

ext/snmp/Makefile.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@ LTLIBRARY_SOURCES = snmp.c
44
LTLIBRARY_SHARED_NAME = snmp.la
55
LTLIBRARY_SHARED_LIBADD = $(SNMP_SHARED_LIBADD)
66

7-
EXTRA_INCLUDES = $(SNMP_INCLUDE)
8-
97
include $(top_srcdir)/build/dynlib.mk

ext/snmp/config.m4

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ PHP_ARG_WITH(snmp,for SNMP support,
1010
to build as a dl and still specify DIR.])
1111

1212
if test "$PHP_SNMP" != "no"; then
13+
1314
if test "$PHP_SNMP" = "yes"; then
1415
for i in /usr/include /usr/local/include; do
1516
test -f $i/snmp.h && SNMP_INCDIR=$i
@@ -22,7 +23,7 @@ PHP_ARG_WITH(snmp,for SNMP support,
2223
done
2324
else
2425
SNMP_INCDIR=$PHP_SNMP/include
25-
test -d $PHP_SNMP/include/ucd-snmp && SNMP_INCDIR=$withval/include/ucd-snmp
26+
test -d $PHP_SNMP/include/ucd-snmp && SNMP_INCDIR=$PHP_SNMP/include/ucd-snmp
2627
SNMP_LIBDIR=$PHP_SNMP/lib
2728
fi
2829

@@ -32,41 +33,46 @@ PHP_ARG_WITH(snmp,for SNMP support,
3233
AC_MSG_ERROR(libsnmp not found. Check your SNMP installation.)
3334
fi
3435

35-
AC_DEFINE(HAVE_SNMP,1,[ ])
36-
PHP_ADD_INCLUDE($SNMP_INCDIR)
37-
PHP_ADD_LIBRARY_WITH_PATH(snmp, $SNMP_LIBDIR, SNMP_SHARED_LIBADD)
38-
3936
old_CPPFLAGS=$CPPFLAGS
40-
CPPFLAGS="$INCLUDES $CPPFLAGS"
37+
CPPFLAGS=-I$SNMP_INCDIR
4138
AC_CHECK_HEADERS(default_store.h)
4239
if test "$ac_cv_header_default_store_h" = "yes"; then
43-
dnl UCD SNMP 4.1.x
44-
AC_TRY_RUN([
45-
#include <ucd-snmp-config.h>
46-
main() { exit(USE_OPENSSL != 1); }
40+
AC_MSG_CHECKING(for OpenSSL support in SNMP libraries)
41+
AC_EGREP_CPP(yes,[
42+
#include <ucd-snmp-config.h>
43+
#if USE_OPENSSL
44+
yes
45+
#endif
4746
],[
4847
SNMP_SSL=yes
4948
],[
5049
SNMP_SSL=no
51-
],[
52-
SNMP_SSL=no
5350
])
51+
fi
52+
CPPFLAGS=$old_CPPFLAGS
53+
AC_MSG_RESULT($SNMP_SSL)
54+
55+
if test "$SNMP_SSL" = "yes"; then
56+
if test "$PHP_OPENSSL" != "no"; then
57+
PHP_ADD_LIBRARY(ssl, 1, SNMP_SHARED_LIBADD)
58+
PHP_ADD_LIBRARY(crypto,1, SNMP_SHARED_LIBADD)
59+
else
60+
AC_MSG_ERROR(The UCD-SNMP in this system is build with SSL support.
5461

55-
if test "$SNMP_SSL" = "yes"; then
56-
PHP_SETUP_OPENSSL
62+
Add --with-openssl<=DIR> to your configure line.)
5763
fi
5864
fi
59-
CPPFLAGS=$old_CPPFLAGS
6065

61-
PHP_EXTENSION(snmp,$ext_shared)
62-
PHP_SUBST(SNMP_SHARED_LIBADD)
63-
6466
AC_CHECK_LIB(kstat, kstat_read, [ PHP_ADD_LIBRARY(kstat,,SNMP_SHARED_LIBADD) ])
65-
SNMP_INCLUDE=-I$SNMP_INCDIR
67+
68+
AC_DEFINE(HAVE_SNMP,1,[ ])
69+
PHP_ADD_INCLUDE($SNMP_INCDIR)
70+
PHP_ADD_LIBRARY_WITH_PATH(snmp, $SNMP_LIBDIR, SNMP_SHARED_LIBADD)
71+
72+
PHP_EXTENSION(snmp, $ext_shared)
73+
PHP_SUBST(SNMP_SHARED_LIBADD)
6674
fi
6775

68-
PHP_SUBST(SNMP_LIBDIR)
69-
PHP_SUBST(SNMP_INCLUDE)
7076

7177
AC_MSG_CHECKING(whether to enable UCD SNMP hack)
7278
AC_ARG_ENABLE(ucd-snmp-hack,

0 commit comments

Comments
 (0)