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