]> git.saurik.com Git - bison.git/blame - bootstrap
* data/lalr1.cc (b4_parse_param_decl_1): New.
[bison.git] / bootstrap
CommitLineData
01c56de4
AD
1#! /bin/sh
2
1f65350a 3# Bootstrap this package from CVS.
01c56de4 4
1f65350a
PE
5# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
6
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2, or (at your option)
10# any later version.
11
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20# 02111-1307, USA.
21
22# Written by Paul Eggert.
23
24package=bison
25
a9f027b9
PE
26# Ensure file names are sorted consistently across platforms;
27# e.g., m4/ulonglong_gl.m4 should follow m4/ulonglong.m4.
28LC_ALL=C
29export LC_ALL
30
1f65350a
PE
31# Parse options.
32
33for option
34do
35 case $option in
36 --help)
37 echo "$0: usage: $0 [--gnulib-srcdir=DIR] [--cvs-user=USERNAME] [--skip-po]"
38 exit;;
39 --gnulib-srcdir=*)
e23d0dd7 40 GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
1f65350a 41 --cvs-user=*)
e23d0dd7 42 CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
1f65350a
PE
43 --skip-po)
44 SKIP_PO=t;;
45 *)
46 echo >&2 "$0: $option: unknown option"
47 exit 1;;
48 esac
49done
50
51echo "$0: Bootstrapping CVS $package..."
52
53build_cvs_prefix() {
54 CVS_PREFIX=:${1}:
55 if [ "${2}" != - ]; then
56 CVS_PREFIX=${CVS_PREFIX}${2}@
57 fi
58}
59
60# Get gnulib files.
61
62case ${GNULIB_SRCDIR--} in
63-)
64 if [ ! -d gnulib ]; then
65 echo "$0: getting gnulib files..."
66
67 trap exit 1 2 13 15
68 trap 'rm -fr gnulib; exit 1' 0
69
70 case ${CVS_AUTH-anoncvs} in
71 anoncvs)
72 CVS_PREFIX='anoncvs@';;
73 ssh)
74 CVS_PREFIX="$CVS_USER${CVS_USER+@}";;
75 *)
76 echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
77 exit 1;;
78 esac
79
80 case $CVS_RSH in
81 '') export CVS_RSH=ssh;;
82 esac
83
84 cvs -z3 -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib co gnulib || exit
85
86 trap 0
87 fi
88 GNULIB_SRCDIR=gnulib
89esac
90
91<$GNULIB_SRCDIR/gnulib-tool || exit
92
93gnulib_modules='
94alloca
95argmatch
96dirname
97error
98getopt
99hard-locale
100hash
101malloc
102mbswidth
103obstack
104quote
105quotearg
106stdbool
107stpcpy
108xalloc
a9f027b9 109xalloc-die
1f65350a
PE
110xstrndup
111'
112
113previous_gnulib_modules=
114while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
115 previous_gnulib_modules=$gnulib_modules
116 gnulib_modules=`
117 (echo "$gnulib_modules"
118 for gnulib_module in $gnulib_modules; do
119 $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
120 done) | sort -u
121 `
122done
123
124gnulib_files=`
125 (for gnulib_module in $gnulib_modules; do
126 $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
127 done) | sort -u
128`
129
130gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
131mkdir -p $gnulib_dirs || exit
132
133for gnulib_file in $gnulib_files; do
134 dest=$gnulib_file
135
136 case $gnulib_file in
137 m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
a9f027b9
PE
138 # These will be overwritten by autopoint, which still uses
139 # old jm_.* macro names, so we have to keep both copies.
140 # m4/gettext.m4 isn't mentioned here, since it's patched below.
141 m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \
142 m4/lib-prefix.m4 | m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \
143 m4/ulonglong.m4)
144 dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;;
1f65350a
PE
145 esac
146
147 rm -f $dest &&
148 echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
149 cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
150done
151
a9f027b9
PE
152echo "$0: patching m4/gettext.m4 so that AM_INTL_SUBDIR is empty ..."
153sed '
154 /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
155 AC_DEFUN([AM_INTL_SUBDIR], [])
156' m4/gettext.m4 >m4/gettext_gl.m4 || exit
157
1f65350a
PE
158
159# Get translations.
160
161case $SKIP_PO in
162'')
6712933e 163 echo "$0: getting translations into po (please ignore the robots.txt ERROR 404)..."
1f65350a
PE
164 (cd po &&
165 rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
166 wget -nv -nd -r -l 1 -A .po -C off \
167 http://www2.iro.umontreal.ca/~gnutra/po/maint/$package/ &&
168 ls *.po | sed 's/\.po$//' >LINGUAS
169 ) || exit;;
170esac
171
172
173# Generate autoconf and automake snippets.
174
175(echo '# This file is generated automatically by "bootstrap".' &&
176 echo 'AC_DEFUN([GNULIB_AUTOCONF_SNIPPET],[' &&
177 $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_modules &&
178 echo '])'
179) >m4/gnulib.m4 || exit
180
181(echo '# This file is generated automatically by "bootstrap".' &&
182 $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_modules
183) >lib/gnulib.mk || exit
184
185
186# Reconfigure, getting other files.
187
188echo "$0: autoreconf --verbose --install --force ..."
189autoreconf --verbose --install --force || exit
190
e23d0dd7 191
1f65350a 192# We don't need intl, so remove it.
e23d0dd7
PE
193# Remove aclocal.m4 too, so that it gets rebuilt.
194intl_files_to_remove='
195 aclocal.m4
196 intl
197 m4/codeset.m4
a9f027b9 198 m4/gettext.m4
e23d0dd7
PE
199 m4/glibc21.m4
200 m4/intdiv0.m4
201 m4/intmax.m4
202 m4/inttypes_h.m4
203 m4/inttypes.m4
204 m4/inttypes-pri.m4
205 m4/isc-posix.m4
206 m4/lcmessage.m4
a9f027b9
PE
207 m4/lib-ld.m4
208 m4/lib-prefix.m4
e23d0dd7
PE
209 m4/longdouble.m4
210 m4/longlong.m4
a9f027b9 211 m4/po.m4
e23d0dd7
PE
212 m4/printf-posix.m4
213 m4/signed.m4
214 m4/size_max.m4
215 m4/stdint_h.m4
216 m4/uintmax_t.m4
217 m4/ulonglong.m4
218 m4/wchar_t.m4
219 m4/wint_t.m4
220 m4/xsize.m4
221'
222echo $0: rm -fr $intl_files_to_remove ...
223rm -fr $intl_files_to_remove || exit
224
1f65350a
PE
225# Patch what appears to be a bug in gettext 0.14.1;
226# remove this once the bug is fixed.
227grep @top_builddir@ po/Makefile.in.in >/dev/null || {
228 echo "$0: prepending 'top_builddir=@top_builddir@' to po/Makefile.in.in ... "
b9c85d5c 229 old_contents=`cat po/Makefile.in.in` || exit
1f65350a
PE
230 cat >po/Makefile.in.in <<EOF
231top_builddir=@top_builddir@
232$old_contents
233EOF
234}
235
236# Put bug-reporting address into po/Makevars.
237echo "$0: sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars ..."
238sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars
239
240
241# if src/parse-gram.[ch] are out of date, rebuild them.
b9c85d5c 242parse_gram_y=`find src/parse-gram.y \
1f65350a 243 '(' -newer src/parse-gram.c -o -newer src/parse-gram.h ')' \
b9c85d5c 244 -print` || exit
1f65350a
PE
245case $parse_gram_y in
246?*)
247 echo "$0: warning: bootstrapping with old src/parse-gram.[ch] files."
248
249 echo "$0: touch -c src/parse-gram.[ch] ... "
250 touch -c src/parse-gram.[ch] || exit
251
252 echo "$0: ./configure --disable-nls ..."
253 ./configure --disable-nls || exit
254
255 echo "$0: (cd lib && make) ..."
256 (cd lib && make) || exit
257
258 echo "$0: (cd src && make) ..."
259 (cd src && make) || exit
260
261 echo "$0: rm -f src/parse-gram.c src/parse-gram.h ..."
262 rm -f src/parse-gram.c src/parse-gram.h || exit
263
264 echo "$0: (cd src && make parse-gram.c parse-gram.h) ..."
265 (cd src && make parse-gram.c parse-gram.h) || exit
266
267 echo "$0: make distclean ..."
268 make distclean || exit;;
269esac
270
271echo "$0: done. Now you can run './configure'."