From: Helmut Schaa <helmut.schaa@googlemail.com>
Date: Fri, 13 Dec 2013 17:54:28 +0000 (+0100)
Subject: openvswitch: Use libtool and allow building shared libs
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=38b7a52b618b98;p=sliver-openvswitch.git

openvswitch: Use libtool and allow building shared libs

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@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
---

diff --git a/AUTHORS b/AUTHORS
index ab570f826..fb204a2b0 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -49,6 +49,7 @@ Guolin Yang             gyang@nicira.com
 Gurucharan Shetty       gshetty@nicira.com
 Henry Mai               hmai@nicira.com
 Hao Zheng               hzheng@nicira.com
+Helmut Schaa            helmut.schaa@googlemail.com
 Ian Campbell            Ian.Campbell@citrix.com
 Isaku Yamahata          yamahata@valinux.co.jp
 James P.                roampune@gmail.com
diff --git a/Makefile.am b/Makefile.am
index a6d985d83..0faed6795 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -93,7 +93,7 @@ MAN_FRAGMENTS =
 MAN_ROOTS =
 noinst_DATA =
 noinst_HEADERS =
-noinst_LIBRARIES =
+lib_LTLIBRARIES =
 noinst_man_MANS =
 noinst_PROGRAMS =
 noinst_SCRIPTS =
diff --git a/acinclude.m4 b/acinclude.m4
index 94f9b6186..2ca931114 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 3cb407157..4c13ba326 100644
--- a/build-aux/.gitignore
+++ b/build-aux/.gitignore
@@ -3,4 +3,5 @@
 /config.sub
 /depcomp
 /install-sh
+/ltmain.sh
 /missing
diff --git a/configure.ac b/configure.ac
index 05b7082ab..8ddc1f9bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,6 @@ AM_INIT_AUTOMAKE
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CPP
-AC_PROG_RANLIB
 AC_PROG_MKDIR_P
 AC_PROG_FGREP
 AC_PROG_EGREP
@@ -41,6 +40,7 @@ AC_USE_SYSTEM_EXTENSIONS
 AC_C_BIGENDIAN
 AC_SYS_LARGEFILE
 
+LT_INIT([disable-shared])
 AC_SEARCH_LIBS([pow], [m])
 AC_SEARCH_LIBS([clock_gettime], [rt])
 AC_SEARCH_LIBS([timer_create], [rt])
diff --git a/lib/automake.mk b/lib/automake.mk
index a8edfc39f..5eece1c2a 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -5,9 +5,12 @@
 # notice and this notice are preserved.  This file is offered as-is,
 # without warranty of any kind.
 
-noinst_LIBRARIES += lib/libopenvswitch.a
+lib_LTLIBRARIES += lib/libopenvswitch.la
 
-lib_libopenvswitch_a_SOURCES = \
+lib_libopenvswitch_la_LIBADD = $(SSL_LIBS)
+lib_libopenvswitch_la_LDFLAGS = -release $(VERSION)
+
+lib_libopenvswitch_la_SOURCES = \
 	lib/aes128.c \
 	lib/aes128.h \
 	lib/async-append.h \
@@ -233,28 +236,30 @@ lib_libopenvswitch_a_SOURCES = \
 	lib/vtep-idl.h
 EXTRA_DIST += lib/string.h.in
 
-nodist_lib_libopenvswitch_a_SOURCES = \
+nodist_lib_libopenvswitch_la_SOURCES = \
 	lib/dirs.c
-CLEANFILES += $(nodist_lib_libopenvswitch_a_SOURCES)
+CLEANFILES += $(nodist_lib_libopenvswitch_la_SOURCES)
 
-noinst_LIBRARIES += lib/libsflow.a
-lib_libsflow_a_SOURCES = \
+lib_LTLIBRARIES += lib/libsflow.la
+lib_libsflow_la_LDFLAGS = -release $(VERSION)
+lib_libsflow_la_SOURCES = \
 	lib/sflow_api.h \
 	lib/sflow.h \
 	lib/sflow_agent.c \
 	lib/sflow_sampler.c \
 	lib/sflow_poller.c \
 	lib/sflow_receiver.c
