[16930] | 1 | @echo off
|
---|
| 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.
|
---|
| 5 |
|
---|
| 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.
|
---|
| 11 | set ARGS=
|
---|
| 12 | set NLS=enabled
|
---|
| 13 | if not "%NLS%" == "enabled" goto SmallEnv
|
---|
| 14 | set STATIC_LIBS=enabled
|
---|
| 15 | if not "%STATIC_LIBS%" == "enabled" goto SmallEnv
|
---|
| 16 | set XSRC=.
|
---|
| 17 | if not "%XSRC%" == "." goto SmallEnv
|
---|
| 18 |
|
---|
| 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.
|
---|
| 22 | :ArgLoop
|
---|
| 23 | set ARGSFLAG=1
|
---|
| 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
|
---|
| 30 | set ARGSFLAG=0
|
---|
| 31 | if not "%ARGSFLAG%" == "0" goto SmallEnv
|
---|
| 32 | shift
|
---|
| 33 | :StaticLibsOpt
|
---|
| 34 | set ARGSFLAG=1
|
---|
| 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
|
---|
| 40 | set ARGSFLAG=0
|
---|
| 41 | if not "%ARGSFLAG%" == "0" goto SmallEnv
|
---|
| 42 | shift
|
---|
| 43 | :SrcDirOpt
|
---|
| 44 | set ARGSFLAG=1
|
---|
| 45 | if not "%ARGSFLAG%" == "1" goto SmallEnv
|
---|
| 46 | echo %1 | grep -q "/"
|
---|
| 47 | if errorlevel 1 goto NextArg
|
---|
| 48 | set XSRC=%1
|
---|
| 49 | if not "%XSRC%" == "%1" goto SmallEnv
|
---|
| 50 | set ARGSFLAG=0
|
---|
| 51 | if not "%ARGSFLAG%" == "0" goto SmallEnv
|
---|
| 52 | :NextArg
|
---|
| 53 | if "%ARGSFLAG%" == "1" set _ARGS=%ARGS% %1
|
---|
| 54 | if "%ARGSFLAG%" == "1" if not "%_ARGS%" == "%ARGS% %1" goto SmallEnv
|
---|
| 55 | set ARGS=%_ARGS%
|
---|
| 56 | set _ARGS=
|
---|
| 57 | shift
|
---|
| 58 | if not "%1" == "" goto ArgLoop
|
---|
| 59 | set ARGSFLAG=
|
---|
| 60 |
|
---|
| 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
|
---|
| 65 | set ARGS=%_ARGS%
|
---|
| 66 | set _ARGS=
|
---|
| 67 |
|
---|
| 68 | if "%XSRC%" == "." goto InPlace
|
---|
| 69 |
|
---|
| 70 | :NotInPlace
|
---|
| 71 | redir -e /dev/null update %XSRC%/configure.orig ./configure
|
---|
| 72 | test -f ./configure
|
---|
| 73 | if errorlevel 1 update %XSRC%/configure ./configure
|
---|
| 74 |
|
---|
| 75 | :InPlace
|
---|
| 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
|
---|
| 82 |
|
---|
| 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
|
---|
| 86 |
|
---|
| 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
|
---|
| 92 |
|
---|
| 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
|
---|
| 97 | Rem accordingly.
|
---|
| 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
|
---|
| 103 |
|
---|
| 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
|
---|
| 108 |
|
---|
| 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
|
---|
| 116 | :NoRen0
|
---|
| 117 |
|
---|
| 118 | Rem Set HOSTNAME so it shows in config.status
|
---|
| 119 | if not "%HOSTNAME%" == "" goto hostdone
|
---|
| 120 | if "%windir%" == "" goto msdos
|
---|
| 121 | set OS=MS-Windows
|
---|
| 122 | if not "%OS%" == "MS-Windows" goto SmallEnv
|
---|
| 123 | goto haveos
|
---|
| 124 | :msdos
|
---|
| 125 | set OS=MS-DOS
|
---|
| 126 | if not "%OS%" == "MS-DOS" goto SmallEnv
|
---|
| 127 | :haveos
|
---|
| 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
|
---|
| 133 | goto userdone
|
---|
| 134 | :haveuser
|
---|
| 135 | set HOSTNAME=%USER%'s PC
|
---|
| 136 | if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
|
---|
| 137 | goto userdone
|
---|
| 138 | :haveuname
|
---|
| 139 | set HOSTNAME=%USERNAME%'s PC
|
---|
| 140 | if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
|
---|
| 141 | :userdone
|
---|
| 142 | set _HOSTNAME=%HOSTNAME%, %OS%
|
---|
| 143 | if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
|
---|
| 144 | set HOSTNAME=%_HOSTNAME%
|
---|
| 145 | :hostdone
|
---|
| 146 | set _HOSTNAME=
|
---|
| 147 | set OS=
|
---|
| 148 |
|
---|
| 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
|
---|
| 153 | echo Done.
|
---|
| 154 | goto ScriptEditing
|
---|
| 155 |
|
---|
| 156 | :WithoutNLS
|
---|
| 157 | echo Running the ./configure script...
|
---|
| 158 | sh ./configure --srcdir=%XSRC% --disable-nls %ARGS%
|
---|
| 159 | if errorlevel 1 goto CfgError
|
---|
| 160 | echo Done.
|
---|
| 161 |
|
---|
| 162 | :ScriptEditing
|
---|
| 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
|
---|
| 172 | call cd_SrcDir.bat
|
---|
| 173 | call djgpp\edtests.bat
|
---|
| 174 | call cd_BuildDir.bat
|
---|
| 175 | rm -f cd_SrcDir.bat cd_BuildDir.bat %XSRC%/cd_BuildDir.bat
|
---|
| 176 | goto End
|
---|
| 177 | :NoDirChange
|
---|
| 178 | call djgpp\edtests.bat
|
---|
| 179 | goto End
|
---|
| 180 |
|
---|
| 181 | :SedError
|
---|
| 182 | echo ./configure script editing failed!
|
---|
| 183 | goto End
|
---|
| 184 |
|
---|
| 185 | :CfgError
|
---|
| 186 | echo ./configure script exited abnormally!
|
---|
| 187 | goto End
|
---|
| 188 |
|
---|
| 189 | :SmallEnv
|
---|
| 190 | echo Your environment size is too small. Enlarge it and run me again.
|
---|
| 191 | echo Configuration NOT done!
|
---|
| 192 |
|
---|
| 193 | :End
|
---|
| 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
|
---|
| 198 | :NoRen1
|
---|
| 199 | set ARGS=
|
---|
| 200 | set CONFIG_SITE=
|
---|
| 201 | set HOSTNAME=
|
---|
| 202 | set NLS=
|
---|
| 203 | set XSRC=
|
---|