Hello,

I think I have found a bug in autoconf v2.13 when combining
autoheader, AC_LANG_CPLUSPLUS and AC_C_CONST or AC_C_INLINE .

This results in inline and const being defined as an empty string.

It happens when trying to use the generated configure script with 
gcc v2.95.2 .

It does not happen when AC_LANG_CPLUSPLUS is not used.

I do not know what has to happen with autoconf.m4f and autoheader.m4f, so
I am not really sure if the proposed patch is Ok.

My workaround is to copy the edited AC_C_CONST and AC_C_INLINE as
AC_CX_CONST and AC_CX_INLINE into aclocal.m4 in the project direcotry
and use these two macros instead.


                                        Regards
                                                Andreas

p.s. host is Ultra Sparc 1 running Solaris 2.6


excerpt from config.log:
-------------------------------------------------------------------------------
configure:1687: checking for working const
configure:1741: g++ -c -g -O2  conftest.C 1>&5
configure: In function `int main()':
configure:1697: uninitialized const `x'
configure: failed program was:
#line 1692 "configure"
#include "confdefs.h"

int main() {

/* Ultrix mips cc rejects this.  */
typedef int charset[2]; const charset x;
/* SunOS 4.1.1 cc rejects this.  */
char const *const *ccp;
char **p;
/* NEC SVR4.0.2 mips cc rejects this.  */
struct point {int x, y;};
static struct point const zero = {0,0};
/* AIX XL C 1.02.0.0 rejects this.
   It does not let you subtract one const X* pointer from another in an arm
   of an if-expression whose if-part is not a constant expression */
const char *g = "string";
ccp = &g + (g ? g-g : 0);
/* HPUX 7.0 cc rejects these. */
++ccp;
p = (char**) ccp;
ccp = (char const *const *) p;
{ /* SCO 3.2v4 cc rejects this.  */
  char *t;
  char const *s = 0 ? (char *) 0 : (char const *) 0;

  *t++ = 0;
}
{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  int x[] = {25, 17};
  const int *foo = &x[0];
  ++foo;
}
{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  typedef const int *iptr;
  iptr p = 0;
  ++p;
}
{ /* AIX XL C 1.02.0.0 rejects this saying
     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  struct s { int j; const int *ap[3]; };
  struct s *b; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
  const int foo = 10;
}

; return 0; }
configure:1762: checking for inline
configure:1776: g++ -c -g -O2  conftest.C 1>&5
configure:1772: ANSI C++ forbids declaration `foo' with no type
configure: failed program was:
#line 1769 "configure"
#include "confdefs.h"

int main() {
} inline foo() {
; return 0; }
configure:1776: g++ -c -g -O2  conftest.C 1>&5
configure:1772: ANSI C++ forbids declaration `foo' with no type
configure: failed program was:
#line 1769 "configure"
#include "confdefs.h"

int main() {
} __inline__ foo() {
; return 0; }
configure:1776: g++ -c -g -O2  conftest.C 1>&5
configure:1772: ANSI C++ forbids declaration `foo' with no type
configure: failed program was:
#line 1769 "configure"
#include "confdefs.h"

int main() {
} __inline foo() {
; return 0; }
configure:1802: checking for size_t
-------------------------------------------------------------------------------
a proposed patch:
-------------------------------------------------------------------------------
~/wk/autoconf-2.13 $ diff -c acspecific.m4.dist acspecific.m4
*** acspecific.m4.dist  Tue Jan  5 14:27:52 1999
--- acspecific.m4       Tue Sep  5 15:30:44 2000
***************
*** 1885,1891 ****
  [AC_CACHE_CHECK([for inline], ac_cv_c_inline,
  [ac_cv_c_inline=no
  for ac_kw in inline __inline__ __inline; do
!   AC_TRY_COMPILE(, [} $ac_kw foo() {], [ac_cv_c_inline=$ac_kw; break])
  done
  ])
  case "$ac_cv_c_inline" in
--- 1885,1891 ----
  [AC_CACHE_CHECK([for inline], ac_cv_c_inline,
  [ac_cv_c_inline=no
  for ac_kw in inline __inline__ __inline; do
!   AC_TRY_COMPILE(, [} $ac_kw int foo() {], [ac_cv_c_inline=$ac_kw; break])
  done
  ])
  case "$ac_cv_c_inline" in
***************
*** 1903,1909 ****
  changequote(<<, >>)dnl
  <<
  /* Ultrix mips cc rejects this.  */
! typedef int charset[2]; const charset x;
  /* SunOS 4.1.1 cc rejects this.  */
  char const *const *ccp;
  char **p;
--- 1903,1909 ----
  changequote(<<, >>)dnl
  <<
  /* Ultrix mips cc rejects this.  */
! typedef int charset[2]; const charset x = { 0 };
  /* SunOS 4.1.1 cc rejects this.  */
  char const *const *ccp;
  char **p;
~/wk/autoconf-2.13 $ 
-------------------------------------------------------------------------------

-- 
        Andreas Buschmann                       [EMAIL PROTECTED]
        Advanced System Software GmbH
        Vahrenwalder Strasse 205-207            tel: +49 511 37294 267
        D-30165 Hannover

Reply via email to