|
1 | 1 | PHP_ARG_WITH([snmp],
|
2 | 2 | [for SNMP support],
|
3 | 3 | [AS_HELP_STRING([[--with-snmp[=DIR]]],
|
4 |
| - [Include SNMP support])]) |
| 4 | + [Include SNMP support. Use PKG_CONFIG_PATH (or SNMP_CFLAGS and SNMP_LIBS) |
| 5 | + environment variables, or alternatively the optional DIR argument to |
| 6 | + customize where to look for the net-snmp-config utility of the NET-SNMP |
| 7 | + library.])]) |
5 | 8 |
|
6 | 9 | if test "$PHP_SNMP" != "no"; then
|
| 10 | + snmp_found=no |
| 11 | + AS_VAR_IF([PHP_SNMP], [yes], |
| 12 | + [PKG_CHECK_MODULES([SNMP], [netsnmp >= 5.3], [snmp_found=yes], [:])]) |
7 | 13 |
|
8 |
| - if test "$PHP_SNMP" = "yes"; then |
9 |
| - AC_PATH_PROG(SNMP_CONFIG,net-snmp-config,,[/usr/local/bin:$PATH]) |
10 |
| - else |
11 |
| - SNMP_CONFIG="$PHP_SNMP/bin/net-snmp-config" |
12 |
| - fi |
| 14 | + AS_VAR_IF([snmp_found], [no], [ |
| 15 | + AS_VAR_IF([PHP_SNMP], [yes], |
| 16 | + [AC_PATH_PROG([SNMP_CONFIG], [net-snmp-config],, [/usr/local/bin:$PATH])], |
| 17 | + [SNMP_CONFIG="$PHP_SNMP/bin/net-snmp-config"]) |
13 | 18 |
|
14 |
| - if test -x "$SNMP_CONFIG"; then |
15 |
| - SNMP_LIBS=`$SNMP_CONFIG --netsnmp-libs` |
16 |
| - SNMP_LIBS="$SNMP_LIBS `$SNMP_CONFIG --external-libs`" |
17 |
| - SNMP_PREFIX=`$SNMP_CONFIG --prefix` |
18 |
| - snmp_full_version=`$SNMP_CONFIG --version` |
19 |
| - ac_IFS=$IFS |
20 |
| - IFS="." |
21 |
| - set $snmp_full_version |
22 |
| - IFS=$ac_IFS |
23 |
| - SNMP_VERSION=`expr [$]1 \* 1000 + [$]2` |
24 |
| - if test "$SNMP_VERSION" -ge "5003"; then |
25 |
| - if test -n "$SNMP_LIBS" && test -n "$SNMP_PREFIX"; then |
26 |
| - PHP_ADD_INCLUDE([${SNMP_PREFIX}/include]) |
27 |
| - PHP_EVAL_LIBLINE([$SNMP_LIBS], [SNMP_SHARED_LIBADD]) |
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 |
| - AC_MSG_ERROR([Net-SNMP version 5.3 or greater required (detected $snmp_full_version).]) |
34 |
| - fi |
35 |
| - else |
36 |
| - AC_MSG_ERROR([Could not find net-snmp-config binary. Please check your net-snmp installation.]) |
37 |
| - fi |
| 19 | + AS_IF([test ! -x "$SNMP_CONFIG"], |
| 20 | + [AC_MSG_ERROR(m4_text_wrap([ |
| 21 | + Could not find net-snmp-config binary. Please check your net-snmp |
| 22 | + installation. |
| 23 | + ]))]) |
| 24 | +
|
| 25 | + snmp_version=$($SNMP_CONFIG --version) |
| 26 | + AS_VERSION_COMPARE([$snmp_version], [5.3], |
| 27 | + [AC_MSG_ERROR(m4_text_wrap([ |
| 28 | + Net-SNMP version 5.3 or greater required (detected $snmp_version). |
| 29 | + ]))]) |
| 30 | +
|
| 31 | + SNMP_PREFIX=$($SNMP_CONFIG --prefix) |
| 32 | + SNMP_CFLAGS="-I${SNMP_PREFIX}/include" |
| 33 | + SNMP_LIBS=$($SNMP_CONFIG --netsnmp-libs) |
| 34 | + SNMP_LIBS="$SNMP_LIBS $($SNMP_CONFIG --external-libs)" |
| 35 | +
|
| 36 | + AS_IF([test -z "$SNMP_LIBS" || test -z "$SNMP_PREFIX"], |
| 37 | + [AC_MSG_ERROR(m4_text_wrap([ |
| 38 | + Could not find the required paths. Please check your net-snmp |
| 39 | + installation. |
| 40 | + ]))]) |
| 41 | + ]) |
| 42 | + |
| 43 | + PHP_EVAL_INCLINE([$SNMP_CFLAGS]) |
| 44 | + PHP_EVAL_LIBLINE([$SNMP_LIBS], [SNMP_SHARED_LIBADD]) |
| 45 | + SNMP_LIBNAME=netsnmp |
38 | 46 |
|
39 | 47 | dnl Test build.
|
40 | 48 | PHP_CHECK_LIBRARY([$SNMP_LIBNAME], [init_snmp],
|
|
0 commit comments