From 33fbbfbc00e8c3a6cbdadfdd367126c5f76170ec Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 6 May 1999 20:59:17 +0000 Subject: [PATCH] * configure.in (sys/resource.h): Add to AC_CHECK_HEADERS list. * getruntime.c: Only attempt to include sys/resource.h and use getrusage if both HAVE_GETRUSAGE and HAVE_SYS_RESOURCE_H are defined. --- libiberty/ChangeLog | 7 +++++++ libiberty/configure | 2 +- libiberty/configure.in | 2 +- libiberty/getruntime.c | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 7032febe63..debdbb1d55 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,10 @@ +Thu May 6 20:34:42 1999 Fred Fish + + * configure.in (sys/resource.h): Add to AC_CHECK_HEADERS list. + * getruntime.c: Only attempt to include sys/resource.h and + use getrusage if both HAVE_GETRUSAGE and HAVE_SYS_RESOURCE_H + are defined. + 1999-04-20 Jim Blandy Fix from Dale Hawkins: diff --git a/libiberty/configure b/libiberty/configure index 98407e7946..075551026a 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -1055,7 +1055,7 @@ else fi echo "$ac_t""$CPP" 1>&6 -for ac_hdr in sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h +for ac_hdr in sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 diff --git a/libiberty/configure.in b/libiberty/configure.in index f02f03561e..1c1cb0b974 100644 --- a/libiberty/configure.in +++ b/libiberty/configure.in @@ -106,7 +106,7 @@ AC_SUBST_FILE(host_makefile_frag) # It's OK to check for header files. Although the compiler may not be # able to link anything, it had better be able to at least compile # something. -AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h) +AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h) AC_HEADER_SYS_WAIT # This is the list of functions which libiberty will provide if they diff --git a/libiberty/getruntime.c b/libiberty/getruntime.c index 6e70773bd9..b855ea6e82 100644 --- a/libiberty/getruntime.c +++ b/libiberty/getruntime.c @@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA. */ #include -#ifdef HAVE_GETRUSAGE +#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H) #include #include #endif @@ -66,7 +66,7 @@ Boston, MA 02111-1307, USA. */ long get_run_time () { -#ifdef HAVE_GETRUSAGE +#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H) struct rusage rusage; getrusage (0, &rusage);