[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gl_FUNC_FSTATAT doesn’t support cross-compilation
From: |
Paul Eggert |
Subject: |
Re: gl_FUNC_FSTATAT doesn’t support cross-compilation |
Date: |
Wed, 09 Nov 2011 16:13:16 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 |
On 11/09/11 13:36, Ludovic Courtès wrote:
> What about a patch along these lines?
I'd rather not hardwire assumptions about AIX into
the 'configure' code, so instead I installed the
following more-conservative patch, which I hope
fixes your problem.
fstatat: work with cross-compilation
Problem reported by Ludovic Courtès in
<http://lists.gnu.org/archive/html/bug-gnulib/2011-11/msg00136.html>.
* m4/fstatat.m4 (gl_FUNC_FSTATAT): When cross-compiling, report
"cross-compiling" and assume the bug is present. Replace
FSTATAT_ZERO_FLAG_BROKEN with HAVE_WORKING_FSTATAT_ZERO_FLAG with
an inverted sense, to be more conservative about our assumptions.
* lib/fstatat.c (rpl_fstatat): Adjust to renamed macro.
diff --git a/lib/fstatat.c b/lib/fstatat.c
index 4b01d66..e7b0a09 100644
--- a/lib/fstatat.c
+++ b/lib/fstatat.c
@@ -45,7 +45,7 @@ orig_fstatat (int fd, char const *filename, struct stat *buf,
int flags)
#include <fcntl.h>
#include <string.h>
-#if HAVE_FSTATAT && !FSTATAT_ZERO_FLAG_BROKEN
+#if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG
# ifndef LSTAT_FOLLOWS_SLASHED_SYMLINK
# define LSTAT_FOLLOWS_SLASHED_SYMLINK 0
@@ -90,7 +90,7 @@ rpl_fstatat (int fd, char const *file, struct stat *st, int
flag)
return result;
}
-#else /* !HAVE_FSTATAT || FSTATAT_ZERO_FLAG_BROKEN */
+#else /* ! (HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG) */
/* On mingw, the gnulib <sys/stat.h> defines `stat' as a function-like
macro; but using it in AT_FUNC_F2 causes compilation failure
@@ -118,7 +118,7 @@ stat_func (char const *name, struct stat *st)
then give a diagnostic and exit nonzero.
Otherwise, this function works just like Solaris' fstatat. */
-# if FSTATAT_ZERO_FLAG_BROKEN
+# if ! HAVE_WORKING_FSTATAT_ZERO_FLAG
# define AT_FUNC_NAME rpl_fstatat
# else
# define AT_FUNC_NAME fstatat
diff --git a/m4/fstatat.m4 b/m4/fstatat.m4
index 5802537..df539eb 100644
--- a/m4/fstatat.m4
+++ b/m4/fstatat.m4
@@ -1,4 +1,4 @@
-# fstatat.m4 serial 1
+# fstatat.m4 serial 2
dnl Copyright (C) 2004-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -22,8 +22,7 @@ AC_DEFUN([gl_FUNC_FSTATAT],
dnl <http://lists.gnu.org/archive/html/bug-tar/2011-09/msg00015.html>.
AC_CACHE_CHECK([whether fstatat (..., 0) works],
[gl_cv_func_fstatat_zero_flag],
- [gl_cv_func_fstatat_zero_flag=no
- AC_RUN_IFELSE(
+ [AC_RUN_IFELSE(
[AC_LANG_SOURCE(
[[
#include <fcntl.h>
@@ -35,15 +34,17 @@ AC_DEFUN([gl_FUNC_FSTATAT],
return fstatat (AT_FDCWD, ".", &a, 0) != 0;
}
]])],
- [gl_cv_func_fstatat_zero_flag=yes])])
+ [gl_cv_func_fstatat_zero_flag=yes],
+ [gl_cv_func_fstatat_zero_flag=no],
+ [gl_cv_func_fstatat_zero_flag=cross-compiling])])
case
$gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in
yes+yes) ;;
*) REPLACE_FSTATAT=1
- if test $gl_cv_func_fstatat_zero_flag != yes; then
- AC_DEFINE([FSTATAT_ZERO_FLAG_BROKEN], [1],
- [Define to 1 if fstatat (..., 0) does not work,
- as in AIX 7.1.])
+ if test $gl_cv_func_fstatat_zero_flag = yes; then
+ AC_DEFINE([HAVE_WORKING_FSTATAT_ZERO_FLAG], [1],
+ [Define to 1 if fstatat (..., 0) works.
+ For example, it does not work in AIX 7.1.])
fi
;;
esac
- gl_FUNC_FSTATAT doesn’t support cross-compilation, Ludovic Courtès, 2011/11/09
- Re: gl_FUNC_FSTATAT doesn’t support cross-compilation,
Paul Eggert <=
- Re: gl_FUNC_FSTATAT doesn’t support cross-compilation, Bruno Haible, 2011/11/09
- Re: gl_FUNC_FSTATAT doesn’t support cross-compilation, Eric Blake, 2011/11/09
- Re: gl_FUNC_FSTATAT doesn’t support cross-compilation, Paul Eggert, 2011/11/09
- Re: gl_FUNC_FSTATAT doesn’t support cross-compilation, Bruno Haible, 2011/11/09
- Re: gl_FUNC_FSTATAT doesn’t support cross-compilation, Paul Eggert, 2011/11/09
- Re: gl_FUNC_FSTATAT doesn’t support cross-compilation, Bruno Haible, 2011/11/10
- Re: gl_FUNC_FSTATAT doesn’t support cross-compilation, Ludovic Courtès, 2011/11/11
- Re: gl_FUNC_FSTATAT doesn’t support cross-compilation, Jim Meyering, 2011/11/12
- Re: gl_FUNC_FSTATAT doesn’t support cross-compilation, Ludovic Courtès, 2011/11/10