title: Preferred Way for Testing External Tools in a Makefile
body: <p>Fiddling with a build-system mainly based on pure Makefiles, I've come to the following macro to make it easy to test for the existence and set an internal variable of each external tool required by the build process.</p>
  
  <pre><code>define tool-available
      $(eval $(1) := $(shell which $(2)))
      $(if $($(1)),$(info $(2) available at $($(1))),$(error error: missing tool $(2)))
  endef
  
  $(eval $(call tool-available,DOT,dot))
  $(eval $(call tool-available,RBIN,R))
  $(eval $(call tool-available,FIND,find))
  </code></pre>
  
  <p>However, experience has shown that it's not common to do so inside a makefile, with third-party build-systems usually preferring external configure scripts and alternative mechanisms.</p>
  
  <p>Besides the fact that the which(1) program has a limited availability along platforms, is there any strong reason for not doing so into a Makefile?</p>