>From a680228fe4d39f749cb819e45202c6fec6ca9d29 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 8 Feb 2020 20:38:01 +0100 Subject: [PATCH 1/3] fchmodat: Improve cross-compilation guesses. * m4/fchmodat.m4 (gl_FUNC_FCHMODAT): Require AC_CANONICAL_HOST. When cross-compiling, guess depending on the platform. * doc/posix-functions/fchmodat.texi: Clarify. --- ChangeLog | 7 +++++++ doc/posix-functions/fchmodat.texi | 10 +++++----- m4/fchmodat.m4 | 14 +++++++++++--- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index df48e88..32d9a00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2020-02-08 Bruno Haible + fchmodat: Improve cross-compilation guesses. + * m4/fchmodat.m4 (gl_FUNC_FCHMODAT): Require AC_CANONICAL_HOST. When + cross-compiling, guess depending on the platform. + * doc/posix-functions/fchmodat.texi: Clarify. + +2020-02-08 Bruno Haible + Fix compilation errors in a testdir created with --with-c++-tests. * lib/c++defs.h (_GL_CXXALIASWARN1_2): Do not use __typeof__ (func), since it does not work any more with g++ >= 4.4. diff --git a/doc/posix-functions/fchmodat.texi b/doc/posix-functions/fchmodat.texi index 4d19031..a295f83 100644 --- a/doc/posix-functions/fchmodat.texi +++ b/doc/posix-functions/fchmodat.texi @@ -9,15 +9,15 @@ Gnulib module: fchmodat Portability problems fixed by Gnulib: @itemize @item -When given the @code{AT_SYMLINK_NOFOLLOW} flag, -this function fails with @code{errno} set to @code{ENOTSUP}, -even when the file is not a symbolic link: -GNU/Linux and Cygwin with glibc 2.31. -@item This function is missing on some platforms: glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14. But the replacement function is not safe to be used in libraries and is not multithread-safe. +@item +When given the @code{AT_SYMLINK_NOFOLLOW} flag, +this function fails with @code{errno} set to @code{ENOTSUP}, +even when the file is not a symbolic link: +GNU/Linux with glibc 2.31, Cygwin 2.9. @end itemize Portability problems not fixed by Gnulib: diff --git a/m4/fchmodat.m4 b/m4/fchmodat.m4 index 8195ef6..f284485 100644 --- a/m4/fchmodat.m4 +++ b/m4/fchmodat.m4 @@ -1,4 +1,4 @@ -# fchmodat.m4 serial 2 +# fchmodat.m4 serial 3 dnl Copyright (C) 2004-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,6 +10,7 @@ AC_DEFUN([gl_FUNC_FCHMODAT], [ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS_ONCE([fchmodat lchmod]) if test $ac_cv_func_fchmodat != yes; then HAVE_FCHMODAT=0 @@ -17,7 +18,9 @@ AC_DEFUN([gl_FUNC_FCHMODAT], AC_CACHE_CHECK( [whether fchmodat+AT_SYMLINK_NOFOLLOW works on non-symlinks], [gl_cv_func_fchmodat_works], - [AC_RUN_IFELSE( + [dnl This test fails on GNU/Linux with glibc 2.31 (but not on + dnl GNU/kFreeBSD nor GNU/Hurd) and Cygwin 2.9. + AC_RUN_IFELSE( [AC_LANG_PROGRAM( [ AC_INCLUDES_DEFAULT[ @@ -53,7 +56,12 @@ AC_DEFUN([gl_FUNC_FCHMODAT], ]])], [gl_cv_func_fchmodat_works=yes], [gl_cv_func_fchmodat_works=no], - [gl_cv_func_fchmodat_works=$gl_cross_guess_normal]) + [case "$host_os" in + dnl Guess no on Linux with glibc and Cygwin, yes otherwise. + linux-gnu* | cygwin*) gl_cv_func_fchmodat_works="guessing no" ;; + *) gl_cv_func_fchmodat_works="$gl_cross_guess_normal" ;; + esac + ]) rm -f conftest.fchmodat]) case $gl_cv_func_fchmodat_works in *yes) ;; -- 2.7.4