config.m4 1.8 KB

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