netsnmp.m4 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # BEGIN COPYRIGHT BLOCK
  2. # Copyright (C) 2006 Red Hat, Inc.
  3. # All rights reserved.
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. #
  19. # END COPYRIGHT BLOCK
  20. AC_CHECKING(for Net-SNMP)
  21. dnl - check for --with-netsnmp
  22. AC_MSG_CHECKING(for --with-netsnmp)
  23. AC_ARG_WITH(netsnmp, [ --with-netsnmp=PATH Net-SNMP directory],
  24. [
  25. if test -d "$withval" -a -d "$withval/lib" -a -d "$withval/include"; then
  26. AC_MSG_RESULT([using $withval])
  27. NETSNMPDIR=$withval
  28. if test -f "$withval/include/net-snmp/net-snmp-includes.h"; then
  29. netsnmp_inc="-I$withval/include"
  30. else
  31. AC_MSG_ERROR(net-snmp-config.h not found)
  32. fi
  33. netsnmp_lib="-L$withval/lib"
  34. netsnmp_libdir="$withval/lib"
  35. else
  36. AC_MSG_RESULT(yes)
  37. AC_MSG_ERROR([$withval not found])
  38. fi
  39. ],
  40. AC_MSG_RESULT(no))
  41. dnl - check for --with-netsnmp-inc
  42. AC_MSG_CHECKING(for --with-netsnmp-inc)
  43. AC_ARG_WITH(netsnmp-inc, [ --with-netsnmp-inc=PATH Net-SNMP include directory],
  44. [
  45. if test -f "$withval/net-snmp/net-snmp-includes.h"; then
  46. AC_MSG_RESULT([using $withval])
  47. netsnmp_inc="-I$withval"
  48. else
  49. echo
  50. AC_MSG_ERROR([$withval/net-snmp/net-snmp-includes.h not found])
  51. fi
  52. ],
  53. AC_MSG_RESULT(no))
  54. dnl - check for --with-netsnmp-lib
  55. AC_MSG_CHECKING(for --with-netsnmp-lib)
  56. AC_ARG_WITH(netsnmp-lib, [ --with-netsnmp-lib=PATH Net-SNMP library directory],
  57. [
  58. if test -d "$withval"
  59. then
  60. AC_MSG_RESULT([using $withval])
  61. netsnmp_lib="-L$withval"
  62. netsnmp_libdir="$withval"
  63. else
  64. echo
  65. AC_MSG_ERROR([$withval not found])
  66. fi
  67. ],
  68. AC_MSG_RESULT(no))
  69. dnl - look in standard system locations
  70. if test -z "$netsnmp_inc" -o -z "$netsnmp_lib"; then
  71. AC_MSG_CHECKING(for net-snmp-includes.h)
  72. if test -f /usr/include/net-snmp/net-snmp-includes.h; then
  73. AC_MSG_RESULT([using /usr/include/net-snmp/net-snmp-includes.h])
  74. netsnmp_inc="-I/usr/include"
  75. else
  76. AC_MSG_RESULT(no)
  77. AC_MSG_ERROR([net-snmp not found, specify with --with-netsnmp.])
  78. fi
  79. fi
  80. dnl - find dependent libs with net-snmp-config
  81. if test -n "$netsnmp_inc"; then
  82. if test -x "$NETSNMPDIR/bin/net-snmp-config"; then
  83. NETSNMP_CONFIG=$NETSNMPDIR/bin/net-snmp-config
  84. else
  85. AC_PATH_PROG(NETSNMP_CONFIG, net-snmp-config)
  86. fi
  87. if test -n "$NETSNMP_CONFIG"; then
  88. netsnmp_link=`$NETSNMP_CONFIG --agent-libs`
  89. else
  90. AC_MSG_ERROR([net-snmp-config not found, specify with --with-netsnmp.])
  91. fi
  92. else
  93. AC_MSG_ERROR([Net-SNMP not found, specify with --with-netsnmp.])
  94. fi