From: Zack Weinberg Date: Fri, 22 Dec 2023 16:22:36 +0000 (-0500) Subject: Save/restore AC_LANG setting in AC_PROG_CC_C_O. X-Git-Tag: v2.72~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e544a323845c1bcc33729927137b09c681073ebd;p=thirdparty%2Fautoconf.git Save/restore AC_LANG setting in AC_PROG_CC_C_O. 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. --- diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index 6cdef6fae..d4f7fbe63 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -557,6 +557,7 @@ fi[]dnl # -------------- 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 @@ -603,6 +604,7 @@ 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