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