1# Configure paths for libopusenc 2# Jean-Marc Valin <jmvalin@jmvalin.ca> 11-12-2017 3# Jack Moffitt <jack@icecast.org> 10-21-2000 4# Shamelessly stolen from Owen Taylor and Manish Singh 5 6dnl XIPH_PATH_LIBOPUSENC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) 7dnl Test for libopusenc, and define LIBOPUSENC_CFLAGS and LIBOPUSENC_LIBS 8dnl 9AC_DEFUN([XIPH_PATH_LIBOPUSENC], 10[dnl 11dnl Get the cflags and libraries 12dnl 13AC_ARG_WITH(libopusenc,AC_HELP_STRING([--with-libopusenc=PFX],[Prefix where libopusenc is installed (optional)]), libopusenc_prefix="$withval", libopusenc_prefix="") 14AC_ARG_WITH(libopusenc-libraries,AC_HELP_STRING([--with-libopusenc-libraries=DIR],[Directory where libopusenc library is installed (optional)]), libopusenc_libraries="$withval", libopusenc_libraries="") 15AC_ARG_WITH(libopusenc-includes,AC_HELP_STRING([--with-libopusenc-includes=DIR],[Directory where libopusenc header files are installed (optional)]), libopusenc_includes="$withval", libopusenc_includes="") 16AC_ARG_ENABLE(libopusenctest,AC_HELP_STRING([--disable-libopusenctest],[Do not try to compile and run a test libopusenc program]),, enable_libopusenctest=yes) 17 18 if test "x$libopusenc_libraries" != "x" ; then 19 LIBOPUSENC_LIBS="-L$libopusenc_libraries" 20 elif test "x$libopusenc_prefix" = "xno" || test "x$libopusenc_prefix" = "xyes" ; then 21 LIBOPUSENC_LIBS="" 22 elif test "x$libopusenc_prefix" != "x" ; then 23 LIBOPUSENC_LIBS="-L$libopusenc_prefix/lib" 24 elif test "x$prefix" != "xNONE" ; then 25 LIBOPUSENC_LIBS="-L$prefix/lib" 26 fi 27 28 if test "x$libopusenc_prefix" != "xno" ; then 29 LIBOPUSENC_LIBS="$LIBOPUSENC_LIBS -lopusenc" 30 fi 31 32 if test "x$libopusenc_includes" != "x" ; then 33 LIBOPUSENC_CFLAGS="-I$libopusenc_includes" 34 elif test "x$libopusenc_prefix" = "xno" || test "x$libopusenc_prefix" = "xyes" ; then 35 LIBOPUSENC_CFLAGS="" 36 elif test "x$libopusenc_prefix" != "x" ; then 37 LIBOPUSENC_CFLAGS="-I$libopusenc_prefix/include/opus" 38 elif test "x$prefix" != "xNONE"; then 39 LIBOPUSENC_CFLAGS="-I$prefix/include/opus" 40 fi 41 42 AC_MSG_CHECKING(for libopusenc) 43 if test "x$libopusenc_prefix" = "xno" ; then 44 no_libopusenc="disabled" 45 enable_libopusenctest="no" 46 else 47 no_libopusenc="" 48 fi 49 50 51 if test "x$enable_libopusenctest" = "xyes" ; then 52 ac_save_CFLAGS="$CFLAGS" 53 ac_save_LIBS="$LIBS" 54 CFLAGS="$CFLAGS $LIBOPUSENC_CFLAGS $OPUS_CFLAGS" 55 LIBS="$LIBS $LIBOPUSENC_LIBS $OPUS_LIBS" 56dnl 57dnl Now check if the installed libopusenc is sufficiently new. 58dnl 59 rm -f conf.libopusenctest 60 AC_TRY_RUN([ 61#include <stdio.h> 62#include <stdlib.h> 63#include <string.h> 64#include <opusenc.h> 65 66int main () 67{ 68 system("touch conf.libopusenctest"); 69 return 0; 70} 71 72],, no_libopusenc=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_libopusenc" = "xdisabled" ; then 78 AC_MSG_RESULT(no) 79 ifelse([$2], , :, [$2]) 80 elif test "x$no_libopusenc" = "x" ; then 81 AC_MSG_RESULT(yes) 82 ifelse([$1], , :, [$1]) 83 else 84 AC_MSG_RESULT(no) 85 if test -f conf.libopusenctest ; then 86 : 87 else 88 echo "*** Could not run libopusenc test program, checking why..." 89 CFLAGS="$CFLAGS $LIBOPUSENC_CFLAGS" 90 LIBS="$LIBS $LIBOPUSENC_LIBS" 91 AC_TRY_LINK([ 92#include <stdio.h> 93#include <opusenc.h> 94], [ return 0; ], 95 [ echo "*** The test program compiled, but did not run. This usually means" 96 echo "*** that the run-time linker is not finding libopusenc or finding the wrong" 97 echo "*** version of libopusenc. If it is not finding libopusenc, you'll need to set your" 98 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 99 echo "*** to the installed location Also, make sure you have run ldconfig 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_LIBRARY_PATH"], 104 [ echo "*** The test program failed to compile or link. See the file config.log for the" 105 echo "*** exact error that occured. This usually means libopusenc was incorrectly installed" 106 echo "*** or that you have moved libopusenc since it was installed." ]) 107 CFLAGS="$ac_save_CFLAGS" 108 LIBS="$ac_save_LIBS" 109 fi 110 LIBOPUSENC_CFLAGS="" 111 LIBOPUSENC_LIBS="" 112 ifelse([$2], , :, [$2]) 113 fi 114 AC_SUBST(LIBOPUSENC_CFLAGS) 115 AC_SUBST(LIBOPUSENC_LIBS) 116 rm -f conf.libopusenctest 117]) 118