summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-12-25 09:53:32 -0500
committermidipix <writeonce@midipix.org>2018-12-25 09:55:45 -0500
commit176f4897b8d1fb473202e3c2eef637e6aada747a (patch)
treeaa20be68a8923a85b4ec3b3a1370c97c38d4a306
parente71772893eca041304ea4edfb645dd778d4b66c3 (diff)
downloadsbpython3-176f4897b8d1fb473202e3c2eef637e6aada747a.tar.bz2
sbpython3-176f4897b8d1fb473202e3c2eef637e6aada747a.tar.xz
build system: configure: handle fatal errors more gracefully.
-rwxr-xr-xconfigure26
1 files changed, 25 insertions, 1 deletions
diff --git a/configure b/configure
index e88666c..abb0750 100755
--- a/configure
+++ b/configure
@@ -2,6 +2,8 @@
set -eu
+trap config_failure 1 2 EXIT
+
usage()
{
cat "$mb_project_dir"/config.usage
@@ -182,6 +184,8 @@ verify_build_directory()
mb_project_dir='.'
fi
fi
+
+ rm -f Makefile Makefile.host Makefile.tmp Makefile.failed
}
@@ -682,6 +686,26 @@ config_status()
printf "\nconfiguration completed successfully.\n\n"
}
+
+config_failure()
+{
+ if [ -f Makefile ]; then
+ mb_error='failed to use the generated Makefile.'
+ printf '\n%s: error: %s\n' "${0}" "$mb_error" >&2
+ mv Makefile Makefile.failed
+ fi
+
+ exit 2
+}
+
+
+config_success()
+{
+ trap '' EXIT
+ exit 0
+}
+
+
# one: init
init_vars
verify_build_directory
@@ -942,4 +966,4 @@ config_status
# all done
-exit 0
+config_success