configure.in (sys/param.h,sys/times.h): Check.
authorMumit Khan <khan@xraylith.wisc.edu>
Sat, 17 Jan 1998 21:39:07 +0000 (21:39 +0000)
committerJeff Law <law@gcc.gnu.org>
Sat, 17 Jan 1998 21:39:07 +0000 (14:39 -0700)
* libU77/configure.in (sys/param.h,sys/times.h): Check.
(times,alarm): Likewise.
* libU77/config.h.in (HAVE_SYS_PARAM_H, HAVE_SYS_TIMES_H,
HAVE_ALARM, HAVE_TIMES): New defs.
* libU77/alarm_.c: Conditionalize for target platform. Set errno
to ENOSYS if target libc doesn't have the function.
* libU77/dtime_.c: Likewise.
* libU77/etime_.c: Likewise.
* libU77/sys_clock_.c: Likewise.

From-SVN: r17398

gcc/f/runtime/ChangeLog.egcs
gcc/f/runtime/libU77/alarm_.c
gcc/f/runtime/libU77/config.h.in
gcc/f/runtime/libU77/configure.in
gcc/f/runtime/libU77/dtime_.c
gcc/f/runtime/libU77/etime_.c
gcc/f/runtime/libU77/link_.c
gcc/f/runtime/libU77/symlnk_.c
gcc/f/runtime/libU77/sys_clock_.c
gcc/f/runtime/libU77/unlink_.c

index 47e86f466c09dcf1f331519360702d17c5448637..e052c2dfd76906a0674f3645c9140e636b2409f6 100644 (file)
@@ -1,4 +1,14 @@
 Sat Jan 17 22:40:31 1998  Mumit Khan <khan@xraylith.wisc.edu>
+
+       * libU77/configure.in (sys/param.h,sys/times.h): Check.
+       (times,alarm): Likewise.
+       * libU77/config.h.in (HAVE_SYS_PARAM_H, HAVE_SYS_TIMES_H,
+       HAVE_ALARM, HAVE_TIMES): New defs.
+       * libU77/alarm_.c: Conditionalize for target platform. Set errno
+       to ENOSYS if target libc doesn't have the function.
+       * libU77/dtime_.c: Likewise.
+       * libU77/etime_.c: Likewise.
+       * libU77/sys_clock_.c: Likewise.
        
        * configure.in (NON_UNIX_STDIO): Define if MINGW32.
        (NON_ANSI_RW_MODE): Do not define for CYGWIN32 or MINGW32.
index b1c347d4a68d9331c31dcd50ef162be04f7c3333..3e2f293d9b1d8542fdb8af3ddb941993166c6d45 100644 (file)
@@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA.  */
 #  include <unistd.h>
 #endif
 
+#include <errno.h>             /* for ENOSYS */
 #include "f2c.h"
 
 #ifndef RETSIGTYPE
@@ -50,10 +51,14 @@ integer G77_alarm_0 (integer *seconds, sig_proc proc)
 #endif
 {
   int status;
-
+#if defined (HAVE_ALARM) && defined (SIGALRM)
   if (signal(SIGALRM, (sig_type)proc) == SIG_ERR)
     status = -1;
   else
     status = alarm (*seconds);
+#else /* ! HAVE_ALARM || ! SIGALRM */
+  errno = ENOSYS;
+  status = -1;
+#endif
   return status;
 }
index 45ada20e23653216bdb91ec1a04826ac5c353713..4fcffeb2162c6d0568016b896332153f943b9d5d 100644 (file)
 
 /* Define if you have the <unistd.h> header file.  */
 #undef HAVE_UNISTD_H
+
+/* Define if you have the <sys/param.h> header file.  */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/times.h> header file.  */
+#undef HAVE_SYS_TIMES_H
+
+/* Define if you have the alarm function.  */
+#undef HAVE_ALARM
+
+/* Define if you have the times function.  */
+#undef HAVE_TIMES
+
index d50fa118e93276fee417262c08c4e0379692ac40..3cacc9f04c7db131352f3f1ae537a2957668bc2d 100644 (file)
@@ -79,7 +79,8 @@ dnl     AC_DEFINE(KR_headers)])])
 dnl AC_MSG_RESULT($ac_cv_sys_proto)              
 
 AC_HEADER_TIME
-AC_CHECK_HEADERS(limits.h unistd.h sys/time.h string.h stdlib.h)
+AC_CHECK_HEADERS(limits.h unistd.h sys/time.h string.h stdlib.h \
+  sys/param.h sys/times.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -96,7 +97,8 @@ AC_STRUCT_TM
 
 dnl Checks for library functions.
 
-AC_CHECK_FUNCS(symlink getcwd getwd lstat gethostname strerror clock getrusage)
+AC_CHECK_FUNCS(symlink getcwd getwd lstat gethostname strerror clock \
+  getrusage times alarm)
 test $ac_cv_func_symlink = yes && MAYBES="$MAYBES symlnk_.o"
 test $ac_cv_func_lstat = yes && MAYBES="$MAYBES lstat_.o"
 test $ac_cv_func_gethostname = yes && MAYBES="$MAYBES hostnm_.o"
index dfc3fde34cf0777dc1f45c1c0a5fbc65fd2bc651..8bcfde8cb39b98dda5ca06825f84433e8cf1562d 100644 (file)
@@ -23,12 +23,17 @@ Boston, MA 02111-1307, USA.  */
 #  include <unistd.h>
 #endif
 #include <sys/types.h>
-#include <sys/times.h>
-#include <sys/param.h>
+#if HAVE_SYS_TIMES_H
+#  include <sys/times.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#  include <sys/param.h>
+#endif
 #if HAVE_GETRUSAGE
 #  include <sys/time.h>
 #  include <sys/resource.h>
 #endif
+#include <errno.h>             /* for ENOSYS */
 #include "f2c.h"
 
 /* For dtime, etime we store the clock tick parameter (clk_tck) the
@@ -45,6 +50,7 @@ double G77_dtime_0 (tarray)
 double G77_dtime_0 (real tarray[2])
 #endif
 {
+#if defined (HAVE_GETRUSAGE) || defined (HAVE_TIMES)
   /* The getrusage version is only the default for convenience. */
 #ifdef HAVE_GETRUSAGE
   float utime, stime;
@@ -85,4 +91,8 @@ double G77_dtime_0 (real tarray[2])
 #endif /* HAVE_GETRUSAGE */
   old_utime = utime; old_stime = stime;
   return (tarray[0]+tarray[1]);
+#else /* ! HAVE_GETRUSAGE && ! HAVE_TIMES */
+  errno = ENOSYS;
+  return 0.0;
+#endif /* ! HAVE_GETRUSAGE && ! HAVE_TIMES */
 }
