[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Andrew Suffield <address@hidden>] Bug#157887: autoconf: various imp
From: |
Andrew Suffield |
Subject: |
Re: [Andrew Suffield <address@hidden>] Bug#157887: autoconf: various imperfectly formed functions in c.m4 |
Date: |
Tue, 24 Sep 2002 23:42:16 +0100 |
User-agent: |
Mutt/1.4i |
On Tue, Sep 24, 2002 at 06:02:32AM -0700, Paul Eggert wrote:
> > Additionally, if running with different CFLAGS is not supported,
> > there's a different bug: autoconf uses whatever value for $CFLAGS you
> > had set in the shell.
>
> That behavior is documented in the Autoconf manual.
Note the "if ...." part, that was in response to Ben Pfaff's comment
"You shouldn't modify the CFLAGS that Autoconf uses."
> > I should be able to set CFLAGS to whatever I want to compile with,
>
> Not if you set CFLAGS to a value that breaks the compiler. The only
> question here is what constitutes "breakage".
>
> I'm sympathetic to your problem and I think Autoconf should be fixed
> to allow overly-pedantic compilers like yours. However, it's not a
> trivial fix, since we must continue to support K&R C for some time.
> The biggest problem will be things like AC_TRY_LINK_FUNC; I don't see
> any easy way to fix that without changing the invoking syntax, and
> that is not a backward-compatible change.
I don't see why it's difficult. #ifdef __STDC__ should handle most
cases. I don't have a K&R C compiler to test it, but something like
this ought to work:
==
AC_DEFUN([AC_C_INLINE],
[AC_CACHE_CHECK([for inline], ac_cv_c_inline,
[ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[#ifndef __cplusplus
typedef int foo_t;
#ifdef __STDC__
static $ac_kw foo_t static_foo (void) {return 0; }
int foo(void);
#else
static $ac_kw foo_t static_foo () {return 0; }
#endif
$ac_kw foo_t foo () {return 0; }
#endif
])],
==
This is essentially the same as the approach used to handle C++
compilers. For the cases where this approach does not work, AC_PROG_CC
can simply try compiling both ways and set a suitable variable, much
like $GCC (I'm betting that this will not be necessary).
--
.''`. ** Debian GNU/Linux ** | Andrew Suffield
: :' : http://www.debian.org/ | Dept. of Computing,
`. `' | Imperial College,
`- -><- | London, UK
pgpa3QnA48ApP.pgp
Description: PGP signature