tests: fetch the 'compile' script for subdir objects
[automake.git] / bootstrap
blobfa0bf88c22a3961f294b3ebeb8e9ed86c9db417b
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 # Don't ignore failures.
23 set -e
25 # Set program basename.
26 me=`echo "$0" | sed 's,^.*/,,'`
28 # Let user choose which version of autoconf, autom4te and perl to use.
29 : ${AUTOCONF=autoconf}
30 export AUTOCONF # might be used by aclocal and/or automake
31 : ${AUTOM4TE=autom4te}
32 export AUTOM4TE # ditto
33 : ${PERL=perl}
35 # Variables to substitute.
36 VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
37 PACKAGE=automake
38 datadir=.
39 PERL_THREADS=0
41 # Override SHELL. This is required on DJGPP so that Perl's system()
42 # uses bash, not COMMAND.COM which doesn't quote arguments properly.
43 # It's not used otherwise.
44 if test -n "$DJDIR"; then
45 BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe
46 else
47 BOOTSTRAP_SHELL=/bin/sh
50 # Read the rule for calculating APIVERSION and execute it.
51 apiver_cmd=`sed -ne 's/\[\[/[/g;s/\]\]/]/g;/^APIVERSION=/p' configure.ac`
52 eval "$apiver_cmd"
54 # Sanity checks.
55 if test -z "$VERSION"; then
56 echo "$me: cannot find VERSION" >&2
57 exit 1
60 if test -z "$APIVERSION"; then
61 echo "$me: cannot find APIVERSION" >&2
62 exit 1
65 # Make a dummy versioned directory for aclocal.
66 rm -rf aclocal-$APIVERSION
67 mkdir aclocal-$APIVERSION
68 if test -d automake-$APIVERSION; then
69 find automake-$APIVERSION -exec chmod u+wx '{}' ';'
71 rm -rf automake-$APIVERSION
72 # Can't use `ln -s lib automake-$APIVERSION', that would create a
73 # lib.exe stub under DJGPP 2.03.
74 mkdir automake-$APIVERSION
75 cp -rf lib/* automake-$APIVERSION
77 dosubst ()
79 rm -f $2
80 in=`echo $1 | sed 's,^.*/,,'`
81 sed -e "s%@APIVERSION@%$APIVERSION%g" \
82 -e "s%@PACKAGE@%$PACKAGE%g" \
83 -e "s%@PERL@%$PERL%g" \
84 -e "s%@PERL_THREADS@%$PERL_THREADS%g" \
85 -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
86 -e "s%@VERSION@%$VERSION%g" \
87 -e "s%@datadir@%$datadir%g" \
88 -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \
89 $1 > $2
90 chmod a-w $2
93 # Create temporary replacement for lib/Automake/Config.pm.
94 dosubst automake-$APIVERSION/Automake/Config.in \
95 automake-$APIVERSION/Automake/Config.pm
97 # Create temporary replacement for aclocal.
98 dosubst aclocal.in aclocal.tmp
100 # Overwrite amversion.m4.
101 dosubst m4/amversion.in m4/amversion.m4
103 # Create temporary replacement for automake.
104 dosubst automake.in automake.tmp
106 # Create required makefile snippets.
107 cd tests
108 $PERL ./gen-testsuite-part > testsuite-part.tmp
109 chmod a-w testsuite-part.tmp
110 mv -f testsuite-part.tmp testsuite-part.am
111 cd ..
113 # Run the autotools.
114 # Use `-I' here so that our own *.m4 files in m4/ gets included,
115 # not copied, in aclocal.m4.
116 $PERL ./aclocal.tmp -I m4 --automake-acdir m4 --system-acdir m4/acdir
117 $AUTOCONF
118 $PERL ./automake.tmp
120 # Remove temporary files and directories.
121 rm -rf aclocal-$APIVERSION automake-$APIVERSION
122 rm -f aclocal.tmp automake.tmp