]>
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 | ||
b295c768 TK |
26 | AC_INIT([swtpm],[0.7.0]) |
27 | AC_PREREQ([2.69]) | |
f163b202 | 28 | AC_CONFIG_SRCDIR(Makefile.am) |
b295c768 | 29 | AC_CONFIG_HEADERS([config.h]) |
f163b202 SB |
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]) | |
b295c768 | 53 | AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[create a debug build]), |
f163b202 SB |
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_C_CONST |
77 | AC_C_INLINE | |
78 | ||
79 | AC_TYPE_SIZE_T | |
e46a2b66 | 80 | |
baecda40 SB |
81 | AC_PROG_CC |
82 | AC_PROG_INSTALL | |
3cb54a5d | 83 | AC_PROG_MKDIR_P |
e46a2b66 | 84 | |
ec37bb56 SB |
85 | AC_ARG_WITH([selinux], |
86 | AS_HELP_STRING([--with-selinux], | |
87 | [add SELinux policy extensions @<:@default=check@:>@])) | |
88 | m4_divert_text([DEFAULTS], [with_selinux=check]) | |
89 | ||
90 | dnl Check for SELinux policy support | |
91 | ||
92 | if test "$with_selinux" != "no"; then | |
93 | if test "$with_selinux" = "check" || test "$with_selinux" = "yes"; then | |
94 | if ! test -f /usr/share/selinux/devel/Makefile; then | |
95 | if test "$with_selinux" = "yes"; then | |
96 | AC_MSG_ERROR("Is selinux-policy-devel installed?") | |
97 | else | |
98 | with_selinux="no" | |
99 | fi | |
100 | fi | |
101 | AC_PATH_PROG([SEMODULE], semodule) | |
33be7be2 | 102 | if test "x$SEMODULE" = "x"; then |
ec37bb56 SB |
103 | if test "$with_selinux" = "yes"; then |
104 | AC_MSG_ERROR("Is selinux-policy-devel installed?") | |
105 | else | |
106 | with_selinux="no" | |
107 | fi | |
108 | fi | |
109 | if test "$with_selinux" = "check"; then | |
110 | with_selinux="yes" | |
111 | fi | |
112 | fi | |
113 | fi | |
33be7be2 | 114 | AM_CONDITIONAL([WITH_SELINUX], [test "x$with_selinux" = "xyes"]) |
ec37bb56 | 115 | |
b096be26 SB |
116 | if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc'; then |
117 | sysconfdir="/etc" | |
118 | fi | |
119 | if test "$prefix" = "" && test "$datarootdir" = '${prefix}/share'; then | |
120 | datarootdir="/usr/share" | |
121 | fi | |
d16b86b7 SB |
122 | if test "$prefix" = "/usr" && test "$localstatedir" = '${prefix}/var'; then |
123 | localstatedir="/var" | |
124 | fi | |
5d35321e SB |
125 | if test "x$prefix" = "xNONE"; then |
126 | prefix="/usr/local" | |
127 | fi | |
0432b653 SB |
128 | SYSCONFDIR=`eval echo $sysconfdir` |
129 | DATAROOTDIR=`eval echo $datarootdir` | |
d16b86b7 | 130 | LOCALSTATEDIR=`eval echo $localstatedir` |
0432b653 SB |
131 | AC_SUBST([SYSCONFDIR]) |
132 | AC_SUBST([DATAROOTDIR]) | |
d16b86b7 | 133 | AC_SUBST([LOCALSTATEDIR]) |
b096be26 | 134 | |
7849b6c6 | 135 | cryptolib=openssl |
3bbdd7bc SB |
136 | |
137 | AC_ARG_WITH([openssl], | |
7849b6c6 SB |
138 | [AS_HELP_STRING([--with-openssl], |
139 | [build with openssl library])], | |
140 | [], | |
141 | []) | |
3bbdd7bc SB |
142 | |
143 | case "$cryptolib" in | |
3bbdd7bc | 144 | openssl) |
7849b6c6 SB |
145 | AC_CHECK_LIB(crypto, |
146 | [AES_set_encrypt_key], | |
b78b6af2 | 147 | [true], |
7849b6c6 SB |
148 | AC_MSG_ERROR(Faulty openssl crypto library)) |
149 | AC_CHECK_HEADERS([openssl/aes.h],[], | |
150 | AC_MSG_ERROR(Is openssl-devel/libssl-dev installed?)) | |
151 | AC_MSG_RESULT([Building with openssl crypto library]) | |
0371b63b SB |
152 | LIBCRYPTO_LIBS=$(pkg-config --libs libcrypto) |
153 | AC_SUBST([LIBCRYPTO_LIBS]) | |
7849b6c6 | 154 | ;; |
3bbdd7bc | 155 | esac |
833a5416 | 156 | |
baecda40 SB |
157 | LIBTASN1_LIBS=$(pkg-config --libs libtasn1) |
158 | if test $? -ne 0; then | |
159 | AC_MSG_ERROR("Is libtasn1-devel installed? -- could not get libs for libtasn1") | |
160 | fi | |
161 | AC_SUBST([LIBTASN1_LIBS]) | |
f163b202 | 162 | |
3b33116d SB |
163 | PKG_CHECK_MODULES( |
164 | [LIBTPMS], | |
165 | [libtpms], | |
166 | , | |
167 | AC_MSG_ERROR("no libtpms.pc found; please set PKG_CONFIG_PATH to the directory where libtpms.pc is located") | |
168 | ) | |
8d086ee9 | 169 | LDFLAGS="$LDFLAGS $LIBTPMS_LIBS" |
b4374c33 | 170 | CFLAGS="$CFLAGS $LIBTPMS_CFLAGS" |
fbc596ab | 171 | AC_CHECK_LIB(tpms, |
b78b6af2 | 172 | TPMLIB_ChooseTPMVersion,[true], |
fbc596ab SB |
173 | AC_MSG_ERROR("libtpms 0.6 or later is required") |
174 | ) | |
baecda40 | 175 | AC_SUBST([LIBTPMS_LIBS]) |
f163b202 | 176 | |
5478de0a SB |
177 | AC_CHECK_LIB(c, clock_gettime, LIBRT_LIBS="", LIBRT_LIBS="-lrt") |
178 | AC_SUBST([LIBRT_LIBS]) | |
179 | ||
cc410ca9 SB |
180 | AC_PATH_PROG([TCSD], tcsd) |
181 | if test "x$TCSD" = "x"; then | |
64faf455 | 182 | have_tcsd=no |
cc410ca9 | 183 | AC_MSG_WARN([tcsd could not be found; typically need it for tss user account and tests]) |
ef606d4a SB |
184 | else |
185 | have_tcsd=yes | |
186 | fi | |
64faf455 | 187 | AM_CONDITIONAL([HAVE_TCSD], test "$have_tcsd" != "no") |
e46a2b66 | 188 | |
d4c60e44 | 189 | dnl We either need netstat (more common across systems) or 'ss' for test cases |
5cd844d0 | 190 | AC_PATH_PROG([NETSTAT], [netstat]) |
d4c60e44 SB |
191 | if test "x$NETSTAT" = "x"; then |
192 | AC_PATH_PROG([SS], [ss]) | |
193 | if test "x$SS" = "x"; then | |
194 | AC_MSG_ERROR(['netstat' and 'ss' tools are missing for tests: net-tools OR iproute/iproute2 package]) | |
195 | fi | |
196 | fi | |
5cd844d0 | 197 | |
09d1a532 SB |
198 | AC_MSG_CHECKING([for whether to build with CUSE interface]) |
199 | AC_ARG_WITH([cuse], | |
b295c768 | 200 | AS_HELP_STRING([--with-cuse],[build with CUSE interface]), |
09d1a532 SB |
201 | [], |
202 | [with_cuse=check] | |
203 | ) | |
f163b202 | 204 | |
09d1a532 SB |
205 | if test "$with_cuse" != "no"; then |
206 | LIBFUSE_CFLAGS=$(pkg-config fuse --cflags 2>/dev/null) | |
207 | if test $? -ne 0; then | |
208 | if test "$with_cuse" = "yes"; then | |
209 | AC_MSG_ERROR("Is fuse-devel installed? -- could not get cflags for libfuse") | |
210 | else | |
211 | with_cuse=no | |
212 | fi | |
213 | else | |
214 | with_cuse=yes | |
215 | fi | |
498433f7 | 216 | fi |
09d1a532 | 217 | |
c125e34b SB |
218 | JSON_GLIB_CFLAGS=$(pkg-config --cflags json-glib-1.0) |
219 | if test $? -ne 0; then | |
220 | AC_MSG_ERROR("Is libjson-glib-dev/json-glib-devel installed? -- could not get cflags") | |
221 | fi | |
222 | AC_SUBST([JSON_GLIB_CFLAGS]) | |
223 | ||
224 | JSON_GLIB_LIBS=$(pkg-config --libs json-glib-1.0) | |
225 | if test $? -ne 0; then | |
226 | AC_MSG_ERROR("Is libjson-glib-dev/json-glib-devel installed? -- could not get libs") | |
227 | fi | |
228 | AC_SUBST([JSON_GLIB_LIBS]) | |
229 | ||
230 | GLIB_CFLAGS=$(pkg-config --cflags glib-2.0) | |
231 | if test $? -ne 0; then | |
232 | AC_MSG_ERROR("Is libglib-2.0-dev/glib2-devel installed? -- could not get cflags") | |
233 | fi | |
234 | AC_SUBST([GLIB_CFLAGS]) | |
235 | ||
236 | GLIB_LIBS=$(pkg-config --libs glib-2.0) | |
237 | if test $? -ne 0; then | |
238 | AC_MSG_ERROR("Is libglib-2.0-dev/glib2-devel installed? -- could not get cflags") | |
239 | fi | |
240 | AC_SUBST([GLIB_LIBS]) | |
241 | ||
09d1a532 SB |
242 | dnl with_cuse is now yes or no |
243 | if test "$with_cuse" != "no"; then | |
244 | LIBFUSE_LIBS=$(pkg-config fuse --libs) | |
245 | if test $? -ne 0; then | |
246 | AC_MSG_ERROR("Is fuse-devel installed? -- could not get libs for libfuse") | |
247 | fi | |
248 | AC_SUBST([LIBFUSE_CFLAGS]) | |
249 | AC_SUBST([LIBFUSE_LIBS]) | |
250 | AC_DEFINE_UNQUOTED([WITH_CUSE], 1, | |
251 | [whether to build with CUSE interface]) | |
ebf1557d | 252 | |
ebf1557d SB |
253 | GTHREAD_LIBS=$(pkg-config --libs gthread-2.0) |
254 | if test $? -ne 0; then | |
255 | AC_MSG_ERROR("Is glib-2.0 installed? -- could not get libs for gthread-2.0") | |
256 | fi | |
257 | AC_SUBST([GTHREAD_LIBS]) | |
baecda40 | 258 | fi |
09d1a532 SB |
259 | AM_CONDITIONAL([WITH_CUSE],[test "$with_cuse" = "yes"]) |
260 | AC_MSG_RESULT($with_cuse) | |
f163b202 | 261 | |
498433f7 SB |
262 | AC_MSG_CHECKING([for whether to build with chardev interface]) |
263 | case $host_os in | |
264 | linux-*) | |
265 | with_chardev=yes | |
266 | AC_DEFINE_UNQUOTED([WITH_CHARDEV], 1, | |
267 | [whether to build with chardev interface]) | |
268 | ;; | |
269 | *) | |
270 | with_chardev=no | |
271 | esac | |
272 | AM_CONDITIONAL([WITH_CHARDEV],[test "$with_chardev" = "yes"]) | |
273 | AC_MSG_RESULT($with_cuse) | |
274 | ||
10002933 | 275 | AC_ARG_WITH([gnutls], |
b295c768 | 276 | AS_HELP_STRING([--with-gnutls],[build with gnutls library]), |
10002933 SB |
277 | [], |
278 | [with_gnutls=check] | |
279 | ) | |
280 | ||
e46a2b66 SB |
281 | if test "x$with_gnutls" != "xno"; then |
282 | GNUTLS_LDFLAGS=$(pkg-config --libs gnutls) | |
283 | if test $? -ne 0; then | |
33be7be2 | 284 | if test "x$with_gnutls" = "xyes"; then |
e46a2b66 SB |
285 | AC_MSG_ERROR("Is gnutls installed? -- could not get libs for gnutls") |
286 | else | |
287 | with_gnutls=no | |
288 | fi | |
289 | fi | |
290 | fi | |
f163b202 | 291 | |
1828edee | 292 | if test "x$with_gnutls" != "xno"; then |
e9fd0142 SB |
293 | AC_PATH_PROG([GNUTLS_CERTTOOL], certtool) |
294 | if test "x$GNUTLS_CERTTOOL" = "x"; then | |
295 | if test "x$with_gnutls" = "xyes"; then | |
296 | AC_MSG_ERROR("Could not find certtool. Is gnutls-utils/gnutls-bin installed?") | |
297 | else | |
298 | with_gnutls=no | |
299 | fi | |
300 | fi | |
301 | dnl certtool changed how it takes private key passwords | |
302 | dnl 3.3.29 is too old (RHEL 7); we need at least gnutls 3.4.0 | |
303 | AC_MSG_CHECKING([for gnutls 3.4.0 or later]) | |
304 | $(pkg-config gnutls --atleast-version=3.4.0) | |
305 | if test $? -ne 0; then | |
306 | AC_MSG_ERROR([gnutls 3.4.0 is required]) | |
307 | fi | |
308 | AC_MSG_RESULT([yes]) | |
1828edee SB |
309 | fi |
310 | ||
e46a2b66 | 311 | if test "x$with_gnutls" != "xno"; then |
571a8eed | 312 | ORIG_CFLAGS="$CFLAGS" |
baecda40 | 313 | GNUTLS_CFLAGS=$(pkg-config gnutls --cflags) |
571a8eed | 314 | CFLAGS="$CFLAGS $GNUTLS_CFLAGS $GNUTLS_LDFLAGS" |
10002933 | 315 | AC_CHECK_LIB([gnutls], [gnutls_load_file], [ |
baecda40 SB |
316 | GNUTLS_LIBS=-lgnutls |
317 | ], | |
33be7be2 | 318 | [if test "x$with_gnutls" = "xyes"; then |
e46a2b66 SB |
319 | AC_MSG_ERROR([GNUTLS >= 3.1.0 library not found: libgnutls.so]) |
320 | else | |
321 | with_gnutls="no" | |
322 | fi]) | |
571a8eed | 323 | CFLAGS="$ORIG_CFLAGS" |
e46a2b66 SB |
324 | fi |
325 | ||
326 | if test "x$with_gnutls" != "xno"; then | |
571a8eed SB |
327 | ORIG_CFLAGS="$CFLAGS" |
328 | CFLAGS="$CFLAGS $GNUTLS_CFLAGS" | |
e46a2b66 | 329 | AC_CHECK_HEADER(gnutls/abstract.h, [], \ |
33be7be2 | 330 | [if test "x$with_gnutls" = "xyes"; then |
e46a2b66 SB |
331 | AC_MSG_ERROR([GNUTLS >= 3.1.0 library header not found: gnutls/abstract.h]) |
332 | else | |
333 | with_gnutls="no" | |
334 | fi]) | |
571a8eed | 335 | CFLAGS="$ORIG_CFLAGS" |
e46a2b66 SB |
336 | fi |
337 | ||
338 | if test "x$with_gnutls" != "xno"; then | |
339 | with_gnutls="yes" | |
340 | fi | |
33be7be2 | 341 | AM_CONDITIONAL([WITH_GNUTLS], [test "x$with_gnutls" = "xyes"]) |
baecda40 | 342 | AC_SUBST([GNUTLS_LIBS]) |
f163b202 | 343 | |
48abfbb1 | 344 | AC_PATH_PROG([EXPECT], expect) |
33be7be2 | 345 | if test "x$EXPECT" = "x"; then |
48abfbb1 SB |
346 | AC_MSG_ERROR([expect is required: expect package]) |
347 | fi | |
348 | ||
b080afb5 | 349 | AC_PATH_PROG([GAWK], gawk) |
33be7be2 | 350 | if test "x$GAWK" = "x"; then |
b080afb5 SB |
351 | AC_MSG_ERROR([gawk is required: gawk package]) |
352 | fi | |
353 | ||
8cb126e4 | 354 | AC_PATH_PROG([SOCAT], socat) |
33be7be2 | 355 | if test "x$SOCAT" = "x"; then |
8cb126e4 SB |
356 | AC_MSG_ERROR([socat is required: socat package]) |
357 | fi | |
358 | ||
cc410ca9 SB |
359 | AC_PATH_PROG([BASE64], base64) |
360 | if test "x$BASE64" = "x"; then | |
361 | AC_MSG_ERROR([base64 is required: base64 package]) | |
dbb399de SB |
362 | fi |
363 | ||
cc410ca9 SB |
364 | AC_PATH_PROG([CP], cp) |
365 | if test "x$CP" = "x"; then | |
366 | AC_MSG_ERROR([cp is required]) | |
367 | fi | |
368 | ||
369 | AM_PATH_PYTHON([3.3]) | |
370 | ||
371 | AC_PATH_PROG([PIP3], pip3) | |
372 | if test "x$PIP3" = "x"; then | |
373 | AC_PATH_PROG([PIP3], pip) | |
374 | if test "x$PIP3" = "x"; then | |
fdaa6f1f | 375 | AC_MSG_WARN([pip3 is required to uninstall the built package]) |
cc410ca9 SB |
376 | else |
377 | AC_MSG_WARN([Using pip as pip3 tool]) | |
378 | fi | |
379 | fi | |
380 | ||
5eeea357 SB |
381 | AC_ARG_ENABLE([hardening], |
382 | AS_HELP_STRING([--disable-hardening], [Disable hardening flags])) | |
a76b4eeb | 383 | |
5eeea357 SB |
384 | if test "x$enable_hardening" != "xno"; then |
385 | TMP="$($CC -fstack-protector-strong $srcdir/include/swtpm/tpm_ioctl.h 2>&1)" | |
386 | if echo $TMP | $GREP 'unrecognized command line option' >/dev/null; then | |
387 | HARDENING_CFLAGS="-fstack-protector -Wstack-protector " | |
388 | else | |
389 | HARDENING_CFLAGS="-fstack-protector-strong -Wstack-protector " | |
390 | fi | |
391 | ||
392 | dnl Must not have -O0 but must have a -O for -D_FORTIFY_SOURCE=2 | |
393 | TMP1="$(echo $CFLAGS | sed -n 's/.*\(-O0\).*/\1/p')" | |
394 | TMP2="$(echo $CFLAGS | sed -n 's/.*\(-O\).*/\1/p')" | |
502cb112 | 395 | if test -z "$TMP1" && test -n "$TMP2"; then |
5eeea357 SB |
396 | HARDENING_CFLAGS="$HARDENING_CFLAGS -D_FORTIFY_SOURCE=2 " |
397 | fi | |
b381e1eb SB |
398 | dnl Check linker for 'relro' and 'now' |
399 | save_CFLAGS="$CFLAGS" | |
400 | CFLAGS="-Wl,-z,relro -Werror" | |
401 | AC_MSG_CHECKING([whether linker supports -Wl,-z,relro]) | |
2ba23cee | 402 | AC_LINK_IFELSE( |
b381e1eb | 403 | [AC_LANG_SOURCE([[int main() { return 0; }]])], |
0586d2f5 | 404 | [HARDENING_LDFLAGS="$HARDENING_LDFLAGS -Wl,-z,relro" |
b381e1eb SB |
405 | AC_MSG_RESULT(yes)], |
406 | [AC_MSG_RESULT(no)] | |
407 | ) | |
408 | CFLAGS="-Wl,-z,now -Werror" | |
409 | AC_MSG_CHECKING([whether linker supports -Wl,-z,now]) | |
2ba23cee | 410 | AC_LINK_IFELSE( |
b381e1eb | 411 | [AC_LANG_SOURCE([[int main() { return 0; }]])], |
0586d2f5 | 412 | [HARDENING_LDFLAGS="$HARDENING_LDFLAGS -Wl,-z,now" |
b381e1eb SB |
413 | AC_MSG_RESULT(yes)], |
414 | [AC_MSG_RESULT(no)] | |
415 | ) | |
416 | CFLAGS="$save_CFLAGS" | |
5eeea357 | 417 | AC_SUBST([HARDENING_CFLAGS]) |
0586d2f5 | 418 | AC_SUBST([HARDENING_LDFLAGS]) |
a76b4eeb | 419 | fi |
e6085e96 | 420 | |
b8421f3d SB |
421 | AC_ARG_ENABLE([test-coverage], |
422 | AS_HELP_STRING([--enable-test-coverage], [Enable test coverage flags])) | |
423 | ||
424 | if test "x$enable_test_coverage" = "xyes"; then | |
425 | COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" | |
426 | COVERAGE_LDFLAGS="-fprofile-arcs" | |
427 | fi | |
428 | ||
c4ac0a11 | 429 | AC_ARG_WITH([tss-user], |
b295c768 | 430 | AS_HELP_STRING([--with-tss-user=TSS_USER],[The tss user to use]), |
c4ac0a11 SB |
431 | [TSS_USER="$withval"], |
432 | [TSS_USER="tss"] | |
433 | ) | |
434 | ||
435 | AC_ARG_WITH([tss-group], | |
b295c768 | 436 | AS_HELP_STRING([--with-tss-group=TSS_GROUP],[The tss group to use]), |
c4ac0a11 SB |
437 | [TSS_GROUP="$withval"], |
438 | [TSS_GROUP="tss"] | |
439 | ) | |
aa88eebe SB |
440 | |
441 | case $have_tcsd in | |
442 | yes) | |
443 | AC_MSG_CHECKING([whether TSS_USER $TSS_USER is available]) | |
444 | if ! test $(id -u $TSS_USER); then | |
445 | AC_MSG_ERROR(["$TSS_USER is not available"]) | |
446 | else | |
447 | AC_MSG_RESULT([yes]) | |
448 | fi | |
449 | AC_MSG_CHECKING([whether TSS_GROUP $TSS_GROUP is available]) | |
450 | if ! test $(id -g $TSS_GROUP); then | |
451 | AC_MSG_ERROR(["$TSS_GROUP is not available"]) | |
452 | else | |
453 | AC_MSG_RESULT([yes]) | |
454 | fi | |
455 | ;; | |
456 | esac | |
457 | ||
c4ac0a11 SB |
458 | AC_SUBST([TSS_USER]) |
459 | AC_SUBST([TSS_GROUP]) | |
460 | ||
f163b202 SB |
461 | CFLAGS="$CFLAGS -Wreturn-type -Wsign-compare -Wswitch-enum" |
462 | CFLAGS="$CFLAGS -Wmissing-prototypes -Wall -Werror" | |
e6085e96 | 463 | CFLAGS="$CFLAGS -Wformat -Wformat-security" |
b8421f3d SB |
464 | CFLAGS="$CFLAGS $GNUTLS_CFLAGS $COVERAGE_CFLAGS" |
465 | ||
466 | LDFLAGS="$LDFLAGS $COVERAGE_LDFLAGS" | |
f163b202 | 467 | |
f2458ef7 SB |
468 | dnl Simulate the following for systems with pkg-config < 0.28: |
469 | dnl PKG_CHECK_VAR([libtpms_cryptolib], [libtpms], [cryptolib], | |
470 | dnl [], AC_MSG_ERROR([Could not determine libtpms crypto library.])) | |
471 | PKG_PROG_PKG_CONFIG | |
472 | ||
473 | AC_MSG_CHECKING([Checking the crypto library libtpms is linked to]) | |
474 | libtpms_cryptolib=`$PKG_CONFIG --variable cryptolib libtpms` | |
33be7be2 | 475 | if test "x$libtpms_cryptolib" = "x"; then |
b4374c33 JB |
476 | AC_MSG_WARN([Could not determine the crypto library libtpms is using, assuming ${cryptolib}]) |
477 | libtpms_cryptolib=${cryptolib} | |
f2458ef7 SB |
478 | fi |
479 | AC_MSG_RESULT($libtpms_cryptolib) | |
86cc4527 SB |
480 | |
481 | if test "$libtpms_cryptolib" != "$cryptolib"; then | |
482 | echo "libtpms is using $libtpms_cryptolib; we have to use the same" | |
33be7be2 | 483 | if test "$cryptolib" = "openssl"; then |
86cc4527 SB |
484 | AC_MSG_ERROR([do not use --with-openssl]) |
485 | else | |
486 | AC_MSG_ERROR([use --with-openssl]) | |
487 | fi | |
488 | fi | |
489 | ||
c751e32e SB |
490 | with_vtpm_proxy=no |
491 | case $host_os in | |
f071d820 | 492 | linux-*) |
c751e32e SB |
493 | with_vtpm_proxy=yes |
494 | AC_DEFINE_UNQUOTED([WITH_VTPM_PROXY], 1, | |
495 | [whether to build in vTPM proxy support (Linux only)]) | |
496 | esac | |
497 | ||
6286beac SB |
498 | case $host_os in |
499 | cygwin) | |
500 | CFLAGS="$CFLAGS -D__USE_LINUX_IOCTL_DEFS" | |
501 | esac | |
502 | ||
761df6cd SB |
503 | dnl Seccomp profile using -lseccomp (Linux only) |
504 | case $host_os in | |
505 | linux-*) | |
506 | with_seccomp_default=yes | |
507 | ;; | |
508 | *) | |
509 | with_seccomp_default=no | |
510 | ;; | |
511 | esac | |
512 | ||
513 | AC_MSG_CHECKING([for whether to build with seccomp profile]) | |
514 | AC_ARG_WITH([seccomp], | |
b295c768 | 515 | AS_HELP_STRING([--with-seccomp],[build with seccomp profile]), |
0232f78f | 516 | AC_MSG_RESULT([$with_seccomp]), |
761df6cd | 517 | [with_seccomp=$with_seccomp_default] |
0232f78f | 518 | AC_MSG_RESULT([$with_seccomp]) |
761df6cd SB |
519 | ) |
520 | ||
521 | if test "$with_seccomp" != "no"; then | |
522 | LIBSECCOMP_CFLAGS=$(pkg-config libseccomp --cflags 2>/dev/null) | |
523 | if test $? -ne 0; then | |
524 | AC_MSG_ERROR("Is libseccomp-devel installed? -- could not get cflags for libseccomp") | |
525 | else | |
526 | with_libseccomp=yes | |
527 | fi | |
528 | LIBSECCOMP_LIBS=$(pkg-config --libs libseccomp) | |
529 | AC_SUBST([LIBSECCOMP_LIBS]) | |
530 | AC_SUBST([LIBSECCOMP_CFLAGS]) | |
531 | AC_DEFINE_UNQUOTED([WITH_SECCOMP], 1, | |
532 | [whether to build in seccomp profile (Linux only)]) | |
533 | fi | |
534 | ||
44b92d43 SB |
535 | AC_CONFIG_FILES([Makefile \ |
536 | debian/swtpm-tools.postinst \ | |
4608cc33 | 537 | swtpm.spec \ |
e46a2b66 | 538 | etc/Makefile \ |
0432b653 | 539 | etc/swtpm_setup.conf \ |
e46a2b66 | 540 | samples/Makefile \ |
d16b86b7 | 541 | samples/swtpm-localca.conf \ |
a12b09b1 | 542 | samples/swtpm-create-user-config-files \ |
e689684c | 543 | samples/swtpm_localca_conf.h \ |
f163b202 SB |
544 | include/Makefile \ |
545 | include/swtpm/Makefile \ | |
a1fa5d77 | 546 | include/swtpm.h \ |
f163b202 SB |
547 | src/Makefile \ |
548 | src/selinux/Makefile \ | |
549 | src/swtpm/Makefile \ | |
e46a2b66 SB |
550 | src/swtpm_bios/Makefile \ |
551 | src/swtpm_cert/Makefile \ | |
552 | src/swtpm_ioctl/Makefile \ | |
553 | src/swtpm_setup/Makefile \ | |
c125e34b SB |
554 | src/swtpm_setup/swtpm_setup_conf.h \ |
555 | src/utils/Makefile \ | |
f163b202 | 556 | man/Makefile \ |
39d0c3de | 557 | man/man3/Makefile \ |
f163b202 | 558 | man/man8/Makefile \ |
e46a2b66 | 559 | tests/Makefile \ |
c4ac0a11 | 560 | tests/test_config \ |
10002933 | 561 | ]) |
f163b202 SB |
562 | AC_OUTPUT |
563 | ||
e46a2b66 | 564 | echo |
c3fdf688 | 565 | printf "with_gnutls : %5s (no = swtpm_cert will NOT be built)\n" $with_gnutls |
040c7097 | 566 | printf "with_selinux : %5s (no = SELinux policy extensions will NOT be built)\n" $with_selinux |
c3fdf688 | 567 | printf "with_cuse : %5s (no = no CUSE interface)\n" $with_cuse |
498433f7 | 568 | printf "with_chardev : %5s (no = no chardev interface)\n" $with_chardev |
c751e32e | 569 | printf "with_vtpm_proxy : %5s (no = no vtpm proxy support; Linux only)\n" $with_vtpm_proxy |
761df6cd | 570 | printf "with_seccomp : %5s (no = no seccomp profile; Linux only)\n" $with_seccomp |
e46a2b66 | 571 | echo |
040c7097 SB |
572 | echo "Version to build : $PACKAGE_VERSION" |
573 | echo "Crypto library : $cryptolib" | |
10002933 | 574 | echo |
5c5856ea | 575 | echo " CFLAGS = $CFLAGS" |
b5701034 SB |
576 | echo " HARDENING_CFLAGS = $HARDENING_CFLAGS" |
577 | echo "HARDENING_LDFLAGS = $HARDENING_LDFLAGS" | |
5c5856ea | 578 | echo " LDFLAGS = $LDFLAGS" |
b5701034 SB |
579 | echo " LIBSECCOMP_LIBS = $LIBSECCOMP_LIBS" |
580 | echo " JSON_GLIB_CFLAGS = $JSON_GLIB_CFLAGS" | |
581 | echo " JSON_GLIB_LIBS = $JSON_GLIB_LIBS" | |
582 | echo " GLIB_CFLAGS = $GLIB_CFLAGS" | |
583 | echo " GLIB_LIBS = $GLIB_LIBS" | |
c4ac0a11 SB |
584 | echo |
585 | echo "TSS_USER=$TSS_USER" | |
586 | echo "TSS_GROUP=$TSS_GROUP" | |
587 | echo |