Bug#992981: autoconf: AC_CHECK_LIB no longer works with g++
On 2021-08-25 23:41:34 +0200, Vincent Lefevre wrote:
> When I want to build MPFR with g++, I get:
>
> checking for __gmpz_init in -lgmp... no
> configure: error: libgmp not found or uses a different ABI (including static vs shared).
>
> due to
>
> dnl Check if we can link with GMP
> AC_CHECK_LIB(gmp, __gmpz_init, [LIBS="-lgmp $LIBS"],
> [AC_MSG_ERROR([libgmp not found or uses a different ABI (including static vs shared).
> Please read the INSTALL file -- see "In case of problem".])])
>
> in the configure.ac file.
Note: the error is
undefined reference to `__gmpz_init()'
I've found the cause. With Autoconf 2.69, there was
#ifdef __cplusplus
extern "C"
#endif
at the beginning of the test program generated by Autoconf.
This is no longer the case with Autoconf 2.71. A manual test
confirms that these 3 lines make the difference.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Reply to: