bug-autoconf
[Top][All Lists]
Advanced

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

Re: AC_CHECK_LIB failures with AC_LANG(C++)


From: Zack Weinberg
Subject: Re: AC_CHECK_LIB failures with AC_LANG(C++)
Date: Sun, 1 Nov 2020 20:15:12 -0500

On Sat, Oct 31, 2020 at 8:36 PM Dima Pasechnik
<dima.pasechnik@cs.ox.ac.uk> wrote:
> On Sat, Oct 31, 2020 at 09:23:30PM +0200, Jani Välimaa wrote:
> > Hello,
> >
> > Looks like AC_CHECK_LIB(foo, main, [foo="yes"]) calls fails after
> > https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=326c9a547423d25c621bc5c0ef76edbf6eda8c92
> > if AC_LANG(C++) is also used.
...
> looking at this commit, it appears that main() should be a special case
> in AC_LANG_CALL(C++),
> as it cannot be of type void, and C++ compilers are getting more and
> more picky with the standard.

For now, I'm just going to make conftest::$2 always have return type int.

> Actually, in modern C main() cannot be of type void either, and
> the corresponding place in AC_LANG_CALL(C)  ought to be fixed in this
> respect, as well.

AC_LANG_CALL(C) appears already to have an appropriate special case for main.

Unfortunately the best we can hope to do for 2.70 is find a stopgap
that works with the current generation of compilers.  The code
generated by AC_LANG_CALL *always* has undefined behavior, in both C
and C++, unless by chance the real prototype of the function we’re
probing for happens to match our fake declaration.  The only permanent
cure is to stop faking declarations, and that’s going to be a
challenge.

zw



reply via email to

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