# HG changeset patch # User "Yann E. MORIN" # Date 1254588563 -7200 # Node ID 79a609170a834d66c93ac9b74b80227df6eb7d35 # Parent 439a6b29291753156262620330248130a736306e configure: split has_or_abort in two: one to check, one to abort Split the has_or_abort function in two: - one that checks if the tool if found, - one that calls the above check, and aborts if not found The rational behind this is to be able to check for a tool and if not found, fallback to using our bundled version, should the need arise (and I get time). diff -r 439a6b292917 -r 79a609170a83 configure --- a/configure Fri Sep 04 17:27:16 2009 +0200 +++ b/configure Sat Oct 03 18:49:23 2009 +0200 @@ -77,6 +77,8 @@ } # A function to test for required tools/headers/libraries +# Return 0 (true) if found, !0 (false) if not found +# # $*: [prog|inc|lib]= # the name(s) of tool(s) to test for # mandatory @@ -94,7 +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" -has_or_abort() { +check_for() { local prog inc lib local var ver err local val @@ -162,6 +164,7 @@ done ;; esac + if [ -z "${status}" ]; then printf "\n${err:-${prog}${inc}${lib}: none found}\n\n" printf "Either you are missing entirely the needed tool,\n" @@ -169,6 +172,22 @@ if [ -n "${var}" ]; then printf "You can give the path to this tool using: --with-${var}=PATH\n" fi + printf "\n" + return 1 + fi + + printf "${status}" + if [ -n "${var}" ]; then + eval ${var}='"'"${where}"'"' + add_to_var_list "${var}" + fi + printf "\n" +} + +# This function checks for a tool, and aborts if not found +# See check_for(), above, for how to call has_or_abort +has_or_abort() { + if ! check_for "$@"; then # FORCE can be set in the environment [ -z "${FORCE}" ] && do_error "Bailing out..." printf "\n" @@ -178,13 +197,6 @@ printf "<* Prepare for breakage *>\n" printf "<* *>\n" printf "\n" - else - printf "${status}" - if [ -n "${var}" ]; then - eval ${var}='"'"${where}"'"' - add_to_var_list "${var}" - fi - printf "\n" fi } @@ -260,7 +272,7 @@ #--------------------------------------------------------------------- # Some sanity checks, now -# We check for grep and sed manually, because they are used in has_or_abort +# We check for grep and sed manually, because they are used in check_for() printf "Checking for 'grep'... " if [ -n "${grep}" ]; then printf "${grep} (cached)\n"