1# ===========================================================================
2#   https://www.gnu.org/software/autoconf-archive/ax_prog_haxe_version.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7#   AX_PROG_HAXE_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE])
8#
9# DESCRIPTION
10#
11#   Makes sure that haxe supports the version indicated. If true the shell
12#   commands in ACTION-IF-TRUE are executed. If not the shell commands in
13#   ACTION-IF-FALSE are run. The $HAXE_VERSION variable will be filled with
14#   the detected version.
15#
16#   This macro uses the $HAXE variable to perform the check. If $HAXE is not
17#   set prior to calling this macro, the macro will fail.
18#
19#   Example:
20#
21#     AC_PATH_PROG([HAXE],[haxe])
22#     AC_PROG_HAXE_VERSION([3.1.3],[ ... ],[ ... ])
23#
24#   Searches for Haxe, then checks if at least version 3.1.3 is present.
25#
26# LICENSE
27#
28#   Copyright (c) 2015 Jens Geyer <jensg@apache.org>
29#
30#   Copying and distribution of this file, with or without modification, are
31#   permitted in any medium without royalty provided the copyright notice
32#   and this notice are preserved. This file is offered as-is, without any
33#   warranty.
34
35#serial 2
36
37AC_DEFUN([AX_PROG_HAXE_VERSION],[
38    AC_REQUIRE([AC_PROG_SED])
39
40    AS_IF([test -n "$HAXE"],[
41        ax_haxe_version="$1"
42
43        AC_MSG_CHECKING([for haxe version])
44        haxe_version=`$HAXE -version 2>&1 | $SED -e 's/^.* \( @<:@0-9@:>@*\.@<:@0-9@:>@*\.@<:@0-9@:>@*\) .*/\1/'`
45        AC_MSG_RESULT($haxe_version)
46
47	    AC_SUBST([HAXE_VERSION],[$haxe_version])
48
49        AX_COMPARE_VERSION([$ax_haxe_version],[le],[$haxe_version],[
50	    :
51            $2
52        ],[
53	    :
54            $3
55        ])
56    ],[
57        AC_MSG_WARN([could not find Haxe])
58        $3
59    ])
60])
61