https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53579
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> However, libstdc++ configure uses CXXFLAGS when testing for
No that is fine and correct.
The toplevel makefile.in has BASE_TARGET_EXPORTS which does:
CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
..
CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
And then RAW_CXX_TARGET_EXPORTS includes BASE_TARGET_EXPORTS and then when
calling libstdc++ configure:
```
$(RAW_CXX_TARGET_EXPORTS) \
echo Configuring in $(TARGET_SUBDIR)/libstdc++-v3; \
cd "$(TARGET_SUBDIR)/libstdc++-v3" || exit 1; \
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(TARGET_SUBDIR)/libstdc++-v3/ | \
sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
esac; \
module_srcdir=libstdc++-v3; \
rm -f no-such-file || : ; \
CONFIG_SITE=no-such-file $(SHELL) \
$$s/$$module_srcdir/configure \
```
So it should be done correctly as CXXFLAGS into libstdc++-v3 configure.
As far as I can tell this has been true since 2009 or even before.