index 625d3d06d2a9a5af4899ff48fae098f61c2d10d8..269d964c75b0fa71eeec7864e942bfcc6ed88803 100644 (file)
@@ -23,12 +23,17 @@ Boston, MA 02111-1307, USA.  */
 #  include <unistd.h>
 #endif
 #include <sys/types.h>
-#include <sys/times.h>
-#include <sys/param.h>
+#if HAVE_SYS_TIMES_H
+#  include <sys/times.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#  include <sys/param.h>
+#endif
 #if HAVE_GETRUSAGE
 #  include <sys/time.h>
 #  include <sys/resource.h>
 #endif
+#include <errno.h>             /* for ENOSYS */
 #include "f2c.h"
 
 /* For dtime, etime we store the clock tick parameter (clk_tck) the
@@ -45,6 +50,7 @@ double G77_etime_0 (tarray)
 double G77_etime_0 (real tarray[2])
 #endif
 {
+#if defined (HAVE_GETRUSAGE) || defined (HAVE_TIMES)
   /* The getrusage version is only the default for convenience. */
 #ifdef HAVE_GETRUSAGE
   struct rusage rbuff;
@@ -77,4 +83,8 @@ double G77_etime_0 (real tarray[2])
   tarray[1] = (float) buffer.tms_stime / (float)clk_tck;
 #endif /* HAVE_GETRUSAGE */
   return (tarray[0]+tarray[1]);
+#else /* ! HAVE_GETRUSAGE && ! HAVE_TIMES */
+  errno = ENOSYS;
+  return 0.0;
+#endif /* ! HAVE_GETRUSAGE && ! HAVE_TIMES */
 }
index 6892dcb76949a218bee9a75790938bb6a48330bd..7a0b51b01848087b8ed2676fafebcd655274917b 100644 (file)
@@ -28,7 +28,9 @@ Boston, MA 02111-1307, USA.  */
 #  include <unistd.h>
 #endif
 #include <errno.h>
-#include <sys/param.h>
+#if HAVE_SYS_PARAM_H
+#  include <sys/param.h>
+#endif
 #include "f2c.h"
 
 #ifdef KR_headers
index d15e4528758804229cb31fe87f5dc96400aa26f1..4b0bf24541d2fc0488320612aa9aa6ab7aa0f014 100644 (file)
@@ -28,7 +28,9 @@ Boston, MA 02111-1307, USA.  */
 #  include <unistd.h>
 #endif
 #include <errno.h>
-#include <sys/param.h>
+#if HAVE_SYS_PARAM_H
+#  include <sys/param.h>
+#endif
 #include "f2c.h"
 
 #ifdef KR_headers
index 5644d497906f1bde2d57f374a2398f791ee57e03..47436ddd6b56fc51bda440d7e9bb0b01822ab65c 100644 (file)
@@ -29,11 +29,14 @@ Boston, MA 02111-1307, USA.  */
 #  include <time.h>
 # endif
 #endif
-#include <sys/times.h>
+#if HAVE_SYS_TIMES_H
+#  include <sys/times.h>
+#endif
 #include <limits.h>
 #if HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
+#include <errno.h>             /* for ENOSYS */
 #include "f2c.h"
 
 #ifdef KR_headers
@@ -43,6 +46,7 @@ int G77_system_clock_0 (count, count_rate, count_max)
 int G77_system_clock_0 (integer *count, integer *count_rate, integer *count_max)
 #endif
 {
+#if defined (HAVE_TIMES)
   struct tms buffer;
   unsigned long cnt;
 #ifdef _SC_CLK_TCK
@@ -63,4 +67,8 @@ int G77_system_clock_0 (integer *count, integer *count_rate, integer *count_max)
   else
     *count = cnt;
   return 0;
+#else /* ! HAVE_TIMES */
+  errno = ENOSYS;
+  return -1;
+#endif /* ! HAVE_TIMES */
 }
index 5e7edf213bc29997654b2e69f68699a582507f39..cd00559b29ac342bdfb57413d886e8e3b8851d60 100644 (file)
@@ -28,7 +28,9 @@ Boston, MA 02111-1307, USA.  */
 #  include <unistd.h>
 #endif
 #include <errno.h>
-#include <sys/param.h>
+#if HAVE_SYS_PARAM_H
+#  include <sys/param.h>
+#endif
 #include "f2c.h"
 
 #ifdef KR_headers