diff --git a/configure.in b/configure.in index c94251d..b449d69 100644 --- a/configure.in +++ b/configure.in @@ -162,11 +162,12 @@ AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${LIBXML2_LDFLAGS}]) AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBXML2_LIBS}]) use_taglib="No" -AX_CHECK_TAGLIB_C([ +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_CFLAGS], [${TAGLIB_CFLAGS}]) + 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" diff --git a/m4/taglib.m4 b/m4/taglib.m4 index b974f1b..f355e4c 100644 --- a/m4/taglib.m4 +++ b/m4/taglib.m4 @@ -1,37 +1,41 @@ -dnl $Id: taglib.m4 721 2008-10-29 14:28:09Z mgrimm $ +dnl $Id$ -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 # 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_CFLAGS, TAGLIB_CPPFLAGS, TAGLIB_LDFLAGS, TAGLIB_LIBS and +dnl # TAGLIB_C_LIBS variables accordingly. -dnl Copyright (c) 2008 Moritz Grimm +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 # 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 # 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 # 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_LIBS: +dnl # AX_CHECK_TAGLIB([TAGLIB-VERSION], [ACTION-IF-FOUND], +dnl # [ACTION-IF-NOT-FOUND]) -dnl For TAGLIB_C_LIBS: -dnl AX_CHECK_TAGLIB_C([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl # For TAGLIB_C_LIBS: +dnl # AX_CHECK_TAGLIB_C([TAGLIB-VERSION], [ACTION-IF-FOUND], +dnl # [ACTION-IF-NOT-FOUND]) AC_DEFUN([_AX_CHECK_TAGLIB_OPTS], [ +AC_ARG_VAR([TAGLIB_CFLAGS], + [C compiler flags for TagLib]) AC_ARG_VAR([TAGLIB_CPPFLAGS], [C preprocessor flags for TagLib]) AC_ARG_VAR([TAGLIB_LDFLAGS], @@ -88,6 +92,9 @@ esac ) AC_CACHE_VAL([local_cv_have_lib_taglib_opts], [ +if test -z "${TAGLIB_CFLAGS}"; then + TAGLIB_CFLAGS="`${PKG_CONFIG} --cflags-only-other taglib`" +fi if test -n "${TAGLIB_CPPFLAGS}"; then if test x"${have_taglib_includes}" != "x"; then TAGLIB_CPPFLAGS="${TAGLIB_CPPFLAGS} -I${have_taglib_includes}" @@ -96,7 +103,11 @@ else if test x"${have_taglib_includes}" != "x"; then TAGLIB_CPPFLAGS="-I${have_taglib_includes}" else - TAGLIB_CPPFLAGS="-I${have_taglib_prefix}/include/taglib" + if test x"${want_taglib}" = "xauto"; then + TAGLIB_CPPFLAGS="`${PKG_CONFIG} --cflags-only-I taglib`" + else + TAGLIB_CPPFLAGS="-I${have_taglib_prefix}/include/taglib" + fi fi fi if test -n "${TAGLIB_LDFLAGS}"; then @@ -107,7 +118,14 @@ else if test -n "${have_taglib_libs}"; then TAGLIB_LDFLAGS="-L${have_taglib_libs}" else - TAGLIB_LDFLAGS="-L${have_taglib_prefix}/lib" + if test x"${want_taglib}" = "xauto"; then + TAGLIB_LDFLAGS=" \ + `${PKG_CONFIG} --libs-only-L taglib` \ + `${PKG_CONFIG} --libs-only-other taglib` \ + " + else + TAGLIB_LDFLAGS="-L${have_taglib_prefix}/lib" + fi fi fi local_cv_have_lib_taglib_opts=yes @@ -116,15 +134,28 @@ 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]) AC_CACHE_VAL([local_cv_have_lib_taglib], [ local_cv_have_lib_taglib=no + +PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${have_taglib_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([taglib $1], [ +dnl ########################## + if test x"${want_taglib}" != "xno"; then # want_taglib != no +libtag_libs_autodetected=no if test -z "${TAGLIB_LIBS}"; then - TAGLIB_LIBS="-ltag" + TAGLIB_LIBS="`${PKG_CONFIG} --libs-only-l taglib`" + libtag_libs_autodetected=yes fi ax_check_taglib_save_CPPFLAGS="${CPPFLAGS}" ax_check_taglib_save_LDFLAGS="${LDFLAGS}" @@ -181,27 +212,43 @@ LDFLAGS="${ax_check_taglib_save_LDFLAGS}" LIBS="${ax_check_taglib_save_LIBS}" AC_LANG_POP([C++]) fi # want_taglib != no + +dnl ####### END CHECK ######## +], []) +dnl ########################## + ]) AC_MSG_CHECKING([for TagLib]) if test x"${local_cv_have_lib_taglib}" = "xyes"; then AC_MSG_RESULT([yes]) : - $1 + $2 else AC_MSG_RESULT([no]) : - $2 + $3 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]) AC_CACHE_VAL([local_cv_have_lib_taglib_c], [ local_cv_have_lib_taglib_c=no + +PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${have_taglib_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([taglib $1], [ +dnl ########################## + if test x"${want_taglib}" != "xno"; then # want_taglib != no if test -z "${TAGLIB_C_LIBS}"; then TAGLIB_C_LIBS="-ltag_c" @@ -259,15 +306,20 @@ LDFLAGS="${ax_check_taglib_c_save_LDFLAGS}" LIBS="${ax_check_taglib_c_save_LIBS}" AC_LANG_POP([C]) fi # want_taglib != no + +dnl ####### END CHECK ######## +], []) +dnl ########################## + ]) AC_MSG_CHECKING([for libtag_c]) if test x"${local_cv_have_lib_taglib_c}" = "xyes"; then AC_MSG_RESULT([yes]) : - $1 + $2 else AC_MSG_RESULT([no]) : - $2 + $3 fi ])