[gfortran] Implementation SYSTEM_CLOCK intrinsic subroutine

Steve Kargl sgk@troutmask.apl.washington.edu
Fri May 14 04:35:00 GMT 2004


Paul, et al.

Here is an implementation of SYSTEM_CLOCK.  Bootstrapped and
tested on FreeBSD-current.  Note, the output is Fortran processor
dependent, so I can't write a portable test case.  Also, note 
there is one failure mode that I just discovered.  At the moment,
I don't know how to fix the problem.  In short, the two things
I tried have failed with the following program.

   program a          ! system_clock requires at least 1 of its
   call system_clock  ! optional arguments to be present.
   end program a

However, the implementation here is better than the current
implementation. ;-).  There are two files. system_clock.diff
should be obvious.  system_clock.c needs to be put into 
libgfortran/intrinsic.

Changelog for gcc/libgfortran

  2004-05-13  Steven G. Kargl  <kargls@comcast.net>

  * makefile.am: Add intrinsics/system_clock.c
  * intrinsics/system_clock.c: New file
  * Makefile.in: regenerated
  * aclocal.m4: regenerated

Changelog for gcc/gcc/fortran

  2004-05-13  Steven G. Kargl  <kargls@comcast.net>

  *check.c (gfc_check_system_clock): New function
  *intrinsic.c (add_sym_3s): New function, use it.
  *intrinsic.h (gfc_check_system_clock,gfc_resolve_system_clock): Add prototypes
  *iresolve.c (gfc_resolve_system_clock): New function

-- 
Steve
-------------- next part --------------
/* Implementation of the SYSTEM_CLOCK intrinsic.
   Copyright (C) 2004 Free Software Foundation, Inc.

This file is part of the GNU Fortran 95 runtime library (libgfortran).

Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

Libgfortran is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with libgfortran; see the file COPYING.LIB.  If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.  */

#include "config.h"
#include <sys/types.h>
#include "libgfortran.h"

#include <limits.h>

#if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
#  include <sys/time.h>
#  define TCK 1000
#elif HAVE_TIME_H
#  include <time.h>
#  ifdef HAVE_UNISTD_H
#    include <unistd.h>
#    define TCK sysconf(_SC_CLK_TCK)
#  else
#    define TCK CLK_TCK
#  endif
#endif

/* __system_clock_1 is the workhorse for the SYSTEM_CLOCK intrinsic subroutine.
   It returns the number of clock time for the current system time, the number
   of ticks per second, and the maximum possible value for COUNT.  On the 
   first call to SYSTEM_CLOCK, COUNT is set to zero. */
void
__system_clock_1(int *count, int *count_rate, int *count_max)
{
#if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
  /* SYSTEM_CLOCK has millisecond resolution */
  static double t0 = -1.;
  struct timeval tp;
  struct timezone tzp;
  double t;

  if (gettimeofday(&tp, &tzp) == 0)
    {
      if (t0 < 0)
        {
          t0 = ((double)tp.tv_sec + tp.tv_usec * 1.e-6) * TCK;
          *count = 0;
        }
      else
        {
          t = ((double)tp.tv_sec + tp.tv_usec * 1.e-6) * TCK;
          if (t - t0 < (double)INT_MAX)
            *count = (int) (t - t0);
          else
            {
               *count = 0;
               t0 = t;
            }
        }
      *count_rate = TCK;
      *count_max = INT_MAX - 1;
    }
  else
    {
      *count = -1;
      *count_rate = 0;
      *count_max = 0;
    }
#elif HAVE_TIME_H
  time_t t, t1;
  static time_t init_time = (time_t) -2;
  t = time(NULL);
  if (t == (time_t) -1)
    {
      *count = -1;
      *count_rate = 0;
      *count_max = 0;
    }
  else if (init_time == (time_t) -2) 
    {
      init_time = t;
      *count = 0;
      *count_rate = TCK;
      *count_max = INT_MAX-1;
    }
  else
    {
       t1 = TCK * (t - init_time);
       if (t1 < (time_t) INT_MAX)
         *count = (int) t1;
       else
         {
            *count = 0;
            init_time = t;
         }
       *count_rate = TCK;
       *count_max = INT_MAX-1;
    }
#else
  *count = -1;
  *count_rate = 0;
  *count_max = 0;
#endif
}

