[gnome-common/wip/deprecate-cxx-macros: 1/2] gnome-compiler-flags: Split out argument checking



commit 13ad1b1cb88c4703bed9855ddbe46f98acab5755
Author: David King <amigadave amigadave com>
Date:   Thu May 8 11:58:00 2014 +0100

    gnome-compiler-flags: Split out argument checking
    
    This will be helpful when calling GNOME_COMPILE_WARNINGS multiple times.

 macros2/gnome-compiler-flags.m4 |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/macros2/gnome-compiler-flags.m4 b/macros2/gnome-compiler-flags.m4
index cd1a0f5..56dc986 100644
--- a/macros2/gnome-compiler-flags.m4
+++ b/macros2/gnome-compiler-flags.m4
@@ -1,8 +1,23 @@
 # gnome-compiler-flags.m4
 #
-# serial 2
+# serial 3
 #
 
+dnl _GNOME_ARG_ENABLE_COMPILE_WARNINGS
+dnl
+dnl Helper macro of GNOME_COMPILE_WARNINGS(). Pulled in through AC_REQUIRE() so
+dnl that it is only expanded once.
+dnl
+m4_define([_GNOME_ARG_ENABLE_COMPILE_WARNINGS],
+[dnl
+AC_PROVIDE([$0])[]dnl
+AC_ARG_ENABLE([compile-warnings],
+              [AS_HELP_STRING([[--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@]],
+                              [Turn on compiler warnings])],
+              [enable_compile_warnings=$enableval],
+              [enable_compile_warnings=yes])[]dnl
+])
+
 dnl GNOME_COMPILE_WARNINGS
 dnl Turn on many useful compiler warnings and substitute the result into
 dnl WARN_CFLAGS
@@ -13,15 +28,12 @@ dnl Additional warning/error flags can be passed as an optional second argument.
 dnl
 dnl For example: GNOME_COMPILE_WARNINGS([maximum],[-Werror=some-flag -Wfoobar])
 AC_DEFUN([GNOME_COMPILE_WARNINGS],[
+    AC_REQUIRE([_GNOME_ARG_ENABLE_COMPILE_WARNINGS])[]dnl
+
     dnl ******************************
     dnl More compiler warnings
     dnl ******************************
 
-    AC_ARG_ENABLE(compile-warnings, 
-                  AS_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
-                                 [Turn on compiler warnings]),,
-                  [enable_compile_warnings="m4_default([$1],[yes])"])
-
     if test "x$GCC" != xyes; then
        enable_compile_warnings=no
     fi


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]