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