>       * m4/fenv-rounding.m4: New file.

Oops, there was a mistake here, and in other places as well: Everywhere where
an Autoconf macro uses $host, $host_os, or $host_cpu, it needs to first
require AC_CANONICAL_HOST. Otherwise the value of such a variable may come out
as empty.


2023-11-04  Bruno Haible  <br...@clisp.org>

        fenv-rounding et al.: Require AC_CANONICAL_HOST before accessing $host.
        * m4/fenv-rounding.m4 (gl_FENV_ROUNDING): Require AC_CANONICAL_HOST.
        * m4/c32rtomb.m4 (gl_FUNC_C32RTOMB): Likewise.
        * m4/getrandom.m4 (gl_FUNC_GETRANDOM): Likewise.
        * m4/iswdigit.m4 (gl_FUNC_ISWDIGIT): Likewise.
        * m4/iswpunct.m4 (gl_FUNC_ISWPUNCT): Likewise.
        * m4/iswxdigit.m4 (gl_FUNC_ISWXDIGIT): Likewise.
        * m4/strerrorname_np.m4 (gl_FUNC_STRERRORNAME_NP): Likewise.
        * m4/strfmon_l.m4 (gl_FUNC_STRFMON_L): Likewise.
        * m4/unlink-busy.m4 (gl_FUNC_UNLINK_BUSY_TEXT): Likewise.
        * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Likewise.
        * m4/wcscmp.m4 (gl_FUNC_WCSCMP): Likewise.
        * m4/wcsncmp.m4 (gl_FUNC_WCSNCMP): Likewise.

diff --git a/m4/c32rtomb.m4 b/m4/c32rtomb.m4
index 5073865d48..5f1db25208 100644
--- a/m4/c32rtomb.m4
+++ b/m4/c32rtomb.m4
@@ -1,4 +1,4 @@
-# c32rtomb.m4 serial 6
+# c32rtomb.m4 serial 7
 dnl Copyright (C) 2020-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,
