netsnmp.m4 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # BEGIN COPYRIGHT BLOCK
  2. # Copyright (C) 2006 Red Hat, Inc.
  3. # All rights reserved.
  4. #
  5. # License: GPL (version 3 or any later version).
  6. # See LICENSE for details.
  7. # END COPYRIGHT BLOCK
  8. AC_CHECKING(for Net-SNMP)
  9. dnl - check for --with-netsnmp
  10. AC_MSG_CHECKING(for --with-netsnmp)
  11. AC_ARG_WITH(netsnmp, AS_HELP_STRING([--with-netsnmp@<:@=PATH@:>@],[Net-SNMP directory]),
  12. [
  13. if test "$withval" = "yes"; then
  14. AC_MSG_RESULT(yes)
  15. elif test "$withval" = "no"; then
  16. AC_MSG_RESULT(no)
  17. AC_MSG_ERROR([Net-SNMP is required.])
  18. elif test -d "$withval" -a -d "$withval/lib" -a -d "$withval/include"; then
  19. AC_MSG_RESULT([using $withval])
  20. NETSNMPDIR=$withval
  21. if test -f "$withval/include/net-snmp/net-snmp-includes.h"; then
  22. netsnmp_inc="-I$withval/include"
  23. else
  24. AC_MSG_ERROR(net-snmp-config.h not found)
  25. fi
  26. netsnmp_lib="-L$withval/lib"
  27. netsnmp_libdir="$withval/lib"
  28. else
  29. AC_MSG_RESULT(yes)
  30. AC_MSG_ERROR([$withval not found])
  31. fi
  32. ],
  33. AC_MSG_RESULT(yes))
  34. dnl - check for --with-netsnmp-inc
  35. AC_MSG_CHECKING(for --with-netsnmp-inc)
  36. AC_ARG_WITH(netsnmp-inc, AS_HELP_STRING([--with-netsnmp-inc=PATH],[Net-SNMP include directory]),
  37. [
  38. if test -f "$withval/net-snmp/net-snmp-includes.h"; then
  39. AC_MSG_RESULT([using $withval])
  40. netsnmp_inc="-I$withval"
  41. else
  42. echo
  43. AC_MSG_ERROR([$withval/net-snmp/net-snmp-includes.h not found])
  44. fi
  45. ],
  46. AC_MSG_RESULT(no))
  47. dnl - check for --with-netsnmp-lib
  48. AC_MSG_CHECKING(for --with-netsnmp-lib)
  49. AC_ARG_WITH(netsnmp-lib, AS_HELP_STRING([--with-netsnmp-lib=PATH],[Net-SNMP library directory]),
  50. [
  51. if test -d "$withval"
  52. then
  53. AC_MSG_RESULT([using $withval])
  54. netsnmp_lib="-L$withval"
  55. netsnmp_libdir="$withval"
  56. else
  57. echo
  58. AC_MSG_ERROR([$withval not found])
  59. fi
  60. ],
  61. AC_MSG_RESULT(no))
  62. dnl - look in standard system locations
  63. if test -z "$netsnmp_inc" -o -z "$netsnmp_lib"; then
  64. AC_MSG_CHECKING(for net-snmp-includes.h)
  65. if test -f /usr/include/net-snmp/net-snmp-includes.h; then
  66. AC_MSG_RESULT([using /usr/include/net-snmp/net-snmp-includes.h])
  67. netsnmp_inc="-I/usr/include"
  68. else
  69. AC_MSG_RESULT(no)
  70. AC_MSG_ERROR([net-snmp not found, specify with --with-netsnmp.])
  71. fi
  72. fi
  73. dnl - find dependent libs with net-snmp-config
  74. if test -n "$netsnmp_inc"; then
  75. if test -x "$NETSNMPDIR/bin/net-snmp-config"; then
  76. NETSNMP_CONFIG=$NETSNMPDIR/bin/net-snmp-config
  77. else
  78. AC_PATH_PROG(NETSNMP_CONFIG, net-snmp-config)
  79. fi
  80. if test -n "$NETSNMP_CONFIG"; then
  81. netsnmp_link=`$NETSNMP_CONFIG --agent-libs`
  82. else
  83. AC_MSG_ERROR([net-snmp-config not found, specify with --with-netsnmp.])
  84. fi
  85. else
  86. AC_MSG_ERROR([Net-SNMP not found, specify with --with-netsnmp.])
  87. fi