configure
branch1.5
changeset 1566 7d22e633ed2c
parent 1485 d031a67fc494
child 1570 1d43b65599a4
child 1576 906b7509835e
     1.1 --- a/configure	Wed Aug 19 19:52:04 2009 +0200
     1.2 +++ b/configure	Sun Oct 04 13:08:43 2009 +0200
     1.3 @@ -77,6 +77,8 @@
     1.4  }
     1.5  
     1.6  # A function to test for required tools/headers/libraries
     1.7 +# Return 0 (true) if found, !0 (false) if not found
     1.8 +#
     1.9  # $*: [prog|inc|lib]=<name[ name...]>
    1.10  #     the name(s) of tool(s) to test for
    1.11  #     mandatory
    1.12 @@ -94,7 +96,7 @@
    1.13  #     the error message to print if tool is missing
    1.14  #     optional, defaults to: '${prog}: none found'
    1.15  #       eg: err="'bash' 3.x or above was not found"
    1.16 -has_or_abort() {
    1.17 +check_for() {
    1.18      local prog inc lib
    1.19      local var ver err
    1.20      local val
    1.21 @@ -162,6 +164,7 @@
    1.22              done
    1.23              ;;
    1.24      esac
    1.25 +
    1.26      if [ -z "${status}" ]; then
    1.27          printf "\n${err:-${prog}${inc}${lib}: none found}\n\n"
    1.28          printf "Either you are missing entirely the needed tool,\n"
    1.29 @@ -169,6 +172,22 @@
    1.30          if [ -n "${var}" ]; then
    1.31              printf "You can give the path to this tool using: --with-${var}=PATH\n"
    1.32          fi
    1.33 +        printf "\n"
    1.34 +        return 1
    1.35 +    fi
    1.36 +
    1.37 +    printf "${status}"
    1.38 +    if [ -n "${var}" ]; then
    1.39 +        eval ${var}='"'"${where}"'"'
    1.40 +        add_to_var_list "${var}"
    1.41 +    fi
    1.42 +    printf "\n"
    1.43 +}
    1.44 +
    1.45 +# This function checks for a tool, and aborts if not found
    1.46 +# See check_for(), above, for how to call has_or_abort
    1.47 +has_or_abort() {
    1.48 +    if ! check_for "$@"; then
    1.49          # FORCE can be set in the environment
    1.50          [ -z "${FORCE}" ] && do_error "Bailing out..."
    1.51          printf "\n"
    1.52 @@ -178,13 +197,6 @@
    1.53          printf "<*          Prepare for breakage            *>\n"
    1.54          printf "<*                                          *>\n"
    1.55          printf "\n"
    1.56 -    else
    1.57 -        printf "${status}"
    1.58 -        if [ -n "${var}" ]; then
    1.59 -            eval ${var}='"'"${where}"'"'
    1.60 -            add_to_var_list "${var}"
    1.61 -        fi
    1.62 -        printf "\n"
    1.63      fi
    1.64  }
    1.65  
    1.66 @@ -260,7 +272,7 @@
    1.67  #---------------------------------------------------------------------
    1.68  # Some sanity checks, now
    1.69  
    1.70 -# We check for grep and sed manually, because they are used in has_or_abort
    1.71 +# We check for grep and sed manually, because they are used in check_for()
    1.72  printf "Checking for 'grep'... "
    1.73  if [ -n "${grep}" ]; then
    1.74      printf "${grep} (cached)\n"