From 701729278cbcb9f395546f529261520f6c349885 Mon Sep 17 00:00:00 2001
From: Sean McGovern <gseanmcg@gmail.com>
Date: Wed, 3 Feb 2016 21:07:21 -0500
Subject: [PATCH] contrib/mpg123: link with libm as appropriate (refs #16385)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
---
 contrib/src/mpg123/mpg123-libm.patch | 20 ++++++++++++++++++++
 contrib/src/mpg123/rules.mak         |  1 +
 2 files changed, 21 insertions(+)
 create mode 100644 contrib/src/mpg123/mpg123-libm.patch

diff --git a/contrib/src/mpg123/mpg123-libm.patch b/contrib/src/mpg123/mpg123-libm.patch
new file mode 100644
index 000000000000..a55d8510005a
--- /dev/null
+++ b/contrib/src/mpg123/mpg123-libm.patch
@@ -0,0 +1,20 @@
+--- trunk/configure.ac	2015/09/06 15:59:04	3820
++++ trunk/configure.ac	2015/09/07 07:59:55	3827
+@@ -93,6 +93,8 @@
+ AM_PROG_CC_C_O
+ AC_PROG_CPP
+ AC_PROG_INSTALL
++AC_CHECK_LIBM
++AC_SUBST(LIBM)
+ dnl "Checking for egrep is broken after removal of libltdl stuff... checks use $EGREP, so searching it here."
+ AC_PROG_EGREP
+ AC_C_CONST
+--- mpg123/libmpg123.pc.in.orig	2015-08-12 01:33:47.000000000 -0400
++++ mpg123/libmpg123.pc.in	2016-02-03 20:40:25.335615001 -0500
+@@ -7,5 +7,5 @@
+ Description: An optimised MPEG Audio decoder
+ Requires: 
+ Version: @PACKAGE_VERSION@
+-Libs: -L${libdir} -lmpg123 
++Libs: -L${libdir} -lmpg123 @LIBM@
+ Cflags: -I${includedir} 
diff --git a/contrib/src/mpg123/rules.mak b/contrib/src/mpg123/rules.mak
index 4ff3322e9265..807a4f6a9222 100644
--- a/contrib/src/mpg123/rules.mak
+++ b/contrib/src/mpg123/rules.mak
@@ -23,6 +23,7 @@ $(TARBALLS)/mpg123-$(MPG123_VERSION).tar.bz2:
 mpg123: mpg123-$(MPG123_VERSION).tar.bz2 .sum-mpg123
 	$(UNPACK)
 	$(APPLY) $(SRC)/mpg123/no-programs.patch
+	$(APPLY) $(SRC)/mpg123/mpg123-libm.patch
 ifdef HAVE_ANDROID
 	$(APPLY) $(SRC)/mpg123/mpg123_android_off_t.patch
 endif
-- 
GitLab