[xiph-commits] r15782 - in trunk/ezstream: . m4 src

moritz at svn.xiph.org moritz at svn.xiph.org
Mon Mar 16 15:59:30 PDT 2009


Author: moritz
Date: 2009-03-16 15:59:28 -0700 (Mon, 16 Mar 2009)
New Revision: 15782

Modified:
   trunk/ezstream/Makefile.am
   trunk/ezstream/NEWS
   trunk/ezstream/README
   trunk/ezstream/configure.in
   trunk/ezstream/m4/libvorbis.m4
   trunk/ezstream/m4/taglib.m4
   trunk/ezstream/src/metadata.c
Log:
#1398: Make optional components optional. (For real.)


Modified: trunk/ezstream/Makefile.am
===================================================================
--- trunk/ezstream/Makefile.am	2009-03-16 20:39:22 UTC (rev 15781)
+++ trunk/ezstream/Makefile.am	2009-03-16 22:59:28 UTC (rev 15782)
@@ -7,9 +7,8 @@
 
 EXTRA_DIST	 = \
 	autogen.sh \
-	m4/ccflags.m4 m4/libogg.m4 m4/libshout.m4 m4/libvorbis.m4 \
-	m4/libxml2.m4 m4/progname.m4 m4/taglib.m4 m4/tree.m4 m4/vacopy.m4 \
-	m4/vars.m4
+	m4/ccflags.m4 m4/libshout.m4 m4/libvorbis.m4 m4/libxml2.m4 \
+	m4/progname.m4 m4/taglib.m4 m4/tree.m4 m4/vacopy.m4 m4/vars.m4
 
 CLEANFILES	 = core *.core *~ .*~
 

Modified: trunk/ezstream/NEWS
===================================================================
--- trunk/ezstream/NEWS	2009-03-16 20:39:22 UTC (rev 15781)
+++ trunk/ezstream/NEWS	2009-03-16 22:59:28 UTC (rev 15782)
@@ -11,6 +11,10 @@
    - [MISC]  Overhaul and modernize the build system. Ezstream is now expected
              to build "out of the box" on more systems without configuration
              tweaks.
