2
echo Configuring GNU Gettext for DJGPP v2.x...
3
Rem The SmallEnv tests protect against fixed and too small size
4
Rem of the environment in stock DOS shell.
6
Rem Find out if NLS is wanted or not,
7
Rem if static or shared libraries are wanted
8
Rem and where the sources are.
9
Rem We always default to NLS support,
10
Rem static libraries, and to in place configuration.
13
if not "%NLS%" == "enabled" goto SmallEnv
14
set STATIC_LIBS=enabled
15
if not "%STATIC_LIBS%" == "enabled" goto SmallEnv
17
if not "%XSRC%" == "." goto SmallEnv
19
Rem Loop over all arguments.
20
Rem Special arguments are: NLS, XSRC and STATIC_LIBS.
21
Rem All other arguments are stored unchanged into ARGS.
24
if not "%ARGSFLAG%" == "1" goto SmallEnv
25
if not "%1" == "NLS" if not "%1" == "nls" if not "%1" == "NO-NLS" if not "%1" == "no-NLS" if not "%1" == "no-nls" goto StaticLibsOpt
26
if "%1" == "no-nls" set NLS=disabled
27
if "%1" == "no-NLS" set NLS=disabled
28
if "%1" == "NO-NLS" set NLS=disabled
29
if not "%NLS%" == "disabled" goto SmallEnv
31
if not "%ARGSFLAG%" == "0" goto SmallEnv
35
if not "%ARGSFLAG%" == "1" goto SmallEnv
36
if not "%1" == "static" if not "%1" == "STATIC" if not "%1" == "shared" if not "%1" == "SHARED" goto SrcDirOpt
37
if "%1" == "shared" set STATIC_LIBS=disabled
38
if "%1" == "SHARED" set STATIC_LIBS=disabled
39
if not "%STATIC_LIBS%" == "disabled" goto SmallEnv
41
if not "%ARGSFLAG%" == "0" goto SmallEnv
45
if not "%ARGSFLAG%" == "1" goto SmallEnv
47
if errorlevel 1 goto NextArg
49
if not "%XSRC%" == "%1" goto SmallEnv
51
if not "%ARGSFLAG%" == "0" goto SmallEnv
53
if "%ARGSFLAG%" == "1" set _ARGS=%ARGS% %1
54
if "%ARGSFLAG%" == "1" if not "%_ARGS%" == "%ARGS% %1" goto SmallEnv
58
if not "%1" == "" goto ArgLoop
61
if "%STATIC_LIBS%" == "enabled" set _ARGS=--enable-static --disable-shared %ARGS%
62
if not "%_ARGS%" == "--enable-static --disable-shared %ARGS%" goto SmallEnv
63
if "%STATIC_LIBS%" == "disabled" set _ARGS=--disable-static --enable-shared %ARGS%
64
if "%STATIC_LIBS%" == "disabled" if not "%_ARGS%" == "--disable-static --enable-shared %ARGS%" goto SmallEnv
68
if "%XSRC%" == "." goto InPlace
71
redir -e /dev/null update %XSRC%/configure.orig ./configure
73
if errorlevel 1 update %XSRC%/configure ./configure
76
Rem Update configuration files
77
echo Updating configuration scripts...
78
test -f ./configure.orig
79
if errorlevel 1 update configure configure.orig
80
sed -f %XSRC%/djgpp/config.sed configure.orig > configure
81
if errorlevel 1 goto SedError
83
Rem Make sure they have a config.site file
84
set CONFIG_SITE=%XSRC%/djgpp/config.site
85
if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv
87
Rem Make sure crucial file names are not munged by unpacking
88
test -f %XSRC%/config.h.in
89
if not errorlevel 1 mv -f %XSRC%/config.h.in %XSRC%/config.h-in
90
test -f %XSRC%/po/Makefile.in.in
91
if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in
93
Rem While building the binaries in src/ subdir an intermediary
94
Rem file called po-gram-gen2.h is generated from po-gram-gen.h.
95
Rem Both resolve to the same 8.3 filename. po-gram-gen2.h will
96
Rem be renamed to po-gram_gen2.h and src/po-lex.c must be fixed
98
test -f %XSRC%/src/po-lex.orig
99
if errorlevel 1 update %XSRC%/src/po-lex.c %XSRC%/src/po-lex.orig
100
sed "s/po-gram-gen2.h/po-gram_gen2.h/g" %XSRC%/src/po-lex.orig > po-lex.tmp
101
if errorlevel 1 goto SedError
102
mv ./po-lex.tmp %XSRC%/src/po-lex.c
104
Rem This is required because DOS/Windows are case-insensitive
105
Rem to file names, and "make install" will do nothing if Make
106
Rem finds a file called `install'.
107
if exist INSTALL mv -f INSTALL INSTALL.txt
109
Rem install-sh is required by the configure script but clashes with the
110
Rem various Makefile install-foo targets, so we MUST have it before the
111
Rem script runs and rename it afterwards
112
test -f %XSRC%/install-sh
113
if not errorlevel 1 goto NoRen0
114
test -f %XSRC%/install-sh.sh
115
if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
118
Rem Set HOSTNAME so it shows in config.status
119
if not "%HOSTNAME%" == "" goto hostdone
120
if "%windir%" == "" goto msdos
122
if not "%OS%" == "MS-Windows" goto SmallEnv
126
if not "%OS%" == "MS-DOS" goto SmallEnv
128
if not "%USERNAME%" == "" goto haveuname
129
if not "%USER%" == "" goto haveuser
130
echo No USERNAME and no USER found in the environment, using default values
131
set HOSTNAME=Unknown PC
132
if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
135
set HOSTNAME=%USER%'s PC
136
if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
139
set HOSTNAME=%USERNAME%'s PC
140
if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
142
set _HOSTNAME=%HOSTNAME%, %OS%
143
if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
144
set HOSTNAME=%_HOSTNAME%
149
if "%NLS%" == "disabled" goto WithoutNLS
150
echo Running the ./configure script...
151
sh ./configure --srcdir=%XSRC% --enable-nls --with-included-gettext %ARGS%
152
if errorlevel 1 goto CfgError
157
echo Running the ./configure script...
158
sh ./configure --srcdir=%XSRC% --disable-nls %ARGS%
159
if errorlevel 1 goto CfgError
163
Rem DJGPP specific editing of test scripts.
164
test -f %XSRC%/tests/stamp-test
165
if not errorlevel 1 goto End
166
if "%XSRC%" == "." goto NoDirChange
167
cd | sed "s|:.*$|:|" > cd_BuildDir.bat
168
cd | sed "s|^.:|cd |" >> cd_BuildDir.bat
169
mv -f cd_BuildDir.bat %XSRC%/cd_BuildDir.bat
170
echo %XSRC% | sed -e "s|^/dev/||" -e "s|/|:|" -e "s|:.*$|:|g" > cd_SrcDir.bat
171
echo %XSRC% | sed -e "s|^/dev/||" -e "s|/|:/|" -e "s|^.*:|cd |" -e "s|^\.\.|cd &|" -e "s|/|\\|g" >> cd_SrcDir.bat
173
call djgpp\edtests.bat
175
rm -f cd_SrcDir.bat cd_BuildDir.bat %XSRC%/cd_BuildDir.bat
178
call djgpp\edtests.bat
182
echo ./configure script editing failed!
186
echo ./configure script exited abnormally!
190
echo Your environment size is too small. Enlarge it and run me again.
191
echo Configuration NOT done!
194
test -f %XSRC%/install-sh.sh
195
if not errorlevel 1 goto NoRen1
196
test -f %XSRC%/install-sh
197
if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh