maint: Update HACKING
[automake.git] / bootstrap
blobb57623798edb181e115a23f610721fa314f2fba3
1 #! /bin/sh
3 # This script helps bootstrap automake, when checked out from git.
5 # Copyright (C) 2002-2017 Free Software Foundation, Inc.
6 # Originally written by Pavel Roskin <proski@gnu.org> September 2002.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <https://www.gnu.org/licenses/>.
21 # Since Automake uses itself in its build process, we can't simply run
22 # 'autoreconf -i' which would require Automake to already be
23 # installed.
25 # Don't ignore failures.
26 set -e
28 # Set program basename.
29 me=`echo "$0" | sed 's,^.*/,,'`
31 # Let user choose which version of autoconf, autom4te and perl to use.
32 : ${AUTOCONF=autoconf}
33 export AUTOCONF # might be used by aclocal and/or automake
34 : ${AUTOM4TE=autom4te}
35 export AUTOM4TE # ditto
36 : ${PERL=perl}
38 # Variables to substitute.
39 VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
40 APIVERSION=`sed -n 's/^APIVERSION=//p' configure.ac`
41 PACKAGE=automake
42 datadir=.
43 # This should be automatically updated by the 'update-copyright'
44 # rule of our Makefile.
45 RELEASE_YEAR=2017
47 # Override SHELL. This is required on DJGPP so that Perl's system()
48 # uses bash, not COMMAND.COM which doesn't quote arguments properly.
49 # It's not used otherwise.
50 if test -n "$DJDIR"; then
51 BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe
52 else
53 BOOTSTRAP_SHELL=/bin/sh
56 # Sanity checks.
57 if test -z "$VERSION"; then
58 echo "$me: cannot find VERSION" >&2
59 exit 1
62 if test -z "$APIVERSION"; then
63 echo "$me: cannot find APIVERSION" >&2
64 exit 1
67 # Make a dummy versioned directory for aclocal.
68 rm -rf aclocal-$APIVERSION
69 mkdir aclocal-$APIVERSION
70 if test -d automake-$APIVERSION; then
71 find automake-$APIVERSION -exec chmod u+wx '{}' ';'
73 rm -rf automake-$APIVERSION
74 # Can't use "ln -s lib automake-$APIVERSION", that would create a
75 # lib.exe stub under DJGPP 2.03.
76 mkdir automake-$APIVERSION
77 cp -rf lib/* automake-$APIVERSION
79 dosubst ()
81 rm -f $2
82 in=`echo $1 | sed 's,^.*/,,'`
83 sed -e "s%@APIVERSION@%$APIVERSION%g" \
84 -e "s%@PACKAGE@%$PACKAGE%g" \
85 -e "s%@PERL@%$PERL%g" \
86 -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
87 -e "s%@VERSION@%$VERSION%g" \
88 -e "s%@datadir@%$datadir%g" \
89 -e "s%@RELEASE_YEAR@%$RELEASE_YEAR%g" \
90 -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \
91 $1 > $2
92 chmod a-w $2
95 # Create temporary replacement for lib/Automake/Config.pm.
96 dosubst automake-$APIVERSION/Automake/Config.in \
97 automake-$APIVERSION/Automake/Config.pm
99 # Overwrite amversion.m4.
100 dosubst m4/amversion.in m4/amversion.m4
102 # Create temporary replacement for aclocal and automake.
103 dosubst bin/aclocal.in bin/aclocal.tmp
104 dosubst bin/automake.in bin/automake.tmp
106 # Create required makefile snippets.
107 $PERL ./gen-testsuite-part > t/testsuite-part.tmp
108 chmod a-w t/testsuite-part.tmp
109 mv -f t/testsuite-part.tmp t/testsuite-part.am
111 # Run the autotools. Bail out if any warning is triggered.
112 # Use '-I' here so that our own *.m4 files in m4/ gets included,
113 # not copied, in aclocal.m4.
114 $PERL ./bin/aclocal.tmp -Wall -Werror -I m4 \
115 --automake-acdir=m4 --system-acdir=m4/acdir
116 $AUTOCONF -Wall -Werror
117 $PERL ./bin/automake.tmp -Wall -Werror
119 # Remove temporary files and directories.
120 rm -rf aclocal-$APIVERSION automake-$APIVERSION
121 rm -f bin/aclocal.tmp bin/automake.tmp