diff options
Diffstat (limited to 'm4/mhd_check_add_cc_ldflags.m4')
-rw-r--r-- | m4/mhd_check_add_cc_ldflags.m4 | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/m4/mhd_check_add_cc_ldflags.m4 b/m4/mhd_check_add_cc_ldflags.m4 new file mode 100644 index 00000000..5b013f29 --- /dev/null +++ b/m4/mhd_check_add_cc_ldflags.m4 | |||
@@ -0,0 +1,39 @@ | |||
1 | # SYNOPSIS | ||
2 | # | ||
3 | # MHD_CHECK_ADD_CC_LDFLAGS([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 (LDFLAGS if not specified), then prepending result to | ||
13 | # LDFLAGS (unless VARIABLE-TO-EXTEND is LDFLAGS), 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_LDFLAGS([-W,--strip-all -Wl,--fatal-warnings], | ||
21 | # [additional_LDFLAGS]) | ||
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 | |||
35 | AC_DEFUN([MHD_CHECK_ADD_CC_LDFLAGS],[dnl | ||
36 | m4_foreach_w([test_flag],[$1], | ||
37 | [MHD_CHECK_ADD_CC_LDFLAG([test_flag],[$2]) | ||
38 | ])dnl | ||
39 | ]) | ||