From c7cc0deae47dad9f68ba56fd569e1eb793f61b81 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 16 Feb 2020 19:51:25 +0100 Subject: [PATCH] lchmod: Improve cross-compilation guess. * m4/lchmod.m4 (gl_FUNC_LCHMOD): Require AC_CANONICAL_HOST. When cross-compiling, guess depending on the platform. --- ChangeLog | 6 ++++++ m4/lchmod.m4 | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 288bae705f..beacc09263 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-02-16 Bruno Haible + + lchmod: Improve cross-compilation guess. + * m4/lchmod.m4 (gl_FUNC_LCHMOD): Require AC_CANONICAL_HOST. When + cross-compiling, guess depending on the platform. + 2020-02-16 Bruno Haible fstrcmp: Add API to clean up resources. diff --git a/m4/lchmod.m4 b/m4/lchmod.m4 index 68dab7a4ac..1646bd7db3 100644 --- a/m4/lchmod.m4 +++ b/m4/lchmod.m4 @@ -1,4 +1,4 @@ -#serial 4 +#serial 5 dnl Copyright (C) 2005-2006, 2008-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -15,6 +15,8 @@ AC_DEFUN([gl_FUNC_LCHMOD], dnl Persuade glibc to declare lchmod(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CHECK_FUNCS_ONCE([fchmodat lchmod lstat]) if test "$ac_cv_func_lchmod" = no; then HAVE_LCHMOD=0 @@ -56,7 +58,12 @@ AC_DEFUN([gl_FUNC_LCHMOD], ]])], [gl_cv_func_lchmod_works=yes], [gl_cv_func_lchmod_works=no], - [gl_cv_func_lchmod_works=$gl_cross_guess_normal]) + [case "$host_os" in + dnl Guess no on Linux with glibc, yes otherwise. + linux-gnu*) gl_cv_func_lchmod_works="guessing no" ;; + *) gl_cv_func_lchmod_works="$gl_cross_guess_normal" ;; + esac + ]) rm -f conftest.lchmod]) case $gl_cv_func_lchmod_works in *yes) ;; -- 2.39.5