1dnl 2dnl Changed slightly from the XIPH_PATH_VORBIS macro distributed with the 3dnl vorbis libraries, because the tests segfault on my machine. 4dnl 5 6dnl NORM_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) 7dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS 8dnl 9AC_DEFUN([NORM_PATH_VORBIS], 10[dnl 11dnl Get the cflags and libraries 12dnl 13AC_ARG_WITH(vorbis, 14 AC_HELP_STRING([--with-vorbis=PFX], 15 [Prefix where libvorbis is installed (optional)]), 16 vorbis_prefix="$withval", vorbis_prefix="") 17AC_ARG_WITH(vorbis-libraries, 18 AC_HELP_STRING([--with-vorbis-libraries=DIR], 19 [Directory where libvorbis library is installed (optional)]), 20 vorbis_libraries="$withval", vorbis_libraries="") 21AC_ARG_WITH(vorbis-includes, 22 AC_HELP_STRING([--with-vorbis-includes=DIR], 23 [Directory where libvorbis header files are installed (optional)]), 24 vorbis_includes="$withval", vorbis_includes="") 25AC_ARG_ENABLE(vorbistest, 26 AC_HELP_STRING([--disable-vorbistest], 27 [Do not try to compile and run a test Vorbis program]),, enable_vorbistest=yes) 28 29 if test "x$vorbis_libraries" != "x" ; then 30 VORBIS_LIBS="-L$vorbis_libraries" 31 elif test "x$vorbis_prefix" != "x" ; then 32 VORBIS_LIBS="-L$vorbis_prefix/lib" 33 elif test "x$prefix" != "xNONE"; then 34 VORBIS_LIBS="-L$prefix/lib" 35 fi 36 37 VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm" 38 VORBISFILE_LIBS="-lvorbisfile" 39 VORBISENC_LIBS="-lvorbisenc" 40 41 if test "x$vorbis_includes" != "x" ; then 42 VORBIS_CFLAGS="-I$vorbis_includes" 43 elif test "x$vorbis_prefix" != "x" ; then 44 VORBIS_CFLAGS="-I$vorbis_prefix/include" 45 elif test "x$prefix" != "xNONE"; then 46 VORBIS_CFLAGS="-I$prefix/include" 47 fi 48 49 50 AC_MSG_CHECKING(for Vorbis) 51 no_vorbis="" 52 53 54 if test "x$enable_vorbistest" = "xyes" ; then 55 ac_save_CFLAGS="$CFLAGS" 56 ac_save_LIBS="$LIBS" 57 CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS" 58 LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS" 59dnl 60dnl Now check if the installed Vorbis is sufficiently new. 61dnl 62 rm -f conf.vorbistest 63 AC_TRY_RUN([ 64#include <stdio.h> 65#include <stdlib.h> 66#include <string.h> 67#include <vorbis/codec.h> 68 69int main () 70{ 71 vorbis_block vb; 72 vorbis_dsp_state vd; 73 vorbis_info vi; 74 75 vorbis_info_init (&vi); 76 vorbis_encode_init (&vi, 2, 44100, -1, 128, -1); 77 /*vorbis_analysis_init (&vd, &vi);*/ 78 vorbis_block_init (&vd, &vb); 79 /* this function was added in 1.0rc3, so this is what we're testing for */ 80 /*vorbis_bitrate_addblock (&vb);*/ 81 82 system("touch conf.vorbistest"); 83 return 0; 84} 85 86],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 87 CFLAGS="$ac_save_CFLAGS" 88 LIBS="$ac_save_LIBS" 89 fi 90 91 if test "x$no_vorbis" = "x" ; then 92 AC_MSG_RESULT(yes) 93 ifelse([$1], , :, [$1]) 94 else 95 AC_MSG_RESULT(no) 96 if test -f conf.vorbistest ; then 97 : 98 else 99 echo "*** Could not run Vorbis test program, checking why..." 100 CFLAGS="$CFLAGS $VORBIS_CFLAGS" 101 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" 102 AC_TRY_LINK([ 103#include <stdio.h> 104#include <vorbis/codec.h> 105], [ return 0; ], 106 [ echo "*** The test program compiled, but did not run. This usually means" 107 echo "*** that the run-time linker is not finding Vorbis or finding the wrong" 108 echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your" 109 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 110 echo "*** to the installed location Also, make sure you have run ldconfig if that" 111 echo "*** is required on your system" 112 echo "***" 113 echo "*** If you have an old version installed, it is best to remove it, although" 114 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], 115 [ echo "*** The test program failed to compile or link. See the file config.log for the" 116 echo "*** exact error that occured. This usually means Vorbis was incorrectly installed" 117 echo "*** or that you have moved Vorbis since it was installed." ]) 118 CFLAGS="$ac_save_CFLAGS" 119 LIBS="$ac_save_LIBS" 120 fi 121 VORBIS_CFLAGS="" 122 VORBIS_LIBS="" 123 VORBISFILE_LIBS="" 124 VORBISENC_LIBS="" 125 ifelse([$2], , :, [$2]) 126 fi 127 AC_SUBST(VORBIS_CFLAGS) 128 AC_SUBST(VORBIS_LIBS) 129 AC_SUBST(VORBISFILE_LIBS) 130 AC_SUBST(VORBISENC_LIBS) 131 rm -f conf.vorbistest 132]) 133 134dnl 135dnl Taken from GNU grep 136dnl 137dnl Check to see if we use dir\file name conventtion 138dnl If so, set macro HAVE_DOS_FILE_NAMES 139dnl Also set the macro HAVE_DOS_FILE_CONTENTS for now, 140dnl since don't know of a good way to independently check this. 141dnl AC_DOSFILE() 142AC_DEFUN([AC_DOSFILE], 143[ 144 AC_CACHE_CHECK([for dos file convention], ac_cv_dosfile, 145 [if test -d ".\."; then 146 ac_cv_dosfile=yes 147 else 148 ac_cv_dosfile=no 149 fi 150 ]) 151 152 if test $ac_cv_dosfile = yes; then 153 AC_DEFINE(HAVE_DOS_FILE_NAMES, 1, [Define if your OS uses backslashes as directory separators]) 154 AC_DEFINE(HAVE_DOS_FILE_CONTENTS, 1, 155 [Define if text file lines end in CRLF.]) 156 fi 157]) 158