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