[v2,1/6] Allow C++17 code to be compiled

Message ID 20210622103318.478914-2-gprocida@google.com
State New
Headers
Series BTF ABI |

Commit Message

Giuliano Procida June 22, 2021, 10:33 a.m. UTC
  The BTF code and abitidy tool were both developed in a C++17
environment. Allow C++17 to be enabled at configuration time.

	* configure.ac: Add --enable-cxx17 option, defaulting to no.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 configure.ac | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
  

Patch

diff --git a/configure.ac b/configure.ac
index 735cc9de..edd03cf8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -138,6 +138,12 @@  AC_ARG_ENABLE(ubsan,
 	      ENABLE_UBSAN=$enableval,
 	      ENABLE_UBSAN=no)
 
+AC_ARG_ENABLE(cxx17,
+	      AS_HELP_STRING([--enable-cxx17=yes|no],
+			     [enable features that use the C++17 compiler]),
+	      ENABLE_CXX17=$enableval,
+	      ENABLE_CXX17=no)
+
 dnl *************************************************
 dnl check for dependencies
 dnl *************************************************
@@ -153,7 +159,7 @@  AC_LANG([C++])
 AC_LANG_COMPILER_REQUIRE
 
 dnl
-dnl We use C++11
+dnl We use C++11 or C++17 if enabled
 dnl
 CXX_STANDARD=c++11
 
@@ -591,6 +597,12 @@  AX_VALGRIND_DFLT(sgcheck, off)
 
 AX_VALGRIND_CHECK
 
+dnl Handle conditional use of a C++17 compiler
+if test x$ENABLE_CXX17 = xyes; then
+   CXX_STANDARD=c++17
+fi
+AM_CONDITIONAL(ENABLE_CXX17, test x$ENABLE_CXX17 = xyes)
+
 dnl Set the list of libraries libabigail depends on
 
 DEPS_LIBS="$XML_LIBS $ELF_LIBS $DW_LIBS"