From 965906e93094565833ff348a8eb32eaf59c2df75 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 5 Jan 2020 20:19:17 +0100 Subject: [PATCH] build: Fix link error on MSVC with --disable-shared. * gettext-tools/tests/setlocale.c (setlocale): Define to fake_setlocale on native Windows. * gettext-tools/tests/format-c-3-prg.c (setlocale): Likewise. * gettext-tools/tests/format-c-4-prg.c (setlocale): Likewise. * gettext-tools/tests/plural-1-prg.c (setlocale): Likewise. * gettext-tools/tests/tstgettext.c (setlocale): Likewise. * gettext-tools/tests/tstngettext.c (setlocale): Likewise. --- gettext-tools/tests/format-c-3-prg.c | 3 +++ gettext-tools/tests/format-c-4-prg.c | 3 +++ gettext-tools/tests/plural-1-prg.c | 3 +++ gettext-tools/tests/setlocale.c | 4 ++++ gettext-tools/tests/tstgettext.c | 5 +++++ gettext-tools/tests/tstngettext.c | 5 +++++ 6 files changed, 23 insertions(+) diff --git a/gettext-tools/tests/format-c-3-prg.c b/gettext-tools/tests/format-c-3-prg.c index 3e085bc03..f26e7a5cd 100644 --- a/gettext-tools/tests/format-c-3-prg.c +++ b/gettext-tools/tests/format-c-3-prg.c @@ -40,6 +40,9 @@ and Windows. This test relies on the fake setlocale function in setlocale.c. */ #undef setlocale +#if defined _WIN32 && !defined __CYGWIN__ +# define setlocale fake_setlocale +#endif #define _(string) gettext (string) diff --git a/gettext-tools/tests/format-c-4-prg.c b/gettext-tools/tests/format-c-4-prg.c index 05b61bb7e..5160ff6ef 100644 --- a/gettext-tools/tests/format-c-4-prg.c +++ b/gettext-tools/tests/format-c-4-prg.c @@ -40,6 +40,9 @@ and Windows. This test relies on the fake setlocale function in setlocale.c. */ #undef setlocale +#if defined _WIN32 && !defined __CYGWIN__ +# define setlocale fake_setlocale +#endif #define _(string) gettext (string) diff --git a/gettext-tools/tests/plural-1-prg.c b/gettext-tools/tests/plural-1-prg.c index e994953e0..e681595b5 100644 --- a/gettext-tools/tests/plural-1-prg.c +++ b/gettext-tools/tests/plural-1-prg.c @@ -36,6 +36,9 @@ and Windows. This test relies on the fake setlocale function in setlocale.c. */ #undef setlocale +#if defined _WIN32 && !defined __CYGWIN__ +# define setlocale fake_setlocale +#endif int main (int argc, char *argv[]) diff --git a/gettext-tools/tests/setlocale.c b/gettext-tools/tests/setlocale.c index c9ce44c5c..e69a69456 100644 --- a/gettext-tools/tests/setlocale.c +++ b/gettext-tools/tests/setlocale.c @@ -27,6 +27,10 @@ Note: On platforms where _nl_locale_name_posix invokes setlocale_null, this override *must* be called 'setlocale'. */ #undef setlocale +/* Avoid a link error on MSVC. */ +#if defined _WIN32 && !defined __CYGWIN__ +# define setlocale fake_setlocale +#endif /* Return string representation of locale CATEGORY. */ static const char * diff --git a/gettext-tools/tests/tstgettext.c b/gettext-tools/tests/tstgettext.c index 52ba1cea9..d3f44ff9c 100644 --- a/gettext-tools/tests/tstgettext.c +++ b/gettext-tools/tests/tstgettext.c @@ -41,6 +41,11 @@ #undef _LIBINTL_H #include "libgnuintl.h" +#if defined _WIN32 && !defined __CYGWIN__ +# undef setlocale +# define setlocale fake_setlocale +#endif + #define _(str) gettext (str) /* If false, add newline after last string. This makes only sense in diff --git a/gettext-tools/tests/tstngettext.c b/gettext-tools/tests/tstngettext.c index aa7cf70ed..42865aee7 100644 --- a/gettext-tools/tests/tstngettext.c +++ b/gettext-tools/tests/tstngettext.c @@ -38,6 +38,11 @@ #undef _LIBINTL_H #include "libgnuintl.h" +#if defined _WIN32 && !defined __CYGWIN__ +# undef setlocale +# define setlocale fake_setlocale +#endif + #define _(str) gettext (str) /* Long options. */ -- 2.47.2