[Libvirt-cim] [V3 PATCH 02/10] building system modification for libnl3 and libbridge

Wayne Xia xiawenc at linux.vnet.ibm.com
Thu Jan 12 09:46:46 UTC 2012


    As patch 1/10 says, this is the libtool making system for libnl3 and
libbridge. Now it only compile core and route components of libnl3, but other
source code were also put in the ./libnl3 in case using in the future.
Note:
    Because in root directory the autoconfigure have modification of glabal
variable CFLAGS and LDFLAGS containing information it have to drop, these
Makefile now override these values, so ./configure CFLAGS would not take effect
in these directories now.
    New Macro were introduced in configure.ac to set the compile and linking
option for ./libnetwork directory. -fvisibility=hidden and -D DLL_BUILD were
used to limit symbols exported.

Signed-off-by: Wayne Xia <xiawenc at linux.vnet.ibm.com>
---
 configure.ac                          |   19 +++++-
 libnetwork/libbridge/Makefile.am      |   20 ++++++
 libnetwork/libnl3/Makefile.am         |    8 ++
 libnetwork/libnl3/include/Makefile.am |  122 +++++++++++++++++++++++++++++++++
 libnetwork/libnl3/lib/Makefile.am     |   99 ++++++++++++++++++++++++++
 5 files changed, 267 insertions(+), 1 deletions(-)
 create mode 100644 libnetwork/libbridge/Makefile.am
 create mode 100644 libnetwork/libnl3/Makefile.am
 create mode 100644 libnetwork/libnl3/include/Makefile.am
 create mode 100644 libnetwork/libnl3/lib/Makefile.am

diff --git a/configure.ac b/configure.ac
index 0250c73..bae3de0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,7 +14,7 @@ AC_CONFIG_SRCDIR([src/Virt_ComputerSystem.c])
 AC_CONFIG_HEADER([config.h])
 
 # Use silent rules if possible
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 m4_define([lt_cur], m4_eval(libvirtcim_maj + libvirtcim_min))
@@ -50,6 +50,18 @@ CC_WARNINGS="\
 
 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_LARGEFILE64_SOURCE"
 
+# following are for libnetwork
+LIBNETWORK_CFLAGS="-fvisibility=hidden"
+LIBNETWORK_DEFINES="-D DLL_BUILD"
+AC_SUBST(LIBNETWORK_CFLAGS)
+AC_SUBST(LIBNETWORK_DEFINES)
+
+AM_CONDITIONAL([LIBNL3_ENABLE_CLI], [test "$enable_cli" = "yes"])
+
+# LEX and YACC is neccessary for libnl-3
+AM_PROG_LEX
+AC_PROG_YACC
+
 # Configure command line options
 AC_ARG_VAR([CIMSERVER],[the target CIM server (pegasus|sfcb|openwbem|sniacimom).
 ])
