]>
Commit | Line | Data |
---|---|---|
1 | --- net-snmp-5.4.1/agent/mibgroup/host/hr_swinst.c 2008-05-15 13:05:07.575307614 +0300 | |
2 | +++ net-snmp-5.4.1.hrmib/agent/mibgroup/host/hr_swinst.c 2008-05-15 13:04:24.676830108 +0300 | |
3 | @@ -183,6 +183,10 @@ | |
4 | #define _PATH_HRSW_directory "/var/db/pkg" | |
5 | #endif | |
6 | ||
7 | +#if defined(RPM_HRMIB_PATH) | |
8 | +#define _PATH_HRSW_directory RPM_HRMIB_PATH | |
9 | +#endif | |
10 | + | |
11 | void | |
12 | init_hr_swinst(void) | |
13 | { | |
14 | --- net-snmp-5.4.1/configure.in 2008-05-15 13:05:07.559306690 +0300 | |
15 | +++ net-snmp-5.4.1.hrmib/configure.in 2008-05-15 13:04:24.684830570 +0300 | |
16 | @@ -2768,25 +2768,41 @@ | |
17 | fi | |
18 | ]) | |
19 | ||
20 | -AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h) | |
21 | ||
22 | -AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no) | |
23 | -AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no) | |
24 | - | |
25 | -if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then | |
26 | - if test "x$with_rpm" = "xyes" ; then | |
27 | - AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support]) | |
28 | - else | |
29 | - with_rpm=no | |
30 | - fi | |
31 | +# check if we can use rpm hrmib export | |
32 | +if test "$with_rpm" != "no" ; then | |
33 | + AC_PATH_PROG([RPM], rpm) | |
34 | + if test -n "$RPM"; then | |
35 | + changequote(, ) | |
36 | + RPM_HRMIB_PATH=$($RPM -E %{_hrmib_path} | sed -e 's,/[^/]\+$,,') | |
37 | + changequote([, ]) | |
38 | + if test -n "$RPM_HRMIB_PATH"; then | |
39 | + AC_DEFINE_UNQUOTED([RPM_HRMIB_PATH], ["$RPM_HRMIB_PATH"], [Directory where RPM exports packages hrmib information]) | |
40 | + fi | |
41 | + fi | |
42 | fi | |
43 | ||
44 | +# otherwise try binary linkin | |
45 | +if test -z "$RPM_HRMIB_PATH"; then | |
46 | + AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h) | |
47 | + | |
48 | + AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no) | |
49 | + AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no) | |
50 | + | |
51 | + if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then | |
52 | + if test "x$with_rpm" = "xyes" ; then | |
53 | + AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support]) | |
54 | + else | |
55 | + with_rpm=no | |
56 | + fi | |
57 | + fi | |
58 | # | |
59 | # rpm libraries only needed for the host resources mib software | |
60 | # installed tables (on linux in particular) | |
61 | # | |
62 | if test "x$with_rpm" != "xno" && \ | |
63 | echo " $module_list " | grep " host/hr_swinst " > /dev/null; then | |
64 | + | |
65 | # ARG. RPM is a real pain. | |
66 | # FWIW librpm.la, librpmio.la, and libpopt.la have correct dependencies. | |
67 | _rpmlibs="" | |
68 | @@ -2835,7 +2851,14 @@ | |
69 | CFLAGS="$CFLAGS -I/usr/include/rpm" | |
70 | ],,-lrpm $_rpmlibs) | |
71 | ]) | |
72 | + | |
73 | + OLDLIBS=$LIBS | |
74 | + LIBS=$LMIBLIBS | |
75 | + AC_CHECK_FUNCS(rpmGetPath) | |
76 | + LIBS=$OLDLIBS | |
77 | fi | |
78 | + | |
79 | +fi # with rpmlib | |
80 | ||
81 | # libkvm | |
82 | AC_CHECK_LIB(kvm, kvm_read, [_libkvm="-lkvm"]) | |
83 | @@ -3406,12 +3429,6 @@ | |
84 | # table_array helper support | |
85 | AC_CHECK_HEADERS(search.h) | |
86 | ||
87 | -# RPM subdirectory path (sigh) | |
88 | -if test "x$with_rpm" != "xno" && \ | |
89 | - echo " $module_list " | grep " host/hr_swinst " > /dev/null; then | |
90 | - AC_CHECK_HEADERS(rpm/rpmdb.h) | |
91 | -fi | |
92 | - | |
93 | # OpenBSD 2.6 needs netinet/in.h before netinet/in_pcb.h | |
94 | AC_MSG_CHECKING([[for netinet/in_pcb.h]]) | |
95 | AC_CACHE_VAL(cv_have_netinet_in_pcb_h, | |
96 | @@ -3633,13 +3650,6 @@ | |
97 | AC_CHECK_FUNCS(random lrand48 rand) | |
98 | AC_CHECK_FUNCS(execv system fork getpid strncasecmp sigalrm) | |
99 | AC_CHECK_FUNCS(lseek64 pread64) | |
100 | -if test "x$with_rpm" != "xno" && \ | |
101 | - echo " $module_list " | grep " host/hr_swinst " > /dev/null; then | |
102 | - OLDLIBS=$LIBS | |
103 | - LIBS=$LMIBLIBS | |
104 | - AC_CHECK_FUNCS(rpmGetPath) | |
105 | - LIBS=$OLDLIBS | |
106 | -fi | |
107 | ||
108 | AC_CHECK_FUNCS(getloadavg) | |
109 | AC_CHECK_FUNCS(getaddrinfo getipnodebyname gai_strerror) |