aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'm4/ax_compiler_flags_cxxflags.m4')
-rw-r--r--m4/ax_compiler_flags_cxxflags.m424
1 files changed, 16 insertions, 8 deletions
diff --git a/m4/ax_compiler_flags_cxxflags.m4 b/m4/ax_compiler_flags_cxxflags.m4
index b768cfa..3067d9b 100644
--- a/m4/ax_compiler_flags_cxxflags.m4
+++ b/m4/ax_compiler_flags_cxxflags.m4
@@ -1,6 +1,6 @@
-# ==============================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cxxflags.html
-# ==============================================================================
+# ===============================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cxxflags.html
+# ===============================================================================
#
# SYNOPSIS
#
@@ -26,15 +26,16 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 4
+#serial 10
AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
+ AC_REQUIRE([AC_PROG_SED])
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
# Variable names
- m4_define(ax_warn_cxxflags_variable,
+ m4_define([ax_warn_cxxflags_variable],
[m4_normalize(ifelse([$1],,[WARN_CXXFLAGS],[$1]))])
AC_LANG_PUSH([C++])
@@ -50,6 +51,13 @@ AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
ax_compiler_flags_test=""
])
+ # Check that -Wno-suggest-attribute=format is supported
+ AX_CHECK_COMPILE_FLAG([-Wno-suggest-attribute=format],[
+ ax_compiler_no_suggest_attribute_flags="-Wno-suggest-attribute=format"
+ ],[
+ ax_compiler_no_suggest_attribute_flags=""
+ ])
+
# Base flags
AX_APPEND_COMPILE_FLAGS([ dnl
-fno-strict-aliasing dnl
@@ -96,14 +104,14 @@ AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
])
AS_IF([test "$ax_enable_compile_warnings" = "error"],[
# "error" flags; -Werror has to be appended unconditionally because
- # it’s not possible to test for
+ # it's not possible to test for
#
# suggest-attribute=format is disabled because it gives too many false
# positives
AX_APPEND_FLAG([-Werror],ax_warn_cxxflags_variable)
AX_APPEND_COMPILE_FLAGS([ dnl
- -Wno-suggest-attribute=format dnl
+ [$ax_compiler_no_suggest_attribute_flags] dnl
],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
])
@@ -115,7 +123,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
AS_CASE([$flag],
[-Wno-*=*],[],
[-Wno-*],[
- AX_APPEND_COMPILE_FLAGS([-Wno-error=${flag:5}],
+ AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')],
ax_warn_cxxflags_variable,
[$ax_compiler_flags_test])
])