2003-02-10 Richard Dawe <rich@phekda.freeserve.co.uk>
[automake.git] / bootstrap
blob3d8e79e0113da4dfdcfd6a9e7174e7716c177317
1 #! /bin/sh
3 # This script helps bootstrap automake, when checked out from CVS.
5 # Copyright (C) 2002, 2003 Free Software Foundation, Inc.
6 # 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, write to the Free Software Foundation,
20 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 # Don't ignore failures
24 set -e
26 # Find perl. Not as good as autoconf would do, but good enough.
27 if test -z "$PERL"; then
28 PERL="`which perl 2>/dev/null`"
31 if test -z $PERL; then
32 echo "Cannot find perl" 2>&1
33 exit 1
36 # Variables to substitute
37 VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.in`
38 PACKAGE=automake
39 datadir=.
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 $DJGPP; 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.in`
52 eval $apiver_cmd
54 # Sanity checks
55 if test -z "$VERSION"; then
56 echo "Cannot find VERSION" 2>&1
57 exit 1
60 if test -z "$APIVERSION"; then
61 echo "Cannot find VERSION" 2>&1
62 exit 1
65 # Make a dummy versioned directory for aclocal
66 rm -rf aclocal-$APIVERSION
67 mkdir aclocal-$APIVERSION
68 rm -rf automake-$APIVERSION
69 ln -s lib automake-$APIVERSION || {
70 mkdir automake-$APIVERSION
71 cp -arf lib/* automake-$APIVERSION
74 # Create temporary replacement for aclocal
75 sed -e "s%@PERL@%$PERL%g" \
76 -e "s%@VERSION@%$VERSION%g" \
77 -e "s%@APIVERSION@%$APIVERSION%g" \
78 -e "s%@PACKAGE@%$PACKAGE%g" \
79 -e "s%@datadir@%$datadir%g" \
80 -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
81 aclocal.in >aclocal.tmp
83 # Create temporary replacement for amversion.m4
84 sed -e "s%@PERL@%$PERL%g" \
85 -e "s%@VERSION@%$VERSION%g" \
86 -e "s%@APIVERSION@%$APIVERSION%g" \
87 -e "s%@PACKAGE@%$PACKAGE%g" \
88 -e "s%@datadir@%$datadir%g" \
89 m4/amversion.in >aclocal-$APIVERSION/amversion-tmp.m4
91 # Run aclocal
92 $PERL ./aclocal.tmp -I aclocal-$APIVERSION -I m4
94 # Create temporary replacement for automake
95 sed -e "s%@PERL@%$PERL%g" \
96 -e "s%@VERSION@%$VERSION%g" \
97 -e "s%@APIVERSION@%$APIVERSION%g" \
98 -e "s%@PACKAGE@%$PACKAGE%g" \
99 -e "s%@datadir@%$datadir%g" \
100 -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
101 automake.in >automake.tmp
103 # Run automake
104 $PERL ./automake.tmp
106 # Remove temporary files and directories
107 rm -rf aclocal-$APIVERSION automake-$APIVERSION
108 rm -f aclocal.tmp automake.tmp