1 # Autoconf support for the Vala compiler
3 # Copyright (C) 2008-2024 Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # Search for a Vala compiler in PATH. If it is found, the variable VALAC is
10 # set to point to it. Otherwise, it is simply set to 'valac'. This macro
11 # takes three optional arguments. The first argument, if present, is the
12 # minimum version of the Vala API required to compile this package. For Vala
13 # releases, this is the same as the major and minor release number; e.g., when
14 # `valac --version' reports 0.48.7, `valac --api-version' reports 0.48. If a
15 # compiler is found and satisfies MINIMUM-VERSION, then ACTION-IF-FOUND is run
16 # (this defaults to do nothing). Otherwise, ACTION-IF-NOT-FOUND is run. If
17 # ACTION-IF-NOT-FOUND is not specified, the default value is to print a
18 # warning in case no compiler is found, or if a too-old version of the
21 # AM_PROG_VALAC([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
22 # --------------------------------------------------------------------------
23 AC_DEFUN([AM_PROG_VALAC],
24 [AC_PATH_PROG([VALAC], [valac], [valac])
25 AS_IF([test "$VALAC" != valac && test -n "$1"],
26 [AC_MSG_CHECKING([whether $VALAC supports at least API version $1])
27 am__vala_version=`$VALAC --api-version`
28 AS_VERSION_COMPARE([$1], ["$am__vala_version"],
29 [AC_MSG_RESULT([yes])],
30 [AC_MSG_RESULT([yes])],
33 if test "$VALAC" = valac; then
35 [AC_MSG_WARN([Vala compiler not found or too old])
36 AC_MSG_WARN([you will not be able to compile Vala source files])])