[quagga-dev 5546] [PATCH 02/11] Make --enable-snmp cross compile and make libcrypto optional with --without-crypto

Joakim Tjernlund Joakim.Tjernlund at transmode.se
Wed Jul 2 14:51:30 BST 2008


Autoconfig work by me, the rest was done by
"Kirill K. Smirnov" <lich at math.spbu.ru>

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
---
 bgpd/bgp_snmp.c     |    4 +++-
 configure.ac        |   28 ++++++++++------------------
 lib/smux.c          |    4 +++-
 ospf6d/ospf6_snmp.c |    5 +++--
 ospfd/ospf_snmp.c   |    4 +++-
 ripd/rip_snmp.c     |    4 +++-
 zebra/zebra_snmp.c  |    4 +++-
 7 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 3d26890..576e3e0 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -23,10 +23,12 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #ifdef HAVE_SNMP
 #ifdef HAVE_NETSNMP
 #include <net-snmp/net-snmp-config.h>
-#endif
+#include <net-snmp/net-snmp-includes.h>
+#else
 #include <asn1.h>
 #include <snmp.h>
 #include <snmp_impl.h>
+#endif
 
 #include "if.h"
 #include "log.h"
diff --git a/configure.ac b/configure.ac
index 5744fe0..b92be42 100755
--- a/configure.ac
+++ b/configure.ac
@@ -205,6 +205,8 @@ AC_ARG_ENABLE(netlink,
 [  --enable-netlink        force to use Linux netlink interface])
 AC_ARG_ENABLE(broken-aliases,
 [  --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,
 [  --enable-snmp           enable SNMP support])
 AC_ARG_WITH(libpam,
@@ -1229,29 +1231,19 @@ dnl ------------------
 dnl check Net-SNMP library
 dnl ------------------
 if test "${enable_snmp}" = "yes"; then
-    LIBS="${LIBS} -lcrypto"
+    if test "$with_crypto" != "no"; then
+        LIBS="${LIBS} -lcrypto";
+    fi
     AC_CHECK_LIB(netsnmp, asn_parse_int,
     	[AC_DEFINE(HAVE_NETSNMP,,Net SNMP) 
     	 AC_DEFINE(HAVE_SNMP,,SNMP)
     	 LIBS="${LIBS} -lnetsnmp"],
     	[AC_MSG_ERROR([--enable-snmp given, but cannot find support for SNMP])])
-    
-    for ac_snmp in /usr/include \
-    		/usr/local/include \
-    		/dev/null; do
-    	test -f "${ac_snmp}/net-snmp/library/asn1.h" && break
-    done
-    
-    case ${ac_snmp} in
-    	/dev/null)
-    		AC_MSG_ERROR([--enable-snmp given, but can not find header])
-    		;;
-    	*)
-    		SNMP_INCLUDES="-I${ac_snmp}/net-snmp"
-    		SNMP_INCLUDES="${SNMP_INCLUDES} -I${ac_snmp}/net-snmp/library"
-    		;;
-    esac
-    
+
+    AC_CHECK_HEADER([net-snmp/net-snmp-config.h],
+        [],
+        [AC_MSG_ERROR([--enable-snmp given, but cannot find net-snmp-config.h])],
+	QUAGGA_INCLUDES)
     AC_SUBST(SNMP_INCLUDES)
 fi
 
diff --git a/lib/smux.c b/lib/smux.c
index 6285c94..4a3696c 100644
--- a/lib/smux.c
+++ b/lib/smux.c
@@ -24,10 +24,12 @@
 #ifdef HAVE_SNMP
 #ifdef HAVE_NETSNMP
 #include <net-snmp/net-snmp-config.h>
-#endif
+#include <net-snmp/net-snmp-includes.h>
+#else
 #include <asn1.h>
 #include <snmp.h>
 #include <snmp_impl.h>
+#endif
 
 #include "log.h"
 #include "thread.h"
diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c
index a1d8d4c..8d9842c 100644
--- a/ospf6d/ospf6_snmp.c
+++ b/ospf6d/ospf6_snmp.c
@@ -25,11 +25,12 @@
 
 #ifdef HAVE_NETSNMP
 #include <net-snmp/net-snmp-config.h>
-#endif /*HAVE_NETSNMP*/
-
+#include <net-snmp/net-snmp-includes.h>
+#else
 #include <asn1.h>
 #include <snmp.h>
 #include <snmp_impl.h>
+#endif
 
 #include "log.h"
 #include "vty.h"
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index 6e97260..e6ce1f0 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -27,10 +27,12 @@
 #ifdef HAVE_SNMP
 #ifdef HAVE_NETSNMP
 #include <net-snmp/net-snmp-config.h>
-#endif
+#include <net-snmp/net-snmp-includes.h>
+#else
 #include <asn1.h>
 #include <snmp.h>
 #include <snmp_impl.h>
+#endif
 
 #include "if.h"
 #include "log.h"
diff --git a/ripd/rip_snmp.c b/ripd/rip_snmp.c
index c1bec76..d02c761 100644
--- a/ripd/rip_snmp.c
+++ b/ripd/rip_snmp.c
@@ -24,10 +24,12 @@
 #ifdef HAVE_SNMP
 #ifdef HAVE_NETSNMP
 #include <net-snmp/net-snmp-config.h>
-#endif
+#include <net-snmp/net-snmp-includes.h>
+#else
 #include <asn1.h>
 #include <snmp.h>
 #include <snmp_impl.h>
+#endif
 
 #include "if.h"
 #include "log.h"
diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c
index 4536026..7e66e2f 100644
--- a/zebra/zebra_snmp.c
+++ b/zebra/zebra_snmp.c
@@ -24,10 +24,12 @@
 #ifdef HAVE_SNMP
 #ifdef HAVE_NETSNMP
 #include <net-snmp/net-snmp-config.h>
-#endif
+#include <net-snmp/net-snmp-includes.h>
+#else
 #include <asn1.h>
 #include <snmp.h>
 #include <snmp_impl.h>
+#endif
 
 #include "if.h"
 #include "log.h"
-- 
1.5.5.4




More information about the Quagga-dev mailing list