From 93c88d0af36b70a406997b40c49bfc14c17b4cd2 Mon Sep 17 00:00:00 2001 From: Damien Goutte-Gattat via Gnupg-devel Date: Wed, 17 Mar 2021 23:19:21 +0000 Subject: [PATCH] build: Allow selection of TSS library. * configure.ac: New option --with-tss to force the use of a specific TSS library. -- While most systems will probably have only one of the two TPM libraries that we support (the IBM TSS or the Intel TSS), it would still be helpful to allow which one to use in the event that both are detected, instead of always using the IBM one. This patch does that by adding a --with-tss=TSS configure-time option, where TSS can be "ibm", "intel", or "autodetect". The default value is "autodetect", which triggers the original behavior (i.e. try to detect both libraries, and prefer the IBM one if both are found). Signed-off-by: Damien Goutte-Gattat --- configure.ac | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 215a6535f..3752acdcc 100644 --- a/configure.ac +++ b/configure.ac @@ -1594,14 +1594,30 @@ AC_SUBST(W32SOCKLIBS) # # TPM libtss library .. don't compile TPM support if we don't have it # +AC_ARG_WITH([tss], + [AS_HELP_STRING([--with-tss=TSS], + [use the specified TPM Software Stack (ibm, intel, or autodetect)])], + [with_tss=$withval], + [with_tss=autodetect]) LIBTSS_LIBS= LIBTSS_CFLAGS= if test "$build_tpm2d" = "yes"; then _save_libs="$LIBS" _save_cflags="$CFLAGS" LIBS="" - AC_SEARCH_LIBS([TSS_Create], [tss ibmtss],have_libtss=IBM, - AC_SEARCH_LIBS([Esys_Initialize], [tss2-esys],have_libtss=Intel)) + if test "$with_tss" = autodetect; then + AC_SEARCH_LIBS([TSS_Create],[tss ibmtss],have_libtss=IBM, + AC_SEARCH_LIBS([Esys_Initialize],[tss2-esys],have_libtss=Intel,have_libtss=no)) + elif test "$with_tss" = ibm; then + AC_SEARCH_LIBS([TSS_Create],[tss ibmtss],have_libtss=IBM, + [AC_MSG_ERROR([IBM TPM Software Stack requested but not found])]) + elif test "$with_tss" = intel; then + AC_SEARCH_LIBS([Esys_Initialize],[tss2-esys],have_libtss=Intel, + [AC_MSG_ERROR([Intel TPM Software Stack requested but not found])]) + else + AC_MSG_ERROR([Invalid TPM Software Stack requested: $with_tss]) + fi + if test "$have_libtss" = IBM; then LIBTSS_CFLAGS="-DTPM_POSIX" CFLAGS="$CFLAGS ${LIBTSS_CFLAGS}"