]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
build: Simplify handling of exported symbols on Windows, part 2.
authorBruno Haible <bruno@clisp.org>
Sun, 8 Jun 2025 21:09:37 +0000 (23:09 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 8 Jun 2025 21:09:37 +0000 (23:09 +0200)
* gettext-tools/configure.ac (WINDOWS_MSVC): New conditional.
* gnulib-local/modules/gettext-tools-misc (Makefile.am): Re-add the
--export-all-symbols linker option.
* gettext-tools/src/Makefile.am (libgettextsrc_la_LDFLAGS): Re-add the
--export-all-symbols linker option.

gettext-tools/configure.ac
gettext-tools/src/Makefile.am
gnulib-local/modules/gettext-tools-misc

index 227f8cc5220830a4ee99af116212d798168c2108..3d327258d0808988daff7a152ecab024a0420df9 100644 (file)
@@ -178,6 +178,21 @@ case "$host_os" in
 esac
 AM_CONDITIONAL([WINDOWS_NATIVE], [test $is_windows_native = yes])
 
+dnl Linking a shared library works slightly differently on MSVC than on
+dnl Cygwin and mingw.
+is_msvc=false
+case "$host_os" in
+  windows*-msvc*) is_msvc=true ;;
+  mingw* | windows*)
+    AC_EGREP_CPP([Special], [
+#ifdef _MSC_VER
+ Special
+#endif
+], [is_msvc=true])
+    ;;
+esac
+gl_CONDITIONAL([WINDOWS_MSVC], [$is_msvc])
+
 dnl Package-private libraries do not need to be installed when we build only
 dnl static libraries. Don't install them in this case. This avoids a build
 dnl error on AIX with --enable-shared, when some other version of GNU gettext,
index 895e28a07ca217588c7e50307c78699908b76e84..eeae86aeb68a0d411c7b468197af8618d2ad5e7b 100644 (file)
@@ -463,6 +463,13 @@ libgettextsrc_la_CPPFLAGS = $(AM_CPPFLAGS) $(INCXML)
 # Needed for the expansion of LIBGETTEXTSRC_DLL_VARIABLE on MSVC.
 libgettextsrc_la_CPPFLAGS += -DIN_LIBGETTEXTSRC
 
+# Tell the mingw or Cygwin linker which symbols to export.
+if WOE32DLL
+if !WINDOWS_MSVC
+libgettextsrc_la_LDFLAGS += -Wl,--export-all-symbols
+endif
+endif
+
 # Specify installation directory, for --enable-relocatable.
 if RELOCATABLE_VIA_LD
 # This is needed, because libgettextsrc depends on libgettextlib and libintl.
index 29cac66ef540e496a2668a1d30da59e029d9d736..b6c9a725d4351e3d3b176296858617cb3e037fe4 100644 (file)
@@ -29,6 +29,13 @@ endif
 
 lib_LDFLAGS += -release @VERSION@
 
+# Tell the mingw or Cygwin linker which symbols to export.
+if WOE32DLL
+if !WINDOWS_MSVC
+lib_LDFLAGS += -Wl,--export-all-symbols
+endif
+endif
+
 Include:
 
 License: