I’m writting my own “configure” script for my package. The Makefile uses some features (e.g.: the “call” function) that were added to GNU make in certain versions. I’d want to check if installed `make´ utility is GNU’s one and if it support that features, but I have no idea about how to do it.
As the `configure´ script is supposed to be portable (and I want to avoid Autoconf, SCons… and any other, although that’s not the question) I need a portable solution. I have looked through my GNU make’s documentation and did not find anything useful.
Thanks in advance (and, of course, sorry if this question is irrelevant or if you guess that checking presence & usability of `make´ tool is not part of configure’s job).
PS: I’ve just found `make -p´ option, whose first line prints # GNU Make 3.81 for me, but, another time, I don’t know if that’s another GNU extension or if it is “standard”.
I would run
make --version.If it is GNU make it will be something like:
So the first line contains the version version and indicates that it is GNU make. If the first line contains something else, including maybe an error message that the version option is not supported, it is not.
You could also emit a temporary Makefile from your configure script, containing those commands that you require. If the make you find on can run it without errors, I.e. with exit code 0, you’re good. No need to determine the exact version. Checking for features is in the spirit of the “real” autoconf and probably more reliable than checking version numbers and using the implicit knowledge of what they support and what not.
Finally, consider looking into the “real” configure / autoconf tool to see how they do it – or even use it instead of your own.