| 1 | #! @SHELL@ |
| 2 | # @configure_input@ |
| 3 | # Wrapper around a non installed bison to make it work as an installed one. |
| 4 | |
| 5 | # Copyright (C) 2001-2013 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 3 of the License, or |
| 10 | # (at your option) 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, see <http://www.gnu.org/licenses/>. |
| 19 | |
| 20 | abs_top_srcdir='@abs_top_srcdir@' |
| 21 | abs_top_builddir='@abs_top_builddir@' |
| 22 | : ${PERL='@PERL@'} |
| 23 | |
| 24 | # Use the shipped files, not those installed. |
| 25 | BISON_PKGDATADIR=$abs_top_srcdir/data |
| 26 | export BISON_PKGDATADIR |
| 27 | |
| 28 | $PREBISON "$abs_top_builddir/src/bison" ${1+"$@"} |
| 29 | status=$? |
| 30 | |
| 31 | # As a special dark magic, if we are actually using this wrapper to |
| 32 | # compile Bison's src/parse-gram.y, post-process the synclines to |
| 33 | # avoid dependencies on the user's set up (srcdir vs. builddir). |
| 34 | for i |
| 35 | do |
| 36 | case $i in |
| 37 | */src/parse-gram.y) |
| 38 | if $PERL --version >/dev/null; then |
| 39 | # We are called by ylwrap which (if it's an old version) still |
| 40 | # uses y.tab.*, and post-processes the synclines on y.tab.c |
| 41 | # itself. Don't let it do it. Besides, it leaves |
| 42 | # "parse-gram.y" as the source, dropping the src/ part. |
| 43 | $PERL -pi -e 's{"y\.tab\.}{"parse-gram.}g;' \ |
| 44 | -e 's{"(?:.*/)?(parse-gram\.[chy])"}{"src/$1"}g;' \ |
| 45 | -e 's{GRAM_Y_TAB_H}{GRAM_SRC_PARSE_GRAM_H}g;' \ |
| 46 | y.tab.[ch] |
| 47 | fi |
| 48 | ;; |
| 49 | esac |
| 50 | done |
| 51 | |
| 52 | exit $status |
| 53 | |
| 54 | # Local Variables: |
| 55 | # mode: shell-script |
| 56 | # End: |