From: Bruno Haible Date: Sun, 8 Jun 2025 21:09:37 +0000 (+0200) Subject: build: Simplify handling of exported symbols on Windows, part 2. X-Git-Tag: v0.26~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3dbf4a9b3b11c5f5ec9a697c6c637354ff38c4c5;p=thirdparty%2Fgettext.git build: Simplify handling of exported symbols on Windows, part 2. * 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. --- diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac index 227f8cc52..3d327258d 100644 --- a/gettext-tools/configure.ac +++ b/gettext-tools/configure.ac @@ -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, diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am index 895e28a07..eeae86aeb 100644 --- a/gettext-tools/src/Makefile.am +++ b/gettext-tools/src/Makefile.am @@ -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. diff --git a/gnulib-local/modules/gettext-tools-misc b/gnulib-local/modules/gettext-tools-misc index 29cac66ef..b6c9a725d 100644 --- a/gnulib-local/modules/gettext-tools-misc +++ b/gnulib-local/modules/gettext-tools-misc @@ -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: