Re: AC_CHECK_DECL has wrong results on macOS

Bruno Haible via Bug reports for autoconf <[email protected]> Mon, 26 May 2025 11:18:53 +0200
Newsgroups gmane.comp.sysutils.autoconf.bugs
Organization GNU
Message-ID <5898890.tIAgqjz4sF@nimes>
Hi Paul,

> > Here's a proposed fix for the issue along these lines.
> 
> Thanks. It'd be nicer if AC_CHECK_DECL didn't require AC_CANONICAL_HOST. 
> We can do that by checking inside the C program rather than using 
> AC_CANONICAL_HOST.

This comes with the cost of an extra compiler invocation on all non-macOS
systems. But I understand the desire to avoid AC_CANONICAL_HOST.

> Also, shouldn't we simply test for the option in question rather than 
> first checking for Clang? GCC might eventually add it. This way, we 
> don't need to test for Clang.

True. I was worried that other compilers would accept said option and
then warn about it at each compilation (like we have seen with some other
compiler option, I don't remember which one). But I now tested with
AIX xlc and Sun cc, and my worry was unfounded.

> So, how about the attached patch instead?

Looks good and works fine. Tested with the above-mentioned minos.tar.gz
  - on the cfarm104.cfarm.net machine,
  - with AIX xlc and Sun cc: The configure script reports e.g.
      checking for cc -D_STDC_C99= -xarch=generic64 -O options to detect undeclared functions... none needed
      checking for cc -D_STDC_C99= -xarch=generic64 -O options to ignore future-version functions... none needed

Since you made significant changes to my input, please can you mark yourself
as co-author in the git commit message? [1]
Co-authored-by: Paul Eggert <[email protected]>

Thanks.

Bruno

[1] https://stackoverflow.com/questions/58525836/