source: trunk/third/gettext/djgpp/config.bat @ 18200

Revision 18200, 11.9 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18199, which included commits to RCS files with non-trunk default branches.
Line 
1@echo off
2echo Configuring GNU Gettext for DJGPP v2.x...
3
4Rem The SmallEnv tests protect against fixed and too small size
5Rem of the environment in stock DOS shell.
6
7Rem Find out if NLS is wanted or not,
8Rem if dependency-tracking is wanted or not,
9Rem if caching is wanted or not
10Rem if static or shared libraries are wanted
11Rem and where the sources are.
12Rem We always default to NLS support,
13Rem no dependency tracking, static library
14Rem and to in place configuration.
15set ARGS=
16set NLS=enabled
17if not "%NLS%" == "enabled" goto SmallEnv
18set CACHING=enabled
19if not "%CACHING%" == "enabled" goto SmallEnv
20set DEPENDENCY_TRACKING=disabled
21if not "%DEPENDENCY_TRACKING%" == "disabled" goto SmallEnv
22set LIBICONV_PREFIX=disabled
23if not "%LIBICONV_PREFIX%" == "disabled" goto SmallEnv
24set LIBINTL_PREFIX=disabled
25if not "%LIBINTL_PREFIX%" == "disabled" goto SmallEnv
26set STATIC_LIBRARY=enabled
27if not "%STATIC_LIBRARY%" == "enabled" goto SmallEnv
28set XSRC=.
29if not "%XSRC%" == "." goto SmallEnv
30
31Rem Loop over all arguments.
32Rem Special arguments are: NLS, XSRC, CACHE, STATIC_LIBS, LIBICONV_PREFIX, LIBINTL_PREFIX and DEPS.
33Rem All other arguments are stored into ARGS.
34:ArgLoop
35if "%1" == "nls" goto NextArgument
36if "%1" == "NLS" goto NextArgument
37if "%1" == "no-nls" goto NoNLS
38if "%1" == "no-NLS" goto NoNLS
39if "%1" == "NO-NLS" goto NoNLS
40goto CachingOption
41:NoNLS
42if "%1" == "no-nls" set NLS=disabled
43if "%1" == "no-NLS" set NLS=disabled
44if "%1" == "NO-NLS" set NLS=disabled
45if not "%NLS%" == "disabled" goto SmallEnv
46goto NextArgument
47:CachingOption
48if "%1" == "cache" goto NextArgument
49if "%1" == "CACHE" goto NextArgument
50if "%1" == "no-cache" goto NoCaching
51if "%1" == "no-CACHE" goto NoCaching
52if "%1" == "NO-CACHE" goto NoCaching
53goto DependencyOption
54:NoCaching
55if "%1" == "no-cache" set CACHING=disabled
56if "%1" == "no-CACHE" set CACHING=disabled
57if "%1" == "NO-CACHE" set CACHING=disabled
58if not "%CACHING%" == "disabled" goto SmallEnv
59goto NextArgument
60:DependencyOption
61if "%1" == "no-dep" goto NextArgument
62if "%1" == "no-DEP" goto NextArgument
63if "%1" == "NO-DEP" goto NextArgument
64if "%1" == "dep" goto DependecyTraking
65if "%1" == "DEP" goto DependecyTraking
66goto LibiconvPrefixOption
67:DependecyTraking
68if "%1" == "dep" set DEPENDENCY_TRACKING=enabled
69if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled
70if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
71goto NextArgument
72:LibiconvPrefixOption
73if "%1" == "no-libiconvprefix" goto NextArgument
74if "%1" == "no-LIBICONVPREFIX" goto NextArgument
75if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
76if "%1" == "libiconvprefix" goto WithLibiconvPrefix
77if "%1" == "LIBICONVPREFIX" goto WithLibiconvPrefix
78goto LibintlPrefixOption
79:WithLibiconvPrefix
80if "%1" == "libiconvprefix" set LIBICONV_PREFIX=enabled
81if "%1" == "LIBICONVPREFIX" set LIBICONV_PREFIX=enabled
82if not "%LIBICONV_PREFIX%" == "enabled" goto SmallEnv
83goto NextArgument
84:LibintlPrefixOption
85if "%1" == "no-libiconvprefix" goto NextArgument
86if "%1" == "no-LIBICONVPREFIX" goto NextArgument
87if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
88if "%1" == "libintlprefix" goto _WithLibintlPrefix
89if "%1" == "LIBINTLPREFIX" goto _WithLibintlPrefix
90goto StaticLibraryOption
91:_WithLibintlPrefix
92if "%1" == "libintlprefix" set LIBINTL_PREFIX=enabled
93if "%1" == "LIBINTLPREFIX" set LIBINTL_PREFIX=enabled
94if not "%LIBINTL_PREFIX%" == "enabled" goto SmallEnv
95goto NextArgument
96:StaticLibraryOption
97if "%1" == "static" goto NextArgument
98if "%1" == "STATIC" goto NextArgument
99if "%1" == "shared" goto SharedLibrary
100if "%1" == "SHARED" goto SharedLibrary
101goto SrcDirOption
102:SharedLibrary
103if "%1" == "shared" set STATIC_LIBRARY=disabled
104if "%1" == "SHARED" set STATIC_LIBRARY=disabled
105if not "%STATIC_LIBRARY%" == "disabled" goto SmallEnv
106goto NextArgument
107:SrcDirOption
108echo %1 | grep -q "/"
109if errorlevel 1 goto CollectArgument
110set XSRC=%1
111if not "%XSRC%" == "%1" goto SmallEnv
112goto NextArgument
113:CollectArgument
114set _ARGS=%ARGS% %1
115if not "%_ARGS%" == "%ARGS% %1" if not "%_ARGS%" == "%ARGS%%1" goto SmallEnv
116echo %_ARGS% | grep -q "[^ ]"
117if not errorlevel 0 set ARGS=%_ARGS%
118set _ARGS=
119:NextArgument
120shift
121if not "%1" == "" goto ArgLoop
122
123Rem Create an arguments file for the configure script.
124echo --srcdir=%XSRC% > arguments
125if "%CACHING%" == "enabled"              echo --cache-file=%XSRC%/djgpp/config.cache >> arguments
126if "%DEPENDENCY_TRACKING%" == "enabled"  echo --enable-dependency-tracking >> arguments
127if "%DEPENDENCY_TRACKING%" == "disabled" echo --disable-dependency-tracking >> arguments
128if "%LIBICONV_PREFIX%" == "enabled"      echo --with-libiconv-prefix >> arguments
129if "%LIBICONV_PREFIX%" == "disabled"     echo --without-libiconv-prefix >> arguments
130if "%LIBINTL_PREFIX%" == "enabled"       echo --with-libintl-prefix >> arguments
131if "%LIBINTL_PREFIX%" == "disabled"      echo --without-libintl-prefix >> arguments
132if "%STATIC_LIBRARY%" == "enabled"       echo --enable-static --disable-shared >> arguments
133if "%STATIC_LIBRARY%" == "disabled"      echo --enable-shared --disable-static >> arguments
134if not "%ARGS%" == ""                    echo %ARGS% >> arguments
135set ARGS=
136set CACHING=
137set DEPENDENCY_TRACKING=
138set LIBICONV_PREFIX=
139set LIBINTL_PREFIX=
140set STATIC_LIBRARY=
141
142if "%XSRC%" == "." goto InPlace
143
144:NotInPlace
145redir -e /dev/null update %XSRC%/configure.orig ./configure
146test -f ./configure
147if errorlevel 1 update %XSRC%/configure ./configure
148
149:InPlace
150Rem Update configuration files
151echo Updating configuration scripts...
152test -f ./configure.orig
153if errorlevel 1 update configure configure.orig
154sed -f %XSRC%/djgpp/config.sed configure.orig > configure
155if errorlevel 1 goto SedError
156
157Rem Make sure they have a config.site file
158set CONFIG_SITE=%XSRC%/djgpp/config.site
159if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv
160
161Rem Make sure crucial file names are not munged by unpacking
162test -f %XSRC%/config.h.in
163if not errorlevel 1 mv -f %XSRC%/config.h.in %XSRC%/config.h-in
164test -f %XSRC%/configh.in
165if not errorlevel 1 mv -f %XSRC%/config.h.in %XSRC%/config.h-in
166test -f %XSRC%/config.h-in
167if errorlevel 1 mv -f %XSRC%/config.h %XSRC%/config.h-in
168test -f %XSRC%/po/Makefile.in.in
169if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in
170
171Rem While building the binaries in src/ subdir an intermediary
172Rem file called po-gram-gen2.h is generated from po-gram-gen.h.
173Rem Both resolve to the same 8.3 filename. po-gram-gen2.h will
174Rem be renamed to po-gram_gen2.h and src/po-lex.c must be fixed
175Rem accordingly.
176test -f %XSRC%/src/po-lex.orig
177if errorlevel 1 update %XSRC%/src/po-lex.c %XSRC%/src/po-lex.orig
178sed "s/po-gram-gen2.h/po-gram_gen2.h/g" %XSRC%/src/po-lex.orig > po-lex.tmp
179if errorlevel 1 goto SedError
180mv ./po-lex.tmp %XSRC%/src/po-lex.c
181
182Rem Starting with gettext-0.11 posix function unsetenv() is needed.
183Rem As long as djdev204 has not been released, we will provide
184Rem unsetenv.c from djdev204 CVS tree.
185test -f %XSRC%/lib/unsetenv.c
186if errorlevel 1 update %XSRC%/djgpp/unsetenv.c %XSRC%/lib/unsetenv.c
187
188Rem Starting with gettext-0.11 pw_gecos is needed.
189Rem As long as djdev204 has not been released, we will provide
190Rem getpwman.c and pwd.h (djpwd.h) from djdev204 CVS tree.
191test -f %XSRC%/lib/djpwd.h
192if errorlevel 1 update %XSRC%/djgpp/djpwd.h %XSRC%/lib/djpwd.h
193test -f %XSRC%/lib/getpwnam.c
194if errorlevel 1 update %XSRC%/djgpp/getpwnam.c %XSRC%/lib/getpwnam.c
195
196Rem src/msginit.c must use the distributed CVS tree pwd.h
197Rem instead of the system's one.
198test -f %XSRC%/src/msginit.orig
199if errorlevel 1 update %XSRC%/src/msginit.c %XSRC%/src/msginit.orig
200sed -f %XSRC%/djgpp/msginit.sed %XSRC%/src/msginit.orig > msginit.tmp
201if errorlevel 1 goto SedError
202mv ./msginit.tmp %XSRC%/src/msginit.c
203
204Rem POTFILES.in must be adjusted to reflect the changed names
205Rem according to fnchange.lst.
206test -f %XSRC%/po/POTFILES.orig
207if errorlevel 1 update %XSRC%/po/POTFILES.in %XSRC%/po/POTFILES.orig
208sed "s/format-librep/format_librep/;s/format-pascal/format_pascal/" %XSRC%/po/POTFILES.orig > POTFILES.tmp
209if errorlevel 1 goto SedError
210mv ./POTFILES.tmp %XSRC%/po/POTFILES.in
211
212Rem This is required because DOS/Windows are case-insensitive
213Rem to file names, and "make install" will do nothing if Make
214Rem finds a file called `install'.
215if exist INSTALL ren INSTALL INSTALL.txt
216
217Rem Set SHELL to a sane default or some configure tests stop working
218Rem if the package is configured across partitions.
219if not "%SHELL%" == "" goto HomeName
220set SHELL=/bin/sh
221if not "%SHELL%" == "/bin/sh" goto SmallEnv
222echo No SHELL found in the environment, using default value
223
224:HomeName
225Rem Set HOME to a sane default so configure stops complaining.
226if not "%HOME%" == "" goto HostName
227set HOME=%XSRC%/djgpp
228if not "%HOME%" == "%XSRC%/djgpp" goto SmallEnv
229echo No HOME found in the environment, using default value
230
231:HostName
232Rem Set HOSTNAME so it shows in config.status
233if not "%HOSTNAME%" == "" goto hostdone
234if "%windir%" == "" goto msdos
235set OS=MS-Windows
236if not "%OS%" == "MS-Windows" goto SmallEnv
237goto haveos
238:msdos
239set OS=MS-DOS
240if not "%OS%" == "MS-DOS" goto SmallEnv
241:haveos
242if not "%USERNAME%" == "" goto haveuname
243if not "%USER%" == "" goto haveuser
244echo No USERNAME and no USER found in the environment, using default values
245set HOSTNAME=Unknown PC
246if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
247goto userdone
248:haveuser
249set HOSTNAME=%USER%'s PC
250if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
251goto userdone
252:haveuname
253set HOSTNAME=%USERNAME%'s PC
254if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
255:userdone
256set _HOSTNAME=%HOSTNAME%, %OS%
257if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
258set HOSTNAME=%_HOSTNAME%
259:hostdone
260set _HOSTNAME=
261set OS=
262
263Rem install-sh is required by the configure script but clashes with the
264Rem various Makefile install-foo targets, so we MUST have it before the
265Rem script runs and rename it afterwards
266test -f %XSRC%/install-sh
267if not errorlevel 1 goto NoRen0
268test -f %XSRC%/install-sh.sh
269if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
270:NoRen0
271
272if "%NLS%" == "disabled" goto WithoutNLS
273
274:WithNLS
275Rem Recreate the files in the %XSRC%/po subdir with our ported tools.
276redir -e /dev/null rm %XSRC%/po/*.gmo
277redir -e /dev/null rm %XSRC%/po/gettext.pot
278redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c
279redir -e /dev/null rm %XSRC%/po/stamp-cat-id
280
281Rem Update the arguments file for the configure script.
282echo --enable-nls --with-included-gettext >> arguments
283goto ConfigurePackage
284
285:WithoutNLS
286Rem Update the arguments file for the configure script.
287echo --disable-nls >> arguments
288
289:ConfigurePackage
290echo Running the ./configure script...
291sh ./configure @arguments
292if errorlevel 1 goto CfgError
293rm arguments
294echo Done.
295
296:ScriptEditing
297Rem DJGPP specific editing of test scripts.
298test -f %XSRC%/tests/stamp-test
299if not errorlevel 1 goto End
300if "%XSRC%" == "." goto NoDirChange
301cd | sed "s|:.*$|:|" > cd_BuildDir.bat
302cd | sed "s|^.:|cd |" >> cd_BuildDir.bat
303mv -f cd_BuildDir.bat %XSRC%/cd_BuildDir.bat
304echo %XSRC% | sed -e "s|^/dev/||" -e "s|/|:|" -e "s|:.*$|:|g" > cd_SrcDir.bat
305echo %XSRC% | sed -e "s|^/dev/||" -e "s|/|:/|" -e "s|^.*:|cd |" -e "s|^\.\.|cd &|" -e "s|/|\\|g" >> cd_SrcDir.bat
306call cd_SrcDir.bat
307call djgpp\edtests.bat
308call cd_BuildDir.bat
309rm -f cd_SrcDir.bat cd_BuildDir.bat %XSRC%/cd_BuildDir.bat
310goto End
311:NoDirChange
312call djgpp\edtests.bat
313goto End
314
315:SedError
316echo ./configure script editing failed!
317goto End
318
319:CfgError
320echo ./configure script exited abnormally!
321goto End
322
323:SmallEnv
324echo Your environment size is too small.  Enlarge it and run me again.
325echo Configuration NOT done!
326
327:End
328test -f %XSRC%/install-sh.sh
329if not errorlevel 1 goto NoRen1
330test -f %XSRC%/install-sh
331if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh
332:NoRen1
333if "%SHELL%" == "/bin/sh" set SHELL=
334if "%HOME%" == "%XSRC%/djgpp" set HOME=
335set CONFIG_SITE=
336set HOSTNAME=
337set NLS=
338set CACHING=
339set DEPENDENCY_TRACKING=
340set XSRC=
Note: See TracBrowser for help on using the repository browser.