xref: /PHP-7.0/ext/snmp/config.m4 (revision c6d977dd)
1dnl
2dnl $Id$
3dnl
4
5PHP_ARG_WITH(snmp,for SNMP support,
6[  --with-snmp[=DIR]         Include SNMP support])
7
8PHP_ARG_WITH(openssl-dir,OpenSSL dir for SNMP,
9[  --with-openssl-dir[=DIR]  SNMP: openssl install prefix], no, no)
10
11if test "$PHP_SNMP" != "no"; then
12
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    snmp_full_version=`$SNMP_CONFIG --version`
24    ac_IFS=$IFS
25    IFS="."
26    set $snmp_full_version
27    IFS=$ac_IFS
28    SNMP_VERSION=`expr [$]1 \* 1000 + [$]2`
29    if test "$SNMP_VERSION" -ge "5003"; then
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        SNMP_LIBNAME=netsnmp
34      else
35        AC_MSG_ERROR([Could not find the required paths. Please check your net-snmp installation.])
36      fi
37    else
38      AC_MSG_ERROR([Net-SNMP version 5.3 or greater reqired (detected $snmp_full_version).])
39    fi
40  else
41    AC_MSG_ERROR([Could not find net-snmp-config binary. Please check your net-snmp installation.])
42  fi
43
44  dnl Test build.
45  PHP_CHECK_LIBRARY($SNMP_LIBNAME, init_snmp,
46  [
47    AC_DEFINE(HAVE_SNMP,1,[ ])
48  ], [
49    AC_MSG_ERROR([SNMP sanity check failed. Please check config.log for more information.])
50  ], [
51    $SNMP_SHARED_LIBADD
52  ])
53
54  dnl Check whether shutdown_snmp_logging() exists.
55  PHP_CHECK_LIBRARY($SNMP_LIBNAME, shutdown_snmp_logging,
56  [
57    AC_DEFINE(HAVE_SHUTDOWN_SNMP_LOGGING, 1, [ ])
58  ], [], [
59    $SNMP_SHARED_LIBADD
60  ])
61
62  PHP_NEW_EXTENSION(snmp, snmp.c, $ext_shared)
63  PHP_SUBST(SNMP_SHARED_LIBADD)
64fi
65