summaryrefslogtreecommitdiffstats
path: root/intl/icu/source/runConfigureICU
blob: 00a56872979f65952a4a0fb94f9a28252cece253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
#!/bin/sh
# Copyright (C) 2016 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
# Copyright (c) 1999-2015, International Business Machines Corporation and
# others. All Rights Reserved.

# runConfigureICU: This script will run the "configure" script for the appropriate platform
# Only supported platforms are recognized

me=`basename $0`
OPTS=

usage()
{
    ec=0$1
    if test $ec -eq 0
    then
        uletter=U
    else
        uletter=u
    fi

    echo "${uletter}sage: $me [ -h, --help ]  [ --enable-debug | --disable-release ] platform [ configurearg ... ]"
    if test $ec -eq 0
    then
        cat <<EOE

Options: -h, --help         Print this message and exit
         --enable-debug     Enable support for debugging
         --disable-release  Disable presetting optimization flags

If you want to add custom CFLAGS or CXXFLAGS or similar, provide them _before_
the runConfigureICU command:

    CXXFLAGS=xyz path/to/runConfigureICU --enable-debug ...

The following names can be supplied as the argument for platform:

    AIX                 Use the IBM XL xlclang/xlclang compilers on AIX
    AIX/GCC             Use the GNU gcc/g++ compilers on AIX
    AIX/OpenXL          Use the IBM Open XL ibm-clang_r/ibm-clang++_r compilers on AIX
    Cygwin              Use the GNU gcc/g++ compilers on Cygwin
    Cygwin/MSVC         Use the Microsoft Visual C++ compiler on Cygwin
    Cygwin/MSVC2005     Use the Microsoft Visual C++ 2005 compiler on Cygwin
    Cygwin/ICL          Use the Intel C++ compiler on Cygwin
    FreeBSD             Use the clang/clang++ or GNU gcc/g++ compilers on FreeBSD
    HP-UX/ACC           Use the HP ANSI C/Advanced C++ compilers on HP-UX 11
    IBMi                Use the iCC compilers on IBM i, i5/OS, OS/400
    Linux               Use the clang/clang++ or GNU gcc/g++ compilers on Linux
    Linux/gcc           Use the GNU gcc/g++ compilers on Linux
    Linux/ECC           Use the Intel ECC compiler on Linux
    Linux/ICC           Use the Intel ICC compiler on Linux
    Linux/VA            Use the IBM XL compiler on Power PC Linux
    MacOSX              Use the default compilers on MacOS X (Darwin)
    MacOSX/GCC          Use the GNU gcc/g++ compilers on MacOSX (Darwin)
    MinGW               Use the GNU gcc/g++ compilers on MinGW
    MSYS/MSVC           Use the Microsoft Visual C++ compiler on MSYS
    QNX                 Use the QNX QCC compiler on QNX/Neutrino
    Solaris             Use the Sun cc/CC compilers on Solaris
    Solaris/GCC         Use the GNU gcc/g++ compilers on Solaris
    SolarisX86          Use the Sun cc/CC compilers on Solaris x86
    TRU64V5.1/CXX       Use the Compaq cxx compiler on Tru64 (OSF)
    zOS                 Use the IBM cxx compiler on z/OS (os/390)
    zOSV1R2             Use the IBM cxx compiler for z/OS 1.2
EOE
    fi

    exit $ec
}

# Parse arguments

platform=
debug=0
release=1

while test $# -ne 0
do
    case "$1" in
    -h|--help)
        usage 0
        ;;
    --enable-debug)
        debug=1
        OPTS="$OPTS --enable-debug"
        ;;
    --disable-release)
        release=0
        OPTS="$OPTS --disable-release"
        ;;
    *)
        platform="$1"
        shift
        break
        ;;
    esac
    shift
done

if test x$platform = x
then
   usage 1
fi

# Go.

rm -f config.cache
rm -f config.log
rm -f config.status

DEBUG_CFLAGS='-g'
DEBUG_CXXFLAGS='-g'

if test x$configure = x
then
    if test -f ./configure
    then
        configuredir=.
    else
        configuredir=`echo $0 | sed 's,[^/]*$,,'`
        if test x$configuredir = x$0
        then
            configuredir=.
        fi
    fi

    if test x$configuredir = x
    then
        configuredir=.
    fi

    configure=$configuredir/configure
