]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/runConfigureICU
ICU-57131.0.1.tar.gz
[apple/icu.git] / icuSources / runConfigureICU
index c59e507fa5b4370378957660fc4926c381e9c742..9cd1e91487a3e61f609059ceafae8e1e547036ec 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 1999-2006, International Business Machines Corporation and
+# Copyright (c) 1999-2015, International Business Machines Corporation and
 # others. All Rights Reserved.
 
 # runConfigureICU: This script will run the "configure" script for the appropriate platform
@@ -27,21 +27,31 @@ Options: -h, --help         Print this message and exit
          --enable-debug     Enable support for debugging
          --disable-release  Disable presetting optimization flags
 
+If you want to add custom CFLAGS or CXXFLAGS or similar, provide them _before_
+the runConfigureICU command:
+
+    CXXFLAGS=xyz path/to/runConfigureICU --enable-debug ...
+
 The following names can be supplied as the argument for platform:
 
     AIX                 Use the IBM Visual Age xlc_r/xlC_r compilers on AIX
     AIX/GCC             Use the GNU gcc/g++ compilers on AIX
-    BeOS                Use the GNU gcc/g++ compilers on BeOS
     Cygwin              Use the GNU gcc/g++ compilers on Cygwin
     Cygwin/MSVC         Use the Microsoft Visual C++ compiler on Cygwin
+    Cygwin/MSVC2005     Use the Microsoft Visual C++ 2005 compiler on Cygwin
     Cygwin/ICL          Use the Intel C++ compiler on Cygwin
-    FreeBSD             Use the GNU gcc/g++ compilers on Free BSD
+    FreeBSD             Use the clang/clang++ or GNU gcc/g++ compilers on FreeBSD
     HP-UX/ACC           Use the HP ANSI C/Advanced C++ compilers on HP-UX 11
-    Linux               Use the GNU gcc/g++ compilers on Linux
+    IBMi                Use the iCC compilers on IBM i, i5/OS, OS/400
+    Linux               Use the clang/clang++ or GNU gcc/g++ compilers on Linux
+    Linux/gcc           Use the GNU gcc/g++ compilers on Linux
     Linux/ECC           Use the Intel ECC compiler on Linux
     Linux/ICC           Use the Intel ICC compiler on Linux
     Linux/VA            Use the IBM Visual Age compiler on Power PC Linux
-    MacOSX              Use the GNU gcc/g++ compilers on MacOS X (Darwin)
+    MacOSX              Use the default compilers on MacOS X (Darwin)
+    MacOSX/GCC          Use the GNU gcc/g++ compilers on MacOSX (Darwin)
+    MinGW               Use the GNU gcc/g++ compilers on MinGW
+    MSYS/MSVC           Use the Microsoft Visual C++ computer on MSYS
     QNX                 Use the QNX QCC compiler on QNX/Neutrino
     Solaris             Use the Sun cc/CC compilers on Solaris
     Solaris/GCC         Use the GNU gcc/g++ compilers on Solaris
@@ -124,7 +134,13 @@ case $platform in
         THE_OS=AIX
         THE_COMP="xlC_r"
         CC=`which xlc_r`; export CC
+        if [ ! -x $CC ]; then
+           echo "ERROR: xlc_r was not found, please check the PATH to make sure it is correct."; exit 1
+        fi
         CXX=`which xlC_r`; export CXX
+        if [ ! -x $CXX ]; then
+           echo "ERROR: xlC_r was not found, please check the PATH to make sure it is correct."; exit 1
+        fi
         RELEASE_CFLAGS="-O2 -qmaxmem=-1"
         RELEASE_CXXFLAGS="-O2 -qmaxmem=-1"
         ;;
@@ -133,13 +149,15 @@ case $platform in
         THE_COMP="the GNU C++"
         CC=gcc; export CC
         CXX=g++; export CXX
+        DEBUG_CFLAGS='-g -O0'
+        DEBUG_CXXFLAGS='-g -O0'
         ;;
     Solaris)
         THE_OS=SOLARIS
         THE_COMP="Sun's CC"
         CC=`which cc`; export CC
         CXX=`which CC`; export CXX
