+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.
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:
-# 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,
[
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
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[
]])],
[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) ;;