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.
Similar to the above, but has the advantage of also being able to interact with automake by exporting the condition variable
Stumbled here while looking for this issue, I should note that if you want to have your program just looked in pathm a runtime test is enough:
I found this to be the shortest approach.
This is not exactly a short approach, it's rather a general purporse approach (although when there are dozens of programs to check it might be also the shortest approach). It's taken from a project of mine (the prefix
NA_
stands for “Not Autotools”).A general purpose macro
Sample usage
So that within
Makefile.am
you can door
and so on.
Features
./configure --help
, so that an alternative path to the program can be providedWhen you should use it
Try this which is what I just lifted from a project of mine, it looks for something called
quantlib-config
in the path:When using AC_CHECK_PROG, this is the most concise version that I've run across is:
When the program is missing, this output will be generated:
Or when coupled with the built-in autoconf program checks, use this instead: