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)
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.
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
34 # Variables to substitute.
35 VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
38 # This should be automatically updated by the 'update-copyright'
39 # rule of our Makefile.
42 # Override SHELL. This is required on DJGPP so that Perl's system()
43 # uses bash, not COMMAND.COM which doesn't quote arguments properly.
44 # It's not used otherwise.
45 if test -n "$DJDIR"; then
46 BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe
48 BOOTSTRAP_SHELL=/bin/sh
51 # Read the rule for calculating APIVERSION and execute it.
52 apiver_cmd=`sed -ne 's/\[\[/[/g;s/\]\]/]/g;/^APIVERSION=/p' configure.ac`
56 if test -z "$VERSION"; then
57 echo "$me: cannot find VERSION" >&2
61 if test -z "$APIVERSION"; then
62 echo "$me: cannot find APIVERSION" >&2
66 # Make a dummy versioned directory for aclocal.
67 rm -rf aclocal-$APIVERSION
68 mkdir aclocal-$APIVERSION
69 if test -d automake-$APIVERSION; then
70 find automake-$APIVERSION -exec chmod u+wx '{}' ';'
72 rm -rf automake-$APIVERSION
73 # Can't use "ln -s lib automake-$APIVERSION", that would create a
74 # lib.exe stub under DJGPP 2.03.
75 mkdir automake-$APIVERSION
76 cp -rf lib/* automake-$APIVERSION
81 in=`echo $1 | sed 's,^.*/,,'`
82 sed -e "s%@APIVERSION@%$APIVERSION%g" \
83 -e "s%@PACKAGE@%$PACKAGE%g" \
84 -e "s%@PERL@%$PERL%g" \
85 -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
86 -e "s%@VERSION@%$VERSION%g" \
87 -e "s%@datadir@%$datadir%g" \
88 -e "s%@RELEASE_YEAR@%$RELEASE_YEAR%g" \
89 -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \
94 # Create temporary replacement for lib/Automake/Config.pm.
95 dosubst automake-$APIVERSION/Automake/Config.in \
96 automake-$APIVERSION/Automake/Config.pm
98 # Create temporary replacement for aclocal.
99 dosubst aclocal.in aclocal.tmp
101 # Overwrite amversion.m4.
102 dosubst m4/amversion.in m4/amversion.m4
104 # Create temporary replacement for automake.
105 dosubst automake.in automake.tmp
107 # Create required makefile snippets.
108 $PERL ./gen-testsuite-part > t/testsuite-part.tmp
109 chmod a-w t/testsuite-part.tmp
110 mv -f t/testsuite-part.tmp t/testsuite-part.am
112 # Run the autotools. Bail out if any warning is triggered.
113 # Use '-I' here so that our own *.m4 files in m4/ gets included,
114 # not copied, in aclocal.m4.
115 $PERL ./aclocal.tmp -Wall -Werror -I m4 \
116 --automake-acdir=m4 --system-acdir=m4/acdir
117 $AUTOCONF -Wall -Werror
118 $PERL ./automake.tmp -Wall -Werror
120 # Remove temporary files and directories.
121 rm -rf aclocal-$APIVERSION automake-$APIVERSION
122 rm -f aclocal.tmp automake.tmp