1# Configure paths for libshout 2# Jack Moffitt <jack@icecast.org> 08-06-2001 3# Shamelessly stolen from Owen Taylor and Manish Singh 4 5dnl AM_PATH_SHOUT2([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) 6dnl Test for libshout 2, and define SHOUT2_CFLAGS and SHOUT2_LIBS 7dnl 8AC_DEFUN([AM_PATH_SHOUT2], 9[dnl 10dnl Get the cflags and libraries 11dnl 12AC_ARG_WITH(shout2-prefix,[ --with-shout2-prefix=PFX Prefix where libshout2 is installed (optional)], shout2_prefix="$withval", shout2_prefix="") 13AC_ARG_ENABLE(shout2test, [ --disable-shout2test Do not try to compile and run a test shout2 program],, enable_shout2test=yes) 14 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" 21 fi 22 23 SHOUT2_LIBS="$SHOUT2_LIBS -lshout -lpthread" 24 25 case $host in 26 *-*-solaris*) 27 SHOUT2_LIBS="$SHOUT2_LIBS -lnsl -lsocket -lresolv" 28 esac 29 30 AC_MSG_CHECKING(for shout2) 31 no_shout2="" 32 33 if test "x$enable_shout2test" = "xyes" ; then 34 ac_save_CFLAGS="$CFLAGS" 35 ac_save_LIBS="$LIBS" 36 CFLAGS="$CFLAGS $SHOUT2_CFLAGS $OGG_CFLAGS $VORBIS_CFLAGS" 37 LIBS="$LIBS $SHOUT2_LIBS $OGG_LIBS $VORBIS_LIBS" 38dnl 39dnl Now check if the installed shout2 is sufficiently new. 40dnl 41 rm -f conf.shout2test 42 AC_TRY_RUN([ 43#include <stdio.h> 44#include <stdlib.h> 45#include <string.h> 46#include <shout/shout.h> 47 48int main () 49{ 50 int major, minor, patch; 51 52 system("touch conf.shout2test"); 53 shout_version(&major, &minor, &patch); 54 if (major < 2) 55 return 1; 56 return 0; 57} 58 59],, no_shout2=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 60 CFLAGS="$ac_save_CFLAGS" 61 LIBS="$ac_save_LIBS" 62 fi 63 64 if test "x$no_shout2" = "x" ; then 65 AC_MSG_RESULT(yes) 66 ifelse([$1], , :, [$1]) 67 else 68 AC_MSG_RESULT(no) 69 if test -f conf.shout2test ; then 70 : 71 else 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" 75 AC_TRY_LINK([ 76#include <stdio.h> 77#include <shout/shout.h> 78], [ return 0; ], 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" 85 echo "***" 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" 93 LIBS="$ac_save_LIBS" 94 fi 95 SHOUT2_CFLAGS="" 96 SHOUT2_LIBS="" 97 ifelse([$2], , :, [$2]) 98 fi 99 AC_SUBST(SHOUT2_CFLAGS) 100 AC_SUBST(SHOUT2_LIBS) 101 rm -f conf.shout2test 102]) 103