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