This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH to libiberty: portably include time headers
- To: gcc-patches at gcc dot gnu dot org
- Subject: PATCH to libiberty: portably include time headers
- From: msokolov at ivan dot Harhan dot ORG (Michael Sokolov)
- Date: Fri, 21 Jul 00 20:58:44 CDT
Hi there,
Below is a patch to libiberty fixing a 4.3BSD build failure. getruntime.c has
to portably #include <sys/time.h>, <time.h>, or both, with the appropriate
checks in configure. This patch does so.
This patch applies cleanly after my previous one.
--
Michael Sokolov Harhan Engineering Laboratory
Public Service Agent International Free Computing Task Force
International Engineering and Science Task Force
615 N GOOD LATIMER EXPY STE #4
DALLAS TX 75204-5852 USA
Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)
2000-07-21 Michael Sokolov <msokolov@ivan.Harhan.ORG>
* configure.in (AC_CHECK_HEADERS): Add time.h.
(AC_HEADER_TIME): Add check.
* configure, config.in: Regenerate.
* getruntime.c: Portably #include <sys/time.h> and/or <time.h>.
*** configure.in.1 Fri Jul 21 20:28:58 2000
--- configure.in.2 Fri Jul 21 20:28:27 2000
***************
*** 109,116 ****
# 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 limits.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h)
AC_HEADER_SYS_WAIT
# This is the list of functions which libiberty will provide if they
# are not available on the host.
--- 109,117 ----
# 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 limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h)
AC_HEADER_SYS_WAIT
+ AC_HEADER_TIME
# This is the list of functions which libiberty will provide if they
# are not available on the host.
*** getruntime.c.orig Fri Jul 21 20:25:39 2000
--- getruntime.c Fri Jul 21 19:56:01 2000
***************
*** 26,35 ****
single way is available for all host systems, nor are there reliable
ways to find out which way is correct for a given host. */
#include <time.h>
#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
- #include <sys/time.h>
#include <sys/resource.h>
#endif
--- 26,43 ----
single way is available for all host systems, nor are there reliable
ways to find out which way is correct for a given host. */
+ #ifdef TIME_WITH_SYS_TIME
+ #include <sys/time.h>
#include <time.h>
+ #else
+ #ifdef HAVE_SYS_TIME_H
+ #include <sys/time.h>
+ #else
+ #include <time.h>
+ #endif
+ #endif
#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
#include <sys/resource.h>
#endif