https://gcc.gnu.org/g:bce2aaa13db011f33a90ad77eb7abfc5fdfab05a

commit bce2aaa13db011f33a90ad77eb7abfc5fdfab05a
Author: Thomas Schwinge <tschwi...@baylibre.com>
Date:   Wed Feb 26 10:13:51 2025 +0100

    libstdc++: Allow 'configure.host' to pre-set 'EXTRA_CFLAGS', 
'EXTRA_CXX_FLAGS'
    
    In particular, 'GLIBCXX_ENABLE_CXX_FLAGS' shouldn't overwrite 
'EXTRA_CXX_FLAGS'
    (and instead append any additional '--enable-cxx-flags=[...]').
    
            libstdc++-v3/
            * acinclude.m4 (GLIBCXX_ENABLE_CXX_FLAGS): Append to
            'EXTRA_CXX_FLAGS' any additional flags.
            * configure: Regenerate.
            * configure.host: Document 'EXTRA_CFLAGS', 'EXTRA_CXX_FLAGS'.
    
    (cherry picked from commit 5967fe0dd1f3a49176740553cd147e99d6950895)

Diff:
---
 libstdc++-v3/ChangeLog.omp  | 8 ++++++++
 libstdc++-v3/acinclude.m4   | 4 +++-
 libstdc++-v3/configure      | 4 +++-
 libstdc++-v3/configure.host | 4 ++++
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/ChangeLog.omp b/libstdc++-v3/ChangeLog.omp
index 7ede4aed9664..3cce4e083b1b 100644
--- a/libstdc++-v3/ChangeLog.omp
+++ b/libstdc++-v3/ChangeLog.omp
@@ -1,5 +1,13 @@
 2025-03-19  Thomas Schwinge  <tschwi...@baylibre.com>
 
+       Backported from trunk:
+       2025-03-13  Thomas Schwinge  <tschwi...@baylibre.com>
+
+       * acinclude.m4 (GLIBCXX_ENABLE_CXX_FLAGS): Append to
+       'EXTRA_CXX_FLAGS' any additional flags.
+       * configure: Regenerate.
+       * configure.host: Document 'EXTRA_CFLAGS', 'EXTRA_CXX_FLAGS'.
+
        Backported from trunk:
        2025-03-06  Jonathan Wakely  <jwak...@redhat.com>
                    Thomas Schwinge  <tschwi...@baylibre.com>
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 51a08bcc8b1d..1c6d725a1359 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3267,9 +3267,11 @@ AC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl
             AC_MSG_ERROR([compiler flags start with a -]) ;;
       esac
     done
+
+    # Append the additional flags to any that came from 'configure.host'.
+    EXTRA_CXX_FLAGS="$EXTRA_CXX_FLAGS $enable_cxx_flags"
   fi
 
-  EXTRA_CXX_FLAGS="$enable_cxx_flags"
   AC_MSG_RESULT($EXTRA_CXX_FLAGS)
   AC_SUBST(EXTRA_CXX_FLAGS)
 ])
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 18053ab7eae6..789c3929f4a5 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -19450,9 +19450,11 @@ fi
             as_fn_error $? "compiler flags start with a -" "$LINENO" 5 ;;
       esac
     done
+
+    # Append the additional flags to any that came from 'configure.host'.
+    EXTRA_CXX_FLAGS="$EXTRA_CXX_FLAGS $enable_cxx_flags"
   fi
 
-  EXTRA_CXX_FLAGS="$enable_cxx_flags"
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXTRA_CXX_FLAGS" >&5
 $as_echo "$EXTRA_CXX_FLAGS" >&6; }
 
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index 7bc430716168..933a43f241c3 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -61,6 +61,10 @@
 #
 # It possibly modifies the following variables:
 #
+#   EXTRA_CFLAGS           extra flags to pass when compiling C code
+#
+#   EXTRA_CXX_FLAGS        extra flags to pass when compiling C++ code
+#
 #   OPT_LDFLAGS            extra flags to pass when linking the library, of
 #                          the form '-Wl,blah'
 #                          (defaults to empty in acinclude.m4)

Reply via email to