From: Martin Vidner Date: Thu, 19 Dec 2019 15:59:12 +0000 (+0100) Subject: Only use -Wsuggest-override if the compiler supports it. (bsc#1160306) X-Git-Tag: v0.8.8^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=db73f0204095f5eed40363b871a8998f79fe55d9;p=thirdparty%2Fsnapper.git Only use -Wsuggest-override if the compiler supports it. (bsc#1160306) should fix building on SLE 12, Fedora 20, 21 --- diff --git a/configure.ac b/configure.ac index ac025169..8196148a 100644 --- a/configure.ac +++ b/configure.ac @@ -56,7 +56,27 @@ dnl Disable it by "configure --disable-silent-rules" or "make V=1" m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) CFLAGS="${CFLAGS} -std=c99 -Wall -Wextra -Wformat -Wmissing-prototypes -Wno-unused-parameter" -CXXFLAGS="${CXXFLAGS} -std=c++11 -Wall -Wextra -Wformat -Wnon-virtual-dtor -Wno-unused-parameter -Wsuggest-override" +CXXFLAGS="${CXXFLAGS} -std=c++11 -Wall -Wextra -Wformat -Wnon-virtual-dtor -Wno-unused-parameter" + +AC_DEFUN([TRY_ADD_CXXFLAGS], [ + AC_MSG_CHECKING([if $CXX supports $1]) + OLD_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="${CXXFLAGS} $1" + AC_LANG_PUSH([C++]) + AC_TRY_COMPILE( + [], [], + [ + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + CXXFLAGS="$OLD_CXXFLAGS" + ] + ) + AC_LANG_POP([C++]) +]) + +TRY_ADD_CXXFLAGS([-Wsuggest-override]) SYSCONFIG=/etc/sysconfig diff --git a/zypp-plugin/Makefile.am b/zypp-plugin/Makefile.am index bbaf0b91..9f7e247f 100644 --- a/zypp-plugin/Makefile.am +++ b/zypp-plugin/Makefile.am @@ -6,7 +6,6 @@ plugindir = /usr/lib/zypp/plugins/commit plugin_PROGRAMS = snapper-zypp-plugin AM_CPPFLAGS = $(DBUS_CFLAGS) $(XML2_CFLAGS) $(JSONC_CFLAGS) -AM_CXXFLAGS = -Wsuggest-override snapper_zypp_plugin_SOURCES = \ snapper_zypp_plugin.cc \ solvable_matcher.cc solvable_matcher.h \