]> git.pld-linux.org Git - packages/mbrowse.git/blame - mbrowse-ac_fixes.patch
- rebuild
[packages/mbrowse.git] / mbrowse-ac_fixes.patch
CommitLineData
d750f4ce 1--- /dev/null Tue May 5 22:32:27 1998
2+++ mbrowse-0.3.0/acinclude.m4 Sun Jan 19 10:47:16 2003
3@@ -0,0 +1,303 @@
4+# Configure paths for net-snmp or ucd-snmp.
5+# This is really messy, but should thouroughly
6+# check everything, and be pretty foolproof.
7+# Some of the tests seem redundant, but it seemed
8+# the sanest way to make it fairly robust.
9+#
10+# $Revision$
11+#
12+# Last Modified:
13+# $Author$
14+# $Date$
15+#
16+# Various pieces were snagged from other m4 files.
0cb84086 17+#
0cb84086 18+
d750f4ce 19+dnl AM_PATH_NETSNMP([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
0cb84086 20+
d750f4ce 21+dnl Test for net-snmp and define NETSNMP_CFLAGS and NETSNMP_LIBS
0cb84086 22+
d750f4ce 23+AC_DEFUN(AM_PATH_NETSNMP,[
24+ AC_ARG_WITH(snmp-type,
25+ [ --with-snmp-type=TYPE Which snmp version to use (net or ucd)],
26+ snmp_type="$withval",snmp_type="")
27+ AC_ARG_WITH(snmp-prefix,
28+ [ --with-snmp-prefix=PFX Prefix where net/ucd snmp is installed (optional)],
29+ snmp_prefix="$withval",snmp_prefix="")
30+ AC_ARG_WITH(snmp-include,
31+ [ --with-snmp-include=DIR Directory pointing to snmp include files (optional)],
32+ snmp_include="$withval",snmp_include="")
33+ AC_ARG_WITH(snmp-lib,
34+ [ --with-snmp-lib=LIB Directory containing the snmp library to use (optional)
35+ (Notes: -lib ignored for net-snmp, -lib and -include
36+ override -prefix)],
37+ snmp_lib="$withval",snmp_lib="")
0cb84086 38+
d750f4ce 39+ guess_type=""
40+ SNMP_CFLAGS=""
41+ SNMP_LIBS=""
0cb84086 42+
d750f4ce 43+ dnl
44+ dnl Check the user-provided include and libs first
45+ dnl
0cb84086 46+
d750f4ce 47+ if test "x$snmp_include" != "x" ; then
48+ for trytype in ucd net ${snmp_type} ; do
49+ if test -d "$snmp_include/$trytype-snmp" ; then
50+ SNMP_CFLAGS="-I$snmp_include"
51+ guess_type="$trytype"
52+ found_snmp_incl="1"
0cb84086 53+ fi
d750f4ce 54+ done
0cb84086 55+ fi
56+
d750f4ce 57+ if test "x$snmp_lib" != "x" ; then
58+ for trytype in libsnmp.sl libsnmp.so libsnmp.a libnetsnmp.sl libnetsnmp.so libnetsnmp.a ; do
59+ if test -r "$snmp_lib/$trytype" ; then
60+ SNMP_LIBS="-L$snmp_lib -lsnmp"
61+ found_snmp_lib="1"
0cb84086 62+ fi
d750f4ce 63+ done
64+ fi
65+
66+ dnl
67+ dnl Check for --with-snmp-type and -prefix at the same time
68+ dnl
69+
70+ AC_MSG_CHECKING([for snmp-type])
71+
72+ for tryprefix in /usr /usr/local /usr/pkg $snmp_prefix ; do
73+
74+ if test "x$found_snmp_incl" = "x" ; then
75+ for trytype in ucd net ${snmp_type} ; do
76+ if test -d "$tryprefix/include/$trytype-snmp" ; then
77+ SNMP_CFLAGS="-I$tryprefix/include"
78+ guess_type="$trytype"
79+ backup_prefix="$tryprefix"
80+ fi
81+ done
82+ fi
83+
84+ if test "x$found_snmp_lib" = "x" ; then
85+ for trytype in libsnmp.sl libsnmp.so libsnmp.a libnetsnmp.sl libnetsnmp.so libnetsnmp.a ; do
86+ if test -r "$tryprefix/lib/$trytype" ; then
87+ SNMP_LIBS="-L$tryprefix/lib -lsnmp"
88+ fi
89+ done
90+ fi
91+
92+ done
93+
94+ if test "x$SNMP_LIBS" = "x" ; then
95+ if test "x$SNMP_CFLAGS" = "x" ; then
96+ echo
97+ echo "***"
98+ echo "*** Could not locate any version of ucd-snmp or net-snmp"
99+ echo "***"
100+ echo "*** Either it is not installed, or installed in a bizarre location."
101+ echo "***"
102+ echo "*** Try using one of the following switches:"
103+ echo "*** --with-snmp-prefix=PFX"
104+ echo "*** --with-snmp-include=DIR"
105+ echo "*** --with-snmp-lib=DIR"
106+ echo "***"
107+ ifelse([$3], ,:,[$3])
108+ else
109+ echo
110+ echo "***"
111+ echo "*** Found snmp headers, but could not locate the libraries."
112+ echo "***"
113+ echo "*** Try using the following switch:"
114+ echo "*** --with-snmp-prefix=PFX"
115+ echo "*** --with-snmp-lib=DIR"
116+ echo "***"
117+ ifelse([$3], ,:,[$3])
118+ fi
119+ elif test "x$SNMP_CFLAGS" = "x" ; then
120+ echo
121+ echo "***"
122+ echo "*** Found snmp libraries, but could not locate headers."
123+ ehco "***"
124+ echo "*** If this was installed from a package, the -devel package"
125+ echo "*** was proabably not installed."
126+ echo "***"
127+ echo "*** Otherwise, try one of the following switches:"
128+ echo "*** --with-snmp-prefix=PFX"
129+ echo "*** --with-snmp-include=DIR"
130+ echo "***"
131+ ifelse([$3], ,:,[$3])
0cb84086 132+ fi
133+
d750f4ce 134+ if test "x$guess_type" = "xnet" ; then
135+ if test "x$snmp_prefix" != "x" ; then
136+ if test -x "$snmp_prefix/bin/net-snmp-config" ; then
137+ SNMP_LIBS=`$snmp_prefix/bin/net-snmp-config --libs`
138+ SNMP_CFLAGS="$SNMP_CFLAGS -DHAVE_NETSNMP"
139+ else
140+ guess_type="ucd"
0cb84086 141+ fi
d750f4ce 142+ else
143+ if test -x "$backup_prefix/bin/net-snmp-config" ; then
144+ SNMP_LIBS=`$backup_prefix/bin/net-snmp-config --libs`
145+ SNMP_CFLAGS="$SNMP_CFLAGS -DHAVE_NETSNMP"
146+ else
147+ guess_type="ucd"
148+ fi
149+ fi
0cb84086 150+ fi
151+
d750f4ce 152+ AC_MSG_RESULT($guess_type)
153+
154+ if test "x$guess_type" = "xucd" ; then
155+ AC_CHECK_LIB(socket,getservbyname)
156+ AC_CHECK_FUNC(gethostbyname, [], AC_CHECK_LIB(nsl, gethostbyname))
157+ AC_CHECK_LIB(crypto,EVP_md5)
158+ AC_CHECK_LIB(kstat,kstat_lookup)
159+ elif test "x$guess_type" != "xnet" ; then
160+ echo
161+ echo "***"
162+ echo "*** I have no clue what to do with this version of SNMP."
163+ echo "*** Net-snmp or ucd-snmp must be installed."
164+ echo "***"
165+ fi
166+
0cb84086 167+ ac_save_CFLAGS="$CFLAGS"
0cb84086 168+ ac_save_LIBS="$LIBS"
d750f4ce 169+
170+ CFLAGS="$CFLAGS $SNMP_CFLAGS"
171+ LIBS="$SNMP_LIBS $LIBS"
172+
173+ AC_MSG_CHECKING([for $guess_type-snmp ifelse([$1], , ,[>= v$1])])
0cb84086 174+ dnl if no minimum version is given, just try to compile
175+ dnl else try to compile AND run
d750f4ce 176+
0cb84086 177+ if test "x$1" = "x" ; then
d750f4ce 178+ AC_TRY_COMPILE([
179+ #include <stdarg.h>
180+ #include <stdio.h>
181+ #include <string.h>
182+ #include <sys/types.h>
183+ #ifdef HAVE_NETSNMP
184+ # include <net-snmp/net-snmp-config.h>
185+ # include <net-snmp/net-snmp-includes.h>
186+ #else
187+ # include <ucd-snmp/asn1.h>
188+ # include <ucd-snmp/snmp_api.h>
189+ # include <ucd-snmp/mib.h>
190+ # include <ucd-snmp/snmp.h>
191+ #endif
192+ ],[
193+ struct snmp_session s;
194+ bzero( &s, sizeof( struct snmp_session));
195+ snmp_open(&s);
196+ ],[AC_MSG_RESULT(yes)
197+ CFLAGS="$ac_save_CFLAGS"
198+ LIBS="$ac_save_LIBS"
199+ ifelse([$2], ,:,[$2])
200+ ],[
201+ $snmp_fail="yes"
202+ ])
0cb84086 203+ else
d750f4ce 204+ snmp_min_version=$1
205+ AC_TRY_RUN([
206+ #include <stdarg.h>
207+ #include <stdio.h>
208+ #include <string.h>
0cb84086 209+
d750f4ce 210+ #include <sys/types.h>
211+ #ifdef HAVE_NETSNMP
212+ # include <net-snmp/net-snmp-config.h>
213+ # include <net-snmp/net-snmp-includes.h>
214+ # include <net-snmp/version.h>
215+ #else
216+ # include <ucd-snmp/asn1.h>
217+ # include <ucd-snmp/snmp_api.h>
218+ # include <ucd-snmp/mib.h>
219+ # include <ucd-snmp/snmp.h>
220+ # include <ucd-snmp/version.h>
221+ #endif
0cb84086 222+
d750f4ce 223+ int main() {
224+ int major, minor,micro;
225+ int snmp_major, snmp_minor, snmp_micro;
226+ char *version1, *version2;
227+ struct snmp_session s;
0cb84086 228+
d750f4ce 229+ bzero(&s, sizeof( struct snmp_session));
230+ snmp_open(&s);
0cb84086 231+
d750f4ce 232+ version1 = strdup( "$snmp_min_version" );
233+ if( sscanf( version1, "%d.%d.%d", &major, &minor, &micro) != 2) {
234+ printf( "%s, bad supplied version string\n", "$netsnmp_min_version");
235+ exit(1);
236+ }
0cb84086 237+
d750f4ce 238+ #ifdef HAVE_NETSNMP
239+ version2 = strdup( NetSnmpVersionInfo );
240+ #else
241+ version2 = strdup( VersionInfo);
242+ #endif
243+ if( sscanf( version2, "%d.%d.%d", &snmp_major, &snmp_minor, &snmp_micro) != 3) {
244+ /* Some people tripped on this with 4.2... check for it */
245+ if ( sscanf( version2, "%d.%d", &snmp_major, &snmp_minor) != 2) {
246+ printf( "%s, bad net-snmp version string\n", version2);
247+ exit(1);
248+ }
249+ snmp_micro=0;
250+ }
0cb84086 251+
d750f4ce 252+ if((snmp_major > major) ||
253+ ((snmp_major == major) && (snmp_minor > minor)) ||
254+ ((snmp_major == major) && (snmp_minor == minor)) ||
255+ ((snmp_major == major) && (snmp_minor == minor) && (snmp_micro >= micro))) {
0cb84086 256+
d750f4ce 257+ if ((snmp_major == 4) && (snmp_minor <= 2) && (snmp_micro <=1)) {
258+ printf("\n***\n*** You are running ucd-snmp < 4.2.2. It\n"
259+ "*** is strongly suggested that you upgrade\n"
260+ "*** for security reasons. See CERT Advisory\n"
261+ "**** CA-2002-03 for more details.\n***\n");
262+ }
263+ return 0;
264+ } else {
265+ printf("\n***\n*** An old version of net-snmp (%d.%d) was found.\n",
266+ snmp_major, snmp_minor);
267+ printf("*** You need a version of net-snmp newer than %d.%d. The latest version of\n",
268+ major, minor);
269+ printf("*** net-snmp is available from ftp://net-snmp.sourceforge.net/ .\n***\n");
270+ }
271+ return 1;
272+ }
273+ ],[AC_MSG_RESULT(yes)
274+ CFLAGS="$ac_save_CFLAGS"
275+ LIBS="$ac_save_LIBS"
276+ ifelse([$2], ,:,[$2])
277+ ],[
278+ snmp_fail="yes"
279+ ])
280+ fi
0cb84086 281+
d750f4ce 282+ if test "x$snmp_fail" != "x" ; then
283+ echo
284+ echo "***"
285+ echo "*** Snmp test source had problems, check your config.log."
286+ echo "*** Chances are, it couldn't find the headers or libraries."
287+ echo "***"
288+ echo "*** Also try one of the following switches :"
289+ echo "*** --with-snmp-prefix=PFX"
290+ echo "*** --with-snmp-include=DIR"
291+ echo "*** --with-snmp-lib=DIR"
292+ echo "***"
0cb84086 293+ CFLAGS="$ac_save_CFLAGS"
294+ LDFLAGS="$ac_save_LDFLAGS"
295+ LIBS="$ac_save_LIBS"
d750f4ce 296+ ifelse([$3], ,:,[$3])
297+ fi
298+
299+ CFLAGS="$ac_save_CFLAGS"
300+ LDFLAGS="$ac_save_LDFLAGS"
301+ LIBS="$ac_save_LIBS"
302+
303+ AC_SUBST(SNMP_CFLAGS)
304+ AC_SUBST(SNMP_LIBS)
0cb84086 305+])
306+
This page took 0.077327 seconds and 4 git commands to generate.