From 02b82ebb6061921c30b0bcc26844c57baa1c4094 Mon Sep 17 00:00:00 2001
From: "Timothy B. Terriberry" <tterribe@xiph.org>
Date: Sun, 30 Sep 2012 23:57:04 -0700
Subject: [PATCH] Add pkg-config files.

---
 Makefile.am                | 12 +++++++++++-
 configure.ac               |  6 +++++-
 opusfile-uninstalled.pc.in | 14 ++++++++++++++
 opusfile.pc.in             | 14 ++++++++++++++
 4 files changed, 44 insertions(+), 2 deletions(-)
 create mode 100644 opusfile-uninstalled.pc.in
 create mode 100644 opusfile.pc.in

diff --git a/Makefile.am b/Makefile.am
index ef7f650..15e773b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,11 +23,21 @@ examples_seeking_example_LDADD = libopusfile.la
 debug:
 	$(MAKE) CFLAGS="${CFLAGS} -O0 -ggdb -DOP_ENABLE_ASSERTIONS" all
 
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = opusfile.pc
+
+EXTRA_DIST = \
+ opusfile.pc.in \
+ opusfile-uninstalled.pc.in
+
 #API Documentation
 
 if HAVE_DOXYGEN
 
-EXTRA_DIST = doc/Doxyfile.in doc/opus_logo.svg
+EXTRA_DIST += \
+ doc/Doxyfile.in \
+ doc/git-version.sh \
+ doc/opus_logo.svg
 
 all-local: doc/doxygen-build.stamp
 
diff --git a/configure.ac b/configure.ac
index 35ae872..c4f4770 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,8 +42,9 @@ AS_IF([test "x$enable_http" != "xno"],
   [openssl="openssl"
    AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
 ])
+AC_SUBST(openssl)
 
-PKG_CHECK_MODULES([DEPS], [ogg opus ]${openssl})
+PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1 ]${openssl})
 
 AC_ARG_ENABLE([fixed-point],
   AS_HELP_STRING([--enable-fixed-point], [Enable fixed-point calculation]),,
@@ -68,6 +69,7 @@ AS_IF([test "x$enable_fixed_point" = "xyes"],
    ])
   ]
 )
+AC_SUBST(ac_cv_search_lrintf)
 
 CC_ATTRIBUTE_VISIBILITY([default], [
   CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
@@ -93,6 +95,8 @@ AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
 
 AC_OUTPUT([
   Makefile
+  opusfile.pc
+  opusfile-uninstalled.pc
   doc/Doxyfile
 ])
 
diff --git a/opusfile-uninstalled.pc.in b/opusfile-uninstalled.pc.in
new file mode 100644
index 0000000..b63a23c
--- /dev/null
+++ b/opusfile-uninstalled.pc.in
@@ -0,0 +1,14 @@
+# opusfile uninstalled pkg-config file
+
+prefix=
+exec_prefix=
+libdir=${pcfiledir}/.libs
+includedir=${pcfiledir}/@top_srcdir@/include
+
+Name: opusfile uninstalled
+Description: Opus playback library (not installed)
+Version: @VERSION@
+Requires: ogg >= 1.3 opus >= 1.0.1 @openssl@
+Conflicts:
+Libs: ${libdir}/libopusfile.la @ac_cv_search_lrintf@
+Cflags: -I${includedir}
diff --git a/opusfile.pc.in b/opusfile.pc.in
new file mode 100644
index 0000000..b4cc0be
--- /dev/null
+++ b/opusfile.pc.in
@@ -0,0 +1,14 @@
+# opusfile installed pkg-config file
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: opusfile
+Description: Opus playback library
+Version: @VERSION@
+Requires: ogg >= 1.3 opus >= 1.0.1 @openssl@
+Conflicts:
+Libs: -L${libdir} -lopusfile
+Cflags: -I${includedir}
-- 
GitLab