1- From 6a426b8093cf6633425d08a2d33ed24d200473a0 Mon Sep 17 00:00:00 2001
1+ From 5eec11089067947bd850e069651cfa9bf4c48d07 Mon Sep 17 00:00:00 2001
22From: Alyssa Ross <hi@alyssa.is>
33Date: Sun, 9 Feb 2025 08:51:32 +0100
44Subject: [PATCH] build: use pkg-config to find tss2-esys
@@ -8,15 +8,15 @@ won't be linked when tss2-esys is a static library.
88---
99Link: https://dev.gnupg.org/D606
1010
11- configure | 131 +++++++++++++++++++++++++++++ ----------------------
11+ configure | 132 ++++++++++++++++++++++++++++- ----------------------
1212 configure.ac | 5 +-
13- 2 files changed, 76 insertions(+), 60 deletions(-)
13+ 2 files changed, 75 insertions(+), 62 deletions(-)
1414
1515diff --git a/configure b/configure
16- index 59f027d..f53c99d 100755
16+ index f5d8bef90..e7f4fb175 100755
1717--- a/configure
1818+++ b/configure
19- @@ -669 ,12 +669 ,12 @@ TEST_LIBTSS_FALSE
19+ @@ -696 ,12 +696 ,12 @@ TEST_LIBTSS_FALSE
2020 TEST_LIBTSS_TRUE
2121 HAVE_LIBTSS_FALSE
2222 HAVE_LIBTSS_TRUE
@@ -31,7 +31,7 @@ index 59f027d..f53c99d 100755
3131 W32SOCKLIBS
3232 NETLIBS
3333 CROSS_COMPILING_FALSE
34- @@ -1005 ,7 +1005 ,9 @@ PKG_CONFIG_LIBDIR
34+ @@ -1030 ,7 +1030 ,9 @@ PKG_CONFIG_LIBDIR
3535 SQLITE3_CFLAGS
3636 SQLITE3_LIBS
3737 LIBGNUTLS_CFLAGS
@@ -42,7 +42,7 @@ index 59f027d..f53c99d 100755
4242
4343
4444 # Initialize some variables set by options.
45- @@ -1771 ,6 +1773 ,9 @@ Some influential environment variables:
45+ @@ -1805 ,6 +1807 ,9 @@ Some influential environment variables:
4646 C compiler flags for LIBGNUTLS, overriding pkg-config
4747 LIBGNUTLS_LIBS
4848 linker flags for LIBGNUTLS, overriding pkg-config
@@ -52,94 +52,99 @@ index 59f027d..f53c99d 100755
5252
5353 Use these variables to override the choices made by `configure' or to help
5454 it to find libraries and programs with nonstandard names/locations.
55- @@ -15465,64 +15470 ,77 @@ else
55+ @@ -16616,67 +16621 ,77 @@ else $as_nop
5656 fi
5757
5858 elif test "$with_tss" = intel; then
59- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing Esys_Initialize" >&5
60- - $as_echo_n "checking for library containing Esys_Initialize... " >&6; }
61- - if ${ac_cv_search_Esys_Initialize+:} false; then :
62- - $as_echo_n "(cached) " >&6
63- - else
59+ - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing Esys_Initialize" >&5
60+ - printf %s "checking for library containing Esys_Initialize... " >&6; }
61+ - if test ${ac_cv_search_Esys_Initialize+y}
62+ - then :
63+ - printf %s "(cached) " >&6
64+ - else $as_nop
6465- ac_func_search_save_LIBS=$LIBS
6566- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6667- /* end confdefs.h. */
6768
6869- /* Override any GCC internal prototype to avoid an error.
6970- Use char because int might match the return type of a GCC
7071- builtin and then its argument prototype would still apply. */
71- - #ifdef __cplusplus
72- - extern "C"
73- - #endif
7472- char Esys_Initialize ();
7573- int
76- - main ()
74+ - main (void )
7775- {
7876- return Esys_Initialize ();
7977- ;
8078- return 0;
8179- }
8280- _ACEOF
83- - for ac_lib in '' tss2-esys; do
81+ - for ac_lib in '' tss2-esys
82+ - do
8483- if test -z "$ac_lib"; then
8584- ac_res="none required"
8685- else
8786- ac_res=-l$ac_lib
8887- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
8988- fi
90- - if ac_fn_c_try_link "$LINENO"; then :
89+ - if ac_fn_c_try_link "$LINENO"
90+ - then :
9191- ac_cv_search_Esys_Initialize=$ac_res
9292- fi
93- - rm -f core conftest.err conftest.$ac_objext \
93+ - rm -f core conftest.err conftest.$ac_objext conftest.beam \
9494- conftest$ac_exeext
95- - if ${ac_cv_search_Esys_Initialize+:} false; then :
95+ - if test ${ac_cv_search_Esys_Initialize+y}
96+ - then :
9697- break
9798- fi
9899- done
99- - if ${ac_cv_search_Esys_Initialize+:} false; then :
100+ - if test ${ac_cv_search_Esys_Initialize+y}
101+ - then :
100102+ pkg_failed=no
101- + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBTSS" >&5
102- + $as_echo_n "checking for LIBTSS... " >&6; }
103+ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBTSS" >&5
104+ + printf %s "checking for LIBTSS... " >&6; }
103105
106+ - else $as_nop
107+ - ac_cv_search_Esys_Initialize=no
104108+ if test -n "$LIBTSS_CFLAGS"; then
105109+ pkg_cv_LIBTSS_CFLAGS="$LIBTSS_CFLAGS"
106110+ elif test -n "$PKG_CONFIG"; then
107111+ if test -n "$PKG_CONFIG" && \
108- + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"tss2-esys tss2-mu tss2-rc tss2-tctildr\""; } >&5
112+ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"tss2-esys tss2-mu tss2-rc tss2-tctildr\""; } >&5
109113+ ($PKG_CONFIG --exists --print-errors "tss2-esys tss2-mu tss2-rc tss2-tctildr") 2>&5
110114+ ac_status=$?
111- + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
115+ + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
112116+ test $ac_status = 0; }; then
113117+ pkg_cv_LIBTSS_CFLAGS=`$PKG_CONFIG --cflags "tss2-esys tss2-mu tss2-rc tss2-tctildr" 2>/dev/null`
114118+ test "x$?" != "x0" && pkg_failed=yes
115- else
116- - ac_cv_search_Esys_Initialize=no
119+ + else
117120+ pkg_failed=yes
118121 fi
119122- rm conftest.$ac_ext
120123- LIBS=$ac_func_search_save_LIBS
121124+ else
122125+ pkg_failed=untried
123126 fi
124- - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_Esys_Initialize" >&5
125- - $as_echo "$ac_cv_search_Esys_Initialize" >&6; }
127+ - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_Esys_Initialize" >&5
128+ - printf "%s\n" "$ac_cv_search_Esys_Initialize" >&6; }
126129- ac_res=$ac_cv_search_Esys_Initialize
127- - if test "$ac_res" != no; then :
130+ - if test "$ac_res" != no
131+ - then :
128132- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
129133- have_libtss=Intel
134+ - else $as_nop
135+ - as_fn_error $? "Intel TPM Software Stack requested but not found" "$LINENO" 5
130136+ if test -n "$LIBTSS_LIBS"; then
131137+ pkg_cv_LIBTSS_LIBS="$LIBTSS_LIBS"
132138+ elif test -n "$PKG_CONFIG"; then
133139+ if test -n "$PKG_CONFIG" && \
134- + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"tss2-esys tss2-mu tss2-rc tss2-tctildr\""; } >&5
140+ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"tss2-esys tss2-mu tss2-rc tss2-tctildr\""; } >&5
135141+ ($PKG_CONFIG --exists --print-errors "tss2-esys tss2-mu tss2-rc tss2-tctildr") 2>&5
136142+ ac_status=$?
137- + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
143+ + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
138144+ test $ac_status = 0; }; then
139145+ pkg_cv_LIBTSS_LIBS=`$PKG_CONFIG --libs "tss2-esys tss2-mu tss2-rc tss2-tctildr" 2>/dev/null`
140146+ test "x$?" != "x0" && pkg_failed=yes
141- else
142- - as_fn_error $? "Intel TPM Software Stack requested but not found" "$LINENO" 5
147+ + else
143148+ pkg_failed=yes
144149+ fi
145150+ else
@@ -149,8 +154,8 @@ index 59f027d..f53c99d 100755
149154+
150155+
151156+ if test $pkg_failed = yes; then
152- + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
153- + $as_echo "no" >&6; }
157+ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
158+ + printf "%s\n" "no" >&6; }
154159+
155160+ if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
156161+ _pkg_short_errors_supported=yes
@@ -167,29 +172,29 @@ index 59f027d..f53c99d 100755
167172+
168173+ as_fn_error $? "Intel TPM Software Stack requested but not found" "$LINENO" 5
169174+ elif test $pkg_failed = untried; then
170- + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
171- + $as_echo "no" >&6; }
175+ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
176+ + printf "%s\n" "no" >&6; }
172177+ as_fn_error $? "Intel TPM Software Stack requested but not found" "$LINENO" 5
173178+ else
174179+ LIBTSS_CFLAGS=$pkg_cv_LIBTSS_CFLAGS
175180+ LIBTSS_LIBS=$pkg_cv_LIBTSS_LIBS
176- + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
177- + $as_echo "yes" >&6; }
181+ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
182+ + printf "%s\n" "yes" >&6; }
178183+ have_libtss=Intel
179184+ fi
180185 else
181186 as_fn_error $? "Invalid TPM Software Stack requested: $with_tss" "$LINENO" 5
182187 fi
183- @@ -15616 ,7 +15634 ,6 @@ $as_echo " $as_me: WARNING: Need Esys_TR_GetTpmHandle API (usually requires Intel
188+ @@ -16768 ,7 +16783 ,6 @@ printf "%s\n" " $as_me: WARNING: Need Esys_TR_GetTpmHandle API (usually requires
184189
185190 fi
186191
187192- LIBTSS_LIBS="$LIBS -ltss2-mu -ltss2-rc -ltss2-tctildr"
188193
189- $as_echo "#define HAVE_INTEL_TSS 1" >>confdefs.h
194+ printf "%s\n" "#define HAVE_INTEL_TSS 1" >>confdefs.h
190195
191196diff --git a/configure.ac b/configure.ac
192- index dc44465..92880e6 100644
197+ index 94bc80583..e88d0f650 100644
193198--- a/configure.ac
194199+++ b/configure.ac
195200@@ -1574,8 +1574,8 @@ if test "$build_tpm2d" = "yes"; then
@@ -212,5 +217,5 @@ index dc44465..92880e6 100644
212217 fi
213218 LIBS="$_save_libs"
214219- -
215- 2.47.2
220+ 2.51.0
216221
0 commit comments