[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix generation of C code for C++ compilers.
From: |
Vincent Lefevre |
Subject: |
[PATCH] Fix generation of C code for C++ compilers. |
Date: |
Thu, 26 Aug 2021 01:30:48 +0200 |
AC_CHECK_LIB fails with a C++ compiler (e.g., g++) because
#ifdef __cplusplus
extern "C"
#endif
is missing in the generated C code. These 3 lines were removed in
commit 326c9a547423d25c621bc5c0ef76edbf6eda8c92 with the comment
"(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.
---
lib/autoconf/c.m4 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 44443a39..3ae432bc 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -127,6 +127,9 @@ 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. */
+#ifdef __cplusplus
+extern "C"
+#endif
char $2 ();])], [return $2 ();])])
--
2.33.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Fix generation of C code for C++ compilers.,
Vincent Lefevre <=