fi

case $platform in
    AIX)
        THE_OS=AIX
        THE_COMP="xlclang"
        CC=`which xlclang`; export CC
        if [ ! -x $CC ]; then
           echo "ERROR: xlclang was not found, please check the PATH to make sure it is correct."; exit 1
        fi
        CXX=`which xlclang++`; export CXX
        if [ ! -x $CXX ]; then
           echo "ERROR: xlclang++ was not found, please check the PATH to make sure it is correct."; exit 1
        fi
        RELEASE_CFLAGS="-O3 -qstrict=ieeefp"
        RELEASE_CXXFLAGS="-O3 -qstrict=ieeefp"
        ;;
    AIX/GCC)
        THE_OS=AIX
        THE_COMP="the GNU C++"
        CC=gcc; export CC
        CXX=g++; export CXX
        DEBUG_CFLAGS='-g -O0'
        DEBUG_CXXFLAGS='-g -O0'
        ;;
    AIX/OpenXL)
        THE_OS=AIX
        THE_COMP="ibm-clang_r"
        CC=`which ibm-clang_r`; export CC
        if [ ! -x $CC ]; then
           echo "ERROR: ibm-clang_r was not found, please check the PATH to make sure it is correct."; exit 1
        fi
        CXX=`which ibm-clang++_r`; export CXX
        if [ ! -x $CXX ]; then
           echo "ERROR: ibm-clang++_r was not found, please check the PATH to make sure it is correct."; exit 1
        fi
        RELEASE_CFLAGS="-O3"
        RELEASE_CXXFLAGS="-O3"
	;;
    Solaris)
        THE_OS=SOLARIS
        THE_COMP="Sun's CC"
        CC=`which cc`; export CC
        CXX=`which CC`; export CXX
        RELEASE_CFLAGS="-xO1 -xlibmil"
        RELEASE_CXXFLAGS="-O4 -xlibmil"
        ;;
    Solaris/GCC)
        THE_OS=SOLARIS
        THE_COMP="the GNU C++"
        CC=gcc; export CC
        CXX=g++; export CXX
        RELEASE_CFLAGS=-O1
        RELEASE_CXXFLAGS=-O2
        ;;
    SolarisX86)
        THE_OS="SOLARIS X86"
        THE_COMP="Sun's CC"
        CC=`which cc`; export CC
        CXX=`which CC`; export CXX
        LDFLAGS="${LDFLAGS} -lCrun";export LDFLAGS
        RELEASE_CFLAGS=-xO3
        RELEASE_CXXFLAGS=-O3
        ;;
    HP-UX/ACC)
        THE_OS="HP-UX 11"
        THE_COMP="aCC"
        CC=cc; export CC
        CXX=aCC; export CXX
        RELEASE_CFLAGS='+O2 +Ofltacc'
        RELEASE_CXXFLAGS='+O2 +Ofltacc'
        ;;
    IBMi)
        THE_OS="IBM i"
        THE_COMP="the iCC C++"
        CC=icc; export CC
        CXX=icc; export CXX
        CPP="$CC -c -qpponly"; export CPP
        MAKE=gmake; export MAKE
        U_MAKE=gmake; export U_MAKE
        # gmake is a .pgm and may not be on the path.  Don't use a full path, just use gmake.
        ac_cv_path_U_MAKE=gmake; export ac_cv_path_U_MAKE
        RELEASE_CFLAGS='-O4'
        RELEASE_CXXFLAGS='-O4'
        ;;
    Linux/ECC)
        THE_OS="Linux"
        THE_COMP="Intel ECC 7.1"
        CC=ecc; export CC
        CXX=ecpc; export CXX
        RELEASE_CFLAGS='-O2'
        RELEASE_CXXFLAGS='-O2'
        ;;
    Linux/ICC)
        THE_OS="Linux"
        CC=`which icc`; export CC
        CXX=`which icpc`; export CXX
	ICC_VER=`${CC} -v 2>&1`
        RELEASE_CFLAGS='-O'
        RELEASE_CXXFLAGS='-O'
        export CFLAGS="-fp-model precise"
        export CXXFLAGS="-fp-model precise"
	if [ "${ICC_VER}" = "Version 9.0 " ]; then
		RELEASE_CFLAGS=''
		RELEASE_CXXFLAGS=''
		export CFLAGS="${CFLAGS} -O0"
		export CXXFLAGS="${CXXFLAGS} -O0"
		echo "ICC 9.0 does not work with optimization- disabling optimizations"
	fi
        THE_COMP="Intel ${ICC_VER}"
        ;;
    Linux/VA)
        THE_OS="Linux"
        THE_COMP="IBM XL C++ Compiler"
        CC=`which xlclang`; export CC
        CXX=`which xlclang++`; export CXX
        RELEASE_CFLAGS="-O3"
        RELEASE_CXXFLAGS="-O3"
        ;;
    Linux/gcc)
        THE_OS="Linux"
        THE_COMP="the GNU C++"
        CC=gcc; export CC
        CXX=g++; export CXX
        RELEASE_CFLAGS='-O3'
        RELEASE_CXXFLAGS='-O3'
        DEBUG_CFLAGS='-g'
        DEBUG_CXXFLAGS='-g'
        ;;
    Linux*)
        THE_OS="Linux"
        THE_COMP="the clang or else GNU C++"
        RELEASE_CFLAGS='-O3'
        RELEASE_CXXFLAGS='-O3'
        DEBUG_CFLAGS='-g'
        DEBUG_CXXFLAGS='-g'
        ;;
    Cygwin)
        THE_OS="Cygwin"
        THE_COMP="the GNU C++"
        RELEASE_CFLAGS='-O3'
        RELEASE_CXXFLAGS='-O3'
        ;;
    Cygwin/MSVC)
        THE_OS="Windows with Cygwin"
        THE_COMP="Microsoft Visual C++"
        CC=cl; export CC
        CXX=cl; export CXX
        RELEASE_CFLAGS='-Gy -MD'
        RELEASE_CXXFLAGS='-Gy -MD'
        DEBUG_CFLAGS='-FS -Zi -MDd'
        DEBUG_CXXFLAGS='-FS -Zi -MDd'
        DEBUG_LDFLAGS='-DEBUG'
        ;;
    Cygwin/MSVC2005)
        THE_OS="Windows with Cygwin"
        THE_COMP="Microsoft Visual C++ 2005"
        CC=cl; export CC
        CXX=cl; export CXX
        RELEASE_CFLAGS='/Gy /MD'
        RELEASE_CXXFLAGS='/Gy /MD'
        DEBUG_CFLAGS='/Zi /MDd'
        DEBUG_CXXFLAGS='/Zi /MDd'
        DEBUG_LDFLAGS='/DEBUG'
        ;;
    Cygwin/ICL)
        THE_OS="Windows with Cygwin"
        THE_COMP="Intel C++"
        CC=icl; export CC
        CXX=icl; export CXX
        # The Intel compiler has optimization bugs. So we disable optimization.
        RELEASE_CFLAGS='/Od'
        RELEASE_CXXFLAGS='/Od'
        DEBUG_CFLAGS='/Zi'
        DEBUG_CXXFLAGS='/Zi'
        DEBUG_LDFLAGS='/DEBUG'
        ;;
    MacOSX)
        THE_OS="MacOS X (Darwin)"
        THE_COMP="the default"
        RELEASE_CFLAGS='-O2'
        RELEASE_CXXFLAGS='-O2'
        DEBUG_CFLAGS='-g -O0'
        DEBUG_CXXFLAGS='-g -O0'
        ;;
    MacOSX/GCC)
        THE_OS="MacOS X (Darwin)"
        THE_COMP="the GNU C++"
        RELEASE_CFLAGS='-O2'
        RELEASE_CXXFLAGS='-O2'
        DEBUG_CFLAGS='-g -O0'
        DEBUG_CXXFLAGS='-g -O0'
        CC=gcc; export CC
        CXX=g++; export CXX
        ;;
    MinGW)
        THE_OS="MinGW"
        THE_COMP="the GNU C++"
        RELEASE_CFLAGS='-O3'
        RELEASE_CXXFLAGS='-O3'
        export CXXFLAGS
        ;;
    MSYS/MSVC)
        THE_OS="MSYS"
        THE_COMP="Microsoft Visual C++"
        CC=cl; export CC
        CXX=cl; export CXX
        RELEASE_CFLAGS='-Gy -MD'
        RELEASE_CXXFLAGS='-Gy -MD'
        DEBUG_CFLAGS='-FS -Zi -MDd'
        DEBUG_CXXFLAGS='-FS -Zi -MDd'
        DEBUG_LDFLAGS='-DEBUG'
        ;;
    *BSD)
        THE_OS="BSD"
        THE_COMP="the GNU C++"
        DEBUG_CFLAGS='-g -O0'
        DEBUG_CXXFLAGS='-g -O0'
        ;;
    TRU64V5.1/CXX)
        THE_OS="OSF1"
        THE_COMP="Compaq cxx"
        CC=cc; export CC
        CXX=cxx; export CXX
        ;;
    QNX)
        THE_OS="QNX"
        THE_COMP="QNX cc"
        CC=qcc; export CC
        CXX=QCC; export CXX
        ;;
    zOS)
        THE_OS="z/OS (OS/390)"
        THE_COMP="z/OS C/C++"
        CC=xlc; export CC
        CXX=xlC; export CXX
        RELEASE_CFLAGS="-O2 -Wc,'inline(AUTO,NOREPORT,1000,8000)'"
        RELEASE_CXXFLAGS="-O2 -Wc,'inline(AUTO,NOREPORT,1000,8000)'"
        ;;
    zOSV1R2)
        THE_OS="z/OS 1.2"
        THE_COMP="z/OS 1.2 C/C++"
        CC=cc; export CC
        CXX=cxx; export CXX
        export COMPILE_LINK_ENVVAR='_CXX_CICC_VER}=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000'
        export _CXX_CVERSION=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000
        export LDFLAGS="-Wl,'compat=pm3'"
        export CFLAGS="-Wc,'target(zOSV1R2)'"
        export CXXFLAGS="-Wc,'target(zOSV1R2)'"
        RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
        RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
        ;;
    *)
        >&2 echo "$me: unrecognized platform \"$platform\" (use --help for help)"
        exit 1;;
