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,AC_HELP_STRING([--with-ogg=PFX],[Prefix where libogg is installed (optional)]), ogg_prefix="$withval", ogg_prefix="")
13 AC_ARG_WITH(ogg-libraries,AC_HELP_STRING([--with-ogg-libraries=DIR],[Directory where libogg library is installed (optional)]), ogg_libraries="$withval", ogg_libraries="")
14 AC_ARG_WITH(ogg-includes,AC_HELP_STRING([--with-ogg-includes=DIR],[Directory where libogg header files are installed (optional)]), ogg_includes="$withval", ogg_includes="")
15 AC_ARG_ENABLE(oggtest,AC_HELP_STRING([--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" = "xno" || test "x$ogg_prefix" = "xyes" ; then
21 elif test "x$ogg_prefix" != "x" ; then
22 OGG_LIBS="-L$ogg_prefix/lib"
23 elif test "x$prefix" != "xNONE" ; then
24 OGG_LIBS="-L$prefix/lib"
27 if test "x$ogg_prefix" != "xno" ; then
28 OGG_LIBS="$OGG_LIBS -logg"
31 if test "x$ogg_includes" != "x" ; then
32 OGG_CFLAGS="-I$ogg_includes"
33 elif test "x$ogg_prefix" = "xno" || test "x$ogg_prefix" = "xyes" ; then
35 elif test "x$ogg_prefix" != "x" ; then
36 OGG_CFLAGS="-I$ogg_prefix/include"
37 elif test "x$prefix" != "xNONE"; then
38 OGG_CFLAGS="-I$prefix/include"
41 AC_MSG_CHECKING(for Ogg)
42 if test "x$ogg_prefix" = "xno" ; then
50 if test "x$enable_oggtest" = "xyes" ; then
51 ac_save_CFLAGS="$CFLAGS"
53 CFLAGS="$CFLAGS $OGG_CFLAGS"
54 LIBS="$LIBS $OGG_LIBS"
56 dnl Now check if the installed Ogg is sufficiently new.
67 system("touch conf.oggtest");
71 ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
72 CFLAGS="$ac_save_CFLAGS"
76 if test "x$no_ogg" = "xdisabled" ; then
78 ifelse([$2], , :, [$2])
79 elif test "x$no_ogg" = "x" ; then
81 ifelse([$1], , :, [$1])
84 if test -f conf.oggtest ; then
87 echo "*** Could not run Ogg test program, checking why..."
88 CFLAGS="$CFLAGS $OGG_CFLAGS"
89 LIBS="$LIBS $OGG_LIBS"
94 [ echo "*** The test program compiled, but did not run. This usually means"
95 echo "*** that the run-time linker is not finding Ogg or finding the wrong"
96 echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
97 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
98 echo "*** to the installed location Also, make sure you have run ldconfig if that"
99 echo "*** is required on your system"
101 echo "*** If you have an old version installed, it is best to remove it, although"
102 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
103 [ echo "*** The test program failed to compile or link. See the file config.log for the"
104 echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
105 echo "*** or that you have moved Ogg since it was installed. In the latter case, you"
106 echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ])
107 CFLAGS="$ac_save_CFLAGS"
112 ifelse([$2], , :, [$2])
119 # Configure paths for libvorbis
120 # Jack Moffitt <jack@icecast.org> 10-21-2000
121 # Shamelessly stolen from Owen Taylor and Manish Singh
123 dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
124 dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
126 AC_DEFUN([XIPH_PATH_VORBIS],
128 dnl Get the cflags and libraries
130 AC_ARG_WITH(vorbis,AC_HELP_STRING([--with-vorbis=PFX],[Prefix where libvorbis is installed (optional)]), vorbis_prefix="$withval", vorbis_prefix="")
131 AC_ARG_WITH(vorbis-libraries,AC_HELP_STRING([--with-vorbis-libraries=DIR],[Directory where libvorbis library is installed (optional)]), vorbis_libraries="$withval", vorbis_libraries="")
132 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="")
133 AC_ARG_ENABLE(vorbistest,AC_HELP_STRING([--disable-vorbistest],[Do not try to compile and run a test Vorbis program]),, enable_vorbistest=yes)
135 if test "x$vorbis_libraries" != "x" ; then
136 VORBIS_LIBS="-L$vorbis_libraries"
137 elif test "x$vorbis_prefix" = "xno" || test "x$vorbis_prefix" = "xyes" ; then
139 elif test "x$vorbis_prefix" != "x" ; then
140 VORBIS_LIBS="-L$vorbis_prefix/lib"
141 elif test "x$prefix" != "xNONE"; then
142 VORBIS_LIBS="-L$prefix/lib"
145 VORBISFILE_LIBS="$VORBIS_LIBS -lvorbisfile"
146 VORBISENC_LIBS="$VORBIS_LIBS -lvorbisenc"
147 if test "x$vorbis_prefix" != "xno" ; then
148 VORBIS_LIBS="$VORBIS_LIBS -lvorbis"
151 if test "x$vorbis_includes" != "x" ; then
152 VORBIS_CFLAGS="-I$vorbis_includes"
153 elif test "x$vorbis_prefix" = "xno" || test "x$vorbis_prefix" = "xyes" ; then
155 elif test "x$vorbis_prefix" != "x" ; then
156 VORBIS_CFLAGS="-I$vorbis_prefix/include"
157 elif test "x$prefix" != "xNONE"; then
158 VORBIS_CFLAGS="-I$prefix/include"
161 xiph_saved_LIBS="$LIBS"
163 AC_SEARCH_LIBS(cos, m, [VORBIS_LIBS="$VORBIS_LIBS $LIBS"], [
164 AC_MSG_WARN([cos() not found in math library, vorbis installation may not work])
166 LIBS="$xiph_saved_LIBS"
168 AC_MSG_CHECKING(for Vorbis)
169 if test "x$vorbis_prefix" = "xno" ; then
171 enable_vorbistest="no"
177 if test "x$enable_vorbistest" = "xyes" ; then
178 ac_save_CFLAGS="$CFLAGS"
180 CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
181 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
183 dnl Now check if the installed Vorbis is sufficiently new.
185 rm -f conf.vorbistest
190 #include <vorbis/codec.h>
194 system("touch conf.vorbistest");
198 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
199 CFLAGS="$ac_save_CFLAGS"
203 if test "x$no_vorbis" = "xdisabled" ; then
205 ifelse([$2], , :, [$2])
206 elif test "x$no_vorbis" = "x" ; then
208 ifelse([$1], , :, [$1])
211 if test -f conf.vorbistest ; then
214 echo "*** Could not run Vorbis test program, checking why..."
215 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
216 LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
219 #include <vorbis/codec.h>
221 [ echo "*** The test program compiled, but did not run. This usually means"
222 echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
223 echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
224 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
225 echo "*** to the installed location Also, make sure you have run ldconfig if that"
226 echo "*** is required on your system"
228 echo "*** If you have an old version installed, it is best to remove it, although"
229 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
230 [ echo "*** The test program failed to compile or link. See the file config.log for the"
231 echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
232 echo "*** or that you have moved Vorbis since it was installed." ])
233 CFLAGS="$ac_save_CFLAGS"
240 ifelse([$2], , :, [$2])
242 AC_SUBST(VORBIS_CFLAGS)
243 AC_SUBST(VORBIS_LIBS)
244 AC_SUBST(VORBISFILE_LIBS)
245 AC_SUBST(VORBISENC_LIBS)
246 rm -f conf.vorbistest
250 # Configure paths for libao
251 # Jack Moffitt <jack@icecast.org> 10-21-2000
252 # Shamelessly stolen from Owen Taylor and Manish Singh
254 dnl XIPH_PATH_AO([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
255 dnl Test for libao, and define AO_CFLAGS and AO_LIBS
257 AC_DEFUN([XIPH_PATH_AO],
259 dnl Get the cflags and libraries
261 AC_ARG_WITH(ao,AC_HELP_STRING([--with-ao=PFX],[Prefix where libao is installed (optional)]), ao_prefix="$withval", ao_prefix="")
262 AC_ARG_WITH(ao-libraries,AC_HELP_STRING([--with-ao-libraries=DIR],[Directory where libao library is installed (optional)]), ao_libraries="$withval", ao_libraries="")
263 AC_ARG_WITH(ao-includes,AC_HELP_STRING([--with-ao-includes=DIR],[Directory where libao header files are installed (optional)]), ao_includes="$withval", ao_includes="")
264 AC_ARG_ENABLE(aotest,AC_HELP_STRING([--disable-aotest],[Do not try to compile and run a test ao program]),, enable_aotest=yes)
266 if test "x$ao_prefix" != "xno"
268 if test "x$ao_libraries" != "x" ; then
269 AO_LIBS="-L$ao_libraries"
270 elif test "x$ao_prefix" = "xno" || test "x$ao_prefix" = "xyes" ; then
272 elif test "x$ao_prefix" != "x" -a "x$ao_prefix" != "xyes"; then
273 AO_LIBS="-L$ao_prefix/lib"
274 elif test "x$prefix" != "xNONE"; then
275 AO_LIBS="-L$prefix/lib"
278 if test "x$ao_includes" != "x" ; then
279 AO_CFLAGS="-I$ao_includes"
280 elif test "x$ao_prefix" = "xno" || test "x$ao_prefix" = "xyes" ; then
282 elif test "x$ao_prefix" != "x" -a "x$ao_prefix" != "xyes"; then
283 AO_CFLAGS="-I$ao_prefix/include"
284 elif test "x$prefix" != "xNONE"; then
285 AO_CFLAGS="-I$prefix/include"
288 # see where dl* and friends live
289 AC_CHECK_FUNCS(dlopen, [AO_DL_LIBS=""], [
290 AC_CHECK_LIB(dl, dlopen, [AO_DL_LIBS="-ldl"], [
291 AC_MSG_WARN([could not find dlopen() needed by libao sound drivers
292 your system may not be supported.])
296 if test "x$ao_prefix" != "xno" ; then
297 AO_LIBS="$AO_LIBS -lao $AO_DL_LIBS"
300 AC_MSG_CHECKING(for ao)
301 if test "x$ao_prefix" = "xno" ; then
309 if test "x$enable_aotest" = "xyes" ; then
310 ac_save_CFLAGS="$CFLAGS"
312 CFLAGS="$CFLAGS $AO_CFLAGS"
313 LIBS="$LIBS $AO_LIBS"
315 dnl Now check if the installed ao is sufficiently new.
326 system("touch conf.aotest");
330 ],, no_ao=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
331 CFLAGS="$ac_save_CFLAGS"
335 if test "x$no_ao" = "xdisabled" ; then
337 ifelse([$2], , :, [$2])
338 elif test "x$no_ao" = "x" ; then
340 ifelse([$1], , :, [$1])
343 if test -f conf.aotest ; then
346 echo "*** Could not run ao test program, checking why..."
347 CFLAGS="$CFLAGS $AO_CFLAGS"
348 LIBS="$LIBS $AO_LIBS"
353 [ echo "*** The test program compiled, but did not run. This usually means"
354 echo "*** that the run-time linker is not finding ao or finding the wrong"
355 echo "*** version of ao. If it is not finding ao, you'll need to set your"
356 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
357 echo "*** to the installed location Also, make sure you have run ldconfig if that"
358 echo "*** is required on your system"
360 echo "*** If you have an old version installed, it is best to remove it, although"
361 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
362 [ echo "*** The test program failed to compile or link. See the file config.log for the"
363 echo "*** exact error that occured. This usually means ao was incorrectly installed"
364 echo "*** or that you have moved ao since it was installed." ])
365 CFLAGS="$ac_save_CFLAGS"
370 ifelse([$2], , :, [$2])
378 dnl This macros shamelessly stolen from
379 dnl http://gcc.gnu.org/ml/gcc-bugs/2001-06/msg01398.html.
380 dnl Written by Bruno Haible.
384 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
385 dnl those with the standalone portable GNU libiconv installed).
387 AC_ARG_WITH([libiconv-prefix],
388 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
389 for dir in `echo "$withval" | tr : ' '`; do
390 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
391 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
395 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
396 am_cv_func_iconv="no, consider installing GNU libiconv"
398 AC_TRY_LINK([#include <stdlib.h>
400 [iconv_t cd = iconv_open("","");
401 iconv(cd,NULL,NULL,NULL,NULL);
403 am_cv_func_iconv=yes)
404 if test "$am_cv_func_iconv" != yes; then
407 AC_TRY_LINK([#include <stdlib.h>
409 [iconv_t cd = iconv_open("","");
410 iconv(cd,NULL,NULL,NULL,NULL);
413 am_cv_func_iconv=yes)
417 if test "$am_cv_func_iconv" = yes; then
418 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
419 AC_MSG_CHECKING([for iconv declaration])
420 AC_CACHE_VAL(am_cv_proto_iconv, [
428 #if defined(__STDC__) || defined(__cplusplus)
429 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
433 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
434 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
435 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
436 AC_MSG_RESULT([$]{ac_t:-
437 }[$]am_cv_proto_iconv)
438 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
439 [Define as const if the declaration of iconv() needs const.])
442 if test "$am_cv_lib_iconv" = yes; then
448 dnl From Bruno Haible.
450 AC_DEFUN([AM_LANGINFO_CODESET],
452 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
453 [AC_TRY_LINK([#include <langinfo.h>],
454 [char* cs = nl_langinfo(CODESET);],
455 am_cv_langinfo_codeset=yes,
456 am_cv_langinfo_codeset=no)
458 if test $am_cv_langinfo_codeset = yes; then
459 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
460 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
464 dnl AM_PATH_CURL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
465 dnl Test for libcurl, and define CURL_CFLAGS and CURL_LIBS
467 AC_DEFUN([AM_PATH_CURL],
469 dnl Get the cflags and libraries
471 AC_ARG_WITH(curl,[ --with-curl=PFX Prefix where libcurl is installed (optional)], curl_prefix="$withval", curl_prefix="")
472 AC_ARG_WITH(curl-libraries,[ --with-curl-libraries=DIR Directory where libcurl library is installed (optional)], curl_libraries="$withval", curl_libraries="")
473 AC_ARG_WITH(curl-includes,[ --with-curl-includes=DIR Directory where libcurl header files are installed (optional)], curl_includes="$withval", curl_includes="")
474 AC_ARG_ENABLE(curltest, [ --disable-curltest Do not try to compile and run a test libcurl program],, enable_curltest=yes)
476 if test "x$curl_prefix" != "xno" ; then
478 if test "x$curl_libraries" != "x" ; then
479 CURL_LIBS="-L$curl_libraries"
480 elif test "x$curl_prefix" != "x" ; then
481 CURL_LIBS="-L$curl_prefix/lib"
482 elif test "x$prefix" != "xNONE" ; then
483 CURL_LIBS="-L$prefix/lib"
486 CURL_LIBS="$CURL_LIBS -lcurl"
488 if test "x$curl_includes" != "x" ; then
489 CURL_CFLAGS="-I$curl_includes"
490 elif test "x$curl_prefix" != "x" ; then
491 CURL_CFLAGS="-I$curl_prefix/include"
492 elif test "x$prefix" != "xNONE"; then
493 CURL_CFLAGS="-I$prefix/include"
496 AC_MSG_CHECKING(for libcurl)
500 if test "x$enable_curltest" = "xyes" ; then
501 ac_save_CFLAGS="$CFLAGS"
503 CFLAGS="$CFLAGS $CURL_CFLAGS"
504 LIBS="$LIBS $CURL_LIBS"
506 dnl Now check if the installed libcurl is sufficiently new.
513 #include <curl/curl.h>
517 system("touch conf.curltest");
521 ],, no_curl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
522 CFLAGS="$ac_save_CFLAGS"
526 if test "x$no_curl" = "x" ; then
528 AC_DEFINE(HAVE_CURL, 1, [Define if you have libcurl.])
529 ifelse([$1], , :, [$1])
532 if test -f conf.curltest ; then
535 echo "*** Could not run libcurl test program, checking why..."
536 CFLAGS="$CFLAGS $CURL_CFLAGS"
537 LIBS="$LIBS $CURL_LIBS"
540 #include <curl/curl.h>
542 [ echo "*** The test program compiled, but did not run. This usually means"
543 echo "*** that the run-time linker is not finding libcurl or finding the wrong"
544 echo "*** version of libcurl. If it is not finding libcurl, you'll need to set your"
545 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
546 echo "*** to the installed location Also, make sure you have run ldconfig if that"
547 echo "*** is required on your system"
549 echo "*** If you have an old version installed, it is best to remove it, although"
550 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
551 [ echo "*** The test program failed to compile or link. See the file config.log for the"
552 echo "*** exact error that occured. This usually means libcurl was incorrectly installed"
553 echo "*** or that you have moved libcurl since it was installed." ])
554 CFLAGS="$ac_save_CFLAGS"
559 ifelse([$2], , :, [$2])
565 AC_SUBST(CURL_CFLAGS)