#undef SYSTEM_CLOCK
#define SYSTEM_CLOCK(KIND)						\
void prefix(system_clock_##KIND) (GFC_INTEGER_##KIND *__count,		\
  GFC_INTEGER_##KIND *__count_rate, GFC_INTEGER_##KIND *__count_max)	\
{									\
  int count, count_rate, count_max;					\
  __system_clock_1(&count, &count_rate, &count_max);			\
  if (__count != NULL)							\
    {									\
    if (count >= 0)							\
      *__count = (GFC_INTEGER_##KIND) count;				\
    else								\
      *__count = - GFC_INTEGER_##KIND##_HUGE;				\
    }									\
  if (__count_rate != NULL)						\
    *__count_rate = (GFC_INTEGER_##KIND) count_rate;			\
  if (__count_max != NULL)						\
    *__count_max = (GFC_INTEGER_##KIND) count_max;			\
}

SYSTEM_CLOCK(4)
SYSTEM_CLOCK(8)
-------------- next part --------------
Index: gcc/fortran/check.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/check.c,v
retrieving revision 1.2
diff -u -b -u -B -r1.2 check.c
--- gcc/fortran/check.c	13 May 2004 06:40:29 -0000	1.2
+++ gcc/fortran/check.c	14 May 2004 04:16:57 -0000
@@ -1864,3 +1864,51 @@
 
   return SUCCESS;
 }
+
+/* Check the arguments of SYSTEM_CLOCK are scalar, integer variables.  Note,
+   count, count_rate, and count_max are all optional arguments */
+
+try
+gfc_check_system_clock (gfc_expr * count, gfc_expr * count_rate,
+                        gfc_expr * count_max)
+{
+
+  if (count != NULL)
+    {
+      if (scalar_check (count, 0) == FAILURE)
+        return FAILURE;
+
+      if (type_check (count, 0, BT_INTEGER) == FAILURE)
+        return FAILURE;
+
+      if (variable_check (count, 0) == FAILURE)
+        return FAILURE;
+    }
+
+  if (count_rate != NULL)
+    {
+      if (scalar_check (count_rate, 0) == FAILURE)
+        return FAILURE;
+
+      if (type_check (count_rate, 0, BT_INTEGER) == FAILURE)
+        return FAILURE;
+
+      if (variable_check (count_rate, 0) == FAILURE)
+        return FAILURE;
+    }
+
+  if (count_max != NULL)
+    {
+      if (scalar_check (count_max, 0) == FAILURE)
+        return FAILURE;
+
+      if (type_check (count_max, 0, BT_INTEGER) == FAILURE)
+        return FAILURE;
+
+      if (variable_check (count_max, 0) == FAILURE)
+        return FAILURE;
+    }
+
+    return SUCCESS;
+}
+
Index: gcc/fortran/intrinsic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/intrinsic.c,v
retrieving revision 1.2
diff -u -b -u -B -r1.2 intrinsic.c
--- gcc/fortran/intrinsic.c	13 May 2004 06:40:30 -0000	1.2
+++ gcc/fortran/intrinsic.c	14 May 2004 04:16:59 -0000
@@ -452,6 +452,33 @@
 	   (void*)0);
 }
 
+/* Add the name of an intrinsic subroutine with three arguments to the list
+   of intrinsic names. */
+
+static void add_sym_3s (const char *name, int elemental, int actual_ok, bt type,
+		       int kind,
+		       try (*check)(gfc_expr *,gfc_expr *,gfc_expr *),
+		       gfc_expr *(*simplify)(gfc_expr *,gfc_expr *,gfc_expr *),
+		       void (*resolve)(gfc_code *),
+		       const char* a1, bt type1, int kind1, int optional1,
+		       const char* a2, bt type2, int kind2, int optional2,
+		       const char* a3, bt type3, int kind3, int optional3
+		       ) {
+  gfc_check_f cf;
+  gfc_simplify_f sf;
+  gfc_resolve_f rf;
+
+  cf.f3 = check;
+  sf.f3 = simplify;
+  rf.s1 = resolve;
+
+  add_sym (name, elemental, actual_ok, type, kind, cf, sf, rf,
+	   a1, type1, kind1, optional1,
+	   a2, type2, kind2, optional2,
+	   a3, type3, kind3, optional3,
+	   (void*)0);
+}
+
 
 static void add_sym_4 (const char *name, int elemental, int actual_ok, bt type,
 		       int kind,
@@ -1631,8 +1658,8 @@
 	     sz, BT_INTEGER, di, 1, pt, BT_INTEGER, di, 1,
 	     gt, BT_INTEGER, di, 1);
 
-  add_sym_3 ("system_clock", 0, 1, BT_UNKNOWN, 0,
-	     NULL, NULL, NULL,
+  add_sym_3s ("system_clock", 0, 1, BT_UNKNOWN, 0,
+	     gfc_check_system_clock, NULL, gfc_resolve_system_clock,
 	     c, BT_INTEGER, di, 1, cr, BT_INTEGER, di, 1,
 	     cm, BT_INTEGER, di, 1);
 }
Index: gcc/fortran/intrinsic.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/intrinsic.h,v
retrieving revision 1.2
diff -u -b -u -B -r1.2 intrinsic.h
--- gcc/fortran/intrinsic.h	13 May 2004 06:40:30 -0000	1.2
+++ gcc/fortran/intrinsic.h	14 May 2004 04:17:00 -0000
@@ -99,6 +99,7 @@
 
 /* Intrinsic subroutines.  */
 try gfc_check_cpu_time (gfc_expr *);
+try gfc_check_system_clock (gfc_expr *, gfc_expr *, gfc_expr *);
 try gfc_check_date_and_time (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
 try gfc_check_mvbits (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
 		      gfc_expr *);
@@ -302,6 +303,7 @@
 
 /* Intrinsic subroutine resolution.  */
 void gfc_resolve_cpu_time (gfc_code *);
+void gfc_resolve_system_clock(gfc_code *);
 void gfc_resolve_random_number (gfc_code *);
 
 
Index: gcc/fortran/iresolve.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/iresolve.c,v
retrieving revision 1.2
diff -u -b -u -B -r1.2 iresolve.c
--- gcc/fortran/iresolve.c	13 May 2004 06:40:30 -0000	1.2
+++ gcc/fortran/iresolve.c	14 May 2004 04:17:02 -0000
@@ -1358,6 +1358,36 @@
   c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
 }
 
+/* Determine if the arguments to SYSTEM_CLOCK are INTEGER(4) or INTEGER(8) */
+
+void
+gfc_resolve_system_clock (gfc_code * c)
+{
+  const char *name;
+
+  int kind;
+
+  if (c->ext.actual->expr != NULL)
+    {
+      kind = c->ext.actual->expr->ts.kind;
+      name = gfc_get_string (PREFIX("system_clock_%d"), kind);
+      c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
+    }
+  else if (c->ext.actual->next->expr != NULL)
+    {
+      kind = c->ext.actual->next->expr->ts.kind;
+      name = gfc_get_string (PREFIX("system_clock_%d"), kind);
+      c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
+    }
+  else
+    {
+      kind = c->ext.actual->next->next->expr->ts.kind;
+      name = gfc_get_string (PREFIX("system_clock_%d"), kind);
+      c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
+    }
+
+}
+
 
 void
 gfc_iresolve_init_1 (void)
Index: libgfortran/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/Makefile.am,v
retrieving revision 1.2
diff -u -b -u -B -r1.2 Makefile.am
--- libgfortran/Makefile.am	13 May 2004 06:40:59 -0000	1.2
+++ libgfortran/Makefile.am	14 May 2004 04:17:24 -0000
@@ -49,6 +49,7 @@
 intrinsics/reshape_generic.c \
 intrinsics/reshape_packed.c \
 intrinsics/selected_kind.f90 \
+intrinsics/system_clock.c \
 intrinsics/transpose_generic.c \
 intrinsics/unpack_generic.c \
 runtime/in_pack_generic.c \
Index: libgfortran/Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/Makefile.in,v
retrieving revision 1.2
diff -u -b -u -B -r1.2 Makefile.in
--- libgfortran/Makefile.in	13 May 2004 06:40:59 -0000	1.2
+++ libgfortran/Makefile.in	14 May 2004 04:17:42 -0000
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.8.2 from Makefile.am.
+# Makefile.in generated by automake 1.8.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -55,7 +55,7 @@
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES =
-am__installdirs = $(DESTDIR)$(libdir)
+am__installdirs = "$(DESTDIR)$(libdir)"
 libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES)
 am__objects_1 = environ.lo error.lo main.lo memory.lo pause.lo stop.lo \
