3 # Wrapper around a non installed bison to make it work as an installed one.
5 # Copyright (C) 2001-2012 Free Software Foundation, Inc.
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 3 of the License, or
10 # (at your option) any later version.
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.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 abs_top_srcdir='@abs_top_srcdir@'
21 abs_top_builddir='@abs_top_builddir@'
25 # Use the shipped files, not those installed.
26 BISON_PKGDATADIR=$abs_top_srcdir/data
27 export BISON_PKGDATADIR
29 trap 'rm -f /tmp/bison.$$.*; exit $status' 0 1 2 13 15
30 $PREBISON "$abs_top_builddir/src/bison" ${1+"$@"} 2>/tmp/bison.$$.err
32 # Protect from gettextized quotes. See quotearg.c's gettext_quote for
33 # the UTF-8 sequences. For context, see
34 # http://lists.gnu.org/archive/html/bug-bison/2012-01/msg00120.html
36 # In UTF-8 the quoting quote are not ', so bison use them to quote the
37 # ' character. When using ASCII quotes, bison issues "'".
39 -e "s{\\xe2\\x80\\x98|\\xe2\\x80\\x99|\\xa1\\ae|\\xa1\\xaf}{'}g;" \
40 -e "s{'''}{\"'\"}g;" \
43 # As a special dark magic, if we are actually using this wrapper to
44 # compile Bison's src/parse-gram.y, post-process the synclines to
45 # avoid dependencies on the user's set up (srcdir vs. builddir).
50 if $PERL --version >/dev/null; then
51 # We are called by ylwrap which still uses y.tab.*, and
52 # post-processes the synclines on y.tab.c itself. Don't let it
53 # do it. Besides, it leaves "parse-gram.y" as the source,
54 # dropping the src/ part.
55 $PERL -pi -e 's{"y\.tab\.}{"src/parse-gram.}g;' \
56 -e 's{".*/(parse-gram\.y)"}{"src/$1"}g;' \