Skip to content

Commit

Permalink
Alternative --with[out]-<backend> syntax in configure script
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipberndt committed Jan 28, 2015
1 parent 785d1a2 commit dff71d6
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ CFLAGS=
MANDIR=
PKG_CONFIG=pkg-config
BACKENDS=
ENFORCED_BACKENDS=
DISABLED_BACKENDS=

# Help and options
help() {
Expand All @@ -40,6 +42,8 @@ options:
poppler (PDF),
spectre (PS/EPS),
wand (ImageMagick, various formats)
--with[out]-<backend> Alternative syntax for backend selection. Non-specified backends are
autodetermined.
EOF
}
Expand Down Expand Up @@ -98,9 +102,20 @@ while [ $# -gt 0 ]; do
done
;;
*)
echo "Unknown option: $1" >&2
help
exit 1
if [ "${PARAMETER#--without-}" != "${PARAMETER}" ]; then
DISABLED_BACKENDS="${PARAMETER#--without-} ${DISABLED_BACKENDS}"
elif [ "${PARAMETER#--with-}" != "${PARAMETER}" ]; then
NAME="${PARAMETER#--with-}"
if ! [ -e backends/${NAME}.c ]; then
echo "Unknown option: $1" >&2
exit 1
fi
ENFORCED_BACKENDS="${NAME} ${ENFORCED_BACKENDS}"
else
echo "Unknown option: $1" >&2
help
exit 1
fi
esac
shift
done
Expand Down Expand Up @@ -180,11 +195,21 @@ fi
# Auto-determine available backends
if [ -z "$BACKENDS" ]; then
echo -n "Checking for supported backends.. "
BACKENDS=`$MAKE get_available_backends PKG_CONFIG=$PKG_CONFIG | sed -nre 's#^BACKENDS: ?(.+)#\1#p'`
BACKENDS="`$MAKE get_available_backends PKG_CONFIG=$PKG_CONFIG | sed -nre 's#^BACKENDS: ?(.+)#\1#p'` "
echo "${BACKENDS:-(none)}"
if [ -z "$BACKENDS" ]; then
echo "WARNING: Building without backends! You won't be able to see _any_ images." >&2
fi
fi

# Disable explicitly disabled and enable explicitly enabled backends
for BACKEND in ${DISABLED_BACKENDS}; do
BACKENDS="${BACKENDS//${BACKEND} /}"
done
for BACKEND in ${ENFORCED_BACKENDS}; do
BACKENDS="${BACKEND} ${BACKENDS//${BACKEND} /}"
done

echo "Building with backends: ${BACKENDS:-(none)}"
if [ -z "$BACKENDS" ]; then
echo "WARNING: Building without backends! You won't be able to see _any_ images." >&2
fi

echo -n "Checking if the prerequisites are installed.. "
Expand Down

0 comments on commit dff71d6

Please sign in to comment.