-lib_libsflow_a_CFLAGS = $(AM_CFLAGS)
+lib_libsflow_la_CPPFLAGS = $(AM_CPPFLAGS)
+lib_libsflow_la_CFLAGS = $(AM_CFLAGS)
 if HAVE_WNO_UNUSED
-lib_libsflow_a_CFLAGS += -Wno-unused
+lib_libsflow_la_CFLAGS += -Wno-unused
 endif
 if HAVE_WNO_UNUSED_PARAMETER
-lib_libsflow_a_CFLAGS += -Wno-unused-parameter
+lib_libsflow_la_CFLAGS += -Wno-unused-parameter
 endif
 
 if LINUX_DATAPATH
-lib_libopenvswitch_a_SOURCES += \
+lib_libopenvswitch_la_SOURCES += \
 	lib/dpif-linux.c \
 	lib/dpif-linux.h \
 	lib/netdev-linux.c \
@@ -271,18 +276,18 @@ lib_libopenvswitch_a_SOURCES += \
 endif
 
 if HAVE_POSIX_AIO
-lib_libopenvswitch_a_SOURCES += lib/async-append-aio.c
+lib_libopenvswitch_la_SOURCES += lib/async-append-aio.c
 else
-lib_libopenvswitch_a_SOURCES += lib/async-append-null.c
+lib_libopenvswitch_la_SOURCES += lib/async-append-null.c
 endif
 
 if ESX
-lib_libopenvswitch_a_SOURCES += \
+lib_libopenvswitch_la_SOURCES += \
         lib/route-table-stub.c
 endif
 
 if HAVE_IF_DL
-lib_libopenvswitch_a_SOURCES += \
+lib_libopenvswitch_la_SOURCES += \
 	lib/netdev-bsd.c \
 	lib/rtbsd.c \
 	lib/rtbsd.h \
@@ -290,8 +295,8 @@ lib_libopenvswitch_a_SOURCES += \
 endif
 
 if HAVE_OPENSSL
