@rem configure.cmd
@echo off
set w=pm
:loop
if "%1"=="" goto start
if "%1"=="--help" goto help
if "%1"=="--with-x" goto with_x
if "%1"=="--with-pm" goto with_pm
echo configure: unknown option: %1
echo For more information, type "configure --help".
goto end

:with_x
set w=x
goto next

:with_pm
set w=pm
goto next

:help
echo Options:
echo   --with-x         use the X Window System
echo   --with-pm        use the Presentation Manager (default)
goto end

:next
shift
goto loop

:start
@echo on
sed -f emx\emx1.sed src\paths.in >src\paths.h
sed -f emx\emx2.sed src\config.in >src\config.tmp
sed -f emx\emx2-%w%.sed src\config.tmp >src\config.h
del src\config.tmp
sed -f emx\emx3.sed src\Makefile.in >src\Makefile.tmp
sed -f emx\emx3-%w%.sed src\Makefile.tmp >src\Makefile.c
del src\Makefile.tmp
sed -f emx\emx4.sed lib-src\Makefile.in >lib-src\Makefile.c
if %w%==x sed -f emx\emx7.sed lwlib\Makefile.in >lwlib\Makefile
cd lib-src
sed -e "/start of cpp stuff/q" <Makefile.c >junk1.c
sed -e "1,/start of cpp stuff/d" -e "s@/\*\*/#\(.*\)$@/* \1 */@" <Makefile.c >junk.c
gcc -E -I. -undef junk.c | sed -f ..\emx\emx6.sed >junk2.c
cat junk1.c junk2.c >Makefile.new
chmod 444 Makefile.new
mv -f Makefile.new Makefile
rm -f junk.c junk1.c junk2.c
cd ..
cd src
sed -e "/start of cpp stuff/q" <Makefile.c >junk1.c
sed -e "1,/start of cpp stuff/d" -e "s@/\*\*/#\(.*\)$@/* \1 */@" <Makefile.c >junk.c
gcc -E -I. -undef junk.c | sed -f ..\emx\emx5.sed | sed -f ..\emx\emx5-%w%.sed >junk2.c
cat junk1.c junk2.c >Makefile.new
chmod 444 Makefile.new
mv -f Makefile.new Makefile
rm -f junk.c junk1.c junk2.c
cd ..
@echo off
:end
set w=
