compile: clear the `eat' variable earlier.
[automake.git] / bootstrap
blob7766bd3e83e314c83377143fd5e0303cd06406fd
1 #! /bin/sh
3 # This script helps bootstrap automake, when checked out from git.
5 # Copyright (C) 2002, 2003, 2004, 2007, 2008, 2010 Free Software
6 # Foundation, Inc.
7 # Originally written by Pavel Roskin <proski@gnu.org> September 2002.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 # Find the path separator.
23 # (Snippet copied from configure's initialization in Autoconf 2.65)
24 if test "${PATH_SEPARATOR+set}" != set; then
25 PATH_SEPARATOR=:
26 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
27 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
28 PATH_SEPARATOR=';'
32 # Don't ignore failures.
33 set -e
35 # Set program basename.
36 me=`echo "$0" | sed 's,^.*/,,'`
38 # Find perl. Code based on Autoconf, but without non-POSIX support.
39 if test -z "$PERL"; then
40 save_IFS=$IFS
41 IFS=$PATH_SEPARATOR
42 for dir in $PATH; do
43 IFS=$save_IFS
44 test -z "$dir" && dir=.
45 if test -x "$dir/perl" && test ! -d "$dir/perl"; then
46 PERL="$dir/perl"
47 break
49 done
52 if test -z "$PERL"; then
53 echo "$me: cannot find perl" >&2
54 exit 1
57 # Variables to substitute.
58 VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
59 PACKAGE=automake
60 datadir=.
61 PERL_THREADS=0
63 # Override SHELL. This is required on DJGPP so that Perl's system()
64 # uses bash, not COMMAND.COM which doesn't quote arguments properly.
65 # It's not used otherwise.
66 if test -n "$DJDIR"; then
67 BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe
68 else
69 BOOTSTRAP_SHELL=/bin/sh
72 # Read the rule for calculating APIVERSION and execute it.
73 apiver_cmd=`sed -ne 's/\[\[/[/g;s/\]\]/]/g;/^APIVERSION=/p' configure.ac`
74 eval $apiver_cmd
76 # Sanity checks.
77 if test -z "$VERSION"; then
78 echo "$me: cannot find VERSION" >&2
79 exit 1
82 if test -z "$APIVERSION"; then
83 echo "$me: cannot find VERSION" >&2
84 exit 1
87 # Make a dummy versioned directory for aclocal.
88 rm -rf aclocal-$APIVERSION
89 mkdir aclocal-$APIVERSION
90 if test -d automake-$APIVERSION; then
91 find automake-$APIVERSION -exec chmod u+wx '{}' ';'
93 rm -rf automake-$APIVERSION
94 # Can't use `ln -s lib automake-$APIVERSION', that would create a
95 # lib.exe stub under DJGPP 2.03.
96 mkdir automake-$APIVERSION
97 cp -rf lib/* automake-$APIVERSION
99 dosubst ()
101 rm -f $2
102 in=`echo $1 | sed 's,^.*/,,'`
103 sed -e "s%@APIVERSION@%$APIVERSION%g" \
104 -e "s%@PACKAGE@%$PACKAGE%g" \
105 -e "s%@PERL@%$PERL%g" \
106 -e "s%@PERL_THREADS@%$PERL_THREADS%g" \
107 -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
108 -e "s%@VERSION@%$VERSION%g" \
109 -e "s%@datadir@%$datadir%g" \
110 -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \
111 $1 > $2
112 chmod a-w $2
116 # Create temporary replacement for lib/Automake/Config.pm.
117 dosubst automake-$APIVERSION/Automake/Config.in \
118 automake-$APIVERSION/Automake/Config.pm
120 # Create temporary replacement for aclocal.
121 dosubst aclocal.in aclocal.tmp
123 # Overwrite amversion.m4.
124 dosubst m4/amversion.in m4/amversion.m4
126 # Create temporary replacement for automake.
127 dosubst automake.in automake.tmp
129 # Create tests/parallel-tests.am.
130 cd tests
131 $BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am
132 cd ..
134 # Run the autotools.
135 $PERL ./aclocal.tmp -I m4
136 autoconf
137 $PERL ./automake.tmp
139 # Remove temporary files and directories.
140 rm -rf aclocal-$APIVERSION automake-$APIVERSION
141 rm -f aclocal.tmp automake.tmp
142 rm -f lib/Automake/Config.pm