Whamcloud - gitweb
LU-831 header: struct bit field should be unsigned type
[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(NET_SNMP_CFLAGS)
54 AC_SUBST(NET_SNMP_LIBS)
55 AC_SUBST(agentdir)
56 AC_SUBST(mibdir)
57 ])
58
59 #
60 # LS_CONFIG_FILE
61 #
62 # files that should be generated with AC_OUTPUT
63 #
64 AC_DEFUN([LS_CONFIG_FILES],
65 [AC_CONFIG_FILES([
66 snmp/Makefile
67 snmp/autoconf/Makefile
68 ])
69 ])