]> git.saurik.com Git - apple/icu.git/blame - icuSources/runConfigureICU
ICU-491.11.3.tar.gz
[apple/icu.git] / icuSources / runConfigureICU
CommitLineData
b75a7d8f 1#!/bin/sh
4388f060 2# Copyright (c) 1999-2011, 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
8me=`basename $0`
9OPTS=
10
11usage()
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
26Options: -h, --help Print this message and exit
27 --enable-debug Enable support for debugging
28 --disable-release Disable presetting optimization flags
29
30The following names can be supplied as the argument for platform:
31
73c04bcf
A
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
73c04bcf
A
34 Cygwin Use the GNU gcc/g++ compilers on Cygwin
35 Cygwin/MSVC Use the Microsoft Visual C++ compiler on Cygwin
46f4442e 36 Cygwin/MSVC2005 Use the Microsoft Visual C++ 2005 compiler on Cygwin
73c04bcf
A
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
46f4442e 40 IBMi Use the iCC compilers on IBM i, i5/OS, OS/400
73c04bcf
A
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)
4388f060 46 MinGW Use the GNU gcc/g++ compilers on MinGW
73c04bcf
A
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
b75a7d8f
A
54EOE
55 fi
56
57 exit $ec
58}
59
60# Parse arguments
61
62platform=
63debug=0
64release=1
65
66while test $# -ne 0
67do
68 case "$1" in
69 -h|--help)
70 usage 0
71 ;;
72 --enable-debug)
73 debug=1
374ca955 74 OPTS="$OPTS --enable-debug"
b75a7d8f
A
75 ;;
76 --disable-release)
b75a7d8f 77 release=0
374ca955 78 OPTS="$OPTS --disable-release"
b75a7d8f
A
79 ;;
80 *)
81 platform="$1"
82 shift
83 break
84 ;;
85 esac
86 shift
87done
88
89if test x$platform = x
90then
91 usage 1
92fi
93
94# Go.
95
96rm -f config.cache
97rm -f config.log
98rm -f config.status
99
100DEBUG_CFLAGS='-g'
101DEBUG_CXXFLAGS='-g'
102
103if test x$configure = x
104then
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
122fi
123
124case $platform in
73c04bcf 125 AIX)
b75a7d8f
A
126 THE_OS=AIX
127 THE_COMP="xlC_r"
128 CC=`which xlc_r`; export CC
729e4ab9
A
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
b75a7d8f 132 CXX=`which xlC_r`; export CXX
729e4ab9
A
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
b75a7d8f
A
136 RELEASE_CFLAGS="-O2 -qmaxmem=-1"
137 RELEASE_CXXFLAGS="-O2 -qmaxmem=-1"
b75a7d8f 138 ;;
73c04bcf 139 AIX/GCC)
374ca955 140 THE_OS=AIX
73c04bcf
A
141 THE_COMP="the GNU C++"
142 CC=gcc; export CC
143 CXX=g++; export CXX
729e4ab9
A
144 DEBUG_CFLAGS='-g -O0'
145 DEBUG_CXFLAGS='-g -O0'
b75a7d8f 146 ;;
73c04bcf 147 Solaris)
b75a7d8f
A
148 THE_OS=SOLARIS
149 THE_COMP="Sun's CC"
150 CC=`which cc`; export CC
151 CXX=`which CC`; export CXX
4388f060 152 RELEASE_CFLAGS="-xO1 -xlibmil"
73c04bcf 153 RELEASE_CXXFLAGS="-O4 -xlibmil"
b75a7d8f 154 ;;
73c04bcf 155 Solaris/GCC)
b75a7d8f 156 THE_OS=SOLARIS
73c04bcf
A
157 THE_COMP="the GNU C++"
158 CC=gcc; export CC
159 CXX=g++; export CXX
160 RELEASE_CFLAGS=-O1
4388f060 161 RELEASE_CXXFLAGS=-O2
73c04bcf
A
162 ;;
163 SolarisX86)
164 THE_OS="SOLARIS X86"
b75a7d8f
A
165 THE_COMP="Sun's CC"
166 CC=`which cc`; export CC
167 CXX=`which CC`; export CXX
4388f060 168 LDFLAGS="${LDFLAGS} -lCrun";export LDFLAGS
73c04bcf
A
169 RELEASE_CFLAGS=-xO3
170 RELEASE_CXXFLAGS=-O3
b75a7d8f 171 ;;
73c04bcf 172 HP-UX/ACC)
b75a7d8f
A
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 ;;
46f4442e
A
180 IBMi)
181 THE_OS="IBM i"
182 THE_COMP="the iCC C++"
4388f060
A
183 CC=icc; export CC
184 CXX=icc; export CXX
729e4ab9 185 CPP="$CC -c -qpponly"; export CPP
4388f060
A
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
46f4442e
A
190 RELEASE_CFLAGS='-O4'
191 RELEASE_CXXFLAGS='-O4'
192 ;;
73c04bcf 193 Linux/ECC)
374ca955
A
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 ;;
73c04bcf 201 Linux/ICC)
374ca955 202 THE_OS="Linux"
73c04bcf
A
203 CC=`which icc`; export CC
204 CXX=`which icpc`; export CXX
729e4ab9 205 ICC_VER=`${CC} -v 2>&1`
73c04bcf
A
206 RELEASE_CFLAGS='-O'
207 RELEASE_CXXFLAGS='-O'
729e4ab9
A
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}"
374ca955 218 ;;
73c04bcf 219 Linux/VA)
374ca955
A
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 ;;
73c04bcf
A
227 Linux*)
228 THE_OS="Linux"
229 THE_COMP="the GNU C++"
230 CC=gcc; export CC
231 CXX=g++; export CXX
729e4ab9
A
232 DEBUG_CFLAGS='-g -O0'
233 DEBUG_CXFLAGS='-g -O0'
73c04bcf 234 ;;
374ca955
A
235 Cygwin)
236 THE_OS="Cygwin"
b75a7d8f 237 THE_COMP="the GNU C++"
374ca955
A
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
729e4ab9
A
246 RELEASE_CFLAGS='/Gy /MD'
247 RELEASE_CXXFLAGS='/Gy /MD'
248 DEBUG_CFLAGS='/Zi /MDd'
249 DEBUG_CXXFLAGS='/Zi /MDd'
73c04bcf
A
250 DEBUG_LDFLAGS='/DEBUG'
251 ;;
46f4442e
A
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
729e4ab9
A
257 RELEASE_CFLAGS='/Gy /MD'
258 RELEASE_CXXFLAGS='/Gy /MD'
259 DEBUG_CFLAGS='/Zi /MDd'
260 DEBUG_CXXFLAGS='/Zi /MDd'
46f4442e
A
261 DEBUG_LDFLAGS='/DEBUG'
262 ;;
73c04bcf
A
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'
b75a7d8f
A
274 ;;
275 MacOSX)
276 THE_OS="MacOS X (Darwin)"
277 THE_COMP="the GNU C++"
278 RELEASE_CFLAGS='-O2'
279 RELEASE_CXXFLAGS='-O2'
729e4ab9
A
280 DEBUG_CFLAGS='-g -O0'
281 DEBUG_CXXFLAGS='-g -O0'
b75a7d8f 282 ;;
4388f060
A
283 MinGW)
284 THE_OS="MinGW"
285 THE_COMP="the GNU C++"
286 RELEASE_CFLAGS='-O3'
287 RELEASE_CXXFLAGS='-O3'
288 ;;
b75a7d8f
A
289 *BSD)
290 THE_OS="BSD"
291 THE_COMP="the GNU C++"
292 CC=gcc; export CC
293 CXX=g++; export CXX
729e4ab9
A
294 DEBUG_CFLAGS='-g -O0'
295 DEBUG_CXFLAGS='-g -O0'
b75a7d8f 296 ;;
73c04bcf
A
297 TRU64V5.1/CXX)
298 THE_OS="OSF1"
299 THE_COMP="Compaq cxx"
300 CC=cc; export CC
301 CXX=cxx; export CXX
302 ;;
b75a7d8f
A
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)"
73c04bcf 311 THE_COMP="z/OS C/C++"
b75a7d8f
A
312 CC=cc; export CC
313 CXX=cxx; export CXX
46f4442e
A
314 RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
315 RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
b75a7d8f
A
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
729e4ab9 322 export COMPILE_LINK_ENVVAR='_CXX_CICC_VER}=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000'
b75a7d8f 323 export _CXX_CVERSION=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000
73c04bcf
A
324 export LDFLAGS="-Wl,'compat=pm3'"
325 export CFLAGS="-Wc,'target(zOSV1R2)'"
326 export CXXFLAGS="-Wc,'target(zOSV1R2)'"
729e4ab9
A
327 RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
328 RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
b75a7d8f
A
329 ;;
330 *)
331 >&2 echo "$me: unrecognized platform \"$platform\" (use --help for help)"
332 exit 1;;
333esac
334
335
336# Tweak flags
337
338if test $release -eq 1
339then
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
b75a7d8f
A
352 if test "$RELEASE_CXXFLAGS" = ""
353 then
354 case $CXX in
355 g++|*/g++|*-g++-*|*/*-g++-*)
729e4ab9 356 RELEASE_CXXFLAGS=-O3
b75a7d8f
A
357 ;;
358 esac
359 fi
360 if test "$RELEASE_CXXFLAGS" != ""
361 then
362 CXXFLAGS="$CXXFLAGS $RELEASE_CXXFLAGS"
363 fi
46f4442e
A
364 if test "$RELEASE_LDFLAGS" != ""
365 then
366 LDFLAGS="$LDFLAGS $RELEASE_LDFLAGS"
367 fi
b75a7d8f
A
368fi
369
370if test $debug -eq 1
371then
372 if test "$DEBUG_CFLAGS" != ""
373 then
374 CFLAGS="$CFLAGS $DEBUG_CFLAGS"
375 fi
b75a7d8f
A
376 if test "$DEBUG_CXXFLAGS" != ""
377 then
378 CXXFLAGS="$CXXFLAGS $DEBUG_CXXFLAGS"
379 fi
374ca955
A
380 if test "$DEBUG_LDFLAGS" != ""
381 then
382 LDFLAGS="$LDFLAGS $DEBUG_LDFLAGS"
383 fi
b75a7d8f
A
384fi
385
46f4442e
A
386export CFLAGS
387export CXXFLAGS
388export LDFLAGS
389
b75a7d8f
A
390# Run configure
391
729e4ab9 392echo "export CPP=$CPP CC=$CC CXX=$CXX CPPFLAGS=$CPPFLAGS CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS MAKE=$MAKE"
b75a7d8f
A
393echo "Running ./configure $OPTS $@ for $THE_OS using $THE_COMP compiler"
394echo
729e4ab9
A
395if $configure $OPTS $@
396then
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...
401else
402 echo $0: ./configure failed
403 exit 1
404fi