-        RELEASE_CFLAGS="-xO4 -xlibmil"
+        RELEASE_CFLAGS="-xO1 -xlibmil"
         RELEASE_CXXFLAGS="-O4 -xlibmil"
         ;;
     Solaris/GCC)
@@ -148,14 +166,14 @@ case $platform in
         CC=gcc; export CC
         CXX=g++; export CXX
         RELEASE_CFLAGS=-O1
-        RELEASE_CXXFLAGS=-O3
+        RELEASE_CXXFLAGS=-O2
         ;;
     SolarisX86)
         THE_OS="SOLARIS X86"
         THE_COMP="Sun's CC"
         CC=`which cc`; export CC
         CXX=`which CC`; export CXX
-        LDFLAGS="-L -lCrun";export LDFLAGS
+        LDFLAGS="${LDFLAGS} -lCrun";export LDFLAGS
         RELEASE_CFLAGS=-xO3
         RELEASE_CXXFLAGS=-O3
         ;;
@@ -167,6 +185,19 @@ case $platform in
         RELEASE_CFLAGS='+O2 +Ofltacc'
         RELEASE_CXXFLAGS='+O2 +Ofltacc'
         ;;
+    IBMi)
+        THE_OS="IBM i"
+        THE_COMP="the iCC C++"
+        CC=icc; export CC
+        CXX=icc; export CXX
+        CPP="$CC -c -qpponly"; export CPP
+        MAKE=gmake; export MAKE
+        U_MAKE=gmake; export U_MAKE
+        # gmake is a .pgm and may not be on the path.  Don't use a full path, just use gmake.
+        ac_cv_path_U_MAKE=gmake; export ac_cv_path_U_MAKE
+        RELEASE_CFLAGS='-O4'
+        RELEASE_CXXFLAGS='-O4'
+        ;;
     Linux/ECC)
         THE_OS="Linux"
         THE_COMP="Intel ECC 7.1"
@@ -177,11 +208,21 @@ case $platform in
         ;;
     Linux/ICC)
         THE_OS="Linux"
-        THE_COMP="Intel ICC 9.0"
         CC=`which icc`; export CC
         CXX=`which icpc`; export CXX
+       ICC_VER=`${CC} -v 2>&1`
         RELEASE_CFLAGS='-O'
         RELEASE_CXXFLAGS='-O'
+        export CFLAGS="-fp-model precise"
+        export CXXFLAGS="-fp-model precise"
+       if [ "${ICC_VER}" = "Version 9.0 " ]; then
+               RELEASE_CFLAGS=''
+               RELEASE_CXXFLAGS=''
+               export CFLAGS="${CFLAGS} -O0"
+               export CXXFLAGS="${CXXFLAGS} -O0"
+               echo "ICC 9.0 does not work with optimization- disabling optimizations"
+       fi
+        THE_COMP="Intel ${ICC_VER}"
         ;;
     Linux/VA)
         THE_OS="Linux"
@@ -191,11 +232,23 @@ case $platform in
         RELEASE_CFLAGS="-O2 -qmaxmem=-1"
         RELEASE_CXXFLAGS="-O2 -qmaxmem=-1"
         ;;
-    Linux*)
+    Linux/gcc)
         THE_OS="Linux"
         THE_COMP="the GNU C++"
         CC=gcc; export CC
         CXX=g++; export CXX
+        RELEASE_CFLAGS='-O3'
+        RELEASE_CXXFLAGS='-O3'
+        DEBUG_CFLAGS='-g'
+        DEBUG_CXXFLAGS='-g'
+        ;;
+    Linux*)
+        THE_OS="Linux"
+        THE_COMP="the clang or else GNU C++"
+        RELEASE_CFLAGS='-O3'
+        RELEASE_CXXFLAGS='-O3'
+        DEBUG_CFLAGS='-g'
+        DEBUG_CXXFLAGS='-g'
         ;;
     Cygwin)
         THE_OS="Cygwin"
@@ -208,10 +261,21 @@ case $platform in
         THE_COMP="Microsoft Visual C++"
         CC=cl; export CC
         CXX=cl; export CXX
