]>
Commit | Line | Data |
---|---|---|
f163b202 SB |
1 | # |
2 | # configure.ac | |
3 | # | |
4 | # The Initial Developer of the Original Code is International | |
5 | # Business Machines Corporation. Portions created by IBM | |
6 | # Corporation are Copyright (C) 2014 International Business | |
7 | # Machines Corporation. All Rights Reserved. | |
8 | # | |
9 | # This program is free software; you can redistribute it and/or modify | |
10 | # it under the terms of the Common Public License as published by | |
11 | # IBM Corporation; either version 1 of the License, or (at your option) | |
12 | # any later version. | |
13 | # | |
14 | # This program is distributed in the hope that it will be useful, | |
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | # Common Public License for more details. | |
18 | # | |
19 | # You should have received a copy of the Common Public License | |
20 | # along with this program; if not, a copy can be viewed at | |
21 | # http://www.opensource.org/licenses/cpl1.0.php. | |
22 | # | |
23 | # This file is derived from tpm-tool's configure.in. | |
24 | # | |
25 | ||
3e3d2c82 | 26 | AC_INIT(swtpm, 0.4.0) |
f163b202 SB |
27 | AC_PREREQ(2.12) |
28 | AC_CONFIG_SRCDIR(Makefile.am) | |
29 | AC_CONFIG_HEADER(config.h) | |
30 | ||
31 | SWTPM_VER_MAJOR=`echo $PACKAGE_VERSION | cut -d "." -f1` | |
32 | SWTPM_VER_MINOR=`echo $PACKAGE_VERSION | cut -d "." -f2` | |
33 | SWTPM_VER_MICRO=`echo $PACKAGE_VERSION | cut -d "." -f3` | |
34 | ||
35 | AC_SUBST([SWTPM_VER_MAJOR]) | |
36 | AC_SUBST([SWTPM_VER_MINOR]) | |
37 | AC_SUBST([SWTPM_VER_MICRO]) | |
38 | ||
39 | dnl Check for programs | |
40 | AC_PROG_CC | |
41 | AC_PROG_INSTALL | |
42 | AC_PROG_LN_S | |
908afaf5 | 43 | LT_INIT |
f163b202 | 44 | |
f163b202 SB |
45 | AC_CONFIG_MACRO_DIR([m4]) |
46 | AC_CANONICAL_TARGET | |
c3fdf688 | 47 | AC_CANONICAL_HOST |
f163b202 | 48 | AM_INIT_AUTOMAKE([foreign 1.6]) |
13cb26d8 | 49 | AM_SILENT_RULES([yes]) |
f163b202 SB |
50 | |
51 | DEBUG="" | |
52 | AC_MSG_CHECKING([for debug-enabled build]) | |
53 | AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [create a debug build]), | |
54 | [if test "$enableval" = "yes"; then | |
55 | DEBUG="yes" | |
56 | AC_MSG_RESULT([yes]) | |
57 | else | |
58 | DEBUG="no" | |
59 | AC_MSG_RESULT([no]) | |
60 | fi], | |
61 | [DEBUG="no", | |
62 | AC_MSG_RESULT([no])]) | |
63 | ||
64 | # If the user has not set CFLAGS, do something appropriate | |
65 | test_CFLAGS=${CFLAGS+set} | |
66 | if test "$test_CFLAGS" != set; then | |
33be7be2 | 67 | if test "$DEBUG" = "yes"; then |
f163b202 SB |
68 | CFLAGS="-O0 -g -DDEBUG" |
69 | else | |
70 | CFLAGS="-g -O2" | |
71 | fi | |
33be7be2 | 72 | elif test "$DEBUG" = "yes"; then |
f163b202 SB |
73 | CFLAGS="$CFLAGS -O0 -g -DDEBUG" |
74 | fi | |
75 | ||
e46a2b66 SB |
76 | AC_HEADER_STDC |
77 | AC_C_CONST | |
78 | AC_C_INLINE | |
79 | ||
80 | AC_TYPE_SIZE_T | |
81 | AC_TYPE_SIGNAL | |
82 | ||
baecda40 SB |
83 | AC_PROG_CC |
84 | AC_PROG_INSTALL | |
3cb54a5d | 85 | AC_PROG_MKDIR_P |
e46a2b66 | 86 | |
ec37bb56 SB |
87 | AC_ARG_WITH([selinux], |
88 | AS_HELP_STRING([--with-selinux], | |
89 | [add SELinux policy extensions @<:@default=check@:>@])) | |
90 | m4_divert_text([DEFAULTS], [with_selinux=check]) | |
91 | ||
92 | dnl Check for SELinux policy support | |
93 | ||
94 | if test "$with_selinux" != "no"; then | |
95 | if test "$with_selinux" = "check" || test "$with_selinux" = "yes"; then | |
96 | if ! test -f /usr/share/selinux/devel/Makefile; then | |
97 | if test "$with_selinux" = "yes"; then | |
98 | AC_MSG_ERROR("Is selinux-policy-devel installed?") | |
99 | else | |
100 | with_selinux="no" | |
101 | fi | |
102 | fi | |
103 | AC_PATH_PROG([SEMODULE], semodule) | |
33be7be2 | 104 | if test "x$SEMODULE" = "x"; then |
ec37bb56 SB |
105 | if test "$with_selinux" = "yes"; then |
106 | AC_MSG_ERROR("Is selinux-policy-devel installed?") | |
107 | else | |
108 | with_selinux="no" | |
109 | fi | |
110 | fi | |
111 | if test "$with_selinux" = "check"; then | |
112 | with_selinux="yes" | |
113 | fi | |
114 | fi | |
115 | fi | |
33be7be2 | 116 | AM_CONDITIONAL([WITH_SELINUX], [test "x$with_selinux" = "xyes"]) |
ec37bb56 | 117 | |
b096be26 SB |
118 | if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc'; then |
119 | sysconfdir="/etc" | |
120 | fi | |
121 | if test "$prefix" = "" && test "$datarootdir" = '${prefix}/share'; then | |
122 | datarootdir="/usr/share" | |
123 | fi | |
d16b86b7 SB |
124 | if test "$prefix" = "/usr" && test "$localstatedir" = '${prefix}/var'; then |
125 | localstatedir="/var" | |
126 | fi | |
5d35321e SB |
127 | if test "x$prefix" = "xNONE"; then |
128 | prefix="/usr/local" | |
129 | fi | |
0432b653 SB |
130 | SYSCONFDIR=`eval echo $sysconfdir` |
131 | DATAROOTDIR=`eval echo $datarootdir` | |
d16b86b7 | 132 | LOCALSTATEDIR=`eval echo $localstatedir` |
0432b653 SB |
133 | AC_SUBST([SYSCONFDIR]) |
134 | AC_SUBST([DATAROOTDIR]) | |
d16b86b7 | 135 | AC_SUBST([LOCALSTATEDIR]) |
b096be26 | 136 | |
7849b6c6 | 137 | cryptolib=openssl |
3bbdd7bc SB |
138 | |
139 | AC_ARG_WITH([openssl], | |
7849b6c6 SB |
140 | [AS_HELP_STRING([--with-openssl], |
141 | [build with openssl library])], | |
142 | [], | |
143 | []) | |
3bbdd7bc SB |
144 | |
145 | case "$cryptolib" in | |
3bbdd7bc | 146 | openssl) |
7849b6c6 SB |
147 | AC_CHECK_LIB(crypto, |
148 | [AES_set_encrypt_key], | |
b78b6af2 | 149 | [true], |
7849b6c6 SB |
150 | AC_MSG_ERROR(Faulty openssl crypto library)) |
151 | AC_CHECK_HEADERS([openssl/aes.h],[], | |
152 | AC_MSG_ERROR(Is openssl-devel/libssl-dev installed?)) | |
153 | AC_MSG_RESULT([Building with openssl crypto library]) | |
0371b63b SB |
154 | LIBCRYPTO_LIBS=$(pkg-config --libs libcrypto) |
155 | AC_SUBST([LIBCRYPTO_LIBS]) | |
7849b6c6 | 156 | ;; |
3bbdd7bc | 157 | esac |
833a5416 | 158 | |
baecda40 SB |
159 | LIBTASN1_LIBS=$(pkg-config --libs libtasn1) |
160 | if test $? -ne 0; then | |
161 | AC_MSG_ERROR("Is libtasn1-devel installed? -- could not get libs for libtasn1") | |
162 | fi | |
163 | AC_SUBST([LIBTASN1_LIBS]) | |
f163b202 | 164 | |
3b33116d SB |
165 | PKG_CHECK_MODULES( |
166 | [LIBTPMS], | |
167 | [libtpms], | |
168 | , | |
169 | AC_MSG_ERROR("no libtpms.pc found; please set PKG_CONFIG_PATH to the directory where libtpms.pc is located") | |
170 | ) | |
b4374c33 JB |
171 | LDFLAGS="$LDFLAGS $LIBTPMS_LDFLAGS" |
172 | CFLAGS="$CFLAGS $LIBTPMS_CFLAGS" | |
fbc596ab | 173 | AC_CHECK_LIB(tpms, |
b78b6af2 | 174 | TPMLIB_ChooseTPMVersion,[true], |
fbc596ab SB |
175 | AC_MSG_ERROR("libtpms 0.6 or later is required") |
176 | ) | |
baecda40 | 177 | AC_SUBST([LIBTPMS_LIBS]) |
f163b202 | 178 | |
5478de0a SB |
179 | AC_CHECK_LIB(c, clock_gettime, LIBRT_LIBS="", LIBRT_LIBS="-lrt") |
180 | AC_SUBST([LIBRT_LIBS]) | |
181 | ||
e46a2b66 | 182 | AC_PATH_PROG([TPM_NVDEFINE], tpm_nvdefine) |
ef606d4a | 183 | if test "x$TPM_NVDEFINE" = "x"; then |
64faf455 | 184 | have_tcsd=no |
ef606d4a SB |
185 | AC_MSG_WARN([NVRAM area tools are needed for TPM 1.2 certificate injection: tpm-tools package]) |
186 | else | |
187 | have_tcsd=yes | |
188 | fi | |
64faf455 SB |
189 | with_swtpm_setup=yes |
190 | AM_CONDITIONAL([HAVE_TCSD], test "$have_tcsd" != "no") | |
e46a2b66 | 191 | |
5cd844d0 SB |
192 | dnl If we have the tcsd package, we can build swtpm_setup, but need netstat also |
193 | AC_PATH_PROG([NETSTAT], [netstat]) | |
194 | case $host_os in | |
195 | linux-*) | |
609dfd87 | 196 | if test "x$NETSTAT" = "x" && test "$have_tcsd" != "no"; then |
64faf455 | 197 | AC_MSG_ERROR([netstat tool is missing for tests: net-tools package]) |
5cd844d0 SB |
198 | fi |
199 | ;; | |
200 | esac | |
201 | ||
09d1a532 SB |
202 | AC_MSG_CHECKING([for whether to build with CUSE interface]) |
203 | AC_ARG_WITH([cuse], | |
204 | AC_HELP_STRING([--with-cuse], | |
205 | [build with CUSE interface]), | |
206 | [], | |
207 | [with_cuse=check] | |
208 | ) | |
f163b202 | 209 | |
09d1a532 SB |
210 | if test "$with_cuse" != "no"; then |
211 | LIBFUSE_CFLAGS=$(pkg-config fuse --cflags 2>/dev/null) | |
212 | if test $? -ne 0; then | |
213 | if test "$with_cuse" = "yes"; then | |
214 | AC_MSG_ERROR("Is fuse-devel installed? -- could not get cflags for libfuse") | |
215 | else | |
216 | with_cuse=no | |
217 | fi | |
218 | else | |
219 | with_cuse=yes | |
220 | fi | |
498433f7 | 221 | fi |
09d1a532 SB |
222 | |
223 | dnl with_cuse is now yes or no | |
224 | if test "$with_cuse" != "no"; then | |
225 | LIBFUSE_LIBS=$(pkg-config fuse --libs) | |
226 | if test $? -ne 0; then | |
227 | AC_MSG_ERROR("Is fuse-devel installed? -- could not get libs for libfuse") | |
228 | fi | |
229 | AC_SUBST([LIBFUSE_CFLAGS]) | |
230 | AC_SUBST([LIBFUSE_LIBS]) | |
231 | AC_DEFINE_UNQUOTED([WITH_CUSE], 1, | |
232 | [whether to build with CUSE interface]) | |
ebf1557d SB |
233 | |
234 | GLIB_CFLAGS=$(pkg-config --cflags glib-2.0) | |
235 | if test $? -ne 0; then | |
236 | AC_MSG_ERROR("Is glib-2.0 installed? -- could not get cflags") | |
237 | fi | |
238 | AC_SUBST([GLIB_CFLAGS]) | |
239 | ||
240 | GLIB_LIBS=$(pkg-config --libs glib-2.0) | |
241 | if test $? -ne 0; then | |
242 | AC_MSG_ERROR("Is glib-2.0 installed? -- could not get libs") | |
243 | fi | |
244 | AC_SUBST([GLIB_LIBS]) | |
245 | ||
246 | GTHREAD_LIBS=$(pkg-config --libs gthread-2.0) | |
247 | if test $? -ne 0; then | |
248 | AC_MSG_ERROR("Is glib-2.0 installed? -- could not get libs for gthread-2.0") | |
249 | fi | |
250 | AC_SUBST([GTHREAD_LIBS]) | |
baecda40 | 251 | fi |
09d1a532 SB |
252 | AM_CONDITIONAL([WITH_CUSE],[test "$with_cuse" = "yes"]) |
253 | AC_MSG_RESULT($with_cuse) | |
f163b202 | 254 | |
498433f7 SB |
255 | AC_MSG_CHECKING([for whether to build with chardev interface]) |
256 | case $host_os in | |
257 | linux-*) | |
258 | with_chardev=yes | |
259 | AC_DEFINE_UNQUOTED([WITH_CHARDEV], 1, | |
260 | [whether to build with chardev interface]) | |
261 | ;; | |
262 | *) | |
263 | with_chardev=no | |
264 | esac | |
265 | AM_CONDITIONAL([WITH_CHARDEV],[test "$with_chardev" = "yes"]) | |
266 | AC_MSG_RESULT($with_cuse) | |
267 | ||
10002933 SB |
268 | AC_ARG_WITH([gnutls], |
269 | AC_HELP_STRING([--with-gnutls], | |
270 | [build with gnutls library]), | |
271 | [], | |
272 | [with_gnutls=check] | |
273 | ) | |
274 | ||
e46a2b66 SB |
275 | if test "x$with_gnutls" != "xno"; then |
276 | GNUTLS_LDFLAGS=$(pkg-config --libs gnutls) | |
277 | if test $? -ne 0; then | |
33be7be2 | 278 | if test "x$with_gnutls" = "xyes"; then |
e46a2b66 SB |
279 | AC_MSG_ERROR("Is gnutls installed? -- could not get libs for gnutls") |
280 | else | |
281 | with_gnutls=no | |
282 | fi | |
283 | fi | |
284 | fi | |
f163b202 | 285 | |
1828edee SB |
286 | if test "x$with_gnutls" != "xno"; then |
287 | AC_PATH_PROG([GNUTLS_CERTTOOL], certtool) | |
33be7be2 SB |
288 | if test "x$GNUTLS_CERTTOOL" = "x"; then |
289 | if test "x$with_gnutls" = "xyes"; then | |
1828edee SB |
290 | AC_MSG_ERROR("Could not find certtool. Is gnutls-utils/gnutls-bin installed?") |
291 | else | |
292 | with_gnutls=no | |
293 | fi | |
294 | fi | |
295 | fi | |
296 | ||
e46a2b66 | 297 | if test "x$with_gnutls" != "xno"; then |
571a8eed | 298 | ORIG_CFLAGS="$CFLAGS" |
baecda40 | 299 | GNUTLS_CFLAGS=$(pkg-config gnutls --cflags) |
571a8eed | 300 | CFLAGS="$CFLAGS $GNUTLS_CFLAGS $GNUTLS_LDFLAGS" |
10002933 | 301 | AC_CHECK_LIB([gnutls], [gnutls_load_file], [ |
baecda40 SB |
302 | GNUTLS_LIBS=-lgnutls |
303 | ], | |
33be7be2 | 304 | [if test "x$with_gnutls" = "xyes"; then |
e46a2b66 SB |
305 | AC_MSG_ERROR([GNUTLS >= 3.1.0 library not found: libgnutls.so]) |
306 | else | |
307 | with_gnutls="no" | |
308 | fi]) | |
571a8eed | 309 | CFLAGS="$ORIG_CFLAGS" |
e46a2b66 SB |
310 | fi |
311 | ||
312 | if test "x$with_gnutls" != "xno"; then | |
571a8eed SB |
313 | ORIG_CFLAGS="$CFLAGS" |
314 | CFLAGS="$CFLAGS $GNUTLS_CFLAGS" | |
e46a2b66 | 315 | AC_CHECK_HEADER(gnutls/abstract.h, [], \ |
33be7be2 | 316 | [if test "x$with_gnutls" = "xyes"; then |
e46a2b66 SB |
317 | AC_MSG_ERROR([GNUTLS >= 3.1.0 library header not found: gnutls/abstract.h]) |
318 | else | |
319 | with_gnutls="no" | |
320 | fi]) | |
571a8eed | 321 | CFLAGS="$ORIG_CFLAGS" |
e46a2b66 SB |
322 | fi |
323 | ||
324 | if test "x$with_gnutls" != "xno"; then | |
325 | with_gnutls="yes" | |
326 | fi | |
33be7be2 | 327 | AM_CONDITIONAL([WITH_GNUTLS], [test "x$with_gnutls" = "xyes"]) |
baecda40 | 328 | AC_SUBST([GNUTLS_LIBS]) |
f163b202 | 329 | |
48abfbb1 | 330 | AC_PATH_PROG([EXPECT], expect) |
33be7be2 | 331 | if test "x$EXPECT" = "x"; then |
48abfbb1 SB |
332 | AC_MSG_ERROR([expect is required: expect package]) |
333 | fi | |
334 | ||
b080afb5 | 335 | AC_PATH_PROG([GAWK], gawk) |
33be7be2 | 336 | if test "x$GAWK" = "x"; then |
b080afb5 SB |
337 | AC_MSG_ERROR([gawk is required: gawk package]) |
338 | fi | |
339 | ||
8cb126e4 | 340 | AC_PATH_PROG([SOCAT], socat) |
33be7be2 | 341 | if test "x$SOCAT" = "x"; then |
8cb126e4 SB |
342 | AC_MSG_ERROR([socat is required: socat package]) |
343 | fi | |
344 | ||
a63fe71a SB |
345 | AC_PATH_PROG([FLOCK], flock) |
346 | if test "x$FLOCK" = "x"; then | |
347 | AC_MSG_ERROR([flock is required: flock package]) | |
348 | fi | |
349 | ||
b4372fe5 | 350 | AC_PATH_PROG([PYTHON], python3) |
33be7be2 | 351 | if test "x$PYTHON" = "x"; then |
b4372fe5 | 352 | AC_MSG_ERROR([python3 is required]) |
dbb399de SB |
353 | fi |
354 | ||
5eeea357 SB |
355 | AC_ARG_ENABLE([hardening], |
356 | AS_HELP_STRING([--disable-hardening], [Disable hardening flags])) | |
a76b4eeb | 357 | |
5eeea357 SB |
358 | if test "x$enable_hardening" != "xno"; then |
359 | TMP="$($CC -fstack-protector-strong $srcdir/include/swtpm/tpm_ioctl.h 2>&1)" | |
360 | if echo $TMP | $GREP 'unrecognized command line option' >/dev/null; then | |
361 | HARDENING_CFLAGS="-fstack-protector -Wstack-protector " | |
362 | else | |
363 | HARDENING_CFLAGS="-fstack-protector-strong -Wstack-protector " | |
364 | fi | |
365 | ||
366 | dnl Must not have -O0 but must have a -O for -D_FORTIFY_SOURCE=2 | |
367 | TMP1="$(echo $CFLAGS | sed -n 's/.*\(-O0\).*/\1/p')" | |
368 | TMP2="$(echo $CFLAGS | sed -n 's/.*\(-O\).*/\1/p')" | |
369 | if test -z "$TMP1" && test -n "$TPM2"; then | |
370 | HARDENING_CFLAGS="$HARDENING_CFLAGS -D_FORTIFY_SOURCE=2 " | |
371 | fi | |
b381e1eb SB |
372 | dnl Check linker for 'relro' and 'now' |
373 | save_CFLAGS="$CFLAGS" | |
374 | CFLAGS="-Wl,-z,relro -Werror" | |
375 | AC_MSG_CHECKING([whether linker supports -Wl,-z,relro]) | |
376 | AC_COMPILE_IFELSE( | |
377 | [AC_LANG_SOURCE([[int main() { return 0; }]])], | |
378 | [HARDENING_CFLAGS="$HARDENING_CFLAGS -Wl,-z,relro" | |
379 | AC_MSG_RESULT(yes)], | |
380 | [AC_MSG_RESULT(no)] | |
381 | ) | |
382 | CFLAGS="-Wl,-z,now -Werror" | |
383 | AC_MSG_CHECKING([whether linker supports -Wl,-z,now]) | |
384 | AC_COMPILE_IFELSE( | |
385 | [AC_LANG_SOURCE([[int main() { return 0; }]])], | |
386 | [HARDENING_CFLAGS="$HARDENING_CFLAGS -Wl,-z,now" | |
387 | AC_MSG_RESULT(yes)], | |
388 | [AC_MSG_RESULT(no)] | |
389 | ) | |
390 | CFLAGS="$save_CFLAGS" | |
5eeea357 | 391 | AC_SUBST([HARDENING_CFLAGS]) |
a76b4eeb | 392 | fi |
e6085e96 | 393 | |
b8421f3d SB |
394 | AC_ARG_ENABLE([test-coverage], |
395 | AS_HELP_STRING([--enable-test-coverage], [Enable test coverage flags])) | |
396 | ||
397 | if test "x$enable_test_coverage" = "xyes"; then | |
398 | COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" | |
399 | COVERAGE_LDFLAGS="-fprofile-arcs" | |
400 | fi | |
401 | ||
c4ac0a11 SB |
402 | AC_ARG_WITH([tss-user], |
403 | AC_HELP_STRING([--with-tss-user=TSS_USER], | |
404 | [The tss user to use]), | |
405 | [TSS_USER="$withval"], | |
406 | [TSS_USER="tss"] | |
407 | ) | |
408 | ||
409 | AC_ARG_WITH([tss-group], | |
410 | AC_HELP_STRING([--with-tss-group=TSS_GROUP], | |
411 | [The tss group to use]), | |
412 | [TSS_GROUP="$withval"], | |
413 | [TSS_GROUP="tss"] | |
414 | ) | |
aa88eebe SB |
415 | |
416 | case $have_tcsd in | |
417 | yes) | |
418 | AC_MSG_CHECKING([whether TSS_USER $TSS_USER is available]) | |
419 | if ! test $(id -u $TSS_USER); then | |
420 | AC_MSG_ERROR(["$TSS_USER is not available"]) | |
421 | else | |
422 | AC_MSG_RESULT([yes]) | |
423 | fi | |
424 | AC_MSG_CHECKING([whether TSS_GROUP $TSS_GROUP is available]) | |
425 | if ! test $(id -g $TSS_GROUP); then | |
426 | AC_MSG_ERROR(["$TSS_GROUP is not available"]) | |
427 | else | |
428 | AC_MSG_RESULT([yes]) | |
429 | fi | |
430 | ;; | |
431 | esac | |
432 | ||
c4ac0a11 SB |
433 | AC_SUBST([TSS_USER]) |
434 | AC_SUBST([TSS_GROUP]) | |
435 | ||
f163b202 SB |
436 | CFLAGS="$CFLAGS -Wreturn-type -Wsign-compare -Wswitch-enum" |
437 | CFLAGS="$CFLAGS -Wmissing-prototypes -Wall -Werror" | |
e6085e96 | 438 | CFLAGS="$CFLAGS -Wformat -Wformat-security" |
b8421f3d SB |
439 | CFLAGS="$CFLAGS $GNUTLS_CFLAGS $COVERAGE_CFLAGS" |
440 | ||
441 | LDFLAGS="$LDFLAGS $COVERAGE_LDFLAGS" | |
f163b202 | 442 | |
f2458ef7 SB |
443 | dnl Simulate the following for systems with pkg-config < 0.28: |
444 | dnl PKG_CHECK_VAR([libtpms_cryptolib], [libtpms], [cryptolib], | |
445 | dnl [], AC_MSG_ERROR([Could not determine libtpms crypto library.])) | |
446 | PKG_PROG_PKG_CONFIG | |
447 | ||
448 | AC_MSG_CHECKING([Checking the crypto library libtpms is linked to]) | |
449 | libtpms_cryptolib=`$PKG_CONFIG --variable cryptolib libtpms` | |
33be7be2 | 450 | if test "x$libtpms_cryptolib" = "x"; then |
b4374c33 JB |
451 | AC_MSG_WARN([Could not determine the crypto library libtpms is using, assuming ${cryptolib}]) |
452 | libtpms_cryptolib=${cryptolib} | |
f2458ef7 SB |
453 | fi |
454 | AC_MSG_RESULT($libtpms_cryptolib) | |
86cc4527 SB |
455 | |
456 | if test "$libtpms_cryptolib" != "$cryptolib"; then | |
457 | echo "libtpms is using $libtpms_cryptolib; we have to use the same" | |
33be7be2 | 458 | if test "$cryptolib" = "openssl"; then |
86cc4527 SB |
459 | AC_MSG_ERROR([do not use --with-openssl]) |
460 | else | |
461 | AC_MSG_ERROR([use --with-openssl]) | |
462 | fi | |
463 | fi | |
464 | ||
c751e32e SB |
465 | with_vtpm_proxy=no |
466 | case $host_os in | |
f071d820 | 467 | linux-*) |
c751e32e SB |
468 | with_vtpm_proxy=yes |
469 | AC_DEFINE_UNQUOTED([WITH_VTPM_PROXY], 1, | |
470 | [whether to build in vTPM proxy support (Linux only)]) | |
471 | esac | |
472 | ||
6286beac SB |
473 | case $host_os in |
474 | cygwin) | |
475 | CFLAGS="$CFLAGS -D__USE_LINUX_IOCTL_DEFS" | |
476 | esac | |
477 | ||
761df6cd SB |
478 | dnl Seccomp profile using -lseccomp (Linux only) |
479 | case $host_os in | |
480 | linux-*) | |
481 | with_seccomp_default=yes | |
482 | ;; | |
483 | *) | |
484 | with_seccomp_default=no | |
485 | ;; | |
486 | esac | |
487 | ||
488 | AC_MSG_CHECKING([for whether to build with seccomp profile]) | |
489 | AC_ARG_WITH([seccomp], | |
490 | AC_HELP_STRING([--with-seccomp], | |
491 | [build with seccomp profile]), | |
0232f78f | 492 | AC_MSG_RESULT([$with_seccomp]), |
761df6cd | 493 | [with_seccomp=$with_seccomp_default] |
0232f78f | 494 | AC_MSG_RESULT([$with_seccomp]) |
761df6cd SB |
495 | ) |
496 | ||
497 | if test "$with_seccomp" != "no"; then | |
498 | LIBSECCOMP_CFLAGS=$(pkg-config libseccomp --cflags 2>/dev/null) | |
499 | if test $? -ne 0; then | |
500 | AC_MSG_ERROR("Is libseccomp-devel installed? -- could not get cflags for libseccomp") | |
501 | else | |
502 | with_libseccomp=yes | |
503 | fi | |
504 | LIBSECCOMP_LIBS=$(pkg-config --libs libseccomp) | |
505 | AC_SUBST([LIBSECCOMP_LIBS]) | |
506 | AC_SUBST([LIBSECCOMP_CFLAGS]) | |
507 | AC_DEFINE_UNQUOTED([WITH_SECCOMP], 1, | |
508 | [whether to build in seccomp profile (Linux only)]) | |
509 | fi | |
510 | ||
44b92d43 SB |
511 | AC_CONFIG_FILES([Makefile \ |
512 | debian/swtpm-tools.postinst \ | |
f163b202 | 513 | dist/swtpm.spec \ |
e46a2b66 | 514 | etc/Makefile \ |
0432b653 | 515 | etc/swtpm_setup.conf \ |
e46a2b66 | 516 | samples/Makefile \ |
d16b86b7 | 517 | samples/swtpm-localca.conf \ |
a12b09b1 | 518 | samples/swtpm-create-user-config-files \ |
f163b202 SB |
519 | include/Makefile \ |
520 | include/swtpm/Makefile \ | |
a1fa5d77 | 521 | include/swtpm.h \ |
f163b202 SB |
522 | src/Makefile \ |
523 | src/selinux/Makefile \ | |
524 | src/swtpm/Makefile \ | |
e46a2b66 SB |
525 | src/swtpm_bios/Makefile \ |
526 | src/swtpm_cert/Makefile \ | |
527 | src/swtpm_ioctl/Makefile \ | |
528 | src/swtpm_setup/Makefile \ | |
c4ac0a11 | 529 | src/swtpm_setup/swtpm_setup.h \ |
eee8cb5d | 530 | src/swtpm_setup/py_swtpm_setup/swtpm_setup_conf.py \ |
f163b202 | 531 | man/Makefile \ |
39d0c3de | 532 | man/man3/Makefile \ |
f163b202 | 533 | man/man8/Makefile \ |
e46a2b66 | 534 | tests/Makefile \ |
c4ac0a11 | 535 | tests/test_config \ |
10002933 SB |
536 | ]) |
537 | AC_CONFIG_FILES([src/swtpm_setup/swtpm_setup.sh], | |
538 | [chmod 755 src/swtpm_setup/swtpm_setup.sh]) | |
0432b653 SB |
539 | AC_CONFIG_FILES([samples/swtpm-localca], |
540 | [chmod 755 samples/swtpm-localca]) | |
f163b202 SB |
541 | AC_OUTPUT |
542 | ||
e46a2b66 | 543 | echo |
c3fdf688 | 544 | printf "with_gnutls : %5s (no = swtpm_cert will NOT be built)\n" $with_gnutls |
040c7097 | 545 | printf "with_selinux : %5s (no = SELinux policy extensions will NOT be built)\n" $with_selinux |
c3fdf688 | 546 | printf "with_cuse : %5s (no = no CUSE interface)\n" $with_cuse |
498433f7 | 547 | printf "with_chardev : %5s (no = no chardev interface)\n" $with_chardev |
c3fdf688 | 548 | printf "with_swtpm_setup: %5s (no = swtpm_setup will NOT be built)\n" $with_swtpm_setup |
c751e32e | 549 | printf "with_vtpm_proxy : %5s (no = no vtpm proxy support; Linux only)\n" $with_vtpm_proxy |
761df6cd | 550 | printf "with_seccomp : %5s (no = no seccomp profile; Linux only)\n" $with_seccomp |
e46a2b66 | 551 | echo |
040c7097 SB |
552 | echo "Version to build : $PACKAGE_VERSION" |
553 | echo "Crypto library : $cryptolib" | |
10002933 | 554 | echo |
f163b202 | 555 | echo "CFLAGS=$CFLAGS" |
a76b4eeb | 556 | echo "HARDENING_CFLAGS=$HARDENING_CFLAGS" |
f163b202 | 557 | echo "LDFLAGS=$LDFLAGS" |
761df6cd | 558 | echo "LIBSECCOMP_LIBS=$LIBSECCOMP_LIBS" |
c4ac0a11 SB |
559 | echo |
560 | echo "TSS_USER=$TSS_USER" | |
561 | echo "TSS_GROUP=$TSS_GROUP" | |
562 | echo |