Build all shared libraries with -no-undefined and link them properly
authorTobias Brunner <tobias@strongswan.org>
Wed, 4 Sep 2013 12:25:22 +0000 (14:25 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 11 Sep 2013 23:44:49 +0000 (01:44 +0200)
The flag is required to convince libtool on Cygwin to build DLLs. But on
Windows these shared libraries can not have undefined symbols, so we have to
link them explicitly to the libraries they reference.

For plugins this is currently not done, so only the monolithic build is
supported.  The plugin loader wouldn't be able to load DLLs anyway, as
it tries to load files that don't exist on Cygwin.

12 files changed:
src/libcharon/Makefile.am
src/libfast/Makefile.am
src/libhydra/Makefile.am
src/libimcv/Makefile.am
src/libipsec/Makefile.am
src/libpts/Makefile.am
src/libpttls/Makefile.am
src/libradius/Makefile.am
src/libsimaka/Makefile.am
src/libstrongswan/Makefile.am
src/libtls/Makefile.am
src/libtnccs/Makefile.am

index 9c7f676..5ee047b 100644 (file)
@@ -136,7 +136,13 @@ AM_CPPFLAGS = \
        -DIPSEC_DIR=\"${ipsecdir}\" \
        -DIPSEC_PIDDIR=\"${piddir}\"
 
-libcharon_la_LIBADD = -lm $(PTHREADLIB) $(DLLIB) $(SOCKLIB)
+AM_LDFLAGS = \
+  -no-undefined
+
+libcharon_la_LIBADD = \
+  $(top_builddir)/src/libstrongswan/libstrongswan.la \
+  $(top_builddir)/src/libhydra/libhydra.la \
+  -lm $(PTHREADLIB) $(DLLIB) $(SOCKLIB)
 
 EXTRA_DIST = Android.mk
 
index edc2ab1..41a489b 100644 (file)
@@ -5,6 +5,9 @@ AM_CPPFLAGS = \
 AM_CFLAGS = \
        -rdynamic
 
+AM_LDFLAGS = \
+       -no-undefined
+
 ipseclib_LTLIBRARIES = libfast.la
 
 libfast_la_SOURCES = \
@@ -17,5 +20,6 @@ nobase_fast_include_HEADERS = \
        fast_request.h fast_session.h fast_smtp.h
 endif
 
-libfast_la_LIBADD = $(top_builddir)/src/libstrongswan/libstrongswan.la \
-  -lfcgi $(clearsilver_LIBS) $(PTHREADLIB)
+libfast_la_LIBADD = \
+       $(top_builddir)/src/libstrongswan/libstrongswan.la \
+       -lfcgi $(clearsilver_LIBS) $(PTHREADLIB)
index a2a164b..f7ae37f 100644 (file)
@@ -11,7 +11,8 @@ kernel/kernel_ipsec.c kernel/kernel_ipsec.h \
 kernel/kernel_net.c kernel/kernel_net.h \
 kernel/kernel_listener.h
 
-libhydra_la_LIBADD =
+libhydra_la_LIBADD = \
+  $(top_builddir)/src/libstrongswan/libstrongswan.la
 
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src/libstrongswan \
@@ -19,6 +20,9 @@ AM_CPPFLAGS = \
        -DPLUGINDIR=\"${plugindir}\" \
        -DSTRONGSWAN_CONF=\"${strongswan_conf}\"
 
+AM_LDFLAGS = \
+  -no-undefined
+
 EXTRA_DIST = Android.mk
 
 # build optional plugins
index e1e6541..86f172d 100644 (file)
@@ -4,7 +4,12 @@ AM_CPPFLAGS = \
 
 ipseclib_LTLIBRARIES = libimcv.la
 
-libimcv_la_LIBADD = $(top_builddir)/src/libtncif/libtncif.la
+libimcv_la_LDFLAGS = \
+       -no-undefined
+
+libimcv_la_LIBADD = \
+       $(top_builddir)/src/libstrongswan/libstrongswan.la \
+       $(top_builddir)/src/libtncif/libtncif.la
 
 libimcv_la_SOURCES = \
        imcv.h imcv.c \
index 74379f1..41f5ae9 100644 (file)
@@ -13,11 +13,15 @@ ipsec_processor.c ipsec_processor.h \
 ipsec_sa.c ipsec_sa.h \
 ipsec_sa_mgr.c ipsec_sa_mgr.h
 
-libipsec_la_LIBADD =
+libipsec_la_LIBADD = \
+       $(top_builddir)/src/libstrongswan/libstrongswan.la
 
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src/libstrongswan
 
+AM_LDFLAGS = \
+       -no-undefined
+
 EXTRA_DIST = Android.mk
 
 # build optional plugins
index 2c02fd1..48bb46c 100644 (file)
@@ -3,9 +3,15 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/src/libtncif \
        -I$(top_srcdir)/src/libimcv
 
+AM_LDFLAGS = \
+       -no-undefined
+
 ipseclib_LTLIBRARIES = libpts.la
 
-libpts_la_LIBADD = $(top_builddir)/src/libimcv/libimcv.la
+libpts_la_LIBADD = \
+       $(top_builddir)/src/libstrongswan/libstrongswan.la \
+       $(top_builddir)/src/libtncif/libtncif.la \
+       $(top_builddir)/src/libimcv/libimcv.la
 
 if USE_TROUSERS
   libpts_la_LIBADD += -ltspi
index 225d0e4..f2bcf44 100644 (file)
@@ -4,8 +4,15 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/src/libtncif \
        -I$(top_srcdir)/src/libtnccs
 
+AM_LDFLAGS = \
+       -no-undefined
+
 ipseclib_LTLIBRARIES = libpttls.la
-libpttls_la_LIBADD = $(top_builddir)/src/libtls/libtls.la
+
+libpttls_la_LIBADD = \
+       $(top_builddir)/src/libstrongswan/libstrongswan.la \
+       $(top_builddir)/src/libtls/libtls.la
+
 libpttls_la_SOURCES = pt_tls.c pt_tls.h \
        pt_tls_client.c pt_tls_client.h \
        pt_tls_server.c pt_tls_server.h \
index 91ded23..4706f27 100644 (file)
@@ -1,7 +1,14 @@
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src/libstrongswan
 
+AM_LDFLAGS = \
+       -no-undefined
+
 ipseclib_LTLIBRARIES = libradius.la
+
+libradius_la_LIBADD = \
+       $(top_builddir)/src/libstrongswan/libstrongswan.la
+
 libradius_la_SOURCES = \
        radius_message.h radius_message.c \
        radius_socket.h radius_socket.c \
index 8aaac7d..6878133 100644 (file)
@@ -3,7 +3,14 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/src/libhydra \
        -I$(top_srcdir)/src/libcharon
 
+AM_LDFLAGS = \
+       -no-undefined
+
 ipseclib_LTLIBRARIES = libsimaka.la
+
+libsimaka_la_LIBADD = \
+       $(top_builddir)/src/libstrongswan/libstrongswan.la
+
 libsimaka_la_SOURCES = simaka_message.h simaka_message.c \
   simaka_crypto.h simaka_crypto.c simaka_manager.h simaka_manager.c \
   simaka_card.h simaka_provider.h simaka_hooks.h
index dfe6e7e..78e4ce2 100644 (file)
@@ -95,6 +95,9 @@ AM_CPPFLAGS = \
 AM_CFLAGS = \
        @COVERAGE_CFLAGS@
 
+AM_LDFLAGS = \
+       -no-undefined
+
 if USE_LEAK_DETECTIVE
   AM_CPPFLAGS += -DLEAK_DETECTIVE
   libstrongswan_la_SOURCES += utils/leak_detective.c
index 9e3712a..b83ea8e 100644 (file)
@@ -1,12 +1,18 @@
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src/libstrongswan
 
+AM_LDFLAGS = \
+       -no-undefined
+
 ipseclib_LTLIBRARIES = libtls.la
 libtls_la_SOURCES = \
        tls_protection.c tls_compression.c tls_fragmentation.c tls_alert.c \
        tls_crypto.c tls_prf.c tls_socket.c tls_eap.c tls_cache.c tls_peer.c \
        tls_server.c tls.c
 
+libtls_la_LIBADD = \
+       $(top_builddir)/src/libstrongswan/libstrongswan.la
+
 if USE_DEV_HEADERS
 tls_includedir = ${dev_headers}/tls
 nobase_tls_include_HEADERS = \
index d1f8825..22a3b93 100644 (file)
@@ -3,9 +3,14 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/src/libtncif \
        -I$(top_srcdir)/src/libtls
 
+AM_LDFLAGS = \
+       -no-undefined
+
 ipseclib_LTLIBRARIES = libtnccs.la
 
-libtnccs_la_LIBADD = $(top_builddir)/src/libtncif/libtncif.la
+libtnccs_la_LIBADD = \
+       $(top_builddir)/src/libstrongswan/libstrongswan.la \
+       $(top_builddir)/src/libtncif/libtncif.la
 
 libtnccs_la_SOURCES = \
 tnc/tnc.h tnc/tnc.c \