2015-03-19 17:19:11 +01:00
|
|
|
dnl Parameters: varname1, description
|
2009-03-28 11:10:40 +01:00
|
|
|
AC_DEFUN([MPD_AUTO_ENABLED], [
|
2014-11-21 14:39:33 +01:00
|
|
|
if test x$[]enable_$1 = xauto; then
|
|
|
|
AC_MSG_NOTICE([auto-detected $2])
|
2014-11-24 18:27:04 +01:00
|
|
|
enable_$1=yes
|
2009-03-28 11:10:40 +01:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2015-03-19 17:19:11 +01:00
|
|
|
dnl Parameters: varname1, description, errmsg
|
2009-03-28 11:10:40 +01:00
|
|
|
AC_DEFUN([MPD_AUTO_DISABLED], [
|
2014-11-21 14:39:33 +01:00
|
|
|
if test x$[]enable_$1 = xauto; then
|
|
|
|
AC_MSG_WARN([$3 -- disabling $2])
|
|
|
|
enable_$1=no
|
|
|
|
elif test x$[]enable_$1 = xyes; then
|
|
|
|
AC_MSG_ERROR([$2: $3])
|
2009-03-28 11:10:40 +01:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2009-04-15 22:23:46 +02:00
|
|
|
dnl Check whether a prerequisite for a feature was found. This is
|
|
|
|
dnl very similar to MPD_AUTO_RESULT, but does not finalize the
|
|
|
|
dnl detection; it assumes that more checks will follow.
|
|
|
|
AC_DEFUN([MPD_AUTO_PRE], [
|
2014-11-21 14:39:33 +01:00
|
|
|
if test x$[]enable_$1 != xno && test x$[]found_$1 = xno; then
|
|
|
|
MPD_AUTO_DISABLED([$1], [$2], [$3])
|
2009-04-15 22:23:46 +02:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2015-03-19 17:19:11 +01:00
|
|
|
dnl Evaluate a check's result. Abort if the feature was requested
|
|
|
|
dnl explicitly but is unavailable.
|
|
|
|
dnl
|
|
|
|
dnl Parameters: varname1, description, errmsg
|
2009-03-28 11:10:40 +01:00
|
|
|
AC_DEFUN([MPD_AUTO_RESULT], [
|
2014-11-21 14:39:33 +01:00
|
|
|
if test x$[]enable_$1 = xno; then
|
|
|
|
found_$1=no
|
2009-03-28 11:10:40 +01:00
|
|
|
fi
|
|
|
|
|
2014-11-21 14:39:33 +01:00
|
|
|
if test x$[]found_$1 = xyes; then
|
|
|
|
MPD_AUTO_ENABLED([$1], [$2])
|
2009-03-28 11:10:40 +01:00
|
|
|
else
|
2014-11-21 14:39:33 +01:00
|
|
|
MPD_AUTO_DISABLED([$1], [$2], [$3])
|
2009-03-28 11:10:40 +01:00
|
|
|
fi
|
|
|
|
])
|
2009-03-28 21:48:07 +01:00
|
|
|
|
2015-03-19 17:19:11 +01:00
|
|
|
dnl Invoke a check if its configuration is "yes" or "auto" and call
|
|
|
|
dnl MPD_AUTO_RESULT.
|
|
|
|
dnl
|
2014-11-23 07:39:05 +01:00
|
|
|
dnl Parameters: varname1, description, errmsg, check
|
|
|
|
AC_DEFUN([MPD_AUTO], [
|
2014-11-21 14:39:33 +01:00
|
|
|
if test x$[]enable_$1 != xno; then
|
2014-11-23 07:39:05 +01:00
|
|
|
$4
|
2009-03-28 21:48:07 +01:00
|
|
|
fi
|
2014-11-23 07:39:05 +01:00
|
|
|
MPD_AUTO_RESULT([$1], [$2], [$3])
|
|
|
|
])
|
2009-03-28 21:48:07 +01:00
|
|
|
|
2015-03-19 17:19:11 +01:00
|
|
|
dnl Wrapper for MPD_AUTO and PKG_CHECK_MODULES.
|
|
|
|
dnl
|
|
|
|
dnl Parameters: varname1, varname2, pkgname, description, errmsg
|
2014-11-23 07:39:05 +01:00
|
|
|
AC_DEFUN([MPD_AUTO_PKG], [
|
|
|
|
MPD_AUTO([$1], [$4], [$5],
|
|
|
|
[PKG_CHECK_MODULES([$2], [$3],
|
|
|
|
[found_$1=yes],
|
|
|
|
[found_$1=no])])
|
2009-03-28 21:48:07 +01:00
|
|
|
])
|
2011-09-01 09:18:16 +02:00
|
|
|
|
|
|
|
dnl Check with pkg-config first, fall back to AC_CHECK_LIB.
|
|
|
|
dnl
|
|
|
|
dnl Parameters: varname1, varname2, pkgname, libname, symname, libs, cflags, description, errmsg
|
|
|
|
AC_DEFUN([MPD_AUTO_PKG_LIB], [
|
2014-11-23 07:39:05 +01:00
|
|
|
MPD_AUTO([$1], [$8], [$9],
|
|
|
|
[PKG_CHECK_MODULES([$2], [$3],
|
2014-11-21 14:39:33 +01:00
|
|
|
[found_$1=yes],
|
2011-09-01 09:18:16 +02:00
|
|
|
AC_CHECK_LIB($4, $5,
|
2014-11-21 14:39:33 +01:00
|
|
|
[found_$1=yes $2_LIBS='$6' $2_CFLAGS='$7'],
|
|
|
|
[found_$1=no],
|
2014-11-23 07:39:05 +01:00
|
|
|
[$6]))])
|
2011-09-01 09:18:16 +02:00
|
|
|
])
|
2013-10-16 23:57:05 +02:00
|
|
|
|
|
|
|
dnl Wrapper for AC_CHECK_LIB.
|
|
|
|
dnl
|
|
|
|
dnl Parameters: varname1, varname2, libname, symname, libs, cflags, description, errmsg
|
|
|
|
AC_DEFUN([MPD_AUTO_LIB], [
|
|
|
|
AC_SUBST([$2_LIBS], [])
|
|
|
|
AC_SUBST([$2_CFLAGS], [])
|
|
|
|
|
2014-11-23 07:39:05 +01:00
|
|
|
MPD_AUTO([$1], [$7], [$8],
|
|
|
|
[AC_CHECK_LIB($3, $4,
|
2014-11-21 14:39:33 +01:00
|
|
|
[found_$1=yes $2_LIBS='$5' $2_CFLAGS='$6'],
|
|
|
|
[found_$1=no],
|
2014-11-23 07:39:05 +01:00
|
|
|
[$5])])
|
2013-10-16 23:57:05 +02:00
|
|
|
])
|
2014-11-21 22:19:57 +01:00
|
|
|
|
2015-03-19 17:19:11 +01:00
|
|
|
dnl Convert the given string into a string for the "default value" in
|
|
|
|
dnl the help text. If the string is a literal, then it is returned
|
|
|
|
dnl as-is; if it contains a variable reference, just "auto" is
|
|
|
|
dnl emitted.
|
|
|
|
dnl
|
|
|
|
dnl Parameters: varname1
|
2014-12-08 18:38:52 +01:00
|
|
|
AC_DEFUN([MPD_FORMAT_DEFAULT],
|
|
|
|
[ifelse([$1], [], [auto],
|
|
|
|
index([$1], [$]), [-1], [$1],
|
|
|
|
[auto])])
|
|
|
|
|
2014-12-08 21:43:32 +01:00
|
|
|
dnl Wrapper for AC_ARG_ENABLE, AC_DEFINE and AM_CONDITIONAL
|
2014-11-21 22:19:57 +01:00
|
|
|
dnl
|
2014-12-08 21:43:32 +01:00
|
|
|
dnl Parameters: varname1, varname2, description, default, check
|
|
|
|
AC_DEFUN([MPD_ARG_ENABLE], [
|
2014-11-21 22:19:57 +01:00
|
|
|
AC_ARG_ENABLE(translit([$1], [_], [-]),
|
|
|
|
AS_HELP_STRING([--enable-]translit([$1], [_], [-]),
|
2014-12-08 21:43:32 +01:00
|
|
|
[enable $3 (default: ]MPD_FORMAT_DEFAULT([$4])[)]),,
|
|
|
|
[enable_$1=]ifelse([$4], [], [auto], [$4]))
|
2014-11-21 22:19:57 +01:00
|
|
|
|
2014-12-08 21:43:32 +01:00
|
|
|
$5
|
2014-11-21 22:19:57 +01:00
|
|
|
|
2014-12-21 23:25:48 +01:00
|
|
|
MPD_DEFINE_CONDITIONAL(enable_$1, ENABLE_$2, [$3])
|
2014-11-21 22:19:57 +01:00
|
|
|
])
|
|
|
|
|
2014-12-08 21:43:32 +01:00
|
|
|
dnl Wrapper for AC_ARG_ENABLE and MPD_AUTO_PKG
|
|
|
|
dnl
|
|
|
|
dnl Parameters: varname1, varname2, pkg, description, errmsg, default, pre
|
|
|
|
AC_DEFUN([MPD_ENABLE_AUTO_PKG], [
|
|
|
|
MPD_ARG_ENABLE([$1], [$2], [$4], [$6], [
|
|
|
|
$7
|
|
|
|
MPD_AUTO_PKG($1, $2, $3, $4, $5)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2014-11-22 23:18:07 +01:00
|
|
|
dnl Wrapper for AC_ARG_ENABLE and MPD_AUTO_PKG_LIB
|
|
|
|
dnl
|
|
|
|
dnl Parameters: varname1, varname2, pkg, libname, symname, libs, cflags, description, errmsg, default, pre
|
|
|
|
AC_DEFUN([MPD_ENABLE_AUTO_PKG_LIB], [
|
2014-12-09 21:18:00 +01:00
|
|
|
MPD_ARG_ENABLE([$1], [$2], [$8], [$10], [
|
2014-12-08 21:43:32 +01:00
|
|
|
$11
|
|
|
|
MPD_AUTO_PKG_LIB($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
|
|
|
])
|
2014-11-22 23:18:07 +01:00
|
|
|
])
|
|
|
|
|
2014-12-09 21:07:05 +01:00
|
|
|
dnl Wrapper for AC_ARG_ENABLE and MPD_AUTO_LIB
|
|
|
|
dnl
|
|
|
|
dnl Parameters: varname1, varname2, libname, symname, libs, cflags, description, errmsg, default, pre
|
|
|
|
AC_DEFUN([MPD_ENABLE_AUTO_LIB], [
|
|
|
|
MPD_ARG_ENABLE([$1], [$2], [$7], [$9], [
|
|
|
|
$10
|
|
|
|
MPD_AUTO_LIB($1, $2, $3, $4, $5, $6, $7, $8)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2014-11-21 22:19:57 +01:00
|
|
|
dnl Wrapper for MPD_ENABLE_AUTO_PKG and MPD_DEPENDS
|
|
|
|
dnl
|
|
|
|
dnl Parameters: varname1, varname2, pkg, description, errmsg, default, dep_variable, dep_errmsg
|
|
|
|
AC_DEFUN([MPD_ENABLE_AUTO_PKG_DEPENDS], [
|
|
|
|
MPD_ENABLE_AUTO_PKG([$1], [$2], [$3], [$4], [$5], [$6],
|
|
|
|
[MPD_DEPENDS([enable_$1], [$7], [$8])])
|
|
|
|
])
|