Save/restore AC_LANG setting in AC_PROG_CC_C_O.
commite544a323845c1bcc33729927137b09c681073ebd
authorZack Weinberg <zack@owlfolio.org>
Fri, 22 Dec 2023 16:22:36 +0000 (22 11:22 -0500)
committerZack Weinberg <zack@owlfolio.org>
Fri, 22 Dec 2023 16:22:36 +0000 (22 11:22 -0500)
treef87a0442e70b0a5b2a024d9bb77ded4e1f1aa281
parent634fb3e72990535248ee6d5c59c885582bf8ce9d
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.
lib/autoconf/c.m4