From fab3140c27518ba45ab206ce6a58a90cf2e51c51 Mon Sep 17 00:00:00 2001 From: "Lim, Lukaz Wei Hwang" Date: Mon, 27 Feb 2023 10:06:43 +0800 Subject: [PATCH] configure: detect --prefix when checking for P11_KIT If HAVE_P11KIT flag is set, install location will be changed (e.g. '/usr/lib/x86_64-linux-gnu/pkcs11' on Ubuntu with libp11-kit-dev package) even overwriting the path given by --prefix This patch ensures that if --prefix is given even with the flag HAVE_P11KIT is set, the install location will still use --prefix Signed-off-by: Lim, Lukaz Wei Hwang --- Makefile.am | 5 +++++ configure.ac | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Makefile.am b/Makefile.am index c9f9db6c..48b36e24 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,6 +57,10 @@ endif # HAVE_LD_VERSION_SCRIPT src_libtpm2_pkcs11_la_LIBADD = $(AM_LDFLAGS) src_libtpm2_pkcs11_la_SOURCES = $(LIB_PKCS11_SRC) $(LIB_PKCS11_INTERNAL_LIB_SRC) +if HAVE_PREFIX + # Use standard install location when using --prefix + lib_LTLIBRARIES = $(libtpm2_pkcs11) +else if HAVE_P11KIT # Use P11 kit library module install location p11libdir=$(P11_MODULE_PATH) @@ -69,6 +73,7 @@ else # Use standard install location when P11Kit is not found lib_LTLIBRARIES = $(libtpm2_pkcs11) endif +endif AM_DISTCHECK_CONFIGURE_FLAGS = --with-p11kitconfigdir='$$(datarootdir)/p11kitconfigdir' --with-p11kitmoduledir='$$(libdir)' diff --git a/configure.ac b/configure.ac index 0f1457e4..1ec6eb4c 100644 --- a/configure.ac +++ b/configure.ac @@ -485,6 +485,10 @@ AS_IF([test "x$have_p11kit" = "xyes"], [ AM_CONDITIONAL([HAVE_P11KIT], [test "x$have_p11kit" = "xyes"]) +# check for --prefix and set flag HAVE_PREFIX if found +# do not change install location if --prefix is given and with P11_KIT found +AM_CONDITIONAL([HAVE_PREFIX], [test ! -z "$(prefix)"]) + # END P11 CONFIG AC_C_BIGENDIAN()