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