This patch fixes a failure of the "checking for GNU gettext in libintl..." test to recognize a libintl built with --disable-shared. It's a long-standing bug (certainly 10 years or older). It was not noticed because hardly anyone builds with --disable-shared nowadays. Only the GCC people have a habit of doing so.
2023-11-17 Bruno Haible <br...@clisp.org> gettext: Recognize a statically built libintl on macOS and AIX. Reported by David Edelsohn <dje....@gmail.com> in <https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636558.html>. * m4/gettext.m4 (AM_GNU_GETTEXT): In the "checking for GNU gettext in libintl..." test, add also the special system library dependencies needed on macOS and AIX. diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 019d1adb5a..16f9db1879 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -1,4 +1,4 @@ -# gettext.m4 serial 77 (gettext-0.22) +# gettext.m4 serial 78 (gettext-0.22.4) dnl Copyright (C) 1995-2014, 2016, 2018-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -210,9 +210,16 @@ AC_DEFUN([AM_GNU_GETTEXT] ]])], [eval "$gt_func_gnugettext_libintl=yes"], [eval "$gt_func_gnugettext_libintl=no"]) - dnl Now see whether libintl exists and depends on libiconv. - if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then - LIBS="$LIBS $LIBICONV" + 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]) + case "$host_os" in + aix*) gt_LIBINTL_EXTRA="-lpthread" ;; + esac + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } \ + && { test -n "$LIBICONV" || test -n "$gt_LIBINTL_EXTRA"; }; then + LIBS="$LIBS $LIBICONV $gt_LIBINTL_EXTRA" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ @@ -234,8 +241,8 @@ AC_DEFUN([AM_GNU_GETTEXT] bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION ]])], - [LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" + [LIBINTL="$LIBINTL $LIBICONV $gt_LIBINTL_EXTRA" + LTLIBINTL="$LTLIBINTL $LTLIBICONV $gt_LIBINTL_EXTRA" eval "$gt_func_gnugettext_libintl=yes" ]) fi