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