diff --git a/Makefile.am b/Makefile.am index ac1d6cc..b032423 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,13 +1,19 @@ AUTOMAKE_OPTIONS = 1.9 foreign -ACLOCAL_AMFLAGS = -I m4 +ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = build-aux compat doc examples m4 src win32 +SUBDIRS = build-aux compat doc examples m4 src win32 -dist_doc_DATA = COPYING NEWS README +dist_doc_DATA = COPYING NEWS README -CLEANFILES = core *.core *~ .*~ +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 -.PHONY: regen-win32 snapshot +CLEANFILES = core *.core *~ .*~ + +.PHONY: regen-win32 snapshot regen-win32: cd win32; ${MAKE} regen-win32 diff --git a/NEWS b/NEWS index 46aace4..830201a 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,9 @@ Changes in 0.5.4, released on XXXX-XX-XX: - [FIX] Add a missing metadata charset conversion, and add charset conversions for filenames. From Roman Donchenko. - [FIX] Fix build on MinGW. From Roman Donchenko. + - [MISC] Overhaul and modernize the build system. Ezstream is now expected + to build "out of the box" on more systems without configuration + tweaks. diff --git a/README b/README index 8977325..134ecbb 100644 --- a/README +++ b/README @@ -57,15 +57,17 @@ 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-taglib=PFX prefix where the TagLib header files and library are + 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 - --with-taglib=PREFIX Prefix where TagLib is installed (default: - autodetect) - --with-ogg=PREFIX Prefix where libogg is installed (optional) - --with-vorbis=PREFIX Prefix where libvorbis is installed (optional) - --with-xml-config=PATH use xml-config in PATH to find libxml The compilation and installation process boils down to the usual @@ -77,6 +79,12 @@ The compilation and installation process boils down to the usual If this procedure is unfamiliar to you, please consult the INSTALL file for more detailed instructions. +When the configuration keeps failing despite having all dependencies +installed, take note of the more verbose error messages in config.log. If +necessary, it is possible to directly customize many build flags through +environment variables. See the "influential environment variables" list +in the --help output. + USAGE diff --git a/autogen.sh b/autogen.sh index 203bc5a..ddfa2e1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -7,7 +7,12 @@ if [ ! -f "./`basename $0`" ]; then exit 1 fi -AUTOCONF_VERSION=2.61 AUTOMAKE_VERSION=1.9 aclocal -I m4 +EXTRA= +if [ -d /usr/local/share/aclocal ]; then + EXTRA="-I /usr/local/share/aclocal" +fi + +AUTOCONF_VERSION=2.61 AUTOMAKE_VERSION=1.9 aclocal -I m4 ${EXTRA} AUTOCONF_VERSION=2.61 AUTOMAKE_VERSION=1.9 autoconf AUTOCONF_VERSION=2.61 AUTOMAKE_VERSION=1.9 autoheader # AUTOCONF_VERSION=2.61 AUTOMAKE_VERSION=1.9 libtoolize --automake -c -f diff --git a/build-aux/Makefile.am b/build-aux/Makefile.am index c00851f..fde9db9 100644 --- a/build-aux/Makefile.am +++ b/build-aux/Makefile.am @@ -1,5 +1,5 @@ AUTOMAKE_OPTIONS = 1.9 foreign -EXTRA_DIST = config.rpath +EXTRA_DIST = config.rpath -CLEANFILES = core *.core *~ .*~ +CLEANFILES = core *.core *~ .*~ diff --git a/compat/Makefile.am b/compat/Makefile.am index 1767a91..7dcd892 100644 --- a/compat/Makefile.am +++ b/compat/Makefile.am @@ -1,5 +1,5 @@ AUTOMAKE_OPTIONS = 1.9 foreign -SUBDIRS = sys +SUBDIRS = sys -CLEANFILES = *~ *.core core +CLEANFILES = *~ *.core core diff --git a/compat/sys/Makefile.am b/compat/sys/Makefile.am index 800745a..a867909 100644 --- a/compat/sys/Makefile.am +++ b/compat/sys/Makefile.am @@ -1,5 +1,5 @@ AUTOMAKE_OPTIONS = 1.9 foreign -EXTRA_DIST = tree.h tree.3 +EXTRA_DIST = tree.h tree.3 -CLEANFILES = *~ *.core core +CLEANFILES = *~ *.core core diff --git a/configure.in b/configure.in index 209b0b2..c94251d 100644 --- a/configure.in +++ b/configure.in @@ -1,112 +1,119 @@ -dnl INITIALIZATION +dnl ########### +dnl ## SETUP ########################################################### +dnl ########### -AC_INIT([ezstream], [0.5.4], [https://trac.xiph.org/newticket?component=ezstream]) -AC_PREREQ(2.61) -AC_CONFIG_SRCDIR(src/ezstream.c) -AC_CONFIG_AUX_DIR(build-aux) +AC_INIT([ezstream], [0.5.4], + [https://trac.xiph.org/newticket?component=ezstream]) +AC_PREREQ([2.61]) +AC_CONFIG_SRCDIR([src/ezstream.c]) +AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE -AC_CONFIG_HEADERS(src/config.h) -AC_CONFIG_LIBOBJ_DIR(src) +AC_CONFIG_HEADERS([src/config.h]) +AC_CONFIG_LIBOBJ_DIR([src]) AM_MAINTAINER_MODE AC_USE_SYSTEM_EXTENSIONS AC_PROG_CC_STDC - - -dnl SETUP - -EXAMPLES_DIR="\$(datadir)/examples/${PACKAGE_TARNAME}" -AC_ARG_ENABLE(examplesdir, - AS_HELP_STRING([--enable-examplesdir=DIR], - [example configuration files installation directory (default: DATADIR/examples/ezstream)]), -[case "$enableval" in - yes) ;; - no) AC_MSG_ERROR([Must have an example configuration files install dir.]) ;; - *) EXAMPLES_DIR="$enableval" ;; -esac], []) -AC_SUBST(EXAMPLES_DIR) - +AC_PROG_FGREP AC_CANONICAL_HOST -if test -z "$GCC"; then - case $host in - *-irix*) - XIPH_CPPFLAGS="-fullwarn" - ;; - *-solaris*) - XIPH_CPPFLAGS="-v" - ;; - *) - ;; - esac -else - XIPH_CPPFLAGS="-fstrict-aliasing -Wall -Wwrite-strings -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" -fi +EXAMPLES_DIR="\$(datadir)/examples/${PACKAGE_TARNAME}" +AC_ARG_ENABLE([examplesdir], + [AS_HELP_STRING([--enable-examplesdir=DIR], + [examples installation directory (default: DATADIR/examples/ezstream)])], +[case "$enableval" in + yes) ;; + no) AC_MSG_ERROR([Must have an install directory for the examples.]) ;; + *) EXAMPLES_DIR="$enableval" ;; +esac], []) +AC_SUBST([EXAMPLES_DIR]) ez_enable_debug=no -AC_ARG_ENABLE(debug, - AS_HELP_STRING([--enable-debug], - [enable memory debugging (default: no)]), +AC_ARG_ENABLE([debug], + [AS_HELP_STRING([--enable-debug], + [enable memory debugging (default: no)])], [case "$enableval" in no) ;; *) ez_enable_debug=yes ;; esac], []) AC_MSG_CHECKING([whether to enable debugging]) -if test x"$ez_enable_debug" = "xyes"; then - AC_DEFINE(XALLOC_DEBUG, 1, [Define whether to build with XALLOC debugging]) +if test x"${ez_enable_debug}" = "xyes"; then + AC_DEFINE([XALLOC_DEBUG], [1], + [Define whether to build with XALLOC debugging]) fi AC_MSG_RESULT([$ez_enable_debug]) +EZ_CFLAGS="" +EZ_CPPFLAGS="" +EZ_LDFLAGS="" +EZ_LIBS="" -dnl USEFUL HEADERS -AC_CHECK_HEADERS(sys/time.h paths.h signal.h langinfo.h libgen.h locale.h) +dnl ############## +dnl ## COMPILER ######################################################## +dnl ############## -COMPAT_INCLUDES="" -if test x"$ez_enable_debug" = "xyes"; then - AC_CHECK_HEADERS(sys/tree.h) - if test x"$ac_cv_header_sys_tree_h" = "xyes"; then - AC_MSG_CHECKING([for RB_FOREACH and RB_INSERT in sys/tree.h]) - AC_EGREP_CPP([yes], [ -#include -#if defined(RB_FOREACH) && defined(RB_INSERT) - yes -#endif - ], [ - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_WORKING_SYS_TREE_H, 1, - [Define whether RB_FOREACH is defined in ]) - ], [ - AC_MSG_RESULT([no]) - COMPAT_INCLUDES="-I\$(top_srcdir)/compat" +if test -n "${GCC}"; then + for _flag in fstack-protector fstrict-aliasing Wall W Wstrict-aliasing \ + Wwrite-strings Wpointer-arith Wshadow Wconversion Wcast-qual \ + Wcast-align Wbounded Wmissing-declarations Wmissing-prototypes \ + Wstrict-prototypes + do + AX_CHECK_CFLAG([${_flag}], + [ AX_UNIQVAR_APPEND([EZ_CFLAGS], [-${_flag}]) ], []) + done + AX_CHECK_CFLAG([Wformat=2], + [ AX_UNIQVAR_APPEND([EZ_CFLAGS], [-Wformat=2]) ], + [ + AX_CHECK_CFLAG([Wformat], + [ AX_UNIQVAR_APPEND([EZ_CFLAGS], [-Wformat]) ], []) ]) - else - COMPAT_INCLUDES="-I\$(top_srcdir)/compat" - fi -fi -AC_SUBST(COMPAT_INCLUDES) - - -dnl MISC SYSTEM CHARACTERISTICS - -dnl __progname check adapted from OpenNTPd-portable configure.ac -AC_MSG_CHECKING([whether libc defines __progname]) -AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[#include ]], - [[extern char *__progname; printf("%s\n", __progname); ]])], - [ac_cv_libc_defines___progname="yes"], - [ac_cv_libc_defines___progname="no"] -) -if test x"$ac_cv_libc_defines___progname" = "xyes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE___PROGNAME, 1, [Define whether libc defines __progname]) else - AC_MSG_RESULT([no]) + case "${host}" in + *-irix*) + EZ_CFLAGS="-fullwarn" + ;; + *-solaris*) + EZ_CFLAGS="-v" + ;; + *) + ;; + esac fi AC_C_CONST AC_C_VOLATILE + + +dnl ############# +dnl ## HEADERS ######################################################### +dnl ############# + +AC_CHECK_HEADERS([ \ + sys/time.h signal.h langinfo.h libgen.h locale.h paths.h \ +], [], [], +[ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +]) + +COMPAT_INCLUDES="" +if test x"${ez_enable_debug}" = "xyes"; then + AX_HEADER_TREE([RB_FOREACHx], [], + [ + COMPAT_INCLUDES="-I\$(top_srcdir)/compat" + ]) +fi +AC_SUBST([COMPAT_INCLUDES]) + + +dnl ########### +dnl ## TYPES ########################################################### +dnl ########### + AC_TYPE_SIZE_T AC_TYPE_SSIZE_T + AC_CHECK_TYPES(struct timeval, , , [ #ifdef HAVE_SYS_TIME_H @@ -115,181 +122,178 @@ AC_CHECK_TYPES(struct timeval, , , ]) -dnl LIBRARY FUNCTIONS +dnl ############### +dnl ## LIBRARIES ####################################################### +dnl ############### -AC_CHECK_LIB(gen, basename) -AC_CHECK_FUNCS(arc4random gettimeofday nl_langinfo random setlocale srandomdev stat) -AC_REPLACE_FUNCS(getopt strlcat strlcpy strtonum) -if test x"$ac_cv_header_signal_h" = "xyes"; then - AC_CHECK_FUNCS([sigaction], [ - AC_DEFINE(HAVE_SIGNALS, 1, [Define whether we have BSD signals]) - ], [], [#include ]) -fi +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])]) +AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${LIBSHOUT_CPPFLAGS}]) +AX_UNIQVAR_APPEND([EZ_CFLAGS], [${LIBSHOUT_CFLAGS}]) +AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${LIBSHOUT_LDFLAGS}]) +AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBSHOUT_LIBS}]) + +AX_CHECK_LIBXML2([], [], + [AC_MSG_ERROR([libxml 2.x is required.], [1])]) +AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${LIBXML2_CPPFLAGS}]) +AX_UNIQVAR_APPEND([EZ_CFLAGS], [${LIBXML2_CFLAGS}]) +AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${LIBXML2_LDFLAGS}]) +AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBXML2_LIBS}]) + +use_taglib="No" +AX_CHECK_TAGLIB_C([ + AC_DEFINE([HAVE_TAGLIB], [1], + [Define to 1 if you have the libtag_c library.] + ) + AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${TAGLIB_CFLAGS}]) + AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${TAGLIB_LDFLAGS}]) + AX_UNIQVAR_PREPEND([EZ_LIBS], [${TAGLIB_C_LIBS}]) + use_taglib="Yes" +], []) + +# Not using AM_ICONV to check for iconv(), with or without libiconv(), +# is not a viable option. Something in the past went horribly wrong; +# the whole topic is extremely complex and not worth rewriting. +# Instead, work around the buggy no-op that is --with-libiconv-prefix, +# and at least try to find it in --prefix. Thankfully, it is and will +# remain optional in ezstream. + +INCICONV="" +LDICONV="" LIBICONV="" LTLIBICONV="" -INCICONV="" -AM_ICONV EZ_LIBICONV="" -if test -n "$LTLIBICONV"; then - EZ_LIBICONV="$LTLIBICONV" -else - EZ_LIBICONV="$LIBICONV" -fi -XIPH_VAR_PREPEND([XIPH_LIBS], [$EZ_LIBICONV]) -XIPH_VAR_APPEND([XIPH_CPPFLAGS], [$INCICONV]) - - -dnl CONFIGURE OPTIONS - -dnl Optional: TagLib support -AC_ARG_VAR([TAGLIB_PREFIX], [path to TagLib installation]) -if test -n "${TAGLIB_PREFIX}"; then - taglib_prefix="${TAGLIB_PREFIX}" -else - taglib_prefix="" -fi -use_taglib=yes -require_taglib=no -AC_ARG_WITH(taglib, - [AS_HELP_STRING([--with-taglib=PREFIX], - [Prefix where TagLib is installed (default: autodetect)])], -[case "$withval" in - yes) require_taglib=yes - if test -z "$taglib_prefix"; then - taglib_prefix=/usr/local - fi - ;; - no) use_taglib=no ;; - *) require_taglib=yes - taglib_prefix="$withval" - ;; -esac], []) - -have_taglib=no -AC_MSG_CHECKING([for TagLib option]) -if test x"$use_taglib" != "xno"; then - if test x"$require_taglib" = "xyes"; then - AC_MSG_RESULT([enabled]) +AM_ICONV +if test x"${am_cv_func_iconv}" != "xyes"; then + unset am_cv_func_iconv + unset am_cv_lib_iconv + if test x"${prefix}" = "xNONE"; then + libiconv_prefix="/usr/local" else - AC_MSG_RESULT([autodetect]) + libiconv_prefix="${prefix}" fi - - TAGLIB_CFLAGS="" - TAGLIB_CPPFLAGS="" - TAGLIB_LIBS="-ltag_c" - if test -n "$taglib_prefix"; then - TAGLIB_CPPFLAGS="-I${taglib_prefix}/include" - TAGLIB_LIBS="-L${taglib_prefix}/lib ${TAGLIB_LIBS}" + AC_MSG_NOTICE([Looking for libiconv in ${libiconv_prefix} ...]) + libiconv_save_CPPFLAGS="${CPPFLAGS}" + libiconv_save_LDFLAGS="${LDFLAGS}" + libiconv_save_LIBS="${LIBS}" + CPPFLAGS="${CPPFLAGS} -I${libiconv_prefix}/include" + LDFLAGS="${LDFLAGS} -L${libiconv_prefix}/lib" + LIBS="-liconv" + AM_ICONV + if test x"${am_cv_func_iconv}" = "xyes"; then + INCICONV="-I${libiconv_prefix}/include" + LDICONV="-L${libiconv_prefix}/lib" + LIBICONV="-liconv" fi - - ac_taglib_save_CFLAGS="$CFLAGS" - ac_taglib_save_CPPFLAGS="$CPPFLAGS" - ac_taglib_save_LIBS="$LIBS" - - CFLAGS="${TAGLIB_CFLAGS}" - CPPFLAGS="${TAGLIB_CPPFLAGS}" - LIBS="${TAGLIB_LIBS}" - - AC_CHECK_HEADERS([taglib/tag_c.h], [ - AC_MSG_CHECKING([whether libtag_c works]) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[#include ]], - [[ taglib_set_string_management_enabled(0); ]])], - [ - AC_MSG_RESULT([yes]) - have_taglib=yes - ], [AC_MSG_RESULT([no])] - ) - ], [ - if test x"$require_taglib" = "xyes"; then - AC_MSG_ERROR([Cannot find taglib/tag_c.h in ${taglib_prefix}/include]) - else - AC_MSG_NOTICE([No TagLib C header found on this system]) - fi - ]) - - dnl For static-only archs: - if test x"$have_taglib" = "xno" -a x"$ac_cv_header_taglib_tag_c_h" = "xyes"; then - AC_MSG_CHECKING([whether libtag_c works with -ltag -lstdc++ -lz (static arch)]) - TAGLIB_LIBS="${TAGLIB_LIBS} -ltag -lstdc++ -lz" - LIBS="${TAGLIB_LIBS}" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[#include ]], - [[ taglib_set_string_management_enabled(0); ]])], - [ - AC_MSG_RESULT([yes]) - have_taglib=yes - ], [ - if test x"$require_taglib" = "xyes"; then - AC_MSG_RESULT([no]) - AC_MSG_ERROR([Cannot link against libtag_c in ${taglib_prefix}/lib]) - else - AC_MSG_RESULT([no]) - AC_MSG_WARN([Error while linking against libtag_c in ${taglib_prefix}/lib, disabling support]) - fi - ] - ) - fi - - CFLAGS="$ac_taglib_save_CFLAGS" - CPPFLAGS="$ac_taglib_save_CPPFLAGS" - LIBS="$ac_taglib_save_LIBS" + CPPFLAGS="${libiconv_save_CPPFLAGS}" + LDFLAGS="${libiconv_save_LDFLAGS}" + LIBS="${libiconv_save_LIBS}" +fi +if test -n "${LTLIBICONV}"; then + EZ_LIBICONV="${LTLIBICONV}" else - AC_MSG_RESULT([disabled]) + EZ_LIBICONV="${LIBICONV}" +fi +AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [$INCICONV]) +AX_UNIQVAR_APPEND([EZ_LDFLAGS], [$LDICONV]) +AX_UNIQVAR_PREPEND([EZ_LIBS], [$EZ_LIBICONV]) +use_iconv="No" +if test x"${am_cv_func_iconv}" = "xyes"; then + use_iconv="Yes" fi -if test x"$have_taglib" = "xyes"; then - AC_DEFINE(HAVE_TAGLIB, 1, [Define whether we're using TagLib]) -else - TAGLIB_CFLAGS="" - TAGLIB_CPPFLAGS="" - TAGLIB_LIBS="" -fi -AC_SUBST(TAGLIB_CFLAGS) -AC_SUBST(TAGLIB_CPPFLAGS) -AC_SUBST(TAGLIB_LIBS) -dnl Check for Ogg Vorbis -XIPH_PATH_OGG(, AC_MSG_ERROR([Must have libogg 1.x installed.])) -XIPH_PATH_VORBIS(, AC_MSG_ERROR([Must have libvorbis 1.x installed.])) +dnl ####################### +dnl ## FUNCTIONS / MACROS ############################################## +dnl ####################### -dnl Check for libshout. -XIPH_PATH_SHOUT(, AC_MSG_ERROR([Must have libshout 2.x installed.])) +AC_CHECK_FUNCS([ \ + arc4random \ + gettimeofday \ + nl_langinfo \ + random \ + setlocale \ + srandomdev \ + stat \ +]) -dnl Check for libxml -XIPH_PATH_XML(, AC_MSG_ERROR([Must have libxml 2.x installed.])) +AC_REPLACE_FUNCS([ \ + getopt \ + strlcat \ + strlcpy \ + strtonum \ +]) -dnl Assemble *FLAGS and *LIBS in the proper order. -XIPH_VAR_APPEND([XIPH_CFLAGS], [$OGG_CFLAGS]) -XIPH_VAR_PREPEND([XIPH_LIBS], [$OGG_LIBS]) -XIPH_VAR_APPEND([XIPH_CFLAGS], [$VORBIS_CFLAGS]) -XIPH_VAR_PREPEND([XIPH_LIBS], [$VORBIS_LIBS]) -XIPH_VAR_APPEND([XIPH_CFLAGS], [$VORBISFILE_CFLAGS]) -XIPH_VAR_PREPEND([XIPH_LIBS], [$VORBISFILE_LIBS]) -XIPH_VAR_APPEND([XIPH_CFLAGS], [$SHOUT_CFLAGS]) -XIPH_VAR_APPEND([XIPH_CPPFLAGS], [$SHOUT_CPPFLAGS]) -XIPH_VAR_PREPEND([XIPH_LIBS], [$SHOUT_LIBS]) -XIPH_VAR_APPEND([XIPH_CFLAGS], [$XML_CFLAGS]) -XIPH_VAR_PREPEND([XIPH_LIBS], [$XML_LIBS]) +AX_FUNC_VA_COPY + +AC_CHECK_FUNCS([sigaction], [ + AC_DEFINE([HAVE_SIGNALS], [1], + [Define to 1 if we have BSD signals.]) + ], [], [ + #ifdef HAVE_SIGNAL_H + # include + #endif + ]) -dnl OUTPUT +dnl ################## +dnl ## MISCELLANEOUS ################################################### +dnl ################## -AC_CONFIG_FILES(Makefile \ - build-aux/Makefile \ - compat/Makefile \ - compat/sys/Makefile \ - doc/Makefile \ - examples/Makefile \ - m4/Makefile \ - src/Makefile \ - win32/Makefile) +AX_CHECK___PROGNAME -AC_SUBST(XIPH_CPPFLAGS) -AC_SUBST(XIPH_CFLAGS) -AC_SUBST(XIPH_LIBS) -AC_SUBST(LIBS) -AC_SUBST(CFLAGS) + +dnl ############ +dnl ## OUTPUT ########################################################## +dnl ############ + +AC_SUBST([EZ_CPPFLAGS]) +AC_SUBST([EZ_CFLAGS]) +AC_SUBST([EZ_LDFLAGS]) +AC_SUBST([EZ_LIBS]) + +AC_CONFIG_FILES([ + Makefile + build-aux/Makefile + compat/Makefile + compat/sys/Makefile + doc/Makefile + examples/Makefile + m4/Makefile + src/Makefile + win32/Makefile +]) AC_OUTPUT + +cat << __EOT + +${PACKAGE_STRING} has been configured successfully. + +Configuration: + TagLib support ............... : ${use_taglib} + Charset conversion support ... : ${use_iconv} + Prefix ....................... : ${prefix} + +__EOT diff --git a/doc/Makefile.am b/doc/Makefile.am index 5e0581d..ead820c 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,12 +1,12 @@ AUTOMAKE_OPTIONS = 1.9 foreign -man_MANS = ezstream.1 +man_MANS = ezstream.1 -EXTRA_DIST = ezstream.1.in +EXTRA_DIST = ezstream.1.in -do_subst = sed -e 's,!!EXAMPLES_DIR!!,@EXAMPLES_DIR@,g' +do_subst = sed -e 's,!!EXAMPLES_DIR!!,@EXAMPLES_DIR@,g' -ezstream.1: ezstream.1.in Makefile - $(do_subst) < $(srcdir)/ezstream.1.in > ezstream.1 +ezstream.1: ezstream.1.in Makefile + $(do_subst) < $(srcdir)/ezstream.1.in > ezstream.1 -CLEANFILES = *~ *.core core ${man_MANS} +CLEANFILES = *~ *.core core $(man_MANS) diff --git a/examples/Makefile.am b/examples/Makefile.am index bf3e5c9..62b76c9 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,10 +1,11 @@ AUTOMAKE_OPTIONS = 1.9 foreign -examplesdir = @EXAMPLES_DIR@ -dist_examples_DATA = ezstream_mp3.xml ezstream_reencode_mp3.xml \ - ezstream_reencode_theora.xml ezstream_reencode_vorbis.xml \ - ezstream_stdin_vorbis.xml ezstream_vorbis.xml \ - ezstream_metadata.xml +examplesdir = @EXAMPLES_DIR@ +dist_examples_DATA = \ + ezstream_mp3.xml ezstream_reencode_mp3.xml \ + ezstream_reencode_theora.xml ezstream_reencode_vorbis.xml \ + ezstream_stdin_vorbis.xml ezstream_vorbis.xml \ + ezstream_metadata.xml dist_examples_SCRIPTS = meta.sh play.sh -CLEANFILES = core *.core *~ .*~ +CLEANFILES = core *.core *~ .*~ diff --git a/m4/Makefile.am b/m4/Makefile.am index b747dfd..201e2a5 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1,5 +1,5 @@ AUTOMAKE_OPTIONS = 1.9 foreign -EXTRA_DIST = xiph_compiler.m4 xiph_xml2.m4 +CLEANFILES = core *.core *~ .*~ -CLEANFILES = core *.core *~ .*~ +# Distribute required .m4 files via EXTRA_DIST in the parent Makefile.am. diff --git a/m4/ccflags.m4 b/m4/ccflags.m4 new file mode 100644 index 0000000..543c52e --- /dev/null +++ b/m4/ccflags.m4 @@ -0,0 +1,101 @@ +dnl $Id: ccflags.m4 907 2009-03-08 10:28:51Z mgrimm $ + +dnl * Check if the compiler understands a certain flag or not. +dnl Inspiration for this came from watching TagLib configure. +dnl * Check for the CFLAG required to turn warnings into errors. + +dnl Copyright (c) 2008 Moritz Grimm +dnl +dnl Permission to use, copy, modify, and distribute this software for any +dnl purpose with or without fee is hereby granted, provided that the above +dnl copyright notice and this permission notice appear in all copies. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +dnl AX_CHECK_CFLAG(CFLAG, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl AX_CHECK_CXXFLAG(CXXFLAG, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) + +AC_DEFUN([AX_CHECK_CFLAG], +[ +AC_MSG_CHECKING([if ${CC} understands -$1]) +_cv_sufx_=$(echo $1 | sed 'y|-+,= |_p___|') +AC_CACHE_VAL([local_cv_prog_cc_${_cv_sufx_}], +[ + AC_LANG_PUSH([C]) + save_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} -$1" + AC_TRY_LINK([], [], + [eval "local_cv_prog_cc_${_cv_sufx_}=yes"], + [eval "local_cv_prog_cc_${_cv_sufx_}=no"]) + CFLAGS="${save_CFLAGS}" + AC_LANG_POP([C]) +]) +eval "_cache_val_=\${local_cv_prog_cc_${_cv_sufx_}}" +if test x"${_cache_val_}" = "xyes"; then + AC_MSG_RESULT([yes]) + : + $2 +else + AC_MSG_RESULT([no]) + : + $3 +fi +]) + +AC_DEFUN([AX_CHECK_CXXFLAG], +[ +AC_MSG_CHECKING([if ${CXX} understands -$1]) +_cv_sufx_=$(echo $1 | sed 'y|-+,= |_p___|') +AC_CACHE_VAL([local_cv_prog_cxx_${_cv_sufx_}], +[ + AC_LANG_PUSH([C++]) + save_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="${CXXFLAGS} -$1" + AC_TRY_LINK([], [], + [eval "local_cv_prog_cxx_${_cv_sufx_}=yes"], + [eval "local_cv_prog_cxx_${_cv_sufx_}=no"]) + CXXFLAGS="${save_CXXFLAGS}" + AC_LANG_POP([C++]) +]) +eval "_cache_val_=\${local_cv_prog_cxx_${_cv_sufx_}}" +if test x"${_cache_val_}" = "xyes"; then + AC_MSG_RESULT([yes]) + : + $2 +else + AC_MSG_RESULT([no]) + : + $3 +fi +]) + +AC_DEFUN([AX_CHECK_ERROR_FLAG], +[ +AC_CACHE_VAL([local_cv_prog_cc_error_flag], +[ + AC_MSG_CHECKING([if ${CC} supports an error flag]) + AC_LANG_PUSH([C]) + save_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} -Werror" + AC_TRY_LINK([], [], + [local_cv_prog_cc_error_flag=-Werror], + [local_cv_prog_cc_error_flag=no]) + CFLAGS="${save_CFLAGS}" + AC_LANG_POP([C]) + if test x"${local_cv_prog_cc_error_flag}" != "xno"; then + AC_MSG_RESULT([yes (${local_cv_prog_cc_error_flag})]) + : + $2 + else + AC_MSG_RESULT([no]) + : + $3 + fi +]) +]) diff --git a/m4/libogg.m4 b/m4/libogg.m4 new file mode 100644 index 0000000..13b2005 --- /dev/null +++ b/m4/libogg.m4 @@ -0,0 +1,130 @@ +dnl $Id: libogg.m4 729 2008-11-01 17:38:43Z mgrimm $ + +dnl # Check for a working installation of libogg. +dnl # Provides appropriate --with configuration options, fills and substitutes +dnl # the LIBOGG_CFLAGS, LIBOGG_CPPFLAGS, LIBOGG_LDFLAGS and LIBOGG_LIBS +dnl # variables accordingly. + + +dnl # Copyright (c) 2008 Moritz Grimm +dnl # +dnl # Permission to use, copy, modify, and distribute this software for any +dnl # purpose with or without fee is hereby granted, provided that the above +dnl # copyright notice and this permission notice appear in all copies. +dnl +dnl # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +dnl # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +dnl # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +dnl # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +dnl # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +dnl # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +dnl # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +dnl # For LIBOGG_CFLAGS, LIBOGG_CPPFLAGS, LIBOGG_LDFLAGS and LIBOGG_LIBS: +dnl # AX_CHECK_LIBOGG([LIBOGG-VERSION], [ACTION-IF-FOUND], +dnl # [ACTION-IF-NOT-FOUND]) + + +AC_DEFUN([AX_CHECK_LIBOGG], +[ +AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +AC_ARG_VAR([LIBOGG_CFLAGS], + [C compiler flags for libogg]) +AC_ARG_VAR([LIBOGG_CPPFLAGS], + [C preprocessor flags for libogg]) +AC_ARG_VAR([LIBOGG_LDFLAGS], + [linker flags for libogg]) +AC_ARG_VAR([LIBOGG_LIBS], + [libraries to use for libogg]) +if test x"${prefix}" = "xNONE"; then + ax_check_libogg_prefix="/usr/local" +else + ax_check_libogg_prefix="${prefix}" +fi +AC_CACHE_VAL([local_cv_have_lib_libogg], +[ +local_cv_have_lib_libogg=no + +PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${ax_check_libogg_prefix}/lib/pkgconfig" +if test -z "${PKG_CONFIG}"; then + AC_MSG_ERROR([The pkg-config utility is required.], [1]) +fi + +dnl ####### BEGIN CHECK ###### +PKG_CHECK_EXISTS([ogg $1], [ +dnl ########################## + +libogg_libs_autodetect=no +if test -z "${LIBOGG_CFLAGS}"; then + LIBOGG_CFLAGS="`${PKG_CONFIG} --cflags-only-other ogg`" +fi +if test -z "${LIBOGG_CPPFLAGS}"; then + LIBOGG_CPPFLAGS="`${PKG_CONFIG} --cflags-only-I ogg`" +fi +if test -z "${LIBOGG_LDFLAGS}"; then + LIBOGG_LDFLAGS="\ + `${PKG_CONFIG} --libs-only-L ogg` \ + `${PKG_CONFIG} --libs-only-other ogg` \ + " +fi +if test -z "${LIBOGG_LIBS}"; then + LIBOGG_LIBS="`${PKG_CONFIG} --libs-only-l ogg`" + libogg_libs_autodetect=yes +fi + +ax_check_libogg_save_CFLAGS="${CFLAGS}" +ax_check_libogg_save_CPPFLAGS="${CPPFLAGS}" +ax_check_libogg_save_LDFLAGS="${LDFLAGS}" +ax_check_libogg_save_LIBS="${LIBS}" +AC_LANG_PUSH([C]) +CFLAGS="${CFLAGS} ${LIBOGG_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${LIBOGG_CPPFLAGS}" +LDFLAGS="${LDFLAGS} ${LIBOGG_LDFLAGS}" +LIBS="${LIBOGG_LIBS} ${LIBS}" +AC_CHECK_HEADER([ogg/ogg.h], +[ + AC_MSG_CHECKING([if libogg works]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + ]], + [[ + ogg_sync_init(NULL); + ]] + )], + [ + AC_MSG_RESULT([yes]) + local_cv_have_lib_libogg=yes + ], + [ + AC_MSG_RESULT([no]) + ] + ) +]) +CFLAGS="${ax_check_libogg_save_CFLAGS}" +CPPFLAGS="${ax_check_libogg_save_CPPFLAGS}" +LDFLAGS="${ax_check_libogg_save_LDFLAGS}" +LIBS="${ax_check_libogg_save_LIBS}" +AC_LANG_POP([C]) + +dnl ####### END CHECK ######## +], []) +dnl ########################## + +]) + +AC_MSG_CHECKING([for libogg $1]) +if test x"${local_cv_have_lib_libogg}" = "xyes"; then + AC_MSG_RESULT([yes]) + : + $2 +else + AC_MSG_RESULT([no]) + : + $3 +fi + +]) diff --git a/m4/libshout.m4 b/m4/libshout.m4 new file mode 100644 index 0000000..88550b7 --- /dev/null +++ b/m4/libshout.m4 @@ -0,0 +1,139 @@ +dnl $Id: libshout.m4 948 2009-03-15 17:59:37Z mgrimm $ + +dnl # Check for a working installation of libshout. +dnl # Provides appropriate --with configuration options, fills and substitutes +dnl # the LIBSHOUT_CFLAGS, LIBSHOUT_CPPFLAGS, LIBSHOUT_LDFLAGS and +dnl # LIBSHOUT_LIBS variables accordingly. + + +dnl # Copyright (c) 2008 Moritz Grimm +dnl # +dnl # Permission to use, copy, modify, and distribute this software for any +dnl # purpose with or without fee is hereby granted, provided that the above +dnl # copyright notice and this permission notice appear in all copies. +dnl +dnl # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +dnl # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +dnl # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +dnl # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +dnl # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +dnl # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +dnl # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +dnl # For LIBSHOUT_CFLAGS, LIBSHOUT_CPPFLAGS, LIBSHOUT_LDFLAGS and +dnl # LIBSHOUT_LIBS: +dnl # AX_CHECK_LIBSHOUT([LIBSHOUT-VERSION], [ACTION-IF-FOUND], +dnl # [ACTION-IF-NOT-FOUND]) + + +AC_DEFUN([AX_CHECK_LIBSHOUT], +[ +AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +AC_REQUIRE([AC_PROG_FGREP]) +AC_ARG_VAR([LIBSHOUT_CFLAGS], + [C compiler flags for libshout]) +AC_ARG_VAR([LIBSHOUT_CPPFLAGS], + [C preprocessor flags for libshout]) +AC_ARG_VAR([LIBSHOUT_LDFLAGS], + [linker flags for libshout]) +AC_ARG_VAR([LIBSHOUT_LIBS], + [libraries to use for libshout]) +if test x"${prefix}" = "xNONE"; then + ax_check_libshout_prefix="/usr/local" +else + ax_check_libshout_prefix="${prefix}" +fi +AC_CACHE_VAL([local_cv_have_lib_libshout], +[ +local_cv_have_lib_libshout=no + +PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${ax_check_libshout_prefix}/lib/pkgconfig" +if test -z "${PKG_CONFIG}"; then + AC_MSG_ERROR([The pkg-config utility is required.], [1]) +fi + +dnl ####### BEGIN CHECK ###### +PKG_CHECK_EXISTS([shout $1], [ +dnl ########################## + +libshout_libs_autodetect=no +if test -z "${LIBSHOUT_CFLAGS}"; then + LIBSHOUT_CFLAGS="`${PKG_CONFIG} --cflags-only-other shout`" +fi +if test -z "${LIBSHOUT_CPPFLAGS}"; then + LIBSHOUT_CPPFLAGS="`${PKG_CONFIG} --cflags-only-I shout`" +fi +if test -z "${LIBSHOUT_LDFLAGS}"; then + LIBSHOUT_LDFLAGS="\ + `${PKG_CONFIG} --libs-only-L shout` \ + `${PKG_CONFIG} --libs-only-other shout` \ + " +fi +if test -z "${LIBSHOUT_LIBS}"; then + LIBSHOUT_LIBS="`${PKG_CONFIG} --libs-only-l shout`" + libshout_libs_autodetect=yes +fi + +# If libshout required libm, make sure that it is listed at the end: +if test "${libshout_libs_autodetect}" = "yes"; then + if test -n "`echo ${LIBSHOUT_LIBS} | ${FGREP} -e ' -lm'`"; then + xt_shout_TEMP="`echo ${LIBSHOUT_LIBS} | sed -e 's, -lm,,g'`" + LIBSHOUT_LIBS="${xt_shout_TEMP} -lm" + fi +fi + +ax_check_libshout_save_CFLAGS="${CFLAGS}" +ax_check_libshout_save_CPPFLAGS="${CPPFLAGS}" +ax_check_libshout_save_LDFLAGS="${LDFLAGS}" +ax_check_libshout_save_LIBS="${LIBS}" +AC_LANG_PUSH([C]) +CFLAGS="${CFLAGS} ${LIBSHOUT_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${LIBSHOUT_CPPFLAGS}" +LDFLAGS="${LDFLAGS} ${LIBSHOUT_LDFLAGS}" +LIBS="${LIBSHOUT_LIBS} ${LIBS}" +AC_CHECK_HEADER([shout/shout.h], +[ + AC_MSG_CHECKING([if libshout works]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + ]], + [[ + shout_new(); + ]] + )], + [ + AC_MSG_RESULT([yes]) + local_cv_have_lib_libshout=yes + ], + [ + AC_MSG_RESULT([no]) + ] + ) +]) +CFLAGS="${ax_check_libshout_save_CFLAGS}" +CPPFLAGS="${ax_check_libshout_save_CPPFLAGS}" +LDFLAGS="${ax_check_libshout_save_LDFLAGS}" +LIBS="${ax_check_libshout_save_LIBS}" +AC_LANG_POP([C]) + +dnl ####### END CHECK ######## +], []) +dnl ########################## + +]) + +AC_MSG_CHECKING([for libshout $1]) +if test x"${local_cv_have_lib_libshout}" = "xyes"; then + AC_MSG_RESULT([yes]) + : + $2 +else + AC_MSG_RESULT([no]) + : + $3 +fi + +]) diff --git a/m4/libvorbis.m4 b/m4/libvorbis.m4 new file mode 100644 index 0000000..7f1745e --- /dev/null +++ b/m4/libvorbis.m4 @@ -0,0 +1,320 @@ +dnl $Id: libvorbis.m4 735 2008-11-01 18:34:34Z mgrimm $ + +dnl # Check for working installations of libvorbis, libvorbisfile and +dnl # libvorbisenc. +dnl # Provides appropriate --with configuration options, fills and substitutes +dnl # the VORBIS_CFLAGS, VORBIS_CPPFLAGS, VORBIS_LDFLAGS, LIBVORBIS_LIBS, +dnl # LIBVORBISENC_LIBS and LIBVORBISFILE_LIBS variables accordingly. + + +dnl # Copyright (c) 2008 Moritz Grimm +dnl # +dnl # Permission to use, copy, modify, and distribute this software for any +dnl # purpose with or without fee is hereby granted, provided that the above +dnl # copyright notice and this permission notice appear in all copies. +dnl # +dnl # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +dnl # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +dnl # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +dnl # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +dnl # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +dnl # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +dnl # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +dnl # Each of these macros supply VORBIS_CFLAGS, VORBIS_CPPFLAGS and +dnl # VORBIS_LDFLAGS. + +dnl # For LIBVORBIS_LIBS: +dnl # AX_CHECK_LIBVORBIS([VORBISLIBS-VERSION], [ACTION-IF-FOUND], +dnl # [ACTION-IF-NOT-FOUND]) + +dnl # For LIBVORBISENC_LIBS: +dnl # AX_CHECK_LIBVORBISENC([VORBISLIBS-VERSION], [ACTION-IF-FOUND], +dnl # [ACTION-IF-NOT-FOUND]) + +dnl # For LIBVORBISFILE_LIBS: +dnl # AX_CHECK_LIBVORBISFILE([VORBISLIBS-VERSION], [ACTION-IF-FOUND], +dnl # [ACTION-IF-NOT-FOUND]) + + +AC_DEFUN([_AX_CHECK_VORBIS_OPTS], +[ +AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +AC_ARG_VAR([VORBIS_CFLAGS], + [C compiler flags for the Vorbis libraries]) +AC_ARG_VAR([VORBIS_CPPFLAGS], + [C preprocessor flags for the Vorbis libraries]) +AC_ARG_VAR([VORBIS_LDFLAGS], + [linker flags for the Vorbis libraries]) +if test x"${prefix}" = "xNONE"; then + ax_check_libvorbis_prefix="/usr/local" +else + ax_check_libvorbis_prefix="${prefix}" +fi +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`" +fi +if test -z "${VORBIS_LDFLAGS}"; then + VORBIS_LDFLAGS="\ + `${PKG_CONFIG} --libs-only-L vorbis` \ + `${PKG_CONFIG} --libs-only-other vorbis` \ + " +fi +]) + +AC_DEFUN([AX_CHECK_LIBVORBIS], +[ +AC_REQUIRE([_AX_CHECK_VORBIS_OPTS]) +AC_ARG_VAR([LIBVORBIS_LIBS], + [libraries to use for libvorbis]) +AC_CACHE_VAL([local_cv_have_lib_libvorbis], +[ +local_cv_have_lib_libvorbis=no + +PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${ax_check_libogg_prefix}/lib/pkgconfig" +if test -z "${PKG_CONFIG}"; then + AC_MSG_ERROR([The pkg-config utility is required.], [1]) +fi + +dnl ####### BEGIN CHECK ###### +PKG_CHECK_EXISTS([vorbis $1], [ +dnl ########################## + +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}" +ax_check_libvorbis_save_LIBS="${LIBS}" +AC_LANG_PUSH([C]) +CFLAGS="${CFLAGS} ${VORBIS_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${VORBIS_CPPFLAGS}" +LDFLAGS="${LDFLAGS} ${VORBIS_LDFLAGS}" +LIBS="${LIBVORBIS_LIBS} ${LIBS}" +AC_CHECK_HEADER([vorbis/codec.h], +[ + AC_MSG_CHECKING([if libvorbis works]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + #include + ]], + [[ + vorbis_info_init(NULL); + ]] + )], + [ + AC_MSG_RESULT([yes]) + local_cv_have_lib_libvorbis=yes + ], + [ + AC_MSG_RESULT([no]) + ] + ) + AC_CHECK_TYPE([struct ovectl_ratemanage_arg], + [], + [AC_MSG_ERROR([These Vorbis libraries are too old, please upgrade.], [1])], + [ + #include + #include + #include + #include + ] + ) +]) +CFLAGS="${ax_check_libvorbis_save_CFLAGS}" +CPPFLAGS="${ax_check_libvorbis_save_CPPFLAGS}" +LDFLAGS="${ax_check_libvorbis_save_LDFLAGS}" +LIBS="${ax_check_libvorbis_save_LIBS}" +AC_LANG_POP([C]) + +dnl ####### END CHECK ######## +], []) +dnl ########################## + +]) + +AC_MSG_CHECKING([for libvorbis $1]) +if test x"${local_cv_have_lib_libvorbis}" = "xyes"; then + AC_MSG_RESULT([yes]) + : + $2 +else + AC_MSG_RESULT([no]) + : + $3 +fi + +]) + +AC_DEFUN([AX_CHECK_LIBVORBISFILE], +[ +AC_REQUIRE([_AX_CHECK_VORBIS_OPTS]) +AC_ARG_VAR([LIBVORBISFILE_LIBS], + [libraries to use for libvorbisfile]) +AC_CACHE_VAL([local_cv_have_lib_libvorbisfile], +[ +local_cv_have_lib_libvorbisfile=no + +PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${ax_check_libogg_prefix}/lib/pkgconfig" +if test -z "${PKG_CONFIG}"; then + AC_MSG_ERROR([The pkg-config utility is required.], [1]) +fi + +dnl ####### BEGIN CHECK ###### +PKG_CHECK_EXISTS([vorbisfile $1], [ +dnl ########################## + +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}" +ax_check_libvorbisfile_save_LIBS="${LIBS}" +AC_LANG_PUSH([C]) +CFLAGS="${CFLAGS} ${VORBIS_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${VORBIS_CPPFLAGS}" +LDFLAGS="${LDFLAGS} ${VORBIS_LDFLAGS}" +LIBS="${LIBVORBISFILE_LIBS} ${LIBS}" +AC_CHECK_HEADER([vorbis/vorbisfile.h], +[ + AC_MSG_CHECKING([if libvorbisfile works]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + ]], + [[ + ov_open(NULL, NULL, NULL, 0); + ]] + )], + [ + AC_MSG_RESULT([yes]) + local_cv_have_lib_libvorbisfile=yes + ], + [ + AC_MSG_RESULT([no]) + ] + ) +]) +CFLAGS="${ax_check_libvorbisfile_save_CFLAGS}" +CPPFLAGS="${ax_check_libvorbisfile_save_CPPFLAGS}" +LDFLAGS="${ax_check_libvorbisfile_save_LDFLAGS}" +LIBS="${ax_check_libvorbisfile_save_LIBS}" +AC_LANG_POP([C]) + +dnl ####### END CHECK ######## +], []) +dnl ########################## + +]) + +AC_MSG_CHECKING([for libvorbisfile $1]) +if test x"${local_cv_have_lib_libvorbisfile}" = "xyes"; then + AC_MSG_RESULT([yes]) + : + $2 +else + AC_MSG_RESULT([no]) + : + $3 +fi + +]) + +AC_DEFUN([AX_CHECK_LIBVORBISENC], +[ +AC_REQUIRE([_AX_CHECK_VORBIS_OPTS]) +AC_ARG_VAR([LIBVORBISENC_LIBS], + [libraries to use for libvorbisenc]) +AC_CACHE_VAL([local_cv_have_lib_libvorbisenc], +[ +local_cv_have_lib_libvorbisenc=no + +PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${ax_check_libogg_prefix}/lib/pkgconfig" +if test -z "${PKG_CONFIG}"; then + AC_MSG_ERROR([The pkg-config utility is required.], [1]) +fi + +dnl ####### BEGIN CHECK ###### +PKG_CHECK_EXISTS([vorbisenc $1], [ +dnl ########################## + +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}" +ax_check_libvorbisenc_save_LIBS="${LIBS}" +AC_LANG_PUSH([C]) +CFLAGS="${CFLAGS} ${VORBIS_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${VORBIS_CPPFLAGS}" +LDFLAGS="${LDFLAGS} ${VORBIS_LDFLAGS}" +LIBS="${LIBVORBISENC_LIBS} ${LIBS}" +AC_CHECK_HEADER([vorbis/vorbisenc.h], +[ + AC_MSG_CHECKING([if libvorbisenc works]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + #include + #include + ]], + [[ + vorbis_encode_init(NULL, 0, 0, 0, 0, 0); + ]] + )], + [ + AC_MSG_RESULT([yes]) + local_cv_have_lib_libvorbisenc=yes + ], + [ + AC_MSG_RESULT([no]) + ] + ) +]) +CFLAGS="${ax_check_libvorbisenc_save_CFLAGS}" +CPPFLAGS="${ax_check_libvorbisenc_save_CPPFLAGS}" +LDFLAGS="${ax_check_libvorbisenc_save_LDFLAGS}" +LIBS="${ax_check_libvorbisenc_save_LIBS}" +AC_LANG_POP([C]) + +dnl ####### END CHECK ######## +], []) +dnl ########################## + +]) + +AC_MSG_CHECKING([for libvorbisenc $1]) +if test x"${local_cv_have_lib_libvorbisenc}" = "xyes"; then + AC_MSG_RESULT([yes]) + : + $2 +else + AC_MSG_RESULT([no]) + : + $3 +fi + +]) diff --git a/m4/libxml2.m4 b/m4/libxml2.m4 new file mode 100644 index 0000000..1940d94 --- /dev/null +++ b/m4/libxml2.m4 @@ -0,0 +1,146 @@ +dnl # $Id: libxml2.m4 736 2008-11-01 19:04:55Z mgrimm $ + +dnl # Check for a working installation of libxml (version 2.) +dnl # Provides appropriate --with configuration options, fills and substitutes +dnl # the LIBXML2_CFLAGS, LIBXML2_CPPFLAGS, LIBXML2_LDFLAGS and LIBXML2_LIBS +dnl # variables accordingly. + +dnl # Copyright (c) 2008 Moritz Grimm +dnl # +dnl # Permission to use, copy, modify, and distribute this software for any +dnl # purpose with or without fee is hereby granted, provided that the above +dnl # copyright notice and this permission notice appear in all copies. +dnl # +dnl # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +dnl # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +dnl # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +dnl # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +dnl # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +dnl # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +dnl # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +dnl # AX_CHECK_LIBXML2([LIBXML2-VERSION], [ACTION-IF-FOUND], +dnl # [ACTION-IF-NOT-FOUND]) + +AC_DEFUN([AX_CHECK_LIBXML2], +[ +AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +AC_ARG_VAR([LIBXML2_CFLAGS], + [C compiler flags for libxml2]) +AC_ARG_VAR([LIBXML2_CPPFLAGS], + [C preprocessor flags for libxml2]) +AC_ARG_VAR([LIBXML2_LDFLAGS], + [linker flags for libxml2]) +AC_ARG_VAR([LIBXML2_LIBS], + [libraries to use for libxml2]) +if test x"${prefix}" = "xNONE"; then + ax_check_libxml2_prefix="/usr/local" +else + ax_check_libxml2_prefix="${prefix}" +fi +AC_CACHE_VAL([local_cv_have_lib_libxml2], +[ +local_cv_have_lib_libxml2=no + +PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${ax_check_libxml2_prefix}/lib/pkgconfig" +if test -z "${PKG_CONFIG}"; then + AC_MSG_ERROR([The pkg-config utility is required.], [1]) +fi + +dnl ####### BEGIN CHECK ###### +PKG_CHECK_EXISTS([libxml-2.0 $1], [ +dnl ########################## + +libxml2_libs_autodetect=no +if test -z "${LIBXML2_CFLAGS}"; then + LIBXML2_CFLAGS="`${PKG_CONFIG} --cflags-only-other libxml-2.0`" +fi +if test -z "${LIBXML2_CPPFLAGS}"; then + LIBXML2_CPPFLAGS="`${PKG_CONFIG} --cflags-only-I libxml-2.0`" +fi +if test -z "${LIBXML2_LDFLAGS}"; then + LIBXML2_LDFLAGS="\ + `${PKG_CONFIG} --libs-only-L libxml-2.0` \ + `${PKG_CONFIG} --libs-only-other libxml-2.0` \ + " +fi +if test -z "${LIBXML2_LIBS}"; then + LIBXML2_LIBS="`${PKG_CONFIG} --libs-only-l libxml-2.0`" + libxml2_libs_autodetect=yes +fi + +ax_check_libxml2_save_CFLAGS="${CFLAGS}" +ax_check_libxml2_save_CPPFLAGS="${CPPFLAGS}" +ax_check_libxml2_save_LDFLAGS="${LDFLAGS}" +ax_check_libxml2_save_LIBS="${LIBS}" +AC_LANG_PUSH([C]) +CFLAGS="${CFLAGS} ${LIBXML2_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${LIBXML2_CPPFLAGS}" +LDFLAGS="${LDFLAGS} ${LIBXML2_LDFLAGS}" +LIBS="${LIBXML2_LIBS} ${LIBS}" +AC_CHECK_HEADERS([libxml/parser.h], [ + AC_MSG_CHECKING([if libxml2 works]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + ]], + [[ + xmlParseFile(NULL); + ]])], + [ + AC_MSG_RESULT([yes]) + local_cv_have_lib_libxml2=yes + ], + [ + AC_MSG_RESULT([no]) + if test x"${libxml2_libs_autodetect}" = "xyes"; then + LIBXML2_LIBS="`${PKG_CONFIG} --static --libs-only-l libxml-2.0`" + LIBS="${LIBXML2_LIBS} ${ax_check_libxml2_save_LIBS}" + AC_MSG_CHECKING([if libxml2 works with explicit dependencies]) + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + ]], + [[ + xmlParseFile(NULL); + ]])], + [ + AC_MSG_RESULT([yes]) + local_cv_have_lib_libxml2=yes + ], + [ + AC_MSG_RESULT([no]) + ] + ) + fi + ] + ) +]) +CFLAGS="${ax_check_libxml2_save_CFLAGS}" +CPPFLAGS="${ax_check_libxml2_save_CPPFLAGS}" +LDFLAGS="${ax_check_libxml2_save_LDFLAGS}" +LIBS="${ax_check_libxml2_save_LIBS}" +AC_LANG_POP([C]) + +dnl ####### END CHECK ######## +], []) +dnl ########################## + +]) + +AC_MSG_CHECKING([for libxml2 $1]) +if test x"${local_cv_have_lib_libxml2}" = "xyes"; then + AC_MSG_RESULT([yes]) + : + $2 +else + AC_MSG_RESULT([no]) + : + $3 +fi + +]) diff --git a/m4/progname.m4 b/m4/progname.m4 new file mode 100644 index 0000000..bdc0984 --- /dev/null +++ b/m4/progname.m4 @@ -0,0 +1,54 @@ +dnl $Id: progname.m4 719 2008-10-29 09:08:42Z mgrimm $ + +dnl Check whether libc defines __progname. Defines HAVE___PROGNAME, if +dnl applicable. This check is heavily inspired by the one in OpenNTPd +dnl (portable.) + +dnl Copyright (c) 2008 Moritz Grimm +dnl +dnl Permission to use, copy, modify, and distribute this software for any +dnl purpose with or without fee is hereby granted, provided that the above +dnl copyright notice and this permission notice appear in all copies. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +dnl AX_CHECK___PROGNAME([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) + +AC_DEFUN([AX_CHECK___PROGNAME], +[ +AC_MSG_CHECKING([whether libc defines __progname]) +AC_CACHE_VAL([local_cv_libc_defines___progname], +[ + AC_LANG_PUSH([C]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + ]], + [[ + extern char *__progname; + printf("%s", __progname); + ]])], + [local_cv_libc_defines___progname=yes], + [local_cv_libc_defines___progname=no] + ) + AC_LANG_POP([C]) +]) +if test x"${local_cv_libc_defines___progname}" = "xyes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE___PROGNAME], [1], + [Define whether libc defines __progname.]) + : + $1 +else + AC_MSG_RESULT([no]) + : + $2 +fi +]) diff --git a/m4/taglib.m4 b/m4/taglib.m4 new file mode 100644 index 0000000..b974f1b --- /dev/null +++ b/m4/taglib.m4 @@ -0,0 +1,273 @@ +dnl $Id: taglib.m4 721 2008-10-29 14:28:09Z mgrimm $ + +dnl Check for working installations of TagLib and its C-wrapper library, +dnl libtag_c. +dnl Provides appropriate --with configuration options, fills and substitutes +dnl the TAGLIB_CPPFLAGS, TAGLIB_LDFLAGS, TAGLIB_LIBS and TAGLIB_C_LIBS +dnl variables accordingly. + + +dnl Copyright (c) 2008 Moritz Grimm +dnl +dnl Permission to use, copy, modify, and distribute this software for any +dnl purpose with or without fee is hereby granted, provided that the above +dnl copyright notice and this permission notice appear in all copies. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +dnl Both check functions provide TAGLIB_CPPFLAGS and TAGLIB_LDFLAGS. + +dnl For TAGLIB_LIBS: +dnl AX_CHECK_TAGLIB([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) + +dnl For TAGLIB_C_LIBS: +dnl AX_CHECK_TAGLIB_C([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) + + +AC_DEFUN([_AX_CHECK_TAGLIB_OPTS], +[ +AC_ARG_VAR([TAGLIB_CPPFLAGS], + [C preprocessor flags for TagLib]) +AC_ARG_VAR([TAGLIB_LDFLAGS], + [linker flags for TagLib]) +if test x"${prefix}" = "xNONE"; then + have_taglib_prefix="/usr/local" +else + have_taglib_prefix="${prefix}" +fi +have_taglib_includes="" +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]) ], + [ +case "${withval}" in + yes) + want_taglib="yes" + ;; + no) + want_taglib="no" + ;; + *) + have_taglib_prefix="${withval}" + want_taglib="yes" + ;; +esac + ] +) +AC_ARG_WITH([taglib-includes], + [AS_HELP_STRING([--with-taglib-includes=DIR], + [directory where TagLib header files are installed (optional)]) ], + [ +case "${withval}" in + yes|no) ;; + *) + have_taglib_includes="${withval}" + ;; +esac + ] +) +AC_ARG_WITH([taglib-libs], + [AS_HELP_STRING([--with-taglib-libs=DIR], + [directory where TagLib is installed (optional)]) ], + [ +case "${withval}" in + yes|no) ;; + *) + have_taglib_libs="${withval}" + ;; +esac + ] +) +AC_CACHE_VAL([local_cv_have_lib_taglib_opts], +[ +if test -n "${TAGLIB_CPPFLAGS}"; then + if test x"${have_taglib_includes}" != "x"; then + TAGLIB_CPPFLAGS="${TAGLIB_CPPFLAGS} -I${have_taglib_includes}" + fi +else + if test x"${have_taglib_includes}" != "x"; then + TAGLIB_CPPFLAGS="-I${have_taglib_includes}" + else + TAGLIB_CPPFLAGS="-I${have_taglib_prefix}/include/taglib" + fi +fi +if test -n "${TAGLIB_LDFLAGS}"; then + if test x"${have_taglib_libs}" != "x"; then + TAGLIB_LDFLAGS="-L${have_taglib_libs} ${TAGLIB_LDFLAGS}" + fi +else + if test -n "${have_taglib_libs}"; then + TAGLIB_LDFLAGS="-L${have_taglib_libs}" + else + TAGLIB_LDFLAGS="-L${have_taglib_prefix}/lib" + fi +fi +local_cv_have_lib_taglib_opts=yes +]) +]) + +AC_DEFUN([AX_CHECK_TAGLIB], +[ +AC_REQUIRE([_AX_CHECK_TAGLIB_OPTS]) +AC_ARG_VAR([TAGLIB_LIBS], + [libraries to use for TagLib]) +AC_CACHE_VAL([local_cv_have_lib_taglib], +[ +local_cv_have_lib_taglib=no +if test x"${want_taglib}" != "xno"; then # want_taglib != no +if test -z "${TAGLIB_LIBS}"; then + TAGLIB_LIBS="-ltag" +fi +ax_check_taglib_save_CPPFLAGS="${CPPFLAGS}" +ax_check_taglib_save_LDFLAGS="${LDFLAGS}" +ax_check_taglib_save_LIBS="${LIBS}" +AC_LANG_PUSH([C++]) +CPPFLAGS="${CPPFLAGS} ${TAGLIB_CPPFLAGS}" +LDFLAGS="${LDFLAGS} ${TAGLIB_LDFLAGS}" +LIBS="${TAGLIB_LIBS} ${LIBS}" +AC_CHECK_HEADER([tag.h], +[ + AC_MSG_CHECKING([if TagLib works]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + ]], + [[ + TagLib::FileRef f(static_cast(NULL)); + ]] + )], + [ + AC_MSG_RESULT([yes]) + local_cv_have_lib_taglib=yes + ], + [ + AC_MSG_RESULT([no]) + LIBS="${LIBS} -lstdc++ -lz" + TAGLIB_LIBS="${TAGLIB_LIBS} -lstdc++ -lz" + AC_MSG_CHECKING([if TagLib works with -lstdc++ -lz]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #include + ]], + [[ + TagLib::FileRef f(static_cast(NULL)); + ]] + )], + [ + AC_MSG_RESULT([yes]) + local_cv_have_lib_taglib=yes + ], + [ + AC_MSG_RESULT([no]) + ] + ) + ] + ) +]) +CPPFLAGS="${ax_check_taglib_save_CPPFLAGS}" +LDFLAGS="${ax_check_taglib_save_LDFLAGS}" +LIBS="${ax_check_taglib_save_LIBS}" +AC_LANG_POP([C++]) +fi # want_taglib != no +]) +AC_MSG_CHECKING([for TagLib]) +if test x"${local_cv_have_lib_taglib}" = "xyes"; then + AC_MSG_RESULT([yes]) + : + $1 +else + AC_MSG_RESULT([no]) + : + $2 +fi +]) + +AC_DEFUN([AX_CHECK_TAGLIB_C], +[ +AC_REQUIRE([_AX_CHECK_TAGLIB_OPTS]) +AC_ARG_VAR([TAGLIB_C_LIBS], + [libraries to use for the TagLib C wrapper]) +AC_CACHE_VAL([local_cv_have_lib_taglib_c], +[ +local_cv_have_lib_taglib_c=no +if test x"${want_taglib}" != "xno"; then # want_taglib != no +if test -z "${TAGLIB_C_LIBS}"; then + TAGLIB_C_LIBS="-ltag_c" +fi +ax_check_taglib_c_save_CPPFLAGS="${CPPFLAGS}" +ax_check_taglib_c_save_LDFLAGS="${LDFLAGS}" +ax_check_taglib_c_save_LIBS="${LIBS}" +AC_LANG_PUSH([C]) +CPPFLAGS="${CPPFLAGS} ${TAGLIB_CPPFLAGS}" +LDFLAGS="${LDFLAGS} ${TAGLIB_LDFLAGS}" +LIBS="${TAGLIB_C_LIBS} ${LIBS}" +AC_CHECK_HEADER([tag_c.h], +[ + AC_MSG_CHECKING([if libtag_c works]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + ]], + [[ + taglib_set_string_management_enabled(0); + ]] + )], + [ + AC_MSG_RESULT([yes]) + local_cv_have_lib_taglib_c=yes + ], + [ + AC_MSG_RESULT([no]) + LIBS="${LIBS} -ltag -lstdc++ -lz" + TAGLIB_LIBS="${TAGLIB_LIBS} -ltag -lstdc++ -lz" + AC_MSG_CHECKING([if libtag_c works with -ltag -lstdc++ -lz]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + ]], + [[ + taglib_set_string_management_enabled(0); + ]] + )], + [ + AC_MSG_RESULT([yes]) + local_cv_have_lib_taglib_c=yes + ], + [ + AC_MSG_RESULT([no]) + ] + ) + ] + ) +]) +CPPFLAGS="${ax_check_taglib_c_save_CPPFLAGS}" +LDFLAGS="${ax_check_taglib_c_save_LDFLAGS}" +LIBS="${ax_check_taglib_c_save_LIBS}" +AC_LANG_POP([C]) +fi # want_taglib != no +]) +AC_MSG_CHECKING([for libtag_c]) +if test x"${local_cv_have_lib_taglib_c}" = "xyes"; then + AC_MSG_RESULT([yes]) + : + $1 +else + AC_MSG_RESULT([no]) + : + $2 +fi +]) diff --git a/m4/tree.m4 b/m4/tree.m4 new file mode 100644 index 0000000..1fb7bb7 --- /dev/null +++ b/m4/tree.m4 @@ -0,0 +1,56 @@ +dnl $Id: tree.m4 719 2008-10-29 09:08:42Z mgrimm $ + +dnl Check for sys/tree.h and if it is recent enough by looking at a certain +dnl macro. Defines HAVE_SYS_TREE_H if all conditions are met. + +dnl Copyright (c) 2008 Moritz Grimm +dnl +dnl Permission to use, copy, modify, and distribute this software for any +dnl purpose with or without fee is hereby granted, provided that the above +dnl copyright notice and this permission notice appear in all copies. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +dnl AX_HEADER_TREE([REQUIRED-MACRO], [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) + +AC_DEFUN([AX_HEADER_TREE], +[ +if test x"$1" = "x"; then + _tree_macro="RB_INIT" +else + _tree_macro=$1 +fi +AC_MSG_CHECKING([for ${_tree_macro} in sys/tree.h]) +AC_CACHE_VAL([local_cv_header_sys_tree_h], +[ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + #if !defined(${_tree_macro}) + # error Required tree macro missing + #endif /* !${_tree_macro} */ + ]], + [[]])], + [local_cv_header_sys_tree_h=yes], + [local_cv_header_sys_tree_h=no]) +]) +if test x"${local_cv_header_sys_tree_h}" = "xyes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_SYS_TREE_H], [1], + [Define to 1 if you have a sufficiently recent header.]) + : + $2 +else + AC_MSG_RESULT([no]) + : + $3 +fi +]) diff --git a/m4/vacopy.m4 b/m4/vacopy.m4 new file mode 100644 index 0000000..9278472 --- /dev/null +++ b/m4/vacopy.m4 @@ -0,0 +1,72 @@ +dnl $Id: vacopy.m4 719 2008-10-29 09:08:42Z mgrimm $ + +dnl Check for means to copy variable argument lists. After this check, +dnl va_copy will at least be defined to something working. +dnl This requires stdarg.h, which is assumed to exist. + +dnl Copyright (c) 2008 Moritz Grimm +dnl +dnl Permission to use, copy, modify, and distribute this software for any +dnl purpose with or without fee is hereby granted, provided that the above +dnl copyright notice and this permission notice appear in all copies. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +dnl AX_FUNC_VA_COPY + +AC_DEFUN([AX_FUNC_VA_COPY], +[ +AC_MSG_CHECKING([for means to copy variable argument lists]) +AC_CACHE_VAL([local_ac_cv_func_va_copy], +[ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + ]], + [[ + va_list ap, ap2; + va_copy(ap2, ap); + ]])], + [local_ac_cv_func_va_copy=va_copy], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + ]], + [[ + va_list ap, ap2; + __va_copy(ap2, ap); + ]])], + [local_ac_cv_func_va_copy=__va_copy], + [local_ac_cv_func_va_copy=memcpy] + )] + ) +]) +AH_TEMPLATE([va_copy], + [Define vararg lists copy function if necessary.]) +case "${local_ac_cv_func_va_copy}" in + va_copy) + AC_MSG_RESULT([va_copy]) + ;; + __va_copy) + AC_MSG_RESULT([__va_copy]) + AC_DEFINE([va_copy], + [__va_copy]) + ;; + memcpy) + AC_MSG_RESULT([memcpy]) + AC_DEFINE([va_copy(dst, src)], + [memcpy(&(dst), &(src), sizeof(va_list))]) + ;; + *) + dnl Cannot happen unless the cache value is corrupt. + ;; +esac +]) diff --git a/m4/vars.m4 b/m4/vars.m4 new file mode 100644 index 0000000..e266d8b --- /dev/null +++ b/m4/vars.m4 @@ -0,0 +1,57 @@ +dnl $Id: vars.m4 947 2009-03-15 17:51:37Z mgrimm $ + +dnl # Append or prepend items to a variable, but keep the items in the +dnl # variable unique. +dnl # Re-implemented from scratch after seeing XIPH_VAR_[PRE,AP]PEND, written +dnl # by Karl Heyes of the Icecast project, in action. The end result turned +dnl # out to be quite similar ... + + +dnl # Copyright (c) 2008 Moritz Grimm +dnl # +dnl # Permission to use, copy, modify, and distribute this software for any +dnl # purpose with or without fee is hereby granted, provided that the above +dnl # copyright notice and this permission notice appear in all copies. +dnl # +dnl # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +dnl # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +dnl # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +dnl # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +dnl # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +dnl # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +dnl # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +dnl # AX_UNIQVAR_APPEND([VARIABLE], [ITEM-LIST]) +dnl # AX_UNIQVAR_PREPEND([VARIABLE], [ITEM-LIST]) + + +AC_DEFUN([AX_UNIQVAR_APPEND], +[ +AC_REQUIRE([AC_PROG_FGREP]) +for arg in $2 +do + if `echo " ${$1} x" | ${FGREP} -v -e " ${arg} " > /dev/null`; then + if test -z "${$1}"; then + $1="${arg}" + else + $1="${$1} ${arg}" + fi + fi +done +]) + +AC_DEFUN([AX_UNIQVAR_PREPEND], +[ +AC_REQUIRE([AC_PROG_FGREP]) +for arg in $2 +do + if `echo " ${$1} x" | ${FGREP} -v -e " ${arg} " > /dev/null`; then + if test -z "${$1}"; then + $1="${arg}" + else + $1="${arg} ${$1}" + fi + fi +done +]) diff --git a/m4/xiph_compiler.m4 b/m4/xiph_compiler.m4 deleted file mode 100644 index ed20782..0000000 --- a/m4/xiph_compiler.m4 +++ /dev/null @@ -1,187 +0,0 @@ -dnl xiph_compiler.m4 -dnl $Id: xiph_compiler.m4 8320 2004-11-30 20:36:09Z karl $ - -dnl XIPH_FUNC_VA_COPY -dnl Karl Heyes -dnl -# XIPH_FUNC_VA_COPY -# Test for implementation of va_copy, or define appropriately if missing -AC_DEFUN([XIPH_FUNC_VA_COPY], -[dnl -AC_MSG_CHECKING([for va_copy]) -AC_TRY_LINK([#include ], [va_list ap1, ap2; va_copy(ap1, ap2);], - AC_MSG_RESULT([va_copy]), - [dnl - AH_TEMPLATE([va_copy], [define if va_copy is not available]) - AC_TRY_LINK([#include ], [va_list ap1, ap2; __va_copy(ap1, ap2);], - [dnl - AC_DEFINE([va_copy], [__va_copy]) - AC_MSG_RESULT([__va_copy])], - [dnl - AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))]) - AC_MSG_RESULT([memcpy]) - ]) - ]) -]) -])dnl XIPH_FUNC_VA_COPY - -dnl XIPH_C_ATTRIBUTE -dnl Karl Heyes -dnl -# XIPH_C_ATTRIBUTE -# Define __attribute__ to be empty if the compiler does not support it -AC_DEFUN([XIPH_C_ATTRIBUTE], -[dnl -AC_TRY_COMPILE([int func(void) __attribute__((unused));], - [int x __attribute__ ((unused));],,[dnl - AH_TEMPLATE([__attribute__],[Define to empty if __attribute__ is not supported]) - AC_DEFINE([__attribute__(x)],[]) -]) -])dnl XIPH_C_ATTRIBUTE - -dnl XIPH_GCC_WARNING -dnl Karl Heyes -dnl -# XIPH_GCC_WARNING(flag, action-if-warning, action-if-not) -# Tests whether GCC emits a warning if explicitly asked to use flag. -# Useful for eg system default include paths -AC_DEFUN([XIPH_GCC_WARNING], -[AC_REQUIRE([AC_PROG_CC]) -xt_warning=no -if test x"$GCC" = "xyes" -then - save_cflags="$CFLAGS" - CFLAGS="-Werror $1" - AC_TRY_COMPILE(,,,xt_warning=yes) - CFLAGS="$save_cflags" -fi -if test "$xt_warning" = "yes" -then - ifelse([$2],,:,[$2]) -else - ifelse([$3],,:,[$3]) -fi -])dnl XIPH_GCC_WARNING - -dnl XIPH_CLEAN_CCFLAGS -dnl Brendan Cully 20030612 -dnl -# XIPH_CLEAN_CCFLAGS(flag-list, dest-shell-var-name) -# Filters out duplicate compiler flags, and -I flags if XIPH_GCC_WARNING -# complains about them -# Operates right-to-left on -l flags, left-to-right on everything else -# eg XIPH_CLEAN_CCFLAGS([-L/opt/lib -lfoo -lm -L/opt/lib -lbar -lm], [MY_LDFLAGS]) -# => MY_LDFLAGS="-L/opt/lib -lfoo -lbar -lm" -# the cat< /dev/null - then - xt_FLAGS="$flag $xt_FLAGS" - fi - ;; - esac -done - -$2='' -for flag in $xt_FLAGS -do - if { cat < /dev/null - then - $2="$flag $$2" - fi -done - -# Prune -I flags if $CC warns about them -xt_FLAGS='' -for flag in $$2 -do - case "$flag" in - -I*) - XIPH_GCC_WARNING([$flag], [], [xt_FLAGS="$xt_FLAGS $flag"]) - ;; - *) - xt_FLAGS="$xt_FLAGS $flag" - ;; - esac -done -$2="$xt_FLAGS" -])dnl XIPH_CLEAN_CCFLAGS - -dnl XIPH_VAR_APPEND -dnl Karl Heyes -dnl -# XIPH_VAR_APPEND(shell-var, list) -# Append each item in list to shell-var iff shell-var doesn't already have it -# eg XIPH_VAR_APPEND([CFLAGS], [-O2 -I/opt/packages/include]) -AC_DEFUN([XIPH_VAR_APPEND], -[dnl -AC_REQUIRE([AC_PROG_FGREP]) -for arg in $2 -do - if { cat < /dev/null - then - $1="$$1 $arg" - fi -done -])dnl XIPH_VAR_APPEND - -dnl XIPH_VAR_PREPEND -dnl Karl Heyes -dnl -# XIPH_VAR_PREPEND(shell-var, list) -# see XIPH_VAR_APPEND -AC_DEFUN([XIPH_VAR_PREPEND], -[dnl -AC_REQUIRE([AC_PROG_FGREP]) -xt_compare="$$1" -xt_filtered="" -for arg in $2 -do - if { cat < /dev/null - then - xt_compare="$arg $xt_compare" - xt_filtered="$xt_filtered $arg" - fi -done -$1="$xt_filtered $$1" -])dnl XIPH_VAR_PREPEND - -dnl XIPH_C__FUNC__ -dnl Karl Heyes 07/2004 -AC_DEFUN([XIPH_C__FUNC__], -[dnl -AC_MSG_CHECKING([for __func__]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[const char *x = __func__;])], - [ AC_MSG_RESULT([yes])], - [ AH_TEMPLATE([__func__], [Replace __func__ if not supported]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[const char *x = __FUNCTION__;])], - [ AC_DEFINE([__func__],[__FUNCTION__]) - AC_MSG_RESULT([yes])], - [ AC_DEFINE([__func__],[""]) - AC_MSG_RESULT([no]) - ]) - ]) -])dnl XIPH_C__FUNC__ - diff --git a/m4/xiph_xml2.m4 b/m4/xiph_xml2.m4 deleted file mode 100644 index 67e480b..0000000 --- a/m4/xiph_xml2.m4 +++ /dev/null @@ -1,58 +0,0 @@ -dnl XIPH_PATH_XML -dnl Populate XML_CFLAGS and XML_LIBS with infomation for -dnl linking with libxml2 -AC_DEFUN([XIPH_PATH_XML], -[dnl -AC_MSG_RESULT([checking for XML configuration]) -AC_ARG_VAR([XMLCONFIG],[XML configuration program]) -AC_ARG_WITH(xml-config, - [AC_HELP_STRING([--with-xml-config=PATH], - [use xml-config in PATH to find libxml])], - [XMLCONFIG="$withval"], - [AC_PATH_PROGS(XMLCONFIG, [xml2-config xml-config], "")] -) -if test "x$XMLCONFIG" = "x"; then - AC_MSG_ERROR([XML configuration could not be found]) -fi -if ! test -x "$XMLCONFIG"; then - AC_MSG_ERROR([$XMLCONFIG cannot be executed]) -fi -XML_LIBS="`$XMLCONFIG --libs`" -XML_CFLAGS="`$XMLCONFIG --cflags`" -ac_xml_save_LIBS="$LIBS" -ac_xml_save_CFLAGS="$CFLAGS" -LIBS="$XML_LIBS $LIBS" -CFLAGS="$CFLAGS $XML_CFLAGS" -AC_CHECK_FUNC(xmlParseFile,, [AC_MSG_ERROR([Unable to link with libxml])]) -CFLAGS="$ac_xml_save_CFLAGS" -LIBS="$ac_xml_save_LIBS" -]) - -dnl XIPH_PATH_XSLT -dnl Populate XSLT_CFLAGS and XSLT_LIBS with infomation for -dnl linking with libxml2 -AC_DEFUN([XIPH_PATH_XSLT], -[dnl -AC_ARG_VAR([XSLTCONFIG],[XSLT configuration program]) -AC_ARG_WITH(xslt-config, - [AC_HELP_STRING([--with-xslt-config=PATH], - [use xslt-config in PATH to find libxslt])], - [XSLTCONFIG="$withval"], - [AC_PATH_PROGS(XSLTCONFIG, [xslt-config], "")] -) -if test "x$XSLTCONFIG" = "x"; then - AC_MSG_ERROR([XSLT configuration could not be found]) -fi -if ! test -x "$XSLTCONFIG"; then - AC_MSG_ERROR([$XSLTCONFIG cannot be executed]) -fi -XSLT_LIBS="`$XSLTCONFIG --libs`" -XSLT_CFLAGS="`$XSLTCONFIG --cflags`" -ac_xslt_save_LIBS="$LIBS" -ac_xslt_save_CFLAGS="$CFLAGS" -LIBS="$XSLT_LIBS $LIBS" -CFLAGS="$CFLAGS $XSLT_CFLAGS" -AC_CHECK_FUNCS([xsltSaveResultToString]) -CFLAGS="$ac_xslt_save_CFLAGS" -LIBS="$ac_xslt_save_LIBS" -]) diff --git a/src/Makefile.am b/src/Makefile.am index d95c0c7..68beb7a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,17 +1,30 @@ AUTOMAKE_OPTIONS = 1.9 foreign -bin_PROGRAMS = ezstream +bin_PROGRAMS = ezstream -ezstream_SOURCES = compat.c configfile.c ezstream.c metadata.c playlist.c \ - util.c xalloc.c -ezstream_LDADD = @LIBOBJS@ @XIPH_LIBS@ @TAGLIB_LIBS@ +ezstream_SOURCES = \ + compat.c \ + configfile.c \ + ezstream.c \ + metadata.c \ + playlist.c \ + util.c \ + xalloc.c +ezstream_LDADD = @LIBOBJS@ @EZ_LIBS@ -INCLUDES = @COMPAT_INCLUDES@ +INCLUDES = @COMPAT_INCLUDES@ +AM_CFLAGS = @EZ_CFLAGS@ +AM_CPPFLAGS = @EZ_CPPFLAGS@ +AM_LDFLAGS = @EZ_LDFLAGS@ -AM_CFLAGS = @XIPH_CFLAGS@ @TAGLIB_CFLAGS@ -AM_CPPFLAGS = @XIPH_CPPFLAGS@ @TAGLIB_CPPFLAGS@ +EXTRA_DIST = \ + compat.h \ + configfile.h \ + getopt.h \ + metadata.h \ + playlist.h \ + strfctns.h \ + util.h \ + xalloc.h -EXTRA_DIST = compat.h configfile.h getopt.h metadata.h playlist.h \ - strfctns.h util.h xalloc.h - -CLEANFILES = core *.core *~ .*~ +CLEANFILES = core *.core *~ .*~ diff --git a/win32/Makefile.am b/win32/Makefile.am index 2143622..8714ed2 100644 --- a/win32/Makefile.am +++ b/win32/Makefile.am @@ -1,12 +1,12 @@ AUTOMAKE_OPTIONS = 1.9 foreign -EXTRA_DIST = README.win32 config.h ezstream.sln ezstream.vcproj +EXTRA_DIST = README.win32 config.h ezstream.sln ezstream.vcproj -CLEANFILES = core *.core *~ .*~ ezstream.1.pdf +CLEANFILES = core *.core *~ .*~ ezstream.1.pdf -do_subst = sed -e 's,!!EXAMPLES_DIR!!,${PACKAGE_TARNAME}-${PACKAGE_VERSION}-win32/examples,g' +do_subst = sed -e 's,!!EXAMPLES_DIR!!,${PACKAGE_TARNAME}-${PACKAGE_VERSION}-win32/examples,g' -.PHONY: regen-win32 +.PHONY: regen-win32 regen-win32: Makefile $(do_subst) < $(top_srcdir)/doc/ezstream.1.in | nroff -Tps -mandoc - | ps2pdf - ezstream.1.pdf