[PATCH] Cygwin needs -no-undefined libtool flag.

Michael Haubenwallner michael.haubenwallner at ssi-schaefer.com
Mon Mar 6 18:04:12 CET 2017


* configure.ac: Set AM_CONDITIONAL(HAVE_UNDEFINED_SYMS) for mingw32 and
cygwin systems.
* src/Makefile.am: Use -no-undefined libtool flag when we do not
HAVE_UNDEFINED_SYMS, instead of when we HAVE_W32_SYSTEM only.

Cygwin is not a "real" Win32 system, but uses the Win32 binary format,
so libtool needs the -no-undefined flag.
---
 configure.ac    | 8 ++++++++
 src/Makefile.am | 8 ++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index a44f0c8..17a6392 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,17 +85,24 @@ AC_GNU_SOURCE
 have_w32_system=no
 have_w64_system=no
 have_w32ce_system=no
+have_undefined_syms=yes
 case "${host}" in
     x86_64-*mingw32*)
         have_w32_system=yes
         have_w64_system=yes
+        have_undefined_syms=no
         ;;
     *-mingw32ce*)
         have_w32_system=yes
         have_w32ce_system=yes
+        have_undefined_syms=no
         ;;
     *-mingw32*)
         have_w32_system=yes
+        have_undefined_syms=no
+        ;;
+    *-cygwin*)
+        have_undefined_syms=no
         ;;
     *)
        ;;
@@ -495,6 +502,7 @@ fi
 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
 AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
+AM_CONDITIONAL(HAVE_UNDEFINED_SYMS, test "$have_undefined_syms" = yes)
 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
 AM_CONDITIONAL(FORCE_USE_SYSCFG, test x$force_use_syscfg = xyes)
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 398ec5e..63710de 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -120,7 +120,6 @@ SUFFIXES = .rc .lo
 	$(LTRCCOMPILE) -i "$<" -o "$@"
 
 gpg_error_res = versioninfo.lo
-no_undefined = -no-undefined
 export_symbols = -export-symbols gpg-error.def
 # i686-w64-mingw32.gcc version 4.9.1 takes the long long helper
 # functions from libgcc_s_sjlj-1.dll and not from a static libgcc.  As
@@ -149,7 +148,6 @@ else
 #
 arch_sources = posix-lock.c posix-lock-obj.h posix-thread.c
 gpg_error_res =
-no_undefined =
 export_symbols =
 extra_ltoptions =
 
@@ -163,6 +161,12 @@ endif
 # }}} End Unix part
 #
 
+if HAVE_UNDEFINED_SYMS
+no_undefined =
+else
+no_undefined = -no-undefined
+endif
+
 if HAVE_LD_VERSION_SCRIPT
   libgpg_error_vers_opt = -Wl,--version-script=$(srcdir)/gpg-error.vers
 else
-- 
2.10.2




More information about the Gnupg-devel mailing list