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. > > Running configure fails to find libraries and config.log shows the > following. > > conftest.cpp:38:14: error: '::main' must return 'int' > 38 | extern "C" void main (); > | ^~~~ > > Problem disappears if I revert the commit. gcc version is 10.2.0. 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. 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.
Dima