diff options
author | J. Alexander Treuman <jat@spatialrift.net> | 2007-05-28 13:09:41 +0000 |
---|---|---|
committer | J. Alexander Treuman <jat@spatialrift.net> | 2007-05-28 13:09:41 +0000 |
commit | 6e5c90e098005b66f86a9fd99a26956cbaa0c392 (patch) | |
tree | d5699855fe945b0b02e511c87def301d119ae922 /trunk/m4 | |
parent | 28c7a91d2462128a7df9a417cbbd59cad89ba19b (diff) | |
download | mpd-6e5c90e098005b66f86a9fd99a26956cbaa0c392.tar.gz mpd-6e5c90e098005b66f86a9fd99a26956cbaa0c392.tar.xz mpd-6e5c90e098005b66f86a9fd99a26956cbaa0c392.zip |
Re-tagging 0.13.0 release to fix a couple of bugs with the tarball.
git-svn-id: https://svn.musicpd.org/mpd/tags/release-0.13.0@6325 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | trunk/m4/alsa.m4 | 142 | ||||
-rw-r--r-- | trunk/m4/ao.m4 | 112 | ||||
-rw-r--r-- | trunk/m4/audiofile.m4 | 179 | ||||
-rw-r--r-- | trunk/m4/codeset.m4 | 23 | ||||
-rw-r--r-- | trunk/m4/libFLAC.m4 | 104 | ||||
-rw-r--r-- | trunk/m4/libOggFLAC.m4 | 104 | ||||
-rw-r--r-- | trunk/m4/libmikmod.m4 | 207 | ||||
-rw-r--r-- | trunk/m4/ogg.m4 | 102 | ||||
-rw-r--r-- | trunk/m4/pkg.m4 | 157 | ||||
-rw-r--r-- | trunk/m4/shout.m4 | 90 | ||||
-rw-r--r-- | trunk/m4/vorbis.m4 | 122 |
11 files changed, 1342 insertions, 0 deletions
diff --git a/trunk/m4/alsa.m4 b/trunk/m4/alsa.m4 new file mode 100644 index 000000000..ea5730cf4 --- /dev/null +++ b/trunk/m4/alsa.m4 @@ -0,0 +1,142 @@ +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) +]) + diff --git a/trunk/m4/ao.m4 b/trunk/m4/ao.m4 new file mode 100644 index 000000000..a852ad86c --- /dev/null +++ b/trunk/m4/ao.m4 @@ -0,0 +1,112 @@ +# 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 +]) diff --git a/trunk/m4/audiofile.m4 b/trunk/m4/audiofile.m4 new file mode 100644 index 000000000..86176c5d4 --- /dev/null +++ b/trunk/m4/audiofile.m4 @@ -0,0 +1,179 @@ +# 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, µ) != 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 +]) diff --git a/trunk/m4/codeset.m4 b/trunk/m4/codeset.m4 new file mode 100644 index 000000000..59535ebcf --- /dev/null +++ b/trunk/m4/codeset.m4 @@ -0,0 +1,23 @@ +# codeset.m4 serial AM1 (gettext-0.10.40) +dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([AM_LANGINFO_CODESET], +[ + AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include <langinfo.h>], + [char* cs = nl_langinfo(CODESET);], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) + fi +]) diff --git a/trunk/m4/libFLAC.m4 b/trunk/m4/libFLAC.m4 new file mode 100644 index 000000000..8f111b2fa --- /dev/null +++ b/trunk/m4/libFLAC.m4 @@ -0,0 +1,104 @@ +# 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 +]) diff --git a/trunk/m4/libOggFLAC.m4 b/trunk/m4/libOggFLAC.m4 new file mode 100644 index 000000000..a90c69bb8 --- /dev/null +++ b/trunk/m4/libOggFLAC.m4 @@ -0,0 +1,104 @@ +# Configure paths for libOggFLAC +# "Inspired" by ogg.m4 + +dnl AM_PATH_LIBOGGFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Test for libOggFLAC, and define LIBOGGFLAC_CFLAGS and LIBOGGFLAC_LIBS +dnl +AC_DEFUN([AM_PATH_LIBOGGFLAC], +[dnl +dnl Get the cflags and libraries +dnl +AC_ARG_WITH(libOggFLAC,[ --with-libOggFLAC=PFX Prefix where libOggFLAC is installed (optional)], libOggFLAC_prefix="$withval", libOggFLAC_prefix="") +AC_ARG_WITH(libOggFLAC-libraries,[ --with-libOggFLAC-libraries=DIR Directory where libOggFLAC library is installed (optional)], libOggFLAC_libraries="$withval", libOggFLAC_libraries="") +AC_ARG_WITH(libOggFLAC-includes,[ --with-libOggFLAC-includes=DIR Directory where libOggFLAC header files are installed (optional)], libOggFLAC_includes="$withval", libOggFLAC_includes="") +AC_ARG_ENABLE(libOggFLACtest, [ --disable-libOggFLACtest Do not try to compile and run a test libOggFLAC program],, enable_libOggFLACtest=yes) + + if test "x$libOggFLAC_libraries" != "x" ; then + LIBOGGFLAC_LIBS="-L$libOggFLAC_libraries" + elif test "x$libOggFLAC_prefix" != "x" ; then + LIBOGGFLAC_LIBS="-L$libOggFLAC_prefix/lib" + elif test "x$prefix" != "xNONE" ; then + LIBOGGFLAC_LIBS="-L$libdir" + fi + + LIBOGGFLAC_LIBS="$LIBOGGFLAC_LIBS -lOggFLAC -lFLAC -lm" + + if test "x$libOggFLAC_includes" != "x" ; then + LIBOGGFLAC_CFLAGS="-I$libOggFLAC_includes" + elif test "x$libOggFLAC_prefix" != "x" ; then + LIBOGGFLAC_CFLAGS="-I$libOggFLAC_prefix/include" + elif test "x$prefix" != "xNONE"; then + LIBOGGFLAC_CFLAGS="-I$prefix/include" + fi + + AC_MSG_CHECKING(for libOggFLAC) + no_libOggFLAC="" + + + if test "x$enable_libOggFLACtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" + CXXFLAGS="$CXXFLAGS $LIBOGGFLAC_CFLAGS" + LIBS="$LIBS $LIBOGGFLAC_LIBS" +dnl +dnl Now check if the installed libOggFLAC is sufficiently new. +dnl + rm -f conf.libOggFLACtest + AC_TRY_RUN([ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <OggFLAC/stream_decoder.h> + +int main () +{ + system("touch conf.libOggFLACtest"); + return 0; +} + +],, no_libOggFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + + if test "x$no_libOggFLAC" = "x" ; then + AC_MSG_RESULT(yes) + ifelse([$1], , :, [$1]) + else + AC_MSG_RESULT(no) + if test -f conf.libOggFLACtest ; then + : + else + echo "*** Could not run libOggFLAC test program, checking why..." + CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" + LIBS="$LIBS $LIBOGGFLAC_LIBS" + AC_TRY_LINK([ +#include <stdio.h> +#include <OggFLAC/stream_decoder.h> +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding libOggFLAC or finding the wrong" + echo "*** version of libOggFLAC. If it is not finding libOggFLAC, 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 libOggFLAC was incorrectly installed" + echo "*** or that you have moved libOggFLAC since it was installed. In the latter case, you" + echo "*** may want to edit the libOggFLAC-config script: $LIBOGGFLAC_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + LIBOGGFLAC_CFLAGS="" + LIBOGGFLAC_LIBS="" + ifelse([$2], , :, [$2]) + fi + AC_SUBST(LIBOGGFLAC_CFLAGS) + AC_SUBST(LIBOGGFLAC_LIBS) + rm -f conf.libOggFLACtest +]) diff --git a/trunk/m4/libmikmod.m4 b/trunk/m4/libmikmod.m4 new file mode 100644 index 000000000..18feebec0 --- /dev/null +++ b/trunk/m4/libmikmod.m4 @@ -0,0 +1,207 @@ +# 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, µ) != 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 +]) diff --git a/trunk/m4/ogg.m4 b/trunk/m4/ogg.m4 new file mode 100644 index 000000000..0e1f1abf5 --- /dev/null +++ b/trunk/m4/ogg.m4 @@ -0,0 +1,102 @@ +# 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 +]) diff --git a/trunk/m4/pkg.m4 b/trunk/m4/pkg.m4 new file mode 100644 index 000000000..c29b6c057 --- /dev/null +++ b/trunk/m4/pkg.m4 @@ -0,0 +1,157 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES diff --git a/trunk/m4/shout.m4 b/trunk/m4/shout.m4 new file mode 100644 index 000000000..4eba5c09b --- /dev/null +++ b/trunk/m4/shout.m4 @@ -0,0 +1,90 @@ +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 diff --git a/trunk/m4/vorbis.m4 b/trunk/m4/vorbis.m4 new file mode 100644 index 000000000..300cc6c7d --- /dev/null +++ b/trunk/m4/vorbis.m4 @@ -0,0 +1,122 @@ +# 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 +]) |