# HG changeset patch # User "Yann E. MORIN" # Date 1306427633 -7200 # Node ID b2591fe701efd5d8cfaa17609bb2234d2260bddf # Parent bce8b2a4bf8f08334c08e106fe2f7f3ea09ea2de configure: add has_or_warn By popular request, add a function to only warn on missing stuff. Signed-off-by: "Yann E. MORIN" diff -r bce8b2a4bf8f -r b2591fe701ef configure --- a/configure Thu May 26 18:40:53 2011 +0200 +++ b/configure Thu May 26 18:33:53 2011 +0200 @@ -96,6 +96,7 @@ # the error message to print if tool is missing # optional, defaults to: '${prog}: none found' # eg: err="'bash' 3.x or above was not found" +# Note: err may be printed by caller, not us check_for() { local val local item @@ -208,6 +209,23 @@ fi } +# This function checks for a tool, and warns if not found +# See check_for(), above, for how to call has_or_abort +# Note: if err is not set, then no error message is printed +has_or_warn() { + # We declare these 6 variables here, although they are + # set in check_for(), called below + local prog inc lib + local var ver err + + if ! check_for "$@"; then + printf "${err:+${err}\n}" + if [ -n "${var}" ]; then + printf -- "--> You can give the path to this tool using: --with-${var}=PATH\n" + fi + fi +} + do_help() { cat <<__EOF__ \`configure' configures crosstool-NG-${VERSION} to adapt to many kind of systems.