[Mesa-dev] [PATCH] configure+mesa/st/tests: avoid building with pre c++11 compilers

Gert Wollny gw.fossdev at gmail.com
Sat Sep 16 16:56:16 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.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102665
---
- Submitter has no write access to mesa-git.  

 configure.ac                             | 3 +++
 src/mesa/state_tracker/tests/Makefile.am | 7 +++++++
 2 files changed, 10 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..55eef200b5 100644
--- a/src/mesa/state_tracker/tests/Makefile.am
+++ b/src/mesa/state_tracker/tests/Makefile.am
@@ -1,3 +1,7 @@
+
+# The tests require c++11 support
+if HAVE_STD_CXX11
+
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
@@ -15,6 +19,7 @@ AM_CPPFLAGS = \
 	-I$(top_builddir)/src/compiler/glsl \
 	$(DEFINES)
 
+
 TESTS = st-renumerate-test
 check_PROGRAMS = st-renumerate-test
 
@@ -32,3 +37,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