1dnl The copyright in this software is being made available under the BSD License,
2dnl included below. This software may be subject to other third party and
3dnl contributor rights, including patent rights, and no such rights are granted
4dnl under this license.
5dnl
6dnl Copyright (c) Intel Corporation
7dnl
8dnl All rights reserved.
9dnl
10dnl BSD License
11dnl
12dnl Redistribution and use in source and binary forms, with or without modification,
13dnl are permitted provided that the following conditions are met:
14dnl
15dnl Redistributions of source code must retain the above copyright notice, this list
16dnl of conditions and the following disclaimer.
17dnl
18dnl Redistributions in binary form must reproduce the above copyright notice, this
19dnl list of conditions and the following disclaimer in the documentation and/or
20dnl other materials provided with the distribution.
21dnl
22dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS""
23dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25dnl DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
26dnl ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27dnl (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29dnl ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33AC_INIT([ms-tpm-20-ref],
34        [0.1],
35        [https://github.com/microsoft/ms-tpm-20-ref/issues],
36        [],
37        [https://github.com/microsoft/ms-tpm-20-ref])
38AC_CONFIG_MACRO_DIR([.])
39AC_PROG_CC
40AC_PROG_LN_S
41AC_PROG_RANLIB
42AM_INIT_AUTOMAKE([foreign subdir-objects])
43AC_CONFIG_FILES([Makefile])
44AC_SUBST([DISTCHECK_CONFIGURE_FLAGS],[$ac_configure_args])
45
46dnl By enabling this feature tpm simulator gets seeds derived from hardware parameters.
47dnl It is enabled only for linux devices.
48dnl Note that the seeds are not derived from secure hardware source.
49
50AC_ARG_ENABLE(usedeviceid,
51    AS_HELP_STRING([--enable-usedeviceid],
52    [tpm simulator get seeds derived from hardware parameters. Seeds are not derived from secure hardware source.]))
53
54PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
55AS_IF([test "x$enable_usedeviceid" = "xyes"], [
56    PKG_CHECK_MODULES([LIBUDEV], [libudev])
57    [ADDITIONAL_LIBS="-ludev"]
58])
59AX_PTHREAD([], [AC_MSG_ERROR([requires pthread])])
60
61AC_DEFINE([HASH_LIB], [Ossl], [Crypto lib for hash algorithms])
62AC_DEFINE([SYM_LIB], [Ossl], [Crypto lib for symmetric encryption algorithms])
63AC_DEFINE([MATH_LIB], [Ossl], [Crypto lib for bignum operations])
64
65ADD_COMPILER_FLAG([-std=gnu11])
66ADD_COMPILER_FLAG([-Werror])
67ADD_COMPILER_FLAG([-Wall])
68ADD_COMPILER_FLAG([-Wformat-security])
69ADD_COMPILER_FLAG([-fstack-protector-all])
70ADD_COMPILER_FLAG([-fPIC])
71ADD_COMPILER_FLAG([-Wno-error=empty-body])
72ADD_COMPILER_FLAG([-Wno-error=expansion-to-defined])
73ADD_COMPILER_FLAG([-Wno-error=parentheses])
74ADD_COMPILER_FLAG([-Wno-error=pointer-to-int-cast])
75ADD_COMPILER_FLAG([-Wno-error=missing-braces])
76ADD_COMPILER_FLAG([-Wno-error=unused-result])
77
78AS_IF([test "x$enable_usedeviceid" = "xyes"], [
79    ADD_COMPILER_FLAG([-DNDEBUG])
80    ADD_COMPILER_FLAG([-g])
81    ADD_COMPILER_FLAG([-DUSE_PLATFORM_EPS])
82    AC_SUBST(ADDITIONAL_LIBS)
83])
84ADD_LINK_FLAG([-Wl,--no-undefined])
85ADD_LINK_FLAG([-Wl,-z,noexecstack])
86ADD_LINK_FLAG([-Wl,-z,now])
87ADD_LINK_FLAG([-Wl,-z,relro])
88
89AC_OUTPUT
90