]> Savannah Git Hosting - gnulib.git/commitdiff
duplocale: Fix compilation error on Haiku (regression 2023-01-22).
authorBruno Haible <bruno@clisp.org>
Wed, 5 Apr 2023 00:36:02 +0000 (02:36 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 5 Apr 2023 00:36:02 +0000 (02:36 +0200)
* lib/locale.in.h (duplocale): If HAVE_DUPLOCALE = 0, don't declare it,
even if REPLACE_DUPLOCALE = 1.
* modules/duplocale (Depends-on, configure.ac): Don't compile a
replacement if HAVE_DUPLOCALE = 0 and REPLACE_DUPLOCALE = 1.

ChangeLog
lib/locale.in.h
modules/duplocale

index 8697719bacf1bcb7349c867026a56150f87d6b08..ea83bf3dd5472bf9e87e54cf31fd5b070938ffc5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-04-04  Bruno Haible  <bruno@clisp.org>
+
+       duplocale: Fix compilation error on Haiku (regression 2023-01-22).
+       * lib/locale.in.h (duplocale): If HAVE_DUPLOCALE = 0, don't declare it,
+       even if REPLACE_DUPLOCALE = 1.
+       * modules/duplocale (Depends-on, configure.ac): Don't compile a
+       replacement if HAVE_DUPLOCALE = 0 and REPLACE_DUPLOCALE = 1.
+
 2023-04-04  Bruno Haible  <bruno@clisp.org>
 
        c32tob, c32is*, c32rtomb, mbrtoc32: Fix file lists.
index e9c34182e5587400200f3ba1793dd6068e9d7705..e37702c4eb74904798112f7c4767283145187e80 100644 (file)
@@ -245,23 +245,23 @@ _GL_WARN_ON_USE (newlocale, "newlocale is not portable");
 #endif
 
 #if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@)
-# if @REPLACE_DUPLOCALE@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef duplocale
-#   define duplocale rpl_duplocale
-#   define GNULIB_defined_duplocale 1
-#  endif
+# if @HAVE_DUPLOCALE@ /* locale_t may be undefined if !@HAVE_DUPLOCALE@.  */
+#  if @REPLACE_DUPLOCALE@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef duplocale
+#    define duplocale rpl_duplocale
+#    define GNULIB_defined_duplocale 1
+#   endif
 _GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale));
-# else
-#  if @HAVE_DUPLOCALE@
+#  else
 _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale));
 #  endif
 # endif
 # if __GLIBC__ >= 2 && @HAVE_DUPLOCALE@
 _GL_CXXALIASWARN (duplocale);
 # endif
-# if @HAVE_DUPLOCALE@ || @REPLACE_DUPLOCALE@
+# if @HAVE_DUPLOCALE@
 #  ifndef HAVE_WORKING_DUPLOCALE
 #   define HAVE_WORKING_DUPLOCALE 1
 #  endif
index 80d4aaaf5465f1c6960bda92b2b80df8af497dae..7c1a8730a5cbadcea2df82b86d6568701ca2fe9b 100644 (file)
@@ -7,11 +7,12 @@ m4/duplocale.m4
 
 Depends-on:
 locale
-setlocale-null  [test $REPLACE_DUPLOCALE = 1]
+setlocale-null  [test $HAVE_DUPLOCALE = 1 && test $REPLACE_DUPLOCALE = 1]
 
 configure.ac:
 gl_FUNC_DUPLOCALE
-gl_CONDITIONAL([GL_COND_OBJ_DUPLOCALE], [test $REPLACE_DUPLOCALE = 1])
+gl_CONDITIONAL([GL_COND_OBJ_DUPLOCALE],
+               [test $HAVE_DUPLOCALE = 1 && test $REPLACE_DUPLOCALE = 1])
 AM_COND_IF([GL_COND_OBJ_DUPLOCALE], [
   gl_PREREQ_DUPLOCALE
 ])