]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix link error when linking with libintl.a on macOS.
authorBruno Haible <bruno@clisp.org>
Sun, 16 Sep 2018 00:25:21 +0000 (02:25 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 16 Sep 2018 00:25:21 +0000 (02:25 +0200)
* gettext-runtime/intl/loadmsgcat.c (_nl_msg_cat_cntr): Zero-initialize on
macOS.

gettext-runtime/intl/loadmsgcat.c

index e1722627d4a62ba5406e7b687ef68c5085f2ee86..363001066115f5aff6ff83c21c83e5222aaa1a27 100644 (file)
@@ -506,7 +506,15 @@ char *alloca ();
 /* We need a sign, whether a new catalog was loaded, which can be associated
    with all translations.  This is important if the translations are
    cached by one of GCC's features.  */
+#if defined __APPLE__ && defined __MACH__
+/* On macOS 10.13 with Apple clang-902.0.39.1 and cctools-895, when linking
+   statically, we need an explicit zero-initialization, in order to avoid a
+   link-time error that __nl_msg_cat_cntr is an undefined symbol.  It could
+   be a compiler bug or a ranlib bug.  */
+int _nl_msg_cat_cntr = 0;
+#else
 int _nl_msg_cat_cntr;
+#endif
 
 
 /* Expand a system dependent string segment.  Return NULL if unsupported.  */