summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap60
-rw-r--r--bootstrap.conf11
2 files changed, 60 insertions, 11 deletions
diff --git a/bootstrap b/bootstrap
index f6d56a2..5ef537a 100755
--- a/bootstrap
+++ b/bootstrap
@@ -34,7 +34,7 @@ bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
bt2=${bt}2
usage() {
- echo >&2 "\
+ cat <<EOF
Usage: $0 [OPTION]...
Bootstrap this package from the checked-out sources.
@@ -56,7 +56,7 @@ For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
are honored.
Running without arguments will suffice in most cases.
-"
+EOF
}
# Configuration.
@@ -70,6 +70,9 @@ gnulib_modules=
# Any gnulib files needed that are not in modules.
gnulib_files=
+# A function to be called after everything else in this script.
+bootstrap_epilogue() { :; }
+
# The command to download all .po files for a specified domain into
# a specified directory. Fill in the first %s is the domain name, and
# the second with the destination directory. Use rsync's -L and -r
@@ -148,6 +151,45 @@ copy=false
# on which version control system (if any) is used in the source directory.
vc_ignore=auto
+# find_tool ENVVAR NAMES...
+# -------------------------
+# Search for a required program. Use the value of ENVVAR, if set,
+# otherwise find the first of the NAMES that can be run (i.e.,
+# supports --version). If found, set ENVVAR to the program name,
+# die otherwise.
+find_tool ()
+{
+ # Find sha1sum, named gsha1sum on MacPorts.
+ find_tool_envvar=$1
+ shift
+ find_tool_names=$@
+ eval "find_tool_res=\$$find_tool_envvar"
+ if test x"$find_tool_res" = x; then
+ for i
+ do
+ if ($i --version </dev/null) >/dev/null 2>&1; then
+ find_tool_res=$i
+ break
+ fi
+ done
+ else
+ find_tool_error_prefix="\$$find_tool_envvar: "
+ fi
+ if test x"$find_tool_res" = x; then
+ echo >&2 "$0: one of these is required: $find_tool_names"
+ exit 1
+ fi
+ ($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
+ echo >&2 "$0: ${find_tool_error_prefix}cannot run $find_tool_res --version"
+ exit 1
+ }
+ eval "$find_tool_envvar=\$find_tool_res"
+ eval "export $find_tool_envvar"
+}
+
+# Find sha1sum, named gsha1sum on MacPorts.
+find_tool SHA1SUM sha1sum gsha1sum
+
# Override the default configuration, if necessary.
# Make sure that bootstrap.conf is sourced from the current directory
# if we were invoked as "sh bootstrap".
@@ -420,11 +462,11 @@ update_po_files() {
cksum_file="$ref_po_dir/$po.s1"
if ! test -f "$cksum_file" ||
! test -f "$po_dir/$po.po" ||
- ! ${SHA1SUM-sha1sum} -c --status "$cksum_file" \
+ ! $SHA1SUM -c --status "$cksum_file" \
< "$new_po" > /dev/null; then
echo "updated $po_dir/$po.po..."
cp "$new_po" "$po_dir/$po.po" \
- && ${SHA1SUM-sha1sum} < "$new_po" > "$cksum_file"
+ && $SHA1SUM < "$new_po" > "$cksum_file"
fi
done
}
@@ -689,6 +731,10 @@ find "$m4_base" "$source_base" \
# Reconfigure, getting other files.
+# Skip autoheader if it's not needed.
+grep '^[ ]*AC_CONFIG_HEADERS\>' configure.ac >/dev/null ||
+ AUTOHEADER=true
+
for command in \
libtool \
"${ACLOCAL-aclocal} --force -I m4" \
@@ -757,11 +803,7 @@ if test $with_gettext = yes; then
fi
fi
-# Horrible, coreutils-specific kludges.
-# Change paths in gnulib-tests/gnulib.mk from "../.." to "..".
-m=gnulib-tests/gnulib.mk
-sed 's,\.\./\.\.,..,g' $m > $m-t
-mv -f $m-t $m
+bootstrap_epilogue
echo "$0: done. Now you can run './configure'."
diff --git a/bootstrap.conf b/bootstrap.conf
index 840e01b..46da506 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -124,7 +124,6 @@ if test $gettext_external = 1; then
m4/glibc2.m4
m4/intdiv0.m4
m4/lcmessage.m4
- m4/lock.m4
m4/uintmax_t.m4
m4/ulonglong.m4
m4/visibility.m4
@@ -150,4 +149,12 @@ tar -
"
# Automake requires that ChangeLog exist.
-touch ChangeLog
+touch ChangeLog || exit 1
+
+bootstrap_epilogue()
+{
+ # Change paths in gnulib-tests/gnulib.mk from "../.." to "..".
+ m=gnulib-tests/gnulib.mk
+ sed 's,\.\./\.\.,..,g' $m > $m-t
+ mv -f $m-t $m
+}