]> git.saurik.com Git - bison.git/blob - djgpp/config.bat
* djgpp/config.sed: Fixes required to run configure scripts generated by autoconf...
[bison.git] / djgpp / config.bat
1 @echo off
2 Rem Configure Bison for DJGPP.
3
4 Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
5 Rem format, or else stock DOS/Windows shells will refuse to run it.
6
7 Rem Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
8
9 Rem This program is free software: you can redistribute it and/or modify
10 Rem it under the terms of the GNU General Public License as published by
11 Rem the Free Software Foundation, either version 3 of the License, or
12 Rem (at your option) any later version.
13 Rem
14 Rem This program is distributed in the hope that it will be useful,
15 Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
16 Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 Rem GNU General Public License for more details.
18 Rem
19 Rem You should have received a copy of the GNU General Public License
20 Rem along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22 echo Configuring Bison for DJGPP v2.x...
23
24 Rem The SmallEnv tests protect against fixed and too small size
25 Rem of the environment in stock DOS shell.
26
27 Rem Find out if NLS is wanted or not,
28 Rem if dependency-tracking is wanted or not,
29 Rem if caching is wanted or not
30 Rem and where the sources are.
31 Rem We always default to NLS support,
32 Rem no dependency tracking
33 Rem and to in place configuration.
34 set ARGS=
35 set NLS=enabled
36 if not "%NLS%" == "enabled" goto SmallEnv
37 set CACHING=enabled
38 if not "%CACHING%" == "enabled" goto SmallEnv
39 set DEPENDENCY_TRACKING=disabled
40 if not "%DEPENDENCY_TRACKING%" == "disabled" goto SmallEnv
41 set LIBICONV_PREFIX=disabled
42 if not "%LIBICONV_PREFIX%" == "disabled" goto SmallEnv
43 set LIBINTL_PREFIX=disabled
44 if not "%LIBINTL_PREFIX%" == "disabled" goto SmallEnv
45 set HTML=enabled
46 if not "%HTML%" == "enabled" goto SmallEnv
47 set XSRC=.
48 if not "%XSRC%" == "." goto SmallEnv
49
50 Rem Loop over all arguments.
51 Rem Special arguments are: NLS, XSRC, CACHE, STATIC_LIBS, LIBICONV_PREFIX, LIBINTL_PREFIX and DEPS.
52 Rem All other arguments are stored into ARGS.
53 :ArgLoop
54 if "%1" == "nls" goto NextArgument
55 if "%1" == "NLS" goto NextArgument
56 if "%1" == "no-nls" goto NoNLS
57 if "%1" == "no-NLS" goto NoNLS
58 if "%1" == "NO-NLS" goto NoNLS
59 goto CachingOption
60 :NoNLS
61 if "%1" == "no-nls" set NLS=disabled
62 if "%1" == "no-NLS" set NLS=disabled
63 if "%1" == "NO-NLS" set NLS=disabled
64 if not "%NLS%" == "disabled" goto SmallEnv
65 goto NextArgument
66 :CachingOption
67 if "%1" == "cache" goto NextArgument
68 if "%1" == "CACHE" goto NextArgument
69 if "%1" == "no-cache" goto NoCaching
70 if "%1" == "no-CACHE" goto NoCaching
71 if "%1" == "NO-CACHE" goto NoCaching
72 goto DependencyOption
73 :NoCaching
74 if "%1" == "no-cache" set CACHING=disabled
75 if "%1" == "no-CACHE" set CACHING=disabled
76 if "%1" == "NO-CACHE" set CACHING=disabled
77 if not "%CACHING%" == "disabled" goto SmallEnv
78 goto NextArgument
79 :DependencyOption
80 if "%1" == "no-dep" goto NextArgument
81 if "%1" == "no-DEP" goto NextArgument
82 if "%1" == "NO-DEP" goto NextArgument
83 if "%1" == "dep" goto DependecyTraking
84 if "%1" == "DEP" goto DependecyTraking
85 goto LibiconvPrefixOption
86 :DependecyTraking
87 if "%1" == "dep" set DEPENDENCY_TRACKING=enabled
88 if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled
89 if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
90 goto NextArgument
91 :LibiconvPrefixOption
92 if "%1" == "no-libiconvprefix" goto NextArgument
93 if "%1" == "no-LIBICONVPREFIX" goto NextArgument
94 if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
95 if "%1" == "libiconvprefix" goto WithLibiconvPrefix
96 if "%1" == "LIBICONVPREFIX" goto WithLibiconvPrefix
97 goto LibintlPrefixOption
98 :WithLibiconvPrefix
99 if "%1" == "libiconvprefix" set LIBICONV_PREFIX=enabled
100 if "%1" == "LIBICONVPREFIX" set LIBICONV_PREFIX=enabled
101 if not "%LIBICONV_PREFIX%" == "enabled" goto SmallEnv
102 goto NextArgument
103 :LibintlPrefixOption
104 if "%1" == "no-libiconvprefix" goto NextArgument
105 if "%1" == "no-LIBICONVPREFIX" goto NextArgument
106 if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
107 if "%1" == "libintlprefix" goto _WithLibintlPrefix
108 if "%1" == "LIBINTLPREFIX" goto _WithLibintlPrefix
109 goto HTMLOption
110 :_WithLibintlPrefix
111 if "%1" == "libintlprefix" set LIBINTL_PREFIX=enabled
112 if "%1" == "LIBINTLPREFIX" set LIBINTL_PREFIX=enabled
113 if not "%LIBINTL_PREFIX%" == "enabled" goto SmallEnv
114 :HTMLOption
115 if "%1" == "withhtml" goto NextArgument
116 if "%1" == "withHTML" goto NextArgument
117 if "%1" == "WITHHTML" goto NextArgument
118 if "%1" == "withouthtml" goto _WithoutHTML
119 if "%1" == "withoutHTML" goto _WithoutHTML
120 if "%1" == "WITHOUTHTML" goto _WithoutHTML
121 goto SrcDirOption
122 :_WithoutHTML
123 if "%1" == "withouthtml" set HTML=disabled
124 if "%1" == "withoutHTML" set HTML=disabled
125 if "%1" == "WITHOUTHTML" set HTML=disabled
126 if not "%HTML%" == "disabled" goto SmallEnv
127 goto NextArgument
128 :SrcDirOption
129 echo %1 | grep -q "/"
130 if errorlevel 1 goto CollectArgument
131 set XSRC=%1
132 if not "%XSRC%" == "%1" goto SmallEnv
133 goto NextArgument
134 :CollectArgument
135 set _ARGS=%ARGS% %1
136 if not "%_ARGS%" == "%ARGS% %1" if not "%_ARGS%" == "%ARGS%%1" goto SmallEnv
137 echo %_ARGS% | grep -q "[^ ]"
138 if not errorlevel 0 set ARGS=%_ARGS%
139 set _ARGS=
140 :NextArgument
141 shift
142 if not "%1" == "" goto ArgLoop
143
144 Rem Create an arguments file for the configure script.
145 echo --srcdir=%XSRC% > args
146 if "%CACHING%" == "enabled" echo --cache-file=%XSRC%/djgpp/config.cache >> args
147 if "%DEPENDENCY_TRACKING%" == "enabled" echo --enable-dependency-tracking >> args
148 if "%DEPENDENCY_TRACKING%" == "disabled" echo --disable-dependency-tracking >> args
149 if "%LIBICONV_PREFIX%" == "enabled" echo --with-libiconv-prefix >> args
150 if "%LIBICONV_PREFIX%" == "disabled" echo --without-libiconv-prefix >> args
151 if "%LIBINTL_PREFIX%" == "enabled" echo --with-libintl-prefix >> args
152 if "%LIBINTL_PREFIX%" == "disabled" echo --without-libintl-prefix >> args
153 if "%HTML%" == "enabled" echo --enable-html >> args
154 if "%HTML%" == "disabled" echo --disable-html >> args
155 if not "%ARGS%" == "" echo %ARGS% >> args
156 set ARGS=
157 set CACHING=
158 set DEPENDENCY_TRACKING=
159 set LIBICONV_PREFIX=
160 set LIBINTL_PREFIX=
161 set HTML=
162
163 if "%XSRC%" == "." goto InPlace
164
165 :NotInPlace
166 redir -e /dev/null update %XSRC%/configure.org ./configure
167 test -f ./configure
168 if errorlevel 1 update %XSRC%/configure ./configure
169
170 :InPlace
171 Rem Update configuration files
172 echo Updating configuration scripts...
173 test -f ./configure.org
174 if errorlevel 1 update configure configure.org
175 sed -f %XSRC%/djgpp/config.sed configure.org > configure
176 if errorlevel 1 goto SedError
177
178 Rem Make sure they have a config.site file
179 set CONFIG_SITE=%XSRC%/djgpp/config.site
180 if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv
181
182 Rem inttypes_.h and inttypes.h map to the same 8.3 alias.
183 test -f %XSRC%/lib/inttypes_.h
184 if not errorlevel 1 mv -f %XSRC%/lib/inttypes_.h %XSRC%/lib/_inttypes.h
185
186 Rem Make sure crucial file names are not munged by unpacking
187 test -f %XSRC%/po/Makefile.in.in
188 if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in
189 test -f %XSRC%/po/Makefile.in-in
190 if errorlevel 1 mv -f %XSRC%/po/Makefile.in %XSRC%/po/Makefile.in-in
191 test -f %XSRC%/po/Makefile.in-in
192 if errorlevel 1 mv -f %XSRC%/po/Makefile.inin %XSRC%/po/Makefile.in-in
193 test -f %XSRC%/po/Makefile.in-in
194 if errorlevel 1 mv -f %XSRC%/po/Makefile.in_in %XSRC%/po/Makefile.in-in
195 test -f %XSRC%/po/Makefile.in-in
196 if errorlevel 1 mv -f %XSRC%/po/Makefile_in.in %XSRC%/po/Makefile.in-in
197 test -f %XSRC%/runtime-po/Makefile.in.in
198 if not errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in.in %XSRC%/runtime-po/Makefile.in-in
199 test -f %XSRC%/runtime-po/Makefile.in-in
200 if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in %XSRC%/runtime-po/Makefile.in-in
201 test -f %XSRC%/runtime-po/Makefile.in-in
202 if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.inin %XSRC%/runtime-po/Makefile.in-in
203 test -f %XSRC%/runtime-po/Makefile.in-in
204 if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in_in %XSRC%/runtime-po/Makefile.in-in
205 test -f %XSRC%/runtime-po/Makefile.in-in
206 if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile_in.in %XSRC%/runtime-po/Makefile.in-in
207 test -f %XSRC%/data/c++.m4
208 if not errorlevel 1 mv -f %XSRC%/data/c++.m4 %XSRC%/data/cxx.m4
209 test -f %XSRC%/data/cxx.m4
210 if errorlevel 1 mv -f %XSRC%/data/cpp.m4 %XSRC%/data/cxx.m4
211 test -f %XSRC%/data/c++-skel.m4
212 if not errorlevel 1 mv -f %XSRC%/data/c++-skel.m4 %XSRC%/data/cxx-skel.m4
213 test -f %XSRC%/data/cxx-skel.m4
214 if errorlevel 1 mv -f %XSRC%/data/cpp-skel.m4 %XSRC%/data/cxx-skel.m4
215 test -f %XSRC%/build-aux/javacomp.sh.in
216 if not errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh.in %XSRC%/build-aux/javacomp.sh-in
217 test -f %XSRC%/build-aux/javacomp.sh-in
218 if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh %XSRC%/build-aux/javacomp.sh-in
219 test -f %XSRC%/build-aux/javacomp.sh-in
220 if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.shin %XSRC%/build-aux/javacomp.sh-in
221 test -f %XSRC%/build-aux/javacomp.sh-in
222 if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh_in %XSRC%/build-aux/javacomp.sh-in
223 test -f %XSRC%/build-aux/javacomp.sh-in
224 if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh.in %XSRC%/build-aux/javacomp.sh-in
225 test -f %XSRC%/build-aux/javaexec.sh.in
226 if not errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh.in %XSRC%/build-aux/javaexec.sh-in
227 test -f %XSRC%/build-aux/javaexec.sh-in
228 if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh %XSRC%/build-aux/javaexec.sh-in
229 test -f %XSRC%/build-aux/javaexec.sh-in
230 if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.shin %XSRC%/build-aux/javaexec.sh-in
231 test -f %XSRC%/build-aux/javaexec.sh-in
232 if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh_in %XSRC%/build-aux/javaexec.sh-in
233 test -f %XSRC%/build-aux/javaexec.sh-in
234 if errorlevel 1 mv -f %XSRC%/build-aux/javaexec_sh.in %XSRC%/build-aux/javaexec.sh-in
235 test -f %XSRC%/doc/yacc.1.in
236 if not errorlevel 1 mv -f %XSRC%/doc/yacc.1.in %XSRC%/doc/yacc.1-in
237 test -f %XSRC%/doc/yacc.1-in
238 if errorlevel 1 mv -f %XSRC%/doc/yacc.1 %XSRC%/doc/yacc.1-in
239 test -f %XSRC%/doc/yacc.1-in
240 if errorlevel 1 mv -f %XSRC%/doc/yacc.1in %XSRC%/doc/yacc.1-in
241 test -f %XSRC%/doc/yacc.1-in
242 if errorlevel 1 mv -f %XSRC%/doc/yacc.1_in %XSRC%/doc/yacc.1-in
243 test -f %XSRC%/doc/yacc.1-in
244 if errorlevel 1 mv -f %XSRC%/doc/yacc_1.in %XSRC%/doc/yacc.1-in
245 test -f %XSRC%/etc/bench.pl.in
246 if not errorlevel 1 mv -f %XSRC%/etc/bench.pl.in %XSRC%/etc/bench.pl-in
247 test -f %XSRC%/etc/bench.pl-in
248 if errorlevel 1 mv -f %XSRC%/etc/bench.pl %XSRC%/etc/bench.pl-in
249 test -f %XSRC%/etc/bench.pl-in
250 if errorlevel 1 mv -f %XSRC%/etc/bench.plin %XSRC%/etc/bench.pl-in
251 test -f %XSRC%/etc/bench.pl-in
252 if errorlevel 1 mv -f %XSRC%/etc/bench.pl_in %XSRC%/etc/bench.pl-in
253 test -f %XSRC%/etc/bench.pl-in
254 if errorlevel 1 mv -f %XSRC%/etc/bench_pl.in %XSRC%/etc/bench.pl-in
255
256 :scan_gram_c_Test
257 test -f %XSRC%/src/c-scan-gram.c
258 if not errorlevel 1 goto scan_skel_c_Test
259 test -f %XSRC%/src/scan-gram-c.c
260 if not errorlevel 1 mv -f %XSRC%/src/scan-gram-c.c %XSRC%/src/c-scan-gram.c
261 :scan_skel_c_Test
262 test -f %XSRC%/src/c-scan-skel.c
263 if not errorlevel 1 goto FixFiles
264 test -f %XSRC%/src/scan-skel-c.c
265 if not errorlevel 1 mv -f %XSRC%/src/scan-skel-c.c %XSRC%/src/c-scan-skel.c
266
267 :FixFiles
268 Rem Fix data/lalr1.cc and data/location.cc to reflect the renaming of c++.m4
269 sed "s/c++\.m4/cxx.m4/" %XSRC%/data/lalr1.cc > lalr1.cc
270 if errorlevel 1 goto lalr1_ccFileError
271 mv ./lalr1.cc %XSRC%/data/lalr1.cc
272 sed "s/c++\.m4/cxx.m4/" %XSRC%/data/location.cc > location.cc
273 if errorlevel 1 goto location_ccFileError
274 mv ./location.cc %XSRC%/data/location.cc
275 sed "s/c++\.m4/cxx.m4/" %XSRC%/data/glr.cc > glr.cc
276 if errorlevel 1 goto glr_ccFileError
277 mv ./glr.cc %XSRC%/data/glr.cc
278
279 Rem Fix src/getargs.c to reflect the renaming of c++-skel.m4
280 sed "s/c++-skel\.m4/cxx-skel.m4/" %XSRC%/src/getargs.c > getargs.c
281 if errorlevel 1 goto getargs_cFileError
282 mv ./getargs.c %XSRC%/src/getargs.c
283
284 Rem Define DJGPP specific defs in config.hin
285 echo Editing config.hin...
286 test -f %XSRC%/lib/config_h.org
287 if errorlevel 1 update %XSRC%/lib/config.hin %XSRC%/lib/config_h.org
288 sed -f %XSRC%/djgpp/config_h.sed %XSRC%/lib/config_h.org > config.hin
289 if errorlevel 1 goto SedError2
290 mv -f config.hin %XSRC%/lib/config.hin
291
292
293 Rem Fixing ilicit testsuite file name.
294 test -f %XSRC%/tests/c++.at
295 if not errorlevel 1 mv -f %XSRC%/tests/c++.at %XSRC%/tests/cxx.at
296
297 test -f %XSRC%/tests/testsuite.org
298 if errorlevel 1 update %XSRC%/tests/testsuite %XSRC%/tests/testsuite.org
299 sed -f %XSRC%/djgpp/testsuite.sed %XSRC%/tests/testsuite.org > testsuite.tmp
300 if errorlevel 1 goto SedError3
301 mv -f ./testsuite.tmp %XSRC%/tests/testsuite
302
303 Rem Fixing ilicit calc++ file names in the calc++ directory.
304 test -d %XSRC%/examples/calc++
305 if not errorlevel 1 mv -f %XSRC%/examples/calc++ %XSRC%/examples/calcxx
306 test -d %XSRC%/examples/calcxx
307 if errorlevel 1 mv -f %XSRC%/examples/calcpp %XSRC%/examples/calcxx
308 test -f %XSRC%/examples/calcxx/calc++-scanner.cc
309 if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
310 test -f %XSRC%/examples/calcxx/calcxx-scanner.cc
311 if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
312 test -f %XSRC%/examples/calcxx/calc++-scanner.ll
313 if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
314 test -f %XSRC%/examples/calcxx/calcxx-scanner.ll
315 if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
316 test -f %XSRC%/examples/calcxx/calc++-driver.cc
317 if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
318 test -f %XSRC%/examples/calcxx/calcxx-driver.cc
319 if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
320 test -f %XSRC%/examples/calcxx/calc++-driver.hh
321 if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
322 test -f %XSRC%/examples/calcxx/calcxx-driver.hh
323 if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
324 test -f %XSRC%/examples/calcxx/calc++-parser.cc
325 if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
326 test -f %XSRC%/examples/calcxx/calcxx-parser.cc
327 if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
328 test -f %XSRC%/examples/calcxx/calc++-parser.hh
329 if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
330 test -f %XSRC%/examples/calcxx/calcxx-parser.hh
331 if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
332 test -f %XSRC%/examples/calcxx/calc++-parser.stamp
333 if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
334 test -f %XSRC%/examples/calcxx/calcxx-parser.stamp
335 if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
336 test -f %XSRC%/examples/calcxx/calc++-parser.yy
337 if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
338 test -f %XSRC%/examples/calcxx/calcxx-parser.yy
339 if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
340 test -f %XSRC%/examples/calcxx/calc++.cc
341 if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++.cc %XSRC%/examples/calcxx/calcxx.cc
342 test -f %XSRC%/examples/calcxx/calcxx.cc
343 if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp.cc %XSRC%/examples/calcxx/calcxx.cc
344
345 Rem Fixing #include lines in calcxx files.
346 sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx.cc > calcxx.cc
347 if errorlevel 1 goto calcxxFileError
348 mv ./calcxx.cc %XSRC%/examples/calcxx/calcxx.cc
349 sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.cc > calcxx-driver.cc
350 if errorlevel 1 goto calcxxFileError
351 mv ./calcxx-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
352 sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.hh > calcxx-driver.hh
353 if errorlevel 1 goto calcxxFileError
354 mv ./calcxx-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
355 sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.cc > calcxx-parser.cc
356 if errorlevel 1 goto calcxxFileError
357 mv ./calcxx-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
358 sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.hh > calcxx-parser.hh
359 if errorlevel 1 goto calcxxFileError
360 mv ./calcxx-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
361 :sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.yy > calcxx-parser.yy
362 :if errorlevel 1 goto calcxxFileError
363 :mv ./calcxx-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
364 sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.cc > calcxx-scanner.cc
365 if errorlevel 1 goto calcxxFileError
366 mv ./calcxx-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
367 :sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.ll > calcxx-scanner.ll
368 :if errorlevel 1 goto calcxxFileError
369 :mv ./calcxx-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
370 sed "s/calc++/calcxx/" %XSRC%/examples/calcxx/test > test
371 if errorlevel 1 goto calcxxFileError
372 mv ./test %XSRC%/examples/calcxx/test
373
374
375 Rem Fixing the scanner files to make file names 8.3 valid.
376 Rem Use only if you want to change the scan-gram.l and scan-skel.l files.
377 : sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-gram.l > scan-gram.l
378 : if errorlevel 1 goto ScannerFileError
379 : mv ./scan-gram.l %XSRC%/src/scan-gram.l
380 : sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-skel.l > scan-skel.l
381 : if errorlevel 1 goto ScannerFileError
382 : mv ./scan-skel.l %XSRC%/src/scan-skel.l
383
384
385 Rem This is required because DOS/Windows are case-insensitive
386 Rem to file names, and "make install" will do nothing if Make
387 Rem finds a file called `install'.
388 if exist INSTALL ren INSTALL INSTALL.txt
389
390 Rem Set SHELL to a sane default or some configure tests stop working
391 Rem if the package is configured across partitions.
392 if not "%SHELL%" == "" goto HomeName
393 set SHELL=/bin/sh
394 if not "%SHELL%" == "/bin/sh" goto SmallEnv
395 echo No SHELL found in the environment, using default value
396
397 :HomeName
398 Rem Set HOME to a sane default so configure stops complaining.
399 if not "%HOME%" == "" goto HostName
400 set HOME=%XSRC%/djgpp
401 if not "%HOME%" == "%XSRC%/djgpp" goto SmallEnv
402 echo No HOME found in the environment, using default value
403
404 :HostName
405 Rem Set HOSTNAME so it shows in config.status
406 if not "%HOSTNAME%" == "" goto hostdone
407 if "%windir%" == "" goto msdos
408 set OS=MS-Windows
409 if not "%OS%" == "MS-Windows" goto SmallEnv
410 goto haveos
411 :msdos
412 set OS=MS-DOS
413 if not "%OS%" == "MS-DOS" goto SmallEnv
414 :haveos
415 if not "%USERNAME%" == "" goto haveuname
416 if not "%USER%" == "" goto haveuser
417 echo No USERNAME and no USER found in the environment, using default values
418 set HOSTNAME=Unknown PC
419 if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
420 goto userdone
421 :haveuser
422 set HOSTNAME=%USER%'s PC
423 if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
424 goto userdone
425 :haveuname
426 set HOSTNAME=%USERNAME%'s PC
427 if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
428 :userdone
429 set _HOSTNAME=%HOSTNAME%, %OS%
430 if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
431 set HOSTNAME=%_HOSTNAME%
432 :hostdone
433 set _HOSTNAME=
434 set OS=
435
436 Rem install-sh is required by the configure script but clashes with the
437 Rem various Makefile install-foo targets, so we MUST have it before the
438 Rem script runs and rename it afterwards
439 test -f %XSRC%/install-sh
440 if not errorlevel 1 goto NoRen0
441 test -f %XSRC%/install-sh.sh
442 if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
443 :NoRen0
444
445 if "%NLS%" == "disabled" goto WithoutNLS
446
447 :WithNLS
448 Rem Check for the needed libraries and binaries.
449 test -x /dev/env/DJDIR/bin/msgfmt.exe
450 if errorlevel 1 goto MissingNLSTools
451 test -x /dev/env/DJDIR/bin/xgettext.exe
452 if errorlevel 1 goto MissingNLSTools
453 test -f /dev/env/DJDIR/include/libcharset.h
454 if errorlevel 1 goto MissingNLSTools
455 test -f /dev/env/DJDIR/lib/libcharset.a
456 if errorlevel 1 goto MissingNLSTools
457 test -f /dev/env/DJDIR/include/iconv.h
458 if errorlevel 1 goto MissingNLSTools
459 test -f /dev/env/DJDIR/lib/libiconv.a
460 if errorlevel 1 goto MissingNLSTools
461 test -f /dev/env/DJDIR/include/libintl.h
462 if errorlevel 1 goto MissingNLSTools
463 test -f /dev/env/DJDIR/lib/libintl.a
464 if errorlevel 1 goto MissingNLSTools
465
466 Rem Recreate the files in the %XSRC%/po subdir with our ported tools.
467 redir -e /dev/null rm %XSRC%/po/*.gmo
468 redir -e /dev/null rm %XSRC%/po/bison.pot
469 redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c
470 redir -e /dev/null rm %XSRC%/po/stamp-cat-id
471
472 Rem Update the arguments file for the configure script.
473 Rem We prefer without-included-gettext because libintl.a from gettext package
474 Rem is the only one that is garanteed to have been ported to DJGPP.
475 echo --enable-nls --without-included-gettext >> args
476 goto ConfigurePackage
477
478 :MissingNLSTools
479 echo Needed libs/tools for NLS not found. Configuring without NLS.
480 :WithoutNLS
481 Rem Update the arguments file for the configure script.
482 echo --disable-nls >> args
483
484 :ConfigurePackage
485 echo Running the ./configure script...
486 sh ./configure @args
487 if errorlevel 1 goto CfgError
488 rm args
489 echo Done.
490 goto End
491
492 :lalr1_ccFileError
493 echo ./data/lalr1.cc file editing failed!
494 goto End
495
496 :glr_ccFileError
497 echo ./data/glr.cc file editing failed!
498 goto End
499
500 :getargs_cFileError
501 echo ./src/getargs.c file editing failed!
502 goto End
503
504 :location_ccFileError
505 echo ./data/location.cc file editing failed!
506 goto End
507
508 :calcxxFileError
509 echo ./examples/calcxx file editing failed!
510 goto End
511
512 :ScannerFileError
513 echo ./scanner file editing failed!
514 goto End
515
516 :SedError
517 echo ./configure script editing failed!
518 goto End
519
520 :SedError2
521 echo ./lib/config.hin editing failed!
522 goto End
523
524 :SedError3
525 echo ./tests/testsuite editing failed!
526 goto End
527
528 :CfgError
529 echo ./configure script exited abnormally!
530 goto End
531
532 :SmallEnv
533 echo Your environment size is too small. Enlarge it and run me again.
534 echo Configuration NOT done!
535
536 :End
537 test -f %XSRC%/install-sh.sh
538 if not errorlevel 1 goto NoRen1
539 test -f %XSRC%/install-sh
540 if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh
541 :NoRen1
542 if "%SHELL%" == "/bin/sh" set SHELL=
543 if "%HOME%" == "%XSRC%/djgpp" set HOME=
544 set CONFIG_SITE=
545 set HOSTNAME=
546 set NLS=
547 set XSRC=