Another tweak of this module: Add the ability to rely on the lock defined
in another library. This makes it possible to avoid a link error regarding
libgettextpo and libintl on Windows.


2019-12-24  Bruno Haible  <br...@clisp.org>

        setlocale-null: Make it easy to rely on the lock in another library.
        * lib/setlocale-lock.c: Do not define anything if OMIT_SETLOCALE_LOCK is
        defined.

diff --git -w a/lib/setlocale-lock.c b/lib/setlocale-lock.c
index 60c1ba3..a71ba64 100644
--- a/lib/setlocale-lock.c
+++ b/lib/setlocale-lock.c
@@ -18,6 +18,16 @@
 
 #include <config.h>
 
+/* When it is known that the gl_get_setlocale_null_lock function is defined
+   by a dependency library, it should not be defined here.  */
+#if OMIT_SETLOCALE_LOCK
+
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+
+#else
+
 /* This file defines the internal lock used by setlocale_null_r.
    It is a separate compilation unit, so that only one copy of it is
    present when linking statically.  */
@@ -136,3 +146,5 @@ gl_get_setlocale_null_lock (void)
 #  endif
 void * IMP(gl_get_setlocale_null_lock) = &gl_get_setlocale_null_lock;
 # endif
+
+#endif


Reply via email to