+cd ../
+
+
+## Uses global $commit.
+commit ()
+{
+ local type=$1
+ shift
+
+ [ $# -gt 0 ] || {
+ echo "No files were modified"
+ return 0
+ }
+
+ echo "Modified file(s): $@"
+
+ [ "$commit" ] || return 0
+
+ echo "Committing..."
+
+ ## bzr status output is always relative to top-level, not PWD.
+ bzr commit -m "Auto-commit of $type files." "$@" || return $?
+
+ echo "Committed files: $@"
+} # function commit
+
+
+commit "generated" $modified || die "bzr commit error"
+
+
+[ "$ldefs_flag" ] || exit 0
+
+
+echo "Finding loaddef targets..."
+
+sed -n -e '/^AUTOGEN_VCS/,/^$/ s/\\//p' lisp/Makefile.in | \
+ sed '/AUTOGEN_VCS/d' >| $tempfile || die "sed error"
+
+genfiles=
+
+while read genfile; do
+
+ [ -r lisp/$genfile ] || die "Unable to read $genfile"
+
+ genfiles="$genfiles $genfile"
+done < $tempfile
+
+
+[ "$genfiles" ] || die "Error setting genfiles"
+
+
+[ -e Makefile ] || {
+ echo "Running ./configure..."
+
+ ## Minimize required packages.
+ ./configure --without-x || die "configure error"