diff options
-rw-r--r-- | config.h.in | 12 | ||||
-rwxr-xr-x | configure | 74 | ||||
-rw-r--r-- | configure.in | 70 | ||||
-rw-r--r-- | print-snmp.c | 10 | ||||
-rw-r--r-- | tcpdump.c | 8 |
5 files changed, 95 insertions, 79 deletions
diff --git a/config.h.in b/config.h.in index 2138832f..0342e610 100644 --- a/config.h.in +++ b/config.h.in @@ -61,9 +61,6 @@ /* Define to 1 if you have the `rpc' library (-lrpc). */ #undef HAVE_LIBRPC -/* Define to 1 if you have the `smi' library (-lsmi). */ -#undef HAVE_LIBSMI - /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H @@ -169,9 +166,6 @@ /* Define to 1 if you have the `sigset' function. */ #undef HAVE_SIGSET -/* Define to 1 if you have the <smi.h> header file. */ -#undef HAVE_SMI_H - /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF @@ -241,9 +235,6 @@ /* if unaligned access fails */ #undef LBL_ALIGN -/* Define if you enable support for libsmi */ -#undef LIBSMI - /* define if you need to include missing/addrinfo.h */ #undef NEED_ADDRINFO_H @@ -301,6 +292,9 @@ /* define if you have ether_ntohost() and it works */ #undef USE_ETHER_NTOHOST +/* Define if you enable support for libsmi */ +#undef USE_LIBSMI + /* define if should chroot when dropping privileges */ #undef WITH_CHROOT @@ -4335,19 +4335,13 @@ fi if test "x$with_smi" != "xno" ; then -for ac_header in smi.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "smi.h" "ac_cv_header_smi_h" "$ac_includes_default" + ac_fn_c_check_header_mongrel "$LINENO" "smi.h" "ac_cv_header_smi_h" "$ac_includes_default" if test "x$ac_cv_header_smi_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SMI_H 1 -_ACEOF - -fi - -done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for smiInit in -lsmi" >&5 + # + # OK, we found smi.h. Do we have libsmi with smiInit? + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for smiInit in -lsmi" >&5 $as_echo_n "checking for smiInit in -lsmi... " >&6; } if ${ac_cv_lib_smi_smiInit+:} false; then : $as_echo_n "(cached) " >&6 @@ -4384,27 +4378,26 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_smi_smiInit" >&5 $as_echo "$ac_cv_lib_smi_smiInit" >&6; } if test "x$ac_cv_lib_smi_smiInit" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBSMI 1 -_ACEOF - - LIBS="-lsmi $LIBS" -fi - -if test "$ac_cv_header_smi_h" = yes -a "$ac_cv_lib_smi_smiInit" = yes -then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable libsmi" >&5 + # + # OK, we have libsmi with smiInit. Can we use it? + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable libsmi" >&5 $as_echo_n "checking whether to enable libsmi... " >&6; } - if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not when cross-compiling" >&5 + savedlibs="$LIBS" + LIBS="-lsmi $LIBS" + if test "$cross_compiling" = yes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not when cross-compiling" >&5 $as_echo "not when cross-compiling" >&6; } - libsmi=no + LIBS="$savedlibs" + else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - /* libsmi available check */ + +/* libsmi available check */ #include <smi.h> main() { @@ -4424,32 +4417,41 @@ main() _ACEOF if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } -$as_echo "#define LIBSMI 1" >>confdefs.h +$as_echo "#define USE_LIBSMI 1" >>confdefs.h + - libsmi=yes else - case $? in - 1) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - smiInit failed" >&5 + + case $? in + 1) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - smiInit failed" >&5 $as_echo "no - smiInit failed" >&6; } ;; - 2) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - header/library version mismatch" >&5 + 2) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - header/library version mismatch" >&5 $as_echo "no - header/library version mismatch" >&6; } ;; - 3) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - can't determine library version" >&5 + 3) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - can't determine library version" >&5 $as_echo "no - can't determine library version" >&6; } ;; - 4) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - too old" >&5 + 4) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - too old" >&5 $as_echo "no - too old" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; - esac - libsmi=no + esac + LIBS="$savedlibs" + fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi + + +fi + + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable the possibly-buggy SMB printer" >&5 diff --git a/configure.in b/configure.in index a63087d7..5d0f771b 100644 --- a/configure.in +++ b/configure.in @@ -98,12 +98,22 @@ AC_ARG_WITH(smi, with_smi=yes) if test "x$with_smi" != "xno" ; then -AC_CHECK_HEADERS(smi.h) -AC_CHECK_LIB(smi, smiInit) -if test "$ac_cv_header_smi_h" = yes -a "$ac_cv_lib_smi_smiInit" = yes -then -AC_MSG_CHECKING([whether to enable libsmi]) - AC_TRY_RUN([ /* libsmi available check */ + AC_CHECK_HEADER(smi.h, + [ + # + # OK, we found smi.h. Do we have libsmi with smiInit? + # + AC_CHECK_LIB(smi, smiInit, + [ + # + # OK, we have libsmi with smiInit. Can we use it? + # + AC_MSG_CHECKING([whether to enable libsmi]) + savedlibs="$LIBS" + LIBS="-lsmi $LIBS" + AC_TRY_RUN( + [ +/* libsmi available check */ #include <smi.h> main() { @@ -120,25 +130,35 @@ main() exit(4); exit(0); } -], -[ AC_MSG_RESULT(yes) - AC_DEFINE(LIBSMI, 1, [Define if you enable support for libsmi]) - libsmi=yes], -dnl autoconf documentation says that $? contains the exit value. -dnl reality is that it does not. We leave this in just in case -dnl autoconf ever comes back to match the documentation. -[ case $? in - 1) AC_MSG_RESULT(no - smiInit failed) ;; - 2) AC_MSG_RESULT(no - header/library version mismatch) ;; - 3) AC_MSG_RESULT(no - can't determine library version) ;; - 4) AC_MSG_RESULT(no - too old) ;; - *) AC_MSG_RESULT(no) ;; - esac - libsmi=no], -[ AC_MSG_RESULT(not when cross-compiling) - libsmi=no] -) -fi + ], + [ + AC_MSG_RESULT(yes) + AC_DEFINE(USE_LIBSMI, 1, + [Define if you enable support for libsmi]) + ], + [ + dnl autoconf documentation says that + dnl $? contains the exit value. + dnl reality is that it does not. + dnl We leave this in just in case + dnl autoconf ever comes back to + dnl match the documentation. + case $? in + 1) AC_MSG_RESULT(no - smiInit failed) ;; + 2) AC_MSG_RESULT(no - header/library version mismatch) ;; + 3) AC_MSG_RESULT(no - can't determine library version) ;; + 4) AC_MSG_RESULT(no - too old) ;; + *) AC_MSG_RESULT(no) ;; + esac + LIBS="$savedlibs" + ], + [ + AC_MSG_RESULT(not when cross-compiling) + LIBS="$savedlibs" + ] + ) + ]) + ]) fi AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer]) diff --git a/print-snmp.c b/print-snmp.c index 53bc210a..f5501582 100644 --- a/print-snmp.c +++ b/print-snmp.c @@ -66,7 +66,7 @@ #include <stdio.h> #include <string.h> -#ifdef HAVE_SMI_H +#ifdef USE_LIBSMI #include <smi.h> #endif @@ -867,7 +867,7 @@ asn1_decode(u_char *p, u_int length) } #endif -#ifdef LIBSMI +#ifdef USE_LIBSMI struct smi2be { SmiBasetype basetype; @@ -1200,7 +1200,7 @@ varbind_print(netdissect_options *ndo, { struct be elem; int count = 0, ind; -#ifdef LIBSMI +#ifdef USE_LIBSMI SmiNode *smiNode = NULL; #endif int status; @@ -1247,7 +1247,7 @@ varbind_print(netdissect_options *ndo, asn1_print(ndo, &elem); return; } -#ifdef LIBSMI +#ifdef USE_LIBSMI smiNode = smi_print_variable(ndo, &elem, &status); #else status = asn1_print(ndo, &elem); @@ -1273,7 +1273,7 @@ varbind_print(netdissect_options *ndo, } } else { if (elem.type != BE_NULL) { -#ifdef LIBSMI +#ifdef USE_LIBSMI status = smi_print_value(ndo, smiNode, pduid, &elem); #else status = asn1_print(ndo, &elem); @@ -53,7 +53,7 @@ extern int SIZE_BUF; #define uint UINT #endif /* WIN32 */ -#ifdef HAVE_SMI_H +#ifdef USE_LIBSMI #include <smi.h> #endif @@ -954,7 +954,7 @@ main(int argc, char **argv) if (abort_on_misalignment(ebuf, sizeof(ebuf)) < 0) error("%s", ebuf); -#ifdef LIBSMI +#ifdef USE_LIBSMI smiInit("tcpdump"); #endif @@ -1135,7 +1135,7 @@ main(int argc, char **argv) break; case 'm': -#ifdef LIBSMI +#ifdef USE_LIBSMI if (smiLoadModule(optarg) == 0) { error("could not load MIB module %s", optarg); } @@ -2487,7 +2487,7 @@ print_version(void) (void)fprintf (stderr, "%s\n", SSLeay_version(SSLEAY_VERSION)); #endif -#if defined(HAVE_SMI_H) +#ifdef USE_LIBSMI (void)fprintf (stderr, "SMI-library: %s\n", smi_version_string); #endif } |