-        RELEASE_CFLAGS='/O2 /Ob2 /Op'
-        RELEASE_CXXFLAGS='/O2 /Ob2 /Op'
-        DEBUG_CFLAGS='/Zi'
-        DEBUG_CXXFLAGS='/Zi'
+        RELEASE_CFLAGS='-Gy -MD'
+        RELEASE_CXXFLAGS='-Gy -MD'
+        DEBUG_CFLAGS='-Zi -MDd'
+        DEBUG_CXXFLAGS='-Zi -MDd'
+        DEBUG_LDFLAGS='-DEBUG'
+        ;;
+    Cygwin/MSVC2005)
+        THE_OS="Windows with Cygwin"
+        THE_COMP="Microsoft Visual C++ 2005"
+        CC=cl; export CC
+        CXX=cl; export CXX
+        RELEASE_CFLAGS='/Gy /MD'
+        RELEASE_CXXFLAGS='/Gy /MD'
+        DEBUG_CFLAGS='/Zi /MDd'
+        DEBUG_CXXFLAGS='/Zi /MDd'
         DEBUG_LDFLAGS='/DEBUG'
         ;;
     Cygwin/ICL)
@@ -227,16 +291,47 @@ case $platform in
         DEBUG_LDFLAGS='/DEBUG'
         ;;
     MacOSX)
+        THE_OS="MacOS X (Darwin)"
+        THE_COMP="the default"
+        RELEASE_CFLAGS='-O2'
+        RELEASE_CXXFLAGS='-O2'
+        DEBUG_CFLAGS='-g -O0'
+        DEBUG_CXXFLAGS='-g -O0'
+        ;;
+    MacOSX/GCC)
         THE_OS="MacOS X (Darwin)"
         THE_COMP="the GNU C++"
         RELEASE_CFLAGS='-O2'
         RELEASE_CXXFLAGS='-O2'
+        DEBUG_CFLAGS='-g -O0'
+        DEBUG_CXXFLAGS='-g -O0'
+        CC=gcc; export CC
+        CXX=g++; export CXX
+        ;;
+    MinGW)
+        THE_OS="MinGW"
+        THE_COMP="the GNU C++"
+        RELEASE_CFLAGS='-O3'
+        RELEASE_CXXFLAGS='-O3'
+        CXXFLAGS="--std=c++03"
+        export CXXFLAGS
+        ;;
+    MSYS/MSVC)
+        THE_OS="MSYS"
+        THE_COMP="Microsoft Visual C++"
+        CC=cl; export CC
+        CXX=cl; export CXX
+        RELEASE_CFLAGS='-Gy -MD'
+        RELEASE_CXXFLAGS='-Gy -MD'
+        DEBUG_CFLAGS='-Zi -MDd'
+        DEBUG_CXXFLAGS='-Zi -MDd'
+        DEBUG_LDFLAGS='-DEBUG'
         ;;
     *BSD)
         THE_OS="BSD"
         THE_COMP="the GNU C++"
-        CC=gcc; export CC
-        CXX=g++; export CXX
+        DEBUG_CFLAGS='-g -O0'
+        DEBUG_CXXFLAGS='-g -O0'
         ;;
     TRU64V5.1/CXX)
         THE_OS="OSF1"
@@ -250,41 +345,26 @@ case $platform in
         CC=qcc; export CC
         CXX=QCC; export CXX
         ;;
-    BeOS)
-        THE_OS="BeOS"
-        THE_COMP="the GNU C++"
-        OPTIMIZATIONS="-fdefault-inline -fdefer-pop -fforce-mem -fforce-addr \
-            -finline -finline-functions \
-            -fkeep-inline-functions -fkeep-static-consts -fbranch-count-reg \
-            -ffunction-cse -fstrength-reduce -fthread-jumps -fcse-follow-jumps \
-            -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt \
-            -fexpensive-optimizations -foptimize-register-move -fregmove \
-            -fschedule-insns -fschedule-insns2 -ffloat-store -funroll-loops \
-            -fmove-all-movables -freduce-all-givs -fpeephole \
-            -funroll-all-loops -ffunction-sections -fdata-sections"
-        RELEASE_CFLAGS="$OPTIMIZATIONS"
-        RELEASE_CXXFLAGS="$OPTIMIZATIONS"
-        ;;
     zOS)
         THE_OS="z/OS (OS/390)"
         THE_COMP="z/OS C/C++"
