[quagga-dev 7754] [PATCH] [isisd] change ISIS_METHOD to use C preprocessor

David Lamparter equinox at diac24.net
Tue Feb 2 20:52:21 GMT 2010


this fixes warnings from vtysh extract.pl by making sure the isis method
files always 'work'. (previously, extract.pl would grab unselected isis
method sources and then complain about missing headers)
---
 configure.ac          |   13 ++++++++-----
 isisd/Makefile.am     |   11 +++--------
 isisd/isis_bpf.c      |    3 +++
 isisd/isis_dlpi.c     |    3 +++
 isisd/isis_pfpacket.c |    3 +++
 5 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9c47b5b..ac0610d 100755
--- a/configure.ac
+++ b/configure.ac
@@ -782,15 +782,18 @@ AC_SUBST(OTHER_METHOD)
 dnl --------------------------
 dnl Determine IS-IS I/O method
 dnl --------------------------
+AC_DEFINE(ISIS_METHOD_PFPACKET,	1, [ constant value for isis method pfpacket ])
+AC_DEFINE(ISIS_METHOD_DLPI,	2, [ constant value for isis method dlpi ])
+AC_DEFINE(ISIS_METHOD_BPF,	3, [ constant value for isis method bpf ])
 AC_CHECK_HEADER(net/bpf.h)
 AC_CHECK_HEADER(sys/dlpi.h)
 AC_MSG_CHECKING(zebra IS-IS I/O method)
 if test x"$opsys" = x"gnu-linux"; then
   AC_MSG_RESULT(pfpacket)
-  ISIS_METHOD=isis_pfpacket.o
+  ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
 elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
   AC_MSG_RESULT(DLPI)
-  ISIS_METHOD="isis_dlpi.o"
+  ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
 else
   if test $ac_cv_header_net_bpf_h = no; then
     if test $ac_cv_header_sys_dlpi_h = no; then
@@ -800,13 +803,13 @@ else
     else
       AC_MSG_RESULT(DLPI)
     fi
-    ISIS_METHOD="isis_dlpi.o"
+    ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
   else
     AC_MSG_RESULT(BPF)
-    ISIS_METHOD="isis_bpf.o"
+    ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
   fi
 fi
-AC_SUBST(ISIS_METHOD)
+AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
 
 dnl ------------------------------------
 dnl check for broken CMSG_FIRSTHDR macro
diff --git a/isisd/Makefile.am b/isisd/Makefile.am
index 9c30339..26b8ee7 100644
--- a/isisd/Makefile.am
+++ b/isisd/Makefile.am
@@ -13,8 +13,6 @@ noinst_LIBRARIES = libisis.a
 sbin_PROGRAMS = isisd 
 SUBDIRS = topology
 
-isis_method = @ISIS_METHOD@
-
 libisis_a_SOURCES = \
 	isis_adjacency.c isis_lsp.c dict.c isis_circuit.c isis_pdu.c \
 	isis_tlv.c isisd.c isis_misc.c isis_zebra.c isis_dr.c \
@@ -30,13 +28,10 @@ noinst_HEADERS = \
 	include-netbsd/clnp.h include-netbsd/esis.h include-netbsd/iso.h
 
 isisd_SOURCES = \
-	isis_main.c $(libisis_a_SOURCES)
-
-isisd_LDADD = $(isis_method) @ISIS_TOPOLOGY_LIB@ ../lib/libzebra.la @LIBCAP@
-
-isisd_DEPENDENCIES = $(isis_method)
+	isis_main.c $(libisis_a_SOURCES) \
+	isis_bpf.c isis_dlpi.c isis_pfpacket.c
 
-EXTRA_DIST = isis_bpf.c isis_dlpi.c isis_pfpacket.c
+isisd_LDADD = @ISIS_TOPOLOGY_LIB@ ../lib/libzebra.la @LIBCAP@
 
 examplesdir = $(exampledir)
 dist_examples_DATA = isisd.conf.sample
diff --git a/isisd/isis_bpf.c b/isisd/isis_bpf.c
index 8c3602d..05f1138 100644
--- a/isisd/isis_bpf.c
+++ b/isisd/isis_bpf.c
@@ -21,6 +21,7 @@
  */
 
 #include <zebra.h>
+#if ISIS_METHOD == ISIS_METHOD_BPF
 #include <net/if.h>
 #include <netinet/if_ether.h>
 #include <sys/time.h>
@@ -339,3 +340,5 @@ isis_send_pdu_p2p (struct isis_circuit *circuit, int level)
 {
   return ISIS_OK;
 }
+
+#endif /* ISIS_METHOD == ISIS_METHOD_BPF */
diff --git a/isisd/isis_dlpi.c b/isisd/isis_dlpi.c
index 3cbe0b4..fe872a9 100644
--- a/isisd/isis_dlpi.c
+++ b/isisd/isis_dlpi.c
@@ -21,6 +21,7 @@
  */
 
 #include <zebra.h>
+#if ISIS_METHOD == ISIS_METHOD_DLPI
 #include <net/if.h>
 #include <netinet/if_ether.h>
 #include <sys/types.h>
@@ -622,3 +623,5 @@ isis_send_pdu_bcast (struct isis_circuit *circuit, int level)
     sock_buff, stream_get_endp (circuit->snd_stream) + LLC_LEN, 0);
   return ISIS_OK;
 }
+
+#endif /* ISIS_METHOD == ISIS_METHOD_DLPI */
diff --git a/isisd/isis_pfpacket.c b/isisd/isis_pfpacket.c
index 8752dba..9e4165e 100644
--- a/isisd/isis_pfpacket.c
+++ b/isisd/isis_pfpacket.c
@@ -21,6 +21,7 @@
  */
 
 #include <zebra.h>
+#if ISIS_METHOD == ISIS_METHOD_PFPACKET
 #include <net/ethernet.h>	/* the L2 protocols */
 #include <netpacket/packet.h>
 
@@ -371,3 +372,5 @@ isis_send_pdu_p2p (struct isis_circuit *circuit, int level)
 
   return ISIS_OK;
 }
+
+#endif /* ISIS_METHOD == ISIS_METHOD_PFPACKET */
-- 
1.6.5.2




More information about the Quagga-dev mailing list