From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Sat, 21 May 2022 18:42:21 +0000
Subject: [PATCH] build: Use p11_module_configs as default pkcs11-config dir

When building p11-kit with meson, `p11_system_config_modules` points at
the dir for system config in `/etc. This is its proper meaning.

When building p11-kit with autotools, `p11_system_config_modules` is a
copy of `p11_module_configs` "for compatibility", and points to the dir
for packaged configs in `/usr/share`.

We want the dir for packaged configs, so use the right variable.
---
 configure.ac                 | 10 +++++-----
 pkcs11/rpc-layer/Makefile.am |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1bf7c14c8ccc..98d8c01018fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -294,15 +294,15 @@ AC_ARG_WITH(pkcs11-config, [
                            [directory to install PKCS#11 config])
             ])
 if test -z "$with_pkcs11_config" ; then
-	P11_SYSTEM_CONFIG_MODULES=$($PKG_CONFIG p11-kit-1 --variable=p11_system_config_modules)
+	P11_MODULE_CONFIGS=$($PKG_CONFIG p11-kit-1 --variable=p11_module_configs)
 else
-	P11_SYSTEM_CONFIG_MODULES="$with_pkcs11_config"
+	P11_MODULE_CONFIGS="$with_pkcs11_config"
 fi
-if test "$P11_SYSTEM_CONFIG_MODULES" = ""; then
+if test "$P11_MODULE_CONFIGS" = ""; then
 	AC_MSG_ERROR([Could not find location for pkcs11 module config])
 fi
-AC_MSG_RESULT($P11_SYSTEM_CONFIG_MODULES)
-AC_SUBST(P11_SYSTEM_CONFIG_MODULES)
+AC_MSG_RESULT($P11_MODULE_CONFIGS)
+AC_SUBST(P11_MODULE_CONFIGS)
 
 AC_MSG_CHECKING([module path to install pkcs11 modules])
 AC_ARG_WITH(pkcs11-modules, [
diff --git a/pkcs11/rpc-layer/Makefile.am b/pkcs11/rpc-layer/Makefile.am
index ccdff9191ad4..d3a3b57bbc6e 100644
--- a/pkcs11/rpc-layer/Makefile.am
+++ b/pkcs11/rpc-layer/Makefile.am
@@ -46,7 +46,7 @@ gnome_keyring_pkcs11_la_LDFLAGS = \
 	-no-undefined -export-symbols-regex 'C_GetFunctionList'
 
 # This is the configuration file that p11-kit uses to load the module
-pkcs11configdir = $(P11_SYSTEM_CONFIG_MODULES)
+pkcs11configdir = $(P11_MODULE_CONFIGS)
 pkcs11config_DATA = \
 	pkcs11/rpc-layer/gnome-keyring.module
 
