@echo off
if exist patch_ok goto patch_done
echo Applying DJGPP specific patches ...
patch < diffs.djg
touch patch_ok
:patch_done

if exist binutils\Makefile.ori goto first_ok
echo copying binutils/Makefile.in to binutils/Makefile.ori ...
cp -p binutils/Makefile.in binutils/Makefile.ori
echo and patching it ...
sed 's,c++filt,cxxfilt,g' binutils/Makefile.ori > binutils\Makefile.in
:first_ok

echo export PATH_SEPARATOR=:>_
echo export PATH_EXPAND=Y>>_
echo export CC=gcc>>_
echo sh configure --prefix=\\\${DJDIR} --enable-shared=no --verbose $*>>_
echo Running the configure script ...

sh _ %1 %2 %3 %4 %5 %6 %7 %8 %9

echo Now you can type
echo make
echo to build all the binutils stuff

