Initial revision 6759
[qball-mpd.git] / m4 / .svn / text-base / shout.m4.svn-base
blob4eba5c09bd917245a282850fb0fe2f738e4b744d
1 dnl XIPH_PATH_SHOUT
2 dnl Jack Moffitt <jack@icecast.org> 08-06-2001
3 dnl Rewritten for libshout 2
4 dnl Brendan Cully <brendan@xiph.org> 20030612
5 dnl 
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
10 # SHOUT_THREADSAFE
11 AC_DEFUN([XIPH_PATH_SHOUT],
12 [dnl
13 xt_have_shout="no"
14 SHOUT_THREADSAFE="no"
15 SHOUT_CPPFLAGS=""
16 SHOUT_CFLAGS=""
17 SHOUT_LIBS=""
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`
29 then
30   SHOUT_CFLAGS=`$PKGCONFIG --variable=cflags_only shout`
31   SHOUT_CPPFLAGS=`$PKGCONFIG --variable=cppflags shout`
32   SHOUT_LIBS=`$PKGCONFIG --libs shout`
33   xt_have_shout="maybe"
34 else
35   if test "$PKGCONFIG" != "no"
36   then
37     AC_MSG_NOTICE([$PKGCONFIG couldn't find libshout. Try adjusting PKG_CONFIG_PATH.])
38   fi
39   # pkg-config unavailable, try shout-config
40   AC_PATH_PROG([SHOUTCONFIG], [shout-config], [no])
41   if test "$SHOUTCONFIG" != "no" && test `$SHOUTCONFIG --package` = "libshout"
42   then
43     SHOUT_CPPFLAGS=`$SHOUTCONFIG --cppflags`
44     SHOUT_CFLAGS=`$SHOUTCONFIG --cflags-only`
45     SHOUT_LIBS=`$SHOUTCONFIG --libs`
46     xt_have_shout="maybe"
47   fi
50 # Now try actually using libshout
51 if test "$xt_have_shout" != "no"
52 then
53   ac_save_CPPFLAGS="$CPPFLAGS"
54   ac_save_CFLAGS="$CFLAGS"
55   ac_save_LIBS="$LIBS"
57   # freebsd 6.1 + shout 2.2 port seems to leave pthread out
58   case "$host_os" in
59   freebsd*)
60         case "$SHOUT_CFLAGS$SHOUT_CPPFLAGS" in
61         *-D_THREAD_SAFE*)
62                 SHOUT_LIBS="$SHOUT_LIBS -lpthread"
63                 ;;
64         esac
65         ;;
66   esac
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])
73       xt_have_shout="yes"
74     ])
75     AC_EGREP_CPP([yes], [#include <shout/shout.h>
76 #if SHOUT_THREADSAFE
77 yes
78 #endif
79 ], [SHOUT_THREADSAFE="yes"])
80   ])
81   CPPFLAGS="$ac_save_CPPFLAGS"
82   CFLAGS="$ac_save_CFLAGS"
83   LIBS="$ac_save_LIBS"
86 if test "$xt_have_shout" != "yes"
87 then
88   ifelse([$2], , :, [$2])
90 ])dnl XIPH_PATH_SHOUT