From: Bruno Haible Date: Sat, 8 Feb 2020 19:38:01 +0000 (+0100) Subject: fchmodat: Improve cross-compilation guesses. X-Git-Tag: v1.0~4260 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=a680228fe4d39f749cb819e45202c6fec6ca9d29;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index df48e889eb..32d9a00c3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +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. diff --git a/doc/posix-functions/fchmodat.texi b/doc/posix-functions/fchmodat.texi index 4d190310e9..a295f83853 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 8195ef6680..f284485dd9 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) ;;