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