3

How to check from the command line whether GNU Make is built with support of Guile?

Inside Makefile it can be determined via analyzing .FEATURES variable (see documentation).

ruvim
  • 7,151
  • 2
  • 27
  • 36

2 Answers2

4

One possible way is a quasi makefile in stdin.

So, .FEATURES variable can be printed in the following way:

echo '$(info $(.FEATURES))' | make -f -

The following command outputs guile string if it is supported or nothing in otherwise:

echo '$(info $(filter guile,$(.FEATURES)))' | make -f -  2>/dev/null

A variation using grep:

echo '$(info $(.FEATURES))' | make -f - 2>/dev/null | grep -wo guile

The solution

As @bobbogo mentioned, we can avoid the pipe at all, using --eval option:

make --eval '$(info $(filter guile,$(.FEATURES)))' 2>/dev/null

This command will print 'guile' or nothing.

ruvim
  • 7,151
  • 2
  • 27
  • 36
3

As @ruvim points out, the manual says

You can determine whether GNU Guile support is available by checking the .FEATURES variable for the word guile.

$(if $(filter guile,${.FEATURES}) \
  ,$(info Guile suppoerted, yay!) \
  ,$(error Guile not supported - update your make))
bobbogo
  • 14,989
  • 3
  • 48
  • 57
  • I just needed a shortest **command line one-liner**. Regarding syntax — `$(...)` variant is the right syntax too (see [doc](https://www.gnu.org/software/make/manual/html_node/Reference.html)). – ruvim Feb 20 '19 at 16:39
  • 1
    @ruvim Ah, sorry, I read your shell lines as _make_ recipes! Blimey, I've gotta get out more. Shortest test is probably to use `--eval` and save a pipe? – bobbogo Feb 21 '19 at 11:41
  • yes, thank you! I have added the variant with `--eval` as the best solutin. – ruvim Mar 01 '19 at 14:19