]> git.saurik.com Git - apple/icu.git/blame - icuSources/runConfigureICU
ICU-8.11.4.tar.gz
[apple/icu.git] / icuSources / runConfigureICU
CommitLineData
b75a7d8f 1#!/bin/sh
73c04bcf 2# Copyright (c) 1999-2006, 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
34 BeOS Use the GNU gcc/g++ compilers on BeOS
35 Cygwin Use the GNU gcc/g++ compilers on Cygwin
36 Cygwin/MSVC Use the Microsoft Visual C++ 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 Linux Use the GNU gcc/g++ compilers on Linux
41 Linux/ECC Use the Intel ECC compiler on Linux
42 Linux/ICC Use the Intel ICC compiler on Linux
43 Linux/VA Use the IBM Visual Age compiler on Power PC Linux
44 MacOSX Use the GNU gcc/g++ compilers on MacOS X (Darwin)
45 QNX Use the QNX QCC compiler on QNX/Neutrino
46 Solaris Use the Sun cc/CC compilers on Solaris
47 Solaris/GCC Use the GNU gcc/g++ compilers on Solaris
48 SolarisX86 Use the Sun cc/CC compilers on Solaris x86
49 TRU64V5.1/CXX Use the Compaq cxx compiler on Tru64 (OSF)
50 zOS Use the IBM cxx compiler on z/OS (os/390)
51 zOSV1R2 Use the IBM cxx compiler for z/OS 1.2
b75a7d8f
A
52EOE
53 fi
54
55 exit $ec
56}
57
58# Parse arguments
59
60platform=
61debug=0
62release=1
63
64while test $# -ne 0
65do
66 case "$1" in
67 -h|--help)
68 usage 0
69 ;;
70 --enable-debug)
71 debug=1
374ca955 72 OPTS="$OPTS --enable-debug"
b75a7d8f
A
73 ;;
74 --disable-release)
b75a7d8f 75 release=0
374ca955 76 OPTS="$OPTS --disable-release"
b75a7d8f
A
77 ;;
78 *)
79 platform="$1"
80 shift
81 break
82 ;;
83 esac
84 shift
85done
86
87if test x$platform = x
88then
89 usage 1
90fi
91
92# Go.
93
94rm -f config.cache
95rm -f config.log
96rm -f config.status
97
98DEBUG_CFLAGS='-g'
99DEBUG_CXXFLAGS='-g'
100
101if test x$configure = x
102then
103 if test -f ./configure
104 then
105 configuredir=.
106 else
107 configuredir=`echo $0 | sed 's,[^/]*$,,'`
108 if test x$configuredir = x$0
109 then
110 configuredir=.
111 fi
112 fi
113
114 if test x$configuredir = x
115 then
116 configuredir=.
117 fi
118
119 configure=$configuredir/configure
120fi
121
122case $platform in
73c04bcf 123 AIX)
b75a7d8f
A
124 THE_OS=AIX
125 THE_COMP="xlC_r"
126 CC=`which xlc_r`; export CC
127 CXX=`which xlC_r`; export CXX
128 RELEASE_CFLAGS="-O2 -qmaxmem=-1"
129 RELEASE_CXXFLAGS="-O2 -qmaxmem=-1"
b75a7d8f 130 ;;
73c04bcf 131 AIX/GCC)
374ca955 132 THE_OS=AIX
73c04bcf
A
133 THE_COMP="the GNU C++"
134 CC=gcc; export CC
135 CXX=g++; export CXX
b75a7d8f 136 ;;
73c04bcf 137 Solaris)
b75a7d8f
A
138 THE_OS=SOLARIS
139 THE_COMP="Sun's CC"
140 CC=`which cc`; export CC
141 CXX=`which CC`; export CXX
73c04bcf
A
142 RELEASE_CFLAGS="-xO4 -xlibmil"
143 RELEASE_CXXFLAGS="-O4 -xlibmil"
b75a7d8f 144 ;;
73c04bcf 145 Solaris/GCC)
b75a7d8f 146 THE_OS=SOLARIS
73c04bcf
A
147 THE_COMP="the GNU C++"
148 CC=gcc; export CC
149 CXX=g++; export CXX
150 RELEASE_CFLAGS=-O1
151 RELEASE_CXXFLAGS=-O3
152 ;;
153 SolarisX86)
154 THE_OS="SOLARIS X86"
b75a7d8f
A
155 THE_COMP="Sun's CC"
156 CC=`which cc`; export CC
157 CXX=`which CC`; export CXX
73c04bcf
A
158 LDFLAGS="-L -lCrun";export LDFLAGS
159 RELEASE_CFLAGS=-xO3
160 RELEASE_CXXFLAGS=-O3
b75a7d8f 161 ;;
73c04bcf 162 HP-UX/ACC)
b75a7d8f
A
163 THE_OS="HP-UX 11"
164 THE_COMP="aCC"
165 CC=cc; export CC
166 CXX=aCC; export CXX
167 RELEASE_CFLAGS='+O2 +Ofltacc'
168 RELEASE_CXXFLAGS='+O2 +Ofltacc'
169 ;;
73c04bcf 170 Linux/ECC)
374ca955
A
171 THE_OS="Linux"
172 THE_COMP="Intel ECC 7.1"
173 CC=ecc; export CC
174 CXX=ecpc; export CXX
175 RELEASE_CFLAGS='-O2'
176 RELEASE_CXXFLAGS='-O2'
177 ;;
73c04bcf 178 Linux/ICC)
374ca955 179 THE_OS="Linux"
73c04bcf
A
180 THE_COMP="Intel ICC 9.0"
181 CC=`which icc`; export CC
182 CXX=`which icpc`; export CXX
183 RELEASE_CFLAGS='-O'
184 RELEASE_CXXFLAGS='-O'
374ca955 185 ;;
73c04bcf 186 Linux/VA)
374ca955
A
187 THE_OS="Linux"
188 THE_COMP="IBM Visual Age C++ Compiler"
189 CC=`which xlc_r`; export CC
190 CXX=`which xlC_r`; export CXX
191 RELEASE_CFLAGS="-O2 -qmaxmem=-1"
192 RELEASE_CXXFLAGS="-O2 -qmaxmem=-1"
193 ;;
73c04bcf
A
194 Linux*)
195 THE_OS="Linux"
196 THE_COMP="the GNU C++"
197 CC=gcc; export CC
198 CXX=g++; export CXX
199 ;;
374ca955
A
200 Cygwin)
201 THE_OS="Cygwin"
b75a7d8f 202 THE_COMP="the GNU C++"
374ca955
A
203 RELEASE_CFLAGS='-O3'
204 RELEASE_CXXFLAGS='-O3'
205 ;;
206 Cygwin/MSVC)
207 THE_OS="Windows with Cygwin"
208 THE_COMP="Microsoft Visual C++"
209 CC=cl; export CC
210 CXX=cl; export CXX
73c04bcf
A
211 RELEASE_CFLAGS='/O2 /Ob2 /Op'
212 RELEASE_CXXFLAGS='/O2 /Ob2 /Op'
213 DEBUG_CFLAGS='/Zi'
214 DEBUG_CXXFLAGS='/Zi'
215 DEBUG_LDFLAGS='/DEBUG'
216 ;;
217 Cygwin/ICL)
218 THE_OS="Windows with Cygwin"
219 THE_COMP="Intel C++"
220 CC=icl; export CC
221 CXX=icl; export CXX
222 # The Intel compiler has optimization bugs. So we disable optimization.
223 RELEASE_CFLAGS='/Od'
224 RELEASE_CXXFLAGS='/Od'
225 DEBUG_CFLAGS='/Zi'
226 DEBUG_CXXFLAGS='/Zi'
227 DEBUG_LDFLAGS='/DEBUG'
b75a7d8f
A
228 ;;
229 MacOSX)
230 THE_OS="MacOS X (Darwin)"
231 THE_COMP="the GNU C++"
232 RELEASE_CFLAGS='-O2'
233 RELEASE_CXXFLAGS='-O2'
234 ;;
235 *BSD)
236 THE_OS="BSD"
237 THE_COMP="the GNU C++"
238 CC=gcc; export CC
239 CXX=g++; export CXX
240 ;;
73c04bcf
A
241 TRU64V5.1/CXX)
242 THE_OS="OSF1"
243 THE_COMP="Compaq cxx"
244 CC=cc; export CC
245 CXX=cxx; export CXX
246 ;;
b75a7d8f
A
247 QNX)
248 THE_OS="QNX"
249 THE_COMP="QNX cc"
250 CC=qcc; export CC
251 CXX=QCC; export CXX
252 ;;
374ca955
A
253 BeOS)
254 THE_OS="BeOS"
255 THE_COMP="the GNU C++"
256 OPTIMIZATIONS="-fdefault-inline -fdefer-pop -fforce-mem -fforce-addr \
257 -finline -finline-functions \
258 -fkeep-inline-functions -fkeep-static-consts -fbranch-count-reg \
259 -ffunction-cse -fstrength-reduce -fthread-jumps -fcse-follow-jumps \
260 -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt \
261 -fexpensive-optimizations -foptimize-register-move -fregmove \
262 -fschedule-insns -fschedule-insns2 -ffloat-store -funroll-loops \
263 -fmove-all-movables -freduce-all-givs -fpeephole \
264 -funroll-all-loops -ffunction-sections -fdata-sections"
265 RELEASE_CFLAGS="$OPTIMIZATIONS"
266 RELEASE_CXXFLAGS="$OPTIMIZATIONS"
267 ;;
b75a7d8f
A
268 zOS)
269 THE_OS="z/OS (OS/390)"
73c04bcf 270 THE_COMP="z/OS C/C++"
b75a7d8f
A
271 CC=cc; export CC
272 CXX=cxx; export CXX
73c04bcf
A
273 export RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,2500)'"
274 export RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,300,2500)'"
b75a7d8f
A
275 ;;
276 zOSV1R2)
277 THE_OS="z/OS 1.2"
278 THE_COMP="z/OS 1.2 C/C++"
279 CC=cc; export CC
280 CXX=cxx; export CXX
281 export COMPILE_LINK_ENVVAR='_CXX_CVERSION=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000'
282 export _CXX_CVERSION=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000
73c04bcf
A
283 export LDFLAGS="-Wl,'compat=pm3'"
284 export CFLAGS="-Wc,'target(zOSV1R2)'"
285 export CXXFLAGS="-Wc,'target(zOSV1R2)'"
286 export RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,2500)'"
287 export RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,300,2500)'"
b75a7d8f
A
288 ;;
289 *)
290 >&2 echo "$me: unrecognized platform \"$platform\" (use --help for help)"
291 exit 1;;
292esac
293
294
295# Tweak flags
296
297if test $release -eq 1
298then
299 if test "$RELEASE_CFLAGS" = ""
300 then
301 case $CC in
302 gcc|*/gcc|*-gcc-*|*/*-gcc-*)
303 RELEASE_CFLAGS=-O3
304 ;;
305 esac
306 fi
307 if test "$RELEASE_CFLAGS" != ""
308 then
309 CFLAGS="$CFLAGS $RELEASE_CFLAGS"
310 fi
311 export CFLAGS
312 if test "$RELEASE_CXXFLAGS" = ""
313 then
314 case $CXX in
315 g++|*/g++|*-g++-*|*/*-g++-*)
316 RELEASE_CXXFLAGS=-O
317 ;;
318 esac
319 fi
320 if test "$RELEASE_CXXFLAGS" != ""
321 then
322 CXXFLAGS="$CXXFLAGS $RELEASE_CXXFLAGS"
323 fi
324 export CXXFLAGS
325fi
326
327if test $debug -eq 1
328then
329 if test "$DEBUG_CFLAGS" != ""
330 then
331 CFLAGS="$CFLAGS $DEBUG_CFLAGS"
332 fi
333 export CFLAGS
334 if test "$DEBUG_CXXFLAGS" != ""
335 then
336 CXXFLAGS="$CXXFLAGS $DEBUG_CXXFLAGS"
337 fi
338 export CXXFLAGS
374ca955
A
339 if test "$DEBUG_LDFLAGS" != ""
340 then
341 LDFLAGS="$LDFLAGS $DEBUG_LDFLAGS"
342 fi
343 export LDFLAGS
b75a7d8f
A
344fi
345
346# Run configure
347
348echo "Running ./configure $OPTS $@ for $THE_OS using $THE_COMP compiler"
349echo
350$configure $OPTS $@
351echo
352echo If the result of the above commands looks okay to you, go to the directory
353echo source in the ICU distribution to build ICU. Please remember that ICU needs
354echo GNU make to build properly...