m4/mpd_auto.m4: reduce "eval" bloat
Don't assign bash variables; instead, use the m4 parameters directly.
This commit is contained in:
parent
ccf78448aa
commit
cdbdcec715
@ -1,23 +1,16 @@
|
||||
AC_DEFUN([MPD_AUTO_ENABLED], [
|
||||
var="enable_$1"
|
||||
feature="$2"
|
||||
|
||||
if eval "test x`echo '$'$var` = xauto"; then
|
||||
AC_MSG_NOTICE([auto-detected $feature])
|
||||
eval "$var=yes"
|
||||
if test x$[]enable_$1 = xauto; then
|
||||
AC_MSG_NOTICE([auto-detected $2])
|
||||
enable_$1=no
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([MPD_AUTO_DISABLED], [
|
||||
var="enable_$1"
|
||||
feature="$2"
|
||||
msg="$3"
|
||||
|
||||
if eval "test x`echo '$'$var` = xauto"; then
|
||||
AC_MSG_WARN([$msg -- disabling $feature])
|
||||
eval "$var=no"
|
||||
elif eval "test x`echo '$'$var` = xyes"; then
|
||||
AC_MSG_ERROR([$feature: $msg])
|
||||
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])
|
||||
fi
|
||||
])
|
||||
|
||||
@ -25,40 +18,28 @@ 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], [
|
||||
name="$1"
|
||||
var="enable_$1"
|
||||
found="found_$name"
|
||||
feature="$2"
|
||||
msg="$3"
|
||||
|
||||
if eval "test x`echo '$'$var` != xno" && eval "test x`echo '$'$found` = xno"; then
|
||||
MPD_AUTO_DISABLED([$name], [$feature], [$msg])
|
||||
if test x$[]enable_$1 != xno && test x$[]found_$1 = xno; then
|
||||
MPD_AUTO_DISABLED([$1], [$2], [$3])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([MPD_AUTO_RESULT], [
|
||||
name="$1"
|
||||
var="enable_$1"
|
||||
found="found_$name"
|
||||
feature="$2"
|
||||
msg="$3"
|
||||
|
||||
if eval "test x`echo '$'$var` = xno"; then
|
||||
eval "$found=no"
|
||||
if test x$[]enable_$1 = xno; then
|
||||
found_$1=no
|
||||
fi
|
||||
|
||||
if eval "test x`echo '$'$found` = xyes"; then
|
||||
MPD_AUTO_ENABLED([$name], [$feature])
|
||||
if test x$[]found_$1 = xyes; then
|
||||
MPD_AUTO_ENABLED([$1], [$2])
|
||||
else
|
||||
MPD_AUTO_DISABLED([$name], [$feature], [$msg])
|
||||
MPD_AUTO_DISABLED([$1], [$2], [$3])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([MPD_AUTO_PKG], [
|
||||
if eval "test x`echo '$'enable_$1` != xno"; then
|
||||
if test x$[]enable_$1 != xno; then
|
||||
PKG_CHECK_MODULES([$2], [$3],
|
||||
[eval "found_$1=yes"],
|
||||
[eval "found_$1=no"])
|
||||
[found_$1=yes],
|
||||
[found_$1=no])
|
||||
fi
|
||||
|
||||
MPD_AUTO_RESULT([$1], [$4], [$5])
|
||||
@ -68,12 +49,12 @@ 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], [
|
||||
if eval "test x`echo '$'enable_$1` != xno"; then
|
||||
if test x$[]enable_$1 != xno; then
|
||||
PKG_CHECK_MODULES([$2], [$3],
|
||||
[eval "found_$1=yes"],
|
||||
[found_$1=yes],
|
||||
AC_CHECK_LIB($4, $5,
|
||||
[eval "found_$1=yes $2_LIBS='$6' $2_CFLAGS='$7'"],
|
||||
[eval "found_$1=no"],
|
||||
[found_$1=yes $2_LIBS='$6' $2_CFLAGS='$7'],
|
||||
[found_$1=no],
|
||||
[$6]))
|
||||
fi
|
||||
|
||||
@ -87,10 +68,10 @@ AC_DEFUN([MPD_AUTO_LIB], [
|
||||
AC_SUBST([$2_LIBS], [])
|
||||
AC_SUBST([$2_CFLAGS], [])
|
||||
|
||||
if eval "test x`echo '$'enable_$1` != xno"; then
|
||||
if test x$[]enable_$1 != xno; then
|
||||
AC_CHECK_LIB($3, $4,
|
||||
[eval "found_$1=yes $2_LIBS='$5' $2_CFLAGS='$6'"],
|
||||
[eval "found_$1=no"],
|
||||
[found_$1=yes $2_LIBS='$5' $2_CFLAGS='$6'],
|
||||
[found_$1=no],
|
||||
[$5])
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user