[Libvirt-cim] [V4 PATCH 1/8] vlan library - Makefile system change

Wenchao Xia xiawenc at linux.vnet.ibm.com
Wed Jan 18 09:41:16 UTC 2012


    building system is changed to check libnl-devel-1.1. Also added Makefile in
sub dir. In sub dir CFLAGS and LDFLAGS were overwritten, because they have
other values set when configure was excuted. Libnetwork have -fPIC and
 -fvisibility=hidden  -D DLL_BUILD flags set.

Signed-off-by: Wenchao Xia <xiawenc at cn.ibm.com>
---
 Makefile.am            |    2 +-
 acinclude.m4           |    9 +++++++++
 configure.ac           |    8 ++++++++
 libnetwork/Makefile.am |   37 +++++++++++++++++++++++++++++++++++++
 libvirt-cim.spec.in    |    2 ++
 5 files changed, 57 insertions(+), 1 deletions(-)
 create mode 100644 libnetwork/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index 94dc5f3..6689550 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
 # Copyright IBM Corp. 2007
 AUTOMAKE_OPTIONS=dist-bzip2
 
-SUBDIRS = libxkutil src doc base_schema
+SUBDIRS = libnetwork libxkutil src doc base_schema
 
 MOFS = \
 	$(top_srcdir)/schema/ComputerSystem.mof \
diff --git a/acinclude.m4 b/acinclude.m4
index e0f76b6..3a2f76f 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -387,3 +387,12 @@ AC_DEFUN([SET_CSET],
 	CFLAGS="$CFLAGS $cs $rv"
 	]
 )
+
+AC_DEFUN([CHECK_LIBNL],
+	[
+	PKG_CHECK_MODULES([LIBNL], [libnl-1 >= 1.1])
+	AC_SUBST([LIBNL_CFLAGS])
+	AC_SUBST([LIBNL_LIBS])
+#	CPPFLAGS="$CPPFLAGS $LIBNL_CFLAGS"
+#	LDFLAGS="$LDFLAGS $LIBNL_LIBS"
+	])
diff --git a/configure.ac b/configure.ac
index 0f85baa..78a7438 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,12 @@ 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)
+
 # Configure command line options
 AC_ARG_VAR([CIMSERVER],[the target CIM server (pegasus|sfcb|openwbem|sniacimom).
 ])
@@ -141,6 +147,7 @@ AC_CONFIG_FILES([
     base_schema/install_base_schema.sh
     base_schema/Makefile
     libxkutil/Makefile
+    libnetwork/Makefile
     src/Makefile
     doc/Makefile
     Makefile 
@@ -165,6 +172,7 @@ CHECK_LIBXML2
 CHECK_LIBCU
 CHECK_LIBUUID
 CHECK_LIBCONFIG
+CHECK_LIBNL
 
 CFLAGS_STRICT="-Werror"
 
diff --git a/libnetwork/Makefile.am b/libnetwork/Makefile.am
new file mode 100644
index 0000000..aaa33c0
--- /dev/null
+++ b/libnetwork/Makefile.am
@@ -0,0 +1,37 @@
+# Copyright IBM Corp. 2012
+# Auther:
+#     Wenchao Xia, <xiawenc at cn.ibm.com>
+#
+#     Try build a dynamic library libnetwork.so, which
+# include libnl-3 and libbridge binaries. Doing this is
+# because there is no devel-libbridge.rpm, and there are
+# many program still using libnl1.so, which conflicts with
+# libnl-3.
+#     Exported symbols are strictly limited by Macro DLL_PUBLIC
+# to reduce name space polution.
+#     It need libcmpiutil to use CU_DEBUG facility.
+#     A test program is generated named as libnetwork_test.
+
+LDFLAGS = $(LIBNETWORK_DEFINES)
+
+CFLAGS = $(CFLAGS_STRICT) \
+            -DLIBVIRTCIM_CONF=\"@sysconfdir@/@PACKAGE at .conf\" \
+            $(LIBNETWORK_CFLAGS) $(LIBNETWORK_DEFINES) \
+            -I $(top_srcdir)/libnetwork/include
+
+
+noinst_HEADERS = host_network_API.h host_network_basic.h host_network_helper.h host_network_error.h \
+                 host_network_implement_OSAPI.h host_network_implement_bridge.h dll_magic.h
+noinst_HEADERS += include/netlink/route/link/vlan.h include/netlink/route/link/info-api.h
+
+lib_LTLIBRARIES = libnetwork.la
+
+libnetwork_la_SOURCES = host_network_API.c host_network_basic.c host_network_helper.c \
+                       host_network_implement_OSAPI.c host_network_implement_bridge.c
+libnetwork_la_LDFLAGS = -version-info @VERSION_INFO@ -lcmpiutil $(LIBNL_LIBS)
+
+noinst_PROGRAMS = libnetwork_test
+
+libnetwork_test_SOURCES = libnetwork_test.c
+libnetwork_test_LDFLAGS = -lcmpiutil
+libnetwork_test_LDADD = libnetwork.la
diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in
index d78eee7..5fac166 100644
--- a/libvirt-cim.spec.in
+++ b/libvirt-cim.spec.in
@@ -13,9 +13,11 @@ Requires: libxml2 >= 2.6.0
 Requires: libvirt >= 0.9.0
 Requires: unzip
 Requires: tog-pegasus
+Requires: libnl >= 1.1
 BuildRequires: libcmpiutil >= 0.5.4
 BuildRequires: tog-pegasus-devel
 BuildRequires: libvirt-devel >= 0.9.0
+BuildRequires: libnl-devel >= 1.1
 
 # In RHEL5 uuid-devel is provided by e2fsprogs
 %if 0%{?el5}
-- 
1.7.1





More information about the Libvirt-cim mailing list