aboutsummaryrefslogtreecommitdiff
path: root/m4/mhd_find_add_cc_cflag_ifelse.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/mhd_find_add_cc_cflag_ifelse.m4')
-rw-r--r--m4/mhd_find_add_cc_cflag_ifelse.m445
1 files changed, 45 insertions, 0 deletions
diff --git a/m4/mhd_find_add_cc_cflag_ifelse.m4 b/m4/mhd_find_add_cc_cflag_ifelse.m4
new file mode 100644
index 00000000..337c4561
--- /dev/null
+++ b/m4/mhd_find_add_cc_cflag_ifelse.m4
@@ -0,0 +1,45 @@
1# SYNOPSIS
2#
3# MHD_FIND_ADD_CC_CFLAG_IFELSE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
4# [VARIABLE-TO-EXTEND],
5# [FLAG1-TO-TEST], [FLAG2-TO-TEST], ...)
6#
7# DESCRIPTION
8#
9# This macro checks whether the specific compiler flags are supported.
10# The flags are checked one-by-one. The checking is stopped when the first
11# supported flag found.
12# The checks are performing by appending FLAGx-TO-TEST to the value of
13# VARIABLE-TO-EXTEND (CFLAGS if not specified), then prepending result to
14# CFLAGS (unless VARIABLE-TO-EXTEND is CFLAGS), and then performing compile
15# and link test. If test succeed without warnings, then the flag is added to
16# VARIABLE-TO-EXTEND and next flags are not checked. If compile-link cycle
17# cannot be performed without warning with all tested flags, no flag is
18# added to the VARIABLE-TO-EXTEND.
19# If any suitable flag is found, ACTION-IF-FOUND is executed otherwise
20# ACTION-IF-NOT-FOUND is executed. Found flag (if any) is available as
21# value of shell variable $mhd_cc_found_flag during action execution.
22#
23# Example usage:
24#
25# MHD_FIND_ADD_CC_CFLAG_IFELSE([AC_MSG_NOTICE([Enabled debug information])],
26# [],
27# [additional_CFLAGS],
28# [-ggdb3], [-g3], [-ggdb], [-g])
29#
30# Note: Unlike others MHD_CHECK_*CC_CFLAG* macro, this macro uses another
31# order of parameters.
32#
33# LICENSE
34#
35# Copyright (c) 2022 Karlson2k (Evgeny Grin) <k2k@narod.ru>
36#
37# Copying and distribution of this file, with or without modification, are
38# permitted in any medium without royalty provided the copyright notice
39# and this notice are preserved. This file is offered as-is, without any
40# warranty.
41
42#serial 1
43
44AC_DEFUN([MHD_FIND_ADD_CC_CFLAG_IFELSE],[dnl
45_MHD_FIND_ADD_CC_XFLAG([[CFLAGS]],$@)])