From 9f71309abedb5a796b145b45e013b91af38edf67 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@mozilla.com>
Date: Sun, 28 Aug 2011 22:32:13 +1200
Subject: [PATCH] Add pkg-config support files.

These files allow compiling and linking against the reference
implementation with an invocation like `pkg-config --cflags
--libs opus`. They're optional within the opus build system,
but can simplify compilation for clients and are generally
considered part of a normal autotools build these days.

The -uninstalled version refers to local build products
within the tree, which is helpful for testing and unprivileged
builds. opus.pc is used once 'make install' has put the
libraries and headers somewhere more permanent.
---
 Makefile.am            |  5 +++++
 configure.ac           |  3 ++-
 opus-uninstalled.pc.in | 12 ++++++++++++
 opus.pc.in             | 15 +++++++++++++++
 4 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 opus-uninstalled.pc.in
 create mode 100644 opus.pc.in

diff --git a/Makefile.am b/Makefile.am
index c6a2f84be..67e8d256c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,3 +35,8 @@ test_opus_LDADD = libopus.la -lm
 test_repacketizer_SOURCES = src/test_repacketizer.c
 
 test_repacketizer_LDADD = libopus.la -lm
+
+EXTRA_DIST = opus.pc.in opus-uninstalled.pc.in
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = opus.pc
diff --git a/configure.ac b/configure.ac
index 609b4f132..4b42131f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,7 +207,8 @@ fi
 
 AM_CONDITIONAL([FIXED_POINT], [test x$ac_enable_fixed = xyes])
 
-AC_OUTPUT([Makefile libcelt/Makefile])
+AC_OUTPUT([Makefile libcelt/Makefile
+           opus.pc opus-uninstalled.pc])
 
 AC_MSG_RESULT([
 ------------------------------------------------------------------------
diff --git a/opus-uninstalled.pc.in b/opus-uninstalled.pc.in
new file mode 100644
index 000000000..b6a86789e
--- /dev/null
+++ b/opus-uninstalled.pc.in
@@ -0,0 +1,12 @@
+# opus codec reference implementation uninstalled pkg-config file
+
+libdir=${pcfiledir}/.libs
+includedir=${pcfiledir}
+
+Name: opus uninstalled
+Description: Opus IETF audio codec (not installed)
+Version: @VERSION@
+Requires:
+Conflicts:
+Libs: ${libdir}/libopus.a
+Cflags: -I${includedir}/src -I${includedir}/libcelt
diff --git a/opus.pc.in b/opus.pc.in
new file mode 100644
index 000000000..f702969a6
--- /dev/null
+++ b/opus.pc.in
@@ -0,0 +1,15 @@
+# opus codec reference implementation pkg-config file
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Opus
+Description: Opus IETF low-latency audio codec
+URL: http://opus-codec.org/
+Version: @VERSION@
+Requires:
+Conflicts:
+Libs: -L${libdir} -lopus
+Cflags: -I${includedir}/opus
-- 
GitLab