From: Andre Noll <maan@systemlinux.org>
Date: Tue, 3 Jun 2014 17:42:52 +0000 (+0200)
Subject: build: Convert libid3tag detection to new macros.
X-Git-Tag: v0.5.5~44^2~8
X-Git-Url: https://git.tue.mpg.de/?a=commitdiff_plain;h=2a6e6a1a5db3ef30000e5def9713ad457c014f49;p=paraslash.git

build: Convert libid3tag detection to new macros.
---

diff --git a/configure.ac b/configure.ac
index 593efefc..66b4787e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -334,40 +334,13 @@ AC_CHECK_LIB([mad], [mad_stream_init], [], HAVE_MAD=no)
 LIB_SUBST_FLAGS(mad)
 UNSTASH_FLAGS
 ###################################################################### libid3tag
-OLD_CPPFLAGS="$CPPFLAGS"
-OLD_LDFLAGS="$LDFLAGS"
-OLD_LIBS="$LIBS"
-
-have_libid3tag="yes"
-AC_ARG_WITH(id3tag_headers, [AS_HELP_STRING(--with-id3tag-headers=dir,
-	[look for id3tag header files also in dir])])
-if test -n "$with_id3tag_headers"; then
-	id3tag_cppflags="-I$with_id3tag_headers"
-	CPPFLAGS="$CPPFLAGS $id3tag_cppflags"
-fi
-AC_ARG_WITH(id3tag_libs, [AS_HELP_STRING(--with-id3tag-libs=dir,
-	[look for id3tag libs also in dir])])
-if test -n "$with_id3tag_libs"; then
-	id3tag_libs="-L$with_id3tag_libs"
-	LDFLAGS="$LDFLAGS $id3tag_libs"
-fi
-
-AC_MSG_CHECKING(for libid3tag)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-	#include <id3tag.h>
-]], [[
-	struct id3_tag t = {.flags = 0};
-]])],[],[have_libid3tag=no])
-AC_MSG_RESULT($have_libid3tag)
-
-if test ${have_libid3tag} = yes; then
-	AC_DEFINE(HAVE_LIBID3TAG, 1, define to 1 you have libid3tag)
-	AC_SUBST(id3tag_cppflags)
-	AC_SUBST(id3tag_ldflags, "$id3tag_libs -lid3tag -lz")
-fi
-CPPFLAGS="$OLD_CPPFLAGS"
-LDFLAGS="$OLD_LDFLAGS"
-LIBS="$OLD_LIBS"
+STASH_FLAGS
+LIB_ARG_WITH([id3tag], [-lid3tag -lz])
+HAVE_ID3TAG=yes
+AC_CHECK_HEADER(id3tag.h, [], HAVE_ID3TAG=no)
+AC_CHECK_LIB([id3tag], [id3_file_fdopen], [], HAVE_ID3TAG=no)
+LIB_SUBST_FLAGS(id3tag)
+UNSTASH_FLAGS
 ########################################################################### flac
 OLD_CPPFLAGS="$CPPFLAGS"
 OLD_LDFLAGS="$LDFLAGS"
@@ -1340,7 +1313,7 @@ crypto lib: ${CRYPTOLIB:-[none]}
 unix socket credentials: $have_ucred
 readline (interactive CLIs): $have_readline
 audio formats handlers: $audio_format_handlers
-id3 version2 support: $have_libid3tag
+id3 version 2 support: $HAVE_ID3TAG
 filters: $filters
 writers: $writers
 
diff --git a/mp3_afh.c b/mp3_afh.c
index 3b540c0b..ccd28dad 100644
--- a/mp3_afh.c
+++ b/mp3_afh.c
@@ -68,7 +68,7 @@ static const int mp3info_bitrate[2][3][14] = {
 static const int frame_size_index[] = {24000, 72000, 72000};
 static const char *mode_text[] = {"stereo", "joint stereo", "dual channel", "mono", "invalid"};
 
-#ifdef HAVE_LIBID3TAG
+#ifdef HAVE_ID3TAG
 
 #include <id3tag.h>
 
@@ -183,7 +183,7 @@ static int mp3_get_id3(unsigned char *map, size_t numbytes, __a_unused int fd,
 	return ret;
 }
 
-#else /* HAVE_LIBID3TAG */
+#else /* HAVE_ID3TAG */
 
 /*
  * Remove trailing whitespace from the end of a string
@@ -233,7 +233,7 @@ static int mp3_get_id3(unsigned char *map, size_t numbytes, __a_unused int fd,
 	tags->comment = para_strdup(comment);
 	return 1;
 }
-#endif /* HAVE_LIBID3TAG */
+#endif /* HAVE_ID3TAG */
 
 static int header_frequency(struct mp3header *h)
 {