release: beta release 1.13.2b (will become 1.13.3)
[automake.git] / bootstrap.sh
blobfc58a21d04d4f62563c6c4794754b65fdd115fc1
1 #! /bin/sh
3 # This script helps bootstrap automake, when checked out from git.
5 # Copyright (C) 2002-2013 Free Software Foundation, Inc.
6 # Originally 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, see <http://www.gnu.org/licenses/>.
21 # Don't ignore failures.
22 set -e
24 # Set program basename.
25 me=`echo "$0" | sed 's,^.*/,,'`
27 # Let user choose which version of autoconf, autom4te and perl to use.
28 : ${AUTOCONF=autoconf}
29 export AUTOCONF # might be used by aclocal and/or automake
30 : ${AUTOM4TE=autom4te}
31 export AUTOM4TE # ditto
32 : ${PERL=perl}
34 # Variables to substitute.
35 VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
36 PACKAGE=automake
37 datadir=.
38 PERL_THREADS=0
39 # This should be automatically updated by the 'update-copyright'
40 # rule of our Makefile.
41 RELEASE_YEAR=2013
43 # Override SHELL. This is required on DJGPP so that Perl's system()
44 # uses bash, not COMMAND.COM which doesn't quote arguments properly.
45 # It's not used otherwise.
46 if test -n "$DJDIR"; then
47 BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe
48 else
49 BOOTSTRAP_SHELL=/bin/sh
52 # Read the rule for calculating APIVERSION and execute it.
53 apiver_cmd=`sed -ne 's/\[\[/[/g;s/\]\]/]/g;/^APIVERSION=/p' configure.ac`
54 eval "$apiver_cmd"
56 # Sanity checks.
57 if test -z "$VERSION"; then
58 echo "$me: cannot find VERSION" >&2
59 exit 1
62 if test -z "$APIVERSION"; then
63 echo "$me: cannot find APIVERSION" >&2
64 exit 1
67 # Make a dummy versioned directory for aclocal.
68 rm -rf aclocal-$APIVERSION
69 mkdir aclocal-$APIVERSION
70 if test -d automake-$APIVERSION; then
71 find automake-$APIVERSION -exec chmod u+wx '{}' ';'
73 rm -rf automake-$APIVERSION
74 # Can't use "ln -s lib automake-$APIVERSION", that would create a
75 # lib.exe stub under DJGPP 2.03.
76 mkdir automake-$APIVERSION
77 cp -rf lib/* automake-$APIVERSION
79 dosubst ()
81 rm -f $2
82 in=`echo $1 | sed 's,^.*/,,'`
83 sed -e "s%@APIVERSION@%$APIVERSION%g" \
84 -e "s%@PACKAGE@%$PACKAGE%g" \
85 -e "s%@PERL@%$PERL%g" \
86 -e "s%@PERL_THREADS@%$PERL_THREADS%g" \
87 -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
88 -e "s%@VERSION@%$VERSION%g" \
89 -e "s%@datadir@%$datadir%g" \
90 -e "s%@RELEASE_YEAR@%$RELEASE_YEAR%g" \
91 -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \
92 $1 > $2
93 chmod a-w $2
96 # Create temporary replacement for lib/Automake/Config.pm.
97 dosubst automake-$APIVERSION/Automake/Config.in \
98 automake-$APIVERSION/Automake/Config.pm
100 # Create temporary replacement for aclocal.
101 dosubst aclocal.in aclocal.tmp
103 # Overwrite amversion.m4.
104 dosubst m4/amversion.in m4/amversion.m4
106 # Create temporary replacement for automake.
107 dosubst automake.in automake.tmp
109 # Create required makefile snippets.
110 $PERL ./gen-testsuite-part > t/testsuite-part.tmp
111 chmod a-w t/testsuite-part.tmp
112 mv -f t/testsuite-part.tmp t/testsuite-part.am
114 # Run the autotools.
115 # Use '-I' here so that our own *.m4 files in m4/ gets included,
116 # not copied, in aclocal.m4.
117 $PERL ./aclocal.tmp -I m4 --automake-acdir m4 --system-acdir m4/acdir
118 $AUTOCONF
119 $PERL ./automake.tmp
121 # Remove temporary files and directories.
122 rm -rf aclocal-$APIVERSION automake-$APIVERSION
123 rm -f aclocal.tmp automake.tmp