vala.m4 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # Autoconf support for the Vala compiler
  2. # Copyright (C) 2008-2017 Free Software Foundation, Inc.
  3. #
  4. # This file is free software; the Free Software Foundation
  5. # gives unlimited permission to copy and/or distribute it,
  6. # with or without modifications, as long as this notice is preserved.
  7. # Check whether the Vala compiler exists in $PATH. If it is found, the
  8. # variable VALAC is set pointing to its absolute path. Otherwise, it is
  9. # simply set to 'valac'.
  10. # Optionally a minimum release number of the compiler can be requested.
  11. # If the ACTION-IF-FOUND parameter is given, it will be run if a proper
  12. # Vala compiler is found.
  13. # Similarly, if the ACTION-IF-FOUND is given, it will be run if no proper
  14. # Vala compiler is found. It defaults to simply print a warning about the
  15. # situation, but otherwise proceeding with the configuration.
  16. #
  17. # AM_PROG_VALAC([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  18. # --------------------------------------------------------------------------
  19. AC_DEFUN([AM_PROG_VALAC],
  20. [AC_PATH_PROG([VALAC], [valac], [valac])
  21. AS_IF([test "$VALAC" != valac && test -n "$1"],
  22. [AC_MSG_CHECKING([whether $VALAC is at least version $1])
  23. am__vala_version=`$VALAC --version | sed 's/Vala *//'`
  24. AS_VERSION_COMPARE([$1], ["$am__vala_version"],
  25. [AC_MSG_RESULT([yes])],
  26. [AC_MSG_RESULT([yes])],
  27. [AC_MSG_RESULT([no])
  28. VALAC=valac])])
  29. if test "$VALAC" = valac; then
  30. m4_default([$3],
  31. [AC_MSG_WARN([no proper vala compiler found])
  32. AC_MSG_WARN([you will not be able to compile vala source files])])
  33. else
  34. m4_default([$2], [:])
  35. fi])