| 1 | @echo off | 
|---|
| 2 |  | 
|---|
| 3 | echo Configuring GNU Texinfo for DJGPP v2.x... | 
|---|
| 4 |  | 
|---|
| 5 | Rem The small_env tests protect against fixed and too small size | 
|---|
| 6 | Rem of the environment in stock DOS shell. | 
|---|
| 7 |  | 
|---|
| 8 | Rem Find out if NLS is wanted or not, if dependency-tracking is | 
|---|
| 9 | Rem wanted or not, if cache is wanted or not, and where the sources are. | 
|---|
| 10 | set ARGS= | 
|---|
| 11 | set NLS=disabled | 
|---|
| 12 | if not "%NLS%" == "disabled" goto small_env | 
|---|
| 13 | set CACHE=enabled | 
|---|
| 14 | if not "%CACHE%" == "enabled" goto small_env | 
|---|
| 15 | set DEPTRAK=disabled | 
|---|
| 16 | if not "%DEPTRAK%" == "disabled" goto small_env | 
|---|
| 17 | set XSRC=. | 
|---|
| 18 | if not "%XSRC%" == "." goto small_env | 
|---|
| 19 |  | 
|---|
| 20 | Rem Loop over all arguments. | 
|---|
| 21 | Rem Special arguments are: NLS, XSRC CACHE and DEPS. | 
|---|
| 22 | Rem All other arguments are stored into ARGS. | 
|---|
| 23 | :arg_loop | 
|---|
| 24 | set SPECARG=0 | 
|---|
| 25 | if not "%SPECARG%" == "0" goto small_env | 
|---|
| 26 | if not "%1" == "NLS" if not "%1" == "nls" goto cache_opt | 
|---|
| 27 | if "%1" == "nls" set NLS=enabled | 
|---|
| 28 | if "%1" == "NLS" set NLS=enabled | 
|---|
| 29 | if not "%NLS%" == "enabled" goto small_env | 
|---|
| 30 | set SPECARG=1 | 
|---|
| 31 | if not "%SPECARG%" == "1" goto small_env | 
|---|
| 32 | shift | 
|---|
| 33 | :cache_opt | 
|---|
| 34 | set SPECARG=0 | 
|---|
| 35 | if not "%SPECARG%" == "0" goto small_env | 
|---|
| 36 | if "%1" == "no-cache" goto cache_off | 
|---|
| 37 | if "%1" == "no-CACHE" goto cache_off | 
|---|
| 38 | if not "%1" == "NO-CACHE" goto dependency_opt | 
|---|
| 39 | :cache_off | 
|---|
| 40 | if "%1" == "no-cache" set CACHE=disabled | 
|---|
| 41 | if "%1" == "no-CACHE" set CACHE=disabled | 
|---|
| 42 | if "%1" == "NO-CACHE" set CACHE=disabled | 
|---|
| 43 | if not "%CACHE%" == "disabled" goto small_env | 
|---|
| 44 | set SPECARG=1 | 
|---|
| 45 | if not "%SPECARG%" == "1" goto small_env | 
|---|
| 46 | shift | 
|---|
| 47 | :dependency_opt | 
|---|
| 48 | set SPECARG=0 | 
|---|
| 49 | if not "%SPECARG%" == "0" goto small_env | 
|---|
| 50 | if "%1" == "dep" goto dep_off | 
|---|
| 51 | if not "%1" == "DEP" goto src_dir_opt | 
|---|
| 52 | :dep_off | 
|---|
| 53 | if "%1" == "dep" set DEPTRAK=enabled | 
|---|
| 54 | if "%1" == "DEP" set DEPTRAK=enabled | 
|---|
| 55 | if not "%DEPTRAK%" == "enabled" goto small_env | 
|---|
| 56 | set SPECARG=1 | 
|---|
| 57 | if not "%SPECARG%" == "1" goto small_env | 
|---|
| 58 | shift | 
|---|
| 59 | :src_dir_opt | 
|---|
| 60 | set SPECARG=0 | 
|---|
| 61 | if not "%SPECARG%" == "0" goto small_env | 
|---|
| 62 | echo %1 | grep -q "/" | 
|---|
| 63 | if errorlevel 1 goto collect_arg | 
|---|
| 64 | set XSRC=%1 | 
|---|
| 65 | if not "%XSRC%" == "%1" goto small_env | 
|---|
| 66 | set SPECARG=1 | 
|---|
| 67 | if not "%SPECARG%" == "1" goto small_env | 
|---|
| 68 | :collect_arg | 
|---|
| 69 | if "%SPECARG%" == "0" set _ARGS=%ARGS% %1 | 
|---|
| 70 | if "%SPECARG%" == "0" if not "%_ARGS%" == "%ARGS% %1" goto small_env | 
|---|
| 71 | echo %_ARGS% | grep -q "[^ ]" | 
|---|
| 72 | if not errorlevel 0 set ARGS=%_ARGS% | 
|---|
| 73 | set _ARGS= | 
|---|
| 74 | shift | 
|---|
| 75 | if not "%1" == "" goto arg_loop | 
|---|
| 76 | set SPECARG= | 
|---|
| 77 |  | 
|---|
| 78 | Rem Create a response file for the configure script. | 
|---|
| 79 | echo --srcdir=%XSRC% > arguments | 
|---|
| 80 | if "%CACHE%" == "enabled"    echo --config-cache >>arguments | 
|---|
| 81 | if "%DEPTRAK%" == "enabled"  echo --enable-dependency-tracking >>arguments | 
|---|
| 82 | if "%DEPTRAK%" == "disabled" echo --disable-dependency-tracking >>arguments | 
|---|
| 83 | if not "%ARGS%" == ""        echo %ARGS% >>arguments | 
|---|
| 84 | set ARGS= | 
|---|
| 85 | set CACHE= | 
|---|
| 86 | set DEPTRAK= | 
|---|
| 87 |  | 
|---|
| 88 | if "%XSRC%" == "." goto in_place | 
|---|
| 89 |  | 
|---|
| 90 | :not_in_place | 
|---|
| 91 | redir -e /dev/null update %XSRC%/configure.orig ./configure | 
|---|
| 92 | test -f ./configure | 
|---|
| 93 | if errorlevel 1 update %XSRC%/configure ./configure | 
|---|
| 94 |  | 
|---|
| 95 | :in_place | 
|---|
| 96 | Rem Update configuration files | 
|---|
| 97 | echo Updating configuration scripts... | 
|---|
| 98 | test -f ./configure.orig | 
|---|
| 99 | if errorlevel 1 update configure configure.orig | 
|---|
| 100 | sed -f %XSRC%/djgpp/config.sed configure.orig > configure | 
|---|
| 101 | if errorlevel 1 goto sed_error | 
|---|
| 102 |  | 
|---|
| 103 | Rem Make sure they have a config.site file | 
|---|
| 104 | set CONFIG_SITE=%XSRC%/djgpp/config.site | 
|---|
| 105 | if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto small_env | 
|---|
| 106 |  | 
|---|
| 107 | Rem Make sure crucial file names are not munged by unpacking | 
|---|
| 108 | test -f %XSRC%/po/Makefile.in.in | 
|---|
| 109 | if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in | 
|---|
| 110 | test -f %XSRC%/po/Makefile.am.in | 
|---|
| 111 | if not errorlevel 1 mv -f %XSRC%/po/Makefile.am.in %XSRC%/po/Makefile.am-in | 
|---|
| 112 |  | 
|---|
| 113 | Rem This is required because DOS/Windows are case-insensitive | 
|---|
| 114 | Rem to file names, and "make install" will do nothing if Make | 
|---|
| 115 | Rem finds a file called `install'. | 
|---|
| 116 | if exist INSTALL ren INSTALL INSTALL.txt | 
|---|
| 117 |  | 
|---|
| 118 | Rem Set HOME to a sane default so configure stops complaining. | 
|---|
| 119 | if not "%HOME%" == "" goto host_name | 
|---|
| 120 | set HOME=%XSRC%/djgpp | 
|---|
| 121 | if not "%HOME%" == "%XSRC%/djgpp" goto small_env | 
|---|
| 122 | echo No HOME found in the environment, using default value | 
|---|
| 123 |  | 
|---|
| 124 | :host_name | 
|---|
| 125 | Rem Set HOSTNAME so it shows in config.status | 
|---|
| 126 | if not "%HOSTNAME%" == "" goto hostdone | 
|---|
| 127 | if "%windir%" == "" goto msdos | 
|---|
| 128 | set OS=MS-Windows | 
|---|
| 129 | if not "%OS%" == "MS-Windows" goto small_env | 
|---|
| 130 | goto haveos | 
|---|
| 131 | :msdos | 
|---|
| 132 | set OS=MS-DOS | 
|---|
| 133 | if not "%OS%" == "MS-DOS" goto small_env | 
|---|
| 134 | :haveos | 
|---|
| 135 | if not "%USERNAME%" == "" goto haveuname | 
|---|
| 136 | if not "%USER%" == "" goto haveuser | 
|---|
| 137 | echo No USERNAME and no USER found in the environment, using default values | 
|---|
| 138 | set HOSTNAME=Unknown PC | 
|---|
| 139 | if not "%HOSTNAME%" == "Unknown PC" goto small_env | 
|---|
| 140 | goto userdone | 
|---|
| 141 | :haveuser | 
|---|
| 142 | set HOSTNAME=%USER%'s PC | 
|---|
| 143 | if not "%HOSTNAME%" == "%USER%'s PC" goto small_env | 
|---|
| 144 | goto userdone | 
|---|
| 145 | :haveuname | 
|---|
| 146 | set HOSTNAME=%USERNAME%'s PC | 
|---|
| 147 | if not "%HOSTNAME%" == "%USERNAME%'s PC" goto small_env | 
|---|
| 148 | :userdone | 
|---|
| 149 | set _HOSTNAME=%HOSTNAME%, %OS% | 
|---|
| 150 | if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto small_env | 
|---|
| 151 | set HOSTNAME=%_HOSTNAME% | 
|---|
| 152 | :hostdone | 
|---|
| 153 | set _HOSTNAME= | 
|---|
| 154 | set OS= | 
|---|
| 155 |  | 
|---|
| 156 | Rem install-sh is required by the configure script but clashes with the | 
|---|
| 157 | Rem various Makefile install-foo targets, so we MUST have it before the | 
|---|
| 158 | Rem script runs and rename it afterwards | 
|---|
| 159 | test -f %XSRC%/install-sh | 
|---|
| 160 | if not errorlevel 1 goto no_ren0 | 
|---|
| 161 | test -f %XSRC%/install-sh.sh | 
|---|
| 162 | if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh | 
|---|
| 163 | :no_ren0 | 
|---|
| 164 |  | 
|---|
| 165 | if "%NLS%" == "disabled" goto without_NLS | 
|---|
| 166 |  | 
|---|
| 167 | :with_NLS | 
|---|
| 168 | Rem Check for the needed libraries and binaries. | 
|---|
| 169 | test -x /dev/env/DJDIR/bin/msgfmt.exe | 
|---|
| 170 | if not errorlevel 0 goto missing_NLS_tools | 
|---|
| 171 | test -x /dev/env/DJDIR/bin/xgettext.exe | 
|---|
| 172 | if not errorlevel 0 goto missing_NLS_tools | 
|---|
| 173 | test -f /dev/env/DJDIR/include/libcharset.h | 
|---|
| 174 | if not errorlevel 0 goto missing_NLS_tools | 
|---|
| 175 | test -f /dev/env/DJDIR/lib/libcharset.a | 
|---|
| 176 | if not errorlevel 0 goto missing_NLS_tools | 
|---|
| 177 | test -f /dev/env/DJDIR/include/iconv.h | 
|---|
| 178 | if not errorlevel 0 goto missing_NLS_tools | 
|---|
| 179 | test -f /dev/env/DJDIR/lib/libiconv.a | 
|---|
| 180 | if not errorlevel 0 goto missing_NLS_tools | 
|---|
| 181 | test -f /dev/env/DJDIR/include/libintl.h | 
|---|
| 182 | if not errorlevel 0 goto missing_NLS_tools | 
|---|
| 183 | test -f /dev/env/DJDIR/lib/libintl.a | 
|---|
| 184 | if not errorlevel 0 goto missing_NLS_tools | 
|---|
| 185 |  | 
|---|
| 186 | Rem Recreate the files in the %XSRC%/po subdir with our ported tools. | 
|---|
| 187 | redir -e /dev/null rm %XSRC%/po/*.gmo | 
|---|
| 188 | redir -e /dev/null rm %XSRC%/po/diffutil*.pot | 
|---|
| 189 | redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c | 
|---|
| 190 | redir -e /dev/null rm %XSRC%/po/stamp-cat-id | 
|---|
| 191 |  | 
|---|
| 192 | Rem Update the arguments file for the configure script. | 
|---|
| 193 | Rem We prefer without-included-gettext because libintl.a from gettext package | 
|---|
| 194 | Rem is the only one that is guaranteed to have been ported to DJGPP. | 
|---|
| 195 | echo --enable-nls --without-included-gettext >> arguments | 
|---|
| 196 | goto configure_package | 
|---|
| 197 |  | 
|---|
| 198 | :missing_NLS_tools | 
|---|
| 199 | echo Needed libs/tools for NLS not found.  Configuring without NLS. | 
|---|
| 200 | :without_NLS | 
|---|
| 201 | Rem Update the arguments file for the configure script. | 
|---|
| 202 | echo --disable-nls >> arguments | 
|---|
| 203 |  | 
|---|
| 204 | :configure_package | 
|---|
| 205 | echo Running the ./configure script... | 
|---|
| 206 | sh ./configure @arguments | 
|---|
| 207 | if errorlevel 1 goto cfg_error | 
|---|
| 208 | rm arguments | 
|---|
| 209 |  | 
|---|
| 210 | Rem Remove files created by the gl_FUNC_MKSTEMP test. | 
|---|
| 211 | rm co*.tmp | 
|---|
| 212 | echo Done. | 
|---|
| 213 | goto End | 
|---|
| 214 |  | 
|---|
| 215 | :sed_error | 
|---|
| 216 | echo ./configure script editing failed! | 
|---|
| 217 | goto End | 
|---|
| 218 |  | 
|---|
| 219 | :cfg_error | 
|---|
| 220 | echo ./configure script exited abnormally! | 
|---|
| 221 | goto End | 
|---|
| 222 |  | 
|---|
| 223 | :small_env | 
|---|
| 224 | echo Your environment size is too small.  Enlarge it and run me again. | 
|---|
| 225 | echo Configuration NOT done! | 
|---|
| 226 |  | 
|---|
| 227 | :End | 
|---|
| 228 | test -f %XSRC%/install-sh.sh | 
|---|
| 229 | if not errorlevel 1 goto no_ren1 | 
|---|
| 230 | test -f %XSRC%/install-sh | 
|---|
| 231 | if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh | 
|---|
| 232 | :no_ren1 | 
|---|
| 233 | if "%HOME%" == "%XSRC%/djgpp" set HOME= | 
|---|
| 234 | set ARGS= | 
|---|
| 235 | set CONFIG_SITE= | 
|---|
| 236 | set HOSTNAME= | 
|---|
| 237 | set NLS= | 
|---|
| 238 | set CACHE= | 
|---|
| 239 | set DEPTRAK= | 
|---|
| 240 | set XSRC= | 
|---|