[prev in list] [next in list] [prev in thread] [next in thread] 

List:       autoconf
Subject:    Re[2]: Which header a symbol is declared in (AC_CHECK_DECLS) ?
From:       Konstantin Andreev <andreev () swemel ! ru>
Date:       2009-04-27 15:52:35
Message-ID: 1240847555.19121.17.camel () jabba
[Download RAW message or body]

Hello, Eric.

On Fr, 27/04/2009 06:09 -0600, you wrote:

> According to Konstantin Andreev on 4/27/2009 3:20 AM:
> > 
> > Could you advise, how to correctly determine which header a symbol is declared in \
> > ?
> 
> Why?  Functionally, all you need to know is whether a symbol is declared within a \
> set of headers, rather than trying to go the extra mile to figure out which exact \
> header.  So for this particular case, I would have used something like: 
> AC_CHECK_DECLS([bzero],[],[],[AC_INCLUDES_DEFAULT
> [#include <string.h>
> #ifdef HAVE_STRINGS_H
> # include <strings.h>
> #endif
> ]])
> 
> to find whether bzero is declared in either string.h or strings.h, then include \
> both headers in my code. 

I have heard that 'string.h' and 'strings.h' are incompatible on some
systems, and including both may causes problems. So, if I include only
one of them, I increase portability.

> But ultimately, bzero is declared obsolete by POSIX.  If you REALLY want to be \
> portable, I'd write your code to use memset and not bzero. 

You are certainly right concerning 'bzero', but the question remains out
of purely academic interest:

What is the simplest way to determine with autoconf the exact header,
where the symbol is declared in ?

Best regards,
--
Konstantin Andreev.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic