xref: /PHP-7.3/ext/snmp/config.m4 (revision 902d39a3)
1dnl config.m4 for extension snmp
2
3PHP_ARG_WITH(snmp,for SNMP support,
4[  --with-snmp[=DIR]         Include SNMP support])
5
6PHP_ARG_WITH(openssl-dir,OpenSSL dir for SNMP,
7[  --with-openssl-dir[=DIR]  SNMP: openssl install prefix], no, no)
8
9if test "$PHP_SNMP" != "no"; then
10
11  if test "$PHP_SNMP" = "yes"; then
12    AC_PATH_PROG(SNMP_CONFIG,net-snmp-config,,[/usr/local/bin:$PATH])
13  else
14    SNMP_CONFIG="$PHP_SNMP/bin/net-snmp-config"
15  fi
16
17  if test -x "$SNMP_CONFIG"; then
18    SNMP_LIBS=`$SNMP_CONFIG --netsnmp-libs`
19    SNMP_LIBS="$SNMP_LIBS `$SNMP_CONFIG --external-libs`"
20    SNMP_PREFIX=`$SNMP_CONFIG --prefix`
21    snmp_full_version=`$SNMP_CONFIG --version`
22    ac_IFS=$IFS
23    IFS="."
24    set $snmp_full_version
25    IFS=$ac_IFS
26    SNMP_VERSION=`expr [$]1 \* 1000 + [$]2`
27    if test "$SNMP_VERSION" -ge "5003"; then
28      if test -n "$SNMP_LIBS" && test -n "$SNMP_PREFIX"; then
29        PHP_ADD_INCLUDE(${SNMP_PREFIX}/include)
30        PHP_EVAL_LIBLINE($SNMP_LIBS, SNMP_SHARED_LIBADD)
31        SNMP_LIBNAME=netsnmp
32      else
33        AC_MSG_ERROR([Could not find the required paths. Please check your net-snmp installation.])
34      fi
35    else
36      AC_MSG_ERROR([Net-SNMP version 5.3 or greater reqired (detected $snmp_full_version).])
37    fi
38  else
39    AC_MSG_ERROR([Could not find net-snmp-config binary. Please check your net-snmp installation.])
40  fi
41
42  dnl Test build.
43  PHP_CHECK_LIBRARY($SNMP_LIBNAME, init_snmp,
44  [
45    AC_DEFINE(HAVE_SNMP,1,[ ])
46  ], [
47    AC_MSG_ERROR([SNMP sanity check failed. Please check config.log for more information.])
48  ], [
49    $SNMP_SHARED_LIBADD
50  ])
51
52  dnl Check whether shutdown_snmp_logging() exists.
53  PHP_CHECK_LIBRARY($SNMP_LIBNAME, shutdown_snmp_logging,
54  [
55    AC_DEFINE(HAVE_SHUTDOWN_SNMP_LOGGING, 1, [ ])
56  ], [], [
57    $SNMP_SHARED_LIBADD
58  ])
59
60  PHP_NEW_EXTENSION(snmp, snmp.c, $ext_shared)
61  PHP_SUBST(SNMP_SHARED_LIBADD)
62fi
63