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 | d0f8cd1 | 2018-05-11 16:00:11 -0700 | [diff] [blame] | 29 | [2.0.0_rc1], |
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]) |
Tadeusz Struk | 3980bad | 2018-04-04 10:30:01 -0700 | [diff] [blame] | 34 | ${CFLAGS=""} |
Philip Tricca | 35ac9cf | 2015-08-05 17:03:52 -0700 | [diff] [blame] | 35 | AC_PROG_CC |
Philip Tricca | ffbd61a | 2015-09-25 00:27:57 -0700 | [diff] [blame] | 36 | LT_INIT() |
Philip Tricca | 71aa985 | 2015-08-25 00:26:22 -0700 | [diff] [blame] | 37 | AM_INIT_AUTOMAKE([foreign |
| 38 | subdir-objects]) |
Andreas Fuchs | 3c965e7 | 2017-11-24 16:16:20 +0100 | [diff] [blame] | 39 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) #Backward compatible setting of "silent-rules" |
| 40 | |
Andreas Fuchs | bc169cb | 2018-04-10 12:02:10 +0200 | [diff] [blame] | 41 | AC_CONFIG_FILES([Makefile Doxyfile]) |
Philip Tricca | 1a94dd8 | 2017-08-16 14:32:55 -0700 | [diff] [blame] | 42 | |
| 43 | # propagate configure arguments to distcheck |
| 44 | AC_SUBST([DISTCHECK_CONFIGURE_FLAGS],[$ac_configure_args]) |
| 45 | |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 46 | AC_ARG_ENABLE([unit], |
| 47 | [AS_HELP_STRING([--enable-unit], |
| 48 | [build cmocka unit tests (default is no)])], |
| 49 | [enable_unit=$enableval], |
| 50 | [enable_unit=no]) |
Philip Tricca | 38db755 | 2018-02-27 07:58:25 -0800 | [diff] [blame] | 51 | m4_define([cmocka_min_version], [1.0]) |
| 52 | 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] | 53 | AS_IF([test "x$enable_unit" != xno], |
| 54 | [PKG_CHECK_MODULES([CMOCKA], |
Philip Tricca | 38db755 | 2018-02-27 07:58:25 -0800 | [diff] [blame] | 55 | [cmocka >= cmocka_min_version], |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 56 | [AC_DEFINE([HAVE_CMOCKA], |
Philip Tricca | 38db755 | 2018-02-27 07:58:25 -0800 | [diff] [blame] | 57 | [1])], |
| 58 | [AC_MSG_ERROR([cmocka_err])])]) |
Philip Tricca | 4334dee | 2016-08-09 19:56:28 -0700 | [diff] [blame] | 59 | AM_CONDITIONAL([UNIT], [test "x$enable_unit" != xno]) |
Philip Tricca | 77683c7 | 2017-12-04 16:05:52 -0800 | [diff] [blame] | 60 | |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 61 | AC_ARG_ENABLE([esapi], |
| 62 | [AS_HELP_STRING([--enable-esapi], |
| 63 | [build the esapi layer (default is yes)])], |
| 64 | [enable_esapi=$enableval], |
| 65 | [enable_esapi=yes]) |
| 66 | AS_IF([test "x$enable_esapi" != xno], |
Philip Tricca | 8eecfd3 | 2018-01-31 06:28:27 -0800 | [diff] [blame] | 67 | [AC_CHECK_HEADER([gcrypt.h], |
| 68 | [], |
| 69 | [AC_MSG_ERROR([Missing required header: gcrypt.h.])])]) |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 70 | AS_IF([test "x$enable_esapi" != xno], |
Philip Tricca | 8eecfd3 | 2018-01-31 06:28:27 -0800 | [diff] [blame] | 71 | [AC_CHECK_LIB([gcrypt], |
| 72 | [gcry_mac_open], |
| 73 | [], |
| 74 | [AC_MSG_ERROR([Missing required library: gcrypt.])])]) |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 75 | AM_CONDITIONAL([ESAPI], [test "x$enable_esapi" != xno]) |
| 76 | |
| 77 | AC_ARG_WITH([tctidefaultmodule], |
| 78 | [AS_HELP_STRING([--with-tctidefaultmodule], |
Andreas Fuchs | 037c878 | 2018-03-21 18:52:38 +0100 | [diff] [blame] | 79 | [The default TCTI module for ESAPI. (Default: libtss2-tcti-default.so])], |
| 80 | [AC_DEFINE_UNQUOTED([ESYS_TCTI_DEFAULT_MODULE], |
| 81 | [$with_tctidefaultmodule], |
| 82 | ["The default TCTI library file"])], |
| 83 | []) |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 84 | |
| 85 | AC_ARG_WITH([tctidefaultconfig], |
| 86 | [AS_HELP_STRING([--with-tctidefaultconfig], |
| 87 | [The default tcti module's configuration.])], |
Andreas Fuchs | 037c878 | 2018-03-21 18:52:38 +0100 | [diff] [blame] | 88 | [AC_DEFINE_UNQUOTED([ESYS_TCTI_DEFAULT_CONFIG], |
| 89 | [$with_tctidefaultconfig], |
| 90 | ["The default TCTIs configuration string"])], |
| 91 | []) |
| 92 | |
Andreas Fuchs | 2b085e9 | 2018-05-02 16:42:47 +0200 | [diff] [blame] | 93 | AC_ARG_ENABLE([tcti-device], |
| 94 | [AS_HELP_STRING([--enable-tcti-device], |
| 95 | [build the tcti-device module (default is yes)])], |
| 96 | [enable_tcti_device=$enableval], |
| 97 | [enable_tcti_device=yes]) |
| 98 | AM_CONDITIONAL([ENABLE_TCTI_DEVICE], [test "x$enable_tcti_device" != xno]) |
| 99 | |
| 100 | AC_ARG_ENABLE([tcti-mssim], |
| 101 | [AS_HELP_STRING([--enable-tcti-mssim], |
| 102 | [build the tcti-mssim module (default is yes)])], |
| 103 | [enable_tcti_mssim=$enableval], |
| 104 | [enable_tcti_mssim=yes]) |
| 105 | AM_CONDITIONAL([ENABLE_TCTI_MSSIM], [test "x$enable_tcti_mssim" != xno]) |
| 106 | |
Philip Tricca | 99d4142 | 2017-06-18 15:11:50 -0700 | [diff] [blame] | 107 | # |
Javier Martinez Canillas | 0075f88 | 2018-04-13 12:49:37 +0200 | [diff] [blame] | 108 | # udev |
| 109 | # |
| 110 | AC_ARG_WITH([udevrulesdir], |
| 111 | [AS_HELP_STRING([--with-udevrulesdir=DIR],[udev rules directory])], |
| 112 | [], |
| 113 | [with_udevrulesdir=${libdir}/udev/rules.d]) |
| 114 | AX_NORMALIZE_PATH([with_udevrulesdir]) |
| 115 | AC_SUBST([udevrulesdir], [$with_udevrulesdir]) |
| 116 | AC_ARG_WITH([udevrulesprefix], |
| 117 | [AS_HELP_STRING([--with-udevrulesprefix=XY],[prefix for udev rules file])], |
| 118 | [AC_SUBST([udevrulesprefix],[$with_udevrulesprefix])]) |
| 119 | AM_CONDITIONAL(WITH_UDEVRULESPREFIX, [test -n "$with_udevrulesprefix"]) |
| 120 | # |
Philip Tricca | 9907543 | 2018-04-25 19:02:05 -0700 | [diff] [blame] | 121 | # enable integration tests and check for simulator binary |
Philip Tricca | 99d4142 | 2017-06-18 15:11:50 -0700 | [diff] [blame] | 122 | # |
Philip Tricca | 9907543 | 2018-04-25 19:02:05 -0700 | [diff] [blame] | 123 | AC_ARG_ENABLE([integration], |
| 124 | [AS_HELP_STRING([--enable-integration], |
| 125 | [build and execute integration tests (default is no)])], |
| 126 | [enable_integration=$enableval], |
| 127 | [enable_integration=no]) |
| 128 | AS_IF([test "x$enable_integration" = "xyes"], |
| 129 | [AC_CHECK_PROG([tpm_server], [tpm_server], [yes], [no]) |
| 130 | AS_IF([test "x$tpm_server" != "xyes"], |
| 131 | [AC_MSG_ERROR([Integration tests enabled but tpm_server not found, try setting PATH])]) |
Philip Tricca | 65aa40f | 2018-05-10 17:03:04 -0700 | [diff] [blame] | 132 | AC_CHECK_PROG([netstat], [netstat], [yes], [no]) |
| 133 | AS_IF([test "x$netstat" != "xyes"], |
| 134 | [AC_MSG_ERROR([Integration tests enabled but netstat executable not found.])]) |
Philip Tricca | 9907543 | 2018-04-25 19:02:05 -0700 | [diff] [blame] | 135 | PKG_CHECK_MODULES([LIBCRYPTO],[libcrypto]) |
| 136 | AC_CHECK_HEADER(uthash.h, [], [AC_MSG_ERROR([Can not find uthash.h. Please install uthash-dev])]) |
| 137 | AC_SUBST([ENABLE_INTEGRATION], [$enable_integration])]) |
| 138 | AM_CONDITIONAL([ENABLE_INTEGRATION],[test "x$enable_integration" = "xyes"]) |
Tadeusz Struk | 1bc0f08 | 2018-04-18 11:53:26 -0700 | [diff] [blame] | 139 | |
David R. Bild | 1e49b4c | 2017-11-28 18:09:42 -0600 | [diff] [blame] | 140 | gl_LD_VERSION_SCRIPT |
| 141 | |
Philip Tricca | 0820651 | 2017-12-28 14:56:07 -0800 | [diff] [blame] | 142 | AX_ADD_COMPILER_FLAG([-std=c99]) |
Andreas Fuchs | 67ef8c2 | 2018-03-29 15:22:32 +0200 | [diff] [blame] | 143 | AX_ADD_COMPILER_FLAG([-Wall]) |
| 144 | AX_ADD_COMPILER_FLAG([-Wextra]) |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 145 | AX_ADD_COMPILER_FLAG([-Wformat-security]) |
Andreas Fuchs | 67ef8c2 | 2018-03-29 15:22:32 +0200 | [diff] [blame] | 146 | AX_ADD_COMPILER_FLAG([-Werror]) |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 147 | AX_ADD_COMPILER_FLAG([-fstack-protector-all]) |
| 148 | AX_ADD_COMPILER_FLAG([-fpic]) |
| 149 | AX_ADD_COMPILER_FLAG([-fPIC]) |
Tadeusz Struk | a3260d8 | 2017-09-11 12:06:13 -0700 | [diff] [blame] | 150 | |
Philip Tricca | 0820651 | 2017-12-28 14:56:07 -0800 | [diff] [blame] | 151 | AX_ADD_PREPROC_FLAG([-D_DEFAULT_SOURCE]) |
Lu Gong | abc63b3 | 2018-01-10 09:43:14 +0800 | [diff] [blame] | 152 | AX_ADD_PREPROC_FLAG([-D_BSD_SOURCE]) |
Jia Zhang | 5878264 | 2018-01-19 11:24:34 +0800 | [diff] [blame] | 153 | AX_ADD_PREPROC_FLAG([-D_POSIX_SOURCE]) |
Philip Tricca | 0820651 | 2017-12-28 14:56:07 -0800 | [diff] [blame] | 154 | |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 155 | AC_ARG_WITH([maxloglevel], |
| 156 | [AS_HELP_STRING([--with-maxloglevel={none,error,warning,info,debug,trace}], |
Andreas Fuchs | bc49076 | 2018-01-03 14:36:38 +0100 | [diff] [blame] | 157 | [sets the maximum log level (default is trace)])], |
| 158 | [], |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 159 | [with_maxloglevel=trace]) |
| 160 | AS_IF([test "x$with_maxloglevel" = "xnone"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 161 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [0], ["Logging disabled"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 162 | AS_IF([test "x$with_maxloglevel" = "xerror"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 163 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [2], ["Error log level"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 164 | AS_IF([test "x$with_maxloglevel" = "xwarning"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 165 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [3], ["Warning log level"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 166 | AS_IF([test "x$with_maxloglevel" = "xinfo"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 167 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [4], ["Info log level"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 168 | AS_IF([test "x$with_maxloglevel" = "xdebug"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 169 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [5], ["Debug log level"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 170 | AS_IF([test "x$with_maxloglevel" = "xtrace"], |
Tadeusz Struk | ae55ab9 | 2018-02-28 11:56:31 -0800 | [diff] [blame] | 171 | AC_DEFINE_UNQUOTED([MAXLOGLEVEL], [6], ["Trace log level"]), |
Andreas Fuchs | 80e8485 | 2018-02-27 22:45:09 +0100 | [diff] [blame] | 172 | AC_MSG_ERROR([Bad value for --with-maxloglevel]))))))) |
Andreas Fuchs | bc49076 | 2018-01-03 14:36:38 +0100 | [diff] [blame] | 173 | |
Tadeusz Struk | a3260d8 | 2017-09-11 12:06:13 -0700 | [diff] [blame] | 174 | AC_ARG_ENABLE([debug], |
| 175 | [AS_HELP_STRING([--enable-debug], |
| 176 | [build with debug info (default is no)])], |
| 177 | [enable_debug=$enableval], |
| 178 | [enable_debug=no]) |
Tadeusz Struk | 3980bad | 2018-04-04 10:30:01 -0700 | [diff] [blame] | 179 | AS_IF([test "x$enable_debug" = "xyes"], AX_ADD_COMPILER_FLAG([-ggdb3 -Og])) |
Tadeusz Struk | a3260d8 | 2017-09-11 12:06:13 -0700 | [diff] [blame] | 180 | AS_IF([test "x$enable_debug" = "xno"], [AX_ADD_PREPROC_FLAG([-U_FORTIFY_SOURCE]) |
Tadeusz Struk | 3980bad | 2018-04-04 10:30:01 -0700 | [diff] [blame] | 181 | AX_ADD_PREPROC_FLAG([-D_FORTIFY_SOURCE=2]) |
| 182 | AX_ADD_COMPILER_FLAG([-g -O2])]) |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 183 | AX_ADD_LINK_FLAG([-Wl,--no-undefined]) |
| 184 | AX_ADD_LINK_FLAG([-Wl,-z,noexecstack]) |
| 185 | AX_ADD_LINK_FLAG([-Wl,-z,now]) |
| 186 | AX_ADD_LINK_FLAG([-Wl,-z,relro]) |
Philip Tricca | b43de64 | 2017-03-04 21:29:10 -0800 | [diff] [blame] | 187 | |
Philip Tricca | 9907543 | 2018-04-25 19:02:05 -0700 | [diff] [blame] | 188 | AC_SUBST([PATH]) |
| 189 | |
Philip Tricca | f891580 | 2017-03-14 17:01:50 -0700 | [diff] [blame] | 190 | # work around GCC bug #53119 |
| 191 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119 |
| 192 | AX_ADD_COMPILER_FLAG([-Wno-missing-braces]) |
| 193 | |
Andreas Fuchs | 2968c71 | 2018-02-01 18:22:47 +0100 | [diff] [blame] | 194 | dnl --------- Doxy Gen ----------------------- |
Andreas Fuchs | bc169cb | 2018-04-10 12:02:10 +0200 | [diff] [blame] | 195 | DX_DOXYGEN_FEATURE(ON) |
| 196 | DX_DOT_FEATURE(OFF) |
Andreas Fuchs | 2968c71 | 2018-02-01 18:22:47 +0100 | [diff] [blame] | 197 | DX_HTML_FEATURE(ON) |
| 198 | DX_CHM_FEATURE(OFF) |
| 199 | DX_CHI_FEATURE(OFF) |
| 200 | DX_MAN_FEATURE(ON) |
| 201 | DX_RTF_FEATURE(OFF) |
| 202 | DX_XML_FEATURE(OFF) |
| 203 | DX_PDF_FEATURE(OFF) |
| 204 | DX_PS_FEATURE(OFF) |
Andreas Fuchs | e5273b3 | 2018-04-26 16:16:24 +0200 | [diff] [blame] | 205 | DX_INIT_DOXYGEN($PACKAGE_NAME, [Doxyfile], [doc/doxygen]) |
| 206 | AM_CONDITIONAL(DOXYMAN, [test $DX_FLAG_man -eq 1]) |
Andreas Fuchs | 2968c71 | 2018-02-01 18:22:47 +0100 | [diff] [blame] | 207 | |
Andreas Fuchs | 61cb7fb | 2017-11-22 10:23:01 +0100 | [diff] [blame] | 208 | AX_CODE_COVERAGE |
| 209 | |
Philip Tricca | d1952b4 | 2015-08-05 15:52:10 -0700 | [diff] [blame] | 210 | AC_OUTPUT |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 211 | |
Andreas Fuchs | 2b085e9 | 2018-05-02 16:42:47 +0200 | [diff] [blame] | 212 | AM_COND_IF([ENABLE_TCTI_DEVICE], [], |
| 213 | [AM_COND_IF([ENABLE_TCTI_MSSIM], [], |
| 214 | [AC_MSG_WARN("No build-in TCTI module enabled")])]) |
| 215 | |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 216 | AC_MSG_RESULT([ |
| 217 | $PACKAGE_NAME $VERSION |
| 218 | esapi: $enable_esapi |
| 219 | tctidefaultmodule: $with_tctidefaultmodule |
| 220 | tctidefaultconfig: $with_tctidefaultconfig |
| 221 | unit: $enable_unit |
| 222 | debug: $enable_debug |
| 223 | simulatorbin: $with_simulatorbin |
Philip Tricca | fb0b72f | 2018-03-04 19:39:24 -0800 | [diff] [blame] | 224 | maxloglevel: $with_maxloglevel |
Andreas Fuchs | 2968c71 | 2018-02-01 18:22:47 +0100 | [diff] [blame] | 225 | doxygen: $DX_FLAG_doc $enable_doxygen_doc |
Juergen Repp | ff821bd | 2017-12-11 15:21:42 +0100 | [diff] [blame] | 226 | ]) |
| 227 | |