mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2024-12-04 14:46:31 -05:00
#1398: Make optional components optional. (For real.)
git-svn-id: https://svn.xiph.org/trunk/ezstream@15782 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
parent
90d4a1a6a3
commit
df2b05bb61
@ -7,9 +7,8 @@ dist_doc_DATA = COPYING NEWS README
|
||||
|
||||
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 *~ .*~
|
||||
|
||||
|
4
NEWS
4
NEWS
@ -11,6 +11,10 @@ Changes in 0.5.4, released on XXXX-XX-XX:
|
||||
- [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)
|
||||
|
||||
|
||||
|
||||
|
39
README
39
README
@ -31,17 +31,23 @@ PREREQUISITES
|
||||
|
||||
|
||||
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 @@ configure script, a couple of additional options are available:
|
||||
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
|
||||
|
42
configure.in
42
configure.in
@ -129,26 +129,8 @@ dnl ###############
|
||||
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_CFLAGS], [${LIBXML2_CFLAGS}])
|
||||
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_CHECK_TAGLIB_C([], [
|
||||
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 @@ cat << __EOT
|
||||
${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
|
||||
|
103
m4/libvorbis.m4
103
m4/libvorbis.m4
@ -48,22 +48,95 @@ AC_ARG_VAR([VORBIS_CPPFLAGS],
|
||||
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 @@ dnl ####### BEGIN CHECK ######
|
||||
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 @@ CPPFLAGS="${ax_check_libvorbis_save_CPPFLAGS}"
|
||||
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 @@ dnl ####### BEGIN CHECK ######
|
||||
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 @@ CPPFLAGS="${ax_check_libvorbisfile_save_CPPFLAGS}"
|
||||
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 @@ dnl ####### BEGIN CHECK ######
|
||||
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 @@ CPPFLAGS="${ax_check_libvorbisenc_save_CPPFLAGS}"
|
||||
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])
|
||||
|
@ -34,6 +34,7 @@ dnl # [ACTION-IF-NOT-FOUND])
|
||||
|
||||
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 @@ have_taglib_libs=""
|
||||
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 @@ local_cv_have_lib_taglib_opts=yes
|
||||
|
||||
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 @@ fi
|
||||
|
||||
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])
|
||||
|
@ -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 @@ metadata_use_self(metadata_t *md, FILE **filep)
|
||||
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 @@ metadata_use_self(metadata_t *md, FILE **filep)
|
||||
ov_clear(&vf);
|
||||
*filep = NULL;
|
||||
}
|
||||
#endif /* HAVE_VORBISFILE */
|
||||
}
|
||||
|
||||
if (*filep != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user