+2007-03-31 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR libfortran/31335
+ * intrinsics/stat.c: Only provide STAT and FSTAT library routines
+ if stat() and fstat() library functions are available. When lstat()
+ is not available, use stat() instead.
+ * configure.ac: Add checks for stat, fstat and lstat.
+ * configure: Regenerate.
+ * config.h.in: Regenerate.
+
2007-03-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/31052
/* libm includes frexpl */
#undef HAVE_FREXPL
+/* Define to 1 if you have the `fstat' function. */
+#undef HAVE_FSTAT
+
/* Define to 1 if you have the `ftruncate' function. */
#undef HAVE_FTRUNCATE
/* libm includes logl */
#undef HAVE_LOGL
+/* Define to 1 if you have the `lstat' function. */
+#undef HAVE_LSTAT
+
/* Define to 1 if you have the <math.h> header file. */
#undef HAVE_MATH_H
/* libm includes sqrtl */
#undef HAVE_SQRTL
+/* Define to 1 if you have the `stat' function. */
+#undef HAVE_STAT
+
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
AC_CHECK_FUNCS(sleep time ttyname signal alarm ctime clock access fork execl)
AC_CHECK_FUNCS(wait setmode execvp pipe dup2 close fdopen strcasestr getrlimit)
-AC_CHECK_FUNCS(gettimeofday)
+AC_CHECK_FUNCS(gettimeofday stat fstat lstat)
# Check for glibc backtrace functions
AC_CHECK_FUNCS(backtrace backtrace_symbols)
#include <errno.h>
+
+#ifdef HAVE_STAT
+
/* SUBROUTINE STAT(FILE, SARRAY, STATUS)
CHARACTER(len=*), INTENT(IN) :: FILE
INTEGER, INTENT(OUT), :: SARRAY(13)
memcpy (str, name, name_len);
str[name_len] = '\0';
+ /* On platforms that don't provide lstat(), we use stat() instead. */
+#ifdef HAVE_LSTAT
if (is_lstat)
val = lstat(str, &sb);
else
+#endif
val = stat(str, &sb);
if (val == 0)
memcpy (str, name, name_len);
str[name_len] = '\0';
+ /* On platforms that don't provide lstat(), we use stat() instead. */
+#ifdef HAVE_LSTAT
if (is_lstat)
val = lstat(str, &sb);
else
+#endif
val = stat(str, &sb);
if (val == 0)
}
-/* SUBROUTINE STAT(FILE, SARRAY, STATUS)
+/* SUBROUTINE LSTAT(FILE, SARRAY, STATUS)
CHARACTER(len=*), INTENT(IN) :: FILE
INTEGER, INTENT(OUT), :: SARRAY(13)
INTEGER, INTENT(OUT), OPTIONAL :: STATUS
- FUNCTION STAT(FILE, SARRAY)
- INTEGER STAT
+ FUNCTION LSTAT(FILE, SARRAY)
+ INTEGER LSTAT
CHARACTER(len=*), INTENT(IN) :: FILE
INTEGER, INTENT(OUT), :: SARRAY(13) */
return val;
}
+#endif
+
+#ifdef HAVE_FSTAT
/* SUBROUTINE FSTAT(UNIT, SARRAY, STATUS)
INTEGER, INTENT(IN) :: UNIT
fstat_i8_sub (unit, sarray, &val);
return val;
}
+
+#endif