+   - [FIX]   Adjust the build system to better handle optional dependencies.
+             It is now possible to choose between TagLib and libvorbis for
+             reading Ogg Vorbis metadata, or no Vorbis metadata support at
+             all. (Ticket #1398)
 
 
 

Modified: trunk/ezstream/README
===================================================================
--- trunk/ezstream/README	2009-03-16 20:39:22 UTC (rev 15781)
+++ trunk/ezstream/README	2009-03-16 22:59:28 UTC (rev 15782)
@@ -31,17 +31,23 @@
 
 
 Ezstream depends on:
- * libshout 2.2.x (http://www.icecast.org/)
- * libshout dependencies, such as libogg, libvorbis, libtheora, etc.
-   (http://www.vorbis.com/ and http://www.theora.org/)
+ * libshout 2.2.x
+   (http://www.icecast.org/)
  * libxml 2.x (http://xmlsoft.org/)
 
 Ezstream optionally uses:
- * TagLib 1.x (1.4 or newer recommended, will be used via the libtag_c
-   wrapper)
-   (http://developer.kde.org/~wheeler/taglib.html)
- * Libiconv, if iconv() is not available in the system libc.
-   (http://www.gnu.org/software/libiconv/)
+ - For reading metadata from Ogg Vorbis files:
+   * TagLib 1.x (1.4 or newer recommended, will be used via the libtag_c
+     wrapper)
+     (http://developer.kde.org/~wheeler/taglib.html)
+   OR:
+   * libvorbis 1.x
+     (http://www.vorbis.com)
+   Using TagLib is recommended, as it allows ezstream to read metadata from
+   many additional media file types.
+ - For basic non-ASCII charset support in metadata and filenames:
+   * Libiconv, if iconv() is not available in the system libc.
+     (http://www.gnu.org/software/libiconv/)
 
 
 
@@ -57,19 +63,22 @@
                           example configuration files installation directory
                           (default: DATADIR/examples/ezstream)
   --enable-debug          enable memory debugging (default: no)
+  --with-libvorbis=PFX    prefix where the Vorbis library header files and
+                          library are installed (default: autodetect)
+  --with-libvorbis-includes=DIR
+                          directory where Vorbis library header files are
+                          installed (optional)
+  --with-libvorbis-libs=DIR
+                          directory where the Vorbis libraries are installed
+                          (optional)
   --with-taglib=PFX       prefix where the TagLib header files and library are
-                          installed (default: autodetect
+                          installed (default: autodetect)
   --with-taglib-includes=DIR
                           directory where TagLib header files are installed
                           (optional)
   --with-taglib-libs=DIR  directory where TagLib is installed (optional)
-  --with-gnu-ld           assume the C compiler uses GNU ld default=no
-  --with-libiconv-prefix[=DIR]
-                          search for libiconv in DIR/include and DIR/lib
-  --without-libiconv-prefix
-                          don't search for libiconv in includedir and libdir
 
-The compilation and installation process boils down to the usual
+The compilation and installation process then boils down to the usual
 
     $ ./configure --help | less         # Skim over the available options
     $ ./configure [options] && make && [sudo] make install

Modified: trunk/ezstream/configure.in
===================================================================
--- trunk/ezstream/configure.in	2009-03-16 20:39:22 UTC (rev 15781)
+++ trunk/ezstream/configure.in	2009-03-16 22:59:28 UTC (rev 15782)
@@ -129,26 +129,8 @@
 AC_CHECK_LIB([gen], [basename],
 	[ AX_UNIQVAR_PREPEND([EZ_LIBS], [-lgen]) ])
 
-AX_CHECK_LIBOGG([], [],
-	[AC_MSG_ERROR([libogg is required.], [1])])
-AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${LIBOGG_CPPFLAGS}])
-AX_UNIQVAR_APPEND([EZ_CFLAGS], [${LIBOGG_CFLAGS}])
-AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${LIBOGG_LDFLAGS}])
-AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBOGG_LIBS}])
-
-AX_CHECK_LIBVORBIS([], [],
-	[AC_MSG_ERROR([libvorbis is required.], [1])])
-AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${VORBIS_CPPFLAGS}])
-AX_UNIQVAR_APPEND([EZ_CFLAGS], [${VORBIS_CFLAGS}])
-AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${VORBIS_LDFLAGS}])
-AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBVORBIS_LIBS}])
-
-AX_CHECK_LIBVORBISFILE([], [],
-	[AC_MSG_ERROR([libvorbisfile is required.], [1])])
-AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBVORBISFILE_LIBS}])
-
 AX_CHECK_LIBSHOUT([], [],
-	[AC_MSG_ERROR([libshout is required.], [1])])
+	[AC_MSG_ERROR([libshout 2.2.x is required.], [1])])
 AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${LIBSHOUT_CPPFLAGS}])
 AX_UNIQVAR_APPEND([EZ_CFLAGS], [${LIBSHOUT_CFLAGS}])
 AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${LIBSHOUT_LDFLAGS}])
@@ -161,7 +143,7 @@
 AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${LIBXML2_LDFLAGS}])
 AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBXML2_LIBS}])
 
-use_taglib="No"
+use_metadata="No"
 AX_CHECK_TAGLIB_C([], [
 	AC_DEFINE([HAVE_TAGLIB], [1],
 		[Define to 1 if you have the libtag_c library.]
@@ -170,8 +152,18 @@
 	AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${TAGLIB_CPPFLAGS}])
 	AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${TAGLIB_LDFLAGS}])
 	AX_UNIQVAR_PREPEND([EZ_LIBS], [${TAGLIB_C_LIBS}])
-	use_taglib="Yes"
-], [])
+	use_metadata="TagLib"
+], [
+	AX_CHECK_LIBVORBISFILE([], [
+		AC_DEFINE([HAVE_VORBISFILE], [1],
+			[Define to 1 if you have the libvorbisfile library.])
+		AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${VORBIS_CPPFLAGS}])
+		AX_UNIQVAR_APPEND([EZ_CFLAGS], [${VORBIS_CFLAGS}])
+		AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${VORBIS_LDFLAGS}])
+		AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBVORBISFILE_LIBS}])
+		use_metadata="libvorbis"
+	], [])
+])
 
 # Not using AM_ICONV to check for iconv(), with or without libiconv(),
 # is not a viable option. Something in the past went horribly wrong;
@@ -293,8 +285,8 @@
 ${PACKAGE_STRING} has been configured successfully.
 
 Configuration:
