bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detect usage of GNU libc.


From: Jeroen Dekkers
Subject: Re: Detect usage of GNU libc.
Date: Fri, 16 Jan 2004 20:56:21 +0100
User-agent: Mutt/1.5.4i

On Fri, Jan 16, 2004 at 07:17:00PM +0100, Johan Rydberg wrote:
> address@hidden (Paul Jarc) wrote:
> 
> : Testing for glibc specifically, by whatever means, is not the right
> : way to go about this.  Instead, try to compile and link (but not run,
> : if you care about cross-compiling) a test program that uses those
> : functions.  If that succeeds, then let your main program use them too.
> : autoconf can help with tests like this.
> 
> I do not need any functions, but instead defines, such as LITTLE_ENDIAN
> and BYTE_ORDER.  The thing is that the header will be installed, so I 
> can not use a autoconf-generated config.h file for these things.

You can try to use the trick getopt.h uses:

/* If __GNU_LIBRARY__ is not already defined, either we are being used
   standalone, or this is the first header included in the source file.
   If we are being used with glibc, we need to include <features.h>, but
   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is
   not defined, include <ctype.h>, which will pull in <features.h> for us
   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it
   doesn't flood the namespace with stuff the way some other headers do.)  */
#if !defined __GNU_LIBRARY__
# include <ctype.h>
#endif


Jeroen Dekkers




reply via email to

[Prev in Thread] Current Thread [Next in Thread]