[Mesa-dev] [PATCH v2] configure+mesa/st: check -std=c++11 support and enable tests accordingly

Gert Wollny gw.fossdev at gmail.com
Sun Sep 17 07:32:43 UTC 2017


The tests in mesa/st/tests require C++11. Check whether the compiler
supports the -std=c++11 flag and if so, enable the tests. Otherwise
skip compiling and running the tests altogether.

Fixes: 7be6d8fe12  ("mesa/st: glsl_to_tgsi: add tests for the
new temporary lifetime tracker")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102665
---
- Submitter has no mesa-git write access
- Changes w.r.t v1: 
  * correct white space errors
  * Add "Fixes" to commit message 

 configure.ac                             | 3 +++
 src/mesa/state_tracker/tests/Makefile.am | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/configure.ac b/configure.ac
index 605c9b4e99..6ba300ec14 100644
--- a/configure.ac
+++ b/configure.ac
@@ -301,8 +301,11 @@ 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_CHECK_COMPILE_FLAG([-std=c++11],                            [std_cxx11=yes])
 AC_LANG_POP([C++])
 
+AM_CONDITIONAL(HAVE_STD_CXX11, test "x$std_cxx11" = xyes)
+
 # 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
diff --git a/src/mesa/state_tracker/tests/Makefile.am b/src/mesa/state_tracker/tests/Makefile.am
index f32957608e..90451a153c 100644
--- a/src/mesa/state_tracker/tests/Makefile.am
+++ b/src/mesa/state_tracker/tests/Makefile.am
@@ -1,3 +1,6 @@
+# The tests require c++11 support
+if HAVE_STD_CXX11
+
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
@@ -32,3 +35,5 @@ st_renumerate_test_LDADD = \
 	$(top_builddir)/src/gtest/libgtest.la \
 	$(GALLIUM_COMMON_LIB_DEPS) \
 	$(LLVM_LIBS)
+
+endif
-- 
2.13.5



More information about the mesa-dev mailing list