@@ -118,8 +118,8 @@
 	eoshift0.lo eoshift2.lo ishftc.lo pack_generic.lo size.lo \
 	spread_generic.lo string_intrinsics.lo random.lo \
 	reshape_generic.lo reshape_packed.lo selected_kind.lo \
-	transpose_generic.lo unpack_generic.lo in_pack_generic.lo \
-	in_unpack_generic.lo
+	system_clock.lo transpose_generic.lo unpack_generic.lo \
+	in_pack_generic.lo in_unpack_generic.lo
 am__objects_33 =
 am__objects_34 = _abs_c4.lo _abs_c8.lo _abs_i4.lo _abs_i8.lo \
 	_abs_r4.lo _abs_r8.lo _exp_r4.lo _exp_r8.lo _exp_c4.lo \
@@ -257,6 +257,7 @@
 @AMDEP_TRUE@	./$(DEPDIR)/sum_c4.Plo ./$(DEPDIR)/sum_c8.Plo \
 @AMDEP_TRUE@	./$(DEPDIR)/sum_i4.Plo ./$(DEPDIR)/sum_i8.Plo \
 @AMDEP_TRUE@	./$(DEPDIR)/sum_r4.Plo ./$(DEPDIR)/sum_r8.Plo \
+@AMDEP_TRUE@	./$(DEPDIR)/system_clock.Plo \
 @AMDEP_TRUE@	./$(DEPDIR)/transfer.Plo \
 @AMDEP_TRUE@	./$(DEPDIR)/transpose_generic.Plo \
 @AMDEP_TRUE@	./$(DEPDIR)/transpose_i4.Plo \
