* lib/am/configure.am: Replace leading spaces with a real tab.
[platform/upstream/automake.git] / bootstrap
1 #! /bin/sh
2
3 # This script helps bootstrap automake, when checked out from CVS.
4 #
5 # Copyright (C) 2002, 2003  Free Software Foundation, Inc.
6 # written by Pavel Roskin <proski@gnu.org> September 2002
7 #
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.
12 #
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.
17 #
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.
21
22 # Find the path separator
23 echo "#! /bin/sh" >boot$$.sh
24 echo  "exit 0"   >>boot$$.sh
25 chmod +x boot$$.sh
26 if (PATH="/nonexistent;."; boot$$.sh) >/dev/null 2>&1; then
27   PATH_SEPARATOR=';'
28 else
29   PATH_SEPARATOR=:
30 fi
31 rm -f boot$$.sh
32
33 # Don't ignore failures
34 set -e
35
36 # Find perl.  Code based on Autoconf, but without non-POSIX support.
37 if test -z "$PERL"; then
38         save_IFS=$IFS
39         IFS=$PATH_SEPARATOR
40         for dir in $PATH; do
41                 IFS=$save_IFS
42                 test -z "$dir" && dir=.
43                 if test -x "$dir/perl"; then
44                         PERL="$dir/perl"
45                         break
46                 fi
47         done
48 fi
49
50 if test -z "$PERL"; then
51         echo "Cannot find perl" 2>&1
52         exit 1
53 fi
54
55 # Variables to substitute
56 VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.in`
57 PACKAGE=automake
58 datadir=.
59
60 # Override SHELL.  This is required on DJGPP so that Perl's system()
61 # uses bash, not COMMAND.COM which doesn't quote arguments properly.
62 # It's not used otherwise.
63 if test -n "$DJGPP"; then
64     BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe
65 else
66     BOOTSTRAP_SHELL=/bin/sh
67 fi
68
69 # Read the rule for calculating APIVERSION and execute it
70 apiver_cmd=`sed -ne 's/\[\[/[/g;s/\]\]/]/g;/^APIVERSION=/p' configure.in`
71 eval $apiver_cmd
72
73 # Sanity checks
74 if test -z "$VERSION"; then
75         echo "Cannot find VERSION" 2>&1
76         exit 1
77 fi
78
79 if test -z "$APIVERSION"; then
80         echo "Cannot find VERSION" 2>&1
81         exit 1
82 fi
83
84 # Make a dummy versioned directory for aclocal
85 rm -rf aclocal-$APIVERSION
86 mkdir aclocal-$APIVERSION
87 rm -rf automake-$APIVERSION
88 # Can't use `ln -s lib automake-$APIVERSION',
89 # that would create a lib.exe stub under DJGPP 2.03.
90 mkdir automake-$APIVERSION
91 cp -rf lib/* automake-$APIVERSION
92
93 # Create temporary replacement for aclocal
94 sed -e "s%@PERL@%$PERL%g" \
95     -e "s%@VERSION@%$VERSION%g" \
96     -e "s%@APIVERSION@%$APIVERSION%g" \
97     -e "s%@PACKAGE@%$PACKAGE%g" \
98     -e "s%@datadir@%$datadir%g" \
99     -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
100     aclocal.in >aclocal.tmp
101
102 # Overwrite amversion.m4
103 sed -e "s%@VERSION@%$VERSION%g" \
104     -e "s%@APIVERSION@%$APIVERSION%g" \
105     m4/amversion.in >m4/amversion.m4
106
107 # Create temporary replacement for automake
108 sed -e "s%@PERL@%$PERL%g" \
109     -e "s%@VERSION@%$VERSION%g" \
110     -e "s%@APIVERSION@%$APIVERSION%g" \
111     -e "s%@PACKAGE@%$PACKAGE%g" \
112     -e "s%@datadir@%$datadir%g" \
113     -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
114     automake.in >automake.tmp
115
116 # Run the autotools.
117 $PERL ./aclocal.tmp -I m4
118 autoconf
119 $PERL ./automake.tmp
120
121 # Remove temporary files and directories
122 rm -rf aclocal-$APIVERSION automake-$APIVERSION
123 rm -f aclocal.tmp automake.tmp