@echo off



rem %1: compiler

rem %2: "dll" (optional)



set cc=unknown



if "%1" == "gcc"       set cc=gcc

if "%1" == "emx"       set cc=gcc

if "%1" == "bcc"       set cc=bcc

if "%1" == "borland"   set cc=bcc

if "%1" == "ztc"       set cc=ztc

if "%1" == "zortech"   set cc=ztc

if "%1" == "wcc"       set cc=wcc

if "%1" == "watcom"    set cc=wcc

if "%1" == "msc"       set cc=msc

if "%1" == "msvc"      set cc=msc

if "%1" == "microsoft" set cc=msc

if "%1" == "icc"       set cc=icc

if "%1" == "cset"      set cc=icc

if "%1" == "ibm"       set cc=icc



set sys=dos

if not "%windir%"    == "" set sys=win32

if not "%os2_shell%" == "" set sys=os2





if not exist confdir\%sys%\%cc%\make.src goto :usage



if "%2" == "" goto :no_dll

if not "%2" == "dll" goto :usage

if not exist confdir\%sys%dll\%cc%\make.src goto  :dll_error

:no_dll





if exist leda.lic del leda.lic > NUL

confdir\util\%sys%\license.exe leda.lic

if not exist leda.lic goto :quit





echo @echo off                                  > def.tmp

if %sys% == win32 echo set wdir=mswin          >> def.tmp

if %sys% == os2   echo set wdir=os2            >> def.tmp

if %sys% == dos   echo set wdir=vga            >> def.tmp

if %cc% == wcc    echo set make=wmake -u -h    >> def.tmp

if %cc% == msc    echo set make=nmake -nologo  >> def.tmp

if %cc% == bcc    echo set make=make           >> def.tmp

if %cc% == ztc    echo set make=make           >> def.tmp

if %cc% == gcc    echo set make=make           >> def.tmp

if %cc% == icc    echo set make=nmake -nologo  >> def.tmp

copy def.tmp + confdir\make\make_lib.bat  make_lib.bat  > NUL

copy def.tmp + confdir\make\make_pro.bat  make_pro.bat  > NUL

copy def.tmp + confdir\make\make_demo.bat make_demo.bat > NUL

del def.tmp > NUL





if "%2" == "dll" goto :start_dll

echo.

set config_dir=confdir\%sys%\%cc%

echo.

echo Setting up makefiles to build static libraries for %sys% with %cc% ...

goto :end_dll

:start_dll

set config_dir=confdir\%sys%dll\%cc%

echo.

echo Setting up makefiles to build DLL's for %sys% with %cc% ...

echo make_dll >> make_lib.bat

copy %config_dir%\make_dll.* . > NUL

copy %config_dir%\makefile sources  > NUL

:end_dll





copy %config_dir%\make.src src  > NUL

copy %config_dir%\make.pro prog > NUL

copy %config_dir%\make.pro test > NUL

copy %config_dir%\make.pro demo > NUL







REM Replace "include" by "!include" for borland and watcom makefiles



if %cc% == gcc goto :skip1

if %cc% == ztc goto :skip1

if %cc% == msc goto :skip1

if %cc% == icc goto :skip1



copy confdir\util\%sys%\replinc.exe . > NUL



replinc src\basic\makefile

replinc src\basic_alg\makefile

replinc src\numbers\makefile

replinc src\dict\makefile

replinc src\prio\makefile

replinc src\graph\makefile

replinc src\graph_alg\makefile

replinc src\graph_draw\makefile

replinc src\plane\makefile

replinc src\plane_alg\makefile

replinc src\d3_geo\makefile

replinc src\window\makefile

replinc src\graphwin\makefile

replinc src\mswin\makefile

replinc src\os2\makefile

replinc src\all\makefile



replinc prog\basic\makefile

replinc prog\numbers\makefile

replinc prog\dict\makefile

replinc prog\prio\makefile

replinc prog\graph\makefile

replinc prog\plane\makefile

replinc prog\window\makefile

replinc prog\demo\makefile



replinc test\basic\makefile

replinc test\numbers\makefile

replinc test\dict\makefile

replinc test\graph\makefile

replinc test\plane\makefile

replinc test\window\makefile



replinc demo\graph\makefile

replinc demo\geo\makefile

replinc demo\d3_geo\makefile

replinc demo\win\makefile

replinc demo\mswin\makefile

replinc demo\stl\makefile



del replinc.exe > NUL



:skip1





if not %cc% == msc   goto :skip2

if not "%2" == "dll" goto :skip2

chdir incl\leda

copy msc_dll\*.h . > NULL

cd ..\..

:skip2





REM copy special window makefiles and resources (if present)



if not exist %config_dir%\makefile.win goto :skip3

copy %config_dir%\makefile.win prog\window\makefile    > NUL

copy %config_dir%\makefile.win prog\demo\makefile      > NUL

copy %config_dir%\makefile.win demo\geo\makefile       > NUL

copy %config_dir%\makefile.win demo\graph\makefile     > NUL

copy %config_dir%\makefile.win demo\win\makefile       > NUL

:skip3



if not exist confdir\%sys%\rc\leda.rc goto :skip4

copy confdir\%sys%\rc\leda.* prog\demo      > NUL

copy confdir\%sys%\rc\leda.* prog\window    > NUL

copy confdir\%sys%\rc\leda.* demo\geo       > NUL

copy confdir\%sys%\rc\leda.* demo\graph     > NUL

copy confdir\%sys%\rc\leda.* demo\win       > NUL

:skip4



echo.

echo Now type "make_lib" to build the LEDA libraries.

echo.



goto :quit





:usage

echo.

echo Usage: lconfig cc [dll]

echo.

echo Possible compilers (cc) under %sys%:

echo.



if %sys% == win32 goto :win32

if %sys% == os2   goto :os2

if %sys% == dos   goto :dos



:win32

echo bcc : Borland C++           (version  5.x)

echo gcc : GNU C++ (emx)         (version  2.7)

echo msc : Microsoft Visual C++  (version  4.x)

echo wcc : Watcom C++            (version 10.x)

echo.

goto :quit



:os2

echo wcc : Watcom C++

echo icc : IBM Cset

echo gcc : GNU C++ (emx)

echo.

goto :quit



:dos

echo wcc : watcom

echo gcc : emx

echo ztc : zortech

echo.

goto :quit





:dll_error

if not %sys% == win32 goto :dll_error1

confdir\util\win32\dll_msg.exe

goto :quit

:dll_error1

echo.

echo Sorry, support for Dynamic Link Libraries is not included in the

echo LEDA research version. DLL's for use with Microsoft, Borland,

echo and Watcom compilers for Win32 (NT/95) and OS/2 are distributed by 

echo the LEDA Software GmbH. For more information please contact

echo.

echo                LEDA Software GmbH 

echo                Postfach 151101 

echo                66041 Saarbruecken 

echo                Germany

echo                email:leda@mpi-sb.mpg.de

echo                fax: +49 681 842502

echo.

goto:quit





:quit

set cc=

set sys=

set config_dir=



