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

Revision 16931, 6.6 KB checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r16930, which included commits to RCS files with non-trunk default branches.
RevLine 
[16930]1@echo off
2echo Configuring GNU Gettext for DJGPP v2.x...
3Rem The SmallEnv tests protect against fixed and too small size
4Rem of the environment in stock DOS shell.
5
6Rem Find out if NLS is wanted or not,
7Rem if static or shared libraries are wanted
8Rem and where the sources are.
9Rem We always default to NLS support,
10Rem static libraries, and to in place configuration.
11set ARGS=
12set NLS=enabled
13if not "%NLS%" == "enabled" goto SmallEnv
14set STATIC_LIBS=enabled
15if not "%STATIC_LIBS%" == "enabled" goto SmallEnv
16set XSRC=.
17if not "%XSRC%" == "." goto SmallEnv
18
19Rem Loop over all arguments.
20Rem Special arguments are: NLS, XSRC and STATIC_LIBS.
21Rem All other arguments are stored unchanged into ARGS.
22:ArgLoop
23set ARGSFLAG=1
24if not "%ARGSFLAG%" == "1" goto SmallEnv
25if not "%1" == "NLS" if not "%1" == "nls" if not "%1" == "NO-NLS" if not "%1" == "no-NLS" if not "%1" == "no-nls" goto StaticLibsOpt
26if "%1" == "no-nls" set NLS=disabled
27if "%1" == "no-NLS" set NLS=disabled
28if "%1" == "NO-NLS" set NLS=disabled
29if not "%NLS%" == "disabled" goto SmallEnv
30set ARGSFLAG=0
31if not "%ARGSFLAG%" == "0" goto SmallEnv
32shift
33:StaticLibsOpt
34set ARGSFLAG=1
35if not "%ARGSFLAG%" == "1" goto SmallEnv
36if not "%1" == "static" if not "%1" == "STATIC" if not "%1" == "shared" if not "%1" == "SHARED" goto SrcDirOpt
37if "%1" == "shared" set STATIC_LIBS=disabled
38if "%1" == "SHARED" set STATIC_LIBS=disabled
39if not "%STATIC_LIBS%" == "disabled" goto SmallEnv
40set ARGSFLAG=0
41if not "%ARGSFLAG%" == "0" goto SmallEnv
42shift
43:SrcDirOpt
44set ARGSFLAG=1
45if not "%ARGSFLAG%" == "1" goto SmallEnv
46echo %1 | grep -q "/"
47if errorlevel 1 goto NextArg
48set XSRC=%1
49if not "%XSRC%" == "%1" goto SmallEnv
50set ARGSFLAG=0
51if not "%ARGSFLAG%" == "0" goto SmallEnv
52:NextArg
53if "%ARGSFLAG%" == "1" set _ARGS=%ARGS% %1
54if "%ARGSFLAG%" == "1" if not "%_ARGS%" == "%ARGS% %1" goto SmallEnv
55set ARGS=%_ARGS%
56set _ARGS=
57shift
58if not "%1" == "" goto ArgLoop
59set ARGSFLAG=
60
61if "%STATIC_LIBS%" == "enabled" set _ARGS=--enable-static --disable-shared %ARGS%
62if not "%_ARGS%" == "--enable-static --disable-shared %ARGS%" goto SmallEnv
63if "%STATIC_LIBS%" == "disabled" set _ARGS=--disable-static --enable-shared %ARGS%
64if "%STATIC_LIBS%" == "disabled" if not "%_ARGS%" == "--disable-static --enable-shared %ARGS%" goto SmallEnv
65set ARGS=%_ARGS%
66set _ARGS=
67
68if "%XSRC%" == "." goto InPlace
69
70:NotInPlace
71redir -e /dev/null update %XSRC%/configure.orig ./configure
72test -f ./configure
73if errorlevel 1 update %XSRC%/configure ./configure
74
75:InPlace
76Rem Update configuration files
77echo Updating configuration scripts...
78test -f ./configure.orig
79if errorlevel 1 update configure configure.orig
80sed -f %XSRC%/djgpp/config.sed configure.orig > configure
81if errorlevel 1 goto SedError
82
83Rem Make sure they have a config.site file
84set CONFIG_SITE=%XSRC%/djgpp/config.site
85if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv
86
87Rem Make sure crucial file names are not munged by unpacking
88test -f %XSRC%/config.h.in
89if not errorlevel 1 mv -f %XSRC%/config.h.in %XSRC%/config.h-in
90test -f %XSRC%/po/Makefile.in.in
91if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in
92
93Rem While building the binaries in src/ subdir an intermediary
94Rem file called po-gram-gen2.h is generated from po-gram-gen.h.
95Rem Both resolve to the same 8.3 filename. po-gram-gen2.h will
96Rem be renamed to po-gram_gen2.h and src/po-lex.c must be fixed
97Rem accordingly.
98test -f %XSRC%/src/po-lex.orig
99if errorlevel 1 update %XSRC%/src/po-lex.c %XSRC%/src/po-lex.orig
100sed "s/po-gram-gen2.h/po-gram_gen2.h/g" %XSRC%/src/po-lex.orig > po-lex.tmp
101if errorlevel 1 goto SedError
102mv ./po-lex.tmp %XSRC%/src/po-lex.c
103
104Rem This is required because DOS/Windows are case-insensitive
105Rem to file names, and "make install" will do nothing if Make
106Rem finds a file called `install'.
107if exist INSTALL mv -f INSTALL INSTALL.txt
108
109Rem install-sh is required by the configure script but clashes with the
110Rem various Makefile install-foo targets, so we MUST have it before the
111Rem script runs and rename it afterwards
112test -f %XSRC%/install-sh
113if not errorlevel 1 goto NoRen0
114test -f %XSRC%/install-sh.sh
115if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
116:NoRen0
117
118Rem Set HOSTNAME so it shows in config.status
119if not "%HOSTNAME%" == "" goto hostdone
120if "%windir%" == "" goto msdos
121set OS=MS-Windows
122if not "%OS%" == "MS-Windows" goto SmallEnv
123goto haveos
124:msdos
125set OS=MS-DOS
126if not "%OS%" == "MS-DOS" goto SmallEnv
127:haveos
128if not "%USERNAME%" == "" goto haveuname
129if not "%USER%" == "" goto haveuser
130echo No USERNAME and no USER found in the environment, using default values
131set HOSTNAME=Unknown PC
132if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
133goto userdone
134:haveuser
135set HOSTNAME=%USER%'s PC
136if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
137goto userdone
138:haveuname
139set HOSTNAME=%USERNAME%'s PC
140if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
141:userdone
142set _HOSTNAME=%HOSTNAME%, %OS%
143if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
144set HOSTNAME=%_HOSTNAME%
145:hostdone
146set _HOSTNAME=
147set OS=
148
149if "%NLS%" == "disabled" goto WithoutNLS
150echo Running the ./configure script...
151sh ./configure --srcdir=%XSRC% --enable-nls --with-included-gettext %ARGS%
152if errorlevel 1 goto CfgError
153echo Done.
154goto ScriptEditing
155
156:WithoutNLS
157echo Running the ./configure script...
158sh ./configure --srcdir=%XSRC% --disable-nls %ARGS%
159if errorlevel 1 goto CfgError
160echo Done.
161
162:ScriptEditing
163Rem DJGPP specific editing of test scripts.
164test -f %XSRC%/tests/stamp-test
165if not errorlevel 1 goto End
166if "%XSRC%" == "." goto NoDirChange
167cd | sed "s|:.*$|:|" > cd_BuildDir.bat
168cd | sed "s|^.:|cd |" >> cd_BuildDir.bat
169mv -f cd_BuildDir.bat %XSRC%/cd_BuildDir.bat
170echo %XSRC% | sed -e "s|^/dev/||" -e "s|/|:|" -e "s|:.*$|:|g" > cd_SrcDir.bat
171echo %XSRC% | sed -e "s|^/dev/||" -e "s|/|:/|" -e "s|^.*:|cd |" -e "s|^\.\.|cd &|" -e "s|/|\\|g" >> cd_SrcDir.bat
172call cd_SrcDir.bat
173call djgpp\edtests.bat
174call cd_BuildDir.bat
175rm -f cd_SrcDir.bat cd_BuildDir.bat %XSRC%/cd_BuildDir.bat
176goto End
177:NoDirChange
178call djgpp\edtests.bat
179goto End
180
181:SedError
182echo ./configure script editing failed!
183goto End
184
185:CfgError
186echo ./configure script exited abnormally!
187goto End
188
189:SmallEnv
190echo Your environment size is too small.  Enlarge it and run me again.
191echo Configuration NOT done!
192
193:End
194test -f %XSRC%/install-sh.sh
195if not errorlevel 1 goto NoRen1
196test -f %XSRC%/install-sh
197if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh
198:NoRen1
199set ARGS=
200set CONFIG_SITE=
201set HOSTNAME=
202set NLS=
203set XSRC=
Note: See TracBrowser for help on using the repository browser.