Skip to content

Commit 9f306aa

Browse files
author
SVN Migration
committed
This commit was manufactured by cvs2svn to create branch 'unlabeled-1.29.2'.
1 parent 3d8f1f0 commit 9f306aa

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

ext/snmp/config.m4

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
dnl
2+
dnl $Id$
3+
dnl
4+
5+
PHP_ARG_WITH(snmp,for SNMP support,
6+
[ --with-snmp[=DIR] Include SNMP support.])
7+
8+
if test "$PHP_SNMP" != "no"; then
9+
10+
dnl
11+
dnl Try net-snmp first
12+
dnl
13+
if test "$PHP_SNMP" = "yes"; then
14+
AC_PATH_PROG(SNMP_CONFIG,net-snmp-config,,[/usr/local/bin:$PATH])
15+
else
16+
SNMP_CONFIG="$PHP_SNMP/bin/net-snmp-config"
17+
fi
18+
19+
if test -x "$SNMP_CONFIG"; then
20+
SNMP_LIBS=`$SNMP_CONFIG --netsnmp-libs`
21+
SNMP_LIBS="$SNMP_LIBS `$SNMP_CONFIG --external-libs`"
22+
SNMP_PREFIX=`$SNMP_CONFIG --prefix`
23+
24+
if test -n "$SNMP_LIBS" && test -n "$SNMP_PREFIX"; then
25+
PHP_ADD_INCLUDE(${SNMP_PREFIX}/include)
26+
PHP_EVAL_LIBLINE($SNMP_LIBS, SNMP_SHARED_LIBADD)
27+
AC_DEFINE(HAVE_NET_SNMP,1,[ ])
28+
SNMP_LIBNAME=netsnmp
29+
else
30+
AC_MSG_ERROR([Could not find the required paths. Please check your net-snmp installation.])
31+
fi
32+
else
33+
34+
dnl
35+
dnl Try ucd-snmp if net-snmp test failed
36+
dnl
37+
38+
if test "$PHP_SNMP" = "yes"; then
39+
for i in /usr/include /usr/local/include; do
40+
test -f $i/snmp.h && SNMP_INCDIR=$i
41+
test -f $i/ucd-snmp/snmp.h && SNMP_INCDIR=$i/ucd-snmp
42+
test -f $i/snmp/snmp.h && SNMP_INCDIR=$i/snmp
43+
test -f $i/snmp/include/ucd-snmp/snmp.h && SNMP_INCDIR=$i/snmp/include/ucd-snmp
44+
done
45+
for i in /usr /usr/snmp /usr/local /usr/local/snmp; do
46+
test -f $i/lib/libsnmp.a -o -f $i/lib/libsnmp.$SHLIB_SUFFIX_NAME && SNMP_LIBDIR=$i/lib
47+
done
48+
else
49+
SNMP_INCDIR=$PHP_SNMP/include
50+
test -d $PHP_SNMP/include/ucd-snmp && SNMP_INCDIR=$PHP_SNMP/include/ucd-snmp
51+
SNMP_LIBDIR=$PHP_SNMP/lib
52+
fi
53+
54+
if test -z "$SNMP_INCDIR"; then
55+
AC_MSG_ERROR(snmp.h not found. Check your SNMP installation.)
56+
elif test -z "$SNMP_LIBDIR"; then
57+
AC_MSG_ERROR(libsnmp not found. Check your SNMP installation.)
58+
fi
59+
60+
old_CPPFLAGS=$CPPFLAGS
61+
CPPFLAGS=-I$SNMP_INCDIR
62+
AC_CHECK_HEADERS(default_store.h)
63+
if test "$ac_cv_header_default_store_h" = "yes"; then
64+
AC_MSG_CHECKING(for OpenSSL support in SNMP libraries)
65+
AC_EGREP_CPP(yes,[
66+
#include <ucd-snmp-config.h>
67+
#if USE_OPENSSL
68+
yes
69+
#endif
70+
],[
71+
SNMP_SSL=yes
72+
],[
73+
SNMP_SSL=no
74+
])
75+
fi
76+
CPPFLAGS=$old_CPPFLAGS
77+
AC_MSG_RESULT($SNMP_SSL)
78+
79+
if test "$SNMP_SSL" = "yes"; then
80+
if test "$PHP_OPENSSL" != "no"; then
81+
PHP_ADD_LIBRARY(ssl, 1, SNMP_SHARED_LIBADD)
82+
PHP_ADD_LIBRARY(crypto,1, SNMP_SHARED_LIBADD)
83+
else
84+
AC_MSG_ERROR(The UCD-SNMP in this system is built with SSL support.
85+
86+
Add --with-openssl<=DIR> to your configure line.)
87+
fi
88+
fi
89+
90+
AC_CHECK_LIB(kstat, kstat_read, [ PHP_ADD_LIBRARY(kstat,,SNMP_SHARED_LIBADD) ])
91+
PHP_ADD_INCLUDE($SNMP_INCDIR)
92+
PHP_ADD_LIBRARY_WITH_PATH(snmp, $SNMP_LIBDIR, SNMP_SHARED_LIBADD)
93+
SNMP_LIBNAME=snmp
94+
fi
95+
96+
AC_CHECK_FUNCS(snmp_parse_oid)
97+
98+
PHP_CHECK_LIBRARY($SNMP_LIBNAME, init_snmp,
99+
[
100+
AC_DEFINE(HAVE_SNMP,1,[ ])
101+
], [
102+
AC_MSG_ERROR([SNMP sanity check failed. Please check config.log for more information.])
103+
], [
104+
$SNMP_SHARED_LIBADD
105+
])
106+
107+
PHP_NEW_EXTENSION(snmp, snmp.c, $ext_shared)
108+
PHP_SUBST(SNMP_SHARED_LIBADD)
109+
fi
110+
111+
112+
AC_MSG_CHECKING(whether to enable UCD SNMP hack)
113+
AC_ARG_ENABLE(ucd-snmp-hack,
114+
[ --enable-ucd-snmp-hack Enable UCD SNMP hack],[
115+
if test "$enableval" = "yes" ; then
116+
AC_DEFINE(UCD_SNMP_HACK, 1, [ ])
117+
AC_MSG_RESULT(yes)
118+
else
119+
AC_MSG_RESULT(no)
120+
fi
121+
],[
122+
AC_MSG_RESULT(no)
123+
])

0 commit comments

Comments
 (0)