More problems with libiberty on 4.3BSD

Geoff Keating geoffk@cygnus.com
Mon Apr 10 16:45:00 GMT 2000


msokolov@ivan.Harhan.ORG (Michael Sokolov) writes:

> Hi there,
> 
> Having posted a patch for libiberty/Makefile.in, I'm now tackling the libiberty
> code, with the same goal of making it build on 4.3BSD. Here are the problems:
> 
> * getruntime.c #includes both <time.h> and <sys/time.h>. ...

> * mkstemps.c uses size_t. 4.3BSD uses the original K&R C compiler from Bell
> Labs (pcc) that doesn't have size_t. ...

> * pexecute.c, strtol.c, and strtoul.c use errno. They #include <errno.h>, but
> on 4.3BSD this file only defines the error codes and not the errno global
> variable. ...

> * strtol.c and strtoul.c #include <limits.h>, which doesn't exist...

> I have fixed the above problems manually on my machine and built
> libiberty, but 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 it supports now (portability isn't my
> forte). Any suggestions? TIA a lot.

These can all be solved through the use of autoconf.  In fact, these
have all been solved for other packages by using autoconf, so you can
probably just copy and paste.

- You can use AC_CHECK_HEADER to see if limits.h is there.
- You can use AC_TYPE_SIZE_T to fix the size_t problem, I think.
- You can use AC_HEADER_TIME to check to see if time.h and sys/time.h
  can both be included.
- I can't find a default macro to handle the errno thing, but it would
  be easy enough to write one (just check to see if

#include <errno.h>
extern int errno;

  compiles; if it does, then you need to define errno).

-- 
- Geoffrey Keating <geoffk@cygnus.com>


More information about the Gcc-patches mailing list