-    TagLib support ............... : ${use_taglib}
-    Charset conversion support ... : ${use_iconv}
-    Prefix ....................... : ${prefix}
+    Ogg Vorbis metadata support ... : ${use_metadata}
+    Charset conversion support .... : ${use_iconv}
+    Prefix ........................ : ${prefix}
 
 __EOT

Modified: trunk/ezstream/m4/libvorbis.m4
===================================================================
--- trunk/ezstream/m4/libvorbis.m4	2009-03-16 20:39:22 UTC (rev 15781)
+++ trunk/ezstream/m4/libvorbis.m4	2009-03-16 22:59:28 UTC (rev 15782)
@@ -48,23 +48,96 @@
 AC_ARG_VAR([VORBIS_LDFLAGS],
 	[linker flags for the Vorbis libraries])
 if test x"${prefix}" = "xNONE"; then
-	ax_check_libvorbis_prefix="/usr/local"
+	have_libvorbis_prefix="/usr/local"
 else
-	ax_check_libvorbis_prefix="${prefix}"
+	have_libvorbis_prefix="${prefix}"
 fi
+have_libvorbis_includes=""
+have_libvorbis_libs=""
+want_libvorbis="auto"
+AC_ARG_WITH([libvorbis],
+	[AS_HELP_STRING([--with-libvorbis=PFX],
+		[prefix where the Vorbis library header files and library are installed (default: autodetect)])],
+	[
+case "${withval}" in
+	yes)
+		want_libvorbis="yes"
+		;;
+	no)
+		want_libvorbis="no"
+		;;
+	*)
+		have_libvorbis_prefix="${withval}"
+		want_libvorbis="yes"
+		;;
+esac
+	]
+)
+AC_ARG_WITH([libvorbis-includes],
+	[AS_HELP_STRING([--with-libvorbis-includes=DIR],
+		[directory where Vorbis library header files are installed (optional)]) ],
+	[
+case "${withval}" in
+	yes|no) ;;
+	*)
+		have_libvorbis_includes="${withval}"
+		;;
+esac
+	]
+)
+AC_ARG_WITH([libvorbis-libs],
+	[AS_HELP_STRING([--with-libvorbis-libs=DIR],
+		[directory where the Vorbis libraries are installed (optional)]) ],
+	[
+case "${withval}" in
+	yes|no) ;;
+	*)
+		have_libvorbis_libs="${withval}"
+		;;
+esac
+	]
+)
+AC_CACHE_VAL([local_cv_have_lib_libvorbis_opts],
+[
 if test -z "${VORBIS_CFLAGS}"; then
 	VORBIS_CFLAGS="`${PKG_CONFIG} --cflags-only-other vorbis`"
 fi
-if test -z "${VORBIS_CPPFLAGS}"; then
-	VORBIS_CPPFLAGS="`${PKG_CONFIG} --cflags-only-I vorbis`"
+if test -n "${VORBIS_CPPFLAGS}"; then
+	if test x"${have_libvorbis_includes}" != "x"; then
+		VORBIS_CPPFLAGS="${VORBIS_CPPFLAGS} -I${have_libvorbis_includes}"
+	fi
+else
+	if test x"${have_libvorbis_includes}" != "x"; then
+		VORBIS_CPPFLAGS="-I${have_libvorbis_includes}"
+	else
+		if test x"${want_libvorbis}" = "xauto"; then
+			VORBIS_CPPFLAGS="`${PKG_CONFIG} --cflags-only-I vorbis`"
+		else
+			VORBIS_CPPFLAGS="-I${have_libvorbis_prefix}/include"
+		fi
+	fi
 fi
-if test -z "${VORBIS_LDFLAGS}"; then
-	VORBIS_LDFLAGS="\
-		`${PKG_CONFIG} --libs-only-L vorbis` \
-		`${PKG_CONFIG} --libs-only-other vorbis` \
-	"
+if test -n "${VORBIS_LDFLAGS}"; then
+	if test x"${have_libvorbis_libs}" != "x"; then
+		VORBIS_LDFLAGS="-L${have_libvorbis_libs} ${VORBIS_LDFLAGS}"
+	fi
+else
+	if test -n "${have_libvorbis_libs}"; then
+		VORBIS_LDFLAGS="-L${have_libvorbis_libs}"
+	else
+		if test x"${want_libvorbis}" = "xauto"; then
+			VORBIS_LDFLAGS=" \
+				`${PKG_CONFIG} --libs-only-L vorbis` \
+				`${PKG_CONFIG} --libs-only-other vorbis` \
+			"
+		else
+			VORBIS_LDFLAGS="-L${have_libvorbis_prefix}/lib"
+		fi
+	fi
 fi
+local_cv_have_lib_libvorbis_opts=yes
 ])
