Philip Tricca | 8ffb654 | 2018-03-04 19:51:53 -0800 | [diff] [blame] | 1 | #;**********************************************************************; |
| 2 | # Copyright (c) 2015 - 2018 Intel Corporation |
| 3 | # Copyright (c) 2018 Fraunhofer SIT sponsored by Infineon Technologies AG |
| 4 | # All rights reserved. |
| 5 | # |
| 6 | # Redistribution and use in source and binary forms, with or without |
| 7 | # modification, are permitted provided that the following conditions are met: |
| 8 | # |
| 9 | # 1. Redistributions of source code must retain the above copyright notice, |
| 10 | # this list of conditions and the following disclaimer. |
| 11 | # |
| 12 | # 2. Redistributions in binary form must reproduce the above copyright notice, |
| 13 | # this list of conditions and the following disclaimer in the documentation |
| 14 | # and/or other materials provided with the distribution. |
| 15 | # |
| 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 26 | # THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | #;**********************************************************************; |
Philip Tricca | 1a94dd8 | 2017-08-16 14:32:55 -0700 | [diff] [blame] | 28 | AC_INIT([tpm2-tss], |
Philip Tricca | d97ed64 | 2017-08-25 14:19:27 -0700 | [diff] [blame] | 29 | [2.0.0-dev], |
Philip Tricca | dc1f15d | 2018-03-04 19:53:25 -0800 | [diff] [blame] | 30 | [https://github.com/tpm2-software/tpm2-tss/issues], |
Philip Tricca | d97ed64 | 2017-08-25 14:19:27 -0700 | [diff] [blame] | 31 | [], |
Philip Tricca | dc1f15d | 2018-03-04 19:53:25 -0800 | [diff] [blame] | 32 | [https://github.com/tpm2-software/tpm2-tss]) |
Philip Tricca | a509a68 | 2015-09-14 15:34:52 -0700 | [diff] [blame] | 33 | AC_CONFIG_MACRO_DIR([m4]) |
Philip Tricca | 35ac9cf | 2015-08-05 17:03:52 -0700 | [diff] [blame] | 34 | AC_PROG_CC |
Philip Tricca | ffbd61a | 2015-09-25 00:27:57 -0700 | [diff] [blame] | 35 | LT_INIT() |
Philip Tricca | 71aa985 | 2015-08-25 00:26:22 -0700 | [diff] [blame] | 36 | AM_INIT_AUTOMAKE([foreign |
| 37 | subdir-objects]) |
Andreas Fuchs | 3c965e7 | 2017-11-24 16:16:20 +0100 | [diff] [blame] | 38 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) #Backward compatible setting of "silent-rules" |
| 39 | |
Andreas Fuchs | 2968c71 | 2018-02-01 18:22:47 +0100 | [diff] [blame] | 40 | AC_CONFIG_FILES([Makefile doc/Doxyfile]) |
Philip Tricca | 1a94dd8 | 2017-08-16 14:32:55 -0700 | [diff] [blame] | 41 | |
| 42 | # propagate configure arguments to distcheck |
| 43 | AC_SUBST([DISTCHECK_CONFIGURE_FLAGS],[$ac_configure_args]) |
| 44 | |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 45 | AC_ARG_ENABLE([unit], |
| 46 | [AS_HELP_STRING([--enable-unit], |
| 47 | [build cmocka unit tests (default is no)])], |
| 48 | [enable_unit=$enableval], |
| 49 | [enable_unit=no]) |
Philip Tricca | 38db755 | 2018-02-27 07:58:25 -0800 | [diff] [blame] | 50 | m4_define([cmocka_min_version], [1.0]) |
| 51 | m4_define([cmocka_err], [Unit test enabled, but cmocka missing or version requirements not met. cmocka version must be >= cmocka_min_version]) |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 52 | AS_IF([test "x$enable_unit" != xno], |
| 53 | [PKG_CHECK_MODULES([CMOCKA], |
Philip Tricca | 38db755 | 2018-02-27 07:58:25 -0800 | [diff] [blame] | 54 | [cmocka >= cmocka_min_version], |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 55 | [AC_DEFINE([HAVE_CMOCKA], |
Philip Tricca | 38db755 | 2018-02-27 07:58:25 -0800 | [diff] [blame] | 56 | [1])], |
| 57 | [AC_MSG_ERROR([cmocka_err])])]) |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 58 | AM_CONDITIONAL([UNIT], [test "x$enable_unit" != xno]) |
Philip Tricca | 77683c7 | 2017-12-04 16:05:52 -0800 | [diff] [blame] | 59 | |
| 60 | # Uriparser library required by simulator TCTI library. |
| 61 | PKG_CHECK_MODULES([URIPARSER],[liburiparser]) |
| 62 | |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 63 | AC_ARG_ENABLE([esapi], |
| 64 | [AS_HELP_STRING([--enable-esapi], |
| 65 | [build the esapi layer (default is yes)])], |
| 66 | [enable_esapi=$enableval], |
| 67 | [enable_esapi=yes]) |
| 68 | AS_IF([test "x$enable_esapi" != xno], |
Philip Tricca | 8eecfd3 | 2018-01-31 06:28:27 -0800 | [diff] [blame] | 69 | [AC_CHECK_HEADER([gcrypt.h], |
| 70 | [], |
| 71 | [AC_MSG_ERROR([Missing required header: gcrypt.h.])])]) |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 72 | AS_IF([test "x$enable_esapi" != xno], |
Philip Tricca | 8eecfd3 | 2018-01-31 06:28:27 -0800 | [diff] [blame] | 73 | [AC_CHECK_LIB([gcrypt], |
| 74 | [gcry_mac_open], |
| 75 | [], |
| 76 | [AC_MSG_ERROR([Missing required library: gcrypt.])])]) |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 77 | AM_CONDITIONAL([ESAPI], [test "x$enable_esapi" != xno]) |
| 78 | |
| 79 | AC_ARG_WITH([tctidefaultmodule], |
| 80 | [AS_HELP_STRING([--with-tctidefaultmodule], |
| 81 | [The default tcti module for an Esys context.])], |
| 82 | [], |
| 83 | [with_tctidefaultmodule=Socket]) |
| 84 | AC_SUBST([TCTI_DEFAULT_MODULE], [$with_tctidefaultmodule]) |
| 85 | |
| 86 | AC_ARG_WITH([tctidefaultconfig], |
| 87 | [AS_HELP_STRING([--with-tctidefaultconfig], |
| 88 | [The default tcti module's configuration.])], |
| 89 | [], |
| 90 | [with_tctidefaultconfig="tcp://127.0.0.1:2321"]) |
| 91 | AC_SUBST([TCTI_DEFAULT_CONFIG], [$with_tctidefaultconfig]) |
Philip Tricca | 99d4142 | 2017-06-18 15:11:50 -0700 | [diff] [blame] | 92 | # |
| 93 | # simulator binary |
| 94 | # |
| 95 | AC_MSG_CHECKING([Checking for simulator binary: $with_simulatorbin]) |
| 96 | AC_ARG_WITH([simulatorbin], |
| 97 | [AS_HELP_STRING([--with-simulatorbin=tpm_server],[simulator executable])], |
| 98 | [AS_IF([test \( -f "$with_simulatorbin" \) -a \( -x "$with_simulatorbin" \)], |
| 99 | [AC_MSG_RESULT([success]) |
| 100 | AC_SUBST([SIMULATOR_BIN],[$with_simulatorbin]) |
| 101 | AX_NORMALIZE_PATH([with_simulatorbin]) |
| 102 | with_simulatorbin_set=yes], |
| 103 | [AC_MSG_ERROR([TPM simulator binary provided does not exist])])], |
| 104 | [with_simulatorbin_set=no]) |
| 105 | AM_CONDITIONAL([SIMULATOR_BIN],[test "x$with_simulatorbin_set" = "xyes"]) |
Philip Tricca | b43de64 | 2017-03-04 21:29:10 -0800 | [diff] [blame] | 106 | |
Tadeusz Struk | 15220e8 | 2018-01-24 09:51:53 -0800 | [diff] [blame] | 107 | AS_IF([test "x$with_simulatorbin_set" == xyes], |
Philip Tricca | 5c1b140 | 2018-02-02 13:09:12 -0800 | [diff] [blame] | 108 | [PKG_CHECK_MODULES([LIBCRYPTO],[libcrypto])]) |
Tadeusz Struk | 15220e8 | 2018-01-24 09:51:53 -0800 | [diff] [blame] | 109 | |
David R. Bild | 1e49b4c | 2017-11-28 18:09:42 -0600 | [diff] [blame] | 110 | gl_LD_VERSION_SCRIPT |
| 111 | |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 112 | AX_ADD_COMPILER_FLAG([-Wall]) |
| 113 | AX_ADD_COMPILER_FLAG([-Werror]) |
Philip Tricca | 0820651 | 2017-12-28 14:56:07 -0800 | [diff] [blame] | 114 | AX_ADD_COMPILER_FLAG([-std=c99]) |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 115 | AX_ADD_COMPILER_FLAG([-Wformat]) |
| 116 | AX_ADD_COMPILER_FLAG([-Wformat-security]) |
| 117 | AX_ADD_COMPILER_FLAG([-fstack-protector-all]) |
| 118 | AX_ADD_COMPILER_FLAG([-fpic]) |
| 119 | AX_ADD_COMPILER_FLAG([-fPIC]) |
Tadeusz Struk | a3260d8 | 2017-09-11 12:06:13 -0700 | [diff] [blame] | 120 | |
Philip Tricca | 0820651 | 2017-12-28 14:56:07 -0800 | [diff] [blame] | 121 | AX_ADD_PREPROC_FLAG([-D_DEFAULT_SOURCE]) |
Lu Gong | abc63b3 | 2018-01-10 09:43:14 +0800 | [diff] [blame] | 122 | AX_ADD_PREPROC_FLAG([-D_BSD_SOURCE]) |
Jia Zhang | 5878264 | 2018-01-19 11:24:34 +0800 | [diff] [blame] | 123 | AX_ADD_PREPROC_FLAG([-D_POSIX_SOURCE]) |
Philip Tricca | 0820651 | 2017-12-28 14:56:07 -0800 | [diff] [blame] | 124 | |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 125 | AC_ARG_WITH([maxloglevel], |
| 126 | [AS_HELP_STRING([--with-maxloglevel={none,error,warning,info,debug,trace}], |
Andreas Fuchs | bc49076 | 2018-01-03 14:36:38 +0100 | [diff] [blame] | 127 | [sets the maximum log level (default is trace)])], |
| 128 | [], |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 129 | [with_maxloglevel=trace]) |
| 130 | AS_IF([test "x$with_maxloglevel" = "xnone"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 131 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [0], ["Logging disabled"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 132 | AS_IF([test "x$with_maxloglevel" = "xerror"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 133 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [2], ["Error log level"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 134 | AS_IF([test "x$with_maxloglevel" = "xwarning"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 135 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [3], ["Warning log level"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 136 | AS_IF([test "x$with_maxloglevel" = "xinfo"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 137 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [4], ["Info log level"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 138 | AS_IF([test "x$with_maxloglevel" = "xdebug"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 139 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [5], ["Debug log level"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 140 | AS_IF([test "x$with_maxloglevel" = "xtrace"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 141 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [6], ["Trace log level"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 142 | AC_MSG_ERROR([Bad value for --with-maxloglevel]))))))) |
Andreas Fuchs | bc49076 | 2018-01-03 14:36:38 +0100 | [diff] [blame] | 143 | |
Tadeusz Struk | a3260d8 | 2017-09-11 12:06:13 -0700 | [diff] [blame] | 144 | AC_ARG_ENABLE([debug], |
| 145 | [AS_HELP_STRING([--enable-debug], |
| 146 | [build with debug info (default is no)])], |
| 147 | [enable_debug=$enableval], |
| 148 | [enable_debug=no]) |
| 149 | AS_IF([test "x$enable_debug" = "xyes"], AX_ADD_COMPILER_FLAG([-ggdb3 -O0])) |
| 150 | AS_IF([test "x$enable_debug" = "xno"], [AX_ADD_PREPROC_FLAG([-U_FORTIFY_SOURCE]) |
| 151 | AX_ADD_PREPROC_FLAG([-D_FORTIFY_SOURCE=2])]) |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 152 | AX_ADD_LINK_FLAG([-Wl,--no-undefined]) |
| 153 | AX_ADD_LINK_FLAG([-Wl,-z,noexecstack]) |
| 154 | AX_ADD_LINK_FLAG([-Wl,-z,now]) |
| 155 | AX_ADD_LINK_FLAG([-Wl,-z,relro]) |
Philip Tricca | b43de64 | 2017-03-04 21:29:10 -0800 | [diff] [blame] | 156 | |
Philip Tricca | f891580 | 2017-03-14 17:01:50 -0700 | [diff] [blame] | 157 | # work around GCC bug #53119 |
| 158 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119 |
| 159 | AX_ADD_COMPILER_FLAG([-Wno-missing-braces]) |
| 160 | |
Andreas Fuchs | 2968c71 | 2018-02-01 18:22:47 +0100 | [diff] [blame] | 161 | dnl --------- Doxy Gen ----------------------- |
| 162 | DX_INIT_DOXYGEN($PACKAGE_NAME, [doc/Doxyfile], [doc/doxy]) |
| 163 | DX_HTML_FEATURE(ON) |
| 164 | DX_CHM_FEATURE(OFF) |
| 165 | DX_CHI_FEATURE(OFF) |
| 166 | DX_MAN_FEATURE(ON) |
| 167 | DX_RTF_FEATURE(OFF) |
| 168 | DX_XML_FEATURE(OFF) |
| 169 | DX_PDF_FEATURE(OFF) |
| 170 | DX_PS_FEATURE(OFF) |
| 171 | |
| 172 | |
Andreas Fuchs | 61cb7fb | 2017-11-22 10:23:01 +0100 | [diff] [blame] | 173 | AX_CODE_COVERAGE |
| 174 | |
Philip Tricca | d1952b4 | 2015-08-05 15:52:10 -0700 | [diff] [blame] | 175 | AC_OUTPUT |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 176 | |
| 177 | AC_MSG_RESULT([ |
| 178 | $PACKAGE_NAME $VERSION |
| 179 | esapi: $enable_esapi |
| 180 | tctidefaultmodule: $with_tctidefaultmodule |
| 181 | tctidefaultconfig: $with_tctidefaultconfig |
| 182 | unit: $enable_unit |
| 183 | debug: $enable_debug |
| 184 | simulatorbin: $with_simulatorbin |
Philip Tricca | fb0b72f | 2018-03-04 19:39:24 -0800 | [diff] [blame^] | 185 | maxloglevel: $with_maxloglevel |
Andreas Fuchs | 2968c71 | 2018-02-01 18:22:47 +0100 | [diff] [blame] | 186 | doxygen: $DX_FLAG_doc $enable_doxygen_doc |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 187 | ]) |
| 188 | |