[ovs-dev] [PATCHv4] openvswitch: Use libtool and allow building shared libs

Ben Pfaff blp at nicira.com
Wed Dec 18 00:29:04 UTC 2013


On Fri, Dec 13, 2013 at 06:54:28PM +0100, Helmut Schaa wrote:
> Currently openvswitch builds all libraries static only. However,
> libopenvswitch is linked into nearly all openvswitch executables
> making it hardly possible to run openvswitch on embedded devices
> (for example running OpenWrt).
> 
> Convert openvswitch to use libtool for building its internal libs.
> This allows "--enable-shared" and "--enable-static" as configure
> arguments. Default is "--disable-shared" thus keeping the current
> behavior with the only change that static libs are installed by
> "make install".
> 
> Since the openvswitch library interfaces are internal and thus not
> stable (yet) encode the openvswitch version into the library name:
> libopenvswitch-2.0.90.so
> 
> Binary size is reduced to around 1/3 when using shared libs.
> 
> Signed-off-by: Helmut Schaa <helmut.schaa at googlemail.com>

Thank you!

I had to fold in the following to polish this up a bit (in particular
to get "sparse" to work).  I'll push this in a minute.

diff --git a/acinclude.m4 b/acinclude.m4
index 94f9b61..2ca9311 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -523,7 +523,7 @@ AC_DEFUN([OVS_ENABLE_SPARSE],
    AC_SUBST([SPARSE])
    AC_CONFIG_COMMANDS_PRE(
      [if test $ovs_cv_gnu_make_if = yes; then
-        CC='$(if $(C),REAL_CC="'"$CC"'" CHECK="$(SPARSE) -I $(top_srcdir)/include/sparse $(SPARSEFLAGS) $(SPARSE_EXTRA_INCLUDES) " cgcc $(CGCCFLAGS),'"$CC"')'
+        CC='$(if $(C),env REAL_CC="'"$CC"'" CHECK="$(SPARSE) -I $(top_srcdir)/include/sparse $(SPARSEFLAGS) $(SPARSE_EXTRA_INCLUDES) " cgcc $(CGCCFLAGS),'"$CC"')'
       fi])])
 
 dnl OVS_PTHREAD_SET_NAME
diff --git a/build-aux/.gitignore b/build-aux/.gitignore
index 3cb4071..4c13ba3 100644
--- a/build-aux/.gitignore
+++ b/build-aux/.gitignore
@@ -3,4 +3,5 @@
 /config.sub
 /depcomp
 /install-sh
+/ltmain.sh
 /missing
diff --git a/m4/.gitignore b/m4/.gitignore
new file mode 100644
index 0000000..94e6f26
--- /dev/null
+++ b/m4/.gitignore
@@ -0,0 +1,5 @@
+/libtool.m4
+/ltoptions.m4
+/ltsugar.m4
+/ltversion.m4
+/lt~obsolete.m4



More information about the dev mailing list