+])
 
 AC_DEFUN([AX_CHECK_LIBVORBIS],
 [
@@ -84,12 +157,12 @@
 PKG_CHECK_EXISTS([vorbis $1], [
 dnl ##########################
 
+if test x"${want_libvorbis}" != "xno"; then	# want_libvorbis != no
 libvorbis_libs_autodetect=no
 if test -z "${LIBVORBIS_LIBS}"; then
 	LIBVORBIS_LIBS="`${PKG_CONFIG} --libs-only-l vorbis`"
 	libvorbis_libs_autodetect=yes
 fi
-
 ax_check_libvorbis_save_CFLAGS="${CFLAGS}"
 ax_check_libvorbis_save_CPPFLAGS="${CPPFLAGS}"
 ax_check_libvorbis_save_LDFLAGS="${LDFLAGS}"
@@ -137,13 +210,13 @@
 LDFLAGS="${ax_check_libvorbis_save_LDFLAGS}"
 LIBS="${ax_check_libvorbis_save_LIBS}"
 AC_LANG_POP([C])
+fi						# want_libvorbis != no
 
 dnl ####### END CHECK ########
 ], [])
 dnl ##########################
 
 ])
-
 AC_MSG_CHECKING([for libvorbis $1])
 if test x"${local_cv_have_lib_libvorbis}" = "xyes"; then
 	AC_MSG_RESULT([yes])
@@ -175,12 +248,12 @@
 PKG_CHECK_EXISTS([vorbisfile $1], [
 dnl ##########################
 
+if test x"${want_libvorbis}" != "xno"; then	# want_libvorbis != no
 libvorbisfile_libs_autodetect=no
 if test -z "${LIBVORBISFILE_LIBS}"; then
 	LIBVORBISFILE_LIBS="`${PKG_CONFIG} --libs-only-l vorbisfile`"
 	libvorbisfile_libs_autodetect=yes
 fi
-
 ax_check_libvorbisfile_save_CFLAGS="${CFLAGS}"
 ax_check_libvorbisfile_save_CPPFLAGS="${CPPFLAGS}"
 ax_check_libvorbisfile_save_LDFLAGS="${LDFLAGS}"
@@ -217,13 +290,13 @@
 LDFLAGS="${ax_check_libvorbisfile_save_LDFLAGS}"
 LIBS="${ax_check_libvorbisfile_save_LIBS}"
 AC_LANG_POP([C])
+fi						# want_libvorbis != no
 
 dnl ####### END CHECK ########
 ], [])
 dnl ##########################
 
 ])
-
 AC_MSG_CHECKING([for libvorbisfile $1])
 if test x"${local_cv_have_lib_libvorbisfile}" = "xyes"; then
 	AC_MSG_RESULT([yes])
@@ -255,12 +328,12 @@
 PKG_CHECK_EXISTS([vorbisenc $1], [
 dnl ##########################
 
+if test x"${want_libvorbis}" != "xno"; then	# want_libvorbis != no
 libvorbisenc_libs_autodetect=no
 if test -z "${LIBVORBISENC_LIBS}"; then
 	LIBVORBISENC_LIBS="`${PKG_CONFIG} --libs-only-l vorbisenc`"
 	libvorbisenc_libs_autodetect=yes
 fi
-
 ax_check_libvorbisenc_save_CFLAGS="${CFLAGS}"
 ax_check_libvorbisenc_save_CPPFLAGS="${CPPFLAGS}"
 ax_check_libvorbisenc_save_LDFLAGS="${LDFLAGS}"
@@ -299,13 +372,13 @@
 LDFLAGS="${ax_check_libvorbisenc_save_LDFLAGS}"
 LIBS="${ax_check_libvorbisenc_save_LIBS}"
 AC_LANG_POP([C])
+fi						# want_libvorbis != no
 
 dnl ####### END CHECK ########
 ], [])
 dnl ##########################
 
 ])
