]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
maint: make ./bootstrap abort if no .git/ directory is present. master
authorKarl Berry <karl@freefriends.org>
Fri, 19 Jun 2026 22:30:49 +0000 (15:30 -0700)
committerKarl Berry <karl@freefriends.org>
Fri, 19 Jun 2026 22:30:49 +0000 (15:30 -0700)
In response to (long thread continuing over a month boundary):
https://lists.gnu.org/archive/html/automake/2025-05/msg00013.html
https://lists.gnu.org/archive/html/automake/2025-06/msg00000.html

* bootstrap: if no .git directory is present, abort with
a long-winded error message. Nothing good comes of running
./bootstrap in a tree from a release tarball, e.g., makeinfo
suddenly becomes required, per the original report.

bootstrap

index 5fc89023fc1bfb446f40adeb1709198ef4633b5b..de337fecf88e280c005e80ade34c33289d88a56d 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 #! /bin/sh
-
 # This script helps bootstrap automake, when checked out from git.
 # This script helps bootstrap automake, when checked out from git.
+# It should not be run from a tree made from a (pre)release tarball.
 #
 # Copyright (C) 2002-2026 Free Software Foundation, Inc.
 # Originally written by Pavel Roskin <proski@gnu.org> September 2002.
 #
 # Copyright (C) 2002-2026 Free Software Foundation, Inc.
 # Originally written by Pavel Roskin <proski@gnu.org> September 2002.
 # 'autoreconf -i' which would require Automake to already be
 # installed.
 
 # 'autoreconf -i' which would require Automake to already be
 # installed.
 
+if test ! -d .git; then
+  cat <<END_NOT_GIT >&2
+$0: no .git directory, so exiting.
+Long-winded explanation:
+
+The Automake bootstrap script is intended to be run only from the
+top level of a git checkout of Automake, but no .git directory
+is present (in `pwd`), so I'm exiting.
+
+In particular, it should not be run from a source tree expanded from a
+release (or test release, etc.) tarball, because those trees already
+contain everything needed for compilation, with minimal dependencies.
+The development-specific actions of this bootstrap script will mess that
+up, e.g., makeinfo will be required to build after running bootstrap.
+
+(By the way, this bootstrap script is still included in the release
+tarballs even though it is not intended to be run in that context simply
+because it is a nontrivial source file and thus potentially useful to
+developers to see, regardless.)
+
+If you desire to run the bootstrap script in some tree that is not a git
+checkout, just mkdir .git and the script will proceed.
+
+Goodbye from $0.
+END_NOT_GIT
+  exit 1
+fi
+
 # Don't ignore failures.
 set -e
 
 # Don't ignore failures.
 set -e