annotate lib/swig/swigwin-2.0.11/Tools/config/ac_compare_version.m4 @ 1933:5fcf6023f9c3

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