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.

54 lines
1.5KB

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