@@ -427,6 +428,7 @@
 intrinsics/reshape_generic.c \
 intrinsics/reshape_packed.c \
 intrinsics/selected_kind.f90 \
+intrinsics/system_clock.c \
 intrinsics/transpose_generic.c \
 intrinsics/unpack_generic.c \
 runtime/in_pack_generic.c \
@@ -794,12 +796,12 @@
 	-rm -f config.h stamp-h1
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
-	$(mkdir_p) $(DESTDIR)$(libdir)
+	test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
 	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
 	  if test -f $$p; then \
 	    f="`echo $$p | sed -e 's|^.*/||'`"; \
-	    echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \
-	    $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \
+	    echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
 	  else :; fi; \
 	done
 
@@ -807,8 +809,8 @@
 	@$(NORMAL_UNINSTALL)
 	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
 	    p="`echo $$p | sed -e 's|^.*/||'`"; \
-	  echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
-	  $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
 	done
 
 clean-libLTLIBRARIES:
@@ -967,6 +969,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sum_i8.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sum_r4.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sum_r8.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/system_clock.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transfer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transpose_generic.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transpose_i4.Plo@am__quote@
@@ -4266,6 +4269,30 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o reshape_packed.lo `test -f 'intrinsics/reshape_packed.c' || echo '$(srcdir)/'`intrinsics/reshape_packed.c
 
