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.

81 lines
3.0KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_very_nice.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_VERY_NICE
  8. #
  9. # DESCRIPTION
  10. #
  11. # A macro to check the options of nice, in order to have a VERY_NICE
  12. # variable which runs a program at the lowest priority VERY_NICE is
  13. # undefined if we don't find the proper options, so you can safely use:
  14. #
  15. # @VERY_NICE@ mycommand
  16. #
  17. # in a shell script.
  18. #
  19. # The VERY_NICE variable includes the placeholder NICE_VALUE that you have
  20. # to instantiate at run-time. If you give a argument to AX_VERY_NICE, it
  21. # will be used as an argument of nice for testing and included in
  22. # VERY_NICE instead of the above placeholder.
  23. #
  24. # LICENSE
  25. #
  26. # Copyright (c) 2008 Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
  27. #
  28. # This program is free software; you can redistribute it and/or modify it
  29. # under the terms of the GNU General Public License as published by the
  30. # Free Software Foundation; either version 2 of the License, or (at your
  31. # option) any later version.
  32. #
  33. # This program is distributed in the hope that it will be useful, but
  34. # WITHOUT ANY WARRANTY; without even the implied warranty of
  35. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  36. # Public License for more details.
  37. #
  38. # You should have received a copy of the GNU General Public License along
  39. # with this program. If not, see <https://www.gnu.org/licenses/>.
  40. #
  41. # As a special exception, the respective Autoconf Macro's copyright owner
  42. # gives unlimited permission to copy, distribute and modify the configure
  43. # scripts that are the output of Autoconf when processing the Macro. You
  44. # need not follow the terms of the GNU General Public License when using
  45. # or distributing such scripts, even though portions of the text of the
  46. # Macro appear in them. The GNU General Public License (GPL) does govern
  47. # all other use of the material that constitutes the Autoconf Macro.
  48. #
  49. # This special exception to the GPL applies to versions of the Autoconf
  50. # Macro released by the Autoconf Archive. When you make and distribute a
  51. # modified version of the Autoconf Macro, you may extend this special
  52. # exception to the GPL to apply to your modified version as well.
  53. #serial 5
  54. AU_ALIAS([AC_VERY_NICE], [AX_VERY_NICE])
  55. AC_DEFUN([AX_VERY_NICE],[
  56. if test "x$1" != "x"; then
  57. NICE_VALUE=$1
  58. else
  59. NICE_VALUE=20
  60. fi
  61. AC_CHECK_PROGS(TEST_NICE, date)
  62. AC_CHECK_PROGS(NICE, nice, )
  63. AC_MSG_CHECKING(syntax of nice)
  64. if test "x$NICE" != "x"; then
  65. if ( $NICE -n $NICE_VALUE $TEST_NICE > /dev/null 2>&1 ) ; then
  66. VERY_NICE="$NICE -n $NICE_VALUE"
  67. else
  68. if ( $NICE -$NICE_VALUE $TEST_NICE > /dev/null 2>&1 ) ; then
  69. VERY_NICE="$NICE -$NICE_VALUE"
  70. fi
  71. fi
  72. fi
  73. if test "x$1" = "x"; then
  74. VERY_NICE=`echo $VERY_NICE | sed "s/$NICE_VALUE/NICE_VALUE/"`
  75. fi
  76. AC_MSG_RESULT($VERY_NICE)
  77. AC_SUBST(VERY_NICE)
  78. ])