This is the mail archive of the
mailing list for the GCC project.
Re: More problems with libiberty on 4.3BSD
- To: msokolov at ivan dot Harhan dot ORG (Michael Sokolov)
- Subject: Re: More problems with libiberty on 4.3BSD
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 11 Apr 2000 13:28:19 -0600
- cc: gcc-patches at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <0004102318.AA00311@ivan.Harhan.ORG>you write:
> Hi there,
> Having posted a patch for libiberty/Makefile.in, I'm now tackling the libib
> code, with the same goal of making it build on 4.3BSD. Here are the problem
> * getruntime.c #includes both <time.h> and <sys/time.h>. On 4.3BSD neither
> protected against multiple inclusion and hence neither can be included more
> than once. <time.h> defines struct tm and the related libc functions, but
> doesn't include anything. <sys/time.h>, OTOH, defines struct timeval and ot
> time-related kernel structs, operations, and constants, and then at the end
> includes <time.h>. This means that it's an error on 4.3BSD to #include both
> them, and if you need the definitions from both, #include <sys/time.h> only
> * mkstemps.c uses size_t. 4.3BSD uses the original K&R C compiler from Bell
> Labs (pcc) that doesn't have size_t. However, 4.3BSD does typedef size_t in
> <sys/types.h>. mkstemps.c, however, doesn't include <sys/types.h> or any ot
> headers that include it.
> * pexecute.c, strtol.c, and strtoul.c use errno. They #include <errno.h>, b
> on 4.3BSD this file only defines the error codes and not the errno global
> variable. The latter is not declared in any header file and must be declare
> * strtol.c and strtoul.c #include <limits.h>, which doesn't exist on 4.3BSD
> Apparently it is wanted for ULONG_MAX, LONG_MAX, and LONG_MIN. Under 4.3BSD
> these are defined in <sys/param.h> and strtol.c and strtoul.c provide their
> definitions anyway when the system doesn't.
> I have fixed the above problems manually on my machine and built libiberty,
> I can't figure out how to fix them in a way that's acceptable for a patch,
> i.e., how to add 4.3BSD support to libiberty that can coexist with whatever
> supports now (portability isn't my forte). Any suggestions? TIA a lot.
You should be using autoconf for most/all of these things. If you look at
other files you'll probably see enough examples to get you started.