bug-autoconf
[Top][All Lists]
Advanced

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

Bug in AC_CHECK_MEMBER


From: Sergey Poznyakoff
Subject: Bug in AC_CHECK_MEMBER
Date: Tue, 14 May 2002 17:23:44 +0300

AC_CHECK_MEMBER fails when the member whose presence is checked is
itself an aggregate type. The bug is due to the fact that the
generated C code contains  `if (aggr.member)' statement which is
a syntax error when `member' is of an aggregate type.

To reproduce the bug, create header aggr.h with the following contents:

/* aggr.h */
struct structure { 
        int dummy;
};

struct aggr {
        int num;
        struct structure structure;
};
/* end of aggr.h */

.. and configure.ac with the following contents:

# configure.ac
AC_PREREQ(2.52)
AC_INIT([bugreport], [1], address@hidden)

AC_CHECK_MEMBER([struct aggr.num], , , [ #include "./aggr.h" ])
AC_CHECK_MEMBER([struct aggr.structure], , , [ #include "./aggr.h" ])
# end of configure.ac

It will correctly recognize aggr.num, but will fail on aggr.structure.
The config.log  shows the reason:

configure:1960: checking for struct aggr.structure
configure:2005: gcc -c -g -O2  conftest.c >&5
configure: In function `main':
configure:2018: invalid operands to binary !=
configure:2005: $? = 1
configure: failed program was:
#line 2005 "configure"
#include "confdefs.h"
 #include "./aggr.h"

#ifdef F77_DUMMY_MAIN
#  ifdef __cplusplus
     extern "C"
#  endif
   int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
static struct aggr ac_aggr;
if (ac_aggr.structure)
return 0;
  ;
  return 0;
}


Regards,
Sergey





reply via email to

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