From fe32a79d354dfc7f341dbfdd6b8f0d408bd76e5b Mon Sep 17 00:00:00 2001 From: fanquake Date: Thu, 2 Dec 2021 11:44:13 +0800 Subject: [PATCH 1/2] build: pass win32-dll to LT_INIT This is the recommended way to support building PE DLLs with modern mingw toolchains and libtool. > This option should be used if the package has been ported to build clean > dlls on win32 platforms. > If this macro is not used, libtool will assume that the package libraries > are not dll clean and will build only static libraries on win32 hosts. See: https://www.gnu.org/software/libtool/manual/libtool.html#LT_005fINIT https://www.gnu.org/software/gnulib/manual/html_node/Libtool-and-Windows.html https://autotools.io/libtool/windows.html --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c3c213a01c..01fbbe6341 100644 --- a/configure.ac +++ b/configure.ac @@ -8,7 +8,7 @@ AH_TOP([#define LIBSECP256K1_CONFIG_H]) AH_BOTTOM([#endif /*LIBSECP256K1_CONFIG_H*/]) AM_INIT_AUTOMAKE([foreign subdir-objects]) -LT_INIT +LT_INIT([win32-dll]) # Make the compilation flags quiet unless V=1 is used. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) From c0cd7de6d4e497c0e678f7098079727188e81de8 Mon Sep 17 00:00:00 2001 From: fanquake Date: Thu, 2 Dec 2021 11:48:43 +0800 Subject: [PATCH 2/2] build: add -no-undefined to libtool LDFLAGS Instruct libtool to not allow undefined symbols when linking a shared library. See: https://autotools.io/libtool/windows.html https://www.gnu.org/software/libtool/manual/libtool.html#LT_005fINIT https://www.gnu.org/software/gnulib/manual/html_node/Libtool-and-Windows.html --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index aa8014f5b6..6c9868c111 100644 --- a/Makefile.am +++ b/Makefile.am @@ -74,6 +74,7 @@ endif libsecp256k1_la_SOURCES = src/secp256k1.c libsecp256k1_la_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES) libsecp256k1_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB) +libsecp256k1_la_LDFLAGS = -no-undefined if VALGRIND_ENABLED libsecp256k1_la_CPPFLAGS += -DVALGRIND