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