This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: libbanshee also using a broken AC_HEADER_STDBOOL
- From: Kelley Cook <kcook at gcc dot gnu dot org>
- To: Paolo Bonzini <paolo dot bonzini at polimi dot it>, zippel at linux-m68k dot org, dberlin at dberlin dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 1 Jun 2004 06:21:21 -0700 (PDT)
- Subject: Re: libbanshee also using a broken AC_HEADER_STDBOOL
- Reply-to: kcook at gcc dot gnu dot org
> Kelley, the same bug is now in libbanshee as well.
>
> Roman, when testing my libcpp patch, you should also try replacing
> AC_HEADER_STDBOOL in libbanshee's configure.ac file with these two
> lines
>
> sinclude(../config/acx.m4)
> ACX_HEADER_STDBOOL
Paolo,
Although I defer judgement on autoconf/automake matters to you, I am
perplexed why you wish to effectively substitute:
dnl See if stdbool.h properly defines bool and true/false.
dnl Check whether _Bool is built-in.
AC_DEFUN([ACX_HEADER_STDBOOL],
[AC_CACHE_CHECK([for working stdbool.h],
ac_cv_header_stdbool_h,
[AC_TRY_COMPILE([#include <stdbool.h>],
[bool foo = false;],
ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
if test $ac_cv_header_stdbool_h = yes; then
AC_DEFINE(HAVE_STDBOOL_H, 1,
[Define if you have a working <stdbool.h> header file.])
fi
AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
[AC_TRY_COMPILE(,
[_Bool foo;],
gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
])
if test $gcc_cv_c__bool = yes; then
AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
fi
])
in place of what appears to be the much more substantial AC 2.59
default test:
# AC_HEADER_STDBOOL
# -----------------
# Check for stdbool.h that conforms to C99.
AN_IDENTIFIER([bool], [AC_HEADER_STDBOOL])
AN_IDENTIFIER([true], [AC_HEADER_STDBOOL])
AN_IDENTIFIER([false],[AC_HEADER_STDBOOL])
AC_DEFUN([AC_HEADER_STDBOOL],
[AC_CACHE_CHECK([for stdbool.h that conforms to C99],
[ac_cv_header_stdbool_h],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <stdbool.h>
#ifndef bool
# error bool is not defined
#endif
#ifndef false
# error false is not defined
#endif
#if false
# error false is not 0
#endif
#ifndef true
# error true is not defined
#endif
#if true != 1
# error true is not 1
#endif
#ifndef __bool_true_false_are_defined
# error __bool_true_false_are_defined is not defined
#endif
struct s { _Bool s: 1; _Bool t; } s;
char a[true == 1 ? 1 : -1];
char b[false == 0 ? 1 : -1];
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
char d[(bool) -0.5 == true ? 1 : -1];
bool e = &s;
char f[(_Bool) -0.0 == false ? 1 : -1];
char g[true];
char h[sizeof (_Bool)];
char i[sizeof s.t];
]],
[[ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ]])],
[ac_cv_header_stdbool_h=yes],
[ac_cv_header_stdbool_h=no])])
AC_CHECK_TYPES([_Bool])
if test $ac_cv_header_stdbool_h = yes; then
AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to
C99.])
fi
])# AC_HEADER_STDBOOL
Could you explain this to me.
KC