mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Karl's simplified and cleaned up ogg/vorbis macros. This will push back
release a bit unfortunately. svn path=/trunk/m4/; revision=4958
This commit is contained in:
parent
e19a7af1b1
commit
49c6946c07
140
m4/ogg.m4
140
m4/ogg.m4
@ -1,110 +1,54 @@
|
|||||||
# Configure paths for libogg
|
# Configure paths for libogg
|
||||||
|
# updated by Karl Heyes 10-Jun-2003
|
||||||
# Jack Moffitt <jack@icecast.org> 10-21-2000
|
# Jack Moffitt <jack@icecast.org> 10-21-2000
|
||||||
# Shamelessly stolen from Owen Taylor and Manish Singh
|
# Shamelessly stolen from Owen Taylor and Manish Singh
|
||||||
|
|
||||||
dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||||
dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
|
dnl Test for libogg, and define OGG_CFLAGS OGG_LDFLAGS and OGG_LIBS
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(XIPH_PATH_OGG,
|
AC_DEFUN(XIPH_PATH_OGG,
|
||||||
[dnl
|
[dnl
|
||||||
dnl Get the cflags and libraries
|
AC_ARG_VAR([OGG_PREFIX],[path to ogg installation])
|
||||||
dnl
|
AC_ARG_WITH(ogg,
|
||||||
AC_ARG_WITH([ogg],
|
[AC_HELP_STRING([--with-ogg=PREFIX],
|
||||||
[ --with-ogg=PFX prefix where libogg is installed (optional)],
|
[Prefix where libogg is installed (optional)])],
|
||||||
[ogg_prefix="$withval"], [ogg_prefix=""])
|
ogg_prefix="$withval",
|
||||||
AC_ARG_WITH([ogg-libraries],
|
ogg_prefix="$OGG_PREFIX"
|
||||||
[ --with-ogg-libraries=DIR directory where libogg library is installed (optional)], [ogg_libraries="$withval"], [ogg_libraries=""])
|
)
|
||||||
AC_ARG_WITH([ogg-includes],
|
if test "x$ogg_prefix" = "x"; then
|
||||||
[ --with-ogg-includes=DIR directory where libogg header files are
|
if test "x$prefix" = "xNONE"; then
|
||||||
installed (optional)],
|
ogg_prefix=/usr/local
|
||||||
[ogg_includes="$withval"], [ogg_includes=""])
|
else
|
||||||
AC_ARG_ENABLE([oggtest],
|
ogg_prefix="$prefix"
|
||||||
[ --disable-oggtest do not try to compile and run a test Ogg program],,
|
fi
|
||||||
[enable_oggtest=yes])
|
fi
|
||||||
|
|
||||||
if test "x$ogg_libraries" != "x" ; then
|
XIPH_GCC_INCLUDE_WARNING([$ogg_prefix/include],,
|
||||||
OGG_LIBS="-L$ogg_libraries"
|
[OGG_CFLAGS="-I$ogg_prefix/include"
|
||||||
elif test "x$ogg_prefix" != "x" ; then
|
OGG_LDFLAGS="-L$ogg_prefix/lib"
|
||||||
OGG_LIBS="-L$ogg_prefix/lib"
|
])
|
||||||
elif test "x$prefix" != "xNONE" ; then
|
OGG_LIBS="-logg"
|
||||||
OGG_LIBS="-L$prefix/lib"
|
|
||||||
fi
|
|
||||||
|
|
||||||
OGG_LIBS="$OGG_LIBS -logg"
|
#
|
||||||
|
# check if the installed Ogg is sufficiently new.
|
||||||
|
#
|
||||||
|
AC_MSG_CHECKING([checking for ogg_sync_init in libogg])
|
||||||
|
ac_save_CFLAGS="$CFLAGS"
|
||||||
|
ac_save_LIBS="$LIBS"
|
||||||
|
ac_save_LDFLAGS="$LDFLAGS"
|
||||||
|
CFLAGS="$CFLAGS $OGG_CFLAGS"
|
||||||
|
LIBS="$LIBS $OGG_LIBS"
|
||||||
|
LDFLAGS="$LDFLAGS $OGG_LDFLAGS"
|
||||||
|
AC_TRY_LINK_FUNC(ogg_sync_init,
|
||||||
|
[ifelse([$1],, [AC_MSG_RESULT([ok])], [$1])],
|
||||||
|
[AC_TRY_LINK([#include <ogg/ogg.h>],,
|
||||||
|
[ ifelse([$2], ,[AC_MSG_ERROR([found, but needs updating])], [$2])],
|
||||||
|
[ ifelse([$2], ,[AC_MSG_ERROR([not found, maybe you need to set LD_LIBRARY_PATH or /etc/ld.so.conf])], [$2])])
|
||||||
|
])
|
||||||
|
CFLAGS="$ac_save_CFLAGS"
|
||||||
|
LIBS="$ac_save_LIBS"
|
||||||
|
|
||||||
if test "x$ogg_includes" != "x" ; then
|
AC_SUBST(OGG_CFLAGS)
|
||||||
OGG_CFLAGS="-I$ogg_includes"
|
AC_SUBST(OGG_LDFLAGS)
|
||||||
elif test "x$ogg_prefix" != "x" ; then
|
AC_SUBST(OGG_LIBS)
|
||||||
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
|
|
||||||
])
|
])
|
||||||
|
182
m4/vorbis.m4
182
m4/vorbis.m4
@ -1,132 +1,82 @@
|
|||||||
# Configure paths for libvorbis
|
# Configure paths for libvorbis
|
||||||
# Jack Moffitt <jack@icecast.org> 10-21-2000
|
# Jack Moffitt <jack@icecast.org> 10-21-2000
|
||||||
|
# updated by Karl Heyes 31-Mar-2003
|
||||||
# Shamelessly stolen from Owen Taylor and Manish Singh
|
# 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 XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||||
dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
|
dnl Test for libvorbis, and define VORBIS_CFLAGS VORBIS_LIBS
|
||||||
|
dnl VORBIS_VORBISENC_LIBS VORBIS_VORBISFILE_LIBS VORBIS_LDFLAGS
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(XIPH_PATH_VORBIS,
|
|
||||||
[dnl
|
AC_DEFUN([XIPH_PATH_VORBIS],
|
||||||
dnl Get the cflags and libraries
|
[
|
||||||
|
XIPH_PATH_OGG([$1],[$2])
|
||||||
|
|
||||||
|
dnl Get the cflags and libraries for vorbis
|
||||||
dnl
|
dnl
|
||||||
AC_ARG_WITH([vorbis],
|
AC_ARG_VAR([VORBIS_PREFIX],[path to vorbis installation])
|
||||||
[ --with-vorbis=PFX prefix where libvorbis is installed (optional)],
|
AC_ARG_WITH(vorbis,
|
||||||
[vorbis_prefix="$withval"], [vorbis_prefix=""])
|
AC_HELP_STRING([--with-vorbis=PREFIX],
|
||||||
AC_ARG_WITH([vorbis-libraries],
|
[Prefix where libvorbis is installed (optional)]),
|
||||||
[ --with-vorbis-libraries=DIR directory where libvorbis library is
|
vorbis_prefix="$withval",
|
||||||
installed (optional)],
|
vorbis_prefix="$VORBIS_PREFIX"
|
||||||
[vorbis_libraries="$withval"], [vorbis_libraries=""])
|
)
|
||||||
AC_ARG_WITH([vorbis-includes],
|
if test "x$vorbis_prefix" = "x"; then
|
||||||
[ --with-vorbis-includes=DIR directory where libvorbis header files are
|
if test "x$prefix" = "xNONE"; then
|
||||||
installed (optional)],
|
vorbis_prefix="/usr/local"
|
||||||
[vorbis_includes="$withval"], [vorbis_includes=""])
|
else
|
||||||
AC_ARG_ENABLE([vorbistest],
|
vorbis_prefix="$prefix"
|
||||||
[ --disable-vorbistest do not try to compile and run a test Vorbis program],,
|
fi
|
||||||
[enable_vorbistest=yes])
|
fi
|
||||||
|
|
||||||
if test "x$vorbis_libraries" != "x" ; then
|
VORBIS_CFLAGS="$OGG_CFLAGS"
|
||||||
VORBIS_LIBS="-L$vorbis_libraries"
|
VORBIS_LDFLAGS="$OGG_LDFLAGS"
|
||||||
elif test "x$vorbis_prefix" != "x" ; then
|
if test "x$vorbis_prefix" != "x$ogg_prefix"; then
|
||||||
VORBIS_LIBS="-L$vorbis_prefix/lib"
|
XIPH_GCC_INCLUDE_WARNING("$vorbis_prefix/include",,
|
||||||
elif test "x$prefix" != "xNONE"; then
|
[VORBIS_CFLAGS="$VORBIS_CFLAGS -I$vorbis_prefix/include"
|
||||||
VORBIS_LIBS="-L$prefix/lib"
|
VORBIS_LDFLAGS="-L$vorbis_prefix/lib $VORBIS_LDFLAGS"
|
||||||
fi
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
|
VORBIS_LIBS="-lvorbis"
|
||||||
VORBISFILE_LIBS="-lvorbisfile"
|
VORBISFILE_LIBS="-lvorbisfile"
|
||||||
VORBISENC_LIBS="-lvorbisenc"
|
VORBISENC_LIBS="-lvorbisenc"
|
||||||
|
|
||||||
if test "x$vorbis_includes" != "x" ; then
|
ac_save_LIBS="$LIBS"
|
||||||
VORBIS_CFLAGS="-I$vorbis_includes"
|
ac_save_LDFLAGS="$LDFLAGS"
|
||||||
elif test "x$vorbis_prefix" != "x" ; then
|
LDFLAGS="$LDFLAGS $VORBIS_LDFLAGS"
|
||||||
VORBIS_CFLAGS="-I$vorbis_prefix/include"
|
LIBS="$LIBS $VORBIS_LIBS"
|
||||||
elif test "x$prefix" != "xNONE"; then
|
AC_MSG_CHECKING([checking for libvorbis])
|
||||||
VORBIS_CFLAGS="-I$prefix/include"
|
AC_TRY_LINK_FUNC(vorbis_info_init, [AC_MSG_RESULT([ok])],
|
||||||
fi
|
[LIBS="$LIBS $OGG_LIBS -lm"
|
||||||
|
AC_TRY_LINK_FUNC(vorbis_info_init,
|
||||||
|
[AC_MSG_RESULT([found, adding extra libs])
|
||||||
|
VORBIS_LIBS="$VORBIS_LIBS $OGG_LIBS -lm"],
|
||||||
|
[ifelse([$2], , AC_MSG_ERROR([Unable to link to libvorbis]), [$2])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
LIBS="$ac_save_LIBS"
|
||||||
|
LDFLAGS="$ac_save_LDFLAGS"
|
||||||
|
|
||||||
AC_MSG_CHECKING(for Vorbis)
|
#
|
||||||
no_vorbis=""
|
# Now check if the installed Vorbis is sufficiently new.
|
||||||
|
#
|
||||||
|
ac_save_CFLAGS="$CFLAGS"
|
||||||
|
ac_save_LIBS="$LIBS"
|
||||||
|
CFLAGS="$CFLAGS $VORBIS_CFLAGS"
|
||||||
|
LIBS="$LIBS $VORBIS_LDFLAGS $VORBIS_LIBS"
|
||||||
|
|
||||||
|
AC_CHECK_TYPES([struct ovectl_ratemanage_arg],[vorbis_ok=yes],
|
||||||
if test "x$enable_vorbistest" = "xyes" ; then
|
[ifelse([$2], ,[AC_MSG_ERROR([libvorbis needs updating])], [$2])], [
|
||||||
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/codec.h>
|
||||||
#include <vorbis/vorbisenc.h>
|
#include <vorbis/vorbisenc.h>
|
||||||
|
])
|
||||||
int main ()
|
CFLAGS="$ac_save_CFLAGS"
|
||||||
{
|
LIBS="$ac_save_LIBS"
|
||||||
vorbis_block vb;
|
AC_SUBST(VORBIS_CFLAGS)
|
||||||
vorbis_dsp_state vd;
|
AC_SUBST(VORBIS_LDFLAGS)
|
||||||
vorbis_info vi;
|
AC_SUBST(VORBIS_LIBS)
|
||||||
|
AC_SUBST(VORBISFILE_LIBS)
|
||||||
vorbis_info_init (&vi);
|
AC_SUBST(VORBISENC_LIBS)
|
||||||
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
|
|
||||||
])
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user