Mercurial > mm7
comparison lib/swig/swigwin-2.0.11/Tools/config/ac_compare_version.m4 @ 1899:b3009adc0e2f
Adding swig, gitignore, hgignore
author | Nomad |
---|---|
date | Mon, 21 Oct 2013 10:42:27 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1867:eb580660bbbb | 1899:b3009adc0e2f |
---|---|
1 dnl @synopsis AC_COMPARE_VERSION\ | |
2 dnl (version-a, version-b, action-if-greater, action-if-equal, action-if-less) | |
3 dnl | |
4 dnl This macro compares two version numbers and executes the indicated action | |
5 dnl based on whether they're equal or one is greater than the other. | |
6 dnl It's needed to determine whether ocaml is new enough that the incompatible | |
7 dnl change 'loc' -> '_loc' is present in this version of camlp4. | |
8 dnl | |
9 dnl It's implemented from scratch just for SWIG by arty. | |
10 dnl | |
11 dnl @category Misc | |
12 dnl @author arty | |
13 dnl @version 2006-11-02 | |
14 dnl @license GPLWithACException | |
15 | |
16 AC_DEFUN([AC_COMPARE_VERSION], [ | |
17 # Split the version into units. | |
18 ver_a="[$1]" | |
19 ver_b="[$2]" | |
20 nodots_a=`echo $ver_a | sed -e 's/\./ /g'` | |
21 condition="equal" | |
22 isolate_b_regex='\([[0-9]]\+\).*' | |
23 for ver_part in $nodots_a ; do | |
24 b_ver_part=`echo "$ver_b" | sed -e 's/'"$isolate_b_regex"'/\1/'` | |
25 if test \( "$ver_part" -lt "$b_ver_part" \) -a \( "x$condition" = "xequal" \) ; then | |
26 condition=less | |
27 elif test \( "$ver_part" -gt "$b_ver_part" \) -a \( "x$condition" = "xequal" \) ; then | |
28 condition=greater | |
29 fi | |
30 isolate_b_regex='[[0-9]]\+\.'"$isolate_b_regex" | |
31 done | |
32 | |
33 if test "x$condition" = "xequal" ; then | |
34 [$4] | |
35 elif test "x$condition" = "xless" ; then | |
36 [$3] | |
37 elif test "x$condition" = "xgreater" ; then | |
38 [$5] | |
39 fi | |
40 ]) |