[3/4] i18n.c: _nl_msg_cat_cntr is an internal symbol of some intl implementation

Message ID 20230516182517.999918-3-bernd.kuhls@t-online.de
State New
Headers
Series [1/4] Fix musl build |

Commit Message

Bernd Kuhls May 16, 2023, 6:25 p.m. UTC
  From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

It is supported by glibc and uClibc (which both define __GLIBC__) but
not musl (which doesn't define __GLIBC__). On musl, it doesn't do
anything because musl has a basic NLS implementation. Even
gettext-tiny defines _nl_msg_cat_cntr as a dummy symbol in its stub
libintl-musl implementation.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 i18n.c | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/i18n.c b/i18n.c
index d77e82c1..e4bc54f2 100644
--- a/i18n.c
+++ b/i18n.c
@@ -124,8 +124,10 @@  static const char *SkipContext(const char *s)
 static void SetEnvLanguage(const char *Locale)
 {
   setenv("LANGUAGE", Locale, 1);
+#if defined(__GLIBC__)
   extern int _nl_msg_cat_cntr;
   ++_nl_msg_cat_cntr;
+#endif
 }
 
 static void SetLanguageNames(void)