From: Christian Storm <[email protected]>

Add pkg-config for libebgenv to ease run-time detection
of the library flags as well as version checks.

Signed-off-by: Christian Storm <[email protected]>
---
 Makefile.am     |  5 +++++
 configure.ac    | 16 ++++++++++------
 libebgenv.pc.in | 24 ++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 6 deletions(-)
 create mode 100644 libebgenv.pc.in

diff --git a/Makefile.am b/Makefile.am
index f8e094a..6d6a049 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -71,6 +71,11 @@ $(GEN_VERSION_H): $(top_srcdir)/Makefile.in FORCE
 
 CLEANFILES += $(GEN_VERSION_H)
 
+#
+# pkg-config
+#
+pkgconfig_DATA = libebgenv.pc
+
 #
 # Static libraries
 #
diff --git a/configure.ac b/configure.ac
index 1b36199..a1a83e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -178,19 +178,22 @@ AC_ARG_ENABLE([bootloader],
        [enable_bootloader="no"],
        [enable_bootloader="yes"])
 
+dnl pkg-config
+PKG_PROG_PKG_CONFIG()
+if test "x$PKG_CONFIG" = "xno"; then
+       AC_MSG_ERROR([You need to install pkg-config])
+fi
+
 AS_IF([test "x$enable_bootloader" != "xno"],
     [
        PKG_CHECK_MODULES(LIBPCI, libpci)
-
-       dnl pkg-config
-       PKG_PROG_PKG_CONFIG()
-       if test "x$PKG_CONFIG" = "xno"; then
-               AC_MSG_ERROR([You need to install pkg-config])
-       fi
        PKG_CHECK_MODULES(LIBCHECK, check)
     ])
 AM_CONDITIONAL([BOOTLOADER], [test "x$enable_bootloader" != "xno"])
 
+PKG_INSTALLDIR
+AC_SUBST(LIBEBGENV_VERSION, $(echo $VERSION | cut -dv -f2))
+
 dnl Python
 AC_PATH_PROGS(PYTHON, [python3 python3.9 python3.8 python3.7 python3.6 
python2.7 python2], no)
 if test "x$PYTHON" = "xno"; then
@@ -201,6 +204,7 @@ fi
 AC_CONFIG_FILES([
        Makefile
        tools/tests/Makefile
+       libebgenv.pc
 ])
 
 AC_OUTPUT
diff --git a/libebgenv.pc.in b/libebgenv.pc.in
new file mode 100644
index 0000000..17bee8e
--- /dev/null
+++ b/libebgenv.pc.in
@@ -0,0 +1,24 @@
+# EFI Boot Guard
+# Copyright (c) Siemens AG, 2019-2022
+#
+# Authors:
+#  Christian Storm <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2.  See
+# the COPYING file in the top-level directory.
+#
+# SPDX-License-Identifier:     GPL-2.0
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libebgenv
+URL: https://github.com/siemens/efibootguard
+Description: Library to access the EFI Boot Guard environment
+Version: @LIBEBGENV_VERSION@
+Requires.private: zlib
+Libs: -L${libdir} -lebgenv
+Cflags: -I${includedir}
+
-- 
2.35.1

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/20220225132617.184923-1-christian.storm%40siemens.com.

Reply via email to