Magellan Linux

Annotation of /trunk/xmms/gentoo-m4/vorbis.m4

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (hide annotations) (download)
Tue May 8 20:52:56 2007 UTC (17 years, 1 month ago) by niro
File size: 4356 byte(s)
-import

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