[sr #110532] AC_CHECK_LIB no longer works with a C++ compiler

2021-08-25 Thread Vincent Lefèvre
URL:
  

 Summary: AC_CHECK_LIB no longer works with a C++ compiler
 Project: Autoconf
Submitted by: vinc17
Submitted on: mer. 25 août 2021 23:47:51 UTC
Category: None
Priority: 5 - Normal
Severity: 3 - Normal
  Status: None
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
Operating System: None

___

Details:

With Autoconf 2.71 (and the current git version), when I want to build MPFR
with g++, I get an error in the AC_CHECK_LIB test (undefined reference)
because the 3 lines

#ifdef __cplusplus
extern "C"
#endif

are now missing at the beginning of the generated test program. The cause is
commit 326c9a547423d25c621bc5c0ef76edbf6eda8c92, which removed these 3 lines
(among other things). This commit says: "(AC_LANG_CALL(C)): Remove #ifdef
__cplusplus, this macro is no longer used to generate C++ code." But this is
actually C code compiled with a C++ compiler, not C++ code.

I've submitted a patch that re-adds these 3 lines:

https://lists.gnu.org/archive/html/autoconf-patches/2021-08/msg5.html

This makes the error disappear for me.




___

Reply to this item at:

  

___
  Message posté via Savannah
  https://savannah.gnu.org/




[sr #110532] AC_CHECK_LIB no longer works with a C++ compiler

2021-08-26 Thread Zack Weinberg
Follow-up Comment #1, sr #110532 (project autoconf):

This (and the matching set of changes to AC_LANG_CALL(C++)) is in fact the
main thing I was thinking of when I wrote in the 2.70 release notes that
"setting CC to a C++ compiler is no longer supported."

That said, I'm not rejecting your patch out of hand, but I would like more
detail on exactly what you did that caused code generated by AC_LANG_CALL(C)
to get processed by a C++ compiler.  If, for instance, there is some obstacle
you're encountering that prevents you from using AC_LANG(C++) in all the right
places, perhaps we should fix _that_ instead.

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[sr #110532] AC_CHECK_LIB no longer works with a C++ compiler

2021-08-26 Thread Vincent Lefèvre
Follow-up Comment #2, sr #110532 (project autoconf):

MPFR is written in C, and it is generally compiled with a C compiler, so that
we expect the compiler to be given by $CC. This means that we need AC_LANG(C),
not AC_LANG(C++).

But we also allow C++ compilers (some compilers seem to support only C++, and
testing with a C++ compiler also allows us to detect some issues with the
header files). And since the compiler is given by $CC, g++ (for instance) is
used via CC=g++.

___

Reply to this item at:

  

___
  Message posté via Savannah
  https://savannah.gnu.org/




[sr #110532] AC_CHECK_LIB no longer works with a C++ compiler

2021-08-31 Thread Paul Eggert
Update of sr #110532 (project autoconf):

  Status:None => Done   
 Open/Closed:Open => Closed 

___

Follow-up Comment #3:

Thanks for explaining, Vincent. I installed the patch with some commentary,
and am closing the bug report.

Zack, if I jumped the gun on this please let me know and I'll revert.

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/