esac


# Tweak flags

if test $release -eq 1
then
    if test "$RELEASE_CFLAGS" = ""
    then
        case $CC in
            gcc|*/gcc|*-gcc-*|*/*-gcc-*)
                RELEASE_CFLAGS=-O3
                ;;
        esac
    fi
    if test "$RELEASE_CFLAGS" != ""
    then
        CFLAGS="$RELEASE_CFLAGS $CFLAGS"
    fi
    if test "$RELEASE_CXXFLAGS" = ""
    then
        case $CXX in
            g++|*/g++|*-g++-*|*/*-g++-*)
                RELEASE_CXXFLAGS=-O3
                ;;
        esac
    fi
    if test "$RELEASE_CXXFLAGS" != ""
    then
        CXXFLAGS="$RELEASE_CXXFLAGS $CXXFLAGS"
    fi
    if test "$RELEASE_LDFLAGS" != ""
    then
        LDFLAGS="$RELEASE_LDFLAGS $LDFLAGS"
    fi
fi

if test $debug -eq 1
then
    if test "$DEBUG_CFLAGS" != ""
    then
        CFLAGS="$DEBUG_CFLAGS $CFLAGS"
    fi
    if test "$DEBUG_CXXFLAGS" != ""
    then
        CXXFLAGS="$DEBUG_CXXFLAGS $CXXFLAGS"
    fi
    if test "$DEBUG_LDFLAGS" != ""
    then
        LDFLAGS="$DEBUG_LDFLAGS $LDFLAGS"
    fi
fi

export CFLAGS
export CXXFLAGS
export LDFLAGS

# Run configure

echo "export CPP=$CPP CC=$CC CXX=$CXX CPPFLAGS=$CPPFLAGS CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS MAKE=$MAKE"
echo "Running ./configure $OPTS $@ for $THE_OS using $THE_COMP compiler"
echo
if $configure $OPTS $@
then
	echo
	echo If the result of the above commands looks okay to you, go to the directory
	echo source in the ICU distribution to build ICU. Please remember that ICU needs
	echo GNU make to build properly...
else
	echo $0: ./configure failed
	exit 1
fi