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