Ensure a consistent C++ standard use
authorMatthias Maennich <maennich@google.com>
Mon, 22 Jul 2019 08:39:40 +0000 (09:39 +0100)
committerDodji Seketeli <dodji@redhat.com>
Mon, 22 Jul 2019 09:18:13 +0000 (11:18 +0200)
On older compilers (such as g++ 4.8), the default C++ standard is set to
gnu++98. When compiling libabigail with --enable-cxx11=yes, src/ and
tests/ where compiled with the correct flag, while tools/ was compiled
without specifying a standard. With a compiler falling back to gnu++98
that leads to unresolved references when linking the tools against the
libabigail library. Fix that by consistently using the std= flag across
the code base.

* configure.ac: add -std=c++11 flag to CXXFLAGS when compiling
for C++11
* src/Makefile.am: drop now obsolete setting of the -std flag
* tests/Makefile.am: likewise

Reported-by: Chun-Hung Wu <Chun-hung.Wu@mediatek.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
configure.ac
src/Makefile.am
tests/Makefile.am

index afcc1db065e9bab10f9bcda1d8b6034204ea72e2..44e951f5bdb4250247e2671b912eadc7c5988e75 100644 (file)
@@ -545,6 +545,7 @@ AC_SUBST(DEPS_CPPFLAGS)
 
 dnl Handle conditional use of a C++11 compiler
 if test x$ENABLE_CXX11 = xyes; then
+   CXXFLAGS="$CXXFLAGS -std=c++11"
    AC_DEFINE([WITH_CXX11], 1, [Defined to 1 if a C++11 compiler is used])
 fi
 
index 7c02d538c50dd67f5755ce49af4ec3cd9e07c583..1d0e2dcecdeecf38c7630736dd23cc0753e24ff1 100644 (file)
@@ -7,7 +7,6 @@ if ENABLE_CXX11
 CXX11_SOURCES = abg-viz-common.cc                      \
                abg-viz-dot.cc                          \
                abg-viz-svg.cc
-AM_CXXFLAGS += "-std=c++11"
 else
 CXX11_SOURCES =
 endif
index 2104300aed221a809f0bc205784cd2784a9cf868..14e83608b0e530dd0e4d225cef8a2489f693b0e6 100644 (file)
@@ -13,7 +13,6 @@ AM_CXXFLAGS = $(VISIBILITY_FLAGS)
 CXX11_TESTS =
 if ENABLE_CXX11
 CXX11_TESTS += runtestsvg
-AM_CXXFLAGS += "-std=c++11"
 endif
 
 FEDABIPKGDIFF_TEST =