-
 AC_MSG_CHECKING([for libvorbisenc $1])
 if test x"${local_cv_have_lib_libvorbisenc}" = "xyes"; then
 	AC_MSG_RESULT([yes])

Modified: trunk/ezstream/m4/taglib.m4
===================================================================
--- trunk/ezstream/m4/taglib.m4	2009-03-16 20:39:22 UTC (rev 15781)
+++ trunk/ezstream/m4/taglib.m4	2009-03-16 22:59:28 UTC (rev 15782)
@@ -34,6 +34,7 @@
 
 AC_DEFUN([_AX_CHECK_TAGLIB_OPTS],
 [
+AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 AC_ARG_VAR([TAGLIB_CFLAGS],
 	[C compiler flags for TagLib])
 AC_ARG_VAR([TAGLIB_CPPFLAGS],
@@ -50,7 +51,7 @@
 want_taglib="auto"
 AC_ARG_WITH([taglib],
 	[AS_HELP_STRING([--with-taglib=PFX],
-		[prefix where the TagLib header files and library are installed (default: autodetect]) ],
+		[prefix where the TagLib header files and library are installed (default: autodetect)])],
 	[
 case "${withval}" in
 	yes)
@@ -134,7 +135,6 @@
 
 AC_DEFUN([AX_CHECK_TAGLIB],
 [
-AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 AC_REQUIRE([_AX_CHECK_TAGLIB_OPTS])
 AC_ARG_VAR([TAGLIB_LIBS],
 	[libraries to use for TagLib])
@@ -232,7 +232,6 @@
 
 AC_DEFUN([AX_CHECK_TAGLIB_C],
 [
-AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 AC_REQUIRE([_AX_CHECK_TAGLIB_OPTS])
 AC_ARG_VAR([TAGLIB_C_LIBS],
 	[libraries to use for the TagLib C wrapper])

Modified: trunk/ezstream/src/metadata.c
===================================================================
--- trunk/ezstream/src/metadata.c	2009-03-16 20:39:22 UTC (rev 15781)
+++ trunk/ezstream/src/metadata.c	2009-03-16 22:59:28 UTC (rev 15782)
@@ -35,8 +35,10 @@
 
 #ifdef HAVE_TAGLIB
 # include <taglib/tag_c.h>
-#endif
-#include <vorbis/vorbisfile.h>
+#endif /* HAVE_TAGLIB */
+#ifdef HAVE_VORBISFILE
+# include <vorbis/vorbisfile.h>
+#endif /* HAVE_VORBISFILE */
 #include <shout/shout.h>
 
 #include "compat.h"
@@ -188,18 +190,19 @@
 	if (strcmp(extension, ".mp3") == 0) {
 		memset(&id3tag, 0, sizeof(id3tag));
 		fseek(*filep, -128L, SEEK_END);
-		fread(&id3tag, 1, sizeof(struct ID3Tag), *filep);
-		if (memcmp(id3tag.tag, "TAG", 3) == 0) {
+		fread(&id3tag, 1UL, sizeof(struct ID3Tag), *filep);
+		if (memcmp(id3tag.tag, "TAG", 3UL) == 0) {
 			if (strlen(id3tag.artistName) > 0)
 				md->artist = CHARtoUTF8(id3tag.artistName, ICONV_REPLACE);
 			if (strlen(id3tag.trackName) > 0)
 				md->title = CHARtoUTF8(id3tag.trackName, ICONV_REPLACE);
 		}
+#ifdef HAVE_VORBISFILE
 	} else if (strcmp(extension, ".ogg") == 0) {
 		OggVorbis_File	vf;
 		int		ret;
 
-		if ((ret = ov_open(*filep, &vf, NULL, 0)) != 0) {
+		if ((ret = ov_open(*filep, &vf, NULL, 0L)) != 0) {
 			switch (ret) {
 			case OV_EREAD:
 				printf("%s: ov_open(): %s: Media read error\n",
@@ -245,6 +248,7 @@
 			ov_clear(&vf);
 			*filep = NULL;
 		}
+#endif /* HAVE_VORBISFILE */
 	}
 
 	if (*filep != NULL)



More information about the commits mailing list