]> git.saurik.com Git - bison.git/blame - bootstrap
DJGPP support added.
[bison.git] / bootstrap
CommitLineData
01c56de4
AD
1#! /bin/sh
2
1f65350a 3# Bootstrap this package from CVS.
01c56de4 4
727e8b0b 5# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
1f65350a
PE
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
0fb669f9
PE
19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20# 02110-1301, USA.
1f65350a
PE
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.
b5240ba5 28# Also, ensure diagnostics are in English, e.g., "wget --help" below.
a9f027b9
PE
29LC_ALL=C
30export LC_ALL
31
1f65350a
PE
32# Parse options.
33
34for option
35do
36 case $option in
37 --help)
38 echo "$0: usage: $0 [--gnulib-srcdir=DIR] [--cvs-user=USERNAME] [--skip-po]"
39 exit;;
40 --gnulib-srcdir=*)
e23d0dd7 41 GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
1f65350a 42 --cvs-user=*)
e23d0dd7 43 CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
1f65350a
PE
44 --skip-po)
45 SKIP_PO=t;;
46 *)
47 echo >&2 "$0: $option: unknown option"
48 exit 1;;
49 esac
50done
51
52echo "$0: Bootstrapping CVS $package..."
53
54build_cvs_prefix() {
55 CVS_PREFIX=:${1}:
56 if [ "${2}" != - ]; then
57 CVS_PREFIX=${CVS_PREFIX}${2}@
58 fi
59}
60
61# Get gnulib files.
62
63case ${GNULIB_SRCDIR--} in
64-)
65 if [ ! -d gnulib ]; then
66 echo "$0: getting gnulib files..."
67
68 trap exit 1 2 13 15
69 trap 'rm -fr gnulib; exit 1' 0
70
71 case ${CVS_AUTH-anoncvs} in
72 anoncvs)
73 CVS_PREFIX='anoncvs@';;
74 ssh)
75 CVS_PREFIX="$CVS_USER${CVS_USER+@}";;
76 *)
77 echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
78 exit 1;;
79 esac
80
81 case $CVS_RSH in
82 '') export CVS_RSH=ssh;;
83 esac
84
85 cvs -z3 -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib co gnulib || exit
86
727e8b0b 87 trap - 0
1f65350a
PE
88 fi
89 GNULIB_SRCDIR=gnulib
90esac
91
92<$GNULIB_SRCDIR/gnulib-tool || exit
93
94gnulib_modules='
1f65350a
PE
95argmatch
96dirname
97error
42e826a4 98extensions
1f65350a 99getopt
c3d5a4a7 100gettext
1f65350a
PE
101hard-locale
102hash
103malloc
104mbswidth
105obstack
106quote
107quotearg
108stdbool
3ea5f0ec 109stdio-safer
1f65350a 110stpcpy
55f0c7b1
PE
111strerror
112strtoul
3ea5f0ec 113unistd-safer
8a6f72f3 114verify
1f65350a 115xalloc
a9f027b9 116xalloc-die
1f65350a
PE
117xstrndup
118'
119
120previous_gnulib_modules=
121while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
122 previous_gnulib_modules=$gnulib_modules
123 gnulib_modules=`
124 (echo "$gnulib_modules"
125 for gnulib_module in $gnulib_modules; do
126 $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
127 done) | sort -u
128 `
129done
130
131gnulib_files=`
132 (for gnulib_module in $gnulib_modules; do
133 $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module
134 done) | sort -u
135`
136
137gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
138mkdir -p $gnulib_dirs || exit
139
140for gnulib_file in $gnulib_files; do
141 dest=$gnulib_file
142
143 case $gnulib_file in
144 m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
a9f027b9
PE
145 # These will be overwritten by autopoint, which still uses
146 # old jm_.* macro names, so we have to keep both copies.
147 # m4/gettext.m4 isn't mentioned here, since it's patched below.
148 m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \
149 m4/lib-prefix.m4 | m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \
150 m4/ulonglong.m4)
151 dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;;
1f65350a
PE
152 esac
153
154 rm -f $dest &&
155 echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
156 cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
157done
158
7e7b77c1
PE
159# This suppresses a bogus diagnostic
160# "warning: macro `AM_LANGINFO_CODESET' not found in library".
161echo "$0: patching m4/gettext.m4 so that AM_INTL_SUBDIR is empty ..."
162sed '
163 /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
164 AC_DEFUN([AM_INTL_SUBDIR], [])
165' m4/gettext.m4 >m4/gettext_gl.m4 || exit
166
1f65350a
PE
167
168# Get translations.
169
170case $SKIP_PO in
171'')
b5240ba5
PE
172 case `wget --help` in
173 *'--no-cache'*)
174 no_cache='--no-cache';;
175 *'--cache=on/off'*)
176 no_cache='--cache=off';;
177 *)
178 no_cache='';;
179 esac
180
6712933e 181 echo "$0: getting translations into po (please ignore the robots.txt ERROR 404)..."
1f65350a
PE
182 (cd po &&
183 rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
b5240ba5 184 wget -nv -nd -r -l 1 -A .po $no_cache \
ff498c4a 185 http://www.iro.umontreal.ca/translation/maint/$package/ &&
1f65350a 186 ls *.po | sed 's/\.po$//' >LINGUAS
f7ab6a50
PE
187 ) || exit
188
189 case $package in
190 bison)
191 echo "$0: getting translations into po (please ignore the robots.txt ERROR 404)..."
192 (cd runtime-po &&
193 rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po$/p'` &&
b5240ba5 194 wget -nv -nd -r -l 1 -A .po $no_cache \
f7ab6a50 195 http://www.iro.umontreal.ca/translation/maint/$package-runtime/ &&
4ff8b7f7
PE
196
197 # For translations that have not yet been upgraded to the new
198 # runtime-po domain, prime the pump by extracting the relevant
199 # strings from the obsolete translations.
200 # This code can be removed once the bison-runtime domain
201 # has been translated by each team.
202 for po in ../po/*.po; do
203 test -f "$po" || continue
204 runpo=`basename $po`
205 test -f $runpo || {
206 msggrep -K \
207 -e 'memory exhausted' \
208 -e 'syntax error' \
209 $po 2>/dev/null |
210 sed '
211 s/^#~ //
212 /^msgid "syntax error; also memory exhausted"$/,/^$/d
213 /^$/,${ /^#/d; }
214 ' >$runpo-
215 if cmp -s $runpo- $runpo; then
216 rm $runpo-
217 else
218 mv $runpo- $runpo
219 fi
220 test -s $runpo || rm -f $runpo
221 } || exit
222 done &&
223
f7ab6a50
PE
224 ls *.po | sed 's/\.po$//' >LINGUAS
225 ) || exit
226 esac;;
1f65350a
PE
227esac
228
229
230# Generate autoconf and automake snippets.
231
232(echo '# This file is generated automatically by "bootstrap".' &&
233 echo 'AC_DEFUN([GNULIB_AUTOCONF_SNIPPET],[' &&
234 $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_modules &&
235 echo '])'
236) >m4/gnulib.m4 || exit
237
238(echo '# This file is generated automatically by "bootstrap".' &&
239 $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_modules
240) >lib/gnulib.mk || exit
241
242
243# Reconfigure, getting other files.
244
245echo "$0: autoreconf --verbose --install --force ..."
246autoreconf --verbose --install --force || exit
247
e23d0dd7 248
1f65350a 249# We don't need intl, so remove it.
e23d0dd7
PE
250# Remove aclocal.m4 too, so that it gets rebuilt.
251intl_files_to_remove='
252 aclocal.m4
253 intl
254 m4/codeset.m4
a9f027b9 255 m4/gettext.m4
3ea5f0ec 256 m4/glibc2.m4
e23d0dd7
PE
257 m4/glibc21.m4
258 m4/intdiv0.m4
259 m4/intmax.m4
260 m4/inttypes_h.m4
261 m4/inttypes.m4
262 m4/inttypes-pri.m4
263 m4/isc-posix.m4
264 m4/lcmessage.m4
a9f027b9
PE
265 m4/lib-ld.m4
266 m4/lib-prefix.m4
e23d0dd7
PE
267 m4/longdouble.m4
268 m4/longlong.m4
a9f027b9 269 m4/po.m4
e23d0dd7
PE
270 m4/printf-posix.m4
271 m4/signed.m4
272 m4/size_max.m4
273 m4/stdint_h.m4
274 m4/uintmax_t.m4
275 m4/ulonglong.m4
276 m4/wchar_t.m4
277 m4/wint_t.m4
278 m4/xsize.m4
279'
280echo $0: rm -fr $intl_files_to_remove ...
281rm -fr $intl_files_to_remove || exit
282
1f65350a
PE
283# Put bug-reporting address into po/Makevars.
284echo "$0: sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars ..."
285sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars
286
f7ab6a50
PE
287# Likewise for runtime-po/Makevars, except also change a few other parameters.
288sed '
289 s/^\(DOMAIN\) *=.*/\1 = bison-runtime/
290 s/^\(subdir\) *=.*/\1 = runtime-po/
30757c8c 291 s/^\(XGETTEXT_OPTIONS\) *=.*/\1 = --keyword=YY_/
f7ab6a50
PE
292' <po/Makevars >runtime-po/Makevars
293
294# Copy identical files from po to runtime-po.
30757c8c 295(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
1f65350a
PE
296
297# if src/parse-gram.[ch] are out of date, rebuild them.
b9c85d5c 298parse_gram_y=`find src/parse-gram.y \
1f65350a 299 '(' -newer src/parse-gram.c -o -newer src/parse-gram.h ')' \
b9c85d5c 300 -print` || exit
1f65350a
PE
301case $parse_gram_y in
302?*)
303 echo "$0: warning: bootstrapping with old src/parse-gram.[ch] files."
304
305 echo "$0: touch -c src/parse-gram.[ch] ... "
306 touch -c src/parse-gram.[ch] || exit
307
308 echo "$0: ./configure --disable-nls ..."
309 ./configure --disable-nls || exit
310
311 echo "$0: (cd lib && make) ..."
312 (cd lib && make) || exit
313
314 echo "$0: (cd src && make) ..."
315 (cd src && make) || exit
316
317 echo "$0: rm -f src/parse-gram.c src/parse-gram.h ..."
318 rm -f src/parse-gram.c src/parse-gram.h || exit
319
320 echo "$0: (cd src && make parse-gram.c parse-gram.h) ..."
321 (cd src && make parse-gram.c parse-gram.h) || exit
322
323 echo "$0: make distclean ..."
324 make distclean || exit;;
325esac
326
327echo "$0: done. Now you can run './configure'."