-lib_libopenvswitch_a_SOURCES += lib/stream-ssl.c
-nodist_lib_libopenvswitch_a_SOURCES += lib/dhparams.c
+lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c
+nodist_lib_libopenvswitch_la_SOURCES += lib/dhparams.c
 lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
 	(echo '#include "lib/dhparams.h"' &&				\
 	 openssl dhparam -C -in $(srcdir)/lib/dh1024.pem -noout &&	\
@@ -300,7 +305,7 @@ lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
 	| sed 's/\(get_dh[0-9]*\)()/\1(void)/' > lib/dhparams.c.tmp
 	mv lib/dhparams.c.tmp lib/dhparams.c
 else
-lib_libopenvswitch_a_SOURCES += lib/stream-nossl.c
+lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
 endif
 
 EXTRA_DIST += \
diff --git a/m4/.gitignore b/m4/.gitignore
new file mode 100644
index 000000000..94e6f26a7
--- /dev/null
+++ b/m4/.gitignore
@@ -0,0 +1,5 @@
+/libtool.m4
+/ltoptions.m4
+/ltsugar.m4
+/ltversion.m4
+/lt~obsolete.m4
diff --git a/ofproto/automake.mk b/ofproto/automake.mk
index 218a5b123..25be10587 100644
--- a/ofproto/automake.mk
+++ b/ofproto/automake.mk
@@ -5,8 +5,9 @@
 # notice and this notice are preserved.  This file is offered as-is,
 # without warranty of any kind.
 
-noinst_LIBRARIES += ofproto/libofproto.a
-ofproto_libofproto_a_SOURCES = \
+lib_LTLIBRARIES += ofproto/libofproto.la
+ofproto_libofproto_la_LDFLAGS = -release $(VERSION)
+ofproto_libofproto_la_SOURCES = \
 	ofproto/bond.c \
 	ofproto/bond.h \
 	ofproto/collectors.c \
@@ -45,10 +46,13 @@ ofproto_libofproto_a_SOURCES = \
 	ofproto/pinsched.h \
 	ofproto/tunnel.c \
 	ofproto/tunnel.h
+ofproto_libofproto_la_CPPFLAGS = $(AM_CPPFLAGS)
+ofproto_libofproto_la_CFLAGS = $(AM_CFLAGS)
+ofproto_libofproto_la_LIBADD = lib/libsflow.la
 
 # Distribute this generated file in order not to require Python at
 # build time if ofproto/ipfix.xml is not modified.
-ofproto_libofproto_a_SOURCES += ofproto/ipfix-entities.def
+ofproto_libofproto_la_SOURCES += ofproto/ipfix-entities.def
 
 BUILT_SOURCES += ofproto/ipfix-entities.def
 
diff --git a/ovsdb/automake.mk b/ovsdb/automake.mk
index 3884d3ffd..b97365ed9 100644
--- a/ovsdb/automake.mk
+++ b/ovsdb/automake.mk
@@ -1,6 +1,7 @@
 # libovsdb
-noinst_LIBRARIES += ovsdb/libovsdb.a
-ovsdb_libovsdb_a_SOURCES = \
+lib_LTLIBRARIES += ovsdb/libovsdb.la
+ovsdb_libovsdb_la_LDFLAGS = -release $(VERSION)
+ovsdb_libovsdb_la_SOURCES = \
 	ovsdb/column.c \
 	ovsdb/column.h \
 	ovsdb/condition.c \
@@ -29,6 +30,9 @@ ovsdb_libovsdb_a_SOURCES = \
 	ovsdb/trigger.h \
 	ovsdb/transaction.c \
 	ovsdb/transaction.h
+ovsdb_libovsdb_la_CFLAGS = $(AM_CFLAGS)
+ovsdb_libovsdb_la_CPPFLAGS = $(AM_CPPFLAGS)
+
 MAN_FRAGMENTS += \
 	ovsdb/remote-active.man \
 	ovsdb/remote-passive.man
@@ -36,7 +40,7 @@ MAN_FRAGMENTS += \
 # ovsdb-tool
 bin_PROGRAMS += ovsdb/ovsdb-tool
 ovsdb_ovsdb_tool_SOURCES = ovsdb/ovsdb-tool.c
-ovsdb_ovsdb_tool_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
+ovsdb_ovsdb_tool_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la $(SSL_LIBS)
 # ovsdb-tool.1
 man_MANS += ovsdb/ovsdb-tool.1
 DISTCLEANFILES += ovsdb/ovsdb-tool.1
@@ -45,7 +49,7 @@ MAN_ROOTS += ovsdb/ovsdb-tool.1.in
 # ovsdb-client
 bin_PROGRAMS += ovsdb/ovsdb-client
 ovsdb_ovsdb_client_SOURCES = ovsdb/ovsdb-client.c
-ovsdb_ovsdb_client_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
+ovsdb_ovsdb_client_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la $(SSL_LIBS)
 # ovsdb-client.1
 man_MANS += ovsdb/ovsdb-client.1
 DISTCLEANFILES += ovsdb/ovsdb-client.1
@@ -54,7 +58,7 @@ MAN_ROOTS += ovsdb/ovsdb-client.1.in
 # ovsdb-server
 sbin_PROGRAMS += ovsdb/ovsdb-server
 ovsdb_ovsdb_server_SOURCES = ovsdb/ovsdb-server.c
-ovsdb_ovsdb_server_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
+ovsdb_ovsdb_server_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la $(SSL_LIBS)
 # ovsdb-server.1
 man_MANS += ovsdb/ovsdb-server.1
 DISTCLEANFILES += ovsdb/ovsdb-server.1
diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index 197541ffa..5da98e100 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -69,6 +69,9 @@ install python/compat/argparse.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
 
 install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
 
+# Get rid of stuff we don't want to make RPM happy.
+rm -rf $RPM_BUILD_ROOT/%{_lib}
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in
index 02857f42a..3413c7520 100644
--- a/rhel/openvswitch.spec.in
+++ b/rhel/openvswitch.spec.in
@@ -62,6 +62,7 @@ rm \
     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-l3ping.8 \
     $RPM_BUILD_ROOT/usr/sbin/ovs-vlan-bug-workaround \
     $RPM_BUILD_ROOT/usr/share/man/man8/ovs-vlan-bug-workaround.8
+rm -rf $RPM_BUILD_ROOT/%{_lib}
 
 install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
 
diff --git a/tests/automake.mk b/tests/automake.mk
index 099398aa5..3f5198ab6 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -176,103 +176,103 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
 
 noinst_PROGRAMS += tests/test-aes128
 tests_test_aes128_SOURCES = tests/test-aes128.c
-tests_test_aes128_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_aes128_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-atomic
 tests_test_atomic_SOURCES = tests/test-atomic.c
-tests_test_atomic_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_atomic_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-bundle
 tests_test_bundle_SOURCES = tests/test-bundle.c
-tests_test_bundle_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_bundle_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-classifier
 tests_test_classifier_SOURCES = tests/test-classifier.c
-tests_test_classifier_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_classifier_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-controller
 MAN_ROOTS += tests/test-controller.8.in
 DISTCLEANFILES += utilities/test-controller.8
 noinst_man_MANS += tests/test-controller.8
 tests_test_controller_SOURCES = tests/test-controller.c
-tests_test_controller_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_controller_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-csum
 tests_test_csum_SOURCES = tests/test-csum.c
-tests_test_csum_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_csum_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-file_name
 tests_test_file_name_SOURCES = tests/test-file_name.c
-tests_test_file_name_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_file_name_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-flows
 tests_test_flows_SOURCES = tests/test-flows.c
-tests_test_flows_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_flows_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 dist_check_SCRIPTS = tests/flowgen.pl
 
 noinst_PROGRAMS += tests/test-hash
 tests_test_hash_SOURCES = tests/test-hash.c
-tests_test_hash_LDADD = lib/libopenvswitch.a
+tests_test_hash_LDADD = lib/libopenvswitch.la
 
 noinst_PROGRAMS += tests/test-heap
 tests_test_heap_SOURCES = tests/test-heap.c
-tests_test_heap_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_heap_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-hindex
 tests_test_hindex_SOURCES = tests/test-hindex.c
-tests_test_hindex_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_hindex_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-hmap
 tests_test_hmap_SOURCES = tests/test-hmap.c
-tests_test_hmap_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_hmap_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-json
 tests_test_json_SOURCES = tests/test-json.c
-tests_test_json_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_json_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-jsonrpc
 tests_test_jsonrpc_SOURCES = tests/test-jsonrpc.c
-tests_test_jsonrpc_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_jsonrpc_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-list
 tests_test_list_SOURCES = tests/test-list.c
-tests_test_list_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_list_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-lockfile
 tests_test_lockfile_SOURCES = tests/test-lockfile.c
-tests_test_lockfile_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_lockfile_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-multipath
 tests_test_multipath_SOURCES = tests/test-multipath.c
-tests_test_multipath_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_multipath_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-packets
 tests_test_packets_SOURCES = tests/test-packets.c
-tests_test_packets_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_packets_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-random
 tests_test_random_SOURCES = tests/test-random.c
-tests_test_random_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_random_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-stp
 tests_test_stp_SOURCES = tests/test-stp.c
-tests_test_stp_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_stp_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-sflow
 tests_test_sflow_SOURCES = tests/test-sflow.c
-tests_test_sflow_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_sflow_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-netflow
 tests_test_netflow_SOURCES = tests/test-netflow.c
-tests_test_netflow_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_netflow_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-unix-socket
 tests_test_unix_socket_SOURCES = tests/test-unix-socket.c
-tests_test_unix_socket_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_unix_socket_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-odp
 tests_test_odp_SOURCES = tests/test-odp.c
-tests_test_odp_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_odp_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-ovsdb
 tests_test_ovsdb_SOURCES = \
@@ -280,7 +280,7 @@ tests_test_ovsdb_SOURCES = \
 	tests/idltest.c \
 	tests/idltest.h
 EXTRA_DIST += tests/uuidfilt.pl tests/ovsdb-monitor-sort.pl
-tests_test_ovsdb_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_ovsdb_LDADD = ovsdb/libovsdb.la lib/libopenvswitch.la $(SSL_LIBS)
 
 # idltest schema and IDL
 OVSIDL_BUILT += tests/idltest.c tests/idltest.h tests/idltest.ovsidl
@@ -294,11 +294,11 @@ tests/idltest.c: tests/idltest.h
 
 noinst_PROGRAMS += tests/test-reconnect
 tests_test_reconnect_SOURCES = tests/test-reconnect.c
-tests_test_reconnect_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_reconnect_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-sha1
 tests_test_sha1_SOURCES = tests/test-sha1.c
-tests_test_sha1_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_sha1_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-strtok_r
 tests_test_strtok_r_SOURCES = tests/test-strtok_r.c
@@ -308,19 +308,19 @@ tests_test_type_props_SOURCES = tests/test-type-props.c
 
 noinst_PROGRAMS += tests/test-util
 tests_test_util_SOURCES = tests/test-util.c
-tests_test_util_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_util_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-uuid
 tests_test_uuid_SOURCES = tests/test-uuid.c
-tests_test_uuid_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_uuid_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-vconn
 tests_test_vconn_SOURCES = tests/test-vconn.c
-tests_test_vconn_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+tests_test_vconn_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += tests/test-byte-order
 tests_test_byte_order_SOURCES = tests/test-byte-order.c
-tests_test_byte_order_LDADD = lib/libopenvswitch.a
+tests_test_byte_order_LDADD = lib/libopenvswitch.la
 
 # Python tests.
 CHECK_PYFILES = \
diff --git a/utilities/automake.mk b/utilities/automake.mk
index b7a4d73f2..ffc48b184 100644
--- a/utilities/automake.mk
+++ b/utilities/automake.mk
@@ -97,32 +97,32 @@ man_MANS += \
 dist_man_MANS += utilities/ovs-ctl.8
 
 utilities_ovs_appctl_SOURCES = utilities/ovs-appctl.c
-utilities_ovs_appctl_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+utilities_ovs_appctl_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 utilities_ovs_dpctl_SOURCES = utilities/ovs-dpctl.c
-utilities_ovs_dpctl_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+utilities_ovs_dpctl_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 utilities_ovs_ofctl_SOURCES = utilities/ovs-ofctl.c
 utilities_ovs_ofctl_LDADD = \
-	ofproto/libofproto.a \
-	lib/libopenvswitch.a \
+	ofproto/libofproto.la \
+	lib/libopenvswitch.la \
 	$(SSL_LIBS)
 
 utilities_ovs_vsctl_SOURCES = utilities/ovs-vsctl.c
-utilities_ovs_vsctl_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+utilities_ovs_vsctl_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 if LINUX_DATAPATH
 sbin_PROGRAMS += utilities/ovs-vlan-bug-workaround
 utilities_ovs_vlan_bug_workaround_SOURCES = utilities/ovs-vlan-bug-workaround.c
-utilities_ovs_vlan_bug_workaround_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+utilities_ovs_vlan_bug_workaround_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 noinst_PROGRAMS += utilities/nlmon
 utilities_nlmon_SOURCES = utilities/nlmon.c
-utilities_nlmon_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+utilities_nlmon_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 endif
 
 bin_PROGRAMS += utilities/ovs-benchmark
 utilities_ovs_benchmark_SOURCES = utilities/ovs-benchmark.c
-utilities_ovs_benchmark_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+utilities_ovs_benchmark_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 include utilities/bugtool/automake.mk
diff --git a/vswitchd/automake.mk b/vswitchd/automake.mk
index 02d413ecc..b0a386b4e 100644
--- a/vswitchd/automake.mk
+++ b/vswitchd/automake.mk
@@ -12,9 +12,9 @@ vswitchd_ovs_vswitchd_SOURCES = \
 	vswitchd/xenserver.c \
 	vswitchd/xenserver.h
 vswitchd_ovs_vswitchd_LDADD = \
-	ofproto/libofproto.a \
-	lib/libsflow.a \
-	lib/libopenvswitch.a \
+	ofproto/libofproto.la \
+	lib/libsflow.la \
+	lib/libopenvswitch.la \
 	$(SSL_LIBS)
 EXTRA_DIST += vswitchd/INTERNALS
 MAN_ROOTS += vswitchd/ovs-vswitchd.8.in
diff --git a/vtep/automake.mk b/vtep/automake.mk
index 6e89a0577..008f5b435 100644
--- a/vtep/automake.mk
+++ b/vtep/automake.mk
@@ -11,7 +11,7 @@ man_MANS += \
    vtep/vtep-ctl.8
 
 vtep_vtep_ctl_SOURCES = vtep/vtep-ctl.c
-vtep_vtep_ctl_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
+vtep_vtep_ctl_LDADD = lib/libopenvswitch.la $(SSL_LIBS)
 
 # ovs-vtep
 scripts_SCRIPTS += \