/* 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
/* 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
/* 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
/* 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
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
{ $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()
{
_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
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()
{
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])
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_SMI_H
+#ifdef USE_LIBSMI
#include <smi.h>
#endif
}
#endif
-#ifdef LIBSMI
+#ifdef USE_LIBSMI
struct smi2be {
SmiBasetype basetype;
{
struct be elem;
int count = 0, ind;
-#ifdef LIBSMI
+#ifdef USE_LIBSMI
SmiNode *smiNode = NULL;
#endif
int status;
asn1_print(ndo, &elem);
return;
}
-#ifdef LIBSMI
+#ifdef USE_LIBSMI
smiNode = smi_print_variable(ndo, &elem, &status);
#else
status = asn1_print(ndo, &elem);
}
} 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);
#define uint UINT
#endif /* WIN32 */
-#ifdef HAVE_SMI_H
+#ifdef USE_LIBSMI
#include <smi.h>
#endif
if (abort_on_misalignment(ebuf, sizeof(ebuf)) < 0)
error("%s", ebuf);
-#ifdef LIBSMI
+#ifdef USE_LIBSMI
smiInit("tcpdump");
#endif
break;
case 'm':
-#ifdef LIBSMI
+#ifdef USE_LIBSMI
if (smiLoadModule(optarg) == 0) {
error("could not load MIB module %s", optarg);
}
(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
}