All of the AC_PROG_{compiler}_C_O macros, *except* AC_PROG_CC_C_O,
wrap their test in an AC_LANG_PUSH/POP pair for the appropriate
language. https://savannah.gnu.org/support/index.php?110987 reports
that AC_PROG_CC_C_O’s not doing this can cause a configure script to
malfunction. Specifically, if a script invokes AC_PROG_CC_C_O with
AC_LANG([C++]) in effect, AC_PROG_CC_C_O still runs $CC but it passes
a .cpp source file, possibly along with C-specific options. Either
of those can cause the test to mis-detect support for -c -o.
Add an AC_LANG_PUSH/POP pair to AC_PROG_CC_C_O, ensuring we are
testing the right compiler and giving it appropriate input.
* lib/autoconf/c.m4 (AC_PROG_CC_C_O): Wrap body of test in
AC_LANG_PUSH/POP to C.
# --------------
AC_DEFUN([AC_PROG_CC_C_O],
[AC_REQUIRE([AC_PROG_CC])dnl
+AC_LANG_PUSH([C])
if test "x$CC" != xcc; then
AC_MSG_CHECKING([whether $CC and cc understand -c and -o together])
else
AC_DEFINE(NO_MINUS_C_MINUS_O, 1,
[Define to 1 if your C compiler doesn't accept -c and -o together.])
fi
+AC_LANG_POP([C])
])# AC_PROG_CC_C_O