2 dnl Jack Moffitt <jack@icecast.org> 08-06-2001
3 dnl Rewritten for libshout 2
4 dnl Brendan Cully <brendan@xiph.org> 20030612
6 dnl $Id: shout.m4 7180 2004-07-20 02:50:54Z brendan $
8 # XIPH_PATH_SHOUT([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
9 # Test for libshout, and define SHOUT_CPPFLAGS SHOUT_CFLAGS SHOUT_LIBS, and
11 AC_DEFUN([XIPH_PATH_SHOUT],
19 # NB: PKG_CHECK_MODULES exits if pkg-config is unavailable on the target
20 # system, so we can't use it.
22 # seed pkg-config with the default libshout location
23 PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-/usr/local/lib/pkgconfig}
24 export PKG_CONFIG_PATH
26 # Step 1: Use pkg-config if available
27 AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
28 if test "$PKGCONFIG" != "no" && `$PKGCONFIG --exists shout`
30 SHOUT_CFLAGS=`$PKGCONFIG --variable=cflags_only shout`
31 SHOUT_CPPFLAGS=`$PKGCONFIG --variable=cppflags shout`
32 SHOUT_LIBS=`$PKGCONFIG --libs shout`
35 if test "$PKGCONFIG" != "no"
37 AC_MSG_NOTICE([$PKGCONFIG couldn't find libshout. Try adjusting PKG_CONFIG_PATH.])
39 # pkg-config unavailable, try shout-config
40 AC_PATH_PROG([SHOUTCONFIG], [shout-config], [no])
41 if test "$SHOUTCONFIG" != "no" && test `$SHOUTCONFIG --package` = "libshout"
43 SHOUT_CPPFLAGS=`$SHOUTCONFIG --cppflags`
44 SHOUT_CFLAGS=`$SHOUTCONFIG --cflags-only`
45 SHOUT_LIBS=`$SHOUTCONFIG --libs`
50 # Now try actually using libshout
51 if test "$xt_have_shout" != "no"
53 ac_save_CPPFLAGS="$CPPFLAGS"
54 ac_save_CFLAGS="$CFLAGS"
57 # freebsd 6.1 + shout 2.2 port seems to leave pthread out
60 case "$SHOUT_CFLAGS$SHOUT_CPPFLAGS" in
62 SHOUT_LIBS="$SHOUT_LIBS -lpthread"
67 CPPFLAGS="$CPPFLAGS $SHOUT_CPPFLAGS"
68 CFLAGS="$CFLAGS $SHOUT_CFLAGS"
69 LIBS="$SHOUT_LIBS $LIBS"
70 AC_CHECK_HEADERS([shout/shout.h], [
71 AC_CHECK_FUNC([shout_new], [
72 ifelse([$1], , :, [$1])
75 AC_EGREP_CPP([yes], [#include <shout/shout.h>
79 ], [SHOUT_THREADSAFE="yes"])
81 CPPFLAGS="$ac_save_CPPFLAGS"
82 CFLAGS="$ac_save_CFLAGS"
86 if test "$xt_have_shout" != "yes"
88 ifelse([$2], , :, [$2])