]>
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 | ||
3bf8f462 | 26 | AC_INIT(swtpm, 0.5.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 | ) | |
8d086ee9 | 171 | LDFLAGS="$LDFLAGS $LIBTPMS_LIBS" |
b4374c33 | 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 | ||
cc410ca9 SB |
182 | AC_PATH_PROG([TCSD], tcsd) |
183 | if test "x$TCSD" = "x"; then | |
64faf455 | 184 | have_tcsd=no |
cc410ca9 | 185 | AC_MSG_WARN([tcsd could not be found; typically need it for tss user account and tests]) |
ef606d4a SB |
186 | else |
187 | have_tcsd=yes | |
188 | fi | |
64faf455 | 189 | AM_CONDITIONAL([HAVE_TCSD], test "$have_tcsd" != "no") |
e46a2b66 | 190 | |
5cd844d0 SB |
191 | dnl If we have the tcsd package, we can build swtpm_setup, but need netstat also |
192 | AC_PATH_PROG([NETSTAT], [netstat]) | |
193 | case $host_os in | |
194 | linux-*) | |
609dfd87 | 195 | if test "x$NETSTAT" = "x" && test "$have_tcsd" != "no"; then |
64faf455 | 196 | AC_MSG_ERROR([netstat tool is missing for tests: net-tools package]) |
5cd844d0 SB |
197 | fi |
198 | ;; | |
199 | esac | |
200 | ||
09d1a532 SB |
201 | AC_MSG_CHECKING([for whether to build with CUSE interface]) |
202 | AC_ARG_WITH([cuse], | |
203 | AC_HELP_STRING([--with-cuse], | |
204 | [build with CUSE interface]), | |
205 | [], | |
206 | [with_cuse=check] | |
207 | ) | |
f163b202 | 208 | |
09d1a532 SB |
209 | if test "$with_cuse" != "no"; then |
210 | LIBFUSE_CFLAGS=$(pkg-config fuse --cflags 2>/dev/null) | |
211 | if test $? -ne 0; then | |
212 | if test "$with_cuse" = "yes"; then | |
213 | AC_MSG_ERROR("Is fuse-devel installed? -- could not get cflags for libfuse") | |
214 | else | |
215 | with_cuse=no | |
216 | fi | |
217 | else | |
218 | with_cuse=yes | |
219 | fi | |
498433f7 | 220 | fi |
09d1a532 SB |
221 | |
222 | dnl with_cuse is now yes or no | |
223 | if test "$with_cuse" != "no"; then | |
224 | LIBFUSE_LIBS=$(pkg-config fuse --libs) | |
225 | if test $? -ne 0; then | |
226 | AC_MSG_ERROR("Is fuse-devel installed? -- could not get libs for libfuse") | |
227 | fi | |
228 | AC_SUBST([LIBFUSE_CFLAGS]) | |
229 | AC_SUBST([LIBFUSE_LIBS]) | |
230 | AC_DEFINE_UNQUOTED([WITH_CUSE], 1, | |
231 | [whether to build with CUSE interface]) | |
ebf1557d SB |
232 | |
233 | GLIB_CFLAGS=$(pkg-config --cflags glib-2.0) | |
234 | if test $? -ne 0; then | |
235 | AC_MSG_ERROR("Is glib-2.0 installed? -- could not get cflags") | |
236 | fi | |
237 | AC_SUBST([GLIB_CFLAGS]) | |
238 | ||
239 | GLIB_LIBS=$(pkg-config --libs glib-2.0) | |
240 | if test $? -ne 0; then | |
241 | AC_MSG_ERROR("Is glib-2.0 installed? -- could not get libs") | |
242 | fi | |
243 | AC_SUBST([GLIB_LIBS]) | |
244 | ||
245 | GTHREAD_LIBS=$(pkg-config --libs gthread-2.0) | |
246 | if test $? -ne 0; then | |
247 | AC_MSG_ERROR("Is glib-2.0 installed? -- could not get libs for gthread-2.0") | |
248 | fi | |
249 | AC_SUBST([GTHREAD_LIBS]) | |
baecda40 | 250 | fi |
09d1a532 SB |
251 | AM_CONDITIONAL([WITH_CUSE],[test "$with_cuse" = "yes"]) |
252 | AC_MSG_RESULT($with_cuse) | |
f163b202 | 253 | |
498433f7 SB |
254 | AC_MSG_CHECKING([for whether to build with chardev interface]) |
255 | case $host_os in | |
256 | linux-*) | |
257 | with_chardev=yes | |
258 | AC_DEFINE_UNQUOTED([WITH_CHARDEV], 1, | |
259 | [whether to build with chardev interface]) | |
260 | ;; | |
261 | *) | |
262 | with_chardev=no | |
263 | esac | |
264 | AM_CONDITIONAL([WITH_CHARDEV],[test "$with_chardev" = "yes"]) | |
265 | AC_MSG_RESULT($with_cuse) | |
266 | ||
10002933 SB |
267 | AC_ARG_WITH([gnutls], |
268 | AC_HELP_STRING([--with-gnutls], | |
269 | [build with gnutls library]), | |
270 | [], | |
271 | [with_gnutls=check] | |
272 | ) | |
273 | ||
e46a2b66 SB |
274 | if test "x$with_gnutls" != "xno"; then |
275 | GNUTLS_LDFLAGS=$(pkg-config --libs gnutls) | |
276 | if test $? -ne 0; then | |
33be7be2 | 277 | if test "x$with_gnutls" = "xyes"; then |
e46a2b66 SB |
278 | AC_MSG_ERROR("Is gnutls installed? -- could not get libs for gnutls") |
279 | else | |
280 | with_gnutls=no | |
281 | fi | |
282 | fi | |
283 | fi | |
f163b202 | 284 | |
1828edee SB |
285 | if test "x$with_gnutls" != "xno"; then |
286 | AC_PATH_PROG([GNUTLS_CERTTOOL], certtool) | |
33be7be2 SB |
287 | if test "x$GNUTLS_CERTTOOL" = "x"; then |
288 | if test "x$with_gnutls" = "xyes"; then | |
1828edee SB |
289 | AC_MSG_ERROR("Could not find certtool. Is gnutls-utils/gnutls-bin installed?") |
290 | else | |
291 | with_gnutls=no | |
292 | fi | |
293 | fi | |
294 | fi | |
295 | ||
e46a2b66 | 296 | if test "x$with_gnutls" != "xno"; then |
571a8eed | 297 | ORIG_CFLAGS="$CFLAGS" |
baecda40 | 298 | GNUTLS_CFLAGS=$(pkg-config gnutls --cflags) |
571a8eed | 299 | CFLAGS="$CFLAGS $GNUTLS_CFLAGS $GNUTLS_LDFLAGS" |
10002933 | 300 | AC_CHECK_LIB([gnutls], [gnutls_load_file], [ |
baecda40 SB |
301 | GNUTLS_LIBS=-lgnutls |
302 | ], | |
33be7be2 | 303 | [if test "x$with_gnutls" = "xyes"; then |
e46a2b66 SB |
304 | AC_MSG_ERROR([GNUTLS >= 3.1.0 library not found: libgnutls.so]) |
305 | else | |
306 | with_gnutls="no" | |
307 | fi]) | |
571a8eed | 308 | CFLAGS="$ORIG_CFLAGS" |
e46a2b66 SB |
309 | fi |
310 | ||
311 | if test "x$with_gnutls" != "xno"; then | |
571a8eed SB |
312 | ORIG_CFLAGS="$CFLAGS" |
313 | CFLAGS="$CFLAGS $GNUTLS_CFLAGS" | |
e46a2b66 | 314 | AC_CHECK_HEADER(gnutls/abstract.h, [], \ |
33be7be2 | 315 | [if test "x$with_gnutls" = "xyes"; then |
e46a2b66 SB |
316 | AC_MSG_ERROR([GNUTLS >= 3.1.0 library header not found: gnutls/abstract.h]) |
317 | else | |
318 | with_gnutls="no" | |
319 | fi]) | |
571a8eed | 320 | CFLAGS="$ORIG_CFLAGS" |
e46a2b66 SB |
321 | fi |
322 | ||
323 | if test "x$with_gnutls" != "xno"; then | |
324 | with_gnutls="yes" | |
325 | fi | |
33be7be2 | 326 | AM_CONDITIONAL([WITH_GNUTLS], [test "x$with_gnutls" = "xyes"]) |
baecda40 | 327 | AC_SUBST([GNUTLS_LIBS]) |
f163b202 | 328 | |
48abfbb1 | 329 | AC_PATH_PROG([EXPECT], expect) |
33be7be2 | 330 | if test "x$EXPECT" = "x"; then |
48abfbb1 SB |
331 | AC_MSG_ERROR([expect is required: expect package]) |
332 | fi | |
333 | ||
b080afb5 | 334 | AC_PATH_PROG([GAWK], gawk) |
33be7be2 | 335 | if test "x$GAWK" = "x"; then |
b080afb5 SB |
336 | AC_MSG_ERROR([gawk is required: gawk package]) |
337 | fi | |
338 | ||
8cb126e4 | 339 | AC_PATH_PROG([SOCAT], socat) |
33be7be2 | 340 | if test "x$SOCAT" = "x"; then |
8cb126e4 SB |
341 | AC_MSG_ERROR([socat is required: socat package]) |
342 | fi | |
343 | ||
cc410ca9 SB |
344 | AC_PATH_PROG([BASE64], base64) |
345 | if test "x$BASE64" = "x"; then | |
346 | AC_MSG_ERROR([base64 is required: base64 package]) | |
dbb399de SB |
347 | fi |
348 | ||
cc410ca9 SB |
349 | AC_PATH_PROG([CP], cp) |
350 | if test "x$CP" = "x"; then | |
351 | AC_MSG_ERROR([cp is required]) | |
352 | fi | |
353 | ||
354 | AM_PATH_PYTHON([3.3]) | |
355 | ||
356 | AC_PATH_PROG([PIP3], pip3) | |
357 | if test "x$PIP3" = "x"; then | |
358 | AC_PATH_PROG([PIP3], pip) | |
359 | if test "x$PIP3" = "x"; then | |
fdaa6f1f | 360 | AC_MSG_WARN([pip3 is required to uninstall the built package]) |
cc410ca9 SB |
361 | else |
362 | AC_MSG_WARN([Using pip as pip3 tool]) | |
363 | fi | |
364 | fi | |
365 | ||
366 | AC_MSG_CHECKING([for python setuptools package]) | |
367 | $PYTHON -c "import setuptools" | |
368 | AS_IF([ test $? = 0 ], | |
369 | [AC_MSG_RESULT([yes])], | |
370 | [AC_MSG_ERROR([python setuptools is required])]) | |
371 | ||
372 | AC_MSG_CHECKING([for python cryptography package]) | |
373 | $PYTHON -c "import cryptography" | |
374 | AS_IF([ test $? = 0 ], | |
375 | [AC_MSG_RESULT([yes])], | |
376 | [AC_MSG_ERROR([python setuptools is required])]) | |
377 | ||
3dafa38e JW |
378 | AC_ARG_ENABLE([python-installation], |
379 | AS_HELP_STRING([--disable-python-installation], [Disable running setup.py install for swtpm_setup])) | |
380 | AM_CONDITIONAL([PYTHON_INSTALLATION], [test "x$enable_python_installation" != "xno"]) | |
381 | ||
5eeea357 SB |
382 | AC_ARG_ENABLE([hardening], |
383 | AS_HELP_STRING([--disable-hardening], [Disable hardening flags])) | |
a76b4eeb | 384 | |
5eeea357 SB |
385 | if test "x$enable_hardening" != "xno"; then |
386 | TMP="$($CC -fstack-protector-strong $srcdir/include/swtpm/tpm_ioctl.h 2>&1)" | |
387 | if echo $TMP | $GREP 'unrecognized command line option' >/dev/null; then | |
388 | HARDENING_CFLAGS="-fstack-protector -Wstack-protector " | |
389 | else | |
390 | HARDENING_CFLAGS="-fstack-protector-strong -Wstack-protector " | |
391 | fi | |
392 | ||
393 | dnl Must not have -O0 but must have a -O for -D_FORTIFY_SOURCE=2 | |
394 | TMP1="$(echo $CFLAGS | sed -n 's/.*\(-O0\).*/\1/p')" | |
395 | TMP2="$(echo $CFLAGS | sed -n 's/.*\(-O\).*/\1/p')" | |
396 | if test -z "$TMP1" && test -n "$TPM2"; then | |
397 | HARDENING_CFLAGS="$HARDENING_CFLAGS -D_FORTIFY_SOURCE=2 " | |
398 | fi | |
b381e1eb SB |
399 | dnl Check linker for 'relro' and 'now' |
400 | save_CFLAGS="$CFLAGS" | |
401 | CFLAGS="-Wl,-z,relro -Werror" | |
402 | AC_MSG_CHECKING([whether linker supports -Wl,-z,relro]) | |
2ba23cee | 403 | AC_LINK_IFELSE( |
b381e1eb | 404 | [AC_LANG_SOURCE([[int main() { return 0; }]])], |
0586d2f5 | 405 | [HARDENING_LDFLAGS="$HARDENING_LDFLAGS -Wl,-z,relro" |
b381e1eb SB |
406 | AC_MSG_RESULT(yes)], |
407 | [AC_MSG_RESULT(no)] | |
408 | ) | |
409 | CFLAGS="-Wl,-z,now -Werror" | |
410 | AC_MSG_CHECKING([whether linker supports -Wl,-z,now]) | |
2ba23cee | 411 | AC_LINK_IFELSE( |
b381e1eb | 412 | [AC_LANG_SOURCE([[int main() { return 0; }]])], |
0586d2f5 | 413 | [HARDENING_LDFLAGS="$HARDENING_LDFLAGS -Wl,-z,now" |
b381e1eb SB |
414 | AC_MSG_RESULT(yes)], |
415 | [AC_MSG_RESULT(no)] | |
416 | ) | |
417 | CFLAGS="$save_CFLAGS" | |
5eeea357 | 418 | AC_SUBST([HARDENING_CFLAGS]) |
0586d2f5 | 419 | AC_SUBST([HARDENING_LDFLAGS]) |
a76b4eeb | 420 | fi |
e6085e96 | 421 | |
b8421f3d SB |
422 | AC_ARG_ENABLE([test-coverage], |
423 | AS_HELP_STRING([--enable-test-coverage], [Enable test coverage flags])) | |
424 | ||
425 | if test "x$enable_test_coverage" = "xyes"; then | |
426 | COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" | |
427 | COVERAGE_LDFLAGS="-fprofile-arcs" | |
428 | fi | |
429 | ||
c4ac0a11 SB |
430 | AC_ARG_WITH([tss-user], |
431 | AC_HELP_STRING([--with-tss-user=TSS_USER], | |
432 | [The tss user to use]), | |
433 | [TSS_USER="$withval"], | |
434 | [TSS_USER="tss"] | |
435 | ) | |
436 | ||
437 | AC_ARG_WITH([tss-group], | |
438 | AC_HELP_STRING([--with-tss-group=TSS_GROUP], | |
439 | [The tss group to use]), | |
440 | [TSS_GROUP="$withval"], | |
441 | [TSS_GROUP="tss"] | |
442 | ) | |
aa88eebe SB |
443 | |
444 | case $have_tcsd in | |
445 | yes) | |
446 | AC_MSG_CHECKING([whether TSS_USER $TSS_USER is available]) | |
447 | if ! test $(id -u $TSS_USER); then | |
448 | AC_MSG_ERROR(["$TSS_USER is not available"]) | |
449 | else | |
450 | AC_MSG_RESULT([yes]) | |
451 | fi | |
452 | AC_MSG_CHECKING([whether TSS_GROUP $TSS_GROUP is available]) | |
453 | if ! test $(id -g $TSS_GROUP); then | |
454 | AC_MSG_ERROR(["$TSS_GROUP is not available"]) | |
455 | else | |
456 | AC_MSG_RESULT([yes]) | |
457 | fi | |
458 | ;; | |
459 | esac | |
460 | ||
c4ac0a11 SB |
461 | AC_SUBST([TSS_USER]) |
462 | AC_SUBST([TSS_GROUP]) | |
463 | ||
f163b202 SB |
464 | CFLAGS="$CFLAGS -Wreturn-type -Wsign-compare -Wswitch-enum" |
465 | CFLAGS="$CFLAGS -Wmissing-prototypes -Wall -Werror" | |
e6085e96 | 466 | CFLAGS="$CFLAGS -Wformat -Wformat-security" |
b8421f3d SB |
467 | CFLAGS="$CFLAGS $GNUTLS_CFLAGS $COVERAGE_CFLAGS" |
468 | ||
469 | LDFLAGS="$LDFLAGS $COVERAGE_LDFLAGS" | |
f163b202 | 470 | |
f2458ef7 SB |
471 | dnl Simulate the following for systems with pkg-config < 0.28: |
472 | dnl PKG_CHECK_VAR([libtpms_cryptolib], [libtpms], [cryptolib], | |
473 | dnl [], AC_MSG_ERROR([Could not determine libtpms crypto library.])) | |
474 | PKG_PROG_PKG_CONFIG | |
475 | ||
476 | AC_MSG_CHECKING([Checking the crypto library libtpms is linked to]) | |
477 | libtpms_cryptolib=`$PKG_CONFIG --variable cryptolib libtpms` | |
33be7be2 | 478 | if test "x$libtpms_cryptolib" = "x"; then |
b4374c33 JB |
479 | AC_MSG_WARN([Could not determine the crypto library libtpms is using, assuming ${cryptolib}]) |
480 | libtpms_cryptolib=${cryptolib} | |
f2458ef7 SB |
481 | fi |
482 | AC_MSG_RESULT($libtpms_cryptolib) | |
86cc4527 SB |
483 | |
484 | if test "$libtpms_cryptolib" != "$cryptolib"; then | |
485 | echo "libtpms is using $libtpms_cryptolib; we have to use the same" | |
33be7be2 | 486 | if test "$cryptolib" = "openssl"; then |
86cc4527 SB |
487 | AC_MSG_ERROR([do not use --with-openssl]) |
488 | else | |
489 | AC_MSG_ERROR([use --with-openssl]) | |
490 | fi | |
491 | fi | |
492 | ||
c751e32e SB |
493 | with_vtpm_proxy=no |
494 | case $host_os in | |
f071d820 | 495 | linux-*) |
c751e32e SB |
496 | with_vtpm_proxy=yes |
497 | AC_DEFINE_UNQUOTED([WITH_VTPM_PROXY], 1, | |
498 | [whether to build in vTPM proxy support (Linux only)]) | |
499 | esac | |
500 | ||
6286beac SB |
501 | case $host_os in |
502 | cygwin) | |
503 | CFLAGS="$CFLAGS -D__USE_LINUX_IOCTL_DEFS" | |
504 | esac | |
505 | ||
761df6cd SB |
506 | dnl Seccomp profile using -lseccomp (Linux only) |
507 | case $host_os in | |
508 | linux-*) | |
509 | with_seccomp_default=yes | |
510 | ;; | |
511 | *) | |
512 | with_seccomp_default=no | |
513 | ;; | |
514 | esac | |
515 | ||
516 | AC_MSG_CHECKING([for whether to build with seccomp profile]) | |
517 | AC_ARG_WITH([seccomp], | |
518 | AC_HELP_STRING([--with-seccomp], | |
519 | [build with seccomp profile]), | |
0232f78f | 520 | AC_MSG_RESULT([$with_seccomp]), |
761df6cd | 521 | [with_seccomp=$with_seccomp_default] |
0232f78f | 522 | AC_MSG_RESULT([$with_seccomp]) |
761df6cd SB |
523 | ) |
524 | ||
525 | if test "$with_seccomp" != "no"; then | |
526 | LIBSECCOMP_CFLAGS=$(pkg-config libseccomp --cflags 2>/dev/null) | |
527 | if test $? -ne 0; then | |
528 | AC_MSG_ERROR("Is libseccomp-devel installed? -- could not get cflags for libseccomp") | |
529 | else | |
530 | with_libseccomp=yes | |
531 | fi | |
532 | LIBSECCOMP_LIBS=$(pkg-config --libs libseccomp) | |
533 | AC_SUBST([LIBSECCOMP_LIBS]) | |
534 | AC_SUBST([LIBSECCOMP_CFLAGS]) | |
535 | AC_DEFINE_UNQUOTED([WITH_SECCOMP], 1, | |
536 | [whether to build in seccomp profile (Linux only)]) | |
537 | fi | |
538 | ||
44b92d43 SB |
539 | AC_CONFIG_FILES([Makefile \ |
540 | debian/swtpm-tools.postinst \ | |
f163b202 | 541 | dist/swtpm.spec \ |
e46a2b66 | 542 | etc/Makefile \ |
0432b653 | 543 | etc/swtpm_setup.conf \ |
e46a2b66 | 544 | samples/Makefile \ |
b71da430 | 545 | samples/py_swtpm_localca/swtpm_localca_conf.py \ |
d16b86b7 | 546 | samples/swtpm-localca.conf \ |
a12b09b1 | 547 | samples/swtpm-create-user-config-files \ |
f163b202 SB |
548 | include/Makefile \ |
549 | include/swtpm/Makefile \ | |
a1fa5d77 | 550 | include/swtpm.h \ |
f163b202 SB |
551 | src/Makefile \ |
552 | src/selinux/Makefile \ | |
553 | src/swtpm/Makefile \ | |
e46a2b66 SB |
554 | src/swtpm_bios/Makefile \ |
555 | src/swtpm_cert/Makefile \ | |
556 | src/swtpm_ioctl/Makefile \ | |
557 | src/swtpm_setup/Makefile \ | |
eee8cb5d | 558 | src/swtpm_setup/py_swtpm_setup/swtpm_setup_conf.py \ |
f163b202 | 559 | man/Makefile \ |
39d0c3de | 560 | man/man3/Makefile \ |
f163b202 | 561 | man/man8/Makefile \ |
e46a2b66 | 562 | tests/Makefile \ |
c4ac0a11 | 563 | tests/test_config \ |
10002933 | 564 | ]) |
0432b653 SB |
565 | AC_CONFIG_FILES([samples/swtpm-localca], |
566 | [chmod 755 samples/swtpm-localca]) | |
3064a72f SB |
567 | AC_CONFIG_FILES([src/swtpm_setup/swtpm_setup], |
568 | [chmod 755 src/swtpm_setup/swtpm_setup]) | |
cc410ca9 | 569 | dnl for out-of-tree builds: |
3064a72f | 570 | AC_CONFIG_LINKS([src/swtpm_setup/py_swtpm_setup/__init__.py:src/swtpm_setup/py_swtpm_setup/__init__.py \ |
cc410ca9 SB |
571 | src/swtpm_setup/py_swtpm_setup/swtpm.py:src/swtpm_setup/py_swtpm_setup/swtpm.py \ |
572 | src/swtpm_setup/py_swtpm_setup/swtpm_utils.py:src/swtpm_setup/py_swtpm_setup/swtpm_utils.py \ | |
573 | src/swtpm_setup/py_swtpm_setup/swtpm_setup.py:src/swtpm_setup/py_swtpm_setup/swtpm_setup.py]) | |
b71da430 SB |
574 | AC_CONFIG_LINKS([samples/py_swtpm_localca/__init__.py:samples/py_swtpm_localca/__init__.py \ |
575 | samples/py_swtpm_localca/swtpm_localca.py:samples/py_swtpm_localca/swtpm_localca.py \ | |
576 | samples/py_swtpm_localca/swtpm_utils.py:samples/py_swtpm_localca/swtpm_utils.py]) | |
f163b202 SB |
577 | AC_OUTPUT |
578 | ||
e46a2b66 | 579 | echo |
c3fdf688 | 580 | printf "with_gnutls : %5s (no = swtpm_cert will NOT be built)\n" $with_gnutls |
040c7097 | 581 | printf "with_selinux : %5s (no = SELinux policy extensions will NOT be built)\n" $with_selinux |
c3fdf688 | 582 | printf "with_cuse : %5s (no = no CUSE interface)\n" $with_cuse |
498433f7 | 583 | printf "with_chardev : %5s (no = no chardev interface)\n" $with_chardev |
c751e32e | 584 | printf "with_vtpm_proxy : %5s (no = no vtpm proxy support; Linux only)\n" $with_vtpm_proxy |
761df6cd | 585 | printf "with_seccomp : %5s (no = no seccomp profile; Linux only)\n" $with_seccomp |
e46a2b66 | 586 | echo |
040c7097 SB |
587 | echo "Version to build : $PACKAGE_VERSION" |
588 | echo "Crypto library : $cryptolib" | |
10002933 | 589 | echo |
f163b202 | 590 | echo "CFLAGS=$CFLAGS" |
a76b4eeb | 591 | echo "HARDENING_CFLAGS=$HARDENING_CFLAGS" |
0586d2f5 | 592 | echo "HARDENING_LDFLAGS=$HARDENING_LDFLAGS" |
f163b202 | 593 | echo "LDFLAGS=$LDFLAGS" |
761df6cd | 594 | echo "LIBSECCOMP_LIBS=$LIBSECCOMP_LIBS" |
c4ac0a11 SB |
595 | echo |
596 | echo "TSS_USER=$TSS_USER" | |
597 | echo "TSS_GROUP=$TSS_GROUP" | |
598 | echo |