]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Port AC_LANG_CALL(C) to C++
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 31 Aug 2021 23:30:46 +0000 (16:30 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 31 Aug 2021 23:51:11 +0000 (16:51 -0700)
* lib/autoconf/c.m4 (AC_LANG_CALL(C)): Add an extern "C" if C++.
Problem reported by Vincent Lefèvre (sr #110532).

lib/autoconf/c.m4

index 44443a390b1200bb9b9b4521c7b5e88e4f4bb2c7..48bd49a3a3b1505cdafae4c0b0f13e6893558d51 100644 (file)
@@ -126,7 +126,13 @@ m4_define([AC_LANG_CALL(C)],
 m4_if([$2], [main], ,
 [/* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code, supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
 char $2 ();])], [return $2 ();])])