1@echo off 2echo Configuring GNU libiconv 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 where the sources are 7set XSRC=. 8if not "%XSRC%" == "." goto SmallEnv 9if "%1" == "" goto InPlace 10set XSRC=%1 11if not "%XSRC%" == "%1" goto SmallEnv 12redir -e /dev/null update %XSRC%/configure.orig ./configure 13test -f ./configure 14if errorlevel 1 update %XSRC%/configure ./configure 15test -d ./libcharset 16if errorlevel 1 md libcharset 17redir -e /dev/null update %XSRC%/libcharset/configure.orig ./libcharset/configure 18test -f ./libcharset/configure 19if errorlevel 1 update %XSRC%/libcharset/configure ./libcharset/configure 20 21:InPlace 22Rem Update configuration files 23echo Updating configuration scripts... 24test -f ./configure.orig 25if errorlevel 1 update ./configure ./configure.orig 26sed -f %XSRC%/djgpp/config.sed ./configure.orig > configure 27if errorlevel 1 goto SedError 28test -f ./libcharset/configure.orig 29if errorlevel 1 update ./libcharset/configure ./libcharset/configure.orig 30sed -f %XSRC%/djgpp/config.sed ./libcharset/configure.orig > configure.tmp 31if errorlevel 1 goto SedError 32Rem The following is needed because the toplevel configure script calls the 33Rem %XSRC%/libcharset/configure script instead of ./libcharset/configure. 34test -f %XSRC%/libcharset/configure.orig 35if errorlevel 1 update %XSRC%/libcharset/configure %XSRC%/libcharset/configure.orig 36update configure.tmp %XSRC%/libcharset/configure 37rm ./configure.tmp 38 39Rem Make sure they have a config.site file 40set CONFIG_SITE=%XSRC%/djgpp/config.site 41if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv 42 43Rem Make sure crucial file names are not munged by unpacking 44test -f %XSRC%/config.h.in 45if not errorlevel 1 mv -f %XSRC%/config.h.in %XSRC%/config.h-in 46test -f %XSRC%/lib/config.h.in 47if not errorlevel 1 mv -f %XSRC%/lib/config.h.in %XSRC%/lib/config.h-in 48test -f %XSRC%/libcharset/config.h.in 49if not errorlevel 1 mv -f %XSRC%/libcharset/config.h.in %XSRC%/libcharset/config.h-in 50test -f %XSRC%/libcharset/include/libcharset.h.in 51if not errorlevel 1 mv -f %XSRC%/libcharset/include/libcharset.h.in %XSRC%/libcharset/include/libcharset.h-in 52test -f %XSRC%/include/iconv.h.in 53if not errorlevel 1 mv -f %XSRC%/include/iconv.h.in %XSRC%/include/iconv.h-in 54 55Rem All fixes needed to get the package configured, compiled and tested. 56Rem 1: Change the stateless-check script so it knowns about the 57Rem new filenames. 58Rem 2: Ditto for Makefile.in 59Rem 3: Ditto for source files. 60Rem 4: Change the files contained in the tests subdirectory from 61Rem UNIX-style EOL into DOS-style EOL so the testsuit works. 62 63test -f %XSRC%/stamp-djgppfixes 64if not errorlevel 1 goto TestsuitFixed 65Rem Fix the Makefile.ins. 66test -f %XSRC%/lib/Makefile.orig 67if errorlevel 1 update %XSRC%/lib/Makefile.in %XSRC%/lib/Makefile.orig 68sed -f %XSRC%/djgpp/makefile.sed %XSRC%/lib/Makefile.in > Makefile.tmp 69if errorlevel 1 goto SedError 70update Makefile.tmp %XSRC%/lib/Makefile.in 71rm Makefile.tmp 72test -f %XSRC%/tests/Makefile.orig 73if errorlevel 1 update %XSRC%/tests/Makefile.in %XSRC%/tests/Makefile.orig 74sed -f %XSRC%/djgpp/makefile.sed %XSRC%/tests/Makefile.in > Makefile.tmp 75if errorlevel 1 goto SedError 76update Makefile.tmp %XSRC%/tests/Makefile.in 77rm Makefile.tmp 78 79Rem Fix the source files. 80test -f %XSRC%/lib/iconv.orig 81if errorlevel 1 update %XSRC%/lib/iconv.c %XSRC%/lib/iconv.orig 82sed -f %XSRC%/djgpp/sources.sed %XSRC%/lib/iconv.c > iconv.tmp 83if errorlevel 1 goto SedError 84update iconv.tmp %XSRC%/lib/iconv.c 85rm iconv.tmp 86test -f %XSRC%/lib/converters.orig 87if errorlevel 1 update %XSRC%/lib/converters.h %XSRC%/lib/converters.orig 88sed -f %XSRC%/djgpp/sources.sed %XSRC%/lib/converters.h > converters.tmp 89if errorlevel 1 goto SedError 90update converters.tmp %XSRC%/lib/converters.h 91rm converters.tmp 92test -f %XSRC%/lib/cns/11643.orig 93if errorlevel 1 update %XSRC%/lib/cns/11643.h %XSRC%/lib/cns/11643.orig 94sed -f %XSRC%/djgpp/sources.sed %XSRC%/lib/cns/11643.h > 11643.tmp 95if errorlevel 1 goto SedError 96update 11643.tmp %XSRC%/lib/cns/11643.h 97rm 11643.tmp 98test -f %XSRC%/lib/cns/11643_4.orig 99if errorlevel 1 update %XSRC%/lib/cns/11643_4.h %XSRC%/lib/cns/11643_4.orig 100sed -f %XSRC%/djgpp/sources.sed %XSRC%/lib/cns/11643_4.h > 11643_4.tmp 101if errorlevel 1 goto SedError 102update 11643_4.tmp %XSRC%/lib/cns/11643_4.h 103rm 11643_4.tmp 104test -f %XSRC%/lib/iso/ir165.orig 105if errorlevel 1 update %XSRC%/lib/iso/ir165.h %XSRC%/lib/iso/ir165.orig 106sed -f %XSRC%/djgpp/sources.sed %XSRC%/lib/iso/ir165.h > ir165.tmp 107if errorlevel 1 goto SedError 108update ir165.tmp %XSRC%/lib/iso/ir165.h 109rm ir165.tmp 110 111Rem Change file's NL to CRLF. 112utod %XSRC%/tests/*.txt 113utod %XSRC%/tests/GEORGIAN/*.txt 114utod %XSRC%/tests/ISO/*.txt 115utod %XSRC%/tests/MAC/*.txt 116 117Rem Fix the test scripts. 118if "%XSRC%" == "." goto NoDirChange 119cd | sed "s|:.*$|:|" > cd_BuildDir.bat 120cd | sed "s|^.:|cd |" >> cd_BuildDir.bat 121mv -f cd_BuildDir.bat %XSRC%/cd_BuildDir.bat 122echo %XSRC% | sed -e "s|^/dev/||" -e "s|/|:|" -e "s|:.*$|:|g" > cd_SrcDir.bat 123echo %XSRC% | sed -e "s|^/dev/||" -e "s|/|:/|" -e "s|^.*:|cd |" -e "s|^\.\.|cd &|" -e "s|/|\\|g" >> cd_SrcDir.bat 124call cd_SrcDir.bat 125call djgpp\edtest.bat 126call cd_BuildDir.bat 127rm -f cd_SrcDir.bat cd_BuildDir.bat %XSRC%/cd_BuildDir.bat 128goto TestsuitFixed 129:NoDirChange 130call djgpp\edtest.bat 131:TestsuitFixed 132touch %XSRC%/stamp-djgppfixes 133 134Rem This is required because DOS/Windows are case-insensitive 135Rem to file names, and "make install" will do nothing if Make 136Rem finds a file called `install'. 137if exist INSTALL mv -f INSTALL INSTALL.txt 138 139Rem install-sh is required by the configure script but clashes with the 140Rem various Makefile install-foo targets, so we MUST have it before the 141Rem script runs and rename it afterwards 142test -f %XSRC%/install-sh 143if not errorlevel 1 goto NoRen0 144test -f %XSRC%/install-sh.sh 145if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh 146:NoRen0 147 148Rem Set HOSTNAME so it shows in config.status 149if not "%HOSTNAME%" == "" goto hostdone 150if "%windir%" == "" goto msdos 151set OS=MS-Windows 152if not "%OS%" == "MS-Windows" goto SmallEnv 153goto haveos 154:msdos 155set OS=MS-DOS 156if not "%OS%" == "MS-DOS" goto SmallEnv 157:haveos 158if not "%USERNAME%" == "" goto haveuname 159if not "%USER%" == "" goto haveuser 160echo No USERNAME and no USER found in the environment, using default values 161set HOSTNAME=Unknown PC 162if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv 163goto userdone 164:haveuser 165set HOSTNAME=%USER%'s PC 166if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv 167goto userdone 168:haveuname 169set HOSTNAME=%USERNAME%'s PC 170if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv 171:userdone 172set _HOSTNAME=%HOSTNAME%, %OS% 173if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv 174set HOSTNAME=%_HOSTNAME% 175:hostdone 176set _HOSTNAME= 177set OS= 178 179Rem With libtool 1.4 -fPIC is the default. This completely breaks compilations 180Rem with djgpp, so we will always use --disable-shared to inhibit the usage of 181Rem -fPIC and -DPIC flags in libtool. 182echo Running the ./configure script... 183sh ./configure --enable-static --disable-shared --src=%XSRC% 184if errorlevel 1 goto CfgError 185echo Done. 186goto End 187 188:SedError 189echo ./configure script editing failed! 190goto End 191 192:CfgError 193echo ./configure script exited abnormally! 194goto End 195 196:SmallEnv 197echo Your environment size is too small. Enlarge it and run me again. 198echo Configuration NOT done! 199 200:End 201test -f %XSRC%/install-sh.sh 202if not errorlevel 1 goto NoRen1 203test -f %XSRC%/install-sh 204if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh 205:NoRen1 206set CONFIG_SITE= 207set HOSTNAME= 208set XSRC= 209