Fix minor doc issues in node `CVS'.
[automake/plouj.git] / bootstrap
blob0b7c43e95ef1deddf238c5463ed4db1c7c28680d
1 #! /bin/sh
3 # This script helps bootstrap automake, when checked out from git.
5 # Copyright (C) 2002, 2003, 2004, 2007 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 3, 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 # Find the path separator
22 echo "#! /bin/sh" >boot$$.sh
23 echo "exit 0" >>boot$$.sh
24 chmod +x boot$$.sh
25 if (PATH="/nonexistent;."; boot$$.sh) >/dev/null 2>&1; then
26 PATH_SEPARATOR=';'
27 else
28 PATH_SEPARATOR=:
30 rm -f boot$$.sh
32 # Don't ignore failures
33 set -e
35 # Find perl. Code based on Autoconf, but without non-POSIX support.
36 if test -z "$PERL"; then
37 save_IFS=$IFS
38 IFS=$PATH_SEPARATOR
39 for dir in $PATH; do
40 IFS=$save_IFS
41 test -z "$dir" && dir=.
42 if test -x "$dir/perl" && test ! -d "$dir/perl"; then
43 PERL="$dir/perl"
44 break
46 done
49 if test -z "$PERL"; then
50 echo "Cannot find perl" >&2
51 exit 1
54 # Variables to substitute
55 VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
56 PACKAGE=automake
57 datadir=.
59 # Override SHELL. This is required on DJGPP so that Perl's system()
60 # uses bash, not COMMAND.COM which doesn't quote arguments properly.
61 # It's not used otherwise.
62 if test -n "$DJGPP"; then
63 BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe
64 else
65 BOOTSTRAP_SHELL=/bin/sh
68 # Read the rule for calculating APIVERSION and execute it
69 apiver_cmd=`sed -ne 's/\[\[/[/g;s/\]\]/]/g;/^APIVERSION=/p' configure.ac`
70 eval $apiver_cmd
72 # Sanity checks
73 if test -z "$VERSION"; then
74 echo "Cannot find VERSION" >&2
75 exit 1
78 if test -z "$APIVERSION"; then
79 echo "Cannot find VERSION" >&2
80 exit 1
83 # Make a dummy versioned directory for aclocal
84 rm -rf aclocal-$APIVERSION
85 mkdir aclocal-$APIVERSION
86 rm -rf automake-$APIVERSION
87 # Can't use `ln -s lib automake-$APIVERSION',
88 # that would create a lib.exe stub under DJGPP 2.03.
89 mkdir automake-$APIVERSION
90 cp -rf lib/* automake-$APIVERSION
92 dosubst ()
94 rm -f $2
95 in=`echo $1 | sed 's,^.*/,,'`
96 sed -e "s%@APIVERSION@%$APIVERSION%g" \
97 -e "s%@PACKAGE@%$PACKAGE%g" \
98 -e "s%@PERL@%$PERL%g" \
99 -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
100 -e "s%@VERSION@%$VERSION%g" \
101 -e "s%@datadir@%$datadir%g" \
102 -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \
103 $1 > $2
104 chmod a-w $2
108 # Create temporary replacement for lib/Automake/Config.pm
109 dosubst automake-$APIVERSION/Automake/Config.in \
110 automake-$APIVERSION/Automake/Config.pm
112 # Create temporary replacement for aclocal
113 dosubst aclocal.in aclocal.tmp
115 # Overwrite amversion.m4
116 dosubst m4/amversion.in m4/amversion.m4
118 # Create temporary replacement for automake
119 dosubst automake.in automake.tmp
121 # Run the autotools.
122 $PERL ./aclocal.tmp -I m4
123 autoconf
124 $PERL ./automake.tmp
126 # Remove temporary files and directories
127 rm -rf aclocal-$APIVERSION automake-$APIVERSION
128 rm -f aclocal.tmp automake.tmp
129 rm -f lib/Automake/Config.pm