]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
build: Fix "make installcheck" on MSVC.
authorBruno Haible <bruno@clisp.org>
Thu, 15 Jan 2026 11:32:43 +0000 (12:32 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 15 Jan 2026 13:13:32 +0000 (14:13 +0100)
Reported by Kirill Makurin <maiddaisuki@outlook.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2026-01/msg00042.html>.

* gettext-runtime/m4/gettext.m4 (AM_GNU_GETTEXT): New variable
INTL_WINDOWS_LIBS. Add it to LIBINTL and LTLIBINTL.
* gettext-runtime/configure.ac (INSTALLED_LIBINTL): Add $INTL_WINDOWS_LIBS.
* gettext-tools/configure.ac (INSTALLED_LIBINTL): Likewise.
* libtextstyle/configure.ac (INSTALLED_LIBTEXTSTYLE): New variable.
* libtextstyle/install-tests/Makefile.am (installcheck-local): Link with
$INSTALLED_LIBTEXTSTYLE instead of -ltextstyle.

gettext-runtime/configure.ac
gettext-runtime/m4/gettext.m4
gettext-tools/configure.ac
libtextstyle/configure.ac
libtextstyle/install-tests/Makefile.am

index 63d2e72c5a8447f7402c21b35c55162be0b3680b..8d18659a7b80c50e0d18b422e1c3ded5751d466b 100644 (file)
@@ -1,5 +1,5 @@
 dnl Configuration for the gettext-runtime directory of GNU gettext
-dnl Copyright (C) 1995-2025 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2026 Free Software Foundation, Inc.
 dnl
 dnl This program is free software: you can redistribute it and/or modify
 dnl it under the terms of the GNU General Public License as published by
@@ -241,7 +241,7 @@ AC_SUBST([ENABLE_SHARED])
 dnl Test for features used in install-tests.
 dnl shlibpath_var and PATH_SEPARATOR are set by LT_INIT.
 if test $USE_INCLUDED_LIBINTL = yes; then
-  INSTALLED_LIBINTL="-lintl $LIBICONV $INTL_MACOSX_LIBS"
+  INSTALLED_LIBINTL="-lintl $LIBICONV $INTL_MACOSX_LIBS $INTL_WINDOWS_LIBS"
 else
   INSTALLED_LIBINTL=
 fi
index 1b551a2d2e5cef579fd52a7cc5c7c05198377949..e9dd222550ba4f7ed983ddd6dac8c64251beaec5 100644 (file)
@@ -1,6 +1,6 @@
 # gettext.m4
-# serial 84 (gettext-1.0)
-dnl Copyright (C) 1995-2025 Free Software Foundation, Inc.
+# serial 85 (gettext-1.0)
+dnl Copyright (C) 1995-2026 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -93,9 +93,18 @@ AC_DEFUN([AM_GNU_GETTEXT],
     AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
   ])
 
-  dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
+  dnl On Mac OS X, libintl requires linking with CoreFoundation.
   gt_INTL_MACOSX
 
+  dnl On native Windows, libintl requires linking with advapi32,
+  dnl because langprefs.c (_nl_language_preferences_win32_95) uses functions
+  dnl from advapi32.dll.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  INTL_WINDOWS_LIBS=
+  case "$host_os" in
+    mingw* | windows*) INTL_WINDOWS_LIBS='-ladvapi32' ;;
+  esac
+
   dnl Set USE_NLS.
   AC_REQUIRE([AM_NLS])
 
@@ -262,11 +271,13 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
               [eval "$gt_func_gnugettext_libintl=yes"],
               [eval "$gt_func_gnugettext_libintl=no"])
             dnl Now see whether libintl exists and depends on libiconv or other
-            dnl OS dependent libraries, specifically on macOS and AIX.
-            gt_LIBINTL_EXTRA="$INTL_MACOSX_LIBS"
-            AC_REQUIRE([AC_CANONICAL_HOST])
+            dnl OS dependent libraries, specifically on macOS, AIX, and native
+            dnl Windows.
+            gt_LIBINTL_EXTRA=
             case "$host_os" in
-              aix*) gt_LIBINTL_EXTRA="-lpthread" ;;
+              darwin*)           gt_LIBINTL_EXTRA="$INTL_MACOSX_LIBS" ;;
+              aix*)              gt_LIBINTL_EXTRA="-lpthread" ;;
+              mingw* | windows*) gt_LIBINTL_EXTRA="$INTL_WINDOWS_LIBS" ;;
             esac
             if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } \
                && { test -n "$LIBICONV" || test -n "$gt_LIBINTL_EXTRA"; }; then
@@ -353,12 +364,21 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
     if test -n "$INTL_MACOSX_LIBS"; then
       if test "$gt_use_preinstalled_gnugettext" = "yes" \
          || test "$gt_cv_use_gnu_libintl" = "yes"; then
