From: Nicolas Boulenguez <nicolas@debian.org>
Date: Tue, 27 Sep 2022 20:15:44 +0200
Subject: Generate and install a pkg-config file for user convenience

This has been an upstream feature request for a while, and should be
forwarded to https://sourceforge.net/p/lame/feature-requests/42/.

Bug-Debian: https://bugs.debian.org/829326
---
 configure.in           |  1 +
 libmp3lame/Makefile.am |  6 ++++++
 libmp3lame/lame.pc.in  | 10 ++++++++++
 3 files changed, 17 insertions(+)
 create mode 100644 libmp3lame/lame.pc.in

diff --git a/configure.in b/configure.in
index 3f9fddb..073139a 100644
--- a/configure.in
+++ b/configure.in
@@ -1241,6 +1241,7 @@ AC_SUBST(CONFIG_DEFS)
 AC_CONFIG_FILES([Makefile \
 		 libmp3lame/Makefile \
 		 libmp3lame/i386/Makefile \
+		 libmp3lame/lame.pc \
 		 libmp3lame/vector/Makefile \
 		 frontend/Makefile \
 		 mpglib/Makefile \
diff --git a/libmp3lame/Makefile.am b/libmp3lame/Makefile.am
index 50cef75..126a675 100644
--- a/libmp3lame/Makefile.am
+++ b/libmp3lame/Makefile.am
@@ -30,6 +30,7 @@ INCLUDES = @INCLUDES@ -I$(top_srcdir)/mpglib -I$(top_builddir)
 DEFS = @DEFS@ @CONFIG_DEFS@
 
 EXTRA_DIST = \
+	lame.pc.in \
 	lame.rc \
 	vbrquantize.h \
 	logoe.ico
@@ -100,3 +101,8 @@ lclint: lclint.txt
 #$(OBJECTS): libtool
 #libtool: $(LIBTOOL_DEPS)
 #	$(SHELL) $(top_builddir)/config.status --recheck
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = lame.pc
+
+DISTCLEANFILES = $(pkgconfig_DATA)
diff --git a/libmp3lame/lame.pc.in b/libmp3lame/lame.pc.in
new file mode 100644
index 0000000..22ddd7a
--- /dev/null
+++ b/libmp3lame/lame.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE_NAME@
+Description: high quality MPEG Audio Layer III (MP3) encoder library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lmp3lame
+Cflags: -I${includedir}/lame
