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