Mercurial > hg > octave-shane > gnulib-hg
diff m4/stat.m4 @ 12036:1762604ec0a7
stat: new module, for mingw bug
Depending on the current directory, either stat(".",buf) or
stat("./",buf) would fail on mingw.
* modules/stat: New file.
* lib/stat.c: Likewise.
* m4/stat.m4 (gl_FUNC_STAT): Likewise.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Add witnesses.
* modules/sys_stat (Makefile.am): Use them.
* lib/sys_stat.in.h (stat): Declare replacement.
* lib/openat.c (fstatat): Deal with lstat and stat being function
macros.
* modules/openat (Depends-on): Add inline.
* MODULES.html.sh (systems lacking POSIX:2008): Mention module.
* doc/posix-functions/stat.texi (stat): Likewise.
* modules/stat-tests: New test.
* tests/test-stat.c: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 15 Sep 2009 07:11:40 -0600 |
parents | |
children | eb6b9da995d7 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/m4/stat.m4 @@ -0,0 +1,31 @@ +# serial 1 + +# Copyright (C) 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STAT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([gl_AC_DOS]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + dnl mingw is the only known platform where stat(".") and stat("./") differ + AC_CACHE_CHECK([whether stat handles trailing slashes], + [gl_cv_func_stat_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/stat.h> +]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])], + [gl_cv_func_stat_works=yes], [gl_cv_func_stat_works=no], + [case $host_os in + mingw*) gl_cv_func_stat_works="guessing no";; + *) gl_cv_func_stat_works="guessing yes";; + esac])]) + case $gl_cv_func_stat_works in + *yes) ;; + *) REPLACE_STAT=1 + AC_LIBOBJ([stat]);; + esac +])