]>
Commit | Line | Data |
---|---|---|
b75a7d8f | 1 | #!/bin/sh |
b331163b | 2 | # Copyright (c) 1999-2014, International Business Machines Corporation and |
b75a7d8f A |
3 | # others. All Rights Reserved. |
4 | ||
5 | # runConfigureICU: This script will run the "configure" script for the appropriate platform | |
6 | # Only supported platforms are recognized | |
7 | ||
8 | me=`basename $0` | |
9 | OPTS= | |
10 | ||
11 | usage() | |
12 | { | |
13 | ec=0$1 | |
14 | if test $ec -eq 0 | |
15 | then | |
16 | uletter=U | |
17 | else | |
18 | uletter=u | |
19 | fi | |
20 | ||
21 | echo "${uletter}sage: $me [ -h, --help ] [ --enable-debug | --disable-release ] platform [ configurearg ... ]" | |
22 | if test $ec -eq 0 | |
23 | then | |
24 | cat <<EOE | |
25 | ||
26 | Options: -h, --help Print this message and exit | |
27 | --enable-debug Enable support for debugging | |
28 | --disable-release Disable presetting optimization flags | |
29 | ||
51004dcb A |
30 | If you want to add custom CFLAGS or CXXFLAGS or similar, provide them _before_ |
31 | the runConfigureICU command: | |
32 | ||
33 | CXXFLAGS=xyz path/to/runConfigureICU --enable-debug ... | |
34 | ||
b75a7d8f A |
35 | The following names can be supplied as the argument for platform: |
36 | ||
73c04bcf A |
37 | AIX Use the IBM Visual Age xlc_r/xlC_r compilers on AIX |
38 | AIX/GCC Use the GNU gcc/g++ compilers on AIX | |
73c04bcf A |
39 | Cygwin Use the GNU gcc/g++ compilers on Cygwin |
40 | Cygwin/MSVC Use the Microsoft Visual C++ compiler on Cygwin | |
46f4442e | 41 | Cygwin/MSVC2005 Use the Microsoft Visual C++ 2005 compiler on Cygwin |
73c04bcf | 42 | Cygwin/ICL Use the Intel C++ compiler on Cygwin |
b331163b | 43 | FreeBSD Use the clang/clang++ or GNU gcc/g++ compilers on FreeBSD |
73c04bcf | 44 | HP-UX/ACC Use the HP ANSI C/Advanced C++ compilers on HP-UX 11 |
46f4442e | 45 | IBMi Use the iCC compilers on IBM i, i5/OS, OS/400 |
51004dcb A |
46 | Linux Use the clang/clang++ or GNU gcc/g++ compilers on Linux |
47 | Linux/gcc Use the GNU gcc/g++ compilers on Linux | |
73c04bcf A |
48 | Linux/ECC Use the Intel ECC compiler on Linux |
49 | Linux/ICC Use the Intel ICC compiler on Linux | |
50 | Linux/VA Use the IBM Visual Age compiler on Power PC Linux | |
57a6839d A |
51 | MacOSX Use the default compilers on MacOS X (Darwin) |
52 | MacOSX/GCC Use the GNU gcc/g++ compilers on MacOSX (Darwin) | |
4388f060 | 53 | MinGW Use the GNU gcc/g++ compilers on MinGW |
b331163b | 54 | MSYS/MSVC Use the Microsoft Visual C++ computer on MSYS |
73c04bcf A |
55 | QNX Use the QNX QCC compiler on QNX/Neutrino |
56 | Solaris Use the Sun cc/CC compilers on Solaris | |
57 | Solaris/GCC Use the GNU gcc/g++ compilers on Solaris | |
58 | SolarisX86 Use the Sun cc/CC compilers on Solaris x86 | |
59 | TRU64V5.1/CXX Use the Compaq cxx compiler on Tru64 (OSF) | |
60 | zOS Use the IBM cxx compiler on z/OS (os/390) | |
61 | zOSV1R2 Use the IBM cxx compiler for z/OS 1.2 | |
b75a7d8f A |
62 | EOE |
63 | fi | |
64 | ||
65 | exit $ec | |
66 | } | |
67 | ||
68 | # Parse arguments | |
69 | ||
70 | platform= | |
71 | debug=0 | |
72 | release=1 | |
73 | ||
74 | while test $# -ne 0 | |
75 | do | |
76 | case "$1" in | |
77 | -h|--help) | |
78 | usage 0 | |
79 | ;; | |
80 | --enable-debug) | |
81 | debug=1 | |
374ca955 | 82 | OPTS="$OPTS --enable-debug" |
b75a7d8f A |
83 | ;; |
84 | --disable-release) | |
b75a7d8f | 85 | release=0 |
374ca955 | 86 | OPTS="$OPTS --disable-release" |
b75a7d8f A |
87 | ;; |
88 | *) | |
89 | platform="$1" | |
90 | shift | |
91 | break | |
92 | ;; | |
93 | esac | |
94 | shift | |
95 | done | |
96 | ||
97 | if test x$platform = x | |
98 | then | |
99 | usage 1 | |
100 | fi | |
101 | ||
102 | # Go. | |
103 | ||
104 | rm -f config.cache | |
105 | rm -f config.log | |
106 | rm -f config.status | |
107 | ||
108 | DEBUG_CFLAGS='-g' | |
109 | DEBUG_CXXFLAGS='-g' | |
110 | ||
111 | if test x$configure = x | |
112 | then | |
113 | if test -f ./configure | |
114 | then | |
115 | configuredir=. | |
116 | else | |
117 | configuredir=`echo $0 | sed 's,[^/]*$,,'` | |
118 | if test x$configuredir = x$0 | |
119 | then | |
120 | configuredir=. | |
121 | fi | |
122 | fi | |
123 | ||
124 | if test x$configuredir = x | |
125 | then | |
126 | configuredir=. | |
127 | fi | |
128 | ||
129 | configure=$configuredir/configure | |
130 | fi | |
131 | ||
132 | case $platform in | |
73c04bcf | 133 | AIX) |
b75a7d8f A |
134 | THE_OS=AIX |
135 | THE_COMP="xlC_r" | |
136 | CC=`which xlc_r`; export CC | |
729e4ab9 A |
137 | if [ ! -x $CC ]; then |
138 | echo "ERROR: xlc_r was not found, please check the PATH to make sure it is correct."; exit 1 | |
139 | fi | |
b75a7d8f | 140 | CXX=`which xlC_r`; export CXX |
729e4ab9 A |
141 | if [ ! -x $CXX ]; then |
142 | echo "ERROR: xlC_r was not found, please check the PATH to make sure it is correct."; exit 1 | |
143 | fi | |
b75a7d8f A |
144 | RELEASE_CFLAGS="-O2 -qmaxmem=-1" |
145 | RELEASE_CXXFLAGS="-O2 -qmaxmem=-1" | |
b75a7d8f | 146 | ;; |
73c04bcf | 147 | AIX/GCC) |
374ca955 | 148 | THE_OS=AIX |
73c04bcf A |
149 | THE_COMP="the GNU C++" |
150 | CC=gcc; export CC | |
151 | CXX=g++; export CXX | |
729e4ab9 | 152 | DEBUG_CFLAGS='-g -O0' |
51004dcb | 153 | DEBUG_CXXFLAGS='-g -O0' |
b75a7d8f | 154 | ;; |
73c04bcf | 155 | Solaris) |
b75a7d8f A |
156 | THE_OS=SOLARIS |
157 | THE_COMP="Sun's CC" | |
158 | CC=`which cc`; export CC | |
159 | CXX=`which CC`; export CXX | |
4388f060 | 160 | RELEASE_CFLAGS="-xO1 -xlibmil" |
73c04bcf | 161 | RELEASE_CXXFLAGS="-O4 -xlibmil" |
b75a7d8f | 162 | ;; |
73c04bcf | 163 | Solaris/GCC) |
b75a7d8f | 164 | THE_OS=SOLARIS |
73c04bcf A |
165 | THE_COMP="the GNU C++" |
166 | CC=gcc; export CC | |
167 | CXX=g++; export CXX | |
168 | RELEASE_CFLAGS=-O1 | |
4388f060 | 169 | RELEASE_CXXFLAGS=-O2 |
73c04bcf A |
170 | ;; |
171 | SolarisX86) | |
172 | THE_OS="SOLARIS X86" | |
b75a7d8f A |
173 | THE_COMP="Sun's CC" |
174 | CC=`which cc`; export CC | |
175 | CXX=`which CC`; export CXX | |
4388f060 | 176 | LDFLAGS="${LDFLAGS} -lCrun";export LDFLAGS |
73c04bcf A |
177 | RELEASE_CFLAGS=-xO3 |
178 | RELEASE_CXXFLAGS=-O3 | |
b75a7d8f | 179 | ;; |
73c04bcf | 180 | HP-UX/ACC) |
b75a7d8f A |
181 | THE_OS="HP-UX 11" |
182 | THE_COMP="aCC" | |
183 | CC=cc; export CC | |
184 | CXX=aCC; export CXX | |
185 | RELEASE_CFLAGS='+O2 +Ofltacc' | |
186 | RELEASE_CXXFLAGS='+O2 +Ofltacc' | |
187 | ;; | |
46f4442e A |
188 | IBMi) |
189 | THE_OS="IBM i" | |
190 | THE_COMP="the iCC C++" | |
4388f060 A |
191 | CC=icc; export CC |
192 | CXX=icc; export CXX | |
729e4ab9 | 193 | CPP="$CC -c -qpponly"; export CPP |
4388f060 A |
194 | MAKE=gmake; export MAKE |
195 | U_MAKE=gmake; export U_MAKE | |
196 | # gmake is a .pgm and may not be on the path. Don't use a full path, just use gmake. | |
197 | ac_cv_path_U_MAKE=gmake; export ac_cv_path_U_MAKE | |
46f4442e A |
198 | RELEASE_CFLAGS='-O4' |
199 | RELEASE_CXXFLAGS='-O4' | |
200 | ;; | |
73c04bcf | 201 | Linux/ECC) |
374ca955 A |
202 | THE_OS="Linux" |
203 | THE_COMP="Intel ECC 7.1" | |
204 | CC=ecc; export CC | |
205 | CXX=ecpc; export CXX | |
206 | RELEASE_CFLAGS='-O2' | |
207 | RELEASE_CXXFLAGS='-O2' | |
208 | ;; | |
73c04bcf | 209 | Linux/ICC) |
374ca955 | 210 | THE_OS="Linux" |
73c04bcf A |
211 | CC=`which icc`; export CC |
212 | CXX=`which icpc`; export CXX | |
729e4ab9 | 213 | ICC_VER=`${CC} -v 2>&1` |
73c04bcf A |
214 | RELEASE_CFLAGS='-O' |
215 | RELEASE_CXXFLAGS='-O' | |
729e4ab9 A |
216 | export CFLAGS="-fp-model precise" |
217 | export CXXFLAGS="-fp-model precise" | |
218 | if [ "${ICC_VER}" = "Version 9.0 " ]; then | |
219 | RELEASE_CFLAGS='' | |
220 | RELEASE_CXXFLAGS='' | |
221 | export CFLAGS="${CFLAGS} -O0" | |
222 | export CXXFLAGS="${CXXFLAGS} -O0" | |
223 | echo "ICC 9.0 does not work with optimization- disabling optimizations" | |
224 | fi | |
225 | THE_COMP="Intel ${ICC_VER}" | |
374ca955 | 226 | ;; |
73c04bcf | 227 | Linux/VA) |
374ca955 A |
228 | THE_OS="Linux" |
229 | THE_COMP="IBM Visual Age C++ Compiler" | |
230 | CC=`which xlc_r`; export CC | |
231 | CXX=`which xlC_r`; export CXX | |
232 | RELEASE_CFLAGS="-O2 -qmaxmem=-1" | |
233 | RELEASE_CXXFLAGS="-O2 -qmaxmem=-1" | |
234 | ;; | |
51004dcb | 235 | Linux/gcc) |
73c04bcf A |
236 | THE_OS="Linux" |
237 | THE_COMP="the GNU C++" | |
238 | CC=gcc; export CC | |
239 | CXX=g++; export CXX | |
51004dcb A |
240 | RELEASE_CFLAGS='-O3' |
241 | RELEASE_CXXFLAGS='-O3' | |
242 | DEBUG_CFLAGS='-g' | |
243 | DEBUG_CXXFLAGS='-g' | |
244 | ;; | |
245 | Linux*) | |
246 | THE_OS="Linux" | |
247 | THE_COMP="the clang or else GNU C++" | |
248 | RELEASE_CFLAGS='-O3' | |
249 | RELEASE_CXXFLAGS='-O3' | |
250 | DEBUG_CFLAGS='-g' | |
251 | DEBUG_CXXFLAGS='-g' | |
73c04bcf | 252 | ;; |
374ca955 A |
253 | Cygwin) |
254 | THE_OS="Cygwin" | |
b75a7d8f | 255 | THE_COMP="the GNU C++" |
374ca955 A |
256 | RELEASE_CFLAGS='-O3' |
257 | RELEASE_CXXFLAGS='-O3' | |
258 | ;; | |
259 | Cygwin/MSVC) | |
260 | THE_OS="Windows with Cygwin" | |
261 | THE_COMP="Microsoft Visual C++" | |
262 | CC=cl; export CC | |
263 | CXX=cl; export CXX | |
57a6839d A |
264 | RELEASE_CFLAGS='-Gy -MD' |
265 | RELEASE_CXXFLAGS='-Gy -MD' | |
266 | DEBUG_CFLAGS='-Zi -MDd' | |
267 | DEBUG_CXXFLAGS='-Zi -MDd' | |
268 | DEBUG_LDFLAGS='-DEBUG' | |
73c04bcf | 269 | ;; |
46f4442e A |
270 | Cygwin/MSVC2005) |
271 | THE_OS="Windows with Cygwin" | |
272 | THE_COMP="Microsoft Visual C++ 2005" | |
273 | CC=cl; export CC | |
274 | CXX=cl; export CXX | |
729e4ab9 A |
275 | RELEASE_CFLAGS='/Gy /MD' |
276 | RELEASE_CXXFLAGS='/Gy /MD' | |
277 | DEBUG_CFLAGS='/Zi /MDd' | |
278 | DEBUG_CXXFLAGS='/Zi /MDd' | |
46f4442e A |
279 | DEBUG_LDFLAGS='/DEBUG' |
280 | ;; | |
73c04bcf A |
281 | Cygwin/ICL) |
282 | THE_OS="Windows with Cygwin" | |
283 | THE_COMP="Intel C++" | |
284 | CC=icl; export CC | |
285 | CXX=icl; export CXX | |
286 | # The Intel compiler has optimization bugs. So we disable optimization. | |
287 | RELEASE_CFLAGS='/Od' | |
288 | RELEASE_CXXFLAGS='/Od' | |
289 | DEBUG_CFLAGS='/Zi' | |
290 | DEBUG_CXXFLAGS='/Zi' | |
291 | DEBUG_LDFLAGS='/DEBUG' | |
b75a7d8f A |
292 | ;; |
293 | MacOSX) | |
57a6839d A |
294 | THE_OS="MacOS X (Darwin)" |
295 | THE_COMP="the default" | |
296 | RELEASE_CFLAGS='-O2' | |
297 | RELEASE_CXXFLAGS='-O2' | |
298 | DEBUG_CFLAGS='-g -O0' | |
299 | DEBUG_CXXFLAGS='-g -O0' | |
300 | ;; | |
301 | MacOSX/GCC) | |
b75a7d8f A |
302 | THE_OS="MacOS X (Darwin)" |
303 | THE_COMP="the GNU C++" | |
304 | RELEASE_CFLAGS='-O2' | |
305 | RELEASE_CXXFLAGS='-O2' | |
729e4ab9 A |
306 | DEBUG_CFLAGS='-g -O0' |
307 | DEBUG_CXXFLAGS='-g -O0' | |
57a6839d A |
308 | CC=gcc; export CC |
309 | CXX=g++; export CXX | |
b75a7d8f | 310 | ;; |
4388f060 A |
311 | MinGW) |
312 | THE_OS="MinGW" | |
313 | THE_COMP="the GNU C++" | |
314 | RELEASE_CFLAGS='-O3' | |
315 | RELEASE_CXXFLAGS='-O3' | |
57a6839d A |
316 | CXXFLAGS="--std=c++03" |
317 | export CXXFLAGS | |
4388f060 | 318 | ;; |
b331163b A |
319 | MSYS/MSVC) |
320 | THE_OS="MSYS" | |
321 | THE_COMP="Microsoft Visual C++" | |
322 | CC=cl; export CC | |
323 | CXX=cl; export CXX | |
324 | RELEASE_CFLAGS='-Gy -MD' | |
325 | RELEASE_CXXFLAGS='-Gy -MD' | |
326 | DEBUG_CFLAGS='-Zi -MDd' | |
327 | DEBUG_CXXFLAGS='-Zi -MDd' | |
328 | DEBUG_LDFLAGS='-DEBUG' | |
329 | ;; | |
b75a7d8f A |
330 | *BSD) |
331 | THE_OS="BSD" | |
332 | THE_COMP="the GNU C++" | |
729e4ab9 | 333 | DEBUG_CFLAGS='-g -O0' |
51004dcb | 334 | DEBUG_CXXFLAGS='-g -O0' |
b75a7d8f | 335 | ;; |
73c04bcf A |
336 | TRU64V5.1/CXX) |
337 | THE_OS="OSF1" | |
338 | THE_COMP="Compaq cxx" | |
339 | CC=cc; export CC | |
340 | CXX=cxx; export CXX | |
341 | ;; | |
b75a7d8f A |
342 | QNX) |
343 | THE_OS="QNX" | |
344 | THE_COMP="QNX cc" | |
345 | CC=qcc; export CC | |
346 | CXX=QCC; export CXX | |
347 | ;; | |
348 | zOS) | |
349 | THE_OS="z/OS (OS/390)" | |
73c04bcf | 350 | THE_COMP="z/OS C/C++" |
51004dcb A |
351 | CC=xlc; export CC |
352 | CXX=xlC; export CXX | |
353 | RELEASE_CFLAGS="-O2 -Wc,'inline(AUTO,NOREPORT,1000,8000)'" | |
354 | RELEASE_CXXFLAGS="-O2 -Wc,'inline(AUTO,NOREPORT,1000,8000)'" | |
b75a7d8f A |
355 | ;; |
356 | zOSV1R2) | |
357 | THE_OS="z/OS 1.2" | |
358 | THE_COMP="z/OS 1.2 C/C++" | |
359 | CC=cc; export CC | |
360 | CXX=cxx; export CXX | |
729e4ab9 | 361 | export COMPILE_LINK_ENVVAR='_CXX_CICC_VER}=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000' |
b75a7d8f | 362 | export _CXX_CVERSION=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000 |
73c04bcf A |
363 | export LDFLAGS="-Wl,'compat=pm3'" |
364 | export CFLAGS="-Wc,'target(zOSV1R2)'" | |
365 | export CXXFLAGS="-Wc,'target(zOSV1R2)'" | |
729e4ab9 A |
366 | RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'" |
367 | RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'" | |
b75a7d8f A |
368 | ;; |
369 | *) | |
370 | >&2 echo "$me: unrecognized platform \"$platform\" (use --help for help)" | |
371 | exit 1;; | |
372 | esac | |
373 | ||
374 | ||
375 | # Tweak flags | |
376 | ||
377 | if test $release -eq 1 | |
378 | then | |
379 | if test "$RELEASE_CFLAGS" = "" | |
380 | then | |
381 | case $CC in | |
382 | gcc|*/gcc|*-gcc-*|*/*-gcc-*) | |
383 | RELEASE_CFLAGS=-O3 | |
384 | ;; | |
385 | esac | |
386 | fi | |
387 | if test "$RELEASE_CFLAGS" != "" | |
388 | then | |
b331163b | 389 | CFLAGS="$RELEASE_CFLAGS $CFLAGS" |
b75a7d8f | 390 | fi |
b75a7d8f A |
391 | if test "$RELEASE_CXXFLAGS" = "" |
392 | then | |
393 | case $CXX in | |
394 | g++|*/g++|*-g++-*|*/*-g++-*) | |
729e4ab9 | 395 | RELEASE_CXXFLAGS=-O3 |
b75a7d8f A |
396 | ;; |
397 | esac | |
398 | fi | |
399 | if test "$RELEASE_CXXFLAGS" != "" | |
400 | then | |
b331163b | 401 | CXXFLAGS="$RELEASE_CXXFLAGS $CXXFLAGS" |
b75a7d8f | 402 | fi |
46f4442e A |
403 | if test "$RELEASE_LDFLAGS" != "" |
404 | then | |
b331163b | 405 | LDFLAGS="$RELEASE_LDFLAGS $LDFLAGS" |
46f4442e | 406 | fi |
b75a7d8f A |
407 | fi |
408 | ||
409 | if test $debug -eq 1 | |
410 | then | |
411 | if test "$DEBUG_CFLAGS" != "" | |
412 | then | |
b331163b | 413 | CFLAGS="$DEBUG_CFLAGS $CFLAGS" |
b75a7d8f | 414 | fi |
b75a7d8f A |
415 | if test "$DEBUG_CXXFLAGS" != "" |
416 | then | |
b331163b | 417 | CXXFLAGS="$DEBUG_CXXFLAGS $CXXFLAGS" |
b75a7d8f | 418 | fi |
374ca955 A |
419 | if test "$DEBUG_LDFLAGS" != "" |
420 | then | |
b331163b | 421 | LDFLAGS="$DEBUG_LDFLAGS $LDFLAGS" |
374ca955 | 422 | fi |
b75a7d8f A |
423 | fi |
424 | ||
46f4442e A |
425 | export CFLAGS |
426 | export CXXFLAGS | |
427 | export LDFLAGS | |
428 | ||
b75a7d8f A |
429 | # Run configure |
430 | ||
729e4ab9 | 431 | echo "export CPP=$CPP CC=$CC CXX=$CXX CPPFLAGS=$CPPFLAGS CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS MAKE=$MAKE" |
b75a7d8f A |
432 | echo "Running ./configure $OPTS $@ for $THE_OS using $THE_COMP compiler" |
433 | echo | |
729e4ab9 A |
434 | if $configure $OPTS $@ |
435 | then | |
436 | echo | |
437 | echo If the result of the above commands looks okay to you, go to the directory | |
438 | echo source in the ICU distribution to build ICU. Please remember that ICU needs | |
439 | echo GNU make to build properly... | |
440 | else | |
441 | echo $0: ./configure failed | |
442 | exit 1 | |
443 | fi |