aboutsummaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-07 17:24:18 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-05-07 18:55:38 +0300
commit4b0e477181f51c12f62236ec91f4bb714125393d (patch)
tree9ddb2c5c16549ce5bf6056e45aef3646402accbc /build-aux
parentcede19f7c5a151c1aeb7c93d1793183bca8e8289 (diff)
downloadgrecs-4b0e477181f51c12f62236ec91f4bb714125393d.tar.gz
grecs-4b0e477181f51c12f62236ec91f4bb714125393d.tar.bz2
Support standalone compilation.
* AUTHORS, COPYING, NEWS, README: New files. * .gitignore: Update. * am/.gitignore: New file. * build-aux/.gitignore: New file. * build-aux/ylwrap: Remove. * Makefile.am: Define ACLOCAL_AMFLAGS [GRECS_CHANGELOG]: Build ChangeLog. * am/grecs.m4: Define GRECS_CHANGELOG and GRECS_SRCDIR. Fixup first argument, if it is [.]. * configure.ac: New file. * src/Make-inst.am (include_HEADERS): Add wordsplit.h. Install libgrecs.m4. * Make-shared.am (noinst_HEADERS): Add wordsplit.h. * src/Make-static.am: Likewise. * src/Make.am (GRECS_SRC): Remove wordsplit.h (noinst_HEADERS): Add yygrecs.h (YLWRAP): Remove. * src/libgrecs.m4: New file. * src/yygrecs.h: New file. * src/grecs-gram.y: Include yygrecs.h. * src/grecs-lex.l: Likewise. * src/preproc.c (yy_grecs_flex_debug): Rename to grecs_yy_flex_debug.
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/.gitignore6
-rwxr-xr-xbuild-aux/ylwrap234
2 files changed, 6 insertions, 234 deletions
diff --git a/build-aux/.gitignore b/build-aux/.gitignore
new file mode 100644
index 0000000..ce7170e
--- /dev/null
+++ b/build-aux/.gitignore
@@ -0,0 +1,6 @@
1config.*
2depcomp
3install-sh
4lt*
5missing
6ylwrap
diff --git a/build-aux/ylwrap b/build-aux/ylwrap
deleted file mode 100755
index 6546d66..0000000
--- a/build-aux/ylwrap
+++ /dev/null
@@ -1,234 +0,0 @@
1#! /bin/sh
2# ylwrap - wrapper for lex/yacc invocations.
3
4scriptversion=2007-11-22.22
5
6# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
7# 2007,2009 Free Software Foundation, Inc.
8#
9# Written by Tom Tromey <tromey@cygnus.com>.
10# The --prefix option added by Sergey Poznyakoff <gray@gnu.org>.
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2, or (at your option)
15# any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25# 02110-1301, USA.
26
27# As a special exception to the GNU General Public License, if you
28# distribute this file as part of a program that contains a
29# configuration script generated by Autoconf, you may include it under
30# the same distribution terms that you use for the rest of that program.
31
32# This file is maintained in Automake, please report
33# bugs to <bug-automake@gnu.org> or send patches to
34# <automake-patches@gnu.org>.
35
36case "$1" in
37 '')
38 echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
39 exit 1
40 ;;
41 --basedir)
42 basedir=$2
43 shift 2
44 ;;
45 --p|--pr|--pre|--pref|--prefi|--prefix)
46 YYREPL="s/yy/$2/g"
47 shift 2
48 ;;
49 -h|--h*)
50 cat <<\EOF
51Usage: ylwrap [OPTIONS] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
52
53Wrapper for lex/yacc invocations, renaming files as desired.
54
55 INPUT is the input file
56 OUTPUT is one file PROG generates
57 DESIRED is the file we actually want instead of OUTPUT
58 PROGRAM is program to run
59 ARGS are passed to PROG
60
61Any number of OUTPUT,DESIRED pairs may be used.
62
63OPTIONS are
64 -p, --prefix PREFIX Replace `yy' in identifiers with PREFIX
65 --help Display this help message and exit
66 --version Display program version and exit
67
68Report bugs to <bug-automake@gnu.org>.
69EOF
70 exit $?
71 ;;
72 -v|--v*)
73 echo "ylwrap $scriptversion"
74 exit $?
75 ;;
76esac
77
78
79# The input.
80input="$1"
81shift
82case "$input" in
83 [\\/]* | ?:[\\/]*)
84 # Absolute path; do nothing.
85 ;;
86 *)
87 # Relative path. Make it absolute.
88 input="`pwd`/$input"
89 ;;
90esac
91
92pairlist=
93while test "$#" -ne 0; do
94 if test "$1" = "--"; then
95 shift
96 break
97 fi
98 pairlist="$pairlist $1"
99 shift
100done
101
102# The program to run.
103prog="$1"
104shift
105# Make any relative path in $prog absolute.
106case "$prog" in
107 [\\/]* | ?:[\\/]*) ;;
108 *[\\/]*) prog="`pwd`/$prog" ;;
109esac
110
111# FIXME: add hostname here for parallel makes that run commands on
112# other machines. But that might take us over the 14-char limit.
113dirname=ylwrap$$
114trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
115mkdir $dirname || exit 1
116
117cd $dirname
118
119case $# in
120 0) "$prog" "$input" ;;
121 *) "$prog" "$@" "$input" ;;
122esac
123ret=$?
124
125if test $ret -eq 0; then
126 set X $pairlist
127 shift
128 first=yes
129 # Since DOS filename conventions don't allow two dots,
130 # the DOS version of Bison writes out y_tab.c instead of y.tab.c
131 # and y_tab.h instead of y.tab.h. Test to see if this is the case.
132 y_tab_nodot="no"
133 if test -f y_tab.c || test -f y_tab.h; then
134 y_tab_nodot="yes"
135 fi
136
137 # The directory holding the input.
138 input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
139 # Quote $INPUT_DIR so we can use it in a regexp.
140 # FIXME: really we should care about more than `.' and `\'.
141 input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
142
143 while test "$#" -ne 0; do
144 from="$1"
145 # Handle y_tab.c and y_tab.h output by DOS
146 if test $y_tab_nodot = "yes"; then
147 if test $from = "y.tab.c"; then
148 from="y_tab.c"
149 else
150 if test $from = "y.tab.h"; then
151 from="y_tab.h"
152 fi
153 fi
154 fi
155 if test -f "$from"; then
156 # If $2 is an absolute path name, then just use that,
157 # otherwise prepend `../'.
158 case "$2" in
159 [\\/]* | ?:[\\/]*) target="$2";;
160 *) target="../$2";;
161 esac
162
163 # We do not want to overwrite a header file if it hasn't
164 # changed. This avoid useless recompilations. However the
165 # parser itself (the first file) should always be updated,
166 # because it is the destination of the .y.c rule in the
167 # Makefile. Divert the output of all other files to a temporary
168 # file so we can compare them to existing versions.
169 if test $first = no; then
170 realtarget="$target"
171 target="tmp-`echo $target | sed s/.*[\\/]//g`"
172 fi
173 # Edit out `#line' or `#' directives.
174 #
175 # We don't want the resulting debug information to point at
176 # an absolute srcdir; it is better for it to just mention the
177 # .y file with no path.
178 #
179 # We want to use the real output file name, not yy.lex.c for
180 # instance.
181 #
182 # We want the include guards to be adjusted too.
183 FROM=`echo "$from" | sed \
184 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
185 -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
186 TARGET=`echo "$2" | sed \
187 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
188 -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
189
190 sed -e "$YYREPL" \
191 -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
192 -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
193
194 # Check whether header files must be updated.
195 if test $first = no; then
196 if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
197 echo "$2" is unchanged
198 rm -f "$target"
199 else
200 echo updating "$2"
201 mv -f "$target" "$realtarget"
202 fi
203 fi
204 else
205 # A missing file is only an error for the first file. This
206 # is a blatant hack to let us support using "yacc -d". If -d
207 # is not specified, we don't want an error when the header
208 # file is "missing".
209 if test $first = yes; then
210 ret=1
211 fi
212 fi
213 shift
214 shift
215 first=no
216 done
217else
218 ret=$?
219fi
220
221# Remove the directory.
222cd ..
223rm -rf $dirname
224
225exit $ret
226
227# Local Variables:
228# mode: shell-script
229# sh-indentation: 2
230# eval: (add-hook 'write-file-hooks 'time-stamp)