Commit 30cd3455 authored by Enrico Weigelt's avatar Enrico Weigelt Committed by Max Kellermann

fixing several imports to work via pkg-config

This patch fixes several imports to use pkg-config instead of certain esoteric tests.
parent 047043d2
......@@ -227,7 +227,9 @@ if test x$enable_shout_mp3 = xyes; then
fi
if test x$enable_ao = xyes; then
XIPH_PATH_AO([AC_DEFINE(HAVE_AO, 1, [Define to play with ao]) MPD_LIBS="$MPD_LIBS $AO_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AO_CFLAGS"], enable_ao=no)
PKG_CHECK_MODULES(AO, [ao],
AC_DEFINE(HAVE_AO, 1, [Define to play with ao]),
enable_ao=no)
fi
if test x$enable_oss = xyes; then
......@@ -259,7 +261,9 @@ if test x$enable_mvp = xyes; then
fi
if test x$enable_alsa = xyes; then
AM_PATH_ALSA(0.9.0,[AC_DEFINE(HAVE_ALSA,1,[Define to enable ALSA support]) MPD_LIBS="$MPD_LIBS $ALSA_LIBS" MPD_CFLAGS="$MPD_CFLAGS $ALSA_CFLAGS"],enable_alsa=no)
PKG_CHECK_MODULES(ALSA, [alsa >= 0.9.0],
AC_DEFINE(HAVE_ALSA, 1, [Define to enable ALSA support]),
enable_alsa=no)
fi
if test x$enable_jack = xyes; then
......@@ -561,21 +565,9 @@ if test x$use_tremor = xyes; then
LIBS="$ac_save_LIBS"
fi
elif test x$enable_oggvorbis = xyes; then
XIPH_PATH_OGG(,enable_oggvorbis=no)
XIPH_PATH_VORBIS(,enable_oggvorbis=no)
if test x$enable_oggvorbis = xyes; then
MPD_LIBS="$MPD_LIBS $OGG_LIBS $VORBIS_LIBS $VORBISFILE_LIBS"
MPD_CFLAGS="$MPD_CFLAGS $OGG_CFLAGS $VORBIS_CFLAGS"
if test x$enable_shout_ogg = xyes; then
MPD_LIBS="$MPD_LIBS $VORBISENC_LIBS"
MPD_CFLAGS="$MPD_CFLAGS $VORBISFILE_CFLAGS $VORBISENC_CFLAGS"
fi
fi
fi
if test x$enable_oggvorbis = xyes; then
AC_DEFINE(HAVE_OGGVORBIS,1,[Define for Ogg Vorbis support])
PKG_CHECK_MODULES(OGGVORBIS, [ogg vorbis vorbisfile],
AC_DEFINE(HAVE_OGGVORBIS, 1, [Define for Ogg Vorbis support]),
enable_oggvorbis=no)
fi
if test x$use_tremor = xyes; then
......@@ -587,23 +579,15 @@ if test x$use_tremor = xyes; then
fi
if test x$enable_flac = xyes; then
oldmpdcflags="$MPD_CFLAGS"
oldmpdlibs="$MPD_LIBS"
AM_PATH_LIBFLAC(MPD_LIBS="$MPD_LIBS $LIBFLAC_LIBS" MPD_CFLAGS="$MPD_CFLAGS $LIBFLAC_CFLAGS",enable_flac=no)
fi
PKG_CHECK_MODULES(FLAC, [flac >= 1.1],
AC_DEFINE(HAVE_FLAC, 1, [Define for FLAC support]),
enable_flac=no)
if test x$enable_flac = xyes; then
oldcflags="$CFLAGS"
oldlibs="$LIBS"
CFLAGS="$CFLAGS $MPD_CFLAGS"
LIBS="$LIBS $MPD_LIBS"
AC_CHECK_LIB(FLAC, FLAC__metadata_object_vorbiscomment_find_entry_from,
,[enable_flac=no;AC_MSG_WARN(You need FLAC 1.1 -- disabling flac support)])
if test x$enable_flac = xno; then
MPD_CFLAGS="$oldmpdcflags"
MPD_LIBS="$oldmpdlibs"
else
CFLAGS="$CFLAGS $FLAC_CFLAGS"
LIBS="$LIBS $FLAC_LIBS"
if test x$enable_flac = xyes; then
AC_CHECK_DECL(FLAC_API_SUPPORTS_OGG_FLAC,
[enable_oggflac=flac], [],
[#include <FLAC/export.h>])
......@@ -612,12 +596,6 @@ if test x$enable_flac = xyes; then
LIBS="$oldlibs"
fi
if test x$enable_flac = xyes; then
AC_DEFINE(HAVE_FLAC,1,[Define for FLAC support])
fi
if test x$enable_oggflac = xyes; then
oldmpdcflags="$MPD_CFLAGS"
oldmpdlibs="$MPD_LIBS"
......@@ -630,20 +608,15 @@ fi
if test x$enable_audiofile = xyes; then
AM_PATH_AUDIOFILE(0.1.7, MPD_LIBS="$MPD_LIBS $AUDIOFILE_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AUDIOFILE_CFLAGS",
[enable_audiofile=no;AC_MSG_WARN(You need audiofile -- disabling audiofile support)])
fi
if test x$enable_audiofile = xyes; then
AC_DEFINE(HAVE_AUDIOFILE,1,[Define for audiofile support])
PKG_CHECK_MODULES(AUDIOFILE, [audiofile >= 0.1.7],
AC_DEFINE(HAVE_AUDIOFILE, 1, [Define for audiofile support]),
enable_audiofile=no)
fi
if test x$enable_mod = xyes; then
AM_PATH_LIBMIKMOD(3.1.7, MPD_CFLAGS="$MPD_CFLAGS $LIBMIKMOD_CFLAGS"
MPD_LIBS="$MPD_LIBS $LIBMIKMOD_LIBS $LIBMIKMOD_LDADD", enable_mod=no)
if test x$enable_mod = xyes; then
AC_DEFINE(HAVE_MIKMOD, 1, [Define for mikmod support])
fi
PKG_CHECK_MODULES(LIBMIKMOD, [libmikmod],
AC_DEFINE(HAVE_MIKMOD, 1, [Define for mikmod support]),
enable_mod=no)
fi
case $with_zeroconf in
......
dnl Configure Paths for Alsa
dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
dnl Jaroslav Kysela <perex@suse.cz>
dnl Last modification: alsa.m4,v 1.23 2004/01/16 18:14:22 tiwai Exp
dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
dnl enables arguments --with-alsa-prefix=
dnl --with-alsa-enc-prefix=
dnl --disable-alsatest
dnl
dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
dnl
AC_DEFUN([AM_PATH_ALSA],
[dnl Save the original CFLAGS, LDFLAGS, and LIBS
alsa_save_CFLAGS="$CFLAGS"
alsa_save_LDFLAGS="$LDFLAGS"
alsa_save_LIBS="$LIBS"
alsa_found=yes
dnl
dnl Get the cflags and libraries for alsa
dnl
AC_ARG_WITH(alsa-prefix,
[ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)],
[alsa_prefix="$withval"], [alsa_prefix=""])
AC_ARG_WITH(alsa-inc-prefix,
[ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)],
[alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
dnl FIXME: this is not yet implemented
AC_ARG_ENABLE(alsatest,
[ --disable-alsatest Do not try to compile and run a test Alsa program],
[enable_alsatest="$enableval"],
[enable_alsatest=yes])
dnl Add any special include directories
AC_MSG_CHECKING(for ALSA CFLAGS)
if test "$alsa_inc_prefix" != "" ; then
ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
CFLAGS="$CFLAGS -I$alsa_inc_prefix"
fi
AC_MSG_RESULT($ALSA_CFLAGS)
CFLAGS="$alsa_save_CFLAGS"
dnl add any special lib dirs
AC_MSG_CHECKING(for ALSA LDFLAGS)
if test "$alsa_prefix" != "" ; then
ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
LDFLAGS="$LDFLAGS $ALSA_LIBS"
fi
dnl add the alsa library
ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
LIBS=`echo $LIBS | sed 's/-lm//'`
LIBS=`echo $LIBS | sed 's/-ldl//'`
LIBS=`echo $LIBS | sed 's/-lpthread//'`
LIBS=`echo $LIBS | sed 's/ //'`
LIBS="$ALSA_LIBS $LIBS"
AC_MSG_RESULT($ALSA_LIBS)
dnl Check for a working version of libasound that is of the right version.
min_alsa_version=ifelse([$1], ,0.1.1,$1)
AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
no_alsa=""
alsa_min_major_version=`echo $min_alsa_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
alsa_min_minor_version=`echo $min_alsa_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
alsa_min_micro_version=`echo $min_alsa_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
AC_LANG_SAVE
AC_LANG_C
AC_TRY_COMPILE([
#include <alsa/asoundlib.h>
], [
/* ensure backward compatibility */
#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
#endif
#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
#endif
#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
#endif
# if(SND_LIB_MAJOR > $alsa_min_major_version)
exit(0);
# else
# if(SND_LIB_MAJOR < $alsa_min_major_version)
# error not present
# endif
# if(SND_LIB_MINOR > $alsa_min_minor_version)
exit(0);
# else
# if(SND_LIB_MINOR < $alsa_min_minor_version)
# error not present
# endif
# if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
# error not present
# endif
# endif
# endif
exit(0);
],
[AC_MSG_RESULT(found.)],
[AC_MSG_RESULT(not present.)
ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)])
alsa_found=no]
)
AC_LANG_RESTORE
dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
if test "x$enable_alsatest" = "xyes"; then
AC_CHECK_LIB([asound], [snd_ctl_open],,
[ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
alsa_found=no]
)
fi
LDFLAGS="$alsa_save_LDFLAGS"
LIBS="$alsa_save_LIBS"
if test "x$alsa_found" = "xyes" ; then
ifelse([$2], , :, [$2])
else
ALSA_CFLAGS=""
ALSA_LIBS=""
ifelse([$3], , :, [$3])
fi
dnl That should be it. Now just export out symbols:
AC_SUBST(ALSA_CFLAGS)
AC_SUBST(ALSA_LIBS)
])
# ao.m4
# Configure paths for libao
# Jack Moffitt <jack@icecast.org> 10-21-2000
# Shamelessly stolen from Owen Taylor and Manish Singh
dnl XIPH_PATH_AO([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libao, and define AO_CFLAGS and AO_LIBS
dnl
AC_DEFUN([XIPH_PATH_AO],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(ao,[ --with-ao=PFX Prefix where libao is installed (optional)], ao_prefix="$withval", ao_prefix="")
AC_ARG_WITH(ao-libraries,[ --with-ao-libraries=DIR Directory where libao library is installed (optional)], ao_libraries="$withval", ao_libraries="")
AC_ARG_WITH(ao-includes,[ --with-ao-includes=DIR Directory where libao header files are installed (optional)], ao_includes="$withval", ao_includes="")
AC_ARG_ENABLE(aotest, [ --disable-aotest Do not try to compile and run a test ao program],, enable_aotest=yes)
if test "x$ao_libraries" != "x" ; then
AO_LIBS="-L$ao_libraries"
elif test "x$ao_prefix" != "x"; then
AO_LIBS="-L$ao_prefix/lib"
elif test "x$prefix" != "xNONE"; then
AO_LIBS="-L$prefix/lib"
fi
if test "x$ao_includes" != "x" ; then
AO_CFLAGS="-I$ao_includes"
elif test "x$ao_prefix" != "x"; then
AO_CFLAGS="-I$ao_prefix/include"
elif test "x$prefix" != "xNONE"; then
AO_CFLAGS="-I$prefix/include"
fi
# see where dl* and friends live
AC_CHECK_FUNCS(dlopen, [AO_DL_LIBS=""], [
AC_CHECK_LIB(dl, dlopen, [AO_DL_LIBS="-ldl"], [
AC_MSG_WARN([could not find dlopen() needed by libao sound drivers
your system may not be supported.])
])
])
AO_LIBS="$AO_LIBS -lao $AO_DL_LIBS"
AC_MSG_CHECKING(for ao)
no_ao=""
if test "x$enable_aotest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $AO_CFLAGS"
LIBS="$LIBS $AO_LIBS"
dnl
dnl Now check if the installed ao is sufficiently new.
dnl
rm -f conf.aotest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ao/ao.h>
int main ()
{
system("touch conf.aotest");
return 0;
}
],, no_ao=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
if test "x$no_ao" = "x" ; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
if test -f conf.aotest ; then
:
else
echo "*** Could not run ao test program, checking why..."
CFLAGS="$CFLAGS $AO_CFLAGS"
LIBS="$LIBS $AO_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <ao/ao.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding ao or finding the wrong"
echo "*** version of ao. If it is not finding ao, 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 ao was incorrectly installed"
echo "*** or that you have moved ao since it was installed." ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
AO_CFLAGS=""
AO_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(AO_CFLAGS)
AC_SUBST(AO_LIBS)
rm -f conf.aotest
])
# Configure paths for the Audio File Library
# Bertrand Guiheneuf 98-10-21
# stolen from esd.m4 in esound :
# Manish Singh 98-9-30
# stolen back from Frank Belew
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor
dnl AM_PATH_AUDIOFILE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for Audio File Library, and define AUDIOFILE_CFLAGS and AUDIOFILE_LIBS.
dnl
AC_DEFUN([AM_PATH_AUDIOFILE],
[dnl
dnl Get compiler flags and libraries from the audiofile-config script.
dnl
AC_ARG_WITH(audiofile-prefix,[ --with-audiofile-prefix=PFX Prefix where Audio File Library is installed (optional)],
audiofile_prefix="$withval", audiofile_prefix="")
AC_ARG_WITH(audiofile-exec-prefix,[ --with-audiofile-exec-prefix=PFX Exec prefix where Audio File Library is installed (optional)],
audiofile_exec_prefix="$withval", audiofile_exec_prefix="")
AC_ARG_ENABLE(audiofiletest, [ --disable-audiofiletest Do not try to compile and run a test Audio File Library program], , enable_audiofiletest=yes)
if test x$audiofile_exec_prefix != x ; then
audiofile_args="$audiofile_args --exec-prefix=$audiofile_exec_prefix"
if test x${AUDIOFILE_CONFIG+set} != xset ; then
AUDIOFILE_CONFIG=$audiofile_exec_prefix/bin/audiofile-config
fi
fi
if test x$audiofile_prefix != x ; then
audiofile_args="$audiofile_args --prefix=$audiofile_prefix"
if test x${AUDIOFILE_CONFIG+set} != xset ; then
AUDIOFILE_CONFIG=$audiofile_prefix/bin/audiofile-config
fi
fi
AC_PATH_PROG(AUDIOFILE_CONFIG, audiofile-config, no)
min_audiofile_version=ifelse([$1], ,0.2.5,$1)
AC_MSG_CHECKING(for Audio File Library - version >= $min_audiofile_version)
no_audiofile=""
if test "$AUDIOFILE_CONFIG" = "no" ; then
no_audiofile=yes
else
AUDIOFILE_LIBS=`$AUDIOFILE_CONFIG $audiofileconf_args --libs`
AUDIOFILE_CFLAGS=`$AUDIOFILE_CONFIG $audiofileconf_args --cflags`
audiofile_major_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
audiofile_minor_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
audiofile_micro_version=`$AUDIOFILE_CONFIG $audiofile_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_audiofiletest" = "xyes" ; then
AC_LANG_SAVE
AC_LANG_C
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"
LIBS="$LIBS $AUDIOFILE_LIBS"
dnl
dnl Now check if the installed Audio File Library is sufficiently new.
dnl (Also checks the sanity of the results of audiofile-config to some extent.)
dnl
rm -f conf.audiofiletest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <audiofile.h>
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.audiofiletest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_audiofile_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_audiofile_version");
exit(1);
}
if (($audiofile_major_version > major) ||
(($audiofile_major_version == major) && ($audiofile_minor_version > minor)) ||
(($audiofile_major_version == major) && ($audiofile_minor_version == minor) && ($audiofile_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'audiofile-config --version' returned %d.%d.%d, but the minimum version\n", $audiofile_major_version, $audiofile_minor_version, $audiofile_micro_version);
printf("*** of the Audio File Library required is %d.%d.%d. If audiofile-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If audiofile-config was wrong, set the environment variable AUDIOFILE_CONFIG\n");
printf("*** to point to the correct copy of audiofile-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_audiofile=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
AC_LANG_RESTORE
fi
fi
if test "x$no_audiofile" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$AUDIOFILE_CONFIG" = "no" ; then
cat <<END
*** The audiofile-config script installed by the Audio File Library could
*** not be found. If the Audio File Library was installed in PREFIX, make
*** sure PREFIX/bin is in your path, or set the AUDIOFILE_CONFIG
*** environment variable to the full path to audiofile-config.
END
else
if test -f conf.audiofiletest ; then
:
else
echo "*** Could not run Audio File Library test program; checking why..."
AC_LANG_SAVE
AC_LANG_C
CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"
LIBS="$LIBS $AUDIOFILE_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <audiofile.h>
], [ return 0; ],
[ cat <<END
*** The test program compiled, but did not run. This usually means that
*** the run-time linker is not finding Audio File Library or finding the
*** wrong version of Audio File Library.
***
*** If it is not finding Audio File Library, you'll need to set your
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
*** to the installed location. Also, make sure you have run ldconfig if
*** that is required on your system.
***
*** If you have an old version installed, it is best to remove it, although
*** you may also be able to get things to work by modifying
*** LD_LIBRARY_PATH.
END
],
[ echo "*** The test program failed to compile or link. See the file config.log"
echo "*** for the exact error that occured. This usually means the Audio File"
echo "*** Library was incorrectly installed or that you have moved the Audio"
echo "*** File Library since it was installed. In the latter case, you may want"
echo "*** to edit the audiofile-config script: $AUDIOFILE_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
AC_LANG_RESTORE
fi
fi
AUDIOFILE_CFLAGS=""
AUDIOFILE_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(AUDIOFILE_CFLAGS)
AC_SUBST(AUDIOFILE_LIBS)
rm -f conf.audiofiletest
])
# Configure paths for libFLAC
# "Inspired" by ogg.m4
dnl AM_PATH_LIBFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libFLAC, and define LIBFLAC_CFLAGS and LIBFLAC_LIBS
dnl
AC_DEFUN([AM_PATH_LIBFLAC],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(libFLAC,[ --with-libFLAC=PFX Prefix where libFLAC is installed (optional)], libFLAC_prefix="$withval", libFLAC_prefix="")
AC_ARG_WITH(libFLAC-libraries,[ --with-libFLAC-libraries=DIR Directory where libFLAC library is installed (optional)], libFLAC_libraries="$withval", libFLAC_libraries="")
AC_ARG_WITH(libFLAC-includes,[ --with-libFLAC-includes=DIR Directory where libFLAC header files are installed (optional)], libFLAC_includes="$withval", libFLAC_includes="")
AC_ARG_ENABLE(libFLACtest, [ --disable-libFLACtest Do not try to compile and run a test libFLAC program],, enable_libFLACtest=yes)
if test "x$libFLAC_libraries" != "x" ; then
LIBFLAC_LIBS="-L$libFLAC_libraries"
elif test "x$libFLAC_prefix" != "x" ; then
LIBFLAC_LIBS="-L$libFLAC_prefix/lib"
elif test "x$prefix" != "xNONE" ; then
LIBFLAC_LIBS="-L$libdir"
fi
LIBFLAC_LIBS="$LIBFLAC_LIBS -lFLAC -lm"
if test "x$libFLAC_includes" != "x" ; then
LIBFLAC_CFLAGS="-I$libFLAC_includes"
elif test "x$libFLAC_prefix" != "x" ; then
LIBFLAC_CFLAGS="-I$libFLAC_prefix/include"
elif test "$prefix" != "xNONE"; then
LIBFLAC_CFLAGS="-I$libdir"
fi
AC_MSG_CHECKING(for libFLAC)
no_libFLAC=""
if test "x$enable_libFLACtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $LIBFLAC_CFLAGS"
CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS"
LIBS="$LIBS $LIBFLAC_LIBS"
dnl
dnl Now check if the installed libFLAC is sufficiently new.
dnl
rm -f conf.libFLACtest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <FLAC/format.h>
int main ()
{
system("touch conf.libFLACtest");
return 0;
}
],, no_libFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
if test "x$no_libFLAC" = "x" ; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
if test -f conf.libFLACtest ; then
:
else
echo "*** Could not run libFLAC test program, checking why..."
CFLAGS="$CFLAGS $LIBFLAC_CFLAGS"
LIBS="$LIBS $LIBFLAC_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <FLAC/format.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding libFLAC or finding the wrong"
echo "*** version of libFLAC. If it is not finding libFLAC, 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 libFLAC was incorrectly installed"
echo "*** or that you have moved libFLAC since it was installed. In the latter case, you"
echo "*** may want to edit the libFLAC-config script: $LIBFLAC_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
LIBFLAC_CFLAGS=""
LIBFLAC_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(LIBFLAC_CFLAGS)
AC_SUBST(LIBFLAC_LIBS)
rm -f conf.libFLACtest
])
# Configure paths for libmikmod
#
# Derived from glib.m4 (Owen Taylor 97-11-3)
# Improved by Chris Butler
#
dnl AM_PATH_LIBMIKMOD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for libmikmod, and define LIBMIKMOD_CFLAGS, LIBMIKMOD_LIBS and
dnl LIBMIKMOD_LDADD
dnl
AC_DEFUN([AM_PATH_LIBMIKMOD],
[dnl
dnl Get the cflags and libraries from the libmikmod-config script
dnl
AC_ARG_WITH(libmikmod-prefix,[ --with-libmikmod-prefix=PFX Prefix where libmikmod is installed (optional)],
libmikmod_config_prefix="$withval", libmikmod_config_prefix="")
AC_ARG_WITH(libmikmod-exec-prefix,[ --with-libmikmod-exec-prefix=PFX Exec prefix where libmikmod is installed (optional)],
libmikmod_config_exec_prefix="$withval", libmikmod_config_exec_prefix="")
AC_ARG_ENABLE(libmikmodtest, [ --disable-libmikmodtest Do not try to compile and run a test libmikmod program],
, enable_libmikmodtest=yes)
if test x$libmikmod_config_exec_prefix != x ; then
libmikmod_config_args="$libmikmod_config_args --exec-prefix=$libmikmod_config_exec_prefix"
if test x${LIBMIKMOD_CONFIG+set} != xset ; then
LIBMIKMOD_CONFIG=$libmikmod_config_exec_prefix/bin/libmikmod-config
fi
fi
if test x$libmikmod_config_prefix != x ; then
libmikmod_config_args="$libmikmod_config_args --prefix=$libmikmod_config_prefix"
if test x${LIBMIKMOD_CONFIG+set} != xset ; then
LIBMIKMOD_CONFIG=$libmikmod_config_prefix/bin/libmikmod-config
fi
fi
AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no)
min_libmikmod_version=ifelse([$1], ,3.1.5,$1)
AC_MSG_CHECKING(for libmikmod - version >= $min_libmikmod_version)
no_libmikmod=""
if test "$LIBMIKMOD_CONFIG" = "no" ; then
no_libmikmod=yes
else
LIBMIKMOD_CFLAGS=`$LIBMIKMOD_CONFIG $libmikmod_config_args --cflags`
LIBMIKMOD_LIBS=`$LIBMIKMOD_CONFIG $libmikmod_config_args --libs`
LIBMIKMOD_LDADD=`$LIBMIKMOD_CONFIG $libmikmod_config_args --ldadd`
libmikmod_config_major_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
libmikmod_config_minor_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
libmikmod_config_micro_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\3/'`
if test "x$enable_libmikmodtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
AC_LANG_SAVE
AC_LANG_C
CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS $LIBMIKMOD_LDADD"
LIBS="$LIBMIKMOD_LIBS $LIBS"
dnl
dnl Now check if the installed libmikmod is sufficiently new. (Also sanity
dnl checks the results of libmikmod-config to some extent
dnl
rm -f conf.mikmodtest
AC_TRY_RUN([
#include <mikmod.h>
#include <stdio.h>
#include <stdlib.h>
char* my_strdup (char *str)
{
char *new_str;
if (str) {
new_str = malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
} else
new_str = NULL;
return new_str;
}
int main()
{
int major,minor,micro;
int libmikmod_major_version,libmikmod_minor_version,libmikmod_micro_version;
char *tmp_version;
system("touch conf.mikmodtest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_libmikmod_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_libmikmod_version");
exit(1);
}
libmikmod_major_version=(MikMod_GetVersion() >> 16) & 255;
libmikmod_minor_version=(MikMod_GetVersion() >> 8) & 255;
libmikmod_micro_version=(MikMod_GetVersion() ) & 255;
if ((libmikmod_major_version != $libmikmod_config_major_version) ||
(libmikmod_minor_version != $libmikmod_config_minor_version) ||
(libmikmod_micro_version != $libmikmod_config_micro_version))
{
printf("\n*** 'libmikmod-config --version' returned %d.%d.%d, but libmikmod (%d.%d.%d)\n",
$libmikmod_config_major_version, $libmikmod_config_minor_version, $libmikmod_config_micro_version,
libmikmod_major_version, libmikmod_minor_version, libmikmod_micro_version);
printf ("*** was found! If libmikmod-config was correct, then it is best\n");
printf ("*** to remove the old version of libmikmod. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If libmikmod-config was wrong, set the environment variable LIBMIKMOD_CONFIG\n");
printf("*** to point to the correct copy of libmikmod-config, and remove the file config.cache\n");
printf("*** before re-running configure\n");
}
else if ((libmikmod_major_version != LIBMIKMOD_VERSION_MAJOR) ||
(libmikmod_minor_version != LIBMIKMOD_VERSION_MINOR) ||
(libmikmod_micro_version != LIBMIKMOD_REVISION))
{
printf("*** libmikmod header files (version %d.%d.%d) do not match\n",
LIBMIKMOD_VERSION_MAJOR, LIBMIKMOD_VERSION_MINOR, LIBMIKMOD_REVISION);
printf("*** library (version %d.%d.%d)\n",
libmikmod_major_version, libmikmod_minor_version, libmikmod_micro_version);
}
else
{
if ((libmikmod_major_version > major) ||
((libmikmod_major_version == major) && (libmikmod_minor_version > minor)) ||
((libmikmod_major_version == major) && (libmikmod_minor_version == minor) && (libmikmod_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of libmikmod (%d.%d.%d) was found.\n",
libmikmod_major_version, libmikmod_minor_version, libmikmod_micro_version);
printf("*** You need a version of libmikmod newer than %d.%d.%d.\n",
major, minor, micro);
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the libmikmod-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of libmikmod, but you can also set the LIBMIKMOD_CONFIG environment to point to the\n");
printf("*** correct copy of libmikmod-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
}
],, no_libmikmod=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
AC_LANG_RESTORE
fi
fi
if test "x$no_libmikmod" = x ; then
AC_MSG_RESULT([yes, `$LIBMIKMOD_CONFIG --version`])
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$LIBMIKMOD_CONFIG" = "no" ; then
echo "*** The libmikmod-config script installed by libmikmod could not be found"
echo "*** If libmikmod was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the LIBMIKMOD_CONFIG environment variable to the"
echo "*** full path to libmikmod-config."
else
if test -f conf.mikmodtest ; then
:
else
echo "*** Could not run libmikmod test program, checking why..."
CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS"
LIBS="$LIBS $LIBMIKMOD_LIBS"
AC_LANG_SAVE
AC_LANG_C
AC_TRY_LINK([
#include <mikmod.h>
#include <stdio.h>
], [ return (MikMod_GetVersion()!=0); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding libmikmod or finding the wrong"
echo "*** version of libmikmod. If it is not finding libmikmod, 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 libmikmod was incorrectly installed"
echo "*** or that you have moved libmikmod since it was installed. In the latter case, you"
echo "*** may want to edit the libmikmod-config script: $LIBMIKMOD_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
AC_LANG_RESTORE
fi
fi
LIBMIKMOD_CFLAGS=""
LIBMIKMOD_LIBS=""
LIBMIKMOD_LDADD=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(LIBMIKMOD_CFLAGS)
AC_SUBST(LIBMIKMOD_LIBS)
AC_SUBST(LIBMIKMOD_LDADD)
rm -f conf.mikmodtest
])
# Configure paths for libogg
# Jack Moffitt <jack@icecast.org> 10-21-2000
# Shamelessly stolen from Owen Taylor and Manish Singh
dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
dnl
AC_DEFUN([XIPH_PATH_OGG],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(ogg,[ --with-ogg=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
AC_ARG_WITH(ogg-libraries,[ --with-ogg-libraries=DIR Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="")
AC_ARG_WITH(ogg-includes,[ --with-ogg-includes=DIR Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="")
AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
if test "x$ogg_libraries" != "x" ; then
OGG_LIBS="-L$ogg_libraries"
elif test "x$ogg_prefix" != "x" ; then
OGG_LIBS="-L$ogg_prefix/lib"
elif test "x$prefix" != "xNONE" ; then
OGG_LIBS="-L$prefix/lib"
fi
OGG_LIBS="$OGG_LIBS -logg"
if test "x$ogg_includes" != "x" ; then
OGG_CFLAGS="-I$ogg_includes"
elif test "x$ogg_prefix" != "x" ; then
OGG_CFLAGS="-I$ogg_prefix/include"
elif test "x$prefix" != "xNONE"; then
OGG_CFLAGS="-I$prefix/include"
fi
AC_MSG_CHECKING(for Ogg)
no_ogg=""
if test "x$enable_oggtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $OGG_CFLAGS"
LIBS="$LIBS $OGG_LIBS"
dnl
dnl Now check if the installed Ogg is sufficiently new.
dnl
rm -f conf.oggtest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ogg/ogg.h>
int main ()
{
system("touch conf.oggtest");
return 0;
}
],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
if test "x$no_ogg" = "x" ; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
if test -f conf.oggtest ; then
:
else
echo "*** Could not run Ogg test program, checking why..."
CFLAGS="$CFLAGS $OGG_CFLAGS"
LIBS="$LIBS $OGG_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <ogg/ogg.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding Ogg or finding the wrong"
echo "*** version of Ogg. If it is not finding Ogg, 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 Ogg was incorrectly installed"
echo "*** or that you have moved Ogg since it was installed." ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
OGG_CFLAGS=""
OGG_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(OGG_CFLAGS)
AC_SUBST(OGG_LIBS)
rm -f conf.oggtest
])
AM_CPPFLAGS = $(GLIB_CFLAGS)
bin_PROGRAMS = mpd
SUBDIRS = $(MP4FF_SUBDIR)
......@@ -196,8 +194,17 @@ mpd_SOURCES = \
mpd_CFLAGS = $(MPD_CFLAGS)
mpd_CPPFLAGS = \
$(AO_CFLAGS) $(ALSA_CFLAGS) \
$(OGGVORBIS_CFLAGS) \
$(patsubst -I%/FLAC,-I%,$(FLAC_CFLAGS)) \
$(AUDIOFILE_CFLAGS) $(LIBMIKMOD_CFLAGS) \
$(GLIB_CFLAGS)
mpd_LDADD = $(MPD_LIBS) $(MP4FF_LIB) \
$(GLIB_LIBS)
$(AO_LIBS) $(ALSA_LIBS) \
$(OGGVORBIS_LIBS) $(FLAC_LIBS) \
$(AUDIOFILE_LIBS) $(LIBMIKMOD_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