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