]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Don't export symbols from static object files on Windows.
authorBruno Haible <bruno@clisp.org>
Wed, 6 Sep 2023 19:13:25 +0000 (21:13 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 6 Sep 2023 23:41:06 +0000 (01:41 +0200)
* gettext-tools/configure.ac (DLL_VARIABLE): Test DLL_EXPORT, not WOE32DLL.
(WOE32DLL): Don't define as a C macro.
* gettext-runtime/configure.ac: Likewise.
(DLL_VARIABLE): Drop special assumption regarding 'exit_failure'.

gettext-runtime/configure.ac
gettext-tools/configure.ac

index e88a231f2b11a273038f8c7dad740bf1bee762a8..35b020fec3d642be4819487965b6ff5a21c93224 100644 (file)
@@ -132,17 +132,16 @@ else
   is_woe32dll=no
 fi
 AM_CONDITIONAL([WOE32DLL], [test $is_woe32dll = yes])
-if test $is_woe32dll = yes; then
-  AC_DEFINE([WOE32DLL], [1],
-    [Define when --enable-shared is used on Windows.])
-fi
 
 dnl Put some default definitions into config.h.
 AH_BOTTOM([
 /* On Windows, variables that may be in a DLL must be marked specially.
-   But here, the only such variable is 'exit_failure', and it is always
-   built into a static library, never into a shared library.  */
-#if defined WOE32DLL && !defined IN_RELOCWRAPPER && 0
+   The symbols marked with DLL_VARIABLE should be exported if and only if the
+   object file gets included in a DLL.  Libtool, on Windows platforms, defines
+   the C macro DLL_EXPORT (together with PIC) when compiling for a DLL
+   and does not define it when compiling an object file meant to be linked
+   statically into some executable.  */
+#if (defined _WIN32 || defined __CYGWIN__) && defined DLL_EXPORT && !defined IN_RELOCWRAPPER
 # define DLL_VARIABLE __declspec (dllimport)
 #else
 # define DLL_VARIABLE
index e4c9783ebea3623c336e652058b0f0a6062d3444..9a543d4e6d497a1c8a9be40cee1f7eb827e65c08 100644 (file)
@@ -280,10 +280,6 @@ else
   is_woe32dll=no
 fi
 AM_CONDITIONAL([WOE32DLL], [test $is_woe32dll = yes])
-if test $is_woe32dll = yes; then
-  AC_DEFINE([WOE32DLL], [1],
-    [Define when --enable-shared is used on Windows.])
-fi
 
 GETTEXTLIB_EXPORTS_FLAGS=
 dnl woe32dll/gettextlib-exports.c needs to know whether the getopt facility
@@ -339,8 +335,13 @@ AH_BOTTOM([
    wrap the file position (#:) comments.  */
 #define PAGE_WIDTH 79
 
-/* On Windows, variables that may be in a DLL must be marked specially.  */
-#if defined WOE32DLL && !defined IN_RELOCWRAPPER
+/* On Windows, variables that may be in a DLL must be marked specially.
+   The symbols marked with DLL_VARIABLE should be exported if and only if the
+   object file gets included in a DLL.  Libtool, on Windows platforms, defines
+   the C macro DLL_EXPORT (together with PIC) when compiling for a DLL
+   and does not define it when compiling an object file meant to be linked
+   statically into some executable.  */
+#if (defined _WIN32 || defined __CYGWIN__) && defined DLL_EXPORT && !defined IN_RELOCWRAPPER
 # define DLL_VARIABLE __declspec (dllimport)
 #else
 # define DLL_VARIABLE