summaryrefslogtreecommitdiffstats
path: root/libraries/bamf/add_compile_warning_flags.patch
blob: 203ccc75d33d2306536e5350572de26a5888aebf (plain)
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=940164

diff -Naur bamf-0.5.4.orig/configure.ac bamf-0.5.4/configure.ac
--- bamf-0.5.4.orig/configure.ac	2018-11-07 23:39:11.355315678 +0100
+++ bamf-0.5.4/configure.ac	2019-11-18 12:57:04.534000000 +0100
@@ -18,14 +18,15 @@
 GNOME_COMPILE_WARNINGS(maximum)
 
 AM_MAINTAINER_MODE
-AM_DISABLE_STATIC
-AM_PROG_LIBTOOL
 AC_ISC_POSIX
 AC_SUBST(ACLOCAL_AMFLAFS, "$ACLOCAL_FLAGS -I m4")
 
 PKG_PROG_PKG_CONFIG
 if test "x$PKG_CONFIG" = "x"; then AC_MSG_ERROR([You need to install pkg-config]); fi
 
+LT_INIT([disable-static])
+LT_LIB_M
+
 # Checks for programs.
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -154,8 +155,39 @@
 #
 AM_PATH_GTK_3_0
 
+# Compile warnings
+AC_ARG_ENABLE(compile-warnings,
+              AS_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
+                             [Trun on compiler warnings]),,
+              [enable_compile_warnings=maximum])
+
+warning_flags=
+
+case "$enable_compile_warnings" in
+no)
+warning_flags=
+;;
+minimum)
+warning_flags="-Wall"
+;;
+yes)
+warning_flags="-wall -Wno-error=deprecated-declarations"
+;;
+maximum|error)
+warning_flags="-Wall -Wno-error=deprecated-declarations -Wempty-body -Wformat-security -Winit-self -Warray-bounds -Wimplicit-function-declaration"
+if test "$enable_compile_warnings" = "error" ; then
+    warning_flags="$warning_flags -Werror"
+fi
+;;
+*)
+AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
+;;
+esac
+AC_MSG_CHECKING(what warning flags to pass to the C compiler)
+AC_MSG_RESULT($warning_flags)
+
 dnl CFLAGS
-CFLAGS="$CFLAGS -Wall -Werror -Wno-error=deprecated-declarations -Wempty-body -Wformat-security -Winit-self -Warray-bounds -Wimplicit-function-declaration -lm"
+CFLAGS="$CFLAGS $warning_flags $LIBM"
 
 AC_SUBST(BAMFDAEMON_CFLAGS)
 AC_SUBST(BAMFDAEMON_LIBS)
@@ -190,5 +222,6 @@
     Headless tests:       ${enable_headless_tests}
     Coverage Reporting:   ${use_gcov}
     Export actions menus: ${enable_export_actions_menu} 
+    Compiler Flags:       ${CFLAGS}
 
 EOF