xref: /aosp_15_r20/external/ms-tpm-20-ref/TPMCmd/flags.m4 (revision 5c591343844d1f9da7da26467c4bf7efc8a7a413)
1*5c591343SA. Cody Schuffelendnl The copyright in this software is being made available under the BSD License,
2*5c591343SA. Cody Schuffelendnl included below. This software may be subject to other third party and
3*5c591343SA. Cody Schuffelendnl contributor rights, including patent rights, and no such rights are granted
4*5c591343SA. Cody Schuffelendnl under this license.
5*5c591343SA. Cody Schuffelendnl
6*5c591343SA. Cody Schuffelendnl Copyright (c) Intel Corporation
7*5c591343SA. Cody Schuffelendnl
8*5c591343SA. Cody Schuffelendnl All rights reserved.
9*5c591343SA. Cody Schuffelendnl
10*5c591343SA. Cody Schuffelendnl BSD License
11*5c591343SA. Cody Schuffelendnl
12*5c591343SA. Cody Schuffelendnl Redistribution and use in source and binary forms, with or without modification,
13*5c591343SA. Cody Schuffelendnl are permitted provided that the following conditions are met:
14*5c591343SA. Cody Schuffelendnl
15*5c591343SA. Cody Schuffelendnl Redistributions of source code must retain the above copyright notice, this list
16*5c591343SA. Cody Schuffelendnl of conditions and the following disclaimer.
17*5c591343SA. Cody Schuffelendnl
18*5c591343SA. Cody Schuffelendnl Redistributions in binary form must reproduce the above copyright notice, this
19*5c591343SA. Cody Schuffelendnl list of conditions and the following disclaimer in the documentation and/or
20*5c591343SA. Cody Schuffelendnl other materials provided with the distribution.
21*5c591343SA. Cody Schuffelendnl
22*5c591343SA. Cody Schuffelendnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS""
23*5c591343SA. Cody Schuffelendnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*5c591343SA. Cody Schuffelendnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25*5c591343SA. Cody Schuffelendnl DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
26*5c591343SA. Cody Schuffelendnl ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27*5c591343SA. Cody Schuffelendnl (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28*5c591343SA. Cody Schuffelendnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29*5c591343SA. Cody Schuffelendnl ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30*5c591343SA. Cody Schuffelendnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31*5c591343SA. Cody Schuffelendnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32*5c591343SA. Cody Schuffelen
33*5c591343SA. Cody Schuffelendnl ADD_COMPILER_FLAG:
34*5c591343SA. Cody Schuffelendnl   A macro to add a CFLAG to the EXTRA_CFLAGS variable. This macro will
35*5c591343SA. Cody Schuffelendnl   check to be sure the compiler supprts the flag. Flags can be made
36*5c591343SA. Cody Schuffelendnl   mandatory (configure will fail).
37*5c591343SA. Cody Schuffelendnl $1: C compiler flag to add to EXTRA_CFLAGS.
38*5c591343SA. Cody Schuffelendnl $2: Set to "required" to cause configure failure if flag not supported..
39*5c591343SA. Cody SchuffelenAC_DEFUN([ADD_COMPILER_FLAG],[
40*5c591343SA. Cody Schuffelen    AX_CHECK_COMPILE_FLAG([$1],[
41*5c591343SA. Cody Schuffelen        EXTRA_CFLAGS="$EXTRA_CFLAGS $1"
42*5c591343SA. Cody Schuffelen        AC_SUBST([EXTRA_CFLAGS])],[
43*5c591343SA. Cody Schuffelen        AS_IF([test x$2 != xrequired],[
44*5c591343SA. Cody Schuffelen            AC_MSG_WARN([Optional CFLAG "$1" not supported by your compiler, continuing.])],[
45*5c591343SA. Cody Schuffelen            AC_MSG_ERROR([Required CFLAG "$1" not supported by your compiler, aborting.])]
46*5c591343SA. Cody Schuffelen        )],[
47*5c591343SA. Cody Schuffelen        -Wall -Werror]
48*5c591343SA. Cody Schuffelen    )]
49*5c591343SA. Cody Schuffelen)
50*5c591343SA. Cody Schuffelendnl ADD_PREPROC_FLAG:
51*5c591343SA. Cody Schuffelendnl   Add the provided preprocessor flag to the EXTRA_CFLAGS variable. This
52*5c591343SA. Cody Schuffelendnl   macro will check to be sure the preprocessor supports the flag.
53*5c591343SA. Cody Schuffelendnl   The flag can be made mandatory by provideing the string 'required' as
54*5c591343SA. Cody Schuffelendnl   the second parameter.
55*5c591343SA. Cody Schuffelendnl $1: Preprocessor flag to add to EXTRA_CFLAGS.
56*5c591343SA. Cody Schuffelendnl $2: Set to "required" t ocause configure failure if preprocesor flag
57*5c591343SA. Cody Schuffelendnl     is not supported.
58*5c591343SA. Cody SchuffelenAC_DEFUN([ADD_PREPROC_FLAG],[
59*5c591343SA. Cody Schuffelen    AX_CHECK_PREPROC_FLAG([$1],[
60*5c591343SA. Cody Schuffelen        EXTRA_CFLAGS="$EXTRA_CFLAGS $1"
61*5c591343SA. Cody Schuffelen        AC_SUBST([EXTRA_CFLAGS])],[
62*5c591343SA. Cody Schuffelen        AS_IF([test x$2 != xrequired],[
63*5c591343SA. Cody Schuffelen            AC_MSG_WARN([Optional preprocessor flag "$1" not supported by your compiler, continuing.])],[
64*5c591343SA. Cody Schuffelen            AC_MSG_ERROR([Required preprocessor flag "$1" not supported by your compiler, aborting.])]
65*5c591343SA. Cody Schuffelen        )],[
66*5c591343SA. Cody Schuffelen        -Wall -Werror]
67*5c591343SA. Cody Schuffelen    )]
68*5c591343SA. Cody Schuffelen)
69*5c591343SA. Cody Schuffelendnl ADD_LINK_FLAG:
70*5c591343SA. Cody Schuffelendnl   A macro to add a LDLAG to the EXTRA_LDFLAGS variable. This macro will
71*5c591343SA. Cody Schuffelendnl   check to be sure the linker supprts the flag. Flags can be made
72*5c591343SA. Cody Schuffelendnl   mandatory (configure will fail).
73*5c591343SA. Cody Schuffelendnl $1: linker flag to add to EXTRA_LDFLAGS.
74*5c591343SA. Cody Schuffelendnl $2: Set to "required" to cause configure failure if flag not supported.
75*5c591343SA. Cody SchuffelenAC_DEFUN([ADD_LINK_FLAG],[
76*5c591343SA. Cody Schuffelen    AX_CHECK_LINK_FLAG([$1],[
77*5c591343SA. Cody Schuffelen        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $1"
78*5c591343SA. Cody Schuffelen        AC_SUBST([EXTRA_LDFLAGS])],[
79*5c591343SA. Cody Schuffelen        AS_IF([test x$2 != xrequired],[
80*5c591343SA. Cody Schuffelen            AC_MSG_WARN([Optional LDFLAG "$1" not supported by your linker, continuing.])],[
81*5c591343SA. Cody Schuffelen            AC_MSG_ERROR([Required LDFLAG "$1" not supported by your linker, aborting.])]
82*5c591343SA. Cody Schuffelen        )]
83*5c591343SA. Cody Schuffelen    )]
84*5c591343SA. Cody Schuffelen)
85