HAVE_LIBSNMP redefinition
While trying to diagnose a weird result with sane-backends-1.2.1 on my OS X box (conclusion: my own fault, broken external dependency), I was browsing config.log and saw a ton of:
configure:22801: gcc -c -g -O2 -include sys/types.h -I/sw/lib/libjpeg8.2-turbo/include -I/sw/include conftest.c >&5
conftest.c:54:9: warning: 'HAVE_LIBSNMP' macro redefined [-Wmacro-redefined]
#define HAVE_LIBSNMP 1
^
conftest.c:53:9: note: previous definition is here
#define HAVE_LIBSNMP 0
^
1 warning generated.
This is due to a bug in configure.ac, starting around line 166:
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"])
Each AC_DEFINE
becomes a permanent part of the header used for all future autoconf tests, rather than a dynamic value that can be replaced. A solution is to have a single AC_DEFINE
for it after the whole AS_IF
block, whose value is set based on SNMP_LIBS
(analogous to have_snmp
)