[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch] configure: Also check C++11 (flags) for ${build} compiler no
From: |
Joseph Myers |
Subject: |
Re: [Patch] configure: Also check C++11 (flags) for ${build} compiler not only for ${host} |
Date: |
Thu, 20 Aug 2020 17:12:09 +0000 |
User-agent: |
Alpine 2.21 (DEB 202 2017-01-01) |
On Thu, 13 Aug 2020, Tobias Burnus wrote:
> diff --git a/config/ax_cxx_compile_stdcxx.m4 b/config/ax_cxx_compile_stdcxx.m4
> index 9413da624d2..0cd515fc65b 100644
> --- a/config/ax_cxx_compile_stdcxx.m4
> +++ b/config/ax_cxx_compile_stdcxx.m4
> @@ -25,6 +25,10 @@
> # regardless, after defining HAVE_CXX${VERSION} if and only if a
> # supporting mode is found.
> #
> +# If the fourth argument is the CXX/CXXFLAG/CPPFLAG suffix, e.g.
> +# "_FOR_BUILD".
It appears you're requiring _FOR_BUILD here and considering other suffixes
invalid, which would prevent any other use, e.g. _FOR_TARGET.
When building GCC, _FOR_TARGET is of course irrelevant because the
top-level build support in the source tree is only intended to work with
the version of GCC in that source tree so can assume what language
features it supports. It's less clear that no other suffix will ever be
relevant elsewhere, given that this is autoconf-archive code rather than
just used by GCC.
> + m4_if([$4], [], [],
> + [$4], [_FOR_BUILD], [],
> + [m4_fatal([invalid fourth argument `$4' to
> AX_CXX_COMPILE_STDCXX])])dnl
So I'm not convinced this check that the suffix should be empty or
_FOR_BUILD is a good idea.
> + m4_if([$4], [_FOR_BUILD],
> + [ax_cv_cxx_compile_cxx$1_orig_cxx="$CXX"
> + ax_cv_cxx_compile_cxx$1_orig_cxxflags="$CXXFLAGS"
> + ax_cv_cxx_compile_cxx$1_orig_cppflags="$CPPFLAGS"
> + CXX="$CXX$4"
> + CXXFLAGS="$CXXFLAGS$4"
> + CPPFLAGS="$CPPFLAGS$4"])
And then it might be better for this to be a check for the suffix not
being empty, rather than it being exactly _FOR_BUILD (even if you keep the
check that other suffixes are invalid, cutting down the number of places
hardcoding _FOR_BUILD seems a good idea).
> m4_if([$2], [], [dnl
> AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
> - ax_cv_cxx_compile_cxx$1,
> + ax_cv_cxx_compile_cxx$1$4,
>
> [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
> [ax_cv_cxx_compile_cxx$1=yes],
> [ax_cv_cxx_compile_cxx$1=no])])
I think this needs to update the variable name in the assignments of the
result of the check, and then in the subsequent check for whether to set
ac_success=yes, not just in the second argument to AC_CACHE_CHECK.
> + m4_if([$4], [_FOR_BUILD],
> + [CXX$4="$CXX"
> + CXXFLAGS$4="$CXXFLAGS"
> + CPPFLAGS$4="$CPPFLAGS"
> + CXX="$ax_cv_cxx_compile_cxx$1_orig_cxx"
> + CXXFLAGS="$ax_cv_cxx_compile_cxx$1_orig_cxxflags"
> + CPPFLAGS="$ax_cv_cxx_compile_cxx$1_orig_cppflags"])
I think this also would be better checking for $4 not being empty rather
than for it being exactly _FOR_BUILD.
--
Joseph S. Myers
joseph@codesourcery.com