[Mesa-dev] [PATCH v3 1/2] configure+mesa/st: unify check for -std=c++11 support and enable accordingly
emil.l.velikov at gmail.com
Mon Oct 2 14:16:03 UTC 2017
On 2 October 2017 at 15:04, Gert Wollny <gw.fossdev at gmail.com> wrote:
> Am Montag, den 02.10.2017, 13:37 +0100 schrieb Emil Velikov:
>> Hi Gert,
>> On 19 September 2017 at 12:35, Gert Wollny <gw.fossdev at gmail.com>
>> > Unify the CXX feature tests for C++11 support that is required for
>> > SWR, clover, and mesa/st/tests.
>> Surely we'll have capable compiler in 90+% of the time, still asking
>> for C++11 for single test is an overkill.
> Hence my attempt to unify the test for the three cases where c++11 is
> already mandatory.
SWR and Clover have been around for ages and they absolutely require C++11.
While rebuilding most of Mesa + its tests (as illustrated in 2/2) only
for a single test is very wasteful.
Let's not do that, pretty please?
>> > ---
>> > .travis.yml | 1 +
>> Unrelated/undocumented change?
> Sorry. slipped my attention.
>> > configure.ac | 13 +-
>> > m4/ax_cxx_compile_stdcxx.m4 | 987
>> > ++++++++++++++++++++++++++
>> Please don't add custom m4 unless absolutely needed.
> The advantage of this module is that it actually tests features of the
> required standard, and if the compiler enables them by default, no flag
> is needed. The result is cached and the test already support c++14 and
> I can also use the already established AX_CHECK_COMPILE_FLAG, and if
> you say so, I'll do it, but IMHO the required changes to configure.ac
> make the code look less clean.
I'm roughly aware of the advantages, although I'm also thinking of the
Close to nobody is interested in reading or maintaining m4, that I
know of. Thus having a custom one in tree is a bad idea.
>> > --- a/configure.ac
>> > +++ b/configure.ac
>> > @@ -301,8 +301,12 @@ AX_CHECK_COMPILE_FLAG([-
>> > Wall], [CXXFLAGS="$CXXFL
>> > AX_CHECK_COMPILE_FLAG([-fno-math-
>> > errno], [CXXFLAGS="$CXXFLAGS -fno-math-
>> > errno"])
>> > AX_CHECK_COMPILE_FLAG([-fno-trapping-
>> > math], [CXXFLAGS="$CXXFLAGS -fno-trapping-
>> > math"])
>> > AX_CHECK_COMPILE_FLAG([-
>> > fvisibility=hidden], [VISIBILITY_CXXFLAGS="-
>> > fvisibility=hidden"])
>> > +AX_CXX_COMPILE_STDCXX(11, noext, optional)
>> > +
>> > AC_LANG_POP([C++])
>> > +AM_CONDITIONAL(HAVE_STD_CXX11, test "x$HAVE_CXX11" = "x1")
>> > +
>> > # Flags to help ensure that certain portions of the code -- and
>> > only those
>> > # portions -- can be built with MSVC:
>> > # - src/util, src/gallium/auxiliary, rc/gallium/drivers/llvmpipe,
>> > and
>> > @@ -2234,9 +2238,7 @@ if test "x$enable_opencl" = xyes; then
>> > AC_MSG_ERROR([cannot enable OpenCL without Gallium])
>> > fi
>> > - if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4
>> > -a $GCC_VERSION_MINOR -lt 7; then
>> > - AC_MSG_ERROR([gcc >= 4.7 is required to build clover])
>> > - fi
>> > + AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
>> Why check again - you already know the result.
> The result is cached, so calling the macro again is of no run-time
> consequence. The alternative is to replace this one-liner with a three
> line if-then statement (same if I switch to AX_CHECK_COMPILE_FLAG).
Surely a simple if check is not that ugly?
More information about the mesa-dev