Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sandbox:master commit in: /, m4/
Date: Sun, 20 Sep 2015 08:15:32
Message-Id: 1442122202.182cde0e780e2b3b0bc7de51f4712c54f47c89ad.vapier@gentoo
1 commit: 182cde0e780e2b3b0bc7de51f4712c54f47c89ad
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 13 05:30:02 2015 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 13 05:30:02 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=182cde0e
7
8 update autotool files
9
10 Fix up the recursive logic with the ax processing so we actually grab all
11 the ones we need. We probably grab too many, but meh.
12
13 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
14
15 INSTALL | 6 +-
16 autogen.sh | 15 ++--
17 m4/ax_append_compile_flags.m4 | 6 +-
18 m4/ax_append_flag.m4 | 30 ++++----
19 m4/ax_append_link_flags.m4 | 6 +-
20 m4/ax_cflags_force_c89.m4 | 4 +-
21 m4/ax_cflags_strict_prototypes.m4 | 4 +-
22 m4/ax_cflags_warn_all.m4 | 4 +-
23 m4/ax_check_compile_flag.m4 | 12 +--
24 m4/ax_check_link_flag.m4 | 13 ++--
25 m4/ax_compiler_flags.m4 | 158 ++++++++++++++++++++++++++++++++++++++
26 m4/ax_compiler_flags_cflags.m4 | 132 +++++++++++++++++++++++++++++++
27 m4/ax_compiler_flags_cxxflags.m4 | 128 ++++++++++++++++++++++++++++++
28 m4/ax_compiler_flags_gir.m4 | 60 +++++++++++++++
29 m4/ax_compiler_flags_ldflags.m4 | 75 ++++++++++++++++++
30 m4/ax_require_defined.m4 | 37 +++++++++
31 16 files changed, 646 insertions(+), 44 deletions(-)
32
33 diff --git a/INSTALL b/INSTALL
34 index 6e90e07..2099840 100644
35 --- a/INSTALL
36 +++ b/INSTALL
37 @@ -1,7 +1,7 @@
38 Installation Instructions
39 *************************
40
41 -Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
42 +Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
43 Inc.
44
45 Copying and distribution of this file, with or without modification,
46 @@ -12,8 +12,8 @@ without warranty of any kind.
47 Basic Installation
48 ==================
49
50 - Briefly, the shell commands `./configure; make; make install' should
51 -configure, build, and install this package. The following
52 + Briefly, the shell command `./configure && make && make install'
53 +should configure, build, and install this package. The following
54 more-detailed instructions are generic; see the `README' file for
55 instructions specific to this package. Some packages provide this
56 `INSTALL' file but do not implement all of the features documented
57
58 diff --git a/autogen.sh b/autogen.sh
59 index 8a53fc8..e583300 100755
60 --- a/autogen.sh
61 +++ b/autogen.sh
62 @@ -5,7 +5,7 @@ touch ChangeLog
63
64 # avoid ugly warnings due to mismatch between local libtool and
65 # whatever updated version is on the host
66 -find m4/*.m4 '!' -name 'ax_*.m4' -delete 2>/dev/null || :
67 +rm -f m4/*.m4
68
69 # not everyone has sys-devel/autoconf-archive installed
70 has() { [[ " ${*:2} " == *" $1 "* ]] ; }
71 @@ -13,9 +13,9 @@ import_ax() {
72 local macro content m4 lm4s=()
73 content=$(sed -e '/^[[:space:]]*#/d' -e 's:\<dnl\>.*::' "$@")
74 for macro in $(echo "${content}" | grep -o '\<AX[A-Z_]*\>' | sort -u) ; do
75 - if m4=$(grep -rl "\[${macro}\]" /usr/share/aclocal/) ; then
76 + for m4 in $(grep -rl "\[${macro}\]" /usr/share/aclocal/) ; do
77 has ${m4} "${m4s[@]}" || lm4s+=( ${m4} )
78 - fi
79 + done
80 done
81 if [[ ${#lm4s[@]} -gt 0 ]] ; then
82 cp -v `printf '%s\n' ${lm4s[@]} | sort -u` m4/
83 @@ -24,8 +24,13 @@ import_ax() {
84 }
85 m4s=()
86 import_ax configure.ac
87 -import_ax m4/ax_*.m4
88 -import_ax m4/ax_*.m4
89 +curr=1
90 +new=0
91 +while [[ ${curr} -ne ${new} ]] ; do
92 + curr=${#m4s[@]}
93 + import_ax m4/ax_*.m4
94 + new=${#m4s[@]}
95 +done
96
97 autoreconf -i -f
98
99
100 diff --git a/m4/ax_append_compile_flags.m4 b/m4/ax_append_compile_flags.m4
101 index 1f8e708..dc7b866 100644
102 --- a/m4/ax_append_compile_flags.m4
103 +++ b/m4/ax_append_compile_flags.m4
104 @@ -54,11 +54,11 @@
105 # modified version of the Autoconf Macro, you may extend this special
106 # exception to the GPL to apply to your modified version as well.
107
108 -#serial 3
109 +#serial 4
110
111 AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
112 -[AC_REQUIRE([AX_CHECK_COMPILE_FLAG])
113 -AC_REQUIRE([AX_APPEND_FLAG])
114 +[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
115 +AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
116 for flag in $1; do
117 AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3])
118 done
119
120 diff --git a/m4/ax_append_flag.m4 b/m4/ax_append_flag.m4
121 index 1d38b76..aeab899 100644
122 --- a/m4/ax_append_flag.m4
123 +++ b/m4/ax_append_flag.m4
124 @@ -49,21 +49,23 @@
125 # modified version of the Autoconf Macro, you may extend this special
126 # exception to the GPL to apply to your modified version as well.
127
128 -#serial 2
129 +#serial 5
130
131 AC_DEFUN([AX_APPEND_FLAG],
132 -[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
133 -AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl
134 -AS_VAR_SET_IF(FLAGS,
135 - [case " AS_VAR_GET(FLAGS) " in
136 - *" $1 "*)
137 - AC_RUN_LOG([: FLAGS already contains $1])
138 - ;;
139 - *)
140 - AC_RUN_LOG([: FLAGS="$FLAGS $1"])
141 - AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"])
142 - ;;
143 - esac],
144 - [AS_VAR_SET(FLAGS,["$1"])])
145 +[dnl
146 +AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
147 +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
148 +AS_VAR_SET_IF(FLAGS,[
149 + AS_CASE([" AS_VAR_GET(FLAGS) "],
150 + [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
151 + [
152 + AS_VAR_APPEND(FLAGS," $1")
153 + AC_RUN_LOG([: FLAGS="$FLAGS"])
154 + ])
155 + ],
156 + [
157 + AS_VAR_SET(FLAGS,[$1])
158 + AC_RUN_LOG([: FLAGS="$FLAGS"])
159 + ])
160 AS_VAR_POPDEF([FLAGS])dnl
161 ])dnl AX_APPEND_FLAG
162
163 diff --git a/m4/ax_append_link_flags.m4 b/m4/ax_append_link_flags.m4
164 index 48cbd4b..c73ddaf 100644
165 --- a/m4/ax_append_link_flags.m4
166 +++ b/m4/ax_append_link_flags.m4
167 @@ -52,11 +52,11 @@
168 # modified version of the Autoconf Macro, you may extend this special
169 # exception to the GPL to apply to your modified version as well.
170
171 -#serial 3
172 +#serial 4
173
174 AC_DEFUN([AX_APPEND_LINK_FLAGS],
175 -[AC_REQUIRE([AX_CHECK_LINK_FLAG])
176 -AC_REQUIRE([AX_APPEND_FLAG])
177 +[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
178 +AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
179 for flag in $1; do
180 AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3])
181 done
182
183 diff --git a/m4/ax_cflags_force_c89.m4 b/m4/ax_cflags_force_c89.m4
184 index 19ada7f..1597b25 100644
185 --- a/m4/ax_cflags_force_c89.m4
186 +++ b/m4/ax_cflags_force_c89.m4
187 @@ -55,7 +55,7 @@
188 # modified version of the Autoconf Macro, you may extend this special
189 # exception to the GPL to apply to your modified version as well.
190
191 -#serial 8
192 +#serial 9
193
194 AC_DEFUN([AX_CFLAGS_FORCE_C89],[dnl
195 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
196 @@ -83,7 +83,7 @@ done
197 AC_LANG_RESTORE
198 ])
199 AS_VAR_POPDEF([FLAGS])dnl
200 -AC_REQUIRE([AX_APPEND_FLAG])
201 +AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
202 case ".$VAR" in
203 .ok|.ok,*) m4_ifvaln($3,$3) ;;
204 .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;;
205
206 diff --git a/m4/ax_cflags_strict_prototypes.m4 b/m4/ax_cflags_strict_prototypes.m4
207 index 2ac34be..3ad4bf0 100644
208 --- a/m4/ax_cflags_strict_prototypes.m4
209 +++ b/m4/ax_cflags_strict_prototypes.m4
210 @@ -58,7 +58,7 @@
211 # modified version of the Autoconf Macro, you may extend this special
212 # exception to the GPL to apply to your modified version as well.
213
214 -#serial 12
215 +#serial 13
216
217 AC_DEFUN([AX_FLAGS_STRICT_PROTOTYPES],[dnl
218 AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl
219 @@ -96,7 +96,7 @@ esac
220 FLAGS="$ac_save_[]FLAGS"
221 ])
222 AS_VAR_POPDEF([FLAGS])dnl
223 -AC_REQUIRE([AX_APPEND_FLAG])
224 +AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
225 case ".$VAR" in
226 .ok|.ok,*) m4_ifvaln($3,$3) ;;
227 .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;;
228
229 diff --git a/m4/ax_cflags_warn_all.m4 b/m4/ax_cflags_warn_all.m4
230 index 0fa3e18..1f07799 100644
231 --- a/m4/ax_cflags_warn_all.m4
232 +++ b/m4/ax_cflags_warn_all.m4
233 @@ -58,7 +58,7 @@
234 # modified version of the Autoconf Macro, you may extend this special
235 # exception to the GPL to apply to your modified version as well.
236
237 -#serial 14
238 +#serial 15
239
240 AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl
241 AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl
242 @@ -84,7 +84,7 @@ done
243 FLAGS="$ac_save_[]FLAGS"
244 ])
245 AS_VAR_POPDEF([FLAGS])dnl
246 -AC_REQUIRE([AX_APPEND_FLAG])
247 +AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
248 case ".$VAR" in
249 .ok|.ok,*) m4_ifvaln($3,$3) ;;
250 .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;;
251
252 diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4
253 index c3a8d69..ca36397 100644
254 --- a/m4/ax_check_compile_flag.m4
255 +++ b/m4/ax_check_compile_flag.m4
256 @@ -4,7 +4,7 @@
257 #
258 # SYNOPSIS
259 #
260 -# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
261 +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
262 #
263 # DESCRIPTION
264 #
265 @@ -19,6 +19,8 @@
266 # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
267 # force the compiler to issue an error when a bad flag is given.
268 #
269 +# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
270 +#
271 # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
272 # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
273 #
274 @@ -53,19 +55,19 @@
275 # modified version of the Autoconf Macro, you may extend this special
276 # exception to the GPL to apply to your modified version as well.
277
278 -#serial 2
279 +#serial 4
280
281 AC_DEFUN([AX_CHECK_COMPILE_FLAG],
282 -[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
283 +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
284 AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
285 AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
286 ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
287 _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
288 - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
289 + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
290 [AS_VAR_SET(CACHEVAR,[yes])],
291 [AS_VAR_SET(CACHEVAR,[no])])
292 _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
293 -AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
294 +AS_VAR_IF(CACHEVAR,yes,
295 [m4_default([$2], :)],
296 [m4_default([$3], :)])
297 AS_VAR_POPDEF([CACHEVAR])dnl
298
299 diff --git a/m4/ax_check_link_flag.m4 b/m4/ax_check_link_flag.m4
300 index e2d0d36..eb01a6c 100644
301 --- a/m4/ax_check_link_flag.m4
302 +++ b/m4/ax_check_link_flag.m4
303 @@ -4,7 +4,7 @@
304 #
305 # SYNOPSIS
306 #
307 -# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
308 +# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
309 #
310 # DESCRIPTION
311 #
312 @@ -19,6 +19,8 @@
313 # EXTRA-FLAGS FLAG". This can for example be used to force the linker to
314 # issue an error when a bad flag is given.
315 #
316 +# INPUT gives an alternative input source to AC_LINK_IFELSE.
317 +#
318 # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
319 # macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
320 #
321 @@ -53,18 +55,19 @@
322 # modified version of the Autoconf Macro, you may extend this special
323 # exception to the GPL to apply to your modified version as well.
324
325 -#serial 2
326 +#serial 4
327
328 AC_DEFUN([AX_CHECK_LINK_FLAG],
329 -[AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
330 +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
331 +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
332 AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
333 ax_check_save_flags=$LDFLAGS
334 LDFLAGS="$LDFLAGS $4 $1"
335 - AC_LINK_IFELSE([AC_LANG_PROGRAM()],
336 + AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
337 [AS_VAR_SET(CACHEVAR,[yes])],
338 [AS_VAR_SET(CACHEVAR,[no])])
339 LDFLAGS=$ax_check_save_flags])
340 -AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
341 +AS_VAR_IF(CACHEVAR,yes,
342 [m4_default([$2], :)],
343 [m4_default([$3], :)])
344 AS_VAR_POPDEF([CACHEVAR])dnl
345
346 diff --git a/m4/ax_compiler_flags.m4 b/m4/ax_compiler_flags.m4
347 new file mode 100644
348 index 0000000..c52ae7d
349 --- /dev/null
350 +++ b/m4/ax_compiler_flags.m4
351 @@ -0,0 +1,158 @@
352 +# ===========================================================================
353 +# http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html
354 +# ===========================================================================
355 +#
356 +# SYNOPSIS
357 +#
358 +# AX_COMPILER_FLAGS([CFLAGS-VARIABLE], [LDFLAGS-VARIABLE], [IS-RELEASE], [EXTRA-BASE-CFLAGS], [EXTRA-YES-CFLAGS], [UNUSED], [UNUSED], [UNUSED], [EXTRA-BASE-LDFLAGS], [EXTRA-YES-LDFLAGS], [UNUSED], [UNUSED], [UNUSED])
359 +#
360 +# DESCRIPTION
361 +#
362 +# Check for the presence of an --enable-compile-warnings option to
363 +# configure, defaulting to "error" in normal operation, or "yes" if
364 +# IS-RELEASE is equal to "yes". Return the value in the variable
365 +# $ax_enable_compile_warnings.
366 +#
367 +# Depending on the value of --enable-compile-warnings, different compiler
368 +# warnings are checked to see if they work with the current compiler and,
369 +# if so, are appended to CFLAGS-VARIABLE and LDFLAGS-VARIABLE. This
370 +# allows a consistent set of baseline compiler warnings to be used across
371 +# a code base, irrespective of any warnings enabled locally by individual
372 +# developers. By standardising the warnings used by all developers of a
373 +# project, the project can commit to a zero-warnings policy, using -Werror
374 +# to prevent compilation if new warnings are introduced. This makes
375 +# catching bugs which are flagged by warnings a lot easier.
376 +#
377 +# By providing a consistent --enable-compile-warnings argument across all
378 +# projects using this macro, continuous integration systems can easily be
379 +# configured the same for all projects. Automated systems or build
380 +# systems aimed at beginners may want to pass the --disable-Werror
381 +# argument to unconditionally prevent warnings being fatal.
382 +#
383 +# --enable-compile-warnings can take the values:
384 +#
385 +# * no: Base compiler warnings only; not even -Wall.
386 +# * yes: The above, plus a broad range of useful warnings.
387 +# * error: The above, plus -Werror so that all warnings are fatal.
388 +# Use --disable-Werror to override this and disable fatal
389 +# warnings.
390 +#
391 +# The set of base and enabled flags can be augmented using the
392 +# EXTRA-*-CFLAGS and EXTRA-*-LDFLAGS variables, which are tested and
393 +# appended to the output variable if --enable-compile-warnings is not
394 +# "no". Flags should not be disabled using these arguments, as the entire
395 +# point of AX_COMPILER_FLAGS is to enforce a consistent set of useful
396 +# compiler warnings on code, using warnings which have been chosen for low
397 +# false positive rates. If a compiler emits false positives for a
398 +# warning, a #pragma should be used in the code to disable the warning
399 +# locally. See:
400 +#
401 +# https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
402 +#
403 +# The EXTRA-* variables should only be used to supply extra warning flags,
404 +# and not general purpose compiler flags, as they are controlled by
405 +# configure options such as --disable-Werror.
406 +#
407 +# IS-RELEASE can be used to disable -Werror when making a release, which
408 +# is useful for those hairy moments when you just want to get the release
409 +# done as quickly as possible. Set it to "yes" to disable -Werror. By
410 +# default, it uses the value of $ax_is_release, so if you are using the
411 +# AX_IS_RELEASE macro, there is no need to pass this parameter. For
412 +# example:
413 +#
414 +# AX_IS_RELEASE([git-directory])
415 +# AX_COMPILER_FLAGS()
416 +#
417 +# CFLAGS-VARIABLE defaults to WARN_CFLAGS, and LDFLAGS-VARIABLE defaults
418 +# to WARN_LDFLAGS. Both variables are AC_SUBST-ed by this macro, but must
419 +# be manually added to the CFLAGS and LDFLAGS variables for each target in
420 +# the code base.
421 +#
422 +# If C++ language support is enabled with AC_PROG_CXX, which must occur
423 +# before this macro in configure.ac, warning flags for the C++ compiler
424 +# are AC_SUBST-ed as WARN_CXXFLAGS, and must be manually added to the
425 +# CXXFLAGS variables for each target in the code base. EXTRA-*-CFLAGS can
426 +# be used to augment the base and enabled flags.
427 +#
428 +# Warning flags for g-ir-scanner (from GObject Introspection) are
429 +# AC_SUBST-ed as WARN_SCANNERFLAGS. This variable must be manually added
430 +# to the SCANNERFLAGS variable for each GIR target in the code base. If
431 +# extra g-ir-scanner flags need to be enabled, the AX_COMPILER_FLAGS_GIR
432 +# macro must be invoked manually.
433 +#
434 +# AX_COMPILER_FLAGS may add support for other tools in future, in addition
435 +# to the compiler and linker. No extra EXTRA-* variables will be added
436 +# for those tools, and all extra support will still use the single
437 +# --enable-compile-warnings configure option. For finer grained control
438 +# over the flags for individual tools, use AX_COMPILER_FLAGS_CFLAGS,
439 +# AX_COMPILER_FLAGS_LDFLAGS and AX_COMPILER_FLAGS_* for new tools.
440 +#
441 +# The UNUSED variables date from a previous version of this macro, and are
442 +# automatically appended to the preceding non-UNUSED variable. They should
443 +# be left empty in new uses of the macro.
444 +#
445 +# LICENSE
446 +#
447 +# Copyright (c) 2014, 2015 Philip Withnall <philip@××××××××××××.uk>
448 +# Copyright (c) 2015 David King <amigadave@×××××××××.com>
449 +#
450 +# Copying and distribution of this file, with or without modification, are
451 +# permitted in any medium without royalty provided the copyright notice
452 +# and this notice are preserved. This file is offered as-is, without any
453 +# warranty.
454 +
455 +#serial 12
456 +
457 +# _AX_COMPILER_FLAGS_LANG([LANGNAME])
458 +m4_defun([_AX_COMPILER_FLAGS_LANG],
459 +[m4_ifdef([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [],
460 + [m4_define([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [])dnl
461 + AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_]$1[FLAGS])])dnl
462 +])
463 +
464 +AC_DEFUN([AX_COMPILER_FLAGS],[
465 + # C support is enabled by default.
466 + _AX_COMPILER_FLAGS_LANG([C])
467 + # Only enable C++ support if AC_PROG_CXX is called. The redefinition of
468 + # AC_PROG_CXX is so that a fatal error is emitted if this macro is called
469 + # before AC_PROG_CXX, which would otherwise cause no C++ warnings to be
470 + # checked.
471 + AC_PROVIDE_IFELSE([AC_PROG_CXX],
472 + [_AX_COMPILER_FLAGS_LANG([CXX])],
473 + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AX_COMPILER_FLAGS_LANG([CXX])])])
474 + AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_LDFLAGS])
475 +
476 + # Default value for IS-RELEASE is $ax_is_release
477 + ax_compiler_flags_is_release=m4_tolower(m4_normalize(ifelse([$3],,
478 + [$ax_is_release],
479 + [$3])))
480 +
481 + AC_ARG_ENABLE([compile-warnings],
482 + AS_HELP_STRING([--enable-compile-warnings=@<:@no/yes/error@:>@],
483 + [Enable compiler warnings and errors]),,
484 + [AS_IF([test "$ax_compiler_flags_is_release" = "yes"],
485 + [enable_compile_warnings="yes"],
486 + [enable_compile_warnings="error"])])
487 + AC_ARG_ENABLE([Werror],
488 + AS_HELP_STRING([--disable-Werror],
489 + [Unconditionally make all compiler warnings non-fatal]),,
490 + [enable_Werror=maybe])
491 +
492 + # Return the user’s chosen warning level
493 + AS_IF([test "$enable_Werror" = "no" -a \
494 + "$enable_compile_warnings" = "error"],[
495 + enable_compile_warnings="yes"
496 + ])
497 +
498 + ax_enable_compile_warnings=$enable_compile_warnings
499 +
500 + AX_COMPILER_FLAGS_CFLAGS([$1],[$ax_compiler_flags_is_release],
501 + [$4],[$5 $6 $7 $8])
502 + m4_ifdef([_AX_COMPILER_FLAGS_LANG_CXX_enabled],
503 + [AX_COMPILER_FLAGS_CXXFLAGS([WARN_CXXFLAGS],
504 + [$ax_compiler_flags_is_release],
505 + [$4],[$5 $6 $7 $8])])
506 + AX_COMPILER_FLAGS_LDFLAGS([$2],[$ax_compiler_flags_is_release],
507 + [$9],[$10 $11 $12 $13])
508 + AX_COMPILER_FLAGS_GIR([WARN_SCANNERFLAGS],[$ax_compiler_flags_is_release])
509 +])dnl AX_COMPILER_FLAGS
510
511 diff --git a/m4/ax_compiler_flags_cflags.m4 b/m4/ax_compiler_flags_cflags.m4
512 new file mode 100644
513 index 0000000..295d7fe
514 --- /dev/null
515 +++ b/m4/ax_compiler_flags_cflags.m4
516 @@ -0,0 +1,132 @@
517 +# ============================================================================
518 +# http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cflags.html
519 +# ============================================================================
520 +#
521 +# SYNOPSIS
522 +#
523 +# AX_COMPILER_FLAGS_CFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
524 +#
525 +# DESCRIPTION
526 +#
527 +# Add warning flags for the C compiler to VARIABLE, which defaults to
528 +# WARN_CFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be
529 +# manually added to the CFLAGS variable for each target in the code base.
530 +#
531 +# This macro depends on the environment set up by AX_COMPILER_FLAGS.
532 +# Specifically, it uses the value of $ax_enable_compile_warnings to decide
533 +# which flags to enable.
534 +#
535 +# LICENSE
536 +#
537 +# Copyright (c) 2014, 2015 Philip Withnall <philip@××××××××××××.uk>
538 +#
539 +# Copying and distribution of this file, with or without modification, are
540 +# permitted in any medium without royalty provided the copyright notice
541 +# and this notice are preserved. This file is offered as-is, without any
542 +# warranty.
543 +
544 +#serial 8
545 +
546 +AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
547 + AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
548 + AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
549 + AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
550 +
551 + # Variable names
552 + m4_define(ax_warn_cflags_variable,
553 + [m4_normalize(ifelse([$1],,[WARN_CFLAGS],[$1]))])
554 +
555 + AC_LANG_PUSH([C])
556 +
557 + # Always pass -Werror=unknown-warning-option to get Clang to fail on bad
558 + # flags, otherwise they are always appended to the warn_cflags variable, and
559 + # Clang warns on them for every compilation unit.
560 + # If this is passed to GCC, it will explode, so the flag must be enabled
561 + # conditionally.
562 + AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[
563 + ax_compiler_flags_test="-Werror=unknown-warning-option"
564 + ],[
565 + ax_compiler_flags_test=""
566 + ])
567 +
568 + # Base flags
569 + AX_APPEND_COMPILE_FLAGS([ dnl
570 + -fno-strict-aliasing dnl
571 + $3 dnl
572 + ],ax_warn_cflags_variable,[$ax_compiler_flags_test])
573 +
574 + AS_IF([test "$ax_enable_compile_warnings" != "no"],[
575 + # "yes" flags
576 + AX_APPEND_COMPILE_FLAGS([ dnl
577 + -Wall dnl
578 + -Wextra dnl
579 + -Wundef dnl
580 + -Wnested-externs dnl
581 + -Wwrite-strings dnl
582 + -Wpointer-arith dnl
583 + -Wmissing-declarations dnl
584 + -Wmissing-prototypes dnl
585 + -Wstrict-prototypes dnl
586 + -Wredundant-decls dnl
587 + -Wno-unused-parameter dnl
588 + -Wno-missing-field-initializers dnl
589 + -Wdeclaration-after-statement dnl
590 + -Wformat=2 dnl
591 + -Wold-style-definition dnl
592 + -Wcast-align dnl
593 + -Wformat-nonliteral dnl
594 + -Wformat-security dnl
595 + -Wsign-compare dnl
596 + -Wstrict-aliasing dnl
597 + -Wshadow dnl
598 + -Winline dnl
599 + -Wpacked dnl
600 + -Wmissing-format-attribute dnl
601 + -Wmissing-noreturn dnl
602 + -Winit-self dnl
603 + -Wredundant-decls dnl
604 + -Wmissing-include-dirs dnl
605 + -Wunused-but-set-variable dnl
606 + -Warray-bounds dnl
607 + -Wimplicit-function-declaration dnl
608 + -Wreturn-type dnl
609 + -Wswitch-enum dnl
610 + -Wswitch-default dnl
611 + $4 dnl
612 + $5 dnl
613 + $6 dnl
614 + $7 dnl
615 + ],ax_warn_cflags_variable,[$ax_compiler_flags_test])
616 + ])
617 + AS_IF([test "$ax_enable_compile_warnings" = "error"],[
618 + # "error" flags; -Werror has to be appended unconditionally because
619 + # it’s not possible to test for
620 + #
621 + # suggest-attribute=format is disabled because it gives too many false
622 + # positives
623 + AX_APPEND_FLAG([-Werror],ax_warn_cflags_variable)
624 +
625 + AX_APPEND_COMPILE_FLAGS([ dnl
626 + -Wno-suggest-attribute=format dnl
627 + ],ax_warn_cflags_variable,[$ax_compiler_flags_test])
628 + ])
629 +
630 + # In the flags below, when disabling specific flags, always add *both*
631 + # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
632 + # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall,
633 + # which effectively turns that flag back on again as an error.
634 + for flag in $ax_warn_cflags_variable; do
635 + AS_CASE([$flag],
636 + [-Wno-*=*],[],
637 + [-Wno-*],[
638 + AX_APPEND_COMPILE_FLAGS([-Wno-error=${flag:5}],
639 + ax_warn_cflags_variable,
640 + [$ax_compiler_flags_test])
641 + ])
642 + done
643 +
644 + AC_LANG_POP([C])
645 +
646 + # Substitute the variables
647 + AC_SUBST(ax_warn_cflags_variable)
648 +])dnl AX_COMPILER_FLAGS
649
650 diff --git a/m4/ax_compiler_flags_cxxflags.m4 b/m4/ax_compiler_flags_cxxflags.m4
651 new file mode 100644
652 index 0000000..b768cfa
653 --- /dev/null
654 +++ b/m4/ax_compiler_flags_cxxflags.m4
655 @@ -0,0 +1,128 @@
656 +# ==============================================================================
657 +# http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cxxflags.html
658 +# ==============================================================================
659 +#
660 +# SYNOPSIS
661 +#
662 +# AX_COMPILER_FLAGS_CXXFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
663 +#
664 +# DESCRIPTION
665 +#
666 +# Add warning flags for the C++ compiler to VARIABLE, which defaults to
667 +# WARN_CXXFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be
668 +# manually added to the CXXFLAGS variable for each target in the code
669 +# base.
670 +#
671 +# This macro depends on the environment set up by AX_COMPILER_FLAGS.
672 +# Specifically, it uses the value of $ax_enable_compile_warnings to decide
673 +# which flags to enable.
674 +#
675 +# LICENSE
676 +#
677 +# Copyright (c) 2015 David King <amigadave@×××××××××.com>
678 +#
679 +# Copying and distribution of this file, with or without modification, are
680 +# permitted in any medium without royalty provided the copyright notice
681 +# and this notice are preserved. This file is offered as-is, without any
682 +# warranty.
683 +
684 +#serial 4
685 +
686 +AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
687 + AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
688 + AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
689 + AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
690 +
691 + # Variable names
692 + m4_define(ax_warn_cxxflags_variable,
693 + [m4_normalize(ifelse([$1],,[WARN_CXXFLAGS],[$1]))])
694 +
695 + AC_LANG_PUSH([C++])
696 +
697 + # Always pass -Werror=unknown-warning-option to get Clang to fail on bad
698 + # flags, otherwise they are always appended to the warn_cxxflags variable,
699 + # and Clang warns on them for every compilation unit.
700 + # If this is passed to GCC, it will explode, so the flag must be enabled
701 + # conditionally.
702 + AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[
703 + ax_compiler_flags_test="-Werror=unknown-warning-option"
704 + ],[
705 + ax_compiler_flags_test=""
706 + ])
707 +
708 + # Base flags
709 + AX_APPEND_COMPILE_FLAGS([ dnl
710 + -fno-strict-aliasing dnl
711 + $3 dnl
712 + ],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
713 +
714 + AS_IF([test "$ax_enable_compile_warnings" != "no"],[
715 + # "yes" flags
716 + AX_APPEND_COMPILE_FLAGS([ dnl
717 + -Wall dnl
718 + -Wextra dnl
719 + -Wundef dnl
720 + -Wwrite-strings dnl
721 + -Wpointer-arith dnl
722 + -Wmissing-declarations dnl
723 + -Wredundant-decls dnl
724 + -Wno-unused-parameter dnl
725 + -Wno-missing-field-initializers dnl
726 + -Wformat=2 dnl
727 + -Wcast-align dnl
728 + -Wformat-nonliteral dnl
729 + -Wformat-security dnl
730 + -Wsign-compare dnl
731 + -Wstrict-aliasing dnl
732 + -Wshadow dnl
733 + -Winline dnl
734 + -Wpacked dnl
735 + -Wmissing-format-attribute dnl
736 + -Wmissing-noreturn dnl
737 + -Winit-self dnl
738 + -Wredundant-decls dnl
739 + -Wmissing-include-dirs dnl
740 + -Wunused-but-set-variable dnl
741 + -Warray-bounds dnl
742 + -Wreturn-type dnl
743 + -Wno-overloaded-virtual dnl
744 + -Wswitch-enum dnl
745 + -Wswitch-default dnl
746 + $4 dnl
747 + $5 dnl
748 + $6 dnl
749 + $7 dnl
750 + ],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
751 + ])
752 + AS_IF([test "$ax_enable_compile_warnings" = "error"],[
753 + # "error" flags; -Werror has to be appended unconditionally because
754 + # it’s not possible to test for
755 + #
756 + # suggest-attribute=format is disabled because it gives too many false
757 + # positives
758 + AX_APPEND_FLAG([-Werror],ax_warn_cxxflags_variable)
759 +
760 + AX_APPEND_COMPILE_FLAGS([ dnl
761 + -Wno-suggest-attribute=format dnl
762 + ],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
763 + ])
764 +
765 + # In the flags below, when disabling specific flags, always add *both*
766 + # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
767 + # we enable -Werror, disable a flag, and a build bot passes CXXFLAGS=-Wall,
768 + # which effectively turns that flag back on again as an error.
769 + for flag in $ax_warn_cxxflags_variable; do
770 + AS_CASE([$flag],
771 + [-Wno-*=*],[],
772 + [-Wno-*],[
773 + AX_APPEND_COMPILE_FLAGS([-Wno-error=${flag:5}],
774 + ax_warn_cxxflags_variable,
775 + [$ax_compiler_flags_test])
776 + ])
777 + done
778 +
779 + AC_LANG_POP([C++])
780 +
781 + # Substitute the variables
782 + AC_SUBST(ax_warn_cxxflags_variable)
783 +])dnl AX_COMPILER_FLAGS_CXXFLAGS
784
785 diff --git a/m4/ax_compiler_flags_gir.m4 b/m4/ax_compiler_flags_gir.m4
786 new file mode 100644
787 index 0000000..180f50d
788 --- /dev/null
789 +++ b/m4/ax_compiler_flags_gir.m4
790 @@ -0,0 +1,60 @@
791 +# ===========================================================================
792 +# http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_gir.html
793 +# ===========================================================================
794 +#
795 +# SYNOPSIS
796 +#
797 +# AX_COMPILER_FLAGS_GIR([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
798 +#
799 +# DESCRIPTION
800 +#
801 +# Add warning flags for the g-ir-scanner (from GObject Introspection) to
802 +# VARIABLE, which defaults to WARN_SCANNERFLAGS. VARIABLE is AC_SUBST-ed
803 +# by this macro, but must be manually added to the SCANNERFLAGS variable
804 +# for each GIR target in the code base.
805 +#
806 +# This macro depends on the environment set up by AX_COMPILER_FLAGS.
807 +# Specifically, it uses the value of $ax_enable_compile_warnings to decide
808 +# which flags to enable.
809 +#
810 +# LICENSE
811 +#
812 +# Copyright (c) 2015 Philip Withnall <philip@××××××××××××.uk>
813 +#
814 +# Copying and distribution of this file, with or without modification, are
815 +# permitted in any medium without royalty provided the copyright notice
816 +# and this notice are preserved. This file is offered as-is, without any
817 +# warranty.
818 +
819 +#serial 4
820 +
821 +AC_DEFUN([AX_COMPILER_FLAGS_GIR],[
822 + AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
823 +
824 + # Variable names
825 + m4_define(ax_warn_scannerflags_variable,
826 + [m4_normalize(ifelse([$1],,[WARN_SCANNERFLAGS],[$1]))])
827 +
828 + # Base flags
829 + AX_APPEND_FLAG([$3],ax_warn_scannerflags_variable)
830 +
831 + AS_IF([test "$ax_enable_compile_warnings" != "no"],[
832 + # "yes" flags
833 + AX_APPEND_FLAG([ dnl
834 + --warn-all dnl
835 + $4 dnl
836 + $5 dnl
837 + $6 dnl
838 + $7 dnl
839 + ],ax_warn_scannerflags_variable)
840 + ])
841 + AS_IF([test "$ax_enable_compile_warnings" = "error"],[
842 + # "error" flags
843 + AX_APPEND_FLAG([ dnl
844 + --warn-error dnl
845 + ],ax_warn_scannerflags_variable)
846 + ])
847 +
848 + # Substitute the variables
849 + AC_SUBST(ax_warn_scannerflags_variable)
850 +])dnl AX_COMPILER_FLAGS
851
852 diff --git a/m4/ax_compiler_flags_ldflags.m4 b/m4/ax_compiler_flags_ldflags.m4
853 new file mode 100644
854 index 0000000..f9077fc
855 --- /dev/null
856 +++ b/m4/ax_compiler_flags_ldflags.m4
857 @@ -0,0 +1,75 @@
858 +# =============================================================================
859 +# http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_ldflags.html
860 +# =============================================================================
861 +#
862 +# SYNOPSIS
863 +#
864 +# AX_COMPILER_FLAGS_LDFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
865 +#
866 +# DESCRIPTION
867 +#
868 +# Add warning flags for the linker to VARIABLE, which defaults to
869 +# WARN_LDFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be
870 +# manually added to the LDFLAGS variable for each target in the code base.
871 +#
872 +# This macro depends on the environment set up by AX_COMPILER_FLAGS.
873 +# Specifically, it uses the value of $ax_enable_compile_warnings to decide
874 +# which flags to enable.
875 +#
876 +# LICENSE
877 +#
878 +# Copyright (c) 2014, 2015 Philip Withnall <philip@××××××××××××.uk>
879 +#
880 +# Copying and distribution of this file, with or without modification, are
881 +# permitted in any medium without royalty provided the copyright notice
882 +# and this notice are preserved. This file is offered as-is, without any
883 +# warranty.
884 +
885 +#serial 3
886 +
887 +AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[
888 + AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
889 + AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
890 + AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
891 +
892 + # Variable names
893 + m4_define(ax_warn_ldflags_variable,
894 + [m4_normalize(ifelse([$1],,[WARN_LDFLAGS],[$1]))])
895 +
896 + # Always pass -Werror=unknown-warning-option to get Clang to fail on bad
897 + # flags, otherwise they are always appended to the warn_ldflags variable,
898 + # and Clang warns on them for every compilation unit.
899 + # If this is passed to GCC, it will explode, so the flag must be enabled
900 + # conditionally.
901 + AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[
902 + ax_compiler_flags_test="-Werror=unknown-warning-option"
903 + ],[
904 + ax_compiler_flags_test=""
905 + ])
906 +
907 + # Base flags
908 + AX_APPEND_COMPILE_FLAGS([ dnl
909 + -Wl,--no-as-needed dnl
910 + $3 dnl
911 + ],ax_warn_ldflags_variable,[$ax_compiler_flags_test])
912 +
913 + AS_IF([test "$ax_enable_compile_warnings" != "no"],[
914 + # "yes" flags
915 + AX_APPEND_COMPILE_FLAGS([$4 $5 $6 $7],
916 + ax_warn_ldflags_variable,
917 + [$ax_compiler_flags_test])
918 + ])
919 + AS_IF([test "$ax_enable_compile_warnings" = "error"],[
920 + # "error" flags; -Werror has to be appended unconditionally because
921 + # it’s not possible to test for
922 + #
923 + # suggest-attribute=format is disabled because it gives too many false
924 + # positives
925 + AX_APPEND_COMPILE_FLAGS([ dnl
926 + -Wl,--fatal-warnings dnl
927 + ],ax_warn_ldflags_variable,[$ax_compiler_flags_test])
928 + ])
929 +
930 + # Substitute the variables
931 + AC_SUBST(ax_warn_ldflags_variable)
932 +])dnl AX_COMPILER_FLAGS
933
934 diff --git a/m4/ax_require_defined.m4 b/m4/ax_require_defined.m4
935 new file mode 100644
936 index 0000000..cae1111
937 --- /dev/null
938 +++ b/m4/ax_require_defined.m4
939 @@ -0,0 +1,37 @@
940 +# ===========================================================================
941 +# http://www.gnu.org/software/autoconf-archive/ax_require_defined.html
942 +# ===========================================================================
943 +#
944 +# SYNOPSIS
945 +#
946 +# AX_REQUIRE_DEFINED(MACRO)
947 +#
948 +# DESCRIPTION
949 +#
950 +# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
951 +# been defined and thus are available for use. This avoids random issues
952 +# where a macro isn't expanded. Instead the configure script emits a
953 +# non-fatal:
954 +#
955 +# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
956 +#
957 +# It's like AC_REQUIRE except it doesn't expand the required macro.
958 +#
959 +# Here's an example:
960 +#
961 +# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
962 +#
963 +# LICENSE
964 +#
965 +# Copyright (c) 2014 Mike Frysinger <vapier@g.o>
966 +#
967 +# Copying and distribution of this file, with or without modification, are
968 +# permitted in any medium without royalty provided the copyright notice
969 +# and this notice are preserved. This file is offered as-is, without any
970 +# warranty.
971 +
972 +#serial 1
973 +
974 +AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
975 + m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
976 +])dnl AX_REQUIRE_DEFINED