summaryrefslogtreecommitdiff
path: root/media-sound/ncmpcpp/files/ncmpcpp-taglib-pc.patch
blob: 3a3c55e923d9d4fabbbce7c66be500ce9ebd0fb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 8796a4469795dfb067d02e19ddb3ae380d9b2fc3 Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Thu, 10 Nov 2022 23:58:33 +0000
Subject: [PATCH] Check for taglib with pkg-config before trying taglib-config

Programs like taglib-config are not good when cross-compiling.
---
 configure.ac | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index ef0c52b7..193840e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -257,19 +257,30 @@ PKG_CHECK_MODULES([libcurl], [libcurl], [
 
 # taglib
 if test "$taglib" != "no" ; then
-	AC_PATH_PROG(TAGLIB_CONFIG, taglib-config)
-	if test "$TAGLIB_CONFIG" != "" ; then
-		CPPFLAGS="$CPPFLAGS `$TAGLIB_CONFIG --cflags`"
-		LIBS="$LIBS `$TAGLIB_CONFIG --libs`"
+	PKG_CHECK_MODULES([taglib], [taglib], [
+		AC_SUBST(taglib_CFLAGS)
+		AC_SUBST(taglib_LIBS)
+	], [
+		AC_PATH_PROG([TAGLIB_CONFIG], [taglib-config])
+		if test "$TAGLIB_CONFIG" != ""; then
+			taglib_CFLAGS=`$TAGLIB_CONFIG --cflags`
+			taglib_LIBS=`$TAGLIB_CONFIG --libs`
+		else
+			if test "$taglib" = "yes" ; then
+				AC_MSG_ERROR([could not find taglib.pc or taglib-config executable])
+			fi
+		fi
+	])
+
+	if test "$TAGLIB_CONFIG$taglib_LIBS" != "" ; then
+		CPPFLAGS="$CPPFLAGS $taglib_CFLAGS"
+		LIBS="$LIBS $taglib_LIBS"
+
 		AC_CHECK_HEADERS([taglib.h], ,
 			if test "$taglib" = "yes" ; then
 				AC_MSG_ERROR([missing taglib.h header])
 			fi
 		)
-	else
-		if test "$taglib" = "yes" ; then
-			AC_MSG_ERROR([taglib-config executable is missing])
-		fi
 	fi
 fi
 
-- 
2.38.1