configure: allow adding compiler-specific warning flags
[babeltrace.git] / m4 / ax_compiler_flags_gir.m4
... / ...
CommitLineData
1# ===========================================================================
2# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_gir.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7# AX_COMPILER_FLAGS_GIR([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
8#
9# DESCRIPTION
10#
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.
15#
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.
19#
20# LICENSE
21#
22# Copyright (c) 2015 Philip Withnall <philip@tecnocode.co.uk>
23#
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.
28
29#serial 6
30
31AC_DEFUN([AX_COMPILER_FLAGS_GIR],[
32 AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
33
34 # Variable names
35 m4_define([ax_warn_scannerflags_variable],
36 [m4_normalize(ifelse([$1],,[WARN_SCANNERFLAGS],[$1]))])
37
38 # Base flags
39 AX_APPEND_FLAG([$3],ax_warn_scannerflags_variable)
40
41 AS_IF([test "$ax_enable_compile_warnings" != "no"],[
42 # "yes" flags
43 AX_APPEND_FLAG([ dnl
44 --warn-all dnl
45 $4 dnl
46 $5 dnl
47 $6 dnl
48 $7 dnl
49 ],ax_warn_scannerflags_variable)
50 ])
51 AS_IF([test "$ax_enable_compile_warnings" = "error"],[
52 # "error" flags
53 AX_APPEND_FLAG([ dnl
54 --warn-error dnl
55 ],ax_warn_scannerflags_variable)
56 ])
57
58 # Substitute the variables
59 AC_SUBST(ax_warn_scannerflags_variable)
60])dnl AX_COMPILER_FLAGS
This page took 0.022202 seconds and 4 git commands to generate.