diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-08-31 16:30:46 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-08-31 16:51:11 -0700 |
commit | b27bc3e230bb12fdd9a813e38e82bc4c3e22b4cc (patch) | |
tree | 432833f8f0a5ccf7edde0b61d4fd316809aaac03 | |
parent | 411d0c0ef5bd94491e816aa80fc70669d8a976ce (diff) | |
download | autoconf-b27bc3e230bb12fdd9a813e38e82bc4c3e22b4cc.tar.gz |
Port AC_LANG_CALL(C) to C++
* lib/autoconf/c.m4 (AC_LANG_CALL(C)): Add an extern "C" if C++.
Problem reported by Vincent Lefèvre (sr #110532).
-rw-r--r-- | lib/autoconf/c.m4 | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index 44443a39..48bd49a3 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -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 ();])]) |