@@ -7,6 +7,7 @@
 AC_DEFUN([gl_FUNC_C32RTOMB],
 [
   AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
 
   AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
 
diff --git a/m4/fenv-rounding.m4 b/m4/fenv-rounding.m4
index f52937c307..fc4e9a819d 100644
--- a/m4/fenv-rounding.m4
+++ b/m4/fenv-rounding.m4
@@ -1,4 +1,4 @@
-# fenv-rounding.m4 serial 1
+# fenv-rounding.m4 serial 2
 dnl Copyright (C) 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,
@@ -7,6 +7,7 @@
 AC_DEFUN([gl_FENV_ROUNDING],
 [
   AC_REQUIRE([gl_FENV_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
 
   dnl On FreeBSD 11/i386, fesetround needs -lm while fegetround doesn't.
   gl_MATHFUNC([fesetround], [int], [(int)], [#include <fenv.h>])
diff --git a/m4/getrandom.m4 b/m4/getrandom.m4
index fd73191b7b..0f7d60246a 100644
--- a/m4/getrandom.m4
+++ b/m4/getrandom.m4
@@ -1,4 +1,4 @@
-# getrandom.m4 serial 12
+# getrandom.m4 serial 13
 dnl Copyright 2020-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,
@@ -9,6 +9,8 @@
 AC_DEFUN([gl_FUNC_GETRANDOM],
 [
   AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+
   gl_CHECK_FUNCS_ANDROID([getrandom],
     [[/* Additional includes are needed before <sys/random.h> on uClibc
          and Mac OS X.  */
diff --git a/m4/iswdigit.m4 b/m4/iswdigit.m4
index b0572819ce..5bb7e6c7dc 100644
--- a/m4/iswdigit.m4
+++ b/m4/iswdigit.m4
@@ -1,4 +1,4 @@
-# iswdigit.m4 serial 5
+# iswdigit.m4 serial 6
 dnl Copyright (C) 2020-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,
@@ -12,6 +12,7 @@ AC_DEFUN([gl_FUNC_ISWDIGIT]
   AC_REQUIRE([gt_LOCALE_JA])
   AC_REQUIRE([gt_LOCALE_FR_UTF8])
   AC_REQUIRE([gt_LOCALE_ZH_CN])
+  AC_REQUIRE([AC_CANONICAL_HOST])
 
   if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
     dnl <wctype.h> redefines iswdigit already.
diff --git a/m4/iswpunct.m4 b/m4/iswpunct.m4
index 14691154cf..7d033f1d98 100644
--- a/m4/iswpunct.m4
+++ b/m4/iswpunct.m4
@@ -1,4 +1,4 @@
-# iswpunct.m4 serial 1
+# iswpunct.m4 serial 2
 dnl Copyright (C) 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,
@@ -8,6 +8,7 @@ AC_DEFUN([gl_FUNC_ISWPUNCT]
 [
   AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
   AC_REQUIRE([gl_WCTYPE_H])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
 
   if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
     dnl <wctype.h> redefines iswpunct already.
diff --git a/m4/iswxdigit.m4 b/m4/iswxdigit.m4
index 7321807bc6..5de1003269 100644
--- a/m4/iswxdigit.m4
+++ b/m4/iswxdigit.m4
@@ -1,4 +1,4 @@
-# iswxdigit.m4 serial 5
+# iswxdigit.m4 serial 6
 dnl Copyright (C) 2020-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,
@@ -11,6 +11,7 @@ AC_DEFUN([gl_FUNC_ISWXDIGIT]
   AC_REQUIRE([gt_LOCALE_JA])
   AC_REQUIRE([gt_LOCALE_FR_UTF8])
   AC_REQUIRE([gt_LOCALE_ZH_CN])
+  AC_REQUIRE([AC_CANONICAL_HOST])
 
   if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
     dnl <wctype.h> redefines iswxdigit already.
diff --git a/m4/strerrorname_np.m4 b/m4/strerrorname_np.m4
index cb160e102d..2894f72449 100644
--- a/m4/strerrorname_np.m4
+++ b/m4/strerrorname_np.m4
@@ -1,4 +1,4 @@
-# strerrorname_np.m4 serial 3
+# strerrorname_np.m4 serial 4
 dnl Copyright (C) 2020-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,
@@ -6,10 +6,13 @@
 
 AC_DEFUN([gl_FUNC_STRERRORNAME_NP],
 [
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+
   dnl Persuade glibc <string.h> to declare strerrorname_np().
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
-  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
   AC_CHECK_FUNCS([strerrorname_np])
   if test $ac_cv_func_strerrorname_np = yes; then
     dnl In glibc 2.32, strerrorname_np returns English error descriptions, not
diff --git a/m4/strfmon_l.m4 b/m4/strfmon_l.m4
index c635a5a515..cce0e8fb22 100644
--- a/m4/strfmon_l.m4
+++ b/m4/strfmon_l.m4
@@ -1,4 +1,4 @@
-# strfmon_l.m4 serial 3
+# strfmon_l.m4 serial 4
 dnl Copyright (C) 2017-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,
@@ -8,6 +8,7 @@ AC_DEFUN([gl_FUNC_STRFMON_L]
 [
   AC_REQUIRE([gl_MONETARY_H_DEFAULTS])
   AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([AC_CANONICAL_HOST])
 
   dnl Persuade glibc <monetary.h> to declare strfmon_l().
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
diff --git a/m4/unlink-busy.m4 b/m4/unlink-busy.m4
index b225c2a285..6819c7bee0 100644
--- a/m4/unlink-busy.m4
+++ b/m4/unlink-busy.m4
@@ -1,4 +1,4 @@
-#serial 16
+#serial 17
 
 dnl From J. David Anglin.
 
@@ -10,7 +10,8 @@
 # with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_FUNC_UNLINK_BUSY_TEXT],
-[dnl
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CACHE_CHECK([whether a running program can be unlinked],
     [gl_cv_func_unlink_busy_text],
     [
diff --git a/m4/vasnprintf.m4 b/m4/vasnprintf.m4
index 77da782188..fb7cd70d8f 100644
--- a/m4/vasnprintf.m4
+++ b/m4/vasnprintf.m4
@@ -1,4 +1,4 @@
-# vasnprintf.m4 serial 51
+# vasnprintf.m4 serial 52
 dnl Copyright (C) 2002-2004, 2006-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,
@@ -94,6 +94,7 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF]
 # Prerequisites of lib/vasnwprintf.c.
 AC_DEFUN_ONCE([gl_PREREQ_VASNWPRINTF],
 [
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CHECK_FUNCS_ONCE([swprintf wcsnlen mbrtowc])
   AC_CHECK_DECLS([_snwprintf], , , [[#include <stdio.h>]])
   AC_CHECK_DECLS([wcsnlen], , , [[#include <wchar.h>]])
diff --git a/m4/wcscmp.m4 b/m4/wcscmp.m4
index 2060da1e76..14f2b45454 100644
--- a/m4/wcscmp.m4
+++ b/m4/wcscmp.m4
@@ -1,4 +1,4 @@
-# wcscmp.m4 serial 4
+# wcscmp.m4 serial 5
 dnl Copyright (C) 2011-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,
@@ -7,6 +7,7 @@
 AC_DEFUN([gl_FUNC_WCSCMP],
 [
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CHECK_FUNCS_ONCE([wcscmp])
   if test $ac_cv_func_wcscmp = no; then
     HAVE_WCSCMP=0
diff --git a/m4/wcsncmp.m4 b/m4/wcsncmp.m4
index 4ef469f1ba..a2e19488f6 100644
--- a/m4/wcsncmp.m4
+++ b/m4/wcsncmp.m4
@@ -1,4 +1,4 @@
-# wcsncmp.m4 serial 3
+# wcsncmp.m4 serial 4
 dnl Copyright (C) 2011-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,
@@ -7,6 +7,7 @@
 AC_DEFUN([gl_FUNC_WCSNCMP],
 [
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CHECK_FUNCS_ONCE([wcsncmp])
   if test $ac_cv_func_wcsncmp = no; then
     HAVE_WCSNCMP=0




Reply via email to