2 Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
3 Rem format, or else stock DOS/Windows shells will refuse to run it.
5 echo Configuring GNU Bison
for DJGPP v2.x...
7 Rem The SmallEnv tests protect against fixed and too small size
8 Rem of the environment in stock DOS shell.
10 Rem Find out if NLS is wanted or not,
11 Rem if dependency-tracking is wanted or not,
12 Rem if caching is wanted or not
13 Rem and where the sources are.
14 Rem We always default to NLS support,
15 Rem no dependency tracking
16 Rem and to in place configuration.
19 if not "%NLS%" == "enabled" goto SmallEnv
21 if not "%CACHING%" == "enabled" goto SmallEnv
22 set DEPENDENCY_TRACKING
=disabled
23 if not "%DEPENDENCY_TRACKING%" == "disabled" goto SmallEnv
24 set LIBICONV_PREFIX
=disabled
25 if not "%LIBICONV_PREFIX%" == "disabled" goto SmallEnv
26 set LIBINTL_PREFIX
=disabled
27 if not "%LIBINTL_PREFIX%" == "disabled" goto SmallEnv
29 if not "%HTML%" == "enabled" goto SmallEnv
31 if not "%XSRC%" == "." goto SmallEnv
33 Rem Loop over all arguments.
34 Rem Special arguments are: NLS, XSRC, CACHE, STATIC_LIBS, LIBICONV_PREFIX, LIBINTL_PREFIX and DEPS.
35 Rem All other arguments are stored into ARGS.
37 if "%1" == "nls" goto NextArgument
38 if "%1" == "NLS" goto NextArgument
39 if "%1" == "no-nls" goto NoNLS
40 if "%1" == "no-NLS" goto NoNLS
41 if "%1" == "NO-NLS" goto NoNLS
44 if "%1" == "no-nls" set NLS
=disabled
45 if "%1" == "no-NLS" set NLS
=disabled
46 if "%1" == "NO-NLS" set NLS
=disabled
47 if not "%NLS%" == "disabled" goto SmallEnv
50 if "%1" == "cache" goto NextArgument
51 if "%1" == "CACHE" goto NextArgument
52 if "%1" == "no-cache" goto NoCaching
53 if "%1" == "no-CACHE" goto NoCaching
54 if "%1" == "NO-CACHE" goto NoCaching
57 if "%1" == "no-cache" set CACHING
=disabled
58 if "%1" == "no-CACHE" set CACHING
=disabled
59 if "%1" == "NO-CACHE" set CACHING
=disabled
60 if not "%CACHING%" == "disabled" goto SmallEnv
63 if "%1" == "no-dep" goto NextArgument
64 if "%1" == "no-DEP" goto NextArgument
65 if "%1" == "NO-DEP" goto NextArgument
66 if "%1" == "dep" goto DependecyTraking
67 if "%1" == "DEP" goto DependecyTraking
68 goto LibiconvPrefixOption
70 if "%1" == "dep" set DEPENDENCY_TRACKING
=enabled
71 if "%1" == "DEP" set DEPENDENCY_TRACKING
=enabled
72 if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
75 if "%1" == "no-libiconvprefix" goto NextArgument
76 if "%1" == "no-LIBICONVPREFIX" goto NextArgument
77 if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
78 if "%1" == "libiconvprefix" goto WithLibiconvPrefix
79 if "%1" == "LIBICONVPREFIX" goto WithLibiconvPrefix
80 goto LibintlPrefixOption
82 if "%1" == "libiconvprefix" set LIBICONV_PREFIX
=enabled
83 if "%1" == "LIBICONVPREFIX" set LIBICONV_PREFIX
=enabled
84 if not "%LIBICONV_PREFIX%" == "enabled" goto SmallEnv
87 if "%1" == "no-libiconvprefix" goto NextArgument
88 if "%1" == "no-LIBICONVPREFIX" goto NextArgument
89 if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
90 if "%1" == "libintlprefix" goto _WithLibintlPrefix
91 if "%1" == "LIBINTLPREFIX" goto _WithLibintlPrefix
94 if "%1" == "libintlprefix" set LIBINTL_PREFIX
=enabled
95 if "%1" == "LIBINTLPREFIX" set LIBINTL_PREFIX
=enabled
96 if not "%LIBINTL_PREFIX%" == "enabled" goto SmallEnv
98 if "%1" == "withhtml" goto NextArgument
99 if "%1" == "withHTML" goto NextArgument
100 if "%1" == "WITHHTML" goto NextArgument
101 if "%1" == "withouthtml" goto _WithoutHTML
102 if "%1" == "withoutHTML" goto _WithoutHTML
103 if "%1" == "WITHOUTHTML" goto _WithoutHTML
106 if "%1" == "withouthtml" set HTML
=disabled
107 if "%1" == "withoutHTML" set HTML
=disabled
108 if "%1" == "WITHOUTHTML" set HTML
=disabled
109 if not "%HTML%" == "disabled" goto SmallEnv
112 echo %1 | grep
-q
"/"
113 if errorlevel 1 goto CollectArgument
115 if not "%XSRC%" == "%1" goto SmallEnv
119 if not "%_ARGS%" == "%ARGS% %1" if not "%_ARGS%" == "%ARGS%%1" goto SmallEnv
120 echo %_ARGS% | grep
-q
"[^ ]"
121 if not errorlevel 0 set ARGS
=%_ARGS%
125 if not "%1" == "" goto ArgLoop
127 Rem Create an arguments file for the configure script.
128 echo --srcdir
=%XSRC% > arguments
129 if "%CACHING%" == "enabled" echo --cache-file
=%XSRC%/djgpp
/config.
cache >> arguments
130 if "%DEPENDENCY_TRACKING%" == "enabled" echo --enable
-dependency
-tracking
>> arguments
131 if "%DEPENDENCY_TRACKING%" == "disabled" echo --disable
-dependency
-tracking
>> arguments
132 if "%LIBICONV_PREFIX%" == "enabled" echo --with
-libiconv
-prefix
>> arguments
133 if "%LIBICONV_PREFIX%" == "disabled" echo --without
-libiconv
-prefix
>> arguments
134 if "%LIBINTL_PREFIX%" == "enabled" echo --with
-libintl
-prefix
>> arguments
135 if "%LIBINTL_PREFIX%" == "disabled" echo --without
-libintl
-prefix
>> arguments
136 if "%HTML%" == "enabled" echo --enable
-html
>> arguments
137 if "%HTML%" == "disabled" echo --disable
-html
>> arguments
138 if not "%ARGS%" == "" echo %ARGS% >> arguments
141 set DEPENDENCY_TRACKING
=
143 if "%XSRC%" == "." goto InPlace
146 redir
-e
/dev
/null update
%XSRC%/configure.orig .
/configure
148 if errorlevel 1 update
%XSRC%/configure .
/configure
151 Rem Update configuration files
152 echo Updating configuration scripts...
153 test
-f .
/configure.orig
154 if errorlevel 1 update configure configure.orig
155 sed
-f
%XSRC%/djgpp
/config.sed configure.orig
> configure
156 if errorlevel 1 goto SedError
158 Rem Make sure they have a config.site file
159 set CONFIG_SITE
=%XSRC%/djgpp
/config.site
160 if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv
162 Rem Make sure crucial file names are not munged by unpacking
163 test
-f
%XSRC%/po
/Makefile.in.in
164 if not errorlevel 1 mv
-f
%XSRC%/po
/Makefile.in.in
%XSRC%/po
/Makefile.in
-in
165 test
-f
%XSRC%/po
/Makefile.in
-in
166 if errorlevel 1 mv
-f
%XSRC%/po
/Makefile.in
%XSRC%/po
/Makefile.in
-in
167 test
-f
%XSRC%/runtime
-po
/Makefile.in.in
168 if not errorlevel 1 mv
-f
%XSRC%/runtime
-po
/Makefile.in.in
%XSRC%/runtime
-po
/Makefile.in
-in
169 test
-f
%XSRC%/runtime
-po
/Makefile.in
-in
170 if errorlevel 1 mv
-f
%XSRC%/runtime
-po
/Makefile.in
%XSRC%/runtime
-po
/Makefile.in
-in
171 test
-f
%XSRC%/data
/c
++.m4
172 if not errorlevel 1 mv
-f
%XSRC%/data
/c
++.m4
%XSRC%/data
/cxx.m4
173 test
-f
%XSRC%/data
/cxx.m4
174 if errorlevel 1 mv
-f
%XSRC%/data
/cpp.m4
%XSRC%/data
/cxx.m4
176 test
-f
%XSRC%/src
/c
-scan
-gram.c
177 if not errorlevel 1 goto scan_skel_c_Test
178 test
-f
%XSRC%/src
/scan
-gram
-c.c
179 if not errorlevel 1 mv
-f
%XSRC%/src
/scan
-gram
-c.c
%XSRC%/src
/c
-scan
-gram.c
181 test
-f
%XSRC%/src
/c
-scan
-skel.c
182 if not errorlevel 1 goto FixFiles
183 test
-f
%XSRC%/src
/scan
-skel
-c.c
184 if not errorlevel 1 mv
-f
%XSRC%/src
/scan
-skel
-c.c
%XSRC%/src
/c
-scan
-skel.c
187 Rem Fix data/lalr1.cc and data/location.cc to reflect the renaming of c++.m4
188 sed
"s/c++\.m4/cxx.m4/" %XSRC%/data
/lalr1.cc
> lalr1.cc
189 if errorlevel 1 goto lalr1_ccFileError
190 mv .
/lalr1.cc
%XSRC%/data
/lalr1.cc
191 sed
"s/c++\.m4/cxx.m4/" %XSRC%/data
/location.cc
> location.cc
192 if errorlevel 1 goto location.ccFileError
193 mv .
/location.cc
%XSRC%/data
/location.cc
195 Rem Define DJGPP specific defs in config.hin
196 echo Editing config.hin...
197 test
-f
%XSRC%/config_h.orig
198 if errorlevel 1 update
%XSRC%/config.hin
%XSRC%/config_h.orig
199 sed
-f
%XSRC%/djgpp
/config_h.sed
%XSRC%/config_h.orig
> config.hin
200 if errorlevel 1 goto SedError2
201 mv
-f config.hin
%XSRC%/config.hin
204 Rem Fixing ilicit testsuite file name.
205 test
-f
%XSRC%/tests
/c
++.at
206 if not errorlevel 1 mv
-f
%XSRC%/tests
/c
++.at
%XSRC%/tests
/cxx.at
208 Rem Fixing ilicit calc++ file names in the calc++ directory.
209 test
-d
%XSRC%/examples
/calc
++
210 if not errorlevel 1 mv
-f
%XSRC%/examples
/calc
++ %XSRC%/examples
/calcxx
211 test
-d
%XSRC%/examples
/calcxx
212 if errorlevel 1 mv
-f
%XSRC%/examples
/calcpp
%XSRC%/examples
/calcxx
213 test
-f
%XSRC%/examples
/calcxx
/calc
++-scanner.cc
214 if not errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calc
++-scanner.cc
%XSRC%/examples
/calcxx
/calcxx
-scanner.cc
215 test
-f
%XSRC%/examples
/calcxx
/calcxx
-scanner.cc
216 if errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calcpp
-scanner.cc
%XSRC%/examples
/calcxx
/calcxx
-scanner.cc
217 test
-f
%XSRC%/examples
/calcxx
/calc
++-scanner.ll
218 if not errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calc
++-scanner.ll
%XSRC%/examples
/calcxx
/calcxx
-scanner.ll
219 test
-f
%XSRC%/examples
/calcxx
/calcxx
-scanner.ll
220 if errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calcpp
-scanner.ll
%XSRC%/examples
/calcxx
/calcxx
-scanner.ll
221 test
-f
%XSRC%/examples
/calcxx
/calc
++-driver.cc
222 if not errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calc
++-driver.cc
%XSRC%/examples
/calcxx
/calcxx
-driver.cc
223 test
-f
%XSRC%/examples
/calcxx
/calcxx
-driver.cc
224 if errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calcpp
-driver.cc
%XSRC%/examples
/calcxx
/calcxx
-driver.cc
225 test
-f
%XSRC%/examples
/calcxx
/calc
++-driver.hh
226 if not errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calc
++-driver.hh
%XSRC%/examples
/calcxx
/calcxx
-driver.hh
227 test
-f
%XSRC%/examples
/calcxx
/calcxx
-driver.hh
228 if errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calcpp
-driver.hh
%XSRC%/examples
/calcxx
/calcxx
-driver.hh
229 test
-f
%XSRC%/examples
/calcxx
/calc
++-parser.cc
230 if not errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calc
++-parser.cc
%XSRC%/examples
/calcxx
/calcxx
-parser.cc
231 test
-f
%XSRC%/examples
/calcxx
/calcxx
-parser.cc
232 if errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calcpp
-parser.cc
%XSRC%/examples
/calcxx
/calcxx
-parser.cc
233 test
-f
%XSRC%/examples
/calcxx
/calc
++-parser.hh
234 if not errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calc
++-parser.hh
%XSRC%/examples
/calcxx
/calcxx
-parser.hh
235 test
-f
%XSRC%/examples
/calcxx
/calcxx
-parser.hh
236 if errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calcpp
-parser.hh
%XSRC%/examples
/calcxx
/calcxx
-parser.hh
237 test
-f
%XSRC%/examples
/calcxx
/calc
++-parser.stamp
238 if not errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calc
++-parser.stamp
%XSRC%/examples
/calcxx
/calcxx
-parser.stamp
239 test
-f
%XSRC%/examples
/calcxx
/calcxx
-parser.stamp
240 if errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calcpp
-parser.stamp
%XSRC%/examples
/calcxx
/calcxx
-parser.stamp
241 test
-f
%XSRC%/examples
/calcxx
/calc
++-parser.yy
242 if not errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calc
++-parser.yy
%XSRC%/examples
/calcxx
/calcxx
-parser.yy
243 test
-f
%XSRC%/examples
/calcxx
/calcxx
-parser.yy
244 if errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calcpp
-parser.yy
%XSRC%/examples
/calcxx
/calcxx
-parser.yy
245 test
-f
%XSRC%/examples
/calcxx
/calc
++.cc
246 if not errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calc
++.cc
%XSRC%/examples
/calcxx
/calcxx.cc
247 test
-f
%XSRC%/examples
/calcxx
/calcxx.cc
248 if errorlevel 1 mv
-f
%XSRC%/examples
/calcxx
/calcpp.cc
%XSRC%/examples
/calcxx
/calcxx.cc
250 Rem Fixing #include lines in calcxx files.
251 sed
"/#[ ]*include/s/++/xx/" %XSRC%/examples
/calcxx
/calcxx.cc
> calcxx.cc
252 if errorlevel 1 goto calcxxFileError
253 mv .
/calcxx.cc
%XSRC%/examples
/calcxx
/calcxx.cc
254 sed
"/#[ ]*include/s/++/xx/" %XSRC%/examples
/calcxx
/calcxx
-driver.cc
> calcxx
-driver.cc
255 if errorlevel 1 goto calcxxFileError
256 mv .
/calcxx
-driver.cc
%XSRC%/examples
/calcxx
/calcxx
-driver.cc
257 sed
"/#[ ]*include/s/++/xx/" %XSRC%/examples
/calcxx
/calcxx
-driver.hh
> calcxx
-driver.hh
258 if errorlevel 1 goto calcxxFileError
259 mv .
/calcxx
-driver.hh
%XSRC%/examples
/calcxx
/calcxx
-driver.hh
260 sed
"/#[ ]*include/s/++/xx/" %XSRC%/examples
/calcxx
/calcxx
-parser.cc
> calcxx
-parser.cc
261 if errorlevel 1 goto calcxxFileError
262 mv .
/calcxx
-parser.cc
%XSRC%/examples
/calcxx
/calcxx
-parser.cc
263 sed
"/#[ ]*include/s/++/xx/" %XSRC%/examples
/calcxx
/calcxx
-parser.hh
> calcxx
-parser.hh
264 if errorlevel 1 goto calcxxFileError
265 mv .
/calcxx
-parser.hh
%XSRC%/examples
/calcxx
/calcxx
-parser.hh
266 :sed "/#[ ]*include/s/++/xx/" %XSRC%/examples
/calcxx
/calcxx
-parser.yy
> calcxx
-parser.yy
267 :if errorlevel 1 goto calcxxFileError
268 :mv .
/calcxx
-parser.yy
%XSRC%/examples
/calcxx
/calcxx
-parser.yy
269 sed
"/#[ ]*include/s/++/xx/" %XSRC%/examples
/calcxx
/calcxx
-scanner.cc
> calcxx
-scanner.cc
270 if errorlevel 1 goto calcxxFileError
271 mv .
/calcxx
-scanner.cc
%XSRC%/examples
/calcxx
/calcxx
-scanner.cc
272 :sed "/#[ ]*include/s/++/xx/" %XSRC%/examples
/calcxx
/calcxx
-scanner.ll
> calcxx
-scanner.ll
273 :if errorlevel 1 goto calcxxFileError
274 :mv .
/calcxx
-scanner.ll
%XSRC%/examples
/calcxx
/calcxx
-scanner.ll
275 sed
"s/calc++/calcxx/" %XSRC%/examples
/calcxx
/test
> test
276 if errorlevel 1 goto calcxxFileError
277 mv .
/test
%XSRC%/examples
/calcxx
/test
280 Rem Fixing the scanner files to make file names 8.3 valid.
281 Rem Use only if you want to change the scan-gram.l and scan-skel.l files.
282 : sed
"/outfile=/s/\.yy/yy/" %XSRC%/src
/scan
-gram.l
> scan
-gram.l
283 : if errorlevel 1 goto ScannerFileError
284 : mv .
/scan
-gram.l
%XSRC%/src
/scan
-gram.l
285 : sed
"/outfile=/s/\.yy/yy/" %XSRC%/src
/scan
-skel.l
> scan
-skel.l
286 : if errorlevel 1 goto ScannerFileError
287 : mv .
/scan
-skel.l
%XSRC%/src
/scan
-skel.l
290 Rem This is required because DOS/Windows are case-insensitive
291 Rem to file names, and "make install" will do nothing if Make
292 Rem finds a file called `install'.
293 if exist INSTALL
ren INSTALL INSTALL.txt
295 Rem Set SHELL to a sane default or some configure tests stop working
296 Rem if the package is configured across partitions.
297 if not "%SHELL%" == "" goto HomeName
299 if not "%SHELL%" == "/bin/sh" goto SmallEnv
300 echo No
SHELL found in the environment
, using default value
303 Rem Set HOME to a sane default so configure stops complaining.
304 if not "%HOME%" == "" goto HostName
305 set HOME
=%XSRC%/djgpp
306 if not "%HOME%" == "%XSRC%/djgpp" goto SmallEnv
307 echo No HOME found in the environment
, using default value
310 Rem Set HOSTNAME so it shows in config.status
311 if not "%HOSTNAME%" == "" goto hostdone
312 if "%windir%" == "" goto msdos
314 if not "%OS%" == "MS-Windows" goto SmallEnv
318 if not "%OS%" == "MS-DOS" goto SmallEnv
320 if not "%USERNAME%" == "" goto haveuname
321 if not "%USER%" == "" goto haveuser
322 echo No USERNAME and no USER found in the environment
, using default values
323 set HOSTNAME
=Unknown PC
324 if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
327 set HOSTNAME
=%USER%'s PC
328 if not "%HOSTNAME%" == "%USER%'s PC
" goto SmallEnv
331 set HOSTNAME=%USERNAME%'s PC
332 if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
334 set _HOSTNAME=%HOSTNAME%, %OS%
335 if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
336 set HOSTNAME=%_HOSTNAME%
341 Rem install-sh is required by the configure script but clashes with the
342 Rem various Makefile install-foo targets, so we MUST have it before the
343 Rem script runs and rename it afterwards
344 test -f %XSRC%/install-sh
345 if not errorlevel 1 goto NoRen0
346 test -f %XSRC%/install-sh.sh
347 if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
350 if "%NLS%" == "disabled" goto WithoutNLS
353 Rem Check for the needed libraries and binaries.
354 test -x /dev/env/DJDIR/bin/msgfmt.exe
355 if errorlevel 1 goto MissingNLSTools
356 test -x /dev/env/DJDIR/bin/xgettext.exe
357 if errorlevel 1 goto MissingNLSTools
358 test -f /dev/env/DJDIR/include/libcharset.h
359 if errorlevel 1 goto MissingNLSTools
360 test -f /dev/env/DJDIR/lib/libcharset.a
361 if errorlevel 1 goto MissingNLSTools
362 test -f /dev/env/DJDIR/include/iconv.h
363 if errorlevel 1 goto MissingNLSTools
364 test -f /dev/env/DJDIR/lib/libiconv.a
365 if errorlevel 1 goto MissingNLSTools
366 test -f /dev/env/DJDIR/include/libintl.h
367 if errorlevel 1 goto MissingNLSTools
368 test -f /dev/env/DJDIR/lib/libintl.a
369 if errorlevel 1 goto MissingNLSTools
371 Rem Recreate the files in the %XSRC%/po subdir with our ported tools.
372 redir -e /dev/null rm %XSRC%/po/*.gmo
373 redir -e /dev/null rm %XSRC%/po/bison.pot
374 redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c
375 redir -e /dev/null rm %XSRC%/po/stamp-cat-id
377 Rem Update the arguments file for the configure script.
378 Rem We prefer without-included-gettext because libintl.a from gettext package
379 Rem is the only one that is garanteed to have been ported to DJGPP.
380 echo --enable-nls --without-included-gettext >> arguments
381 goto ConfigurePackage
384 echo Needed libs/tools for NLS not found. Configuring without NLS.
386 Rem Update the arguments file for the configure script.
387 echo --disable-nls >> arguments
390 echo Running the ./configure script...
391 sh ./configure @arguments
392 if errorlevel 1 goto CfgError
398 echo ./data/lalr1.cc file editing failed!
401 :location_ccFileError
402 echo ./data/location.cc file editing failed!
406 echo ./examples/calcxx file editing failed!
410 echo ./scanner file editing failed!
414 echo ./configure script editing failed!
418 echo ./config.hin editing failed!
422 echo ./configure script exited abnormally!
426 echo Your environment size is too small. Enlarge it and run me again.
427 echo Configuration NOT done!
430 test -f %XSRC%/install-sh.sh
431 if not errorlevel 1 goto NoRen1
432 test -f %XSRC%/install-sh
433 if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh
435 if "%SHELL%" == "/bin/sh" set SHELL=
436 if "%HOME%" == "%XSRC%/djgpp" set HOME=
442 set DEPENDENCY_TRACKING=