Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
cdbdcec7
Commit
cdbdcec7
authored
Nov 21, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
m4/mpd_auto.m4: reduce "eval" bloat
Don't assign bash variables; instead, use the m4 parameters directly.
parent
ccf78448
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
44 deletions
+25
-44
mpd_auto.m4
m4/mpd_auto.m4
+25
-44
No files found.
m4/mpd_auto.m4
View file @
cdbdcec7
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment