void
init_hr_swinst(void)
{
---- net-snmp-5.4.1/configure.in 2008-05-15 13:05:07.559306690 +0300
-+++ net-snmp-5.4.1.hrmib/configure.in 2008-05-15 13:04:24.684830570 +0300
-@@ -2768,25 +2768,41 @@
- fi
- ])
-
+--- net-snmp-5.6/configure.d/config_os_libs1.orig 2010-10-24 10:37:25.527741043 +0200
++++ net-snmp-5.6/configure.d/config_os_libs1 2010-10-24 10:40:56.519744396 +0200
+@@ -425,20 +425,34 @@
+ # RPM checks
+ #
+ ##
-AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
-
+-
-AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
-AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
-
- else
- with_rpm=no
- fi
++#
+# check if we can use rpm hrmib export
+if test "$with_rpm" != "no" ; then
-+ AC_PATH_PROG([RPM], rpm)
-+ if test -n "$RPM"; then
-+ changequote(, )
-+ RPM_HRMIB_PATH=$($RPM -E %{_hrmib_path} | sed -e 's,/[^/]\+$,,')
-+ changequote([, ])
-+ if test -n "$RPM_HRMIB_PATH"; then
-+ AC_DEFINE_UNQUOTED([RPM_HRMIB_PATH], ["$RPM_HRMIB_PATH"], [Directory where RPM exports packages hrmib information])
-+ fi
-+ fi
++ AC_PATH_PROG([RPM], rpm)
++ if test -n "$RPM"; then
++ changequote(, )
++ RPM_HRMIB_PATH=$($RPM -E %{_hrmib_path} | sed -e 's,/[^/]\+$,,')
++ changequote([, ])
++ if test -n "$RPM_HRMIB_PATH"; then
++ AC_DEFINE_UNQUOTED([RPM_HRMIB_PATH], ["$RPM_HRMIB_PATH"], [Directory where RPM exports packages hrmib information])
++ fi
++ fi
fi
-
+# otherwise try binary linkin
+if test -z "$RPM_HRMIB_PATH"; then
-+ AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
++ AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
+
-+ AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
-+ AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
++ AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
++ AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
+
-+ if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
-+ if test "x$with_rpm" = "xyes" ; then
-+ AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
-+ else
-+ with_rpm=no
-+ fi
-+ fi
- #
++ if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
++ if test "x$with_rpm" = "xyes" ; then
++ AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
++ else
++ with_rpm=no
++ fi
++ fi
+
+-#
# rpm libraries only needed for the host resources mib software
# installed tables (on linux in particular)
#
- if test "x$with_rpm" != "xno" && \
- echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
-+
- # ARG. RPM is a real pain.
- # FWIW librpm.la, librpmio.la, and libpopt.la have correct dependencies.
- _rpmlibs=""
-@@ -2835,7 +2851,14 @@
- CFLAGS="$CFLAGS -I/usr/include/rpm"
- ],,-lrpm $_rpmlibs)
- ])
+@@ -490,6 +504,12 @@
+ AC_DEFINE([_RPM_4_4_COMPAT], [], [Define if you have RPM 4.6 or newer to turn on legacy API]),
+ [[#include <rpm/rpmlib.h>]]
+ )
+
+ OLDLIBS=$LIBS
+ LIBS=$LMIBLIBS
-+ AC_CHECK_FUNCS(rpmGetPath)
++ AC_CHECK_FUNCS([rpmGetPath])
+ LIBS=$OLDLIBS
++ fi
fi
-+
-+fi # with rpmlib
-
- # libkvm
- AC_CHECK_LIB(kvm, kvm_read, [_libkvm="-lkvm"])
-@@ -3406,12 +3429,6 @@
- # table_array helper support
- AC_CHECK_HEADERS(search.h)
--# RPM subdirectory path (sigh)
--if test "x$with_rpm" != "xno" && \
-- echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
-- AC_CHECK_HEADERS(rpm/rpmdb.h)
+ ##
+--- net-snmp-5.5/configure.d/config_os_functions~ 2009-07-26 20:20:55.000000000 +0200
++++ net-snmp-5.5/configure.d/config_os_functions 2010-05-12 14:35:39.421276242 +0200
+@@ -114,15 +114,6 @@
+ # (Agent)
+ ##
+
+-# rpmGetPath check needs clean LIBS environment (Linux)
+-#
+-if test "x$with_rpm" != "xno"; then
+- OLDLIBS=$LIBS
+- LIBS=$LMIBLIBS
+- AC_CHECK_FUNCS(rpmGetPath)
+- LIBS=$OLDLIBS
-fi
-
- # OpenBSD 2.6 needs netinet/in.h before netinet/in_pcb.h
- AC_MSG_CHECKING([[for netinet/in_pcb.h]])
- AC_CACHE_VAL(cv_have_netinet_in_pcb_h,
-@@ -3633,13 +3650,6 @@
- AC_CHECK_FUNCS(random lrand48 rand)
- AC_CHECK_FUNCS(execv system fork getpid strncasecmp sigalrm)
- AC_CHECK_FUNCS(lseek64 pread64)
--if test "x$with_rpm" != "xno" && \
-- echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
-- OLDLIBS=$LIBS
-- LIBS=$LMIBLIBS
-- AC_CHECK_FUNCS(rpmGetPath)
-- LIBS=$OLDLIBS
--fi
+ # statfs( char *, struct fs_data* ) (Ultrix)
+ #
+ AC_MSG_CHECKING([[for two-argument statfs with struct fs_data (Ultrix)]])
+--- net-snmp-5.6/agent/mibgroup/host/data_access/swinst_pkginfo.c~ 2010-01-26 23:24:14.000000000 +0200
++++ net-snmp-5.6/agent/mibgroup/host/data_access/swinst_pkginfo.c 2010-12-16 00:13:22.027247692 +0200
+@@ -52,6 +52,8 @@
+ {
+ #if defined(PKGLOC)
+ snprintf( pkg_directory, SNMP_MAXPATH, "%s", PKGLOC );
++#elif defined(RPM_HRMIB_PATH)
++ snprintf( pkg_directory, SNMP_MAXPATH, "%s", RPM_HRMIB_PATH);
+ #elif defined(hpux9)
+ snprintf( pkg_directory, SNMP_MAXPATH, "/system" );
+ #elif defined(hpux10) || defined(hpux11)
+--- net-snmp-5.6/agent/mibgroup/host/data_access/swinst.h 2010-12-16 00:14:13.634392176 +0200
++++ net-snmp-5.6/agent/mibgroup/host/data_access/swinst.h 2010-12-16 01:27:48.195543278 +0200
+@@ -11,6 +11,10 @@
+ #ifndef NETSNMP_ACCESS_SWINST_CONFIG_H
+ #define NETSNMP_ACCESS_SWINST_CONFIG_H
- AC_CHECK_FUNCS(getloadavg)
- AC_CHECK_FUNCS(getaddrinfo getipnodebyname gai_strerror)
++// quick fix: this file is consulted before RPM_HRMIB_PATH check is made in configure, hardcode a define for now
++#define RPM_HRMIB_PATH "/var/cache/hrmib"
++
++
+ /*
+ * all platforms use this generic code
+ */
+@@ -29,7 +29,7 @@
+ config_require(host/data_access/swinst_apt)
+ #elif defined( HAVE_LIBRPM ) && defined( linux )
+ config_require(host/data_access/swinst_rpm)
+-#elif defined( HAVE_PKGLOCS_H ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd )
++#elif defined( HAVE_PKGLOCS_H ) || defined( RPM_HRMIB_PATH ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd )
+ config_require(host/data_access/swinst_pkginfo)
+ #else
+ config_warning(This platform does not yet support hrSWInstalledTable rewrites)