shout.m4 1.81 KB
Newer Older
1
2
3
4
dnl XIPH_PATH_SHOUT
dnl Jack Moffitt <jack@icecast.org> 08-06-2001
dnl Rewritten for libshout 2
dnl Brendan Cully <brendan@xiph.org> 20030612
5
dnl 
6
dnl $Id: shout.m4,v 1.9 2003/06/26 19:34:00 brendan Exp $
7

8
9
10
11
# XIPH_PATH_SHOUT([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
# Test for libshout, and define SHOUT_CFLAGS and SHOUT_LIBS
AC_DEFUN([XIPH_PATH_SHOUT],
[dnl
12
xt_have_shout="no"
13
14
15
SHOUT_CFLAGS=""
SHOUT_LIBS=""

16
17
18
# NB: PKG_CHECK_MODULES exits if pkg-config is unavailable on the targe
# system, so we can't use it.

19
20
21
# seed pkg-config with the default libshout location
PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-/usr/local/lib/pkgconfig}

22
# Step 1: Use pkg-config if available
23
24
25
26
27
28
29
30
AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
if test "$PKGCONFIG" != "no" && `$PKGCONFIG --exists shout`
then
  SHOUT_CFLAGS=`$PKGCONFIG --cflags shout`
  SHOUT_LIBS=`$PKGCONFIG --libs shout`
  xt_have_shout="maybe"
else
  if test "$PKGCONFIG" != "no"
31
  then
32
    AC_MSG_NOTICE([$PKGCONFIG couldn't find libshout. Try adjusting PKG_CONFIG_PATH.])
Jack Moffitt's avatar
Jack Moffitt committed
33
  fi
34
35
36
37
38
39
40
41
42
  # pkg-config unavailable, try shout-config
  AC_PATH_PROG([SHOUTCONFIG], [shout-config], [no])
  if test "$SHOUTCONFIG" != "no" && test `$SHOUTCONFIG --package` = "libshout"
  then
    SHOUT_CFLAGS=`$SHOUTCONFIG --cflags`
    SHOUT_LIBS=`$SHOUTCONFIG --libs`
    xt_have_shout="maybe"
  fi
fi
Jack Moffitt's avatar
Jack Moffitt committed
43

44
# Now try actually using libshout
45
if test "$xt_have_shout" != "no"
46
47
48
49
50
51
52
53
54
then
  ac_save_CFLAGS="$CFLAGS"
  ac_save_LIBS="$LIBS"
  CFLAGS="$CFLAGS $SHOUT_CFLAGS"
  LIBS="$LIBS $SHOUT_LIBS"
  AC_CHECK_HEADER([shout/shout.h], [
    AC_DEFINE([HAVE_SHOUT_SHOUT_H], 1, [Define if you have <shout/shout.h>])
    AC_CHECK_FUNC([shout_new], [
      ifelse([$1], , :, [$1])
55
      xt_have_shout="yes"
56
57
    ])
  ])
58
59
60
61
  CFLAGS="$ac_save_CFLAGS"
  LIBS="$ac_save_LIBS"
fi

62
if test "$xt_have_shout" != "yes"
63
64
65
then
  ifelse([$2], , :, [$2])
fi
66
])dnl XIPH_PATH_SHOUT