@@ -142,6 +154,11 @@ AC_CONFIG_FILES([
     base_schema/Makefile
     libxkutil/Makefile
     libxkutil/tests/Makefile
+    libnetwork/Makefile
+    libnetwork/libbridge/Makefile
+    libnetwork/libnl3/Makefile
+    libnetwork/libnl3/lib/Makefile
+    libnetwork/libnl3/include/Makefile
     src/Makefile
     src/tests/Makefile
     doc/Makefile
diff --git a/libnetwork/libbridge/Makefile.am b/libnetwork/libbridge/Makefile.am
new file mode 100644
index 0000000..93646fb
--- /dev/null
+++ b/libnetwork/libbridge/Makefile.am
@@ -0,0 +1,20 @@
+# Copyright IBM Corp. 2011
+# Auther:
+#     Wenchao Xia, <xiawenc at cn.ibm.com>
+#
+#     These code is a taken from bridge-utils-1.5
+
+CFLAGS = $(LIBNETWORK_CFLAGS) \
+         $(LIBNETWORK_DEFINES)
+CPPFLAGS =
+LDFLAGS = $(LIBNETWORK_DEFINES)
+
+AM_CFLAGS = $(CFLAGS_STRICT) \
+            -DLIBVIRTCIM_CONF=\"@sysconfdir@/@PACKAGE at .conf\"
+
+noinst_HEADERS = libbridge_private.h libbridge.h
+
+noinst_LTLIBRARIES = libbridge.la
+
+libbridge_la_SOURCES = libbridge_devif.c libbridge_if.c libbridge_init.c \
+                       libbridge_misc.c
diff --git a/libnetwork/libnl3/Makefile.am b/libnetwork/libnl3/Makefile.am
new file mode 100644
index 0000000..3fc7f0f
--- /dev/null
+++ b/libnetwork/libnl3/Makefile.am
@@ -0,0 +1,8 @@
+# Copyright IBM Corp. 2011
+# Auther:
+#     Wenchao Xia, <xiawenc at cn.ibm.com>
+#
+#     This is the root directory just as original
+# libnl3 project.
+
+SUBDIRS = lib include
diff --git a/libnetwork/libnl3/include/Makefile.am b/libnetwork/libnl3/include/Makefile.am
new file mode 100644
index 0000000..65d7924
--- /dev/null
+++ b/libnetwork/libnl3/include/Makefile.am
@@ -0,0 +1,122 @@
+# Copyright IBM Corp. 2011
+# Auther:
+#     Wenchao Xia, <xiawenc at cn.ibm.com>
+#
+#     These code is a taken from libnl3-3.2.3,
+# it is modified to generate static library.
+
+noinst_HEADERS = \
+	netlink/fib_lookup/lookup.h \
+	netlink/fib_lookup/request.h \
+	netlink/genl/ctrl.h \
+	netlink/genl/family.h \
+	netlink/genl/genl.h \
+	netlink/genl/mngt.h \
+	netlink/netfilter/ct.h \
+	netlink/netfilter/log.h \
+	netlink/netfilter/log_msg.h \
+	netlink/netfilter/netfilter.h \
+	netlink/netfilter/nfnl.h \
+	netlink/netfilter/queue.h \
+	netlink/netfilter/queue_msg.h \
+	netlink/addr.h \
+	netlink/attr.h \
+	netlink/cache-api.h \
+	netlink/cache.h \
+	netlink/data.h \
+	netlink/errno.h \
+	netlink/handlers.h \
+	netlink/list.h \
+	netlink/msg.h \
+	netlink/netlink-compat.h \
+	netlink/netlink-kernel.h \
+	netlink/netlink.h \
+	netlink/object-api.h \
+	netlink/object.h \
+	netlink/route/cls/ematch/cmp.h \
+	netlink/route/cls/ematch/meta.h \
+	netlink/route/cls/ematch/nbyte.h \
+	netlink/route/cls/ematch/text.h \
+	netlink/route/cls/basic.h \
+	netlink/route/cls/cgroup.h \
+	netlink/route/cls/ematch.h \
+	netlink/route/cls/fw.h \
+	netlink/route/cls/police.h \
+	netlink/route/cls/u32.h \
+	netlink/route/link/api.h \
+	netlink/route/link/bonding.h \
+	netlink/route/link/info-api.h \
+	netlink/route/link/inet.h \
+	netlink/route/link/vlan.h \
+	netlink/route/qdisc/cbq.h \
+	netlink/route/qdisc/dsmark.h \
+	netlink/route/qdisc/fifo.h \
+	netlink/route/qdisc/htb.h \
+	netlink/route/qdisc/netem.h \
+	netlink/route/qdisc/prio.h \
+	netlink/route/qdisc/red.h \
+	netlink/route/qdisc/sfq.h \
+	netlink/route/qdisc/tbf.h \
+	netlink/route/addr.h \
+	netlink/route/class.h \
+	netlink/route/classifier.h \
+	netlink/route/link.h \
+	netlink/route/neighbour.h \
+	netlink/route/neightbl.h \
+	netlink/route/nexthop.h \
+	netlink/route/pktloc.h \
+	netlink/route/qdisc.h \
+	netlink/route/route.h \
+	netlink/route/rtnl.h \
+	netlink/route/rule.h \
+	netlink/route/tc.h \
+	netlink/route/tc-api.h \
+	netlink/socket.h \
+	netlink/types.h \
+	netlink/utils.h \
+	netlink/version.h
+
+if LIBNL3_ENABLE_CLI
+noinst_HEADERS += \
+	netlink/cli/addr.h \
+	netlink/cli/class.h \
+	netlink/cli/cls.h \
+	netlink/cli/ct.h \
+	netlink/cli/link.h \
+	netlink/cli/neigh.h \
+	netlink/cli/qdisc.h \
+	netlink/cli/route.h \
+	netlink/cli/rule.h \
+	netlink/cli/tc.h \
+	netlink/cli/utils.h
+endif
+
+noinst_HEADERS += \
+	linux/fib_rules.h \
+	linux/genetlink.h \
+	linux/gen_stats.h \
+	linux/if_addr.h \
+	linux/if_arp.h \
+	linux/if_ether.h \
+	linux/if.h \
+	linux/if_link.h \
+	linux/if_vlan.h \
+	linux/inetdevice.h \
+	linux/ip_mp_alg.h \
+	linux/ipv6.h \
+	linux/neighbour.h \
+	linux/netfilter.h \
+	linux/netfilter/nfnetlink_conntrack.h \
+	linux/netfilter/nfnetlink.h \
+	linux/netfilter/nfnetlink_log.h \
+	linux/netfilter/nfnetlink_queue.h \
+	linux/netlink.h \
+	linux/pkt_cls.h \
+	linux/pkt_sched.h \
+	linux/rtnetlink.h \
+	linux/snmp.h \
+	linux/tc_ematch/tc_em_meta.h \
+	netlink-generic.h \
+	netlink-local.h \
+	netlink-tc.h \
+	netlink-types.h
diff --git a/libnetwork/libnl3/lib/Makefile.am b/libnetwork/libnl3/lib/Makefile.am
new file mode 100644
index 0000000..945dca8
--- /dev/null
+++ b/libnetwork/libnl3/lib/Makefile.am
@@ -0,0 +1,99 @@
+# Copyright IBM Corp. 2011
+# Auther:
+#     Wenchao Xia, <xiawenc at cn.ibm.com>
+#
+#     These code is a taken from libnl3-3.2.3,
+# it is modified to generate static library.
+
+CFLAGS = $(LIBNETWORK_CFLAGS) \
+         $(LIBNETWORK_DEFINES)
+CPPFLAGS =
+LDFLAGS = $(LIBNETWORK_DEFINES)
+
+AM_CFLAGS = $(CFLAGS_STRICT) \
+            -DLIBVIRTCIM_CONF=\"@sysconfdir@/@PACKAGE at .conf\"
+
+AM_CPPFLAGS  =	\
+	-Wall \
+        -I$(top_srcdir)/libnetwork/libnl3/include \
+	-I$(top_srcdir)/libnetwork/libnl3/include/netlink/route \
+	-I$(top_srcdir)/libnetwork/libnl3/include/netlink/route/cls \
+	-D_GNU_SOURCE \
+	-DSYSCONFDIR=\"$(sysconfdir)/libnl\"
+
+#the code is from libnl-3.2.3
+AM_LDFLAGS = \
+	-version-info 3:2:3
+
+noinst_LTLIBRARIES = \
+	libnl-3-4cim.la libnl-route-3-4cim.la
+
+libnl_3_4cim_la_SOURCES = \
+	addr.c attr.c cache.c cache_mngr.c cache_mngt.c data.c \
+	error.c handlers.c msg.c nl.c object.c socket.c utils.c
+
+CLEANFILES = \
+	route/pktloc_grammar.c route/pktloc_grammar.h \
+	route/pktloc_syntax.c route/pktloc_syntax.h \
+	route/cls/ematch_grammar.c route/cls/ematch_grammar.h \
+	route/cls/ematch_syntax.c route/cls/ematch_syntax.h
+
+# Hack to avoid using ylwrap. It does not function correctly in combination
+# with --header-file=
+route/pktloc_grammar.c: route/pktloc_grammar.l
+	$(AM_V_GEN) $(LEX) --header-file=route/pktloc_grammar.h $(LFLAGS) -o $@ $^
+
+route/pktloc_syntax.c: route/pktloc_syntax.y
+	$(AM_V_GEN) $(YACC) -d $(YFLAGS) -o $@ $^
+
+route/cls/ematch_grammar.c: route/cls/ematch_grammar.l
+	$(AM_V_GEN) $(LEX) --header-file=route/cls/ematch_grammar.h $(LFLAGS) -o $@ $^
+
+route/cls/ematch_syntax.c: route/cls/ematch_syntax.y
+	$(AM_V_GEN) $(YACC) -d $(YFLAGS) -o $@ $^
+
+libnl_route_3_4cim_la_LIBADD  = libnl-3-4cim.la
+libnl_route_3_4cim_la_SOURCES = \
+	route/addr.c route/class.c route/cls.c route/link.c \
+	route/neigh.c route/neightbl.c route/nexthop.c route/qdisc.c \
+	route/route.c route/route_obj.c route/route_utils.c route/rtnl.c \
+	route/rule.c route/tc.c route/classid.c \
+	\
+	route/cls/fw.c route/cls/police.c route/cls/u32.c route/cls/basic.c \
+	route/cls/cgroup.c \
+	\
+	route/cls/ematch.c \
+	route/cls/ematch/container.c route/cls/ematch/cmp.c \
+	route/cls/ematch/nbyte.c route/cls/ematch/text.c \
+	route/cls/ematch/meta.c \
+	\
+	route/link/api.c route/link/vlan.c route/link/dummy.c \
+	route/link/bridge.c route/link/inet6.c route/link/inet.c \
+	route/link/bonding.c \
+	\
+	route/qdisc/blackhole.c route/qdisc/cbq.c route/qdisc/dsmark.c \
+	route/qdisc/fifo.c route/qdisc/htb.c route/qdisc/netem.c \
+	route/qdisc/prio.c route/qdisc/red.c route/qdisc/sfq.c \
+	route/qdisc/tbf.c \
+	\
+	fib_lookup/lookup.c fib_lookup/request.c \
+	\
+	route/pktloc.c
+
+nodist_libnl_route_3_4cim_la_SOURCES = \
+	route/pktloc_syntax.c route/pktloc_syntax.h \
+	route/pktloc_grammar.c route/pktloc_grammar.h \
+	route/cls/ematch_syntax.c route/cls/ematch_syntax.h \
+	route/cls/ematch_grammar.c route/cls/ematch_grammar.h
+
+BUILT_SOURCES = \
+	route/cls/ematch_grammar.c \
+	route/cls/ematch_syntax.c \
+	route/pktloc_grammar.c \
+	route/pktloc_syntax.c
+
+EXTRA_DIST = \
+	route/pktloc_grammar.l \
+	route/pktloc_syntax.y \
+	route/cls/ematch_grammar.l \
+	route/cls/ematch_syntax.y
-- 
1.7.6





More information about the Libvirt-cim mailing list