-        dnl Some extra flags are needed during linking.
+        dnl Some extra options are needed during linking.
         LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
         LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
       fi
     fi
 
+    if test -n "$INTL_WINDOWS_LIBS"; then
+      if test "$gt_use_preinstalled_gnugettext" = "yes" \
+         || test "$gt_cv_use_gnu_libintl" = "yes"; then
+        dnl Some extra options are needed during linking.
+        LIBINTL="$LIBINTL $INTL_WINDOWS_LIBS"
+        LTLIBINTL="$LTLIBINTL $INTL_WINDOWS_LIBS"
+      fi
+    fi
+
     if test "$gt_use_preinstalled_gnugettext" = "yes" \
        || test "$gt_cv_use_gnu_libintl" = "yes"; then
       AC_DEFINE([ENABLE_NLS], [1],
index 769d2512bd69dd1abe25d8080e1bec102d08e914..d3f4e8dc5b28c78a013e67a89acd1b3c63a5a896 100644 (file)
@@ -1,5 +1,5 @@
 dnl Configuration for the gettext-tools directory of GNU gettext
-dnl Copyright (C) 1995-2025 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2026 Free Software Foundation, Inc.
 dnl
 dnl This program is free software: you can redistribute it and/or modify
 dnl it under the terms of the GNU General Public License as published by
@@ -790,7 +790,7 @@ AC_SUBST([HAVE_JAVAEXEC])
 dnl Test for features used in install-tests.
 dnl shlibpath_var and PATH_SEPARATOR are set by LT_INIT.
 if test $USE_INCLUDED_LIBINTL = yes; then
-  INSTALLED_LIBINTL="-lintl $LIBICONV $INTL_MACOSX_LIBS"
+  INSTALLED_LIBINTL="-lintl $LIBICONV $INTL_MACOSX_LIBS $INTL_WINDOWS_LIBS"
   INSTALLED_LIBGETTEXTPO_DEPS="$INSTALLED_LIBINTL"
 else
   INSTALLED_LIBINTL=
index 12317ce1c17178ea1d6fdd39ad8aab5cc5d1c7da..d073e8d067ac9f79fcf85e1b91a42f897d7a6f9b 100644 (file)
@@ -1,5 +1,5 @@
 dnl Configuration for the toplevel directory of GNU libtextstyle
-dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2026 Free Software Foundation, Inc.
 dnl
 dnl This program is free software: you can redistribute it and/or modify
 dnl it under the terms of the GNU General Public License as published by
@@ -172,6 +172,12 @@ AC_PATH_PROG([PERL], [perl], [$ac_aux_dir_abs/missing perl])
 
 dnl Test for features used in install-tests.
 dnl shlibpath_var and PATH_SEPARATOR are set by LT_INIT.
+INSTALLED_LIBTEXTSTYLE="-ltextstyle"
+dnl Link dependencies: $(GETHOSTNAME_LIB).
+case "$host_os" in
+  mingw* | windows*) INSTALLED_LIBTEXTSTYLE="$INSTALLED_LIBTEXTSTYLE -lws2_32" ;;
+esac
+AC_SUBST([INSTALLED_LIBTEXTSTYLE])
 if test -n "${shlibpath_var}"; then
   if test "${shlibpath_var}" = PATH; then
     AUGMENT_SHLIBPATH="PATH='\$(bindir)'${PATH_SEPARATOR}\"\$\$PATH\";"
index 7f833b1fdfc9a15a7bb6ec77bbb474373097b01c..8e41d77d57b7ef2ab75230cc11866da09fd069e0 100644 (file)
@@ -1,5 +1,5 @@
 ## Makefile for libtextstyle/install-tests.
-## Copyright (C) 2025 Free Software Foundation, Inc.
+## Copyright (C) 2025-2026 Free Software Foundation, Inc.
 ##
 ## This program is free software: you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -20,14 +20,14 @@ installcheck-local:
        $(CC) -I$(includedir) -L$(libdir) \
              $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
              $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-             -o test-version $(srcdir)/test-version.c -ltextstyle
+             -o test-version $(srcdir)/test-version.c $(INSTALLED_LIBTEXTSTYLE)
        @AUGMENT_SHLIBPATH@ ./test-version
        rm -rf test-version test-version$(EXEEXT)
        $(CC) -I$(includedir) -L$(libdir) \
              $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
              -DTOP_SRCDIR=\"$(top_srcdir)/\" \
              $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-             -o test-api $(srcdir)/test-api.c -ltextstyle
+             -o test-api $(srcdir)/test-api.c $(INSTALLED_LIBTEXTSTYLE)
        @AUGMENT_SHLIBPATH@ ./test-api
        rm -rf test-api test-api$(EXEEXT)