Discussion:
faccessat: port to macOS
Bruno Haible
2017-11-12 12:24:46 UTC
Permalink
bug-gnulib was not in CC; I'm replying to
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=dd1890b79725d4a044039b476e6ad4592d2c9399
from this thread:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29231

There are two nits in this patch:
- gl_cv_func_lstat_dereferences_slashed_symlink may be used before it has been
set (depends on the order that autoconf happens to pick).
- In cross-compilation, the value is typically "guessing yes", not "yes".

This should fix it.


2017-11-12 Bruno Haible <***@clisp.org>

faccessat: Make the last change more robust.
* m4/faccessat.m4 (gl_FUNC_FACCESSAT): Require
gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK. Treat "guessing yes" like "yes".

diff --git a/m4/faccessat.m4 b/m4/faccessat.m4
index f4cb49d..c64545a 100644
--- a/m4/faccessat.m4
+++ b/m4/faccessat.m4
@@ -1,4 +1,4 @@
-# serial 7
+# serial 8
# See if we need to provide faccessat replacement.

dnl Copyright (C) 2009-2017 Free Software Foundation, Inc.
@@ -11,6 +11,7 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_FACCESSAT],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])

dnl Persuade glibc <unistd.h> to declare faccessat().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@@ -18,8 +19,11 @@ AC_DEFUN([gl_FUNC_FACCESSAT],
AC_CHECK_FUNCS_ONCE([faccessat])
if test $ac_cv_func_faccessat = no; then
HAVE_FACCESSAT=0
- elif test "$gl_cv_func_lstat_dereferences_slashed_symlink" != yes; then
- REPLACE_FACCESSAT=1
+ else
+ case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+ *yes) ;;
+ *) REPLACE_FACCESSAT=1 ;;
+ esac
fi
])

Loading...