+system_clock.o: intrinsics/system_clock.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT system_clock.o -MD -MP -MF "$(DEPDIR)/system_clock.Tpo" -c -o system_clock.o `test -f 'intrinsics/system_clock.c' || echo '$(srcdir)/'`intrinsics/system_clock.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/system_clock.Tpo" "$(DEPDIR)/system_clock.Po"; else rm -f "$(DEPDIR)/system_clock.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='intrinsics/system_clock.c' object='system_clock.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/system_clock.Po' tmpdepfile='$(DEPDIR)/system_clock.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o system_clock.o `test -f 'intrinsics/system_clock.c' || echo '$(srcdir)/'`intrinsics/system_clock.c
+
+system_clock.obj: intrinsics/system_clock.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT system_clock.obj -MD -MP -MF "$(DEPDIR)/system_clock.Tpo" -c -o system_clock.obj `if test -f 'intrinsics/system_clock.c'; then $(CYGPATH_W) 'intrinsics/system_clock.c'; else $(CYGPATH_W) '$(srcdir)/intrinsics/system_clock.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/system_clock.Tpo" "$(DEPDIR)/system_clock.Po"; else rm -f "$(DEPDIR)/system_clock.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='intrinsics/system_clock.c' object='system_clock.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/system_clock.Po' tmpdepfile='$(DEPDIR)/system_clock.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o system_clock.obj `if test -f 'intrinsics/system_clock.c'; then $(CYGPATH_W) 'intrinsics/system_clock.c'; else $(CYGPATH_W) '$(srcdir)/intrinsics/system_clock.c'; fi`
+
+system_clock.lo: intrinsics/system_clock.c
+@am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT system_clock.lo -MD -MP -MF "$(DEPDIR)/system_clock.Tpo" -c -o system_clock.lo `test -f 'intrinsics/system_clock.c' || echo '$(srcdir)/'`intrinsics/system_clock.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/system_clock.Tpo" "$(DEPDIR)/system_clock.Plo"; else rm -f "$(DEPDIR)/system_clock.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='intrinsics/system_clock.c' object='system_clock.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/system_clock.Plo' tmpdepfile='$(DEPDIR)/system_clock.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o system_clock.lo `test -f 'intrinsics/system_clock.c' || echo '$(srcdir)/'`intrinsics/system_clock.c
+
 transpose_generic.o: intrinsics/transpose_generic.c
 @am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT transpose_generic.o -MD -MP -MF "$(DEPDIR)/transpose_generic.Tpo" -c -o transpose_generic.o `test -f 'intrinsics/transpose_generic.c' || echo '$(srcdir)/'`intrinsics/transpose_generic.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/transpose_generic.Tpo" "$(DEPDIR)/transpose_generic.Po"; else rm -f "$(DEPDIR)/transpose_generic.Tpo"; exit 1; fi
@@ -5242,7 +5269,7 @@
 	        distuninstallcheck \
 	  && chmod -R a-w "$$dc_install_base" \
 	  && ({ \
-	       (cd ../.. && $(mkdir_p) "$$dc_destdir") \
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
 	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
 	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
 	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
@@ -5279,7 +5306,9 @@
 	$(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES) config.h
 installdirs:
-	$(mkdir_p) $(DESTDIR)$(libdir)
+	for dir in "$(DESTDIR)$(libdir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
 install: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
Index: libgfortran/aclocal.m4
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/aclocal.m4,v
retrieving revision 1.2
diff -u -b -u -B -r1.2 aclocal.m4
--- libgfortran/aclocal.m4	13 May 2004 06:40:59 -0000	1.2
+++ libgfortran/aclocal.m4	14 May 2004 04:17:43 -0000
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.8.2 -*- Autoconf -*-
+# generated automatically by aclocal 1.8.3 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
 # Free Software Foundation, Inc.
@@ -40,7 +40,7 @@
 # Call AM_AUTOMAKE_VERSION so it can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-	 [AM_AUTOMAKE_VERSION([1.8.2])])
+	 [AM_AUTOMAKE_VERSION([1.8.3])])
 
 # AM_AUX_DIR_EXPAND
 
@@ -149,7 +149,7 @@
 Usually this means the macro was only invoked conditionally.])
 fi])])
 
-# serial 6						-*- Autoconf -*-
+# serial 7						-*- Autoconf -*-
 
 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
 # Free Software Foundation, Inc.
@@ -236,7 +236,9 @@
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      : > sub/conftst$i.h
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
@@ -312,7 +314,7 @@
 
 # Generate code to set up dependency tracking.   -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -351,14 +353,14 @@
   grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
   # Extract the definition of DEP_FILES from the Makefile without
   # running `make'.
-  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
   test -z "$DEPDIR" && continue
   # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n -e '/^U = / s///p' < "$mf"`
+  U=`sed -n 's/^U = //p' < "$mf"`
   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
   # We invoke sed twice because it is the simplest approach to
   # changing $(DEPDIR) to its actual value in the expansion.
-  for file in `sed -n -e '
+  for file in `sed -n '
     /^DEP_FILES = .*\\\\$/ {
       s/^DEP_FILES = //
       :loop
@@ -781,8 +783,16 @@
 #
 # Do not use -m 0755 and let people choose whatever they expect by
 # setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
 AC_DEFUN([AM_PROG_MKDIR_P],
-[if mkdir -p -- . 2>/dev/null; then
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
   # Keeping the `.' argument allows $(mkdir_p) to be used without
   # argument.  Indeed, we sometimes output rules like
   #   $(mkdir_p) $(somedir)
@@ -795,7 +805,7 @@
   # recognize any option.  It will interpret all options as
   # directories to create, and then abort because `.' already
   # exists.
-  for d in ./-p ./--;
+  for d in ./-p ./--version;
   do
     test -d $d && rmdir $d
   done


More information about the Fortran mailing list