On Thursday 9 March 2000, at 17 h 21, the keyboard of Stephane Bortzmeyer
<[EMAIL PROTECTED]> wrote:
> Apparently, nice can be invoked in many different ways, depending on the Unix
> you use. Putting "nice -n 20 myprogram" is not portable.
Well, I got no reply, so here is my solution:
dnl A macro to check the options of nice, in order to have a
dnl VERY_NICE variable which runs a program at the lowest priority
dnl VERY_NICE is undefined if we don't find the proper options, so
dnl you can safely use:
dnl @VERY_NICE@ mycommand
dnl in a shell script.
AC_DEFUN(AC_VERY_NICE,[ AC_MSG_CHECKING(syntax of nice)
AC_CHECK_PROGS(TEST_NICE, date)
AC_CHECK_PROGS(NICE, nice, )
if test "x$NICE" != "x"; then
if ( $NICE -n 20 $TEST_NICE > /dev/null 2>&1 ) ; then
VERY_NICE="$NICE -n 20"
else
if ( $NICE -20 $TEST_NICE > /dev/null 2>&1 ) ; then
VERY_NICE="$NICE -20"
fi
fi
fi
AC_SUBST(VERY_NICE)
])