Whamcloud - gitweb
2ca0f46bada8ae6dc0f8cf2d9eac300ecdcc07fc
[fs/lustre-release.git] / snmp / autoconf / lustre-snmp.m4
1 #
2 # LS_CONFIGURE
3 #
4 # configure bits for lustre-snmp
5 #
6 AC_DEFUN([LS_CONFIGURE],
7 [AC_MSG_CHECKING([whether to try to build SNMP support])
8 AC_ARG_ENABLE([snmp],
9         AC_HELP_STRING([--enable-snmp],
10                        [require SNMP support (default=auto)]),
11         [],[enable_snmp='auto'])
12 AC_MSG_RESULT([$enable_snmp])
13
14 if test x$enable_snmp != xno ; then
15         AC_CHECK_PROG([NET_SNMP_CONFIG], [net-snmp-config], [net-snmp-config], [])
16         if test "$NET_SNMP_CONFIG" ; then
17                 NET_SNMP_CFLAGS=$($NET_SNMP_CONFIG --base-cflags)
18                 NET_SNMP_LIBS=$($NET_SNMP_CONFIG --agent-libs)
19
20                 CPPFLAGS_save="$CPPFLAGS"
21                 CPPFLAGS="$CPPFLAGS $NET_SNMP_CFLAGS"
22
23                 LIBS_save="$LIBS"
24                 LIBS="$LIBS $NET_SNMP_LIBS"
25
26                 AC_CHECK_HEADER([net-snmp/net-snmp-config.h],[
27                         AC_CHECK_FUNC([register_mib],[SNMP_SUBDIR="snmp"],[
28                                 LIBS="$LIBS -lwrap"
29                                 NET_SNMP_LISB="$NET_SNMP_LIBS -lwrap"
30                                 # fail autoconf's cache
31                                 unset ac_cv_func_register_mib
32                                 AC_CHECK_FUNC([register_mib],[SNMP_SUBDIR="snmp"])
33                         ])
34                 ])
35
36                 LIBS="$LIBS_save"
37                 CPPFLAGS="$CPPFLAGS_save"
38         fi
39         AC_MSG_CHECKING([for SNMP support])
40         if test "$SNMP_SUBDIR" ; then
41                 AC_MSG_RESULT([yes])
42         else
43                 AC_MSG_RESULT([no (see config.log for errors)])
44                 if test x$enable_snmp = xyes ; then
45                         AC_MSG_ERROR([SNMP support was requested, but unavailable])
46                 fi
47         fi
48 fi
49
50 agentdir='${pkglibdir}/snmp'
51 mibdir='${pkgdatadir}/snmp/mibs'
52
53 AC_SUBST(SNMP_SUBDIR)
54 AC_SUBST(NET_SNMP_CFLAGS)
55 AC_SUBST(NET_SNMP_LIBS)
56 AC_SUBST(agentdir)
57 AC_SUBST(mibdir)
58 ])
59
60 #
61 # LS_CONDITIONALS
62 #
63 # AM_CONDITIONALs for lustre-snmp
64 #
65 AC_DEFUN([LS_CONDITIONALS],
66 [
67 ])
68
69 #
70 # LS_CONFIG_FILE
71 #
72 # files that should be generated with AC_OUTPUT
73 #
74 AC_DEFUN([LS_CONFIG_FILES],
75 [AC_CONFIG_FILES([
76 snmp/Makefile
77 snmp/autoconf/Makefile
78 ])
79 ])