diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-10-23 22:43:54 +0200 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-10-23 20:43:54 +0000 |
commit | ad238e4ff7d574bf58d5345ca050949c866867d3 (patch) | |
tree | 5d5bd3e427e9311346a6f6558c309b3c7348fc9d /libgfortran/acinclude.m4 | |
parent | 5f700e6de038a05c3068dac9199b21bbdc70c2e9 (diff) | |
download | gcc-ad238e4ff7d574bf58d5345ca050949c866867d3.zip gcc-ad238e4ff7d574bf58d5345ca050949c866867d3.tar.gz gcc-ad238e4ff7d574bf58d5345ca050949c866867d3.tar.bz2 |
re PR libfortran/23272 ([mingw32] inquire via filename fails)
PR libfortran/23272
* acinclude.m4 (LIBGFOR_CHECK_WORKING_STAT): New check.
* configure.ac: Use LIBGFOR_CHECK_WORKING_STAT.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* config.h.in: Regenerate.
* configure: Regenerate.
* io/unix.c (compare_file_filename): Add fallback case for
systems without working stat.
* io/open.c (already_open): Correct call to
compare_file_filename.
* io/io.h: Correct proto for compare_file_filename.
From-SVN: r105824
Diffstat (limited to 'libgfortran/acinclude.m4')
-rw-r--r-- | libgfortran/acinclude.m4 | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4 index dbf25f3..a94dafa 100644 --- a/libgfortran/acinclude.m4 +++ b/libgfortran/acinclude.m4 @@ -349,3 +349,38 @@ esac])] if test x"$have_broken_fpclassify" = xyes; then AC_DEFINE(HAVE_BROKEN_FPCLASSIFY, 1, [Define if fpclassify is broken.]) fi]) + +dnl Check whether the st_ino and st_dev stat fields taken together uniquely +dnl identify the file within the system. This is should be true for POSIX +dnl systems; it is known to be false on mingw32. +AC_DEFUN([LIBGFOR_CHECK_WORKING_STAT], [ + AC_CACHE_CHECK([whether the target stat is reliable], + have_working_stat, [ + AC_TRY_RUN([ +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + +int main () +{ + FILE *f, *g; + struct stat st1, st2; + + f = fopen ("foo", "w"); + g = fopen ("bar", "w"); + if (stat ("foo", &st1) != 0 || stat ("bar", &st2)) + return 1; + if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino) + return 1; + fclose(f); + fclose(g); + return 0; +}], have_working_stat=yes, have_working_stat=no, [ +case "${target}" in + *mingw*) have_working_stat=no ;; + *) have_working_stat=yes;; +esac])]) +if test x"$have_working_stat" = xyes; then + AC_DEFINE(HAVE_WORKING_STAT, 1, [Define if target has a reliable stat.]) +fi]) |