Home | History | Annotate | Download | only in icu4c
      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         CXX=`which xlC_r`; export CXX
    129         RELEASE_CFLAGS="-O2 -qmaxmem=-1"
    130         RELEASE_CXXFLAGS="-O2 -qmaxmem=-1"
    131         ;;
    132     AIX/GCC)
    133         THE_OS=AIX
    134         THE_COMP="the GNU C++"
    135         CC=gcc; export CC
    136         CXX=g++; export CXX
    137         ;;
    138     Solaris)
    139         THE_OS=SOLARIS
    140         THE_COMP="Sun's CC"
    141         CC=`which cc`; export CC
    142         CXX=`which CC`; export CXX
    143         RELEASE_CFLAGS="-xO4 -xlibmil"
    144         RELEASE_CXXFLAGS="-O4 -xlibmil"
    145         ;;
    146     Solaris/GCC)
    147         THE_OS=SOLARIS
    148         THE_COMP="the GNU C++"
    149         CC=gcc; export CC
    150         CXX=g++; export CXX
    151         RELEASE_CFLAGS=-O1
    152         RELEASE_CXXFLAGS=-O3
    153         ;;
    154     SolarisX86)
    155         THE_OS="SOLARIS X86"
    156         THE_COMP="Sun's CC"
    157         CC=`which cc`; export CC
    158         CXX=`which CC`; export CXX
    159         LDFLAGS="-L -lCrun";export LDFLAGS
    160         RELEASE_CFLAGS=-xO3
    161         RELEASE_CXXFLAGS=-O3
    162         ;;
    163     HP-UX/ACC)
    164         THE_OS="HP-UX 11"
    165         THE_COMP="aCC"
    166         CC=cc; export CC
    167         CXX=aCC; export CXX
    168         RELEASE_CFLAGS='+O2 +Ofltacc'
    169         RELEASE_CXXFLAGS='+O2 +Ofltacc'
    170         ;;
    171     IBMi)
    172         THE_OS="IBM i"
    173         THE_COMP="the iCC C++"
    174         CC=/usr/bin/icc; export CC
    175         CXX=/usr/bin/icc; export CXX
    176         MAKE=/usr/bin/gmake; export MAKE
    177         RELEASE_CFLAGS='-O4'
    178         RELEASE_CXXFLAGS='-O4'
    179         ;;
    180     Linux/ECC)
    181         THE_OS="Linux"
    182         THE_COMP="Intel ECC 7.1"
    183         CC=ecc; export CC
    184         CXX=ecpc; export CXX
    185         RELEASE_CFLAGS='-O2'
    186         RELEASE_CXXFLAGS='-O2'
    187         ;;
    188     Linux/ICC)
    189         THE_OS="Linux"
    190         THE_COMP="Intel ICC 9.0"
    191         CC=`which icc`; export CC
    192         CXX=`which icpc`; export CXX
    193         RELEASE_CFLAGS='-O'
    194         RELEASE_CXXFLAGS='-O'
    195         ;;
    196     Linux/VA)
    197         THE_OS="Linux"
    198         THE_COMP="IBM Visual Age C++ Compiler"
    199         CC=`which xlc_r`; export CC
    200         CXX=`which xlC_r`; export CXX
    201         RELEASE_CFLAGS="-O2 -qmaxmem=-1"
    202         RELEASE_CXXFLAGS="-O2 -qmaxmem=-1"
    203         ;;
    204     Linux*)
    205         THE_OS="Linux"
    206         THE_COMP="the GNU C++"
    207         CC=gcc; export CC
    208         CXX=g++; export CXX
    209         ;;
    210     Cygwin)
    211         THE_OS="Cygwin"
    212         THE_COMP="the GNU C++"
    213         RELEASE_CFLAGS='-O3'
    214         RELEASE_CXXFLAGS='-O3'
    215         ;;
    216     Cygwin/MSVC)
    217         THE_OS="Windows with Cygwin"
    218         THE_COMP="Microsoft Visual C++"
    219         CC=cl; export CC
    220         CXX=cl; export CXX
    221         RELEASE_CFLAGS='/O2 /Ob2 /Op'
    222         RELEASE_CXXFLAGS='/O2 /Ob2 /Op'
    223         DEBUG_CFLAGS='/Zi'
    224         DEBUG_CXXFLAGS='/Zi'
    225         DEBUG_LDFLAGS='/DEBUG'
    226         ;;
    227     Cygwin/MSVC2005)
    228         THE_OS="Windows with Cygwin"
    229         THE_COMP="Microsoft Visual C++ 2005"
    230         CC=cl; export CC
    231         CXX=cl; export CXX
    232         RELEASE_CFLAGS='/O2 /Ob2'
    233         RELEASE_CXXFLAGS='/O2 /Ob2'
    234         DEBUG_CFLAGS='/Zi'
    235         DEBUG_CXXFLAGS='/Zi'
    236         DEBUG_LDFLAGS='/DEBUG'
    237         ;;
    238     Cygwin/ICL)
    239         THE_OS="Windows with Cygwin"
    240         THE_COMP="Intel C++"
    241         CC=icl; export CC
    242         CXX=icl; export CXX
    243         # The Intel compiler has optimization bugs. So we disable optimization.
    244         RELEASE_CFLAGS='/Od'
    245         RELEASE_CXXFLAGS='/Od'
    246         DEBUG_CFLAGS='/Zi'
    247         DEBUG_CXXFLAGS='/Zi'
    248         DEBUG_LDFLAGS='/DEBUG'
    249         ;;
    250     MacOSX)
    251         THE_OS="MacOS X (Darwin)"
    252         THE_COMP="the GNU C++"
    253         RELEASE_CFLAGS='-O2'
    254         RELEASE_CXXFLAGS='-O2'
    255         ;;
    256     *BSD)
    257         THE_OS="BSD"
    258         THE_COMP="the GNU C++"
    259         CC=gcc; export CC
    260         CXX=g++; export CXX
    261         ;;
    262     TRU64V5.1/CXX)
    263         THE_OS="OSF1"
    264         THE_COMP="Compaq cxx"
    265         CC=cc; export CC
    266         CXX=cxx; export CXX
    267         ;;
    268     QNX)
    269         THE_OS="QNX"
    270         THE_COMP="QNX cc"
    271         CC=qcc; export CC
    272         CXX=QCC; export CXX
    273         ;;
    274     zOS)
    275         THE_OS="z/OS (OS/390)"
    276         THE_COMP="z/OS C/C++"
    277         CC=cc; export CC
    278         CXX=cxx; export CXX
    279         RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
    280         RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
    281         ;;
    282     zOSV1R2)
    283         THE_OS="z/OS 1.2"
    284         THE_COMP="z/OS 1.2 C/C++"
    285         CC=cc; export CC
    286         CXX=cxx; export CXX
    287         export COMPILE_LINK_ENVVAR='_CXX_CVERSION=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000'
    288         export _CXX_CVERSION=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000
    289         export LDFLAGS="-Wl,'compat=pm3'"
    290         export CFLAGS="-Wc,'target(zOSV1R2)'"
    291         export CXXFLAGS="-Wc,'target(zOSV1R2)'"
    292         export RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
    293         export RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
    294         ;;
    295     *)
    296         >&2 echo "$me: unrecognized platform \"$platform\" (use --help for help)"
    297         exit 1;;
    298 esac
    299 
    300 
    301 # Tweak flags
    302 
    303 if test $release -eq 1
    304 then
    305     if test "$RELEASE_CFLAGS" = ""
    306     then
    307         case $CC in
    308             gcc|*/gcc|*-gcc-*|*/*-gcc-*)
    309                 RELEASE_CFLAGS=-O3
    310                 ;;
    311         esac
    312     fi
    313     if test "$RELEASE_CFLAGS" != ""
    314     then
    315         CFLAGS="$CFLAGS $RELEASE_CFLAGS"
    316     fi
    317     if test "$RELEASE_CXXFLAGS" = ""
    318     then
    319         case $CXX in
    320             g++|*/g++|*-g++-*|*/*-g++-*)
    321                 RELEASE_CXXFLAGS=-O
    322                 ;;
    323         esac
    324     fi
    325     if test "$RELEASE_CXXFLAGS" != ""
    326     then
    327         CXXFLAGS="$CXXFLAGS $RELEASE_CXXFLAGS"
    328     fi
    329     if test "$RELEASE_LDFLAGS" != ""
    330     then
    331         LDFLAGS="$LDFLAGS $RELEASE_LDFLAGS"
    332     fi
    333 fi
    334 
    335 if test $debug -eq 1
    336 then
    337     if test "$DEBUG_CFLAGS" != ""
    338     then
    339         CFLAGS="$CFLAGS $DEBUG_CFLAGS"
    340     fi
    341     if test "$DEBUG_CXXFLAGS" != ""
    342     then
    343         CXXFLAGS="$CXXFLAGS $DEBUG_CXXFLAGS"
    344     fi
    345     if test "$DEBUG_LDFLAGS" != ""
    346     then
    347         LDFLAGS="$LDFLAGS $DEBUG_LDFLAGS"
    348     fi
    349 fi
    350 
    351 export CFLAGS
    352 export CXXFLAGS
    353 export LDFLAGS
    354 
    355 # Run configure
    356 
    357 echo "Running ./configure $OPTS $@ for $THE_OS using $THE_COMP compiler"
    358 echo
    359 if $configure $OPTS $@
    360 then
    361 	echo
    362 	echo If the result of the above commands looks okay to you, go to the directory
    363 	echo source in the ICU distribution to build ICU. Please remember that ICU needs
    364 	echo GNU make to build properly...
    365 else
    366 	echo $0: ./configure failed
    367 	exit 1
    368 fi
    369 
    370