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