dnl Test for libopus, and define OPUS_CFLAGS and OPUS_LIBS
dnl
AC_DEFUN([XIPH_PATH_OPUS],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(opus,AC_HELP_STRING([--with-opus=PFX],[Prefix where opus is installed (optional)]), opus_prefix="$withval", opus_prefix="")
AC_ARG_WITH(opus-libraries,AC_HELP_STRING([--with-opus-libraries=DIR],[Directory where the opus library is installed (optional)]), opus_libraries="$withval", opus_libraries="")
AC_ARG_WITH(opus-includes,AC_HELP_STRING([--with-opus-includes=DIR],[Directory where the opus header files are installed (optional)]), opus_includes="$withval", opus_includes="")
AC_ARG_ENABLE(opustest,AC_HELP_STRING([--disable-opustest],[Do not try to compile and run a test opus program]),, enable_opustest=yes)
if test "x$opus_libraries" != "x" ; then
OPUS_LIBS="-L$opus_libraries"
elif test "x$opus_prefix" = "xno" || test "x$opus_prefix" = "xyes" ; then
OPUS_LIBS=""
elif test "x$opus_prefix" != "x" ; then
OPUS_LIBS="-L$opus_prefix/lib"
elif test "x$prefix" != "xNONE" ; then
OPUS_LIBS="-L$prefix/lib"
fi
if test "x$opus_prefix" != "xno" ; then
OPUS_LIBS="$OPUS_LIBS -lopus"
fi
if test "x$opus_includes" != "x" ; then
OPUS_CFLAGS="-I$opus_includes"
elif test "x$opus_prefix" = "xno" || test "x$opus_prefix" = "xyes" ; then
OPUS_CFLAGS=""
elif test "x$opus_prefix" != "x" ; then
OPUS_CFLAGS="-I$opus_prefix/include"
elif test "x$prefix" != "xNONE"; then
OPUS_CFLAGS="-I$prefix/include"
fi
AC_MSG_CHECKING(for Opus)
if test "x$opus_prefix" = "xno" ; then
no_opus="disabled"
enable_opustest="no"
else
no_opus=""
fi
if test "x$enable_opustest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $OPUS_CFLAGS"
LIBS="$LIBS $OPUS_LIBS"
dnl
dnl Now check if the installed Opus is sufficiently new.