On 01/31/2011 01:02 PM, Andreas Schwab wrote:
Ralf Corsepius<ralf.corsep...@rtems.org> writes:
ATM, I am not sure, if what autoconf does actually is useful, but this
is a different matter.
autoconf needs to deliberately trigger errors in a lot of its tests in
order to do the right thing.
I know, but ...
... the autoconf macro in question is this (from
.../share/autoconf/types.m4)
...
m4_define([_AC_CHECK_TYPE_NEW],
[AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
AC_CACHE_CHECK([for $1], [ac_Type],
[AS_VAR_SET([ac_Type], [no])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
[if (sizeof ($1))
return 0;])],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
[if (sizeof (($1)))
return 0;])],
[],
[AS_VAR_SET([ac_Type], [yes])])])])
AS_VAR_IF([ac_Type], [yes], [$2], [$3])[]dnl
AS_VAR_POPDEF([ac_Type])dnl
])# _AC_CHECK_TYPE_NEW
...
I.e. to check for presence of a type, it 1st tries to compile
if (sizeof (<type>)
return 0;
and then
if (sizeof ((<type>))
return 0;
and expects the 1st compile to succeed and the 2nd to fail.
However, the rationale why autoconf is doing so, so far escapes me.
Ralf