-        CC=cc; export CC
-        CXX=cxx; export CXX
-        export RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,2500)'"
-        export RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,300,2500)'"
+        CC=xlc; export CC
+        CXX=xlC; export CXX
+        RELEASE_CFLAGS="-O2 -Wc,'inline(AUTO,NOREPORT,1000,8000)'"
+        RELEASE_CXXFLAGS="-O2 -Wc,'inline(AUTO,NOREPORT,1000,8000)'"
         ;;
     zOSV1R2)
         THE_OS="z/OS 1.2"
         THE_COMP="z/OS 1.2 C/C++"
         CC=cc; export CC
         CXX=cxx; export CXX
-        export COMPILE_LINK_ENVVAR='_CXX_CVERSION=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000'
+        export COMPILE_LINK_ENVVAR='_CXX_CICC_VER}=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000'
         export _CXX_CVERSION=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000
         export LDFLAGS="-Wl,'compat=pm3'"
         export CFLAGS="-Wc,'target(zOSV1R2)'"
         export CXXFLAGS="-Wc,'target(zOSV1R2)'"
-        export RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,2500)'"
-        export RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,300,2500)'"
+        RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
+        RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
         ;;
     *)
         >&2 echo "$me: unrecognized platform \"$platform\" (use --help for help)"
@@ -306,49 +386,58 @@ then
     fi
     if test "$RELEASE_CFLAGS" != ""
     then
-        CFLAGS="$CFLAGS $RELEASE_CFLAGS"
+        CFLAGS="$RELEASE_CFLAGS $CFLAGS"
     fi
-    export CFLAGS
     if test "$RELEASE_CXXFLAGS" = ""
     then
         case $CXX in
             g++|*/g++|*-g++-*|*/*-g++-*)
-                RELEASE_CXXFLAGS=-O
+                RELEASE_CXXFLAGS=-O3
                 ;;
         esac
     fi
     if test "$RELEASE_CXXFLAGS" != ""
     then
-        CXXFLAGS="$CXXFLAGS $RELEASE_CXXFLAGS"
+        CXXFLAGS="$RELEASE_CXXFLAGS $CXXFLAGS"
+    fi
+    if test "$RELEASE_LDFLAGS" != ""
+    then
+        LDFLAGS="$RELEASE_LDFLAGS $LDFLAGS"
     fi
-    export CXXFLAGS
 fi
 
 if test $debug -eq 1
 then
     if test "$DEBUG_CFLAGS" != ""
     then
-        CFLAGS="$CFLAGS $DEBUG_CFLAGS"
+        CFLAGS="$DEBUG_CFLAGS $CFLAGS"
     fi
-    export CFLAGS
     if test "$DEBUG_CXXFLAGS" != ""
     then
-        CXXFLAGS="$CXXFLAGS $DEBUG_CXXFLAGS"
+        CXXFLAGS="$DEBUG_CXXFLAGS $CXXFLAGS"
     fi
-    export CXXFLAGS
     if test "$DEBUG_LDFLAGS" != ""
     then
-        LDFLAGS="$LDFLAGS $DEBUG_LDFLAGS"
+        LDFLAGS="$DEBUG_LDFLAGS $LDFLAGS"
     fi
-    export LDFLAGS
 fi
 
+export CFLAGS
+export CXXFLAGS
+export LDFLAGS
+
 # Run configure
 
+echo "export CPP=$CPP CC=$CC CXX=$CXX CPPFLAGS=$CPPFLAGS CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS MAKE=$MAKE"
 echo "Running ./configure $OPTS $@ for $THE_OS using $THE_COMP compiler"
 echo
-$configure $OPTS $@
-echo
-echo If the result of the above commands looks okay to you, go to the directory
-echo source in the ICU distribution to build ICU. Please remember that ICU needs
-echo GNU make to build properly...
+if $configure $OPTS $@
+then
+       echo
+       echo If the result of the above commands looks okay to you, go to the directory
+       echo source in the ICU distribution to build ICU. Please remember that ICU needs
+       echo GNU make to build properly...
+else
+       echo $0: ./configure failed
+       exit 1
+fi