shout.m4 1.75 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
Jack Moffitt's avatar
Jack Moffitt committed
5
dnl
6 7 8 9 10 11 12 13 14 15 16
# 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
have_shout="no"
SHOUT_CFLAGS=""
SHOUT_LIBS=""

# Step 1: Use pkg-config if available
m4_ifdef([PKG_CHECK_MODULES],
  [# PKG_CHECK_MODULES available
17
  PKG_CHECK_MODULES([SHOUT], [shout])
18 19 20
  have_shout="maybe"],
  [# PKG_CHECK_MODULES is unavailable, search for pkg-config program
  AC_PATH_PROG([PKGCONFIG], [pkg-config], [none])
21
  if test "$PKGCONFIG" != "none" && `$PKGCONFIG --exists shout`
22
  then
23 24
    SHOUT_CFLAGS=`$PKGCONFIG --cflags shout`
    SHOUT_LIBS=`$PKGCONFIG --libs shout`
25 26
    have_shout="maybe"
  else
27 28 29 30
    if test "$PKGCONFIG" != "none"
    then
      AC_MSG_NOTICE([$PKGCONFIG couldn't find libshout. Try adjusting PKG_CONFIG_PATH.])
    fi
31 32
    # Step 2: try shout-config
    AC_PATH_PROG([SHOUTCONFIG], [shout-config], [none])
33
    if test "$SHOUTCONFIG" != "none" && test `$SHOUTCONFIG --package` = "libshout"
34 35 36 37 38
    then
      SHOUT_CFLAGS=`$SHOUTCONFIG --cflags`
      SHOUT_LIBS=`$SHOUTCONFIG --libs`
      have_shout="maybe"
    fi
Jack Moffitt's avatar
Jack Moffitt committed
39
  fi
40
  ])
Jack Moffitt's avatar
Jack Moffitt committed
41

42 43 44 45 46 47 48 49 50 51 52 53
# Now try actually using libshout
if test "$have_shout" != "no"
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])
      have_shout="yes"
54 55
    ])
  ])
56 57 58 59 60 61 62 63
  CFLAGS="$ac_save_CFLAGS"
  LIBS="$ac_save_LIBS"
fi

if test "$have_shout" != "yes"
then
  ifelse([$2], , :, [$2])
fi
64
])dnl XIPH_PATH_SHOUT