From: Daniel Elstner Date: Tue, 8 Sep 2015 02:42:22 +0000 (+0200) Subject: sigrok.m4: Add SR_PROG_VERSION macro X-Git-Tag: libsigrok-0.4.0~326 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a6e8a8f766359e098fb12e8e015137223cd7437e;p=libsigrok.git sigrok.m4: Add SR_PROG_VERSION macro --- diff --git a/m4/sigrok.m4 b/m4/sigrok.m4 index 539c3849..e35f9fd1 100644 --- a/m4/sigrok.m4 +++ b/m4/sigrok.m4 @@ -319,6 +319,19 @@ _SR_ARG_OPT_PKG(m4_defn([_SR_VAR_OPT_PKG_FEATURES]), m4_shift3($@))[]dnl ]) +## SR_PROG_VERSION(program, sh-var) +## +## Obtain the version of and store it in . +## +AC_DEFUN([SR_PROG_VERSION], +[dnl +m4_assert([$# >= 2])[]dnl +sr_prog_ver=`$1 --version 2>&AS_MESSAGE_LOG_FD | sed 1q 2>&AS_MESSAGE_LOG_FD` +AS_CASE([[$]?:$sr_prog_ver], + [[0:*[0-9].[0-9]*]], [$2=$sr_prog_ver], + [$2=unknown])[]dnl +]) + ## SR_PROG_MAKE_NO_PRINT_DIRECTORY ## ## Check whether the make program supports the --no-print-directory flag.