1 # compiler.m4 - autoconf macros for compiler settings
3 # Copyright © 2005 Scott James Remnant <scott@netsplit.com>.
5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be
14 # included in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
20 # ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 # CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 # ----------------------
27 # Add configure option to enable additional compiler warnings and treat
29 AC_DEFUN([COMPILER_WARNINGS],
30 [AC_ARG_ENABLE(compiler-warnings,
31 AS_HELP_STRING([--enable-compiler-warnings],
32 [Enable additional compiler warnings]),
33 [if test "x$enable_compiler_warnings" = "xyes"; then
34 if test "x$GCC" = "xyes"; then
35 CFLAGS="-Wall -Werror $CFLAGS"
37 if test "x$GXX" = "xyes"; then
38 CXXFLAGS="-Wall -Werror $CXXFLAGS"
43 # COMPILER_OPTIMISATIONS
44 # ---------------------------
45 # Add configure option to disable optimisations.
46 AC_DEFUN([COMPILER_OPTIMISATIONS],
47 [AC_ARG_ENABLE(compiler-optimisations,
48 AS_HELP_STRING([--disable-compiler-optimisations],
49 [Disable compiler optimisations]),
50 [if test "x$enable_compiler_optimisations" = "xno"; then
51 [CFLAGS=`echo "$CFLAGS" | sed -e "s/ -O[1-9]*\b/ -O0/g"`]
53 ])# COMPILER_OPTIMISATIONS
56 # ----------------------
57 # Add configure option to enable coverage data.
58 AC_DEFUN([COMPILER_COVERAGE],
59 [AC_ARG_ENABLE(compiler-coverage,
60 AS_HELP_STRING([--enable-compiler-coverage],
61 [Enable generation of coverage data]),
62 [if test "x$enable_compiler_coverage" = "xyes"; then
63 if test "x$GCC" = "xyes"; then
64 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
66 fi],[enable_compiler_coverage=no])dnl