kopia lustrzana https://gitlab.com/sane-project/backends
configure: Use PKG_CHECK_MODULES to detect Net-SNMP
The output of "net-snmp-config --cflags" can contain optimization flags. These might not be applicable to the current compiler, causing warnings. Use PKG_CHECK_MODULES to check for Net-SNMP and obtain the compiler and linker flags instead, in the same way as for libcurl or poppler-glib.merge-requests/729/head
rodzic
4b15f35e75
commit
9e1819c3f7
57
configure.ac
57
configure.ac
|
@ -152,48 +152,27 @@ AC_CHECK_LIB(sane, sane_init, LIBSANE_EXISTS="yes")
|
|||
|
||||
|
||||
dnl **************************************************************
|
||||
dnl SNMP CHECKS
|
||||
dnl Check for libsnmp availability
|
||||
dnl **************************************************************
|
||||
|
||||
AC_ARG_WITH(snmp,
|
||||
AS_HELP_STRING([--with-snmp], [enable SNMP support @<:@default=yes@:>@]))
|
||||
|
||||
if test "$with_snmp" = "no"; then
|
||||
echo "Not including SNMP support"
|
||||
else
|
||||
AC_PATH_PROG(SNMP_CONFIG_PATH, net-snmp-config, "no")
|
||||
AC_CHECK_LIB([netsnmp], [snmp_timeout], LIBSNMP_EXISTS="yes")
|
||||
AC_MSG_CHECKING(for proper SNMP version)
|
||||
if test "$SNMP_CONFIG_PATH" != "no" ; then
|
||||
snmp_version=`$SNMP_CONFIG_PATH --version 2>/dev/null`
|
||||
vers=`echo $snmp_version | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2);}'`
|
||||
if test -n "$vers" && test "$vers" -ge 5006; then
|
||||
SNMP_LIBS=`$SNMP_CONFIG_PATH --libs`
|
||||
SNMP_CFLAGS=`$SNMP_CONFIG_PATH --cflags`
|
||||
AC_MSG_RESULT(yes)
|
||||
with_snmp="yes"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN([You need at least net-snmp 5.6, your version is $snmp_version])
|
||||
with_snmp="no"
|
||||
fi
|
||||
else
|
||||
with_snmp="no"
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$with_snmp" = "yes" && test "${LIBSNMP_EXISTS}x" = "yesx"; then
|
||||
AC_SUBST(SNMP_LIBS)
|
||||
AC_SUBST(SNMP_CFLAGS)
|
||||
AC_DEFINE(HAVE_LIBSNMP, 1, [Define to 1 if you have the net-snmp library.])
|
||||
else
|
||||
AC_MSG_WARN([net-snmp library disabled, autodetecting network scanners will not be supported.])
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
AS_HELP_STRING([--with-snmp],
|
||||
[enable SNMP support @<:@default=check@:>@]),
|
||||
[],
|
||||
[with_snmp=check])
|
||||
AC_DEFINE(HAVE_LIBSNMP,
|
||||
[0], [Define to 1 if libsnmp is available])
|
||||
AS_IF([test xno != "x$with_snmp"],
|
||||
[PKG_CHECK_MODULES(SNMP, [netsnmp >= 5.6],
|
||||
[AC_DEFINE([HAVE_LIBSNMP], [1])
|
||||
with_snmp=yes
|
||||
],
|
||||
[AS_IF([test xcheck != "x$with_snmp"],
|
||||
[AC_MSG_ERROR([libsnmp requested but not found])])
|
||||
with_snmp=no
|
||||
])
|
||||
])
|
||||
AM_CONDITIONAL([have_snmp], [test x != "x$SNMP_LIBS"])
|
||||
|
||||
dnl ***********************************************************************
|
||||
dnl Checks for header files.
|
||||
|
|
Ładowanie…
Reference in New Issue