logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: fd73fc35696b2a2d087abff6578b6d8bf201c1cb
parent acb3198c59dcc94e225aa172f40ba6fba891cc66
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 10 Feb 2022 02:09:08 +0100

configure: Handle $MAKE

Diffstat:

Mconfigure29++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/configure b/configure @@ -15,6 +15,7 @@ Variables: PKGCONFIG=BIN MSGFMT=BIN CC=BIN + MAKE=BIN MANDOC=BIN SHELLCHECK=BIN @@ -64,6 +65,18 @@ gen_targets() { echo } +check_cmd() { + var="$1" + full_cmd="$2" + + # shellcheck disable=SC2086 + set -- $full_cmd + cmd="$1" + + printf 'Checking $%s = %s command existance ...' "$var" "$full_cmd" + command -v "$cmd" >/dev/null ; is_ok +} + ## User configuration # defaults @@ -72,6 +85,7 @@ PREFIX="${PREFIX:-/usr/local}" PKGCONFIG="${PKGCONFIG:-pkg-config}" MSGFMT="${MSGFMT:-msgfmt}" CC="${CC:-cc}" +MAKE="${MAKE:-make}" CFLAGS="${CFLAGS:--g -O2 -pie -fPIE}" LDFLAGS="${LDFLAGS:--Wl,--as-needed}" MANDOC="${MANDOC:-mandoc}" @@ -118,14 +132,11 @@ rm -f config.mk bin/config.mk sbin/config.mk \ ## System checks # commands -printf 'Checking %s command existance ...' "${PKGCONFIG}" -command -v "${PKGCONFIG}" >/dev/null ; or_die - -printf 'Checking %s command existance ...' "${CC}" -command -v "${CC}" >/dev/null ; or_die +check_cmd PKGCONFIG "$PKGCONFIG" || exit 1 +check_cmd CC "$CC" || exit 1 +check_cmd MAKE "$MAKE" || exit 1 -printf 'Checking %s command existance ...' "${MANDOC}" -if command -v "${MANDOC}" >/dev/null ; is_ok +if check_cmd MANDOC "$MANDOC" then : else @@ -133,8 +144,7 @@ else MANDOC="true" fi -printf 'Checking %s command existance ...' "${SHELLCHECK}" -if command -v "${SHELLCHECK}" >/dev/null ; is_ok +if check_cmd SHELLCHECK "$SHELLCHECK" then : else @@ -180,6 +190,7 @@ MANDIR = ${MANDIR} PKGCONFIG = ${PKGCONFIG} CC = ${CC} +MAKE = ${MAKE} MANDOC = ${MANDOC} SHELLCHECK = ${SHELLCHECK} MSGFMT = ${MSGFMT}