annotate src/libvorbis-1.3.3/vorbis.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 05aa0afa9217
children
rev   line source
Chris@1 1 # Configure paths for libvorbis
Chris@1 2 # Jack Moffitt <jack@icecast.org> 10-21-2000
Chris@1 3 # Shamelessly stolen from Owen Taylor and Manish Singh
Chris@1 4 # thomasvs added check for vorbis_bitrate_addblock which is new in rc3
Chris@1 5
Chris@1 6 dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
Chris@1 7 dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
Chris@1 8 dnl
Chris@1 9 AC_DEFUN([XIPH_PATH_VORBIS],
Chris@1 10 [dnl
Chris@1 11 dnl Get the cflags and libraries
Chris@1 12 dnl
Chris@1 13 AC_ARG_WITH(vorbis,AC_HELP_STRING([--with-vorbis=PFX],[Prefix where libvorbis is installed (optional)]), vorbis_prefix="$withval", vorbis_prefix="")
Chris@1 14 AC_ARG_WITH(vorbis-libraries,AC_HELP_STRING([--with-vorbis-libraries=DIR],[Directory where libvorbis library is installed (optional)]), vorbis_libraries="$withval", vorbis_libraries="")
Chris@1 15 AC_ARG_WITH(vorbis-includes,AC_HELP_STRING([--with-vorbis-includes=DIR],[Directory where libvorbis header files are installed (optional)]), vorbis_includes="$withval", vorbis_includes="")
Chris@1 16 AC_ARG_ENABLE(vorbistest,AC_HELP_STRING([--disable-vorbistest],[Do not try to compile and run a test Vorbis program]),, enable_vorbistest=yes)
Chris@1 17
Chris@1 18 if test "x$vorbis_libraries" != "x" ; then
Chris@1 19 VORBIS_LIBS="-L$vorbis_libraries"
Chris@1 20 elif test "x$vorbis_prefix" = "xno" || test "x$vorbis_prefix" = "xyes" ; then
Chris@1 21 VORBIS_LIBS=""
Chris@1 22 elif test "x$vorbis_prefix" != "x" ; then
Chris@1 23 VORBIS_LIBS="-L$vorbis_prefix/lib"
Chris@1 24 elif test "x$prefix" != "xNONE"; then
Chris@1 25 VORBIS_LIBS="-L$prefix/lib"
Chris@1 26 fi
Chris@1 27
Chris@1 28 if test "x$vorbis_prefix" != "xno" ; then
Chris@1 29 VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
Chris@1 30 fi
Chris@1 31 VORBISFILE_LIBS="-lvorbisfile"
Chris@1 32 VORBISENC_LIBS="-lvorbisenc"
Chris@1 33
Chris@1 34 if test "x$vorbis_includes" != "x" ; then
Chris@1 35 VORBIS_CFLAGS="-I$vorbis_includes"
Chris@1 36 elif test "x$vorbis_prefix" = "xno" || test "x$vorbis_prefix" = "xyes" ; then
Chris@1 37 VORBIS_CFLAGS=""
Chris@1 38 elif test "x$vorbis_prefix" != "x" ; then
Chris@1 39 VORBIS_CFLAGS="-I$vorbis_prefix/include"
Chris@1 40 elif test "x$prefix" != "xNONE"; then
Chris@1 41 VORBIS_CFLAGS="-I$prefix/include"
Chris@1 42 fi
Chris@1 43
Chris@1 44
Chris@1 45 AC_MSG_CHECKING(for Vorbis)
Chris@1 46 if test "x$vorbis_prefix" = "xno" ; then
Chris@1 47 no_vorbis="disabled"
Chris@1 48 enable_vorbistest="no"
Chris@1 49 else
Chris@1 50 no_vorbis=""
Chris@1 51 fi
Chris@1 52
Chris@1 53
Chris@1 54 if test "x$enable_vorbistest" = "xyes" ; then
Chris@1 55 ac_save_CFLAGS="$CFLAGS"
Chris@1 56 ac_save_LIBS="$LIBS"
Chris@1 57 CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
Chris@1 58 LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
Chris@1 59 dnl
Chris@1 60 dnl Now check if the installed Vorbis is sufficiently new.
Chris@1 61 dnl
Chris@1 62 rm -f conf.vorbistest
Chris@1 63 AC_TRY_RUN([
Chris@1 64 #include <stdio.h>
Chris@1 65 #include <stdlib.h>
Chris@1 66 #include <string.h>
Chris@1 67 #include <vorbis/codec.h>
Chris@1 68 #include <vorbis/vorbisenc.h>
Chris@1 69
Chris@1 70 int main ()
Chris@1 71 {
Chris@1 72 vorbis_block vb;
Chris@1 73 vorbis_dsp_state vd;
Chris@1 74 vorbis_info vi;
Chris@1 75
Chris@1 76 vorbis_info_init (&vi);
Chris@1 77 vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
Chris@1 78 vorbis_analysis_init (&vd, &vi);
Chris@1 79 vorbis_block_init (&vd, &vb);
Chris@1 80 /* this function was added in 1.0rc3, so this is what we're testing for */
Chris@1 81 vorbis_bitrate_addblock (&vb);
Chris@1 82
Chris@1 83 system("touch conf.vorbistest");
Chris@1 84 return 0;
Chris@1 85 }
Chris@1 86
Chris@1 87 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
Chris@1 88 CFLAGS="$ac_save_CFLAGS"
Chris@1 89 LIBS="$ac_save_LIBS"
Chris@1 90 fi
Chris@1 91
Chris@1 92 if test "x$no_vorbis" = "xdisabled" ; then
Chris@1 93 AC_MSG_RESULT(no)
Chris@1 94 ifelse([$2], , :, [$2])
Chris@1 95 elif test "x$no_vorbis" = "x" ; then
Chris@1 96 AC_MSG_RESULT(yes)
Chris@1 97 ifelse([$1], , :, [$1])
Chris@1 98 else
Chris@1 99 AC_MSG_RESULT(no)
Chris@1 100 if test -f conf.vorbistest ; then
Chris@1 101 :
Chris@1 102 else
Chris@1 103 echo "*** Could not run Vorbis test program, checking why..."
Chris@1 104 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
Chris@1 105 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
Chris@1 106 AC_TRY_LINK([
Chris@1 107 #include <stdio.h>
Chris@1 108 #include <vorbis/codec.h>
Chris@1 109 ], [ return 0; ],
Chris@1 110 [ echo "*** The test program compiled, but did not run. This usually means"
Chris@1 111 echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
Chris@1 112 echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
Chris@1 113 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
Chris@1 114 echo "*** to the installed location Also, make sure you have run ldconfig if that"
Chris@1 115 echo "*** is required on your system"
Chris@1 116 echo "***"
Chris@1 117 echo "*** If you have an old version installed, it is best to remove it, although"
Chris@1 118 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
Chris@1 119 [ echo "*** The test program failed to compile or link. See the file config.log for the"
Chris@1 120 echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
Chris@1 121 echo "*** or that you have moved Vorbis since it was installed." ])
Chris@1 122 CFLAGS="$ac_save_CFLAGS"
Chris@1 123 LIBS="$ac_save_LIBS"
Chris@1 124 fi
Chris@1 125 VORBIS_CFLAGS=""
Chris@1 126 VORBIS_LIBS=""
Chris@1 127 VORBISFILE_LIBS=""
Chris@1 128 VORBISENC_LIBS=""
Chris@1 129 ifelse([$2], , :, [$2])
Chris@1 130 fi
Chris@1 131 AC_SUBST(VORBIS_CFLAGS)
Chris@1 132 AC_SUBST(VORBIS_LIBS)
Chris@1 133 AC_SUBST(VORBISFILE_LIBS)
Chris@1 134 AC_SUBST(VORBISENC_LIBS)
Chris@1 135 rm -f conf.vorbistest
Chris@1 136 ])