VS2008 project files.
[xiph/unicode.git] / ezstream / m4 / shout.m4
blobc4f6120b441622fd6e038686d4737ea2b7eaf57c
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 dnl XXX - Up until and including speex-1.2beta1, '-lm' has been missing from
51 dnl       --libs in speex.pc, even though Speex (still) depends on it. This is
52 dnl       a problem for Solaris' linker and at least some static archs using
53 dnl       GNU ld. '-lm' now comes from the libshout's libvorbis dependency and
54 dnl       is in the wrong place, if libshout was built with Speex support. Just
55 dnl       move libm to the end for now.
56 xt_shout_TEMP="`echo $SHOUT_LIBS | sed -e 's,-lm,,g'`"
57 SHOUT_LIBS="$xt_shout_TEMP -lm"
59 # Now try actually using libshout
60 if test "$xt_have_shout" != "no"
61 then
62   ac_save_CPPFLAGS="$CPPFLAGS"
63   ac_save_CFLAGS="$CFLAGS"
64   ac_save_LIBS="$LIBS"
65   CPPFLAGS="$CPPFLAGS $SHOUT_CPPFLAGS"
66   CFLAGS="$CFLAGS $SHOUT_CFLAGS"
67   LIBS="$SHOUT_LIBS $LIBS"
68   AC_CHECK_HEADERS([shout/shout.h], [
69     AC_CHECK_FUNC([shout_new], [
70       ifelse([$1], , :, [$1])
71       xt_have_shout="yes"
72     ])
73     AC_EGREP_CPP([yes], [#include <shout/shout.h>
74 #if SHOUT_THREADSAFE
75 yes
76 #endif
77 ], [SHOUT_THREADSAFE="yes"])
78   ])
79   CPPFLAGS="$ac_save_CPPFLAGS"
80   CFLAGS="$ac_save_CFLAGS"
81   LIBS="$ac_save_LIBS"
84 if test "$xt_have_shout" != "yes"
85 then
86   ifelse([$2], , :, [$2])
88 ])dnl XIPH_PATH_SHOUT