Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.7KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_try_awk_expout.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_TRY_AWK_EXPOUT(NAME,TEST-INPUT,TEST-BODY,EXPECTED-OUTPUT,[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Run a test using the awk program found on AWK variable. The test being
  12. # run has TEST-BODY as body and is feeded with TEST-INPUT. Check if the
  13. # test gives the expected output. If successful execute ACTION-IF-SUCCESS
  14. # otherwise ACTION-IF-FAILURE.
  15. #
  16. # This work is heavily based upon testawk.sh script by Heiner Steven. You
  17. # should find his script (and related works) at
  18. # <http://www.shelldorado.com/articles/awkcompat.html>. Thanks to
  19. # Alessandro Massignan for his suggestions and extensive nawk tests on
  20. # FreeBSD.
  21. #
  22. # LICENSE
  23. #
  24. # Copyright (c) 2009 Francesco Salvestrini <salvestrini@users.sourceforge.net>
  25. #
  26. # Copying and distribution of this file, with or without modification, are
  27. # permitted in any medium without royalty provided the copyright notice
  28. # and this notice are preserved. This file is offered as-is, without any
  29. # warranty.
  30. #serial 9
  31. AC_DEFUN([AX_TRY_AWK_EXPOUT], [
  32. AC_REQUIRE([AX_NEED_AWK])
  33. AC_MSG_CHECKING([if $AWK supports $1])
  34. cat <<EOF > conftest.out
  35. $2
  36. EOF
  37. ax_try_awk_output=`$AWK '{ [$3] ; }' conftest.out 2> /dev/null`
  38. ax_try_awk_result=$?
  39. rm -f conftest.out
  40. AS_IF([test $ax_try_awk_result -eq 0],[
  41. AS_IF([test "X$ax_try_awk_output" = "X[$4]"],[
  42. AC_MSG_RESULT([yes])
  43. $5
  44. ],[
  45. AC_MSG_RESULT([no])
  46. $6
  47. ])
  48. ],[
  49. AC_MSG_RESULT([no])
  50. $6
  51. ])
  52. ])