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