In the previous commit we built an import library on Windows
(server/libnbdkit.a). This contains the stubs which allow plugins to
dynamically link to symbols such as nbdkit_error exported by
nbdkit.exe.
An additional complexity is added by libtool which refuses to believe
that it's possible to add a *.a file when generating a dynamic
library. We must therefore hide the *.a file from libtool by using
-Wl options (ie. passing the library directly through to the linker).
---
configure.ac | 2 ++
filters/blocksize/Makefile.am | 1 +
filters/cache/Makefile.am | 1 +
filters/cacheextents/Makefile.am | 1 +
filters/cow/Makefile.am | 1 +
filters/ddrescue/Makefile.am | 1 +
filters/delay/Makefile.am | 3 +++
filters/error/Makefile.am | 1 +
filters/exitlast/Makefile.am | 3 +++
filters/ext2/Makefile.am | 3 ++-
filters/extentlist/Makefile.am | 1 +
filters/fua/Makefile.am | 3 +++
filters/gzip/Makefile.am | 1 +
filters/ip/Makefile.am | 1 +
filters/limit/Makefile.am | 1 +
filters/log/Makefile.am | 1 +
filters/nocache/Makefile.am | 3 +++
filters/noextents/Makefile.am | 3 +++
filters/nofilter/Makefile.am | 3 +++
filters/noparallel/Makefile.am | 3 +++
filters/nozero/Makefile.am | 3 +++
filters/offset/Makefile.am | 1 +
filters/partition/Makefile.am | 1 +
filters/pause/Makefile.am | 1 +
filters/rate/Makefile.am | 1 +
filters/readahead/Makefile.am | 1 +
filters/retry/Makefile.am | 1 +
filters/stats/Makefile.am | 1 +
filters/swab/Makefile.am | 1 +
filters/tar/Makefile.am | 1 +
filters/tls-fallback/Makefile.am | 3 +++
filters/truncate/Makefile.am | 1 +
filters/xz/Makefile.am | 1 +
plugins/cc/Makefile.am | 1 +
plugins/cdi/Makefile.am | 1 +
plugins/curl/Makefile.am | 3 ++-
plugins/data/Makefile.am | 1 +
plugins/eval/Makefile.am | 1 +
plugins/example1/Makefile.am | 3 +++
plugins/example2/Makefile.am | 3 +++
plugins/example3/Makefile.am | 3 +++
plugins/file/Makefile.am | 1 +
plugins/floppy/Makefile.am | 1 +
plugins/full/Makefile.am | 3 +++
plugins/guestfs/Makefile.am | 3 ++-
plugins/gzip/Makefile.am | 1 +
plugins/info/Makefile.am | 1 +
plugins/iso/Makefile.am | 1 +
plugins/libvirt/Makefile.am | 1 +
plugins/linuxdisk/Makefile.am | 1 +
plugins/lua/Makefile.am | 3 +++
plugins/memory/Makefile.am | 1 +
plugins/nbd/Makefile.am | 1 +
plugins/null/Makefile.am | 3 +++
plugins/ondemand/Makefile.am | 1 +
plugins/partitioning/Makefile.am | 1 +
plugins/pattern/Makefile.am | 3 +++
plugins/perl/Makefile.am | 1 +
plugins/python/Makefile.am | 3 ++-
plugins/random/Makefile.am | 3 +++
plugins/ruby/Makefile.am | 1 +
plugins/sh/Makefile.am | 1 +
plugins/split/Makefile.am | 1 +
plugins/ssh/Makefile.am | 3 ++-
plugins/streaming/Makefile.am | 3 +++
plugins/tar/Makefile.am | 7 ++++---
plugins/tcl/Makefile.am | 1 +
plugins/tmpdisk/Makefile.am | 7 ++++---
plugins/torrent/Makefile.am | 11 ++++++-----
plugins/vddk/Makefile.am | 1 +
plugins/zero/Makefile.am | 3 +++
tests/Makefile.am | 12 ++++++++++++
72 files changed, 138 insertions(+), 16 deletions(-)
diff --git a/configure.ac b/configure.ac
index 16762f54..faae1ca7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -485,11 +485,13 @@ AS_CASE([$host_os],
is_windows=yes
LIBS="$LIBS -lmsvcrt -lkernel32 -luser32"
NO_UNDEFINED_ON_WINDOWS="-no-undefined"
+ IMPORT_LIBRARY_ON_WINDOWS='-Wl,-L$(top_builddir)/server -Wl,-lnbdkit'
],
[is_windows=no]
)
AC_MSG_RESULT([$is_windows])
AC_SUBST([NO_UNDEFINED_ON_WINDOWS])
+AC_SUBST([IMPORT_LIBRARY_ON_WINDOWS])
AM_CONDITIONAL([IS_WINDOWS],[test "x$is_windows" = "xyes"])
AS_IF([test "x$is_windows" = "xyes"],[
diff --git a/filters/blocksize/Makefile.am b/filters/blocksize/Makefile.am
index ea51246a..5cda19bd 100644
--- a/filters/blocksize/Makefile.am
+++ b/filters/blocksize/Makefile.am
@@ -52,6 +52,7 @@ nbdkit_blocksize_filter_la_LDFLAGS = \
$(NULL)
nbdkit_blocksize_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/cache/Makefile.am b/filters/cache/Makefile.am
index 200cda15..e8879807 100644
--- a/filters/cache/Makefile.am
+++ b/filters/cache/Makefile.am
@@ -61,6 +61,7 @@ nbdkit_cache_filter_la_LDFLAGS = \
nbdkit_cache_filter_la_LIBADD = \
$(top_builddir)/common/bitmap/libbitmap.la \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/cacheextents/Makefile.am b/filters/cacheextents/Makefile.am
index 2f7a689b..5ddffe98 100644
--- a/filters/cacheextents/Makefile.am
+++ b/filters/cacheextents/Makefile.am
@@ -52,6 +52,7 @@ nbdkit_cacheextents_filter_la_LDFLAGS = \
$(NULL)
nbdkit_cacheextents_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/cow/Makefile.am b/filters/cow/Makefile.am
index 4ff08a44..93ecf76b 100644
--- a/filters/cow/Makefile.am
+++ b/filters/cow/Makefile.am
@@ -56,6 +56,7 @@ nbdkit_cow_filter_la_LDFLAGS = \
nbdkit_cow_filter_la_LIBADD = \
$(top_builddir)/common/bitmap/libbitmap.la \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/ddrescue/Makefile.am b/filters/ddrescue/Makefile.am
index 79bbad9c..e19c022f 100644
--- a/filters/ddrescue/Makefile.am
+++ b/filters/ddrescue/Makefile.am
@@ -57,6 +57,7 @@ nbdkit_ddrescue_filter_la_LDFLAGS = \
$(NULL)
nbdkit_ddrescue_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(GNUTLS_LIBS) \
$(NULL)
diff --git a/filters/delay/Makefile.am b/filters/delay/Makefile.am
index 470c6062..b77c15ab 100644
--- a/filters/delay/Makefile.am
+++ b/filters/delay/Makefile.am
@@ -44,6 +44,9 @@ nbdkit_delay_filter_la_CPPFLAGS = \
-I$(top_srcdir)/include \
$(NULL)
nbdkit_delay_filter_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_delay_filter_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_delay_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/filters/filters.syms \
diff --git a/filters/error/Makefile.am b/filters/error/Makefile.am
index 78e2a7b7..8ce8dc32 100644
--- a/filters/error/Makefile.am
+++ b/filters/error/Makefile.am
@@ -52,6 +52,7 @@ nbdkit_error_filter_la_LDFLAGS = \
$(NULL)
nbdkit_error_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/exitlast/Makefile.am b/filters/exitlast/Makefile.am
index 17603951..94f35f7b 100644
--- a/filters/exitlast/Makefile.am
+++ b/filters/exitlast/Makefile.am
@@ -42,6 +42,9 @@ nbdkit_exitlast_filter_la_SOURCES = \
nbdkit_exitlast_filter_la_CPPFLAGS = -I$(top_srcdir)/include
nbdkit_exitlast_filter_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_exitlast_filter_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_exitlast_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/filters/filters.syms \
diff --git a/filters/ext2/Makefile.am b/filters/ext2/Makefile.am
index b1fdcb8c..c73f963d 100644
--- a/filters/ext2/Makefile.am
+++ b/filters/ext2/Makefile.am
@@ -53,8 +53,9 @@ nbdkit_ext2_filter_la_CFLAGS = \
$(EXT2FS_CFLAGS) $(COM_ERR_CFLAGS) \
$(NULL)
nbdkit_ext2_filter_la_LIBADD = \
- $(EXT2FS_LIBS) $(COM_ERR_LIBS) \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(EXT2FS_LIBS) $(COM_ERR_LIBS) \
$(NULL)
nbdkit_ext2_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/filters/extentlist/Makefile.am b/filters/extentlist/Makefile.am
index 612fdfc8..66d3b306 100644
--- a/filters/extentlist/Makefile.am
+++ b/filters/extentlist/Makefile.am
@@ -52,6 +52,7 @@ nbdkit_extentlist_filter_la_LDFLAGS = \
$(NULL)
nbdkit_extentlist_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/fua/Makefile.am b/filters/fua/Makefile.am
index 9fd056df..8dfe53f9 100644
--- a/filters/fua/Makefile.am
+++ b/filters/fua/Makefile.am
@@ -44,6 +44,9 @@ nbdkit_fua_filter_la_CPPFLAGS = \
-I$(top_srcdir)/include \
$(NULL)
nbdkit_fua_filter_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_fua_filter_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_fua_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/filters/filters.syms \
diff --git a/filters/gzip/Makefile.am b/filters/gzip/Makefile.am
index d122c032..d571b820 100644
--- a/filters/gzip/Makefile.am
+++ b/filters/gzip/Makefile.am
@@ -53,6 +53,7 @@ nbdkit_gzip_filter_la_CFLAGS = \
$(NULL)
nbdkit_gzip_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(ZLIB_LIBS) \
$(NULL)
nbdkit_gzip_filter_la_LDFLAGS = \
diff --git a/filters/ip/Makefile.am b/filters/ip/Makefile.am
index 16d23057..d09cd1e0 100644
--- a/filters/ip/Makefile.am
+++ b/filters/ip/Makefile.am
@@ -52,6 +52,7 @@ nbdkit_ip_filter_la_LDFLAGS = \
$(NULL)
nbdkit_ip_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/limit/Makefile.am b/filters/limit/Makefile.am
index c721700c..b4951ace 100644
--- a/filters/limit/Makefile.am
+++ b/filters/limit/Makefile.am
@@ -51,6 +51,7 @@ nbdkit_limit_filter_la_LDFLAGS = \
$(NULL)
nbdkit_limit_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/log/Makefile.am b/filters/log/Makefile.am
index f2c4d813..a31d2a67 100644
--- a/filters/log/Makefile.am
+++ b/filters/log/Makefile.am
@@ -51,6 +51,7 @@ nbdkit_log_filter_la_LDFLAGS = \
$(NULL)
nbdkit_log_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/nocache/Makefile.am b/filters/nocache/Makefile.am
index c3cb35f7..aa9fee07 100644
--- a/filters/nocache/Makefile.am
+++ b/filters/nocache/Makefile.am
@@ -45,6 +45,9 @@ nbdkit_nocache_filter_la_CPPFLAGS = \
-I$(top_srcdir)/common/include \
$(NULL)
nbdkit_nocache_filter_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_nocache_filter_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_nocache_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/filters/filters.syms \
diff --git a/filters/noextents/Makefile.am b/filters/noextents/Makefile.am
index 81e826e9..c3aa1942 100644
--- a/filters/noextents/Makefile.am
+++ b/filters/noextents/Makefile.am
@@ -44,6 +44,9 @@ nbdkit_noextents_filter_la_CPPFLAGS = \
-I$(top_srcdir)/include \
$(NULL)
nbdkit_noextents_filter_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_noextents_filter_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_noextents_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/filters/filters.syms \
diff --git a/filters/nofilter/Makefile.am b/filters/nofilter/Makefile.am
index 77ebe33d..6781fe59 100644
--- a/filters/nofilter/Makefile.am
+++ b/filters/nofilter/Makefile.am
@@ -45,6 +45,9 @@ nbdkit_nofilter_filter_la_CPPFLAGS = \
-I$(top_srcdir)/common/include \
$(NULL)
nbdkit_nofilter_filter_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_nofilter_filter_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_nofilter_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/filters/filters.syms \
diff --git a/filters/noparallel/Makefile.am b/filters/noparallel/Makefile.am
index fc5a5522..1630deac 100644
--- a/filters/noparallel/Makefile.am
+++ b/filters/noparallel/Makefile.am
@@ -45,6 +45,9 @@ nbdkit_noparallel_filter_la_CPPFLAGS = \
-I$(top_srcdir)/common/include \
$(NULL)
nbdkit_noparallel_filter_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_noparallel_filter_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_noparallel_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/filters/filters.syms \
diff --git a/filters/nozero/Makefile.am b/filters/nozero/Makefile.am
index ab7abf44..628934b2 100644
--- a/filters/nozero/Makefile.am
+++ b/filters/nozero/Makefile.am
@@ -45,6 +45,9 @@ nbdkit_nozero_filter_la_CPPFLAGS = \
-I$(top_srcdir)/common/include \
$(NULL)
nbdkit_nozero_filter_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_nozero_filter_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_nozero_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/filters/filters.syms \
diff --git a/filters/offset/Makefile.am b/filters/offset/Makefile.am
index a579b8ce..5437e700 100644
--- a/filters/offset/Makefile.am
+++ b/filters/offset/Makefile.am
@@ -51,6 +51,7 @@ nbdkit_offset_filter_la_LDFLAGS = \
$(NULL)
nbdkit_offset_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/partition/Makefile.am b/filters/partition/Makefile.am
index 49e3e213..e8a20c68 100644
--- a/filters/partition/Makefile.am
+++ b/filters/partition/Makefile.am
@@ -56,6 +56,7 @@ nbdkit_partition_filter_la_LDFLAGS = \
$(NULL)
nbdkit_partition_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/pause/Makefile.am b/filters/pause/Makefile.am
index 3f83eb03..12600033 100644
--- a/filters/pause/Makefile.am
+++ b/filters/pause/Makefile.am
@@ -48,6 +48,7 @@ nbdkit_pause_filter_la_CPPFLAGS = \
nbdkit_pause_filter_la_CFLAGS = $(WARNINGS_CFLAGS)
nbdkit_pause_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
nbdkit_pause_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/filters/rate/Makefile.am b/filters/rate/Makefile.am
index 7f61ca44..f4cf414a 100644
--- a/filters/rate/Makefile.am
+++ b/filters/rate/Makefile.am
@@ -50,6 +50,7 @@ nbdkit_rate_filter_la_CPPFLAGS = \
nbdkit_rate_filter_la_CFLAGS = $(WARNINGS_CFLAGS)
nbdkit_rate_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
nbdkit_rate_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/filters/readahead/Makefile.am b/filters/readahead/Makefile.am
index 387750c2..3d2c507d 100644
--- a/filters/readahead/Makefile.am
+++ b/filters/readahead/Makefile.am
@@ -52,6 +52,7 @@ nbdkit_readahead_filter_la_LDFLAGS = \
$(NULL)
nbdkit_readahead_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/retry/Makefile.am b/filters/retry/Makefile.am
index 1011bff8..14d83cf1 100644
--- a/filters/retry/Makefile.am
+++ b/filters/retry/Makefile.am
@@ -52,6 +52,7 @@ nbdkit_retry_filter_la_LDFLAGS = \
$(NULL)
nbdkit_retry_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/stats/Makefile.am b/filters/stats/Makefile.am
index be06a08d..ccfeb3e7 100644
--- a/filters/stats/Makefile.am
+++ b/filters/stats/Makefile.am
@@ -52,6 +52,7 @@ nbdkit_stats_filter_la_LDFLAGS = \
$(NULL)
nbdkit_stats_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/swab/Makefile.am b/filters/swab/Makefile.am
index 7acaa6a6..07aefe88 100644
--- a/filters/swab/Makefile.am
+++ b/filters/swab/Makefile.am
@@ -57,6 +57,7 @@ nbdkit_swab_filter_la_LDFLAGS = \
$(NULL)
nbdkit_swab_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(GNUTLS_LIBS) \
$(NULL)
diff --git a/filters/tar/Makefile.am b/filters/tar/Makefile.am
index 30e973cc..897a5c3b 100644
--- a/filters/tar/Makefile.am
+++ b/filters/tar/Makefile.am
@@ -52,6 +52,7 @@ nbdkit_tar_filter_la_LDFLAGS = \
$(NULL)
nbdkit_tar_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/tls-fallback/Makefile.am b/filters/tls-fallback/Makefile.am
index 516c2ccf..530119d9 100644
--- a/filters/tls-fallback/Makefile.am
+++ b/filters/tls-fallback/Makefile.am
@@ -45,6 +45,9 @@ nbdkit_tls_fallback_filter_la_CPPFLAGS = \
-I$(top_srcdir)/common/include \
$(NULL)
nbdkit_tls_fallback_filter_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_tls_fallback_filter_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_tls_fallback_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/filters/filters.syms \
diff --git a/filters/truncate/Makefile.am b/filters/truncate/Makefile.am
index 3b3d6aca..3240e46d 100644
--- a/filters/truncate/Makefile.am
+++ b/filters/truncate/Makefile.am
@@ -52,6 +52,7 @@ nbdkit_truncate_filter_la_LDFLAGS = \
$(NULL)
nbdkit_truncate_filter_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/filters/xz/Makefile.am b/filters/xz/Makefile.am
index 63bbd1c5..ce6bc342 100644
--- a/filters/xz/Makefile.am
+++ b/filters/xz/Makefile.am
@@ -57,6 +57,7 @@ nbdkit_xz_filter_la_CFLAGS = \
nbdkit_xz_filter_la_LIBADD = \
$(LIBLZMA_LIBS) \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
nbdkit_xz_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/plugins/cc/Makefile.am b/plugins/cc/Makefile.am
index 82db7200..a624903d 100644
--- a/plugins/cc/Makefile.am
+++ b/plugins/cc/Makefile.am
@@ -54,6 +54,7 @@ nbdkit_cc_plugin_la_LDFLAGS = \
$(NULL)
nbdkit_cc_plugin_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(DL_LIBS) \
$(NULL)
diff --git a/plugins/cdi/Makefile.am b/plugins/cdi/Makefile.am
index 9ce98d5f..79c669bb 100644
--- a/plugins/cdi/Makefile.am
+++ b/plugins/cdi/Makefile.am
@@ -55,6 +55,7 @@ nbdkit_cdi_plugin_la_LDFLAGS = \
$(NULL)
nbdkit_cdi_plugin_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(JANSSON_LIBS) \
$(NULL)
diff --git a/plugins/curl/Makefile.am b/plugins/curl/Makefile.am
index 29183f03..d6a57a45 100644
--- a/plugins/curl/Makefile.am
+++ b/plugins/curl/Makefile.am
@@ -54,8 +54,9 @@ nbdkit_curl_plugin_la_CFLAGS = \
$(CURL_CFLAGS) \
$(NULL)
nbdkit_curl_plugin_la_LIBADD = \
- $(CURL_LIBS) \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(CURL_LIBS) \
$(NULL)
nbdkit_curl_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/plugins/data/Makefile.am b/plugins/data/Makefile.am
index 01e5eec6..0d219c5e 100644
--- a/plugins/data/Makefile.am
+++ b/plugins/data/Makefile.am
@@ -64,6 +64,7 @@ nbdkit_data_plugin_la_LIBADD = \
$(top_builddir)/common/allocators/liballocators.la \
$(top_builddir)/common/utils/libutils.la \
$(top_builddir)/common/replacements/libcompat.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(GNUTLS_LIBS) \
$(NULL)
diff --git a/plugins/eval/Makefile.am b/plugins/eval/Makefile.am
index 4ea8d7d4..762c0b24 100644
--- a/plugins/eval/Makefile.am
+++ b/plugins/eval/Makefile.am
@@ -65,6 +65,7 @@ nbdkit_eval_plugin_la_CPPFLAGS = \
nbdkit_eval_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
nbdkit_eval_plugin_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
nbdkit_eval_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/plugins/example1/Makefile.am b/plugins/example1/Makefile.am
index 450b367f..390333df 100644
--- a/plugins/example1/Makefile.am
+++ b/plugins/example1/Makefile.am
@@ -44,6 +44,9 @@ nbdkit_example1_plugin_la_CPPFLAGS = \
-I$(top_srcdir)/include \
$(NULL)
nbdkit_example1_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_example1_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_example1_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
diff --git a/plugins/example2/Makefile.am b/plugins/example2/Makefile.am
index 41fe1378..7a392567 100644
--- a/plugins/example2/Makefile.am
+++ b/plugins/example2/Makefile.am
@@ -44,6 +44,9 @@ nbdkit_example2_plugin_la_CPPFLAGS = \
-I$(top_srcdir)/include \
$(NULL)
nbdkit_example2_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_example2_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_example2_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
diff --git a/plugins/example3/Makefile.am b/plugins/example3/Makefile.am
index e721896e..092787eb 100644
--- a/plugins/example3/Makefile.am
+++ b/plugins/example3/Makefile.am
@@ -44,6 +44,9 @@ nbdkit_example3_plugin_la_CPPFLAGS = \
-I$(top_srcdir)/include \
$(NULL)
nbdkit_example3_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_example3_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_example3_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
diff --git a/plugins/file/Makefile.am b/plugins/file/Makefile.am
index ae72a9c4..a067d0fc 100644
--- a/plugins/file/Makefile.am
+++ b/plugins/file/Makefile.am
@@ -52,6 +52,7 @@ nbdkit_file_plugin_la_LDFLAGS = \
$(NULL)
nbdkit_file_plugin_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/plugins/floppy/Makefile.am b/plugins/floppy/Makefile.am
index c788382c..468f93b6 100644
--- a/plugins/floppy/Makefile.am
+++ b/plugins/floppy/Makefile.am
@@ -61,6 +61,7 @@ nbdkit_floppy_plugin_la_LDFLAGS = \
nbdkit_floppy_plugin_la_LIBADD = \
$(top_builddir)/common/regions/libregions.la \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/plugins/full/Makefile.am b/plugins/full/Makefile.am
index 97101d18..e93a4f12 100644
--- a/plugins/full/Makefile.am
+++ b/plugins/full/Makefile.am
@@ -44,6 +44,9 @@ nbdkit_full_plugin_la_CPPFLAGS = \
-I$(top_srcdir)/include \
$(NULL)
nbdkit_full_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_full_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_full_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
diff --git a/plugins/guestfs/Makefile.am b/plugins/guestfs/Makefile.am
index ab54daf1..efbffb50 100644
--- a/plugins/guestfs/Makefile.am
+++ b/plugins/guestfs/Makefile.am
@@ -51,8 +51,9 @@ nbdkit_guestfs_plugin_la_CFLAGS = \
$(LIBGUESTFS_CFLAGS) \
$(NULL)
nbdkit_guestfs_plugin_la_LIBADD = \
- $(LIBGUESTFS_LIBS) \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(LIBGUESTFS_LIBS) \
$(NULL)
nbdkit_guestfs_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/plugins/gzip/Makefile.am b/plugins/gzip/Makefile.am
index ea8bc480..2c128d57 100644
--- a/plugins/gzip/Makefile.am
+++ b/plugins/gzip/Makefile.am
@@ -50,6 +50,7 @@ nbdkit_gzip_plugin_la_CFLAGS = \
$(ZLIB_CFLAGS) \
$(NULL)
nbdkit_gzip_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(ZLIB_LIBS) \
$(NULL)
nbdkit_gzip_plugin_la_LDFLAGS = \
diff --git a/plugins/info/Makefile.am b/plugins/info/Makefile.am
index dc55d93c..e54d727c 100644
--- a/plugins/info/Makefile.am
+++ b/plugins/info/Makefile.am
@@ -53,6 +53,7 @@ nbdkit_info_plugin_la_LDFLAGS = \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
$(NULL)
nbdkit_info_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(GNUTLS_LIBS) \
$(NULL)
diff --git a/plugins/iso/Makefile.am b/plugins/iso/Makefile.am
index 1f1f8416..7c05548e 100644
--- a/plugins/iso/Makefile.am
+++ b/plugins/iso/Makefile.am
@@ -54,6 +54,7 @@ nbdkit_iso_plugin_la_LDFLAGS = \
$(NULL)
nbdkit_iso_plugin_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/plugins/libvirt/Makefile.am b/plugins/libvirt/Makefile.am
index e750e544..5b19b2e3 100644
--- a/plugins/libvirt/Makefile.am
+++ b/plugins/libvirt/Makefile.am
@@ -50,6 +50,7 @@ nbdkit_libvirt_plugin_la_CFLAGS = \
$(LIBVIRT_CFLAGS) \
$(NULL)
nbdkit_libvirt_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(LIBVIRT_LIBS) \
$(NULL)
nbdkit_libvirt_plugin_la_LDFLAGS = \
diff --git a/plugins/linuxdisk/Makefile.am b/plugins/linuxdisk/Makefile.am
index 7557ee5e..20579bb5 100644
--- a/plugins/linuxdisk/Makefile.am
+++ b/plugins/linuxdisk/Makefile.am
@@ -58,6 +58,7 @@ nbdkit_linuxdisk_plugin_la_LIBADD = \
$(top_builddir)/common/gpt/libgpt.la \
$(top_builddir)/common/regions/libregions.la \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
nbdkit_linuxdisk_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/plugins/lua/Makefile.am b/plugins/lua/Makefile.am
index c799de9d..36f6f6d2 100644
--- a/plugins/lua/Makefile.am
+++ b/plugins/lua/Makefile.am
@@ -52,6 +52,9 @@ nbdkit_lua_plugin_la_CFLAGS = \
$(WARNINGS_CFLAGS) \
$(LUA_CFLAGS) \
$(NULL)
+nbdkit_lua_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_lua_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
diff --git a/plugins/memory/Makefile.am b/plugins/memory/Makefile.am
index 5915baf4..ab0f3a0d 100644
--- a/plugins/memory/Makefile.am
+++ b/plugins/memory/Makefile.am
@@ -55,6 +55,7 @@ nbdkit_memory_plugin_la_LIBADD = \
$(top_builddir)/common/allocators/liballocators.la \
$(top_builddir)/common/replacements/libcompat.la \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/plugins/nbd/Makefile.am b/plugins/nbd/Makefile.am
index 671ae678..1af1fac4 100644
--- a/plugins/nbd/Makefile.am
+++ b/plugins/nbd/Makefile.am
@@ -58,6 +58,7 @@ nbdkit_nbd_plugin_la_LDFLAGS = \
$(NULL)
nbdkit_nbd_plugin_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(LIBNBD_LIBS) \
$(NULL)
diff --git a/plugins/null/Makefile.am b/plugins/null/Makefile.am
index b07a70a4..9fbe9330 100644
--- a/plugins/null/Makefile.am
+++ b/plugins/null/Makefile.am
@@ -44,6 +44,9 @@ nbdkit_null_plugin_la_CPPFLAGS = \
-I$(top_srcdir)/include \
$(NULL)
nbdkit_null_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_null_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_null_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
diff --git a/plugins/ondemand/Makefile.am b/plugins/ondemand/Makefile.am
index 423ac7ae..6312f4b1 100644
--- a/plugins/ondemand/Makefile.am
+++ b/plugins/ondemand/Makefile.am
@@ -66,6 +66,7 @@ nbdkit_ondemand_plugin_la_LDFLAGS = \
$(NULL)
nbdkit_ondemand_plugin_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/plugins/partitioning/Makefile.am b/plugins/partitioning/Makefile.am
index 9540d6f6..80f461f3 100644
--- a/plugins/partitioning/Makefile.am
+++ b/plugins/partitioning/Makefile.am
@@ -63,6 +63,7 @@ nbdkit_partitioning_plugin_la_LIBADD = \
$(top_builddir)/common/regions/libregions.la \
$(top_builddir)/common/utils/libutils.la \
$(top_builddir)/common/replacements/libcompat.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/plugins/pattern/Makefile.am b/plugins/pattern/Makefile.am
index dfbbdafa..9935b50a 100644
--- a/plugins/pattern/Makefile.am
+++ b/plugins/pattern/Makefile.am
@@ -45,6 +45,9 @@ nbdkit_pattern_plugin_la_CPPFLAGS = \
-I$(top_srcdir)/common/include \
$(NULL)
nbdkit_pattern_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_pattern_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_pattern_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
diff --git a/plugins/perl/Makefile.am b/plugins/perl/Makefile.am
index 858ea258..89fe733e 100644
--- a/plugins/perl/Makefile.am
+++ b/plugins/perl/Makefile.am
@@ -56,6 +56,7 @@ nbdkit_perl_plugin_la_CFLAGS = \
$(NULL)
nbdkit_perl_plugin_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
nbdkit_perl_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/plugins/python/Makefile.am b/plugins/python/Makefile.am
index b34d0394..e6153d17 100644
--- a/plugins/python/Makefile.am
+++ b/plugins/python/Makefile.am
@@ -58,8 +58,9 @@ nbdkit_python_plugin_la_CFLAGS = \
$(PYTHON_CFLAGS) \
$(NULL)
nbdkit_python_plugin_la_LIBADD = \
- $(PYTHON_LIBS) \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(PYTHON_LIBS) \
$(NULL)
nbdkit_python_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/plugins/random/Makefile.am b/plugins/random/Makefile.am
index cb58831f..35443053 100644
--- a/plugins/random/Makefile.am
+++ b/plugins/random/Makefile.am
@@ -45,6 +45,9 @@ nbdkit_random_plugin_la_CPPFLAGS = \
-I$(top_srcdir)/include \
$(NULL)
nbdkit_random_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_random_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_random_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
diff --git a/plugins/ruby/Makefile.am b/plugins/ruby/Makefile.am
index c435ff0e..1bd3fad3 100644
--- a/plugins/ruby/Makefile.am
+++ b/plugins/ruby/Makefile.am
@@ -53,6 +53,7 @@ nbdkit_ruby_plugin_la_CFLAGS = \
$(RUBY_CFLAGS) \
$(NULL)
nbdkit_ruby_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(RUBY_LIBS) \
$(NULL)
nbdkit_ruby_plugin_la_LDFLAGS = \
diff --git a/plugins/sh/Makefile.am b/plugins/sh/Makefile.am
index 77a3abde..90cf2617 100644
--- a/plugins/sh/Makefile.am
+++ b/plugins/sh/Makefile.am
@@ -56,6 +56,7 @@ nbdkit_sh_plugin_la_CPPFLAGS = \
nbdkit_sh_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
nbdkit_sh_plugin_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
nbdkit_sh_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/plugins/split/Makefile.am b/plugins/split/Makefile.am
index 209d669b..7c09d036 100644
--- a/plugins/split/Makefile.am
+++ b/plugins/split/Makefile.am
@@ -51,6 +51,7 @@ nbdkit_split_plugin_la_LDFLAGS = \
$(NULL)
nbdkit_split_plugin_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(NULL)
if HAVE_POD
diff --git a/plugins/ssh/Makefile.am b/plugins/ssh/Makefile.am
index 8b2e9293..4149e8e1 100644
--- a/plugins/ssh/Makefile.am
+++ b/plugins/ssh/Makefile.am
@@ -52,8 +52,9 @@ nbdkit_ssh_plugin_la_CFLAGS = \
$(SSH_CFLAGS) \
$(NULL)
nbdkit_ssh_plugin_la_LIBADD = \
- $(SSH_LIBS) \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(SSH_LIBS) \
$(NULL)
nbdkit_ssh_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
diff --git a/plugins/streaming/Makefile.am b/plugins/streaming/Makefile.am
index 7cb7e509..d18d77c7 100644
--- a/plugins/streaming/Makefile.am
+++ b/plugins/streaming/Makefile.am
@@ -44,6 +44,9 @@ nbdkit_streaming_plugin_la_CPPFLAGS = \
-I$(top_srcdir)/include \
$(NULL)
nbdkit_streaming_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_streaming_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_streaming_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
diff --git a/plugins/tar/Makefile.am b/plugins/tar/Makefile.am
index 88909189..7ca941c9 100644
--- a/plugins/tar/Makefile.am
+++ b/plugins/tar/Makefile.am
@@ -46,13 +46,14 @@ nbdkit_tar_plugin_la_CPPFLAGS = \
-I. \
$(NULL)
nbdkit_tar_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_tar_plugin_la_LIBADD = \
+ $(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_tar_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
$(NULL)
-nbdkit_tar_plugin_la_LIBADD = \
- $(top_builddir)/common/utils/libutils.la \
- $(NULL)
if HAVE_POD
diff --git a/plugins/tcl/Makefile.am b/plugins/tcl/Makefile.am
index 91243dd5..9b5989f0 100644
--- a/plugins/tcl/Makefile.am
+++ b/plugins/tcl/Makefile.am
@@ -53,6 +53,7 @@ nbdkit_tcl_plugin_la_CFLAGS = \
$(TCL_CFLAGS) \
$(NULL)
nbdkit_tcl_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(TCL_LIBS) \
$(NULL)
nbdkit_tcl_plugin_la_LDFLAGS = \
diff --git a/plugins/tmpdisk/Makefile.am b/plugins/tmpdisk/Makefile.am
index 69ae85e0..b1e045b1 100644
--- a/plugins/tmpdisk/Makefile.am
+++ b/plugins/tmpdisk/Makefile.am
@@ -60,13 +60,14 @@ nbdkit_tmpdisk_plugin_la_CPPFLAGS = \
-I$(top_srcdir)/common/utils \
$(NULL)
nbdkit_tmpdisk_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_tmpdisk_plugin_la_LIBADD = \
+ $(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_tmpdisk_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
$(NULL)
-nbdkit_tmpdisk_plugin_la_LIBADD = \
- $(top_builddir)/common/utils/libutils.la \
- $(NULL)
if HAVE_POD
diff --git a/plugins/torrent/Makefile.am b/plugins/torrent/Makefile.am
index 0097813a..22ca9e9c 100644
--- a/plugins/torrent/Makefile.am
+++ b/plugins/torrent/Makefile.am
@@ -53,14 +53,15 @@ nbdkit_torrent_plugin_la_CFLAGS = \
$(PTHREAD_CFLAGS) \
$(LIBTORRENT_CFLAGS) \
$(NULL)
-nbdkit_torrent_plugin_la_LDFLAGS = \
- -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
- -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
- $(NULL)
nbdkit_torrent_plugin_la_LIBADD = \
+ $(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(PTHREAD_LIBS) \
$(LIBTORRENT_LIBS) \
- $(top_builddir)/common/utils/libutils.la \
+ $(NULL)
+nbdkit_torrent_plugin_la_LDFLAGS = \
+ -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
+ -Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
$(NULL)
if HAVE_POD
diff --git a/plugins/vddk/Makefile.am b/plugins/vddk/Makefile.am
index 9902d93c..e334d46d 100644
--- a/plugins/vddk/Makefile.am
+++ b/plugins/vddk/Makefile.am
@@ -58,6 +58,7 @@ nbdkit_vddk_plugin_la_CPPFLAGS = \
nbdkit_vddk_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
nbdkit_vddk_plugin_la_LIBADD = \
$(top_builddir)/common/utils/libutils.la \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
$(DL_LIBS) \
$(NULL)
nbdkit_vddk_plugin_la_LDFLAGS = \
diff --git a/plugins/zero/Makefile.am b/plugins/zero/Makefile.am
index 0ec1c396..7b414f4f 100644
--- a/plugins/zero/Makefile.am
+++ b/plugins/zero/Makefile.am
@@ -43,6 +43,9 @@ nbdkit_zero_plugin_la_SOURCES = \
nbdkit_zero_plugin_la_CPPFLAGS = \
-I$(top_srcdir)/include
nbdkit_zero_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
+nbdkit_zero_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
nbdkit_zero_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \
-Wl,--version-script=$(top_srcdir)/plugins/plugins.syms \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2db56ded..516b5a40 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -268,6 +268,9 @@ test_stdio_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
test_stdio_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) -rpath /nowhere \
$(NULL)
+test_stdio_plugin_la_LIBADD = \
+ $(IMPORT_LIBRARY_ON_WINDOWS) \
+ $(NULL)
# check_LTLIBRARIES won't build a shared library (see automake manual).
# So we have to do this and add a dependency.
@@ -287,6 +290,7 @@ test_flush_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
test_flush_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) -rpath /nowhere \
$(NULL)
+test_flush_plugin_la_LIBADD = $(IMPORT_LIBRARY_ON_WINDOWS)
# check_LTLIBRARIES won't build a shared library (see automake manual).
# So we have to do this and add a dependency.
@@ -306,6 +310,7 @@ test_shutdown_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
test_shutdown_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) -rpath /nowhere \
$(NULL)
+test_shutdown_plugin_la_LIBADD = $(IMPORT_LIBRARY_ON_WINDOWS)
endif HAVE_PLUGINS
@@ -360,6 +365,7 @@ test_ansi_c_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
test_ansi_c_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) -rpath /nowhere \
$(NULL)
+test_ansi_c_plugin_la_LIBADD = $(IMPORT_LIBRARY_ON_WINDOWS)
endif CAN_TEST_ANSI_C
if HAVE_CXX
@@ -385,6 +391,7 @@ test_cxx_plugin_la_CXXFLAGS = $(WARNINGS_CFLAGS)
test_cxx_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) -rpath /nowhere \
$(NULL)
+test_cxx_plugin_la_LIBADD = $(IMPORT_LIBRARY_ON_WINDOWS)
test_cxx_filter_la_SOURCES = \
test-cxx-filter.cpp \
@@ -399,6 +406,7 @@ test_cxx_filter_la_CXXFLAGS = $(WARNINGS_CFLAGS)
test_cxx_filter_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) -rpath /nowhere \
$(NULL)
+test_cxx_filter_la_LIBADD = $(IMPORT_LIBRARY_ON_WINDOWS)
endif HAVE_CXX
# Exit with parent test.
@@ -1227,6 +1235,7 @@ test_layers_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
test_layers_plugin_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) -rpath /nowhere \
$(NULL)
+test_layers_plugin_la_LIBADD = $(IMPORT_LIBRARY_ON_WINDOWS)
test_layers_filter1_la_SOURCES = \
test-layers-filter.c \
@@ -1239,6 +1248,7 @@ test_layers_filter1_la_CFLAGS = $(WARNINGS_CFLAGS)
-Dlayer='"filter1"'
test_layers_filter1_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) -rpath /nowhere \
$(NULL)
+test_layers_filter1_la_LIBADD = $(IMPORT_LIBRARY_ON_WINDOWS)
test_layers_filter2_la_SOURCES = \
test-layers-filter.c \
@@ -1251,6 +1261,7 @@ test_layers_filter2_la_CFLAGS = $(WARNINGS_CFLAGS)
-Dlayer='"filter2"'
test_layers_filter2_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) -rpath /nowhere \
$(NULL)
+test_layers_filter2_la_LIBADD = $(IMPORT_LIBRARY_ON_WINDOWS)
test_layers_filter3_la_SOURCES = \
test-layers-filter.c \
@@ -1263,6 +1274,7 @@ test_layers_filter3_la_CFLAGS = $(WARNINGS_CFLAGS)
-Dlayer='"filter3"'
test_layers_filter3_la_LDFLAGS = \
-module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) -rpath /nowhere \
$(NULL)
+test_layers_filter3_la_LIBADD = $(IMPORT_LIBRARY_ON_WINDOWS)
# blocksize filter test.
TESTS += test-blocksize.sh test-blocksize-extents.sh
--
2.27.0