Merge branch 'minor'
[automake.git] / bootstrap
blob953577b05240fa500a326413a1262ceef64398ef
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 <http://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 # Sanity checks.
48 if test -z "$VERSION"; then
49 echo "$me: cannot find VERSION" >&2
50 exit 1
53 if test -z "$APIVERSION"; then
54 echo "$me: cannot find APIVERSION" >&2
55 exit 1
58 # Make a dummy versioned directory for aclocal.
59 rm -rf aclocal-$APIVERSION
60 mkdir aclocal-$APIVERSION
61 if test -d automake-$APIVERSION; then
62 find automake-$APIVERSION -exec chmod u+wx '{}' ';'
64 rm -rf automake-$APIVERSION
65 # Can't use "ln -s lib automake-$APIVERSION", that might not work
66 # properly on MinGW/MSYS.
67 mkdir automake-$APIVERSION
68 cp -rf lib/* automake-$APIVERSION
70 dosubst ()
72 rm -f $2
73 in=`echo $1 | sed 's,^.*/,,'`
74 sed -e "s%@APIVERSION@%$APIVERSION%g" \
75 -e "s%@PACKAGE@%$PACKAGE%g" \
76 -e "s%@PERL@%$PERL%g" \
77 -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
78 -e "s%@VERSION@%$VERSION%g" \
79 -e "s%@datadir@%$datadir%g" \
80 -e "s%@RELEASE_YEAR@%$RELEASE_YEAR%g" \
81 -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \
82 $1 > $2
83 chmod a-w $2
86 # Create temporary replacement for lib/Automake/Config.pm.
87 dosubst automake-$APIVERSION/Automake/Config.in \
88 automake-$APIVERSION/Automake/Config.pm
90 # Overwrite amversion.m4.
91 dosubst m4/amversion.in m4/amversion.m4
93 # Create temporary replacement for aclocal and automake.
94 dosubst bin/aclocal.in bin/aclocal.tmp
95 dosubst bin/automake.in bin/automake.tmp
97 # Create required makefile snippets.
98 $PERL ./gen-testsuite-part > t/testsuite-part.tmp
99 chmod a-w t/testsuite-part.tmp
100 mv -f t/testsuite-part.tmp t/testsuite-part.am
102 # Run the autotools. Bail out if any warning is triggered.
103 # Use '-I' here so that our own *.m4 files in m4/ gets included,
104 # not copied, in aclocal.m4.
105 $PERL ./bin/aclocal.tmp -Wall -Werror -I m4 \
106 --automake-acdir=m4 --system-acdir=m4/acdir
107 $AUTOCONF -Wall -Werror
108 $PERL ./bin/automake.tmp -Wall -Werror
110 # Remove temporary files and directories.
111 rm -rf aclocal-$APIVERSION automake-$APIVERSION
112 rm -f bin/aclocal.tmp bin/automake.tmp