Autoconf check for program and fail if not found

Try this which is what I just lifted from a project of mine, it looks for something called quantlib-config in the path:

# borrowed from a check for gnome in GNU gretl: def. a check for quantlib-config
AC_DEFUN(AC_PROG_QUANTLIB, [AC_CHECK_PROG(QUANTLIB,quantlib-config,yes)])
AC_PROG_QUANTLIB
if test x"${QUANTLIB}" == x"yes" ; then
    # use quantlib-config for QL settings
    [.... more stuff omitted here ...]
else
    AC_MSG_ERROR([Please install QuantLib before trying to build RQuantLib.])
fi

I found this to be the shortest approach.

AC_CHECK_PROG(FFMPEG_CHECK,ffmpeg,yes)
AS_IF([test x"$FFMPEG_CHECK" != x"yes"], [AC_MSG_ERROR([Please install ffmpeg before configuring.])])

Tags:

Linux

Autoconf