summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-11-03 12:03:53 +0100
committerBruno Haible <bruno@clisp.org>2011-11-04 10:55:30 +0100
commit531e3287a33c005edeeba10b0ab0910c6686e049 (patch)
tree564111cc0d0d8f9566f8f180334f7ab26b7316f9 /m4
parent84c3f9cf54eaa688c5a1a26925886535079a91de (diff)
downloadgnulib-531e3287a33c005edeeba10b0ab0910c6686e049.tar.gz
New module 'fstatat', split off from module 'openat'.
* lib/openat.h (statat, lstatat): Enable only if GNULIB_FSTATAT is defined. * m4/fstatat.m4: New file. extracted from m4/openat.m4. * m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_FSTATAT. Don't invoke gl_FUNC_FSTATAT. (gl_FUNC_FSTATAT): Moved to m4/fstatat.m4. * modules/fstatat: New file, extracted from modules/openat. * modules/openat (Files): Remove lib/fstatat.c. (Depends-on): Remove lstat. (configure.ac): Remove AC_LIBOBJ of fstatat. * modules/fstatat-tests: New file, extracted from modules/openat-tests. * modules/openat-tests (Files): Remove tests/test-fstatat.c, tests/test-lstat.h, tests/test-stat.h. (Depends-on): Remove getcwd-lgpl. (Makefile.am): Remove rules for test-fstatat. * doc/posix-functions/fstatat.texi: Mention module 'fstatat' instead of module 'openat'. * NEWS: Mention the change. * modules/getcwd (Depends-on): Add fstatat. * modules/linkat (Depends-on): Likewise. * modules/mkfifoat-tests (Depends-on): Likewise. * modules/utimensat (Depends-on): Add fstatat. Remove openat.
Diffstat (limited to 'm4')
-rw-r--r--m4/fstatat.m451
-rw-r--r--m4/openat.m448
2 files changed, 52 insertions, 47 deletions
diff --git a/m4/fstatat.m4 b/m4/fstatat.m4
new file mode 100644
index 0000000000..58025372e0
--- /dev/null
+++ b/m4/fstatat.m4
@@ -0,0 +1,51 @@
+# fstatat.m4 serial 1
+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,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Written by Jim Meyering.
+
+# If we have the fstatat function, and it has the bug (in AIX 7.1)
+# that it does not fill in st_size correctly, use the replacement function.
+AC_DEFUN([gl_FUNC_FSTATAT],
+[
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+ AC_CHECK_FUNCS_ONCE([fstatat])
+
+ if test $ac_cv_func_fstatat = no; then
+ HAVE_FSTATAT=0
+ else
+ dnl Test for an AIX 7.1 bug; see
+ 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_LANG_SOURCE(
+ [[
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ int
+ main (void)
+ {
+ struct stat a;
+ return fstatat (AT_FDCWD, ".", &a, 0) != 0;
+ }
+ ]])],
+ [gl_cv_func_fstatat_zero_flag=yes])])
+
+ 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.])
+ fi
+ ;;
+ esac
+ fi
+])
diff --git a/m4/openat.m4 b/m4/openat.m4
index 86e3144771..86a8b629e1 100644
--- a/m4/openat.m4
+++ b/m4/openat.m4
@@ -1,4 +1,4 @@
-# serial 40
+# serial 41
# See if we need to use our replacement for Solaris' openat et al functions.
dnl Copyright (C) 2004-2011 Free Software Foundation, Inc.
@@ -14,7 +14,6 @@ AC_DEFUN([gl_FUNC_OPENAT],
GNULIB_OPENAT=1
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
- GNULIB_FSTATAT=1
GNULIB_MKDIRAT=1
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@@ -35,56 +34,11 @@ AC_DEFUN([gl_FUNC_OPENAT],
if test $ac_cv_func_mkdirat != yes; then
HAVE_MKDIRAT=0
fi
- gl_FUNC_FSTATAT
dnl This is tested at least via getcwd.c.
gl_MODULE_INDICATOR([openat])
])
-# If we have the fstatat function, and it has the bug (in AIX 7.1)
-# that it does not fill in st_size correctly, use the replacement function.
-AC_DEFUN([gl_FUNC_FSTATAT],
-[
- AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
- AC_CHECK_FUNCS_ONCE([fstatat])
-
- if test $ac_cv_func_fstatat = no; then
- HAVE_FSTATAT=0
- else
- dnl Test for an AIX 7.1 bug; see
- 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_LANG_SOURCE(
- [[
- #include <fcntl.h>
- #include <sys/stat.h>
- int
- main (void)
- {
- struct stat a;
- return fstatat (AT_FDCWD, ".", &a, 0) != 0;
- }
- ]])],
- [gl_cv_func_fstatat_zero_flag=yes])])
-
- 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.])
- fi
- ;;
- esac
- fi
-])
-
AC_DEFUN([gl_PREREQ_OPENAT],
[
AC_REQUIRE([AC_C_INLINE])