annotate src/opus-1.3/opus.m4 @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents 7aeed7906520
children
rev   line source
Chris@69 1 # Configure paths for libopus
Chris@69 2 # Gregory Maxwell <greg@xiph.org> 08-30-2012
Chris@69 3 # Shamelessly stolen from Jack Moffitt (libogg) who
Chris@69 4 # Shamelessly stole from Owen Taylor and Manish Singh
Chris@69 5
Chris@69 6 dnl XIPH_PATH_OPUS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
Chris@69 7 dnl Test for libopus, and define OPUS_CFLAGS and OPUS_LIBS
Chris@69 8 dnl
Chris@69 9 AC_DEFUN([XIPH_PATH_OPUS],
Chris@69 10 [dnl
Chris@69 11 dnl Get the cflags and libraries
Chris@69 12 dnl
Chris@69 13 AC_ARG_WITH(opus,AC_HELP_STRING([--with-opus=PFX],[Prefix where opus is installed (optional)]), opus_prefix="$withval", opus_prefix="")
Chris@69 14 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="")
Chris@69 15 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="")
Chris@69 16 AC_ARG_ENABLE(opustest,AC_HELP_STRING([--disable-opustest],[Do not try to compile and run a test opus program]),, enable_opustest=yes)
Chris@69 17
Chris@69 18 if test "x$opus_libraries" != "x" ; then
Chris@69 19 OPUS_LIBS="-L$opus_libraries"
Chris@69 20 elif test "x$opus_prefix" = "xno" || test "x$opus_prefix" = "xyes" ; then
Chris@69 21 OPUS_LIBS=""
Chris@69 22 elif test "x$opus_prefix" != "x" ; then
Chris@69 23 OPUS_LIBS="-L$opus_prefix/lib"
Chris@69 24 elif test "x$prefix" != "xNONE" ; then
Chris@69 25 OPUS_LIBS="-L$prefix/lib"
Chris@69 26 fi
Chris@69 27
Chris@69 28 if test "x$opus_prefix" != "xno" ; then
Chris@69 29 OPUS_LIBS="$OPUS_LIBS -lopus"
Chris@69 30 fi
Chris@69 31
Chris@69 32 if test "x$opus_includes" != "x" ; then
Chris@69 33 OPUS_CFLAGS="-I$opus_includes"
Chris@69 34 elif test "x$opus_prefix" = "xno" || test "x$opus_prefix" = "xyes" ; then
Chris@69 35 OPUS_CFLAGS=""
Chris@69 36 elif test "x$opus_prefix" != "x" ; then
Chris@69 37 OPUS_CFLAGS="-I$opus_prefix/include"
Chris@69 38 elif test "x$prefix" != "xNONE"; then
Chris@69 39 OPUS_CFLAGS="-I$prefix/include"
Chris@69 40 fi
Chris@69 41
Chris@69 42 AC_MSG_CHECKING(for Opus)
Chris@69 43 if test "x$opus_prefix" = "xno" ; then
Chris@69 44 no_opus="disabled"
Chris@69 45 enable_opustest="no"
Chris@69 46 else
Chris@69 47 no_opus=""
Chris@69 48 fi
Chris@69 49
Chris@69 50
Chris@69 51 if test "x$enable_opustest" = "xyes" ; then
Chris@69 52 ac_save_CFLAGS="$CFLAGS"
Chris@69 53 ac_save_LIBS="$LIBS"
Chris@69 54 CFLAGS="$CFLAGS $OPUS_CFLAGS"
Chris@69 55 LIBS="$LIBS $OPUS_LIBS"
Chris@69 56 dnl
Chris@69 57 dnl Now check if the installed Opus is sufficiently new.
Chris@69 58 dnl
Chris@69 59 rm -f conf.opustest
Chris@69 60 AC_TRY_RUN([
Chris@69 61 #include <stdio.h>
Chris@69 62 #include <stdlib.h>
Chris@69 63 #include <string.h>
Chris@69 64 #include <opus.h>
Chris@69 65
Chris@69 66 int main ()
Chris@69 67 {
Chris@69 68 system("touch conf.opustest");
Chris@69 69 return 0;
Chris@69 70 }
Chris@69 71
Chris@69 72 ],, no_opus=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
Chris@69 73 CFLAGS="$ac_save_CFLAGS"
Chris@69 74 LIBS="$ac_save_LIBS"
Chris@69 75 fi
Chris@69 76
Chris@69 77 if test "x$no_opus" = "xdisabled" ; then
Chris@69 78 AC_MSG_RESULT(no)
Chris@69 79 ifelse([$2], , :, [$2])
Chris@69 80 elif test "x$no_opus" = "x" ; then
Chris@69 81 AC_MSG_RESULT(yes)
Chris@69 82 ifelse([$1], , :, [$1])
Chris@69 83 else
Chris@69 84 AC_MSG_RESULT(no)
Chris@69 85 if test -f conf.opustest ; then
Chris@69 86 :
Chris@69 87 else
Chris@69 88 echo "*** Could not run Opus test program, checking why..."
Chris@69 89 CFLAGS="$CFLAGS $OPUS_CFLAGS"
Chris@69 90 LIBS="$LIBS $OPUS_LIBS"
Chris@69 91 AC_TRY_LINK([
Chris@69 92 #include <stdio.h>
Chris@69 93 #include <opus.h>
Chris@69 94 ], [ return 0; ],
Chris@69 95 [ echo "*** The test program compiled, but did not run. This usually means"
Chris@69 96 echo "*** that the run-time linker is not finding Opus or finding the wrong"
Chris@69 97 echo "*** version of Opus. If it is not finding Opus, you'll need to set your"
Chris@69 98 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
Chris@69 99 echo "*** to the installed location Also, make sure you have run ldconfig if that"
Chris@69 100 echo "*** is required on your system"
Chris@69 101 echo "***"
Chris@69 102 echo "*** If you have an old version installed, it is best to remove it, although"
Chris@69 103 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
Chris@69 104 [ echo "*** The test program failed to compile or link. See the file config.log for the"
Chris@69 105 echo "*** exact error that occurred. This usually means Opus was incorrectly installed"
Chris@69 106 echo "*** or that you have moved Opus since it was installed." ])
Chris@69 107 CFLAGS="$ac_save_CFLAGS"
Chris@69 108 LIBS="$ac_save_LIBS"
Chris@69 109 fi
Chris@69 110 OPUS_CFLAGS=""
Chris@69 111 OPUS_LIBS=""
Chris@69 112 ifelse([$2], , :, [$2])
Chris@69 113 fi
Chris@69 114 AC_SUBST(OPUS_CFLAGS)
Chris@69 115 AC_SUBST(OPUS_LIBS)
Chris@69 116 rm -f conf.opustest
Chris@69 117 ])