source: filezilla/trunk/fuentes/m4/fz_checkversion.m4 @ 130

Last change on this file since 130 was 130, checked in by jrpelegrina, 3 years ago

First release to xenial

File size: 1.6 KB
Line 
1dnl FZ_PATH_PROG_VER does basically the same as AC_PATH_PROG, but
2dnl wants the minimum acceptable version of the program as 3rd parameter.
3
4AC_DEFUN([FZ_PATH_PROG_VER],
5[
6  AC_PATH_PROG([$1], [$2], [$4], [$5])
7
8  if ! test -z "@S|@$1" && ! test -z "$3"; then
9    fz_req_version=$3
10    fz_req_major=`echo $fz_req_version | cut -d. -f1`
11    fz_req_minor=`echo $fz_req_version | sed s/@<:@-,a-z,A-Z@:>@.*// | cut -d. -f2`
12    fz_req_micro=`echo $fz_req_version | sed s/@<:@-,a-z,A-Z@:>@.*// | cut -d. -f3`
13    if test -z "$fz_req_minor"; then fz_req_minor=0; fi
14    if test -z "$fz_req_micro"; then fz_req_micro=0; fi
15
16    AC_MSG_CHECKING([whether $2 version >= $fz_req_major.$fz_req_minor.$fz_req_micro])
17
18    fz_pkg_version=`@S|@$1 --version|head -n 1|sed 's/(@<:@^)@:>@*)//g;s/^@<:@a-zA-Z\.\ \-@:>@*//;s/ .*$//'`
19    fz_pkg_major=`echo $fz_pkg_version | cut -d. -f1`
20    fz_pkg_minor=`echo $fz_pkg_version | sed s/@<:@-,a-z,A-Z@:>@.*// | cut -d. -f2`
21    fz_pkg_micro=`echo $fz_pkg_version | sed s/@<:@-,a-z,A-Z@:>@.*// | cut -d. -f3`
22    if test -z "$fz_pkg_minor"; then fz_pkg_minor=0; fi
23    if test -z "$fz_pkg_micro"; then fz_pkg_micro=0; fi
24
25    if test "$fz_pkg_major" -lt "$fz_req_major"; then
26      $1=
27    elif test "$fz_pkg_major" -eq "$fz_req_major"; then
28      if test "$fz_pkg_minor" -lt "$fz_req_minor"; then
29        $1=
30      elif test "$fz_pkg_minor" -eq "$fz_req_minor"; then
31        if test "$fz_pkg_micro" -lt "$fz_req_micro"; then
32          $1=
33        fi
34      fi
35    fi
36
37    if test -z "@S|@$1"; then
38      AC_MSG_RESULT([no, $fz_pkg_version])
39    else
40      AC_MSG_RESULT([yes, $fz_pkg_version])
41    fi
42
43  fi
44])
Note: See TracBrowser for help on using the repository browser.