aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'm4/ax_compiler_flags_cflags.m4')
-rw-r--r--m4/ax_compiler_flags_cflags.m424
1 files changed, 16 insertions, 8 deletions
diff --git a/m4/ax_compiler_flags_cflags.m4 b/m4/ax_compiler_flags_cflags.m4
index 295d7fe..aeb16e3 100644
--- a/m4/ax_compiler_flags_cflags.m4
+++ b/m4/ax_compiler_flags_cflags.m4
@@ -1,6 +1,6 @@
-# ============================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cflags.html
-# ============================================================================
+# =============================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cflags.html
+# =============================================================================
#
# SYNOPSIS
#
@@ -25,15 +25,16 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 8
+#serial 14
AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
+ 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_cflags_variable,
+ m4_define([ax_warn_cflags_variable],
[m4_normalize(ifelse([$1],,[WARN_CFLAGS],[$1]))])
AC_LANG_PUSH([C])
@@ -49,6 +50,13 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
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
@@ -100,14 +108,14 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
])
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_cflags_variable)
AX_APPEND_COMPILE_FLAGS([ dnl
- -Wno-suggest-attribute=format dnl
+ [$ax_compiler_no_suggest_attribute_flags] dnl
],ax_warn_cflags_variable,[$ax_compiler_flags_test])
])
@@ -119,7 +127,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
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_cflags_variable,
[$ax_compiler_flags_test])
])