summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2009-10-03 16:49:23 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2009-10-03 16:49:23 (GMT)
commit26edbc5b62418e0eea8bacb9f8c076c46ae51ed8 (patch)
treebf5ba2ae907004a443a1dd0f2b384bc86e6d5ddc
parent85b96f88feceb8049d49aa3a770a7a53a381ae04 (diff)
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).
-rwxr-xr-xconfigure30
1 files changed, 21 insertions, 9 deletions
diff --git a/configure b/configure
index 8589007..2b97f50 100755
--- a/configure
+++ b/configure
@@ -77,6 +77,8 @@ add_to_var_list() {
}
# A function to test for required tools/headers/libraries
+# Return 0 (true) if found, !0 (false) if not found
+#
# $*: [prog|inc|lib]=<name[ name...]>
# the name(s) of tool(s) to test for
# mandatory
@@ -94,7 +96,7 @@ add_to_var_list() {
# 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 @@ has_or_abort() {
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 @@ has_or_abort() {
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 @@ has_or_abort() {
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 @@ fi
#---------------------------------------------------------------------
# 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"