Commit b5336594 authored by Max Kellermann's avatar Max Kellermann

configure.ac: find more libraries with pkg-config

Detect the following libraries with pkg-config: libshout, libid3tag, libmad.
parent da83f2bb
......@@ -106,10 +106,6 @@ AC_ARG_WITH(tremor,[[ --with-tremor[=PFX] Use Tremor(vorbisidec) intege
AC_ARG_WITH(tremor-libraries,[ --with-tremor-libraries=DIR Directory where Tremor library is installed (optional)], tremor_libraries="$withval", tremor_libraries="")
AC_ARG_WITH(tremor-includes,[ --with-tremor-includes=DIR Directory where Tremor header files are installed (optional)], tremor_includes="$withval", tremor_includes="")
AC_ARG_WITH(id3tag,[ --with-id3tag=PFX Prefix where libid3tag is installed (optional)], id3tag_prefix="$withval", id3tag_prefix="")
AC_ARG_WITH(id3tag-libraries,[ --with-id3tag-libraries=DIR Directory where libid3tag library is installed (optional)], id3tag_libraries="$withval", id3tag_libraries="")
AC_ARG_WITH(id3tag-includes,[ --with-id3tag-includes=DIR Directory where libid3tag header files are installed (optional)], id3tag_includes="$withval", id3tag_includes="")
AC_ARG_WITH(faad,[ --with-faad=PFX Prefix where faad2 is installed], faad_prefix="$withval", faad_prefix="")
AC_ARG_WITH(faad-libraries,[ --with-faad-libraries=DIR Directory where faad2 library is installed (optional)], faad_libraries="$withval", faad_libraries="")
AC_ARG_WITH(faad-includes,[ --with-faad-includes=DIR Directory where faad2 header files are installed (optional)], faad_includes="$withval", faad_includes="")
......@@ -178,7 +174,10 @@ case $host in
esac
if test x$enable_shout_ogg = xyes || x$enable_shout_mp3 = xyes; then
XIPH_PATH_SHOUT([enable_shout=yes;AC_DEFINE(HAVE_SHOUT, 1, [Define to enable libshout support]) MPD_LIBS="$MPD_LIBS $SHOUT_LIBS" MPD_CFLAGS="$MPD_CFLAGS $SHOUT_CFLAGS"], [AC_MSG_WARN(libshout not found -- disabling shout support);enable_shout=no])
enable_shout=yes
PKG_CHECK_MODULES([SHOUT], [shout],
AC_DEFINE(HAVE_SHOUT, 1, [Define to enable libshout support]),
enable_shout=no)
fi
if test x$enable_shout_ogg = xyes; then
......@@ -261,88 +260,16 @@ if test x$enable_jack = xyes; then
[enable_jack=no;AC_MSG_WARN([JACK not found -- disabling])])
fi
ID3_SUBDIR=""
if test x$enable_id3 = xyes; then
if test "x$id3tag_libraries" != "x" ; then
ID3TAG_LIBS="-L$id3tag_libraries"
elif test "x$id3tag_prefix" != "x" ; then
ID3TAG_LIBS="-L$id3tag_prefix/lib"
fi
ID3TAG_LIBS="$ID3TAG_LIBS -lid3tag -lz"
if test "x$id3tag_includes" != "x" ; then
ID3TAG_CFLAGS="-I$id3tag_includes"
elif test "x$id3tag_prefix" != "x" ; then
ID3TAG_CFLAGS="-I$id3tag_prefix/include"
fi
ID3TAG_CFLAGS="$ID3TAG_CFLAGS"
oldcflags=$CFLAGS
oldlibs=$LIBS
oldcppflags=$CPPFLAGS
CFLAGS="$CFLAGS $MPD_CFLAGS $ID3TAG_CFLAGS"
LIBS="$LIBS $MPD_LIBS $ID3TAG_LIBS"
CPPFLAGS=$CFLAGS
AC_CHECK_HEADERS(id3tag.h,use_libid3tag=yes,
[use_libid3tag=no])
if test x$use_libid3tag = xyes; then
AC_CHECK_LIB(id3tag,id3_file_open,
[MPD_LIBS="$MPD_LIBS $ID3TAG_LIBS";
MPD_CFLAGS="$MPD_CFLAGS $ID3TAG_CFLAGS";
use_libid3tag=yes],
[use_libid3tag=no])
fi
CFLAGS=$oldcflags
LIBS=$oldlibs
CPPFLAGS=$oldcppflags
if test x$use_libid3tag = xyes; then
AC_DEFINE(HAVE_ID3TAG,1,[Define to use id3tag])
else
enable_id3=no
fi
PKG_CHECK_MODULES([ID3TAG], [id3tag],
AC_DEFINE(HAVE_ID3TAG, 1, [Define to use id3tag]),
enable_id3=no)
fi
MAD_SUBDIR=""
if test x$enable_mp3 = xyes; then
if test "x$mad_libraries" != "x" ; then
MAD_LIBS="-L$mad_libraries"
elif test "x$mad_prefix" != "x" ; then
MAD_LIBS="-L$mad_prefix/lib"
fi
MAD_LIBS="$MAD_LIBS -lmad"
if test "x$mad_includes" != "x" ; then
MAD_CFLAGS="-I$mad_includes"
elif test "x$mad_prefix" != "x" ; then
MAD_CFLAGS="-I$mad_prefix/include"
fi
oldcflags=$CFLAGS
oldlibs=$LIBS
oldcppflags=$CPPFLAGS
CFLAGS="$CFLAGS $MPD_CFLAGS $MAD_CFLAGS"
LIBS="$LIBS $MPD_LIBS $MAD_LIBS"
CPPFLAGS=$CFLAGS
AC_CHECK_HEADERS(mad.h,use_libmad=yes,
[use_libmad=no])
if test x$use_libmad = xyes; then
AC_CHECK_LIB(mad,mad_stream_init,[MPD_LIBS="$MPD_LIBS $MAD_LIBS";
MPD_CFLAGS="$MPD_CFLAGS $MAD_CFLAGS";
use_libmad=yes],[use_libmad=no])
fi
CFLAGS=$oldcflags
LIBS=$oldlibs
CPPFLAGS=$oldcppflags
if test x$use_libmad = xyes; then
AC_DEFINE(HAVE_MAD,1,[Define to use libmad])
else
enable_mp3=no
fi
PKG_CHECK_MODULES([MAD], [mad],
AC_DEFINE(HAVE_MAD, 1, [Define to use libmad]),
enable_mp3=no)
fi
if test x$enable_lame = xyes; then
......
dnl XIPH_PATH_SHOUT
dnl Jack Moffitt <jack@icecast.org> 08-06-2001
dnl Rewritten for libshout 2
dnl Brendan Cully <brendan@xiph.org> 20030612
dnl
dnl $Id: shout.m4 7180 2004-07-20 02:50:54Z brendan $
# XIPH_PATH_SHOUT([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
# Test for libshout, and define SHOUT_CPPFLAGS SHOUT_CFLAGS SHOUT_LIBS, and
# SHOUT_THREADSAFE
AC_DEFUN([XIPH_PATH_SHOUT],
[dnl
xt_have_shout="no"
SHOUT_THREADSAFE="no"
SHOUT_CPPFLAGS=""
SHOUT_CFLAGS=""
SHOUT_LIBS=""
# NB: PKG_CHECK_MODULES exits if pkg-config is unavailable on the target
# system, so we can't use it.
# seed pkg-config with the default libshout location
PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-/usr/local/lib/pkgconfig}
export PKG_CONFIG_PATH
# Step 1: Use pkg-config if available
AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
if test "$PKGCONFIG" != "no" && `$PKGCONFIG --exists shout`
then
SHOUT_CFLAGS=`$PKGCONFIG --variable=cflags_only shout`
SHOUT_CPPFLAGS=`$PKGCONFIG --variable=cppflags shout`
SHOUT_LIBS=`$PKGCONFIG --libs shout`
xt_have_shout="maybe"
else
if test "$PKGCONFIG" != "no"
then
AC_MSG_NOTICE([$PKGCONFIG couldn't find libshout. Try adjusting PKG_CONFIG_PATH.])
fi
# pkg-config unavailable, try shout-config
AC_PATH_PROG([SHOUTCONFIG], [shout-config], [no])
if test "$SHOUTCONFIG" != "no" && test `$SHOUTCONFIG --package` = "libshout"
then
SHOUT_CPPFLAGS=`$SHOUTCONFIG --cppflags`
SHOUT_CFLAGS=`$SHOUTCONFIG --cflags-only`
SHOUT_LIBS=`$SHOUTCONFIG --libs`
xt_have_shout="maybe"
fi
fi
# Now try actually using libshout
if test "$xt_have_shout" != "no"
then
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
# freebsd 6.1 + shout 2.2 port seems to leave pthread out
case "$host_os" in
freebsd*)
case "$SHOUT_CFLAGS$SHOUT_CPPFLAGS" in
*-D_THREAD_SAFE*)
SHOUT_LIBS="$SHOUT_LIBS -lpthread"
;;
esac
;;
esac
CPPFLAGS="$CPPFLAGS $SHOUT_CPPFLAGS"
CFLAGS="$CFLAGS $SHOUT_CFLAGS"
LIBS="$SHOUT_LIBS $LIBS"
AC_CHECK_HEADERS([shout/shout.h], [
AC_CHECK_FUNC([shout_new], [
ifelse([$1], , :, [$1])
xt_have_shout="yes"
])
AC_EGREP_CPP([yes], [#include <shout/shout.h>
#if SHOUT_THREADSAFE
yes
#endif
], [SHOUT_THREADSAFE="yes"])
])
CPPFLAGS="$ac_save_CPPFLAGS"
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
if test "$xt_have_shout" != "yes"
then
ifelse([$2], , :, [$2])
fi
])dnl XIPH_PATH_SHOUT
# Configure paths for libvorbis
# Jack Moffitt <jack@icecast.org> 10-21-2000
# Shamelessly stolen from Owen Taylor and Manish Singh
# thomasvs added check for vorbis_bitrate_addblock which is new in rc3
dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
dnl
AC_DEFUN([XIPH_PATH_VORBIS],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(vorbis,[ --with-vorbis=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
AC_ARG_WITH(vorbis-libraries,[ --with-vorbis-libraries=DIR Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="")
AC_ARG_WITH(vorbis-includes,[ --with-vorbis-includes=DIR Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="")
AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
if test "x$vorbis_libraries" != "x" ; then
VORBIS_LIBS="-L$vorbis_libraries"
elif test "x$vorbis_prefix" != "x" ; then
VORBIS_LIBS="-L$vorbis_prefix/lib"
elif test "x$prefix" != "xNONE"; then
VORBIS_LIBS="-L$prefix/lib"
fi
VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
VORBISFILE_LIBS="-lvorbisfile"
VORBISENC_LIBS="-lvorbisenc"
if test "x$vorbis_includes" != "x" ; then
VORBIS_CFLAGS="-I$vorbis_includes"
elif test "x$vorbis_prefix" != "x" ; then
VORBIS_CFLAGS="-I$vorbis_prefix/include"
elif test "x$prefix" != "xNONE"; then
VORBIS_CFLAGS="-I$prefix/include"
fi
AC_MSG_CHECKING(for Vorbis)
no_vorbis=""
if test "x$enable_vorbistest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
dnl
dnl Now check if the installed Vorbis is sufficiently new.
dnl
rm -f conf.vorbistest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisenc.h>
int main ()
{
vorbis_block vb;
vorbis_dsp_state vd;
vorbis_info vi;
vorbis_info_init (&vi);
vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
vorbis_analysis_init (&vd, &vi);
vorbis_block_init (&vd, &vb);
/* this function was added in 1.0rc3, so this is what we're testing for */
vorbis_bitrate_addblock (&vb);
system("touch conf.vorbistest");
return 0;
}
],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
if test "x$no_vorbis" = "x" ; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
if test -f conf.vorbistest ; then
:
else
echo "*** Could not run Vorbis test program, checking why..."
CFLAGS="$CFLAGS $VORBIS_CFLAGS"
LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <vorbis/codec.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
echo "*** or that you have moved Vorbis since it was installed." ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
VORBIS_CFLAGS=""
VORBIS_LIBS=""
VORBISFILE_LIBS=""
VORBISENC_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(VORBIS_CFLAGS)
AC_SUBST(VORBIS_LIBS)
AC_SUBST(VORBISFILE_LIBS)
AC_SUBST(VORBISENC_LIBS)
rm -f conf.vorbistest
])
......@@ -196,14 +196,20 @@ mpd_SOURCES = \
mpd_CFLAGS = $(MPD_CFLAGS)
mpd_CPPFLAGS = \
$(AO_CFLAGS) $(ALSA_CFLAGS) \
$(SHOUT_CFLAGS) \
$(OGGVORBIS_CFLAGS) $(VORBISENC_CFLAGS) \
$(patsubst -I%/FLAC,-I%,$(FLAC_CFLAGS)) \
$(AUDIOFILE_CFLAGS) $(LIBMIKMOD_CFLAGS) \
$(ID3TAG_CFLAGS) \
$(MAD_CFLAGS) \
$(GLIB_CFLAGS)
mpd_LDADD = $(MPD_LIBS) $(MP4FF_LIB) \
$(AO_LIBS) $(ALSA_LIBS) \
$(SHOUT_LIBS) \
$(OGGVORBIS_LIBS) $(VORBISENC_LIBS) $(FLAC_LIBS) \
$(AUDIOFILE_LIBS) $(LIBMIKMOD_LIBS) \
$(ID3TAG_LIBS) \
$(MAD_LIBS) \
$(GLIB_LIBS)
DIST_SUBDIRS = mp4ff
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment