2
dnl $Id: config.m4,v 1.32.2.1.2.3 2007/07/31 13:02:00 jani Exp $
5
PHP_ARG_WITH(snmp,for SNMP support,
6
[ --with-snmp[=DIR] Include SNMP support])
8
PHP_ARG_WITH(openssl-dir,OpenSSL dir for SNMP,
9
[ --with-openssl-dir[=DIR] SNMP: openssl install prefix], no, no)
11
PHP_ARG_ENABLE(ucd-snmp-hack, whether to enable UCD SNMP hack,
12
[ --enable-ucd-snmp-hack SNMP: Enable UCD SNMP hack], no, no)
14
if test "$PHP_SNMP" != "no"; then
17
dnl Try net-snmp first
19
if test "$PHP_SNMP" = "yes"; then
20
AC_PATH_PROG(SNMP_CONFIG,net-snmp-config,,[/usr/local/bin:$PATH])
22
SNMP_CONFIG="$PHP_SNMP/bin/net-snmp-config"
25
if test -x "$SNMP_CONFIG"; then
26
SNMP_LIBS=`$SNMP_CONFIG --netsnmp-libs`
27
SNMP_LIBS="$SNMP_LIBS `$SNMP_CONFIG --external-libs`"
28
SNMP_PREFIX=`$SNMP_CONFIG --prefix`
30
if test -n "$SNMP_LIBS" && test -n "$SNMP_PREFIX"; then
31
PHP_ADD_INCLUDE(${SNMP_PREFIX}/include)
32
PHP_EVAL_LIBLINE($SNMP_LIBS, SNMP_SHARED_LIBADD)
33
AC_DEFINE(HAVE_NET_SNMP,1,[ ])
36
AC_MSG_ERROR([Could not find the required paths. Please check your net-snmp installation.])
41
dnl Try ucd-snmp if net-snmp test failed
44
if test "$PHP_SNMP" = "yes"; then
45
for i in /usr/include /usr/local/include; do
46
test -f $i/snmp.h && SNMP_INCDIR=$i
47
test -f $i/ucd-snmp/snmp.h && SNMP_INCDIR=$i/ucd-snmp
48
test -f $i/snmp/snmp.h && SNMP_INCDIR=$i/snmp
49
test -f $i/snmp/include/ucd-snmp/snmp.h && SNMP_INCDIR=$i/snmp/include/ucd-snmp
51
for i in /usr/$PHP_LIBDIR /usr/snmp/lib /usr/local/$PHP_LIBDIR /usr/local/lib /usr/local/snmp/lib; do
52
test -f $i/libsnmp.a || test -f $i/libsnmp.$SHLIB_SUFFIX_NAME && SNMP_LIBDIR=$i
55
SNMP_INCDIR=$PHP_SNMP/include
56
test -d $PHP_SNMP/include/ucd-snmp && SNMP_INCDIR=$PHP_SNMP/include/ucd-snmp
57
SNMP_LIBDIR=$PHP_SNMP/lib
60
if test -z "$SNMP_INCDIR"; then
61
AC_MSG_ERROR(snmp.h not found. Check your SNMP installation.)
62
elif test -z "$SNMP_LIBDIR"; then
63
AC_MSG_ERROR(libsnmp not found. Check your SNMP installation.)
66
old_CPPFLAGS=$CPPFLAGS
67
CPPFLAGS=-I$SNMP_INCDIR
68
AC_CHECK_HEADERS(default_store.h)
69
if test "$ac_cv_header_default_store_h" = "yes"; then
70
AC_MSG_CHECKING(for OpenSSL support in SNMP libraries)
72
#include <ucd-snmp-config.h>
82
CPPFLAGS=$old_CPPFLAGS
83
AC_MSG_RESULT($SNMP_SSL)
85
if test "$SNMP_SSL" = "yes"; then
86
if test "$PHP_OPENSSL_DIR" != "no"; then
87
PHP_OPENSSL=$PHP_OPENSSL_DIR
90
if test "$PHP_OPENSSL" = "no"; then
91
AC_MSG_ERROR([The UCD-SNMP in this system is built with SSL support.
93
Add --with-openssl-dir=DIR to your configure line.])
95
PHP_SETUP_OPENSSL(SNMP_SHARED_LIBADD, [], [
96
AC_MSG_ERROR([SNMP: OpenSSL check failed. Please check config.log for more information.])
101
AC_CHECK_LIB(kstat, kstat_read, [ PHP_ADD_LIBRARY(kstat,,SNMP_SHARED_LIBADD) ])
102
PHP_ADD_INCLUDE($SNMP_INCDIR)
103
PHP_ADD_LIBRARY_WITH_PATH(snmp, $SNMP_LIBDIR, SNMP_SHARED_LIBADD)
107
dnl Check whether snmp_parse_oid() exists.
108
PHP_CHECK_LIBRARY($SNMP_LIBNAME, snmp_parse_oid,
110
AC_DEFINE(HAVE_SNMP_PARSE_OID, 1, [ ])
116
PHP_CHECK_LIBRARY($SNMP_LIBNAME, init_snmp,
118
AC_DEFINE(HAVE_SNMP,1,[ ])
120
AC_MSG_ERROR([SNMP sanity check failed. Please check config.log for more information.])
125
if test "$PHP_UCD_SNMP_HACK" = "yes" ; then
126
AC_DEFINE(UCD_SNMP_HACK, 1, [ ])
129
PHP_NEW_EXTENSION(snmp, snmp.c, $ext_shared)
130
PHP_SUBST(SNMP_SHARED_LIBADD)