[Mesa-dev] [PATCH v4 0/2] build system: Unify c++11 detection and used [was: configure+mesa/st:check -std=c++11 support and enable tests accordingly]

Gert Wollny gw.fossdev at gmail.com
Mon Oct 16 18:58:23 UTC 2017


Am Montag, den 16.10.2017, 10:31 -0400 schrieb Chuck Atkins:
> Hi Gert, Emil, 
> 
> > I think that using the -std=c++11 check should be good,
> 
> A few things to consider, neither of which is a deal breaker, I just
> want to make sure they're not forgotten about:
> #1 -std=c++ will cover many cases, but not all.  Many commercial
> compilers use a different set of options 
[...]
> #2 This only checks support for language suport, not std library
> support.  This can be problematic where your compiler doesn't have
> it's own standard library (i.e. Intel and PGI).  This puts you in a
> wierd spot where things like range-for loops work because they're a
> language feature but std::unique_ptr is not available because it's an
> std lib feature.


> Both of these are managable, #1 by looping through possible flags to
> test for and #2 by performing a test compile of C++ code using
> required library features and the compiler flags accepted by #1.  
> I would even venture to say they could be accounted for as needed,
> rather than dealt with apriori. 

Well, my second patch set was using an m4 file that did exactly that.
It would, however, only run one compile test to check whether the
features of the requested standard are available (with or without
additional compiler flags), but as Emil pointed out, nobody really
wants to maintain custom m4 files (and I myself am also far from an
expert, I just grabbed a m4 file that was on the Internet). 

I also think adding a test for each C++11 feature used in the code is
too tedious, regardless of the build system, and it would really need a
dedicated maintainer. 

> The use cases should not be forgotten though.  Neither of these are
> common on a typical end-user linux desktop but they are the norm on
> HPC / SuperComputing systems, where Mesa+llvmpipe or Mesa+swr are
> heavily relied on for rendering in cpu-only compute clusters.

With that in mind I think the best solution to accommodate these use
cases too without adding an m4 file is to add a configure flag that
makes it possible to set the c++11 enabling flag manually, and harvest
the swr compile check that tests whether __cplusplus >= 201103L with
this flag set, and maybe add some standard library feature check.

Opinions? 

Best, 
Gert



More information about the mesa-dev mailing list