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