[PATCH gnupg] build: Allow selection of TSS library.

Damien Goutte-Gattat dgouttegattat at incenp.org
Thu Mar 18 00:19:21 CET 2021


* 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 <dgouttegattat at incenp.org>
---
 configure.ac | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 59374491f..55de98ef4 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}"
-- 
2.27.0




More information about the Gnupg-devel mailing list