From: Bruno Haible Date: Thu, 15 Jan 2026 11:32:43 +0000 (+0100) Subject: build: Fix "make installcheck" on MSVC. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d806d18eb396aaec68d51f6e38fda36f220da466;p=thirdparty%2Fgettext.git build: Fix "make installcheck" on MSVC. Reported by Kirill Makurin in . * 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. --- diff --git a/gettext-runtime/configure.ac b/gettext-runtime/configure.ac index 63d2e72c5..8d18659a7 100644 --- a/gettext-runtime/configure.ac +++ b/gettext-runtime/configure.ac @@ -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 diff --git a/gettext-runtime/m4/gettext.m4 b/gettext-runtime/m4/gettext.m4 index 1b551a2d2..e9dd22255 100644 --- a/gettext-runtime/m4/gettext.m4 +++ b/gettext-runtime/m4/gettext.m4 @@ -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], diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac index 769d2512b..d3f4e8dc5 100644 --- a/gettext-tools/configure.ac +++ b/gettext-tools/configure.ac @@ -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= diff --git a/libtextstyle/configure.ac b/libtextstyle/configure.ac index 12317ce1c..d073e8d06 100644 --- a/libtextstyle/configure.ac +++ b/libtextstyle/configure.ac @@ -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\";" diff --git a/libtextstyle/install-tests/Makefile.am b/libtextstyle/install-tests/Makefile.am index 7f833b1fd..8e41d77d5 100644 --- a/libtextstyle/install-tests/Makefile.am +++ b/libtextstyle/install-tests/Makefile.am @@ -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)