[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_C_PROTOTYPES and CC=g++
From: |
Akim Demaille |
Subject: |
Re: AC_C_PROTOTYPES and CC=g++ |
Date: |
11 Apr 2002 12:34:46 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) |
| When CC=g++ is used, AC_C_PROTOTYPES seems to get the wrong answer. I
| think this is due to _AC_PROG_CC_STDC needing K&R style function
| definitions to work before declaring the compiler ANSI capable.
|
| I know CC=g++ is not really sensible, but there's some setups to make
| "exit" work with it, so maybe it's a semi-supported feature. In any
| case, unless there's a particular reason for _AC_PROG_CC_STDC to mix
| ANSI and K&R I thought to suggest:
|
| * lib/autoconf/c.m4 (_AC_PROG_CC_STDC): Don't require K&R definitions
| to work, only ANSI, for the benefit of CC=g++ or similar.
|
|
| Index: c.m4
| ===================================================================
| RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
| retrieving revision 1.160
| diff -u -r1.160 c.m4
| --- c.m4 2 Mar 2002 15:19:48 -0000 1.160
| +++ c.m4 25 Mar 2002 22:40:31 -0000
| @@ -752,9 +752,7 @@
| /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
| struct buf { int x; };
| FILE * (*rcsopen) (struct buf *, struct stat *, int);
| -static char *e (p, i)
| - char **p;
| - int i;
| +static char *e (char **p, int i)
| {
| return p[i];
| }
I don't think this is the right means to do it. A proper ANSI C
compiler still accepts K&R code. So I'd suggest that you wrap this
with __cplusplus and probably __STDC__ too.