This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: More problems with libiberty on 4.3BSD


  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
  > erty
  > code, with the same goal of making it build on 4.3BSD. Here are the problem
  > s:
  > 
  > * getruntime.c #includes both <time.h> and <sys/time.h>. On 4.3BSD neither 
  > is
  > 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
  > her
  > 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
  >  of
  > 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
  > her
  > headers that include it.
  > 
  > * pexecute.c, strtol.c, and strtoul.c use errno. They #include <errno.h>, b
  > ut
  > 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
  > d
  > manually.
  > 
  > * 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
  >  own
  > definitions anyway when the system doesn't.
  > 
  > 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.
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.
jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]