Version 3.28.1
[yelp.git] / m4 / ax_compiler_flags_gir.m4
blob99a27c1c3b2f8c96a17d74c3b4d19f6b248fc80d
1 # ===========================================================================
2 #   http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_gir.html
3 # ===========================================================================
5 # SYNOPSIS
7 #   AX_COMPILER_FLAGS_GIR([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-MINIMUM-FLAGS], [EXTRA-YES-FLAGS], [EXTRA-MAXIMUM-FLAGS], [EXTRA-ERROR-FLAGS])
9 # DESCRIPTION
11 #   Add warning flags for the g-ir-scanner (from GObject Introspection) to
12 #   VARIABLE, which defaults to WARN_SCANNERFLAGS.  VARIABLE is AC_SUBST-ed
13 #   by this macro, but must be manually added to the SCANNERFLAGS variable
14 #   for each GIR target in the code base.
16 #   This macro depends on the environment set up by AX_COMPILER_FLAGS.
17 #   Specifically, it uses the value of $ax_enable_compile_warnings to decide
18 #   which flags to enable.
20 # LICENSE
22 #   Copyright (c) 2015 Philip Withnall <philip@tecnocode.co.uk>
24 #   Copying and distribution of this file, with or without modification, are
25 #   permitted in any medium without royalty provided the copyright notice
26 #   and this notice are preserved.  This file is offered as-is, without any
27 #   warranty.
29 #serial 3
31 AC_DEFUN([AX_COMPILER_FLAGS_GIR],[
32     AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
34     # Variable names
35     m4_define(ax_warn_scannerflags_variable,
36               [m4_normalize(ifelse([$1],,[WARN_SCANNERFLAGS],[$1]))])
38     # Base flags
39     AX_APPEND_FLAG([$3],ax_warn_scannerflags_variable)
41     AS_IF([test "$ax_enable_compile_warnings" != "no"],[
42         # "minimum" flags
43         AX_APPEND_FLAG([ dnl
44             --warn-all dnl
45             $4 dnl
46         ],ax_warn_scannerflags_variable)
47     ])
48     AS_IF([test "$ax_enable_compile_warnings" != "no" -a \
49                 "$ax_enable_compile_warnings" != "minimum"],[
50         # "yes" flags
51         AX_APPEND_FLAG([$5],ax_warn_scannerflags_variable)
52     ])
53     AS_IF([test "$ax_enable_compile_warnings" = "maximum" -o \
54                 "$ax_enable_compile_warnings" = "error"],[
55         # "maximum" flags
56         AX_APPEND_FLAG([$6],ax_warn_scannerflags_variable)
57     ])
58     AS_IF([test "$ax_enable_compile_warnings" = "error"],[
59         # "error" flags
60         AX_APPEND_FLAG([ dnl
61             --warn-error dnl
62             $7 dnl
63         ],ax_warn_scannerflags_variable)
64     ])
66     # Substitute the variables
67     AC_SUBST(ax_warn_scannerflags_variable)
68 ])dnl AX_COMPILER_FLAGS