]> Savannah Git Hosting - gnulib.git/commitdiff
fchmodat: Improve cross-compilation guesses.
authorBruno Haible <bruno@clisp.org>
Sat, 8 Feb 2020 19:38:01 +0000 (20:38 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 8 Feb 2020 19:40:04 +0000 (20:40 +0100)
* 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
doc/posix-functions/fchmodat.texi
m4/fchmodat.m4

index df48e889ebec6d6d4aa2907fc0b76e13998b078a..32d9a00c3b03ce81adaf46b1172c0b681428b471 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-02-08  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        Fix compilation errors in a testdir created with --with-c++-tests.
index 4d190310e997c7f4a3d53ae49312fa2104e638dc..a295f83853d0b3cdc4aa8bbdac2f016db983522c 100644 (file)
@@ -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:
index 8195ef6680564d756d75515c0803ac19f4cacd10..f284485dd9c8c6fedfc0da90c9162fb533529ce3 100644 (file)
@@ -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) ;;