netsnmp.m4 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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, AS_HELP_STRING([--with-netsnmp@<:@=PATH@:>@],[Net-SNMP directory]),
  24. [
  25. if test "$withval" = "yes"; then
  26. AC_MSG_RESULT(yes)
  27. elif test "$withval" = "no"; then
  28. AC_MSG_RESULT(no)
  29. AC_MSG_ERROR([Net-SNMP is required.])
  30. elif test -d "$withval" -a -d "$withval/lib" -a -d "$withval/include"; then
  31. AC_MSG_RESULT([using $withval])
  32. NETSNMPDIR=$withval
  33. if test -f "$withval/include/net-snmp/net-snmp-includes.h"; then
  34. netsnmp_inc="-I$withval/include"
  35. else
  36. AC_MSG_ERROR(net-snmp-config.h not found)
  37. fi
  38. netsnmp_lib="-L$withval/lib"
  39. netsnmp_libdir="$withval/lib"
  40. else
  41. AC_MSG_RESULT(yes)
  42. AC_MSG_ERROR([$withval not found])
  43. fi
  44. ],
  45. AC_MSG_RESULT(yes))
  46. dnl - check for --with-netsnmp-inc
  47. AC_MSG_CHECKING(for --with-netsnmp-inc)
  48. AC_ARG_WITH(netsnmp-inc, AS_HELP_STRING([--with-netsnmp-inc=PATH],[Net-SNMP include directory]),
  49. [
  50. if test -f "$withval/net-snmp/net-snmp-includes.h"; then
  51. AC_MSG_RESULT([using $withval])
  52. netsnmp_inc="-I$withval"
  53. else
  54. echo
  55. AC_MSG_ERROR([$withval/net-snmp/net-snmp-includes.h not found])
  56. fi
  57. ],
  58. AC_MSG_RESULT(no))
  59. dnl - check for --with-netsnmp-lib
  60. AC_MSG_CHECKING(for --with-netsnmp-lib)
  61. AC_ARG_WITH(netsnmp-lib, AS_HELP_STRING([--with-netsnmp-lib=PATH],[Net-SNMP library directory]),
  62. [
  63. if test -d "$withval"
  64. then
  65. AC_MSG_RESULT([using $withval])
  66. netsnmp_lib="-L$withval"
  67. netsnmp_libdir="$withval"
  68. else
  69. echo
  70. AC_MSG_ERROR([$withval not found])
  71. fi
  72. ],
  73. AC_MSG_RESULT(no))
  74. dnl - look in standard system locations
  75. if test -z "$netsnmp_inc" -o -z "$netsnmp_lib"; then
  76. AC_MSG_CHECKING(for net-snmp-includes.h)
  77. if test -f /usr/include/net-snmp/net-snmp-includes.h; then
  78. AC_MSG_RESULT([using /usr/include/net-snmp/net-snmp-includes.h])
  79. netsnmp_inc="-I/usr/include"
  80. else
  81. AC_MSG_RESULT(no)
  82. AC_MSG_ERROR([net-snmp not found, specify with --with-netsnmp.])
  83. fi
  84. fi
  85. dnl - find dependent libs with net-snmp-config
  86. if test -n "$netsnmp_inc"; then
  87. if test -x "$NETSNMPDIR/bin/net-snmp-config"; then
  88. NETSNMP_CONFIG=$NETSNMPDIR/bin/net-snmp-config
  89. else
  90. AC_PATH_PROG(NETSNMP_CONFIG, net-snmp-config)
  91. fi
  92. if test -n "$NETSNMP_CONFIG"; then
  93. netsnmp_link=`$NETSNMP_CONFIG --agent-libs`
  94. else
  95. AC_MSG_ERROR([net-snmp-config not found, specify with --with-netsnmp.])
  96. fi
  97. else
  98. AC_MSG_ERROR([Net-SNMP not found, specify with --with-netsnmp.])
  99. fi