build: use net-snmp-config to configure NetSNMP

The correct method to link to NetSNMP is to use net-snmp-config (which
is like pkg-config). Explicit link to libcrypto is also dropped
(NetSNMP libs are linked to libcrypto, no need to link Quagga to
it). Moreover, @SNMP_INCLUDES@ is dropped because useless. Due to a
bug in configure.ac, it was properly populated.
This commit is contained in:
Vincent Bernat 2012-05-22 22:29:17 +02:00
parent 6b1e37f853
commit 08d7f6533e
10 changed files with 28 additions and 25 deletions

View file

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib @SNMP_INCLUDES@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600 INSTALL_SDATA=@INSTALL@ -m 600

View file

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib @SNMP_INCLUDES@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600 INSTALL_SDATA=@INSTALL@ -m 600

View file

@ -221,8 +221,6 @@ AC_ARG_ENABLE(netlink,
[ --enable-netlink force to use Linux netlink interface]) [ --enable-netlink force to use Linux netlink interface])
AC_ARG_ENABLE(broken-aliases, AC_ARG_ENABLE(broken-aliases,
[ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X]) [ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
AC_ARG_WITH(crypto,
[ --without-crypto do not use libcrypto in SNMP])
AC_ARG_ENABLE(snmp, AC_ARG_ENABLE(snmp,
[ --enable-snmp enable SNMP support]) [ --enable-snmp enable SNMP support])
AC_ARG_WITH(libpam, AC_ARG_WITH(libpam,
@ -1366,19 +1364,24 @@ dnl ------------------
dnl check Net-SNMP library dnl check Net-SNMP library
dnl ------------------ dnl ------------------
if test "${enable_snmp}" = "yes"; then if test "${enable_snmp}" = "yes"; then
if test "$with_crypto" != "no"; then AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
LIBS="${LIBS} -lcrypto"; if test x"$NETSNMP_CONFIG" = x"no"; then
fi AC_MSG_ERROR([--enable-snmp given but unable to find net-snmp-config])
AC_CHECK_LIB(netsnmp, asn_parse_int, fi
[AC_DEFINE(HAVE_SNMP,,SNMP) LIBS="$LIBS `${NETSNMP_CONFIG} --agent-libs`"
LIBS="${LIBS} -lnetsnmp"], CFLAGS="`${NETSNMP_CONFIG} --base-cflags` $CFLAGS"
[AC_MSG_ERROR([--enable-snmp given, but cannot find support for SNMP])]) AC_MSG_CHECKING([whether we can link to Net-SNMP])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
AC_CHECK_HEADER([net-snmp/net-snmp-config.h], int main(void);
[], ],
[AC_MSG_ERROR([--enable-snmp given, but cannot find net-snmp-config.h])], [
QUAGGA_INCLUDES) {
AC_SUBST(SNMP_INCLUDES) return 0;
}
])],[AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
AC_MSG_ERROR([--enable-snmp given but not usable])])
AC_DEFINE(HAVE_SNMP,,SNMP)
fi fi
dnl --------------------------- dnl ---------------------------
@ -1624,7 +1627,7 @@ source code location : ${srcdir}
compiler : ${CC} compiler : ${CC}
compiler flags : ${CFLAGS} compiler flags : ${CFLAGS}
make : ${MAKE-make} make : ${MAKE-make}
includes : ${INCLUDES} ${SNMP_INCLUDES} includes : ${INCLUDES}
linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM} linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
state file directory : ${quagga_statedir} state file directory : ${quagga_statedir}
config file directory : `eval echo \`echo ${sysconfdir}\`` config file directory : `eval echo \`echo ${sysconfdir}\``

View file

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib @SNMP_INCLUDES@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
lib_LTLIBRARIES = libzebra.la lib_LTLIBRARIES = libzebra.la

View file

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib @SNMP_INCLUDES@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600 INSTALL_SDATA=@INSTALL@ -m 600

View file

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib @SNMP_INCLUDES@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ $(LOCAL_OPTS) -DSYSCONFDIR=\"$(sysconfdir)/\" DEFS = @DEFS@ $(LOCAL_OPTS) -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600 INSTALL_SDATA=@INSTALL@ -m 600

View file

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib @SNMP_INCLUDES@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600 INSTALL_SDATA=@INSTALL@ -m 600

View file

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib @SNMP_INCLUDES@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600 INSTALL_SDATA=@INSTALL@ -m 600

View file

@ -63,7 +63,7 @@ $ignore{'"show history"'} = "ignore";
foreach (@ARGV) { foreach (@ARGV) {
$file = $_; $file = $_;
open (FH, "cpp -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_builddir@/lib -I@top_srcdir@/isisd/topology @SNMP_INCLUDES@ @CPPFLAGS@ $file |"); open (FH, "cpp -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_builddir@/lib -I@top_srcdir@/isisd/topology @CPPFLAGS@ $file |");
local $/; undef $/; local $/; undef $/;
$line = <FH>; $line = <FH>;
close (FH); close (FH);

View file

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib @SNMP_INCLUDES@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DMULTIPATH_NUM=@MULTIPATH_NUM@ DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DMULTIPATH_NUM=@MULTIPATH_NUM@
INSTALL_SDATA=@INSTALL@ -m 600 INSTALL_SDATA=@INSTALL@ -m 600