Patch #1239112: Correct LINKCC C++ test. Fixes #1189330.
Backported to 2.4.
diff --git a/configure.in b/configure.in
index 101fd44..7d6fe82 100644
--- a/configure.in
+++ b/configure.in
@@ -471,9 +471,11 @@
         if test -z "$CXX"; then
               LINKCC="\$(PURIFY) \$(CC)"
         else
-              echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
-              $CXX -c conftest.$ac_ext 2>&5
-              if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
+              echo 'extern "C" void foo();int main(){foo();}' > conftest_a.cc
+              $CXX -c conftest_a.cc # 2>&5
+              echo 'void foo(){}' > conftest_b.$ac_ext
+              $CC -c conftest_b.$ac_ext # 2>&5
+              if $CC -o conftest$ac_exeext conftest_a.$ac_objext conftest_b.$ac_objext 2>&5 \
                  && test -s conftest$ac_exeext && ./conftest$ac_exeext
               then
                  LINKCC="\$(PURIFY) \$(CC)"