aboutsummaryrefslogtreecommitdiff
path: root/m4/mhd_check_add_cc_cflags.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/mhd_check_add_cc_cflags.m4')
-rw-r--r--m4/mhd_check_add_cc_cflags.m439
1 files changed, 39 insertions, 0 deletions
diff --git a/m4/mhd_check_add_cc_cflags.m4 b/m4/mhd_check_add_cc_cflags.m4
new file mode 100644
index 00000000..2f13192d
--- /dev/null
+++ b/m4/mhd_check_add_cc_cflags.m4
@@ -0,0 +1,39 @@
1# SYNOPSIS
2#
3# MHD_CHECK_ADD_CC_CFLAGS([FLAGS-TO-TEST], [VARIABLE-TO-EXTEND])
4#
5# DESCRIPTION
6#
7# This macro checks whether the specific compiler flags are supported.
8# The FLAGS-TO-TEST parameter is whitespace-separated flagto to test.
9# The flags are tested one-by-one, all supported flags are added to the
10# VARIABLE-TO-EXTEND.
11# Every flag check is performing by appending one flag to the value of
12# VARIABLE-TO-EXTEND (CFLAGS if not specified), then prepending result to
13# CFLAGS (unless VARIABLE-TO-EXTEND is CFLAGS), and then performing compile
14# and link test. If test succeed without warnings, then the flag is added to
15# VARIABLE-TO-EXTEND. Otherwise, if compile and link without test flag cannot
16# be done without any warning, the flag is considered to be unsuppoted.
17#
18# Example usage:
19#
20# MHD_CHECK_ADD_CC_CFLAGS([-Wshadow -Walloc-zero -Winit-self],
21# [additional_CFLAGS])
22#
23#
24# LICENSE
25#
26# Copyright (c) 2022 Karlson2k (Evgeny Grin) <k2k@narod.ru>
27#
28# Copying and distribution of this file, with or without modification, are
29# permitted in any medium without royalty provided the copyright notice
30# and this notice are preserved. This file is offered as-is, without any
31# warranty.
32
33#serial 1
34
35AC_DEFUN([MHD_CHECK_ADD_CC_CFLAGS],[dnl
36m4_foreach_w([test_flag],[$1],
37[MHD_CHECK_ADD_CC_CFLAG([test_flag],[$2])
38])dnl
39])