-# On Fedora, at least these rpms must be installed:
-# gdbm-devel
-# ncurses-devel
-# cyrus-sasl-devel, if using sasl
-# openssl-devel, if using TLS
-# autoconf and automake, with -s (see docs/README.developers for versions)
-# rpm-build, with -r
+# To disable colorization of the test summary, either unset the TERM
+# environment variable or set it to dumb, e.g., TERM=dumb build_nmh.
+#
+# See the nmh MACHINES file for build prerequisites. In addition, the rpmbuild
+# is required to be available if the -r option is used.
+
+usage="usage: $0
+ [-b <branch>, only if downloading]
+ [-c to run 'make distcheck' instead of 'make check']
+ [-d to build nmh with debug enabled]
+ [-i to install nmh]
+ [-l <logfile name>, default '$logfile']
+ [-r to build rpm]
+ [-s to use 'make superclean': requires recent autoconf and automake]
+ [-v to display progress]
+ [-y to accept all configuration options without confirmation]"
+
+#### Exit with error message.
+die() {
+ status=1
+ exec 1>&3 3>&- 2>&4 4>&-
+ cat "$tmpfile" 1>&2
+ echo "$0: $*" 1>&2
+ exit 1
+}
+
+#### Find location of a program. Bourne shell just puts the name in
+#### $0 if it's found from the PATH, so search that if necessary.
+finddir() {
+ case $1 in
+ */*) dirname "$1" ;;
+ * ) IFS=:
+ for d in $PATH; do
+ [ -f "${d:=.}/$1" -a -x "$d/$1" ] && printf %s "$d" && break
+ done ;;
+ esac
+}
+
+#### Make sure user sees error output even on early termination. Assumes
+#### that called programs exit with non-zero status when terminated.
+cleanup() {
+ if [ $status -eq 0 ]; then
+ rm -f "$tmpfile"
+ else
+ [ $logfile = - ] && cat "$tmpfile" 1>&3 || mv "$tmpfile" "$logfile"
+ fi
+}
+trap cleanup EXIT
+
+directory=
+gitrepo=git.savannah.nongnu.org
+invocation="$0 $*"
+tmpfile=/tmp/build_nmh-$$.log