OSDN Git Service

PR libfortran/31335
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 31 Mar 2007 19:41:11 +0000 (19:41 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 31 Mar 2007 19:41:11 +0000 (19:41 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123388 138bc75d-0d04-0410-961f-82ee72b054a4

libgfortran/ChangeLog
libgfortran/config.h.in
libgfortran/configure
libgfortran/configure.ac
libgfortran/intrinsics/stat.c

index 4dbc337..6b8f4f8 100644 (file)
@@ -1,3 +1,13 @@
+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
index b6004bb..fc8e73c 100644 (file)
 /* 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
 
index b7119c1..5cc0013 100755 (executable)
 done
 
 
-for ac_func in gettimeofday
+
+
+
+for ac_func in gettimeofday stat fstat lstat
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_func" >&5
index 60645a9..c5fb875 100644 (file)
@@ -177,7 +177,7 @@ AC_CHECK_FUNCS(getrusage times mkstemp strtof strtold snprintf ftruncate chsize)
 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)
index 150387d..ce65245 100644 (file)
@@ -49,6 +49,9 @@ Boston, MA 02110-1301, USA.  */
 
 #include <errno.h>
 
+
+#ifdef HAVE_STAT
+
 /* SUBROUTINE STAT(FILE, SARRAY, STATUS)
    CHARACTER(len=*), INTENT(IN) :: FILE
    INTEGER, INTENT(OUT), :: SARRAY(13)
@@ -88,9 +91,12 @@ stat_i4_sub_0 (char *name, gfc_array_i4 *sarray, GFC_INTEGER_4 *status,
   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)
@@ -204,9 +210,12 @@ stat_i8_sub_0 (char *name, gfc_array_i8 *sarray, GFC_INTEGER_8 *status,
   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)
@@ -319,13 +328,13 @@ stat_i8 (char *name, gfc_array_i8 *sarray, gfc_charlen_type name_len)
 }
 
 
-/* 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)  */
 
@@ -351,7 +360,10 @@ lstat_i8 (char *name, gfc_array_i8 *sarray, gfc_charlen_type name_len)
   return val;
 }
 
+#endif
+
 
+#ifdef HAVE_FSTAT
 
 /* SUBROUTINE FSTAT(UNIT, SARRAY, STATUS)
    INTEGER, INTENT(IN) :: UNIT
@@ -546,3 +558,5 @@ fstat_i8 (GFC_INTEGER_8 *unit, gfc_array_i8 *sarray)
   fstat_i8_sub (unit, sarray, &val);
   return val;
 }
+
+#endif