1 @ECHO OFF 2 REM ************************************************************************** 3 REM * 4 REM * configure.bat for setting up compiling STLport under Windows 5 REM * to see available options, call with option --help 6 REM * 7 REM * Copyright (C) 2004,2005 Michael Fink 8 REM * 9 REM ************************************************************************** 10 11 REM Attention! Batch file labels only have 8 significant characters! 12 13 echo STLport Configuration Tool for Windows 14 echo. 15 16 REM no options at all? 17 if NOT "%1xyz123" == "xyz123" goto init 18 19 echo Please specify at least the compiler you are going to use, 20 echo use "configure --help" to see the available ones. 21 goto skp_comp 22 23 :init 24 25 REM initially create/overwrite config.mak 26 echo # STLport Configuration Tool for Windows > build\Makefiles\nmake\config.mak 27 echo # >> build\Makefiles\nmake\config.mak 28 echo # config.mak generated with command line: >> build\Makefiles\nmake\config.mak 29 echo # configure %1 %2 %3 %4 %5 %6 %7 %8 %9 >> build\Makefiles\nmake\config.mak 30 echo # >> build\Makefiles\nmake\config.mak 31 32 REM First parameter can only be help or compiler 33 REM help option 34 if "%1" == "-?" goto opt_help 35 if "%1" == "-h" goto opt_help 36 if "%1" == "/?" goto opt_help 37 if "%1" == "/h" goto opt_help 38 if "%1" == "--help" goto opt_help 39 40 REM This is necessarily a compiler 41 goto opt_comp 42 43 REM 44 REM option loop 45 REM 46 :loop 47 48 REM platform option 49 if "%1" == "-p" goto opt_plat 50 if "%1" == "/p" goto opt_plat 51 if "%1" == "--platform" goto opt_plat 52 53 REM cross compiling 54 if "%1" == "-x" goto opt_x 55 if "%1" == "/x" goto opt_x 56 if "%1" == "--cross" goto opt_x 57 58 REM C runtime library 59 if "%1" == "--with-static-rtl" goto opt_srtl 60 if "%1" == "--with-dynamic-rtl" goto opt_drtl 61 if "%1" == "--rtl-static" goto opt_srtl 62 if "%1" == "--rtl-dynamic" goto opt_drtl 63 64 REM boost support 65 if "%1" == "--use-boost" goto opt_bst 66 67 REM multithreading support 68 if "%1" == "--not-thread-safe" goto opt_st 69 if "%1" == "--without-thread" goto opt_st 70 71 REM rtti support 72 if "%1" == "--no-rtti" goto opt_rtti 73 if "%1" == "--without-rtti" goto opt_rtti 74 75 REM additional compiler options 76 if "%1" == "--extra-cxxflag" goto opt_xtra 77 78 REM library name customization 79 if "%1" == "--lib-motif" goto opt_motf 80 if "%1" == "--with-lib-motif" goto opt_motf 81 82 REM build without STLport 83 if "%1" == "--without-stlport" goto no_sport 84 85 REM clean rule 86 if "%1" == "--clean" goto opt_cln 87 88 echo Unknown option: %1 89 90 :cont_lp 91 echo. 92 shift 93 94 REM no more options? 95 if "%1xyz123" == "xyz123" goto end_loop 96 97 goto loop 98 99 100 REM ************************************************************************** 101 REM * 102 REM * Help 103 REM * 104 REM ************************************************************************** 105 :opt_help 106 echo The first parameter must be the compiler name, here are the available 107 echo keywords: 108 echo. 109 echo msvc6 Microsoft Visual C++ 6.0 110 echo msvc7 Microsoft Visual C++ .NET 2002 111 echo msvc71 Microsoft Visual C++ .NET 2003 112 echo msvc8 Microsoft Visual C++ 2005 113 echo msvc9 Microsoft Visual C++ 2008 114 echo icl Intel C++ Compiler 115 echo evc3 Microsoft eMbedded Visual C++ 3 (*) 116 echo evc4 Microsoft eMbedded Visual C++ .NET (*) 117 echo evc8 Microsoft Visual C++ 2005 compiling for CE 118 echo evc9 Microsoft Visual C++ 2008 compiling for CE 119 echo. 120 echo (*) For these compilers the target processor is determined automatically. 121 echo You must run the WCE*.BAT file you wish to build STLport for before 122 echo running configure. 123 echo. 124 echo Then the following options are available: 125 echo. 126 echo "-p <platform>" or "--platform <platform>" 127 echo Build STLport for the specified platform. Not all existing platforms are 128 echo available, only the ones that make a difference when building STLport are. 129 echo The following keywords are available: 130 echo win95 Windows 95 compatible 131 echo win98 Windows 98 and up to Windows XP excluded 132 echo winxp Windows XP or later (default) 133 echo. 134 echo "-x" 135 echo Enables cross-compiling; the result is that all built files that are 136 echo normally put under "bin" and "lib" get extra subfolders depending on 137 echo the compiler name. 138 echo. 139 echo "--with-static-rtl" 140 echo "--with-dynamic-rtl" 141 echo Enables usage of static (libc.lib family) or dynamic (msvcrt.lib family) 142 echo C/C++ runtime library when linking with STLport. If you want your appli/dll 143 echo to link statically with STLport but using the dynamic C runtime use 144 echo --with-dynamic-rtl; if you want to link dynamicaly with STLport but using the 145 echo static C runtime use --with-static-rtl. See README.options for details. 146 echo Don't forget to signal the link method when building your appli or dll, in 147 echo stlport/stl/config/host.h set the following macro depending on the configure 148 echo option: 149 echo "--with-static-rtl -> _STLP_USE_DYNAMIC_LIB" 150 echo "--with-dynamic-rtl -> _STLP_USE_STATIC_LIB" 151 echo. 152 echo "--use-boost <boost install path>" 153 echo Request use of boost support (www.boost.org). For the moment only the boost 154 echo type_traits library is used to get type information and to implement some 155 echo specific workaround not directly implemented by STLport. To use the same 156 echo support when using STLport for your application don't forget to define 157 echo _STLP_USE_BOOST_SUPPORT in stlport/stl/config/user_config.h file. 158 echo. 159 echo "--without-thread" 160 echo Per default STLport libraries are built in order to be usable in a multithreaded 161 echo context. If you don't need this you can ask for a not thread safe version with 162 echo this option. 163 echo. 164 echo "--without-rtti" 165 echo Remove rtti (run time type information) support if available. 166 echo. 167 echo "--extra-cxxflag <additional compilation options>" 168 echo Use this option to add any compilation flag to the build system. For instance 169 echo it can be used to activate a specific processor optimization depending on your 170 echo processor. For Visual C++ .Net 2003, to activate pentium 3 optim you will use: 171 echo --extra-cxxflag /G7 172 echo If you have several options use several --extra-cxxflag options. For instance 173 echo to also force use of wchar_t as an intrinsic type: 174 echo --extra-cxxflag /G7 --extra-cxxflag /Zc:wchar_t 175 echo. 176 echo "--with-lib-motif <motif>" 177 echo Use this option to customize the generated library name. The motif will be used 178 echo in the last place before version information, separated by an underscore, ex: 179 echo stlportd_MOTIF.5.0.lib 180 echo stlportstld_static_MOTIF.5.1.lib 181 echo Do not forget to define _STLP_LIB_NAME_MOTIF macro in STLport configuration file 182 echo to the same value if you want to keep the auto link feature supported by some 183 echo compilers. 184 echo. 185 echo "--without-stlport" 186 echo Option specially targetting build of the unit tests project without STLport. This 187 echo is a good way to challenge the C++ Standard library implementation comming with 188 echo your compiler with STLport. 189 echo. 190 echo "--clean" 191 echo Removes the build configuration file. 192 goto skp_comp 193 194 REM ************************************************************************** 195 REM * 196 REM * Compiler configuration 197 REM * 198 REM ************************************************************************** 199 :opt_comp 200 201 if "%1" == "msvc6" goto oc_msvc6 202 if "%1" == "msvc71" goto oc_msv71 203 if "%1" == "msvc7" goto oc_msvc7 204 if "%1" == "msvc8" goto oc_msvc8 205 if "%1" == "msvc9" goto oc_msvc9 206 if "%1" == "icl" goto oc_icl 207 208 if "%1" == "evc3" goto oc_evc3 209 if "%1" == "evc4" goto oc_evc4 210 if "%1" == "evc8" goto oc_evc8 211 if "%1" == "evc9" goto oc_evc9 212 213 if "%1" == "watcom" goto oc_wtm 214 215 echo Unknown compiler: %1 216 goto oc_end 217 218 :oc_msvc6 219 :oc_wtm 220 echo Setting compiler: Microsoft Visual C++ 6.0 221 echo COMPILER_NAME=vc6 >> build\Makefiles\nmake\config.mak 222 set SELECTED_COMPILER_VERSION=60 223 goto oc_msvc 224 225 :oc_msvc7 226 echo Setting compiler: Microsoft Visual C++ .NET 2002 227 echo COMPILER_NAME=vc70 >> build\Makefiles\nmake\config.mak 228 set SELECTED_COMPILER_VERSION=70 229 goto oc_msvc 230 231 :oc_msv71 232 echo Setting compiler: Microsoft Visual C++ .NET 2003 233 echo COMPILER_NAME=vc71 >> build\Makefiles\nmake\config.mak 234 set SELECTED_COMPILER_VERSION=71 235 goto oc_msvc 236 237 :oc_msvc8 238 echo Setting compiler: Microsoft Visual C++ 2005 239 echo COMPILER_NAME=vc8 >> build\Makefiles\nmake\config.mak 240 set SELECTED_COMPILER_VERSION=80 241 goto oc_msvc 242 243 :oc_msvc9 244 echo Setting compiler: Microsoft Visual C++ 2008 245 echo COMPILER_NAME=vc9 >> build\Makefiles\nmake\config.mak 246 set SELECTED_COMPILER_VERSION=90 247 goto oc_msvc 248 249 :oc_msvc 250 echo TARGET_OS=x86 >> build\Makefiles\nmake\config.mak 251 set SELECTED_COMPILER=msvc 252 echo !include msvc.mak > .\build\lib\Makefile 253 echo !include msvc.mak > .\build\test\unit\Makefile 254 echo !include msvc.mak > .\build\test\eh\Makefile 255 goto oc_end 256 257 :oc_icl 258 echo Setting compiler: Intel C++ Compiler 259 echo COMPILER_NAME=icl >> build\Makefiles\nmake\config.mak 260 echo TARGET_OS=x86 >> build\Makefiles\nmake\config.mak 261 set SELECTED_COMPILER=icl 262 echo !include icl.mak > .\build\lib\Makefile 263 echo !include icl.mak > .\build\test\unit\Makefile 264 echo !include icl.mak > .\build\test\eh\Makefile 265 goto oc_end 266 267 :oc_evc3 268 echo Setting compiler: Microsoft eMbedded Visual C++ 3 269 echo COMPILER_NAME=evc3 >> build\Makefiles\nmake\config.mak 270 rem TODO: branch on OSVERSION like below? 271 echo CEVERSION=300 >> build\Makefiles\nmake\config.mak 272 set SELECTED_COMPILER_VERSION=3 273 goto oc_evc 274 275 :oc_evc4 276 echo Setting compiler: Microsoft eMbedded Visual C++ .NET 277 echo COMPILER_NAME=evc4 >> build\Makefiles\nmake\config.mak 278 if "%OSVERSION%"=="" ( 279 echo OSVERSION not set, assuming target is CE 4.2 280 echo CEVERSION=420 >> build\Makefiles\nmake\config.mak 281 ) else if "%OSVERSION%"=="WCE400" ( 282 echo CEVERSION=400 >> build\Makefiles\nmake\config.mak 283 ) else if "%OSVERSION%"=="WCE420" ( 284 echo CEVERSION=420 >> build\Makefiles\nmake\config.mak 285 ) else if "%OSVERSION%"=="WCE500" ( 286 echo CEVERSION=500 >> build\Makefiles\nmake\config.mak 287 ) else ( 288 echo Unknown value for OSVERSION. 289 exit /b 1 290 ) 291 set SELECTED_COMPILER_VERSION=4 292 goto oc_evc 293 294 :oc_evc8 295 echo Setting compiler: Microsoft Visual C++ .NET 2005 for Windows CE 296 echo COMPILER_NAME=evc8 >> build\Makefiles\nmake\config.mak 297 set SELECTED_COMPILER_VERSION=80 298 if "%OSVERSION%"=="" ( 299 echo OSVERSION not set, assuming target is CE 5.0 300 echo CEVERSION=500 >> build\Makefiles\nmake\config.mak 301 ) else if "%OSVERSION%"=="WCE400" ( 302 echo CEVERSION=400 >> build\Makefiles\nmake\config.mak 303 ) else if "%OSVERSION%"=="WCE420" ( 304 echo CEVERSION=420 >> build\Makefiles\nmake\config.mak 305 ) else if "%OSVERSION%"=="WCE500" ( 306 echo CEVERSION=500 >> build\Makefiles\nmake\config.mak 307 ) else ( 308 echo Unknown value for OSVERSION. 309 exit /b 1 310 ) 311 set PLATFORM_SPECIFIED=1 312 set SELECTED_COMPILER=msvc 313 echo !include evc.mak > .\build\lib\Makefile 314 echo !include evc.mak > .\build\test\unit\Makefile 315 echo !include evc.mak > .\build\test\eh\Makefile 316 goto proc 317 318 :oc_evc9 319 echo Setting compiler: Microsoft Visual C++ .NET 2008 for Windows CE 320 echo COMPILER_NAME=evc9 >> build\Makefiles\nmake\config.mak 321 set SELECTED_COMPILER_VERSION=90 322 if "%OSVERSION%"=="" ( 323 echo OSVERSION not set, assuming target is CE 5.0 324 echo CEVERSION=500 >> build\Makefiles\nmake\config.mak 325 ) else if "%OSVERSION%"=="WCE400" ( 326 echo CEVERSION=400 >> build\Makefiles\nmake\config.mak 327 ) else if "%OSVERSION%"=="WCE420" ( 328 echo CEVERSION=420 >> build\Makefiles\nmake\config.mak 329 ) else if "%OSVERSION%"=="WCE500" ( 330 echo CEVERSION=500 >> build\Makefiles\nmake\config.mak 331 ) else ( 332 echo Unknown value for OSVERSION. 333 exit /b 1 334 ) 335 set PLATFORM_SPECIFIED=1 336 set SELECTED_COMPILER=msvc 337 echo !include evc.mak > .\build\lib\Makefile 338 echo !include evc.mak > .\build\test\unit\Makefile 339 echo !include evc.mak > .\build\test\eh\Makefile 340 goto proc 341 342 :oc_evc 343 set PLATFORM_SPECIFIED=1 344 set SELECTED_COMPILER=evc 345 echo !include evc.mak > .\build\lib\Makefile 346 echo !include evc.mak > .\build\test\unit\Makefile 347 echo !include evc.mak > .\build\test\eh\Makefile 348 goto proc 349 350 :oc_end 351 goto cont_lp 352 353 354 REM ************************************************************************** 355 REM * 356 REM * Target processor configuration (automatic) 357 REM * 358 REM ************************************************************************** 359 :proc 360 361 if "%TARGETCPU%" == "ARM" goto pr_arm 362 if "%TARGETCPU%" == "ARMV4" goto pr_arm 363 if "%TARGETCPU%" == "ARMV4I" goto pr_arm 364 if "%TARGETCPU%" == "ARMV4T" goto pr_arm 365 366 if "%TARGETCPU%" == "X86" goto pr_x86 367 REM Type from evc3 and/or PocketPC 2002 SDK reported here 368 REM to correctly check the platform: 369 if "%TARGETCPU%" == "X86EMnset CFG=none" goto pr_emul 370 if "%TARGETCPU%" == "x86" goto pr_x86 371 if "%TARGETCPU%" == "emulator" goto pr_emul 372 373 if "%TARGETCPU%" == "R4100" goto pr_mips 374 if "%TARGETCPU%" == "R4111" goto pr_mips 375 if "%TARGETCPU%" == "R4300" goto pr_mips 376 if "%TARGETCPU%" == "MIPS16" goto pr_mips 377 if "%TARGETCPU%" == "MIPSII" goto pr_mips 378 if "%TARGETCPU%" == "MIPSII_FP" goto pr_mips 379 if "%TARGETCPU%" == "MIPSIV" goto pr_mips 380 if "%TARGETCPU%" == "MIPSIV_FP" goto pr_mips 381 382 if "%TARGETCPU%" == "SH3" goto pr_sh3 383 if "%TARGETCPU%" == "SH4" goto pr_sh4 384 385 :pr_err 386 echo Unknown target CPU: %TARGETCPU% 387 goto pr_end 388 389 :pr_arm 390 echo Target processor: ARM 391 echo TARGET_PROC=arm >> build\Makefiles\nmake\config.mak 392 echo TARGET_PROC_SUBTYPE=%TARGETCPU% >> build\Makefiles\nmake\config.mak 393 goto pr_end 394 395 :pr_x86 396 echo Target processor: x86 397 echo TARGET_PROC=x86 >> build\Makefiles\nmake\config.mak 398 goto pr_end 399 400 :pr_emul 401 echo Target processor: Emulator 402 echo TARGET_PROC=x86 >> build\Makefiles\nmake\config.mak 403 echo TARGET_PROC_SUBTYPE=emulator >> build\Makefiles\nmake\config.mak 404 goto pr_end 405 406 :pr_mips 407 echo Target processor: MIPS 408 echo TARGET_PROC=mips >> build\Makefiles\nmake\config.mak 409 echo TARGET_PROC_SUBTYPE=%TARGETCPU% >> build\Makefiles\nmake\config.mak 410 411 goto pr_end 412 413 :pr_sh3 414 echo Target processor: %TARGETCPU% 415 echo TARGET_PROC=sh3 >> build\Makefiles\nmake\config.mak 416 goto pr_end 417 418 :pr_sh4 419 echo Target processor: %TARGETCPU% 420 echo TARGET_PROC=sh4 >> build\Makefiles\nmake\config.mak 421 goto pr_end 422 423 :pr_end 424 goto oc_end 425 426 427 REM ************************************************************************** 428 REM * 429 REM * Platform configuration 430 REM * 431 REM ************************************************************************** 432 :opt_plat 433 434 if "%2" == "win95" goto op_win95 435 if "%2" == "win98" goto op_win98 436 if "%2" == "winxp" goto op_winxp 437 438 echo Unknown platform: %2 439 goto op_end 440 441 :op_win95 442 echo Setting platform: Windows 95 443 echo WINVER=0x0400 >> build\Makefiles\nmake\config.mak 444 set PLATFORM_SPECIFIED=1 445 goto op_end 446 447 :op_win98 448 echo Setting platform: Windows 98 449 echo WINVER=0x0410 >> build\Makefiles\nmake\config.mak 450 set PLATFORM_SPECIFIED=1 451 goto op_end 452 453 :op_winxp 454 echo Setting platform: Windows XP 455 echo WINVER=0x0501 >> build\Makefiles\nmake\config.mak 456 set PLATFORM_SPECIFIED=1 457 goto op_end 458 459 :op_end 460 shift 461 462 goto cont_lp 463 464 465 REM ************************************************************************** 466 REM * 467 REM * Cross Compiling option 468 REM * 469 REM ************************************************************************** 470 471 :opt_x 472 echo Setting up for cross compiling. 473 echo CROSS_COMPILING=1 >> build\Makefiles\nmake\config.mak 474 goto cont_lp 475 476 477 REM ************************************************************************** 478 REM * 479 REM * C runtime library selection 480 REM * 481 REM ************************************************************************** 482 483 :opt_srtl 484 if "%SELECTED_COMPILER%" == "msvc" goto or_sok 485 goto or_err 486 487 :opt_drtl 488 if "%SELECTED_COMPILER%" == "msvc" goto or_dok 489 goto or_err 490 491 :or_err 492 echo Error: Setting C runtime library for compiler other than microsoft ones! 493 goto or_end 494 495 :or_sok 496 echo Selecting static C runtime library for STLport 497 echo WITH_STATIC_RTL=1 >> build\Makefiles\nmake\config.mak 498 goto or_end 499 500 :or_dok 501 echo Selecting dynamic C runtime library for STLport 502 echo WITH_DYNAMIC_RTL=1 >> build\Makefiles\nmake\config.mak 503 goto or_end 504 505 :or_end 506 goto cont_lp 507 508 REM ************************************************************************** 509 REM * 510 REM * boost support 511 REM * 512 REM ************************************************************************** 513 :opt_bst 514 REM if (Exists("%2")) goto ob_ok 515 REM if !("%2" == "") goto ob_ok 516 goto ob_ok 517 518 echo Error: Invalid boost intallation folder ("%2"). 519 goto ob_end 520 521 :ob_ok 522 echo Activating boost support using "%2" path 523 echo STLP_BUILD_BOOST_PATH="%2" >> build\Makefiles\nmake\config.mak 524 525 :ob_end 526 shift 527 528 goto cont_lp 529 530 REM ************************************************************************** 531 REM * 532 REM * Multithreading support 533 REM * 534 REM ************************************************************************** 535 :opt_st 536 echo Removing thread safety support 537 echo WITHOUT_THREAD=1 >> build\Makefiles\nmake\config.mak 538 goto cont_lp 539 540 REM ************************************************************************** 541 REM * 542 REM * rtti support 543 REM * 544 REM ************************************************************************** 545 :opt_rtti 546 echo Removing rtti support 547 echo WITHOUT_RTTI=1 >> build\Makefiles\nmake\config.mak 548 goto cont_lp 549 550 REM ************************************************************************** 551 REM * 552 REM * Extra compilation flags 553 REM * 554 REM ************************************************************************** 555 :opt_xtra 556 echo Adding '%2' compilation option 557 if "%ONE_OPTION_ADDED%" == "1" goto ox_n 558 559 echo DEFS = %2 >> build\Makefiles\nmake\config.mak 560 set ONE_OPTION_ADDED=1 561 goto ox_end 562 563 :ox_n 564 echo DEFS = $(DEFS) %2 >> build\Makefiles\nmake\config.mak 565 566 :ox_end 567 shift 568 goto cont_lp 569 570 REM ************************************************************************** 571 REM * 572 REM * Library name configuration 573 REM * 574 REM ************************************************************************** 575 :opt_motf 576 echo Using '%2' in generated library names 577 578 echo LIB_MOTIF = %2 >> build\Makefiles\nmake\config.mak 579 580 shift 581 goto cont_lp 582 583 REM ************************************************************************** 584 REM * 585 REM * Build without STLport 586 REM * 587 REM ************************************************************************** 588 :no_sport 589 echo Configured to build without STLport 590 591 echo WITHOUT_STLPORT=1 >> build\Makefiles\nmake\config.mak 592 593 shift 594 goto cont_lp 595 596 REM ************************************************************************** 597 REM * 598 REM * Clean 599 REM * 600 REM ************************************************************************** 601 :opt_cln 602 del build\Makefiles\nmake\config.mak 603 echo STLport configuration file removed. 604 goto skp_comp 605 606 REM ************************************************************************** 607 REM * 608 REM * End loop 609 REM * 610 REM ************************************************************************** 611 612 :end_loop 613 614 if "%PLATFORM_SPECIFIED%" == "1" goto comp 615 echo Setting platform: Windows XP 616 echo. 617 echo WINVER=0x0501 >> build\Makefiles\nmake\config.mak 618 619 :comp 620 echo Done configuring STLport. 621 echo. 622 echo Go to build/lib folder and type "nmake clean install" to build and 623 echo install STLport to the "lib" and "bin" folders. 624 echo Go to build/test/unit folder and type nmake clean install to 625 echo build unit tests and install them in bin folder. 626 echo. 627 628 :skp_comp 629 set SELECTED_COMPILER= 630 set SELECTED_COMPILER_VERSION= 631 set ONE_OPTION_ADDED= 632 set PLATFORM_SPECIFIED= 633