1 # Configure paths for libshout
2 # Jack Moffitt <jack@icecast.org> 08-06-2001
3 # Shamelessly stolen from Owen Taylor and Manish Singh
5 dnl AM_PATH_SHOUT2([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
6 dnl Test for libshout 2, and define SHOUT2_CFLAGS and SHOUT2_LIBS
8 AC_DEFUN([AM_PATH_SHOUT2],
10 dnl Get the cflags and libraries
12 AC_ARG_WITH(shout2-prefix,[ --with-shout2-prefix=PFX Prefix where libshout2 is installed (optional)], shout2_prefix="$withval", shout2_prefix="")
13 AC_ARG_ENABLE(shout2test, [ --disable-shout2test Do not try to compile and run a test shout2 program],, enable_shout2test=yes)
15 if test "x$shout2_prefix" != "xNONE" ; then
16 SHOUT2_CFLAGS="-I$shout2_prefix/include"
17 SHOUT2_LIBS="-L$shout2_prefix/lib"
18 elif test "x$prefix" != "x"; then
19 SHOUT2_CFLAGS="-I$prefix/include"
20 SHOUT2_LIBS="-L$prefix/lib"
23 SHOUT2_LIBS="$SHOUT2_LIBS -lshout -lpthread"
27 SHOUT2_LIBS="$SHOUT2_LIBS -lnsl -lsocket -lresolv"
30 AC_MSG_CHECKING(for shout2)
33 if test "x$enable_shout2test" = "xyes" ; then
34 ac_save_CFLAGS="$CFLAGS"
36 CFLAGS="$CFLAGS $SHOUT2_CFLAGS $OGG_CFLAGS $VORBIS_CFLAGS"
37 LIBS="$LIBS $SHOUT2_LIBS $OGG_LIBS $VORBIS_LIBS"
39 dnl Now check if the installed shout2 is sufficiently new.
46 #include <shout/shout.h>
50 int major, minor, patch;
52 system("touch conf.shout2test");
53 shout_version(&major, &minor, &patch);
59 ],, no_shout2=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
60 CFLAGS="$ac_save_CFLAGS"
64 if test "x$no_shout2" = "x" ; then
66 ifelse([$1], , :, [$1])
69 if test -f conf.shout2test ; then
72 echo "*** Could not run Shout2 test program, checking why..."
73 CFLAGS="$CFLAGS $SHOUT2_CFLAGS $OGG_CFLAGS $VORBIS_CFLAGS"
74 LIBS="$LIBS $SHOUT2_LIBS $OGG_LIBS $VORBIS_LIBS"
77 #include <shout/shout.h>
79 [ echo "*** The test program compiled, but did not run. This usually means"
80 echo "*** that the run-time linker is not finding Shout2 or finding the wrong"
81 echo "*** version of Shout2. If it is not finding Shout2, you'll need to set your"
82 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
83 echo "*** to the installed location Also, make sure you have run ldconfig if that"
84 echo "*** is required on your system"
86 echo "*** If you have an old version installed, it is best to remove it, although"
87 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
88 [ echo "*** The test program failed to compile or link. See the file config.log for the"
89 echo "*** exact error that occured. This usually means Shout2 was incorrectly installed"
90 echo "*** or that you have moved Shout2 since it was installed. In the latter case, you"
91 echo "*** may want to edit the shout-config script: $SHOUT2_CONFIG" ])
92 CFLAGS="$ac_save_CFLAGS"
97 ifelse([$2], , :, [$2])
99 AC_SUBST(SHOUT2_CFLAGS)
100 AC_SUBST(SHOUT2_LIBS)
101 rm -f conf.shout2test