Autoconf check for program and fail if not found

Adam Magaluk picture Adam Magaluk · Sep 20, 2011 · Viewed 7.1k times · Source

I'm creating a project and using GNU Autoconf tools to do the configuring and making. I've set up all my library checking and header file checking but can't seem to figure out how to check if an executable exists on the system and fail if it doesn't exist.

I've tried:

AC_CHECK_PROG(TEST,testprogram,testprogram,AC_MSG_ERROR(Cannot find testprogram.))

When I configure it runs and outputs:

Checking for testprogram... find: `testprogram. 15426 5 ': No such file or directory

but does not fail.

Answer

Adam Magaluk picture Adam Magaluk · Sep 20, 2011

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.])])