The variables 'host' and 'host_os' can be guaranteed to be set only when there is a preceding invocation of AC_CANONICAL_HOST. So:
2017-07-10 Bruno Haible <br...@clisp.org> Make sure $host and $host_os are defined when used. * m4/argz.m4 (gl_FUNC_ARGZ): Require AC_CANONICAL_HOST. * m4/closedir.m4 (gl_FUNC_CLOSEDIR): Likewise. * m4/csharpexec.m4 (gt_CSHARPEXEC): Likewise. * m4/dirfd.m4 (gl_FUNC_DIRFD): Likewise. * m4/expl.m4 (gl_FUNC_EXPL): Likewise. * m4/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Likewise. * m4/lstat.m4 (gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): Likewise. * m4/opendir.m4 (gl_FUNC_OPENDIR): Likewise. * m4/poll.m4 (gl_FUNC_POLL): Likewise. * m4/pselect.m4 (gl_FUNC_PSELECT): Likewise. * m4/ptsname.m4 (gl_FUNC_PTSNAME): Likewise. * m4/relocatable.m4 (gl_RELOCATABLE_BODY): Likewise. * m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Likewise. * m4/ceill.m4 (gl_FUNC_CEILL): Require AC_CANONICAL_HOST outside the m4_ifdef block. diff --git a/m4/argz.m4 b/m4/argz.m4 index 67f4cbe..c34d685 100644 --- a/m4/argz.m4 +++ b/m4/argz.m4 @@ -7,12 +7,13 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 11 argz.m4 +# serial 12 argz.m4 AC_DEFUN([gl_FUNC_ARGZ], [gl_PREREQ_ARGZ AC_REQUIRE([AC_C_RESTRICT]) +AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT]) diff --git a/m4/ceill.m4 b/m4/ceill.m4 index 8e87acf..e981c7b 100644 --- a/m4/ceill.m4 +++ b/m4/ceill.m4 @@ -1,4 +1,4 @@ -# ceill.m4 serial 14 +# ceill.m4 serial 15 dnl Copyright (C) 2007, 2009-2017 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,7 @@ AC_DEFUN([gl_FUNC_CEILL], m4_divert_text([DEFAULTS], [gl_ceill_required=plain]) AC_REQUIRE([gl_MATH_H_DEFAULTS]) AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Persuade glibc <math.h> to declare ceill(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) @@ -25,7 +26,6 @@ AC_DEFUN([gl_FUNC_CEILL], fi m4_ifdef([gl_FUNC_CEILL_IEEE], [ if test $gl_ceill_required = ieee && test $REPLACE_CEILL = 0; then - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether ceill works according to ISO C 99 with IEC 60559], [gl_cv_func_ceill_ieee], [ diff --git a/m4/closedir.m4 b/m4/closedir.m4 index 40765b1..69e41b3 100644 --- a/m4/closedir.m4 +++ b/m4/closedir.m4 @@ -1,4 +1,4 @@ -# closedir.m4 serial 5 +# closedir.m4 serial 6 dnl Copyright (C) 2011-2017 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 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_CLOSEDIR], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS([closedir]) if test $ac_cv_func_closedir = no; then diff --git a/m4/csharpexec.m4 b/m4/csharpexec.m4 index 73c2ff4..90b9991 100644 --- a/m4/csharpexec.m4 +++ b/m4/csharpexec.m4 @@ -1,4 +1,4 @@ -# csharpexec.m4 serial 4 +# csharpexec.m4 serial 5 dnl Copyright (C) 2003-2005, 2009-2017 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 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gt_CSHARPEXEC], [ AC_REQUIRE([gt_CSHARP_CHOICE]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_MSG_CHECKING([for C[#] program execution engine]) AC_EGREP_CPP([yes], [ #if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__ diff --git a/m4/dirfd.m4 b/m4/dirfd.m4 index b4ec3d1..86c1cb3 100644 --- a/m4/dirfd.m4 +++ b/m4/dirfd.m4 @@ -1,4 +1,4 @@ -# serial 24 -*- Autoconf -*- +# serial 25 -*- Autoconf -*- dnl Find out how to get the file descriptor associated with an open DIR*. @@ -12,6 +12,7 @@ dnl From Jim Meyering AC_DEFUN([gl_FUNC_DIRFD], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Persuade glibc <dirent.h> to declare dirfd(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) diff --git a/m4/expl.m4 b/m4/expl.m4 index 8ddaad5..530bad8 100644 --- a/m4/expl.m4 +++ b/m4/expl.m4 @@ -1,4 +1,4 @@ -# expl.m4 serial 8 +# expl.m4 serial 9 dnl Copyright (C) 2010-2017 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_EXPL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Persuade glibc <math.h> to declare expl(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4 index a678f05..4c8b4ac 100644 --- a/m4/ls-mntd-fs.m4 +++ b/m4/ls-mntd-fs.m4 @@ -1,4 +1,4 @@ -# serial 32 +# serial 33 # How to list mounted file systems. # Copyright (C) 1998-2004, 2006, 2009-2017 Free Software Foundation, Inc. @@ -26,6 +26,7 @@ AC_CHECK_FUNCS([getmntent]) # gl_LIST_MOUNTED_FILE_SYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) AC_DEFUN([gl_LIST_MOUNTED_FILE_SYSTEMS], [ +AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS([listmntent getmntinfo]) AC_CHECK_HEADERS_ONCE([sys/param.h sys/statvfs.h]) diff --git a/m4/lstat.m4 b/m4/lstat.m4 index 953c117..931f3b2 100644 --- a/m4/lstat.m4 +++ b/m4/lstat.m4 @@ -1,4 +1,4 @@ -# serial 27 +# serial 28 # Copyright (C) 1997-2001, 2003-2017 Free Software Foundation, Inc. # @@ -33,6 +33,7 @@ AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], [ dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ. + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether lstat correctly handles trailing slash], [gl_cv_func_lstat_dereferences_slashed_symlink], [rm -f conftest.sym conftest.file diff --git a/m4/opendir.m4 b/m4/opendir.m4 index b970e65..0047d34 100644 --- a/m4/opendir.m4 +++ b/m4/opendir.m4 @@ -1,4 +1,4 @@ -# opendir.m4 serial 4 +# opendir.m4 serial 5 dnl Copyright (C) 2011-2017 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 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_OPENDIR], [ AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS([opendir]) if test $ac_cv_func_opendir = no; then diff --git a/m4/poll.m4 b/m4/poll.m4 index 5706ab5..060052e 100644 --- a/m4/poll.m4 +++ b/m4/poll.m4 @@ -1,4 +1,4 @@ -# poll.m4 serial 17 +# poll.m4 serial 18 dnl Copyright (c) 2003, 2005-2007, 2009-2017 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_POLL], [ AC_REQUIRE([gl_POLL_H]) AC_REQUIRE([gl_SOCKETS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles if test $ac_cv_header_poll_h = no; then ac_cv_func_poll=no gl_cv_func_poll=no diff --git a/m4/pselect.m4 b/m4/pselect.m4 index 3f1c43f..ea925cb 100644 --- a/m4/pselect.m4 +++ b/m4/pselect.m4 @@ -1,4 +1,4 @@ -# pselect.m4 serial 2 +# pselect.m4 serial 3 dnl Copyright (C) 2011-2017 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_PSELECT], [ AC_REQUIRE([gl_HEADER_SYS_SELECT]) AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS_ONCE([pselect]) if test $ac_cv_func_pselect = yes; then diff --git a/m4/ptsname.m4 b/m4/ptsname.m4 index 3fd5770..a8fb6c8 100644 --- a/m4/ptsname.m4 +++ b/m4/ptsname.m4 @@ -1,4 +1,4 @@ -# ptsname.m4 serial 3 +# ptsname.m4 serial 4 dnl Copyright (C) 2010-2017 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 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_PTSNAME], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Persuade glibc <stdlib.h> to declare ptsname(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) diff --git a/m4/relocatable.m4 b/m4/relocatable.m4 index a5476e7..6a833ab 100644 --- a/m4/relocatable.m4 +++ b/m4/relocatable.m4 @@ -1,4 +1,4 @@ -# relocatable.m4 serial 18 +# relocatable.m4 serial 19 dnl Copyright (C) 2003, 2005-2007, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,6 +31,7 @@ AC_DEFUN([gl_RELOCATABLE_BODY], AC_BEFORE([AC_PROG_INSTALL],[gl_RELOCATABLE_BODY]) AC_REQUIRE([AC_LIB_LIBPATH]) AC_REQUIRE([gl_RELOCATABLE_LIBRARY_BODY]) + AC_REQUIRE([AC_CANONICAL_HOST]) is_noop=no use_elf_origin_trick=no use_wrapper=no diff --git a/m4/symlinkat.m4 b/m4/symlinkat.m4 index 8d9d417..b1a8a99 100644 --- a/m4/symlinkat.m4 +++ b/m4/symlinkat.m4 @@ -1,4 +1,4 @@ -# serial 6 +# serial 7 # See if we need to provide symlinkat replacement. dnl Copyright (C) 2009-2017 Free Software Foundation, Inc. @@ -10,9 +10,10 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_SYMLINKAT], [ - AC_REQUIRE([gl_FUNC_OPENAT]) AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_OPENAT]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS_ONCE([symlinkat]) if test $ac_cv_func_symlinkat = no; then HAVE_SYMLINKAT=0