1 # Configure paths for libogg
2 # Jack Moffitt <jack@icecast.org> 10-21-2000
3 # Shamelessly stolen from Owen Taylor and Manish Singh
5 dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
6 dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
8 AC_DEFUN([XIPH_PATH_OGG],
10 dnl Get the cflags and libraries
12 AC_ARG_WITH(ogg,[ --with-ogg=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
13 AC_ARG_WITH(ogg-libraries,[ --with-ogg-libraries=DIR Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="")
14 AC_ARG_WITH(ogg-includes,[ --with-ogg-includes=DIR Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="")
15 AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
17 if test "x$ogg_libraries" != "x" ; then
18 OGG_LIBS="-L$ogg_libraries"
19 elif test "x$ogg_prefix" != "x" ; then
20 OGG_LIBS="-L$ogg_prefix/lib"
21 elif test "x$prefix" != "xNONE" ; then
22 OGG_LIBS="-L$prefix/lib"
25 OGG_LIBS="$OGG_LIBS -logg"
27 if test "x$ogg_includes" != "x" ; then
28 OGG_CFLAGS="-I$ogg_includes"
29 elif test "x$ogg_prefix" != "x" ; then
30 OGG_CFLAGS="-I$ogg_prefix/include"
31 elif test "x$prefix" != "xNONE"; then
32 OGG_CFLAGS="-I$prefix/include"
35 AC_MSG_CHECKING(for Ogg)
39 if test "x$enable_oggtest" = "xyes" ; then
40 ac_save_CFLAGS="$CFLAGS"
42 CFLAGS="$CFLAGS $OGG_CFLAGS"
43 LIBS="$LIBS $OGG_LIBS"
45 dnl Now check if the installed Ogg is sufficiently new.
56 system("touch conf.oggtest");
60 ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
61 CFLAGS="$ac_save_CFLAGS"
65 if test "x$no_ogg" = "x" ; then
67 ifelse([$1], , :, [$1])
70 if test -f conf.oggtest ; then
73 echo "*** Could not run Ogg test program, checking why..."
74 CFLAGS="$CFLAGS $OGG_CFLAGS"
75 LIBS="$LIBS $OGG_LIBS"
80 [ echo "*** The test program compiled, but did not run. This usually means"
81 echo "*** that the run-time linker is not finding Ogg or finding the wrong"
82 echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
83 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
84 echo "*** to the installed location Also, make sure you have run ldconfig if that"
85 echo "*** is required on your system"
87 echo "*** If you have an old version installed, it is best to remove it, although"
88 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
89 [ echo "*** The test program failed to compile or link. See the file config.log for the"
90 echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
91 echo "*** or that you have moved Ogg since it was installed." ])
92 CFLAGS="$ac_save_CFLAGS"
97 ifelse([$2], , :, [$2])
103 # Configure paths for libvorbis
104 # Jack Moffitt <jack@icecast.org> 10-21-2000
105 # Shamelessly stolen from Owen Taylor and Manish Singh
106 # thomasvs added check for vorbis_bitrate_addblock which is new in rc3
108 dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
109 dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
111 AC_DEFUN([XIPH_PATH_VORBIS],
113 dnl Get the cflags and libraries
115 AC_ARG_WITH(vorbis,[ --with-vorbis=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
116 AC_ARG_WITH(vorbis-libraries,[ --with-vorbis-libraries=DIR Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="")
117 AC_ARG_WITH(vorbis-includes,[ --with-vorbis-includes=DIR Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="")
118 AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
120 if test "x$vorbis_libraries" != "x" ; then
121 VORBIS_LIBS="-L$vorbis_libraries"
122 elif test "x$vorbis_prefix" != "x" ; then
123 VORBIS_LIBS="-L$vorbis_prefix/lib"
124 elif test "x$prefix" != "xNONE"; then
125 VORBIS_LIBS="-L$prefix/lib"
128 VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
129 VORBISFILE_LIBS="-lvorbisfile"
130 VORBISENC_LIBS="-lvorbisenc"
132 if test "x$vorbis_includes" != "x" ; then
133 VORBIS_CFLAGS="-I$vorbis_includes"
134 elif test "x$vorbis_prefix" != "x" ; then
135 VORBIS_CFLAGS="-I$vorbis_prefix/include"
136 elif test "x$prefix" != "xNONE"; then
137 VORBIS_CFLAGS="-I$prefix/include"
141 AC_MSG_CHECKING(for Vorbis)
145 if test "x$enable_vorbistest" = "xyes" ; then
146 ac_save_CFLAGS="$CFLAGS"
148 CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
149 LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
151 dnl Now check if the installed Vorbis is sufficiently new.
153 rm -f conf.vorbistest
158 #include <vorbis/codec.h>
159 #include <vorbis/vorbisenc.h>
167 vorbis_info_init (&vi);
168 vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
169 vorbis_analysis_init (&vd, &vi);
170 vorbis_block_init (&vd, &vb);
171 /* this function was added in 1.0rc3, so this is what we're testing for */
172 vorbis_bitrate_addblock (&vb);
174 system("touch conf.vorbistest");
178 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
179 CFLAGS="$ac_save_CFLAGS"
183 if test "x$no_vorbis" = "x" ; then
185 ifelse([$1], , :, [$1])
188 if test -f conf.vorbistest ; then
191 echo "*** Could not run Vorbis test program, checking why..."
192 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
193 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
196 #include <vorbis/codec.h>
198 [ echo "*** The test program compiled, but did not run. This usually means"
199 echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
200 echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
201 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
202 echo "*** to the installed location Also, make sure you have run ldconfig if that"
203 echo "*** is required on your system"
205 echo "*** If you have an old version installed, it is best to remove it, although"
206 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
207 [ echo "*** The test program failed to compile or link. See the file config.log for the"
208 echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
209 echo "*** or that you have moved Vorbis since it was installed." ])
210 CFLAGS="$ac_save_CFLAGS"
217 ifelse([$2], , :, [$2])
219 AC_SUBST(VORBIS_CFLAGS)
220 AC_SUBST(VORBIS_LIBS)
221 AC_SUBST(VORBISFILE_LIBS)
222 AC_SUBST(VORBISENC_LIBS)
223 rm -f conf.vorbistest
225 # Configure paths for SDL
226 # Sam Lantinga 9/21/99
227 # stolen from Manish Singh
228 # stolen back from Frank Belew
229 # stolen from Manish Singh
230 # Shamelessly stolen from Owen Taylor
232 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
233 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
235 AC_DEFUN([AM_PATH_SDL],
237 dnl Get the cflags and libraries from the sdl-config script
239 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
240 sdl_prefix="$withval", sdl_prefix="")
241 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
242 sdl_exec_prefix="$withval", sdl_exec_prefix="")
243 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
244 , enable_sdltest=yes)
246 if test x$sdl_exec_prefix != x ; then
247 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
248 if test x${SDL_CONFIG+set} != xset ; then
249 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
252 if test x$sdl_prefix != x ; then
253 sdl_args="$sdl_args --prefix=$sdl_prefix"
254 if test x${SDL_CONFIG+set} != xset ; then
255 SDL_CONFIG=$sdl_prefix/bin/sdl-config
259 AC_REQUIRE([AC_CANONICAL_TARGET])
260 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
261 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
262 min_sdl_version=ifelse([$1], ,0.11.0,$1)
263 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
265 if test "$SDL_CONFIG" = "no" ; then
268 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
269 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
271 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
272 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
273 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
274 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
275 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
276 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
277 if test "x$enable_sdltest" = "xyes" ; then
278 ac_save_CFLAGS="$CFLAGS"
280 CFLAGS="$CFLAGS $SDL_CFLAGS"
281 LIBS="$LIBS $SDL_LIBS"
283 dnl Now check if the installed SDL is sufficiently new. (Also sanity
284 dnl checks the results of sdl-config to some extent
294 my_strdup (char *str)
300 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
301 strcpy (new_str, str);
309 int main (int argc, char *argv[])
311 int major, minor, micro;
314 /* This hangs on some systems (?)
315 system ("touch conf.sdltest");
317 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
319 /* HP/UX 9 (%@#!) writes to sscanf strings */
320 tmp_version = my_strdup("$min_sdl_version");
321 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
322 printf("%s, bad version string\n", "$min_sdl_version");
326 if (($sdl_major_version > major) ||
327 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
328 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
334 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
335 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
336 printf("*** best to upgrade to the required version.\n");
337 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
338 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
339 printf("*** config.cache before re-running configure\n");
344 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
345 CFLAGS="$ac_save_CFLAGS"
349 if test "x$no_sdl" = x ; then
351 ifelse([$2], , :, [$2])
354 if test "$SDL_CONFIG" = "no" ; then
355 echo "*** The sdl-config script installed by SDL could not be found"
356 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
357 echo "*** your path, or set the SDL_CONFIG environment variable to the"
358 echo "*** full path to sdl-config."
360 if test -f conf.sdltest ; then
363 echo "*** Could not run SDL test program, checking why..."
364 CFLAGS="$CFLAGS $SDL_CFLAGS"
365 LIBS="$LIBS $SDL_LIBS"
370 int main(int argc, char *argv[])
373 #define main K_and_R_C_main
375 [ echo "*** The test program compiled, but did not run. This usually means"
376 echo "*** that the run-time linker is not finding SDL or finding the wrong"
377 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
378 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
379 echo "*** to the installed location Also, make sure you have run ldconfig if that"
380 echo "*** is required on your system"
382 echo "*** If you have an old version installed, it is best to remove it, although"
383 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
384 [ echo "*** The test program failed to compile or link. See the file config.log for the"
385 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
386 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
387 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
388 CFLAGS="$ac_save_CFLAGS"
394 ifelse([$3], , :, [$3])