build: Add pkg-config for clients
Provide a pkg-config for clients using our headers.
Partially resolves openbmc/openbmc#1106
Change-Id: I185da26a0034b4bb315d2b279c776eea87c14a82
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/Makefile.am b/Makefile.am
index d0189de..a2b4ca5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -52,4 +52,7 @@
elog-lookup.cpp: $(REQ_FILES_TO_GEN)
$(AM_V_at)$(PYTHON) ${abs_srcdir}/tools/elog-gen.py -y ${abs_srcdir}/${ELOG_YAML_DIR} -t ${abs_srcdir}/${ELOG_TEMPLATE_DIR} -m $(LOOKUP_MAKO) -o ${abs_srcdir}/elog-lookup.cpp
+pkgconfiglibdir = ${libdir}/pkgconfig
+pkgconfiglib_DATA = phosphor-logging.pc
+
SUBDIRS = test
diff --git a/configure.ac b/configure.ac
index 01423ed..9f51ec6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,12 +21,13 @@
# Surpress the --with-libtool-sysroot error
LT_INIT
-# Check for libraries.
-PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
-PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,
- AC_MSG_ERROR(["Requires sdbusplus package."]))
-PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],,\
- AC_MSG_ERROR(["Requires phosphor-dbus-interfaces package."]))
+# Checks for libraries.
+AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found."])])
+
+# sdbusplus is non-private because we have no library to link.
+# If we ever have a library, move this to private.
+AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [], [], [AC_MSG_ERROR(["sdbusplus required and not found."])])
+AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])])
AC_CHECK_HEADER(systemd/sd-journal.h, ,[AC_MSG_ERROR([Could not find \
systemd/sd-journal.h...systemd developement package required])])
@@ -63,4 +64,5 @@
AC_DEFINE(OBJ_ENTRY, "/xyz/openbmc_project/Logging/Entry", [The log entry DBus object path.])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile test/Makefile])
+AC_CONFIG_FILES([phosphor-logging.pc])
AC_OUTPUT
diff --git a/phosphor-logging.pc.in b/phosphor-logging.pc.in
new file mode 100644
index 0000000..228246a
--- /dev/null
+++ b/phosphor-logging.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: phosphor-logging
+Description: Phosphor logging utilities
+URL: https://github.com/openbmc/phosphor-logging
+Version: @VERSION@
+Requires: @AX_PACKAGE_REQUIRES@
+Requires.private: @AX_PACKAGE_REQUIRES_PRIVATE@
+Libs:
+Cflags: -I@includedir@