This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 73f23bf121dc728f3e10461da31b52ee6bd3e727
Author: Jim Jagielski <[email protected]>
AuthorDate: Thu Jun 11 15:51:19 2026 -0400

    Fix bundled-module builds (nss/nspr) with autoconf >= 2.70 on macOS
    
    Newer autoconf makes AC_PROG_CC probe for the highest C standard the
    compiler accepts and append it (e.g. -std=gnu23) to $CC, turning 'clang'
    into 'clang -std=gnu23'. That value-with-a-space is exported and passed to
    bundled module configure scripts as an unquoted inline env assignment
    (CC=$(CC) sh ../configure), so the shell parses -std=gnu23 as a command:
    
        /bin/sh: -std=gnu23: command not found
    
    CXX avoided this via the existing macos_c11 wrapper; the in-tree build was
    unaffected since the C dialect is pinned per-module in solenv/inc/*.mk, so
    the appended flag served no purpose and only broke external configure runs.
    
    Strip the autoconf-appended -std= token right after AC_PROG_CC so $CC stays
    a single bare compiler word.
---
 main/configure.ac | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/main/configure.ac b/main/configure.ac
index ecc51a4cd6..0654f771bd 100644
--- a/main/configure.ac
+++ b/main/configure.ac
@@ -1749,6 +1749,15 @@ if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; 
then
    AC_PROG_CC
 fi
 
+dnl Newer autoconf (>= 2.70) probes for the highest C standard the compiler
+dnl accepts and appends it (e.g. -std=gnu23) to $CC.  That breaks bundled
+dnl module configure scripts (nss/nspr, ...) which pass CC=$(CC) unquoted as
+dnl an inline environment assignment: the embedded space makes the shell
+dnl treat -std=gnu23 as a command ("-std=gnu23: command not found").  We pin
+dnl the C dialect per-module in solenv/inc/*.mk anyway, so strip the appended
+dnl -std= token and keep $CC a single bare compiler word.
+CC=`echo "$CC" | $SED 's/ -std=[[^ ]]*//g'`
+
 COMPATH=`dirname "$CC"`
 if test "$COMPATH" = "." ; then
     AC_PATH_PROGS(COMPATH, $CC)

Reply via email to