This patch makes it possible to use Gnulib libunistring modules that
define variables (such as uninorm/nfc, uninorm/nfd) in libraries
and build these libraries with --enable-shared on MSVC.


2025-06-05  Bruno Haible  <br...@clisp.org>

        unictype/base, uninorm/base, etc.: Support shared libraries on MSVC.
        * m4/libunistring-base.m4 (gl_LIBUNISTRING_MODULE_WITH_VARIABLE): Use
        the value of
        ${module_indicator_prefix}_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME.

diff --git a/m4/libunistring-base.m4 b/m4/libunistring-base.m4
index e136344292..9b5795ed55 100644
--- a/m4/libunistring-base.m4
+++ b/m4/libunistring-base.m4
@@ -1,5 +1,5 @@
 # libunistring-base.m4
-# serial 9
+# serial 10
 dnl Copyright (C) 2010-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -41,8 +41,10 @@ AC_DEFUN([gl_LIBUNISTRING_MODULE]
 dnl     when the .h files get installed.)
 dnl   - When building gnulib or application code it expands to
 dnl       - LIBUNISTRING_DLL_VARIABLE by default,
-dnl       - empty if the automake conditional LIBUNISTRING_COMPILE_$MODULE
-dnl         evaluates to true.
+dnl       - if the automake conditional LIBUNISTRING_COMPILE_$MODULE evaluates
+dnl         to true: the value of
+dnl         ${module_indicator_prefix}_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME
+dnl         (which usually is empty, unless explicitly set in configure.ac).
 dnl     (This is necessary because when the conditional evaluates to false,
 dnl     the application code expects to use the declared variable from the
 dnl     installed libunistring; it's in this case that the
@@ -56,7 +58,7 @@ AC_DEFUN([gl_LIBUNISTRING_MODULE_WITH_VARIABLE]
   gl_LIBUNISTRING_MODULE([$1], [$2])
   m4_ifndef([gl_IN_LIBUNISTRING],
     [if test -z "${AS_TR_CPP([LIBUNISTRING_COMPILE_$2])_TRUE}"; then
-       GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]AS_TR_CPP([$2_DLL_VARIABLE])=
+       
GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]AS_TR_CPP([$2_DLL_VARIABLE])=$GL_MODULE_INDICATOR_PREFIX[]_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME
      fi
     ])
 ])




Reply via email to