autoconf
[Top][All Lists]
Advanced

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

Re: AC_CHECK_SIZEOF failing on undefined HAVE_STDINT_H with -Werror


From: Keith MARSHALL
Subject: Re: AC_CHECK_SIZEOF failing on undefined HAVE_STDINT_H with -Werror
Date: Tue, 15 Aug 2006 14:42:49 +0100

Stepan Kasal wrote, quoting David Fang:
>> -------->8 snip 8<--------
>> | #if HAVE_STDINT_H
>> | # include <stdint.h>
>> | #endif
>> -------->8 snip 8<--------
...
>> | #ifdef HAVE_STDINT_H
>> | # include <stdint.h>
>> | #endif
>> 
>> After all, isn't this the convention used in producing "config.h"
>> and using it for conditional #includes?
>
> Though I originally thought that `#ifdef' should be used, when I
> came to autoconf community, I heard this ``it is defined as `1',
> so that you can use either `#if' or `#ifdef'.''

So, please consider this trivial example:

<example file="configure.ac">
AC_INIT
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CHECK_HEADERS([nonsuch.h])
AC_OUTPUT
</example>

Put this in an empty test directory, and then run these commands
in that directory:

<commands>
autoheader
autoconf
./configure
cat config.h
</commands>

<output>
  :
  :
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if you have the <nonsuch.h> header file. */
/* #undef HAVE_NONSUCH_H */

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
  :
  :
</output>

Yes, it defines `HAVE_*_H' to be `1', for headers which exist, but
note how it *doesn't* define `HAVE_NONSUCH_H'; how does that jive
with your assertion that it doesn't matter whether you use `#if'
or `#ifdef'?  `#if HAVE_NONSUCH_H' would be testing the *value*
of a symbol which isn't defined, so is invalid.  `#ifdef HAVE...'
is the required format; `#if HAVE...' is a bug wrt current practice
in `config.h', of not defining symbols for missing headers.

Regards,
Keith.




reply via email to

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