config.m4 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. dnl
  2. dnl $Id$
  3. dnl
  4. PHP_ARG_WITH(snmp,for SNMP support,
  5. [ --with-snmp[=DIR] Include SNMP support])
  6. PHP_ARG_WITH(openssl-dir,OpenSSL dir for SNMP,
  7. [ --with-openssl-dir[=DIR] SNMP: openssl install prefix], no, no)
  8. if test "$PHP_SNMP" != "no"; then
  9. if test "$PHP_SNMP" = "yes"; then
  10. AC_PATH_PROG(SNMP_CONFIG,net-snmp-config,,[/usr/local/bin:$PATH])
  11. else
  12. SNMP_CONFIG="$PHP_SNMP/bin/net-snmp-config"
  13. fi
  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 reqired (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
  38. dnl Test build.
  39. PHP_CHECK_LIBRARY($SNMP_LIBNAME, init_snmp,
  40. [
  41. AC_DEFINE(HAVE_SNMP,1,[ ])
  42. ], [
  43. AC_MSG_ERROR([SNMP sanity check failed. Please check config.log for more information.])
  44. ], [
  45. $SNMP_SHARED_LIBADD
  46. ])
  47. dnl Check whether shutdown_snmp_logging() exists.
  48. PHP_CHECK_LIBRARY($SNMP_LIBNAME, shutdown_snmp_logging,
  49. [
  50. AC_DEFINE(HAVE_SHUTDOWN_SNMP_LOGGING, 1, [ ])
  51. ], [], [
  52. $SNMP_SHARED_LIBADD
  53. ])
  54. PHP_NEW_EXTENSION(snmp, snmp.c, $ext_shared)
  55. PHP_SUBST(SNMP_SHARED_LIBADD)
  56. fi