--- net-snmp-5.4.1/agent/mibgroup/host/hr_swinst.c 2008-05-15 13:05:07.575307614 +0300 +++ net-snmp-5.4.1.hrmib/agent/mibgroup/host/hr_swinst.c 2008-05-15 13:04:24.676830108 +0300 @@ -183,6 +183,10 @@ #define _PATH_HRSW_directory "/var/db/pkg" #endif +#if defined(RPM_HRMIB_PATH) +#define _PATH_HRSW_directory RPM_HRMIB_PATH +#endif + void init_hr_swinst(void) { --- net-snmp-5.5/configure.d/config_os_libs~ 2010-05-12 14:31:17.751301337 +0200 +++ net-snmp-5.5/configure.d/config_os_libs 2010-05-12 14:34:11.694627717 +0200 @@ -261,20 +261,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) - -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 - # +# 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 +fi +# otherwise try binary linkin +if test -z "$RPM_HRMIB_PATH"; then + 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) + + 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) # @@ -319,7 +333,14 @@ LMIBLIBS="$_rpmlibs $LMIBLIBS" CFLAGS="$CFLAGS -I/usr/include/rpm" ],, $LMIBLIBS, _rpmlibs) -fi + OLDLIBS=$LIBS + LIBS=$LMIBLIBS + AC_CHECK_FUNCS(rpmGetPath) + LIBS=$OLDLIBS + + fi + +fi # with rpmlib ## # mysql --- 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 @@ -67,15 +67,6 @@ # (Agent) ## -# rpmGetPath check needs clean LIBS environment (Linux) -# -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) #