xref: /aosp_15_r20/external/kmod/m4/features.m4 (revision cc4ad7da8cefe208cb129ac2aa9a357c7c72deb2)
1*cc4ad7daSAndroid Build Coastguard Worker#  Copyright (c) 2015 Lucas De Marchi <[email protected]>
2*cc4ad7daSAndroid Build Coastguard Worker#
3*cc4ad7daSAndroid Build Coastguard Worker#  This program is free software: you can redistribute it and/or modify it
4*cc4ad7daSAndroid Build Coastguard Worker#  under the terms of the GNU General Public License as published by the
5*cc4ad7daSAndroid Build Coastguard Worker#  Free Software Foundation, either version 2 of the License, or (at your
6*cc4ad7daSAndroid Build Coastguard Worker#  option) any later version.
7*cc4ad7daSAndroid Build Coastguard Worker#
8*cc4ad7daSAndroid Build Coastguard Worker#  This program is distributed in the hope that it will be useful, but
9*cc4ad7daSAndroid Build Coastguard Worker#  WITHOUT ANY WARRANTY; without even the implied warranty of
10*cc4ad7daSAndroid Build Coastguard Worker#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11*cc4ad7daSAndroid Build Coastguard Worker#  Public License for more details.
12*cc4ad7daSAndroid Build Coastguard Worker#
13*cc4ad7daSAndroid Build Coastguard Worker#  You should have received a copy of the GNU General Public License along
14*cc4ad7daSAndroid Build Coastguard Worker#  with this program. If not, see <http://www.gnu.org/licenses/>.
15*cc4ad7daSAndroid Build Coastguard Worker#
16*cc4ad7daSAndroid Build Coastguard Worker#  As a special exception, the respective Autoconf Macro's copyright owner
17*cc4ad7daSAndroid Build Coastguard Worker#  gives unlimited permission to copy, distribute and modify the configure
18*cc4ad7daSAndroid Build Coastguard Worker#  scripts that are the output of Autoconf when processing the Macro. You
19*cc4ad7daSAndroid Build Coastguard Worker#  need not follow the terms of the GNU General Public License when using
20*cc4ad7daSAndroid Build Coastguard Worker#  or distributing such scripts, even though portions of the text of the
21*cc4ad7daSAndroid Build Coastguard Worker#  Macro appear in them. The GNU General Public License (GPL) does govern
22*cc4ad7daSAndroid Build Coastguard Worker#  all other use of the material that constitutes the Autoconf Macro.
23*cc4ad7daSAndroid Build Coastguard Worker#
24*cc4ad7daSAndroid Build Coastguard Worker#  This special exception to the GPL applies to versions of the Autoconf
25*cc4ad7daSAndroid Build Coastguard Worker#  Macro released by the Autoconf Archive. When you make and distribute a
26*cc4ad7daSAndroid Build Coastguard Worker#  modified version of the Autoconf Macro, you may extend this special
27*cc4ad7daSAndroid Build Coastguard Worker#  exception to the GPL to apply to your modified version as well.
28*cc4ad7daSAndroid Build Coastguard Worker#
29*cc4ad7daSAndroid Build Coastguard Worker# CC_FEATURE_APPEND([FLAGS], [ENV-TO-CHECK], [FLAG-NAME])
30*cc4ad7daSAndroid Build Coastguard WorkerAC_DEFUN([CC_FEATURE_APPEND], [
31*cc4ad7daSAndroid Build Coastguard Worker  AS_VAR_PUSHDEF([FLAGS], [$1])dnl
32*cc4ad7daSAndroid Build Coastguard Worker  AS_VAR_PUSHDEF([ENV_CHECK], [$2])dnl
33*cc4ad7daSAndroid Build Coastguard Worker  AS_VAR_PUSHDEF([FLAG_NAME], [$3])dnl
34*cc4ad7daSAndroid Build Coastguard Worker
35*cc4ad7daSAndroid Build Coastguard Worker  AS_CASE([" AS_VAR_GET(FLAGS) " ],
36*cc4ad7daSAndroid Build Coastguard Worker          [*" FLAG_NAME "*], [AC_RUN_LOG([: FLAGS already contains FLAG_NAME])],
37*cc4ad7daSAndroid Build Coastguard Worker          [
38*cc4ad7daSAndroid Build Coastguard Worker	    AS_IF([test "x$FLAGS" != "x"], [AS_VAR_APPEND(FLAGS, " ")])
39*cc4ad7daSAndroid Build Coastguard Worker            AS_IF([test "x$ENV_CHECK" = "xyes"],
40*cc4ad7daSAndroid Build Coastguard Worker                  [AS_VAR_APPEND(FLAGS, "+FLAG_NAME")],
41*cc4ad7daSAndroid Build Coastguard Worker                  [AS_VAR_APPEND(FLAGS, "-FLAG_NAME")])
42*cc4ad7daSAndroid Build Coastguard Worker          ]
43*cc4ad7daSAndroid Build Coastguard Worker  )
44*cc4ad7daSAndroid Build Coastguard Worker
45*cc4ad7daSAndroid Build Coastguard Worker  AS_VAR_POPDEF([FLAG_NAME])dnl
46*cc4ad7daSAndroid Build Coastguard Worker  AS_VAR_POPDEF([ENV_CHECK])dnl
47*cc4ad7daSAndroid Build Coastguard Worker  AS_VAR_POPDEF([FLAGS])dnl
48*cc4ad7daSAndroid Build Coastguard Worker])
49