2009-03-15 20:08:31 -04:00
|
|
|
dnl # Check for a working installation of libshout.
|
2009-08-01 09:46:39 -04:00
|
|
|
dnl # Provides appropriate --with configuration options, fills the
|
|
|
|
dnl # LIBSHOUT_CFLAGS, LIBSHOUT_CPPFLAGS, LIBSHOUT_LDFLAGS and LIBSHOUT_LIBS
|
|
|
|
dnl # variables accordingly.
|
2009-03-15 20:08:31 -04:00
|
|
|
|
|
|
|
|
2009-06-21 10:21:32 -04:00
|
|
|
dnl # Copyright (c) 2009 Moritz Grimm <mgrimm@mrsserver.net>
|
2009-03-15 20:08:31 -04:00
|
|
|
dnl #
|
|
|
|
dnl # Permission to use, copy, modify, and distribute this software for any
|
|
|
|
dnl # purpose with or without fee is hereby granted, provided that the above
|
|
|
|
dnl # copyright notice and this permission notice appear in all copies.
|
2009-06-21 10:21:32 -04:00
|
|
|
dnl #
|
2009-03-15 20:08:31 -04:00
|
|
|
dnl # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
dnl # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
dnl # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
dnl # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
dnl # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
dnl # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
dnl # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
dnl # For LIBSHOUT_CFLAGS, LIBSHOUT_CPPFLAGS, LIBSHOUT_LDFLAGS and
|
|
|
|
dnl # LIBSHOUT_LIBS:
|
|
|
|
dnl # AX_CHECK_LIBSHOUT([LIBSHOUT-VERSION], [ACTION-IF-FOUND],
|
|
|
|
dnl # [ACTION-IF-NOT-FOUND])
|
|
|
|
|
|
|
|
|
2009-06-21 10:21:32 -04:00
|
|
|
AC_DEFUN([_AX_CHECK_LIBSHOUT_OPTS],
|
2009-03-15 20:08:31 -04:00
|
|
|
[
|
|
|
|
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
2009-06-21 10:21:32 -04:00
|
|
|
if test -z "${PKG_CONFIG}"; then
|
|
|
|
AC_MSG_ERROR([The pkg-config utility is required.], [1])
|
|
|
|
fi
|
2009-03-15 20:08:31 -04:00
|
|
|
AC_ARG_VAR([LIBSHOUT_CFLAGS],
|
|
|
|
[C compiler flags for libshout])
|
|
|
|
AC_ARG_VAR([LIBSHOUT_CPPFLAGS],
|
|
|
|
[C preprocessor flags for libshout])
|
|
|
|
AC_ARG_VAR([LIBSHOUT_LDFLAGS],
|
|
|
|
[linker flags for libshout])
|
2009-06-21 10:21:32 -04:00
|
|
|
have_libshout_includes=""
|
|
|
|
have_libshout_libs=""
|
|
|
|
want_libshout="auto"
|
|
|
|
AC_ARG_WITH([libshout],
|
|
|
|
[AS_HELP_STRING([--with-libshout=PFX],
|
|
|
|
[prefix where the libshout header files and library are installed (default: autodetect)])],
|
|
|
|
[
|
|
|
|
case "${withval}" in
|
|
|
|
yes)
|
|
|
|
want_libshout="yes"
|
|
|
|
;;
|
|
|
|
no)
|
|
|
|
want_libshout="no"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
have_libshout_prefix="${withval}"
|
|
|
|
want_libshout="yes"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
]
|
|
|
|
)
|
|
|
|
AC_ARG_WITH([libshout-includes],
|
|
|
|
[AS_HELP_STRING([--with-libshout-includes=DIR],
|
|
|
|
[directory where libshout header files are installed (optional)]) ],
|
|
|
|
[
|
|
|
|
case "${withval}" in
|
|
|
|
yes|no) ;;
|
|
|
|
*)
|
|
|
|
have_libshout_includes="${withval}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
]
|
|
|
|
)
|
|
|
|
AC_ARG_WITH([libshout-libs],
|
|
|
|
[AS_HELP_STRING([--with-libshout-libs=DIR],
|
|
|
|
[directory where libshout is installed (optional)]) ],
|
|
|
|
[
|
|
|
|
case "${withval}" in
|
|
|
|
yes|no) ;;
|
|
|
|
*)
|
|
|
|
have_libshout_libs="${withval}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
]
|
|
|
|
)
|
|
|
|
AC_CACHE_VAL([local_cv_have_lib_libshout_opts],
|
|
|
|
[
|
|
|
|
ax_check_libshout_shout_pc="no"
|
|
|
|
PKG_CHECK_EXISTS([shout], [ax_check_libshout_shout_pc=yes])
|
|
|
|
if test -z "${LIBSHOUT_CFLAGS}" \
|
|
|
|
-a x"${ax_check_libshout_shout_pc}" = "xyes"; then
|
|
|
|
LIBSHOUT_CFLAGS="`${PKG_CONFIG} --cflags-only-other shout`"
|
|
|
|
fi
|
|
|
|
if test -n "${LIBSHOUT_CPPFLAGS}"; then
|
2009-08-01 09:46:39 -04:00
|
|
|
if test -n "${have_libshout_includes}"; then
|
2009-06-21 10:21:32 -04:00
|
|
|
LIBSHOUT_CPPFLAGS="${LIBSHOUT_CPPFLAGS} -I${have_libshout_includes}"
|
|
|
|
fi
|
|
|
|
else
|
2009-08-01 09:46:39 -04:00
|
|
|
if test -n "${have_libshout_includes}"; then
|
2009-06-21 10:21:32 -04:00
|
|
|
LIBSHOUT_CPPFLAGS="-I${have_libshout_includes}"
|
|
|
|
else
|
|
|
|
if test x"${want_libshout}" = "xauto" \
|
|
|
|
-a x"${ax_check_libshout_shout_pc}" = "xyes"; then
|
|
|
|
LIBSHOUT_CPPFLAGS="`${PKG_CONFIG} --cflags-only-I shout`"
|
2009-08-01 09:46:39 -04:00
|
|
|
elif test -n "${have_libshout_prefix}"; then
|
2009-06-21 10:21:32 -04:00
|
|
|
LIBSHOUT_CPPFLAGS="-I${have_libshout_prefix}/include"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test -n "${LIBSHOUT_LDFLAGS}"; then
|
2009-08-01 09:46:39 -04:00
|
|
|
if test -n "${have_libshout_libs}"; then
|
2009-06-21 10:21:32 -04:00
|
|
|
LIBSHOUT_LDFLAGS="-L${have_libshout_libs} ${LIBSHOUT_LDFLAGS}"
|
|
|
|
fi
|
2009-03-15 20:08:31 -04:00
|
|
|
else
|
2009-06-21 10:21:32 -04:00
|
|
|
if test -n "${have_libshout_libs}"; then
|
|
|
|
LIBSHOUT_LDFLAGS="-L${have_libshout_libs}"
|
|
|
|
else
|
|
|
|
if test x"${want_libshout}" = "xauto" \
|
|
|
|
-a x"${ax_check_libshout_shout_pc}" = "xyes"; then
|
|
|
|
LIBSHOUT_LDFLAGS=" \
|
|
|
|
`${PKG_CONFIG} --libs-only-L shout` \
|
|
|
|
`${PKG_CONFIG} --libs-only-other shout` \
|
|
|
|
"
|
2009-08-01 09:46:39 -04:00
|
|
|
elif test -n "${have_libshout_prefix}"; then
|
2009-06-21 10:21:32 -04:00
|
|
|
LIBSHOUT_LDFLAGS="-L${have_libshout_prefix}/lib"
|
|
|
|
fi
|
|
|
|
fi
|
2009-03-15 20:08:31 -04:00
|
|
|
fi
|
2009-06-21 10:21:32 -04:00
|
|
|
local_cv_have_lib_libshout_opts=yes
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
AC_DEFUN([AX_CHECK_LIBSHOUT],
|
|
|
|
[
|
|
|
|
AC_REQUIRE([_AX_CHECK_LIBSHOUT_OPTS])
|
|
|
|
AC_REQUIRE([AC_PROG_FGREP])
|
|
|
|
AC_ARG_VAR([LIBSHOUT_LIBS],
|
|
|
|
[libraries to use for libshout])
|
2009-03-15 20:08:31 -04:00
|
|
|
AC_CACHE_VAL([local_cv_have_lib_libshout],
|
|
|
|
[
|
|
|
|
local_cv_have_lib_libshout=no
|
|
|
|
|
2009-06-21 10:21:32 -04:00
|
|
|
if test x"${want_libshout}" != "xno"; then # want_libshout != no
|
|
|
|
|
2009-03-15 20:08:31 -04:00
|
|
|
if test -z "${PKG_CONFIG}"; then
|
|
|
|
AC_MSG_ERROR([The pkg-config utility is required.], [1])
|
|
|
|
fi
|
|
|
|
|
2009-08-01 11:28:07 -04:00
|
|
|
if test -n "$1" -a x"${ax_check_libshout_shout_pc}" = "xyes"; then
|
|
|
|
PKG_CHECK_EXISTS([shout $1], [],
|
|
|
|
[AC_MSG_ERROR([libshout version $1 is required.], [1])]
|
|
|
|
)
|
|
|
|
fi
|
2009-03-15 20:08:31 -04:00
|
|
|
|
|
|
|
libshout_libs_autodetect=no
|
2009-08-01 12:08:45 -04:00
|
|
|
if test -z "${LIBSHOUT_LIBS}" \
|
|
|
|
-a x"${ax_check_libshout_shout_pc}" = "xyes"; then
|
2009-03-15 20:08:31 -04:00
|
|
|
LIBSHOUT_LIBS="`${PKG_CONFIG} --libs-only-l shout`"
|
|
|
|
libshout_libs_autodetect=yes
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If libshout required libm, make sure that it is listed at the end:
|
2009-06-21 10:21:32 -04:00
|
|
|
if test x"${libshout_libs_autodetect}" = x"yes"; then
|
2009-03-15 20:08:31 -04:00
|
|
|
if test -n "`echo ${LIBSHOUT_LIBS} | ${FGREP} -e ' -lm'`"; then
|
|
|
|
xt_shout_TEMP="`echo ${LIBSHOUT_LIBS} | sed -e 's, -lm,,g'`"
|
|
|
|
LIBSHOUT_LIBS="${xt_shout_TEMP} -lm"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
ax_check_libshout_save_CFLAGS="${CFLAGS}"
|
|
|
|
ax_check_libshout_save_CPPFLAGS="${CPPFLAGS}"
|
|
|
|
ax_check_libshout_save_LDFLAGS="${LDFLAGS}"
|
|
|
|
ax_check_libshout_save_LIBS="${LIBS}"
|
|
|
|
AC_LANG_PUSH([C])
|
|
|
|
CFLAGS="${CFLAGS} ${LIBSHOUT_CFLAGS}"
|
|
|
|
CPPFLAGS="${CPPFLAGS} ${LIBSHOUT_CPPFLAGS}"
|
|
|
|
LDFLAGS="${LDFLAGS} ${LIBSHOUT_LDFLAGS}"
|
|
|
|
LIBS="${LIBSHOUT_LIBS} ${LIBS}"
|
|
|
|
AC_CHECK_HEADER([shout/shout.h],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING([if libshout works])
|
|
|
|
AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM(
|
|
|
|
[[
|
|
|
|
#include <shout/shout.h>
|
|
|
|
]],
|
|
|
|
[[
|
|
|
|
shout_new();
|
|
|
|
]]
|
|
|
|
)],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
local_cv_have_lib_libshout=yes
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([no])
|
2009-08-01 12:08:45 -04:00
|
|
|
if test x"${libshout_libs_autodetect}" = "xyes"; then
|
|
|
|
LIBSHOUT_LIBS="`${PKG_CONFIG} --static --libs-only-l shout`"
|
|
|
|
LIBS="${LIBSHOUT_LIBS} ${ax_check_libshout_save_LIBS}"
|
|
|
|
AC_MSG_CHECKING([if libshout works with explicit dependencies])
|
|
|
|
AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM(
|
|
|
|
[[
|
|
|
|
#include <shout/shout.h>
|
|
|
|
]],
|
|
|
|
[[
|
|
|
|
shout_new();
|
|
|
|
]])],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
local_cv_have_lib_libshout=yes
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
]
|
|
|
|
)
|
|
|
|
fi
|
2009-03-15 20:08:31 -04:00
|
|
|
]
|
|
|
|
)
|
|
|
|
])
|
|
|
|
CFLAGS="${ax_check_libshout_save_CFLAGS}"
|
|
|
|
CPPFLAGS="${ax_check_libshout_save_CPPFLAGS}"
|
|
|
|
LDFLAGS="${ax_check_libshout_save_LDFLAGS}"
|
|
|
|
LIBS="${ax_check_libshout_save_LIBS}"
|
|
|
|
AC_LANG_POP([C])
|
|
|
|
|
2009-06-21 10:21:32 -04:00
|
|
|
fi # want_libshout != no
|
|
|
|
|
2009-03-15 20:08:31 -04:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for libshout $1])
|
|
|
|
if test x"${local_cv_have_lib_libshout}" = "xyes"; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
:
|
|
|
|
$2
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
:
|
|
|
|
$3
|
|
|
|
fi
|
|
|
|
|
|
|
|
])
|