]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/configure.in
ICU-511.35.tar.gz
[apple/icu.git] / icuSources / configure.in
index 107912b041db24e2fa257316a0d7689ca774f1bf..2e33779997d8cfadcf064f1d1b67ed2f2e1e06b9 100644 (file)
@@ -1,17 +1,23 @@
 # -*-autoconf-*-
-AC_COPYRIGHT([ Copyright (c) 1999-2010, International Business Machines Corporation and others. All Rights Reserved. ])
+AC_COPYRIGHT([ Copyright (c) 1999-2012, International Business Machines Corporation and others. All Rights Reserved. ])
 # configure.in for ICU
 # Stephen F. Booth, heavily modified by Yves and others
 
 # Check for autoconf version
-AC_PREREQ(2.67)
-
+AC_PREREQ(2.68)
 
 # Process this file with autoconf to produce a configure script
-AC_INIT
+AC_INIT([ICU])
+
+#TODO: IcuBug:8502
+#AC_INIT([ICU],
+#        m4_esyscmd_s([sed -n 's/^[    ]*#[    ]*define[       ]*U_ICU_VERSION[        ]*"\([^"]*\)".*/\1/p' "./common/unicode/uvernum.h]"),
+#        [http://icu-project.org/bugs],
+#        [International Components for Unicode],
+#        [http://icu-project.org])
+
 AC_CONFIG_SRCDIR([common/unicode/utypes.h])
 
-AC_CONFIG_HEADERS(common/icucfg.h)
 PACKAGE="icu"
 AC_SUBST(PACKAGE)
 
@@ -44,23 +50,23 @@ getuversion() {
 }
 VERSION=`geticuversion $srcdir/common/unicode/uvernum.h`
 if test x"$VERSION" = x; then
-    VERSION=`geticuversion $srcdir/common/unicode/*.h`
-    if test x"$VERSION" = x; then
-        AC_MSG_ERROR([Cannot determine ICU version number from uvernum.h header file])
-    fi
+   as_fn_error $? "Cannot determine ICU version number from uvernum.h header file" "$LINENO" 5
 fi
 
+#TODO: IcuBug:8502
+#if test "$VERSION" != "$PACKAGE_VERSION"; then
+#   AC_MSG_ERROR([configure was generated for $PACKAGE_VERSION but uvernum.h has $VERSION - please rerun autoconf])
+#fi
+
 UNICODE_VERSION=`getuversion $srcdir/common/unicode/uchar.h`
 if test x"$UNICODE_VERSION" = x; then
-    UNICODE_VERSION=`getuversion $srcdir/common/unicode/*.h`
-    if test x"$UNICODE_VERSION" = x; then
-        AC_MSG_ERROR([Cannot determine Unicode version number from uchar.h header file])
-    fi
+    AC_MSG_ERROR([Cannot determine Unicode version number from uchar.h header file])
 fi
 # Compute a reasonable library version from the release version. This is
 # very bad, but that's wanted... We want to make sure that the LIB_VERSION
 # has at least a dot in it, so we'll add a .0 if needed.
-[LIB_VERSION=`echo $VERSION | sed -e 's/\.//' -e 's/^\([^.]*\)$/\1.0/'`]
+#[LIB_VERSION=`echo $VERSION | sed -e 's/\.//' -e 's/^\([^.]*\)$/\1.0/'`]
+LIB_VERSION=$VERSION
 LIB_VERSION_MAJOR=`echo $LIB_VERSION | sed 's/\..*//'`
 AC_SUBST(VERSION)
 AC_SUBST(LIB_VERSION)
@@ -70,7 +76,7 @@ AC_MSG_RESULT([release $VERSION, library $LIB_VERSION, unicode version $UNICODE_
 AC_SUBST(UNICODE_VERSION)
 
 # Determine the host system
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_HOST
 
 AC_SUBST(CPPFLAGS)
 
@@ -78,14 +84,18 @@ AC_SUBST(CPPFLAGS)
 _CXX_CXXSUFFIX=cpp
 export _CXX_CXXSUFFIX
 
+# Accumulate #defines
+CONFIG_CPPFLAGS=""
+UCONFIG_CPPFLAGS=""
+
 # Check whether to build debug libraries
 AC_MSG_CHECKING([whether to build debug libraries])
 enabled=no
 ENABLE_DEBUG=0
 AC_ARG_ENABLE(debug,
-    [  --enable-debug          build debug libraries [default=no]],
+    [  --enable-debug          build debug libraries and enable the U_DEBUG define [default=no]],
     [ case "${enableval}" in
-         yes|"") enabled=yes; ENABLE_DEBUG=1 ;;
+         yes|"") enabled=yes; ENABLE_DEBUG=1; CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_DEBUG=1" ;;
          *) ;;   
     esac],  
 )
@@ -110,9 +120,11 @@ AC_SUBST(ENABLE_RELEASE)
 : ${CFLAGS=""}
 : ${CXXFLAGS=""}
 
-# Checks for programs
-AC_PROG_CC
-AC_PROG_CXX
+# Checks for compilers
+AC_PROG_CC([clang gcc cc c99 c89 xlc_r xlc cl.exe icc])
+# Make sure that we try clang++ first, which provides C++11 support.
+# The g++ compiler is less likely to support C++11.
+AC_PROG_CXX([clang++ g++ c++ gpp xlC_r xlC aCC CC cxx cc++ cl.exe icc FCC KCC RCC])
 
 # Ensure that if CXXFLAGS/CFLAGS were not set when calling configure, set it correctly based on (enable/disable) debug or release option
 # The release mode use is the default one for autoconf
@@ -254,6 +266,38 @@ AC_ARG_ENABLE(static,
 AC_MSG_RESULT($enabled)
 AC_SUBST(ENABLE_STATIC)
 
+# When building release static library, there might be some optimization flags we can use
+if test "$ENABLE_STATIC" = "YES"; then
+    if test "$ENABLE_SHARED" != "YES"; then
+        if test "$ENABLE_RELEASE" = 1; then
+            AC_MSG_CHECKING([whether we can use static library optimization option])
+            CHECK_STATIC_OPT_FLAG=no
+            
+            OLD_CPPFLAGS="${CPPFLAGS}"
+            OLD_LDFLAGS="${LDFLAGS}"
+            
+            case "${host}" in
+            *-linux*|i*86-*-*bsd*|i*86-pc-gnu)
+                if test "$GCC" = yes; then
+                    CPPFLAGS="${CPPFLAGS} -ffunction-sections -fdata-sections"
+                    LDFLAGS="${LDFLAGS} -Wl,--gc-sections"
+                fi
+                ;;
+            *)
+                ;;
+            esac
+            
+            AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [CHECK_STATIC_OPT_FLAG=yes], [CHECK_STATIC_OPT_FLAG=no])
+            AC_MSG_RESULT($CHECK_STATIC_OPT_FLAG)
+            if test "$CHECK_STATIC_OPT_FLAG" = no; then
+                CPPFLAGS="${OLD_CPPFLAGS}"
+                LDFLAGS="${OLD_LDFLAGS}"
+            fi
+        fi
+    fi
+fi
+
+
 # Check whether to enable auto cleanup of libraries
 AC_MSG_CHECKING([whether to enable auto cleanup of libraries])
 enabled=no
@@ -261,7 +305,10 @@ UCLN_NO_AUTO_CLEANUP=1
 AC_ARG_ENABLE(auto-cleanup,
     [  --enable-auto-cleanup   enable auto cleanup of libraries [default=no]],
     [ case "${enableval}" in
-         yes) enabled=yes; UCLN_NO_AUTO_CLEANUP=0 ;;
+         yes) enabled=yes; 
+         CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DUCLN_NO_AUTO_CLEANUP=0";
+         UCLN_NO_AUTO_CLEANUP=0
+          ;;
          *) ;;
     esac],
 )
@@ -293,75 +340,23 @@ U_DEFAULT_SHOW_DRAFT=1
 AC_ARG_ENABLE(draft,
     [  --enable-draft          enable draft APIs (and internal APIs) [default=yes]],
     [ case "${enableval}" in
-         no) enabled=no; U_DEFAULT_SHOW_DRAFT=0 ;;
+         no) enabled=no; U_DEFAULT_SHOW_DRAFT=0;
+         CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_DEFAULT_SHOW_DRAFT=0"
+          ;;
          *) ;;
     esac],
 )
 AC_MSG_RESULT($enabled)
 # Make sure that we can use draft API in ICU.
 if test "$U_DEFAULT_SHOW_DRAFT" = 0; then
-    CPPFLAGS="$CPPFLAGS -DU_SHOW_DRAFT_API"
+    CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_SHOW_DRAFT_API"
 fi
 AC_SUBST(U_DEFAULT_SHOW_DRAFT)
 
-# Check if we can hide variables from 
-AC_MSG_CHECKING([for library API export])
-SHAREDLIBEXPORT=no
-U_USE_GCC_VISIBILITY_ATTRIBUTE=0
-OLD_CFLAGS="${CFLAGS}"
-OLD_CXXFLAGS="${CXXFLAGS}"
-if test "$ac_cv_c_compiler_gnu" = yes; then
-    LIBCFLAGS="-fvisibility=hidden"
-    LIBCXXFLAGS="-fvisibility=hidden"
-    CFLAGS="${CFLAGS} ${LIBCFLAGS}"
-    CXXFLAGS="${CXXFLAGS} ${LIBCXXFLAGS}"
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([[__attribute__ ((visibility ("default"))) void f(void);
-#include <stdlib.h>]], [[exit(0);]])],[SHAREDLIBEXPORT=yes],[SHAREDLIBEXPORT=no])
-    if test "$SHAREDLIBEXPORT" = no; then
-        LIBCFLAGS=
-        LIBCXXFLAGS=
-    else
-        U_USE_GCC_VISIBILITY_ATTRIBUTE=1
-    fi
-else
-    case "${host}" in
-    *-*-solaris*)
-        LIBCFLAGS="-xldscope=hidden"
-        LIBCXXFLAGS="-xldscope=hidden"
-        CFLAGS="${CFLAGS} ${LIBCFLAGS}"
-        CXXFLAGS="${CXXFLAGS} ${LIBCXXFLAGS}"
-        AC_LINK_IFELSE([AC_LANG_PROGRAM([[__global void f(void);
-#include <stdlib.h>]], [[exit(0);]])],[SHAREDLIBEXPORT=yes],[SHAREDLIBEXPORT=no])
-        if test "$SHAREDLIBEXPORT" = no; then
-            LIBCFLAGS=
-            LIBCXXFLAGS=
-        fi
-        ;;
-    *-*-hpux*)
-        # ICU isn't set up to follow the HP syntax yet.
-        ;;
-    *)
-    esac
-fi
-# Restore to their original state because the Intel compiler chokes
-# on this option when checking for the wchar_t size, but the
-# option otherwise works.
-CFLAGS="${OLD_CFLAGS}"
-CXXFLAGS="${OLD_CXXFLAGS}"
-AC_MSG_RESULT($SHAREDLIBEXPORT)
-AC_SUBST(U_USE_GCC_VISIBILITY_ATTRIBUTE)
-AC_SUBST(LIBCFLAGS)
-AC_SUBST(LIBCXXFLAGS)
-
 AC_PROG_RANLIB
 
 # look for 'ar' the proper way
-#AC_PATH_PROG(AR,ar,[echo archiver ar not found re-run configure ; false],$PATH:/bin:/usr/bin:/usr/ccs/bin)
-AC_CHECK_TOOL(AR, ar)
-if test "x$AR" = "x"; then
-  AC_MSG_ERROR(Archiver ar not found. Set AR= or fix PATH)
-fi
-
+AC_CHECK_TOOL(AR, ar, false)
 
 AC_MSG_CHECKING([whether to enable renaming of symbols])
 enabled=yes
@@ -370,7 +365,9 @@ AC_ARG_ENABLE(renaming,
     [  --enable-renaming       add a version suffix to symbols [default=yes]],
     [ case "${enableval}" in
             yes|"") enabled=yes ;;
-            no) enabled=no; U_DISABLE_RENAMING=1 ;;
+            no) enabled=no; U_DISABLE_RENAMING=1;
+             UCONFIG_CPPFLAGS="${UCONFIG_CPPFLAGS} -DU_DISABLE_RENAMING=1"
+              ;;
             *) ;;
     esac],
 )
@@ -383,7 +380,9 @@ U_ENABLE_TRACING=0
 AC_ARG_ENABLE(tracing,
     [  --enable-tracing        enable function and data tracing [default=no]],
     [ case "${enableval}" in
-            yes|"") enabled=yes; U_ENABLE_TRACING=1 ;;
+            yes|"") enabled=yes; 
+                     CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_ENABLE_TRACING=1";
+                     U_ENABLE_TRACING=1 ;;
             no) enabled=no; U_ENABLE_TRACING=0 ;;
             *) ;;
     esac],
@@ -393,40 +392,43 @@ AC_SUBST(U_ENABLE_TRACING)
 
 
 U_ENABLE_DYLOAD=1
+enable=yes
 AC_MSG_CHECKING([whether to enable dynamic loading of plugins])
-enabled=check
 AC_ARG_ENABLE(dyload,
     [  --disable-dyload        disable dynamic loading [default=no]],
     [ case "${enableval}" in
             yes|"") 
                     U_ENABLE_DYLOAD=1
-                    enabled=check ;;
+                     enable=yes
+                     ;;
             no) 
                 U_ENABLE_DYLOAD=0;
-                enabled=disabled ;;
+                 enable=no;
+                 CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DU_ENABLE_DYLOAD=0";
+                 ;;
             *) ;;
     esac],
 )
+AC_MSG_RESULT($enable)
 AC_SUBST(U_ENABLE_DYLOAD)
 
-# goes into icucfg.h
-AC_CHECK_HEADERS([dlfcn.h])
-U_CHECK_DYLOAD=0
-#AC_MSG_RESULT($enabled)
-if test "$enabled" = "check"; then
-    AC_SEARCH_LIBS([dlopen], [dl])
-    AC_CHECK_FUNCS([dlopen])
-    U_CHECK_DYLOAD=1
+if test "$enable" = "yes"; then
+   AC_CHECK_HEADERS([dlfcn.h])
+   #AC_MSG_RESULT($enabled)
+   AC_SEARCH_LIBS([dlopen], [dl])
+   AC_CHECK_FUNCS([dlopen])
+
+   if test "x$ac_cv_func_dlopen" != xyes; then
+      CONFIG_CPPFLAGS="$CONFIG_CPPFLAGS -DHAVE_DLOPEN=0"
+   fi
 fi
-AC_SUBST(U_CHECK_DYLOAD)
 
 # Check for miscellanous functions.
-# These only go into common/icucfg.h and are NOT exported with ICU builds.
 # So, use for putil / tools only.
 # Note that this will generate HAVE_GETTIMEOFDAY, not U_HAVE_GETTIMEOFDAY
-# rerun 'autoheader' to regenerate icucfg.h.in
 AC_CHECK_FUNCS([gettimeofday])
 
+
 # Check whether to use the evil rpath or not
 AC_ARG_ENABLE(rpath,
     [  --enable-rpath          use rpath when linking [default is only if necessary]],
@@ -440,32 +442,13 @@ AC_ARG_ENABLE(rpath,
 AC_SUBST(ENABLE_RPATH)
 
 
-# set up U_INLINE.  
-# Copy the definition of AC_C_INLINE, with slight mods.
-#
-AC_CACHE_CHECK([for definition of U_INLINE for C], ac_cv_c_inline,
-[ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;} $ac_kw int foo() {]])],[ac_cv_c_inline=$ac_kw; break],[])
-  done
-  ])
-case "$ac_cv_c_inline" in
-      yes)       U_INLINE= "inline" ;;
-         no )       U_INLINE= ;;
-           *)       U_INLINE=$ac_cv_c_inline ;;
-esac
-AC_SUBST(U_INLINE)
 
-# set up U_HAVE_STD_STRING.
-# Copy the definition of AC_C_INLINE, with slight mods.
-#
-U_HAVE_STD_STRING=0
 AC_LANG_PUSH([C++])
 AC_MSG_CHECKING([[if we have a C++ compiler]])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[cxx_okay=yes],[cxx_okay=no])
 if test $cxx_okay = yes
 then
-       AC_MSG_RESULT([[congratulations]])
+       AC_MSG_RESULT([[Good]])
 else
        AC_MSG_RESULT([[no]])
        AC_MSG_ERROR([[C++ compiler $CXX does not work or no compiler found]])
@@ -477,24 +460,16 @@ AC_MSG_RESULT($ac_cv_header_stdstring)
 if test $ac_cv_header_stdstring = yes
 then
        U_HAVE_STD_STRING=1
+else
+        U_HAVE_STD_STRING=0
+        CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STD_STRING=0"
 fi
 AC_SUBST(U_HAVE_STD_STRING)
 AC_LANG_POP([C++])
 
+# Always build ICU with multi-threading support.
 threads=true
-
-# Enable/disable threads
-AC_ARG_ENABLE(threads,
-       [  --enable-threads        build ICU with thread safety [default=yes]],
-       [case "${enableval}" in
-               yes) threads=true ;;
-               no)  threads=false ;;
-               *) AC_MSG_ERROR(bad value ${enableval} for --enable-threads) ;;
-               esac], 
-       threads=true)
-ICU_CONDITIONAL(THREADS, test "$threads" = true)
-
-ICU_USE_THREADS=0
+ICU_USE_THREADS=1
 OLD_LIBS=${LIBS}
 
 if test $threads = true; then
@@ -561,8 +536,6 @@ if test $threads = true; then
   esac
 fi
 
-AC_SUBST(ICU_USE_THREADS)
-
 AC_ARG_ENABLE(weak-threads,
        [  --enable-weak-threads   weakly reference the threading library [default=no]],
        [case "${enableval}" in
@@ -590,6 +563,8 @@ AC_MSG_RESULT($ac_cv_func_mmap_ok)
 if test $ac_cv_func_mmap_ok = yes
 then
     HAVE_MMAP=1
+else
+    CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_MMAP=0"
 fi
 AC_SUBST(HAVE_MMAP)
 
@@ -598,7 +573,7 @@ AC_MSG_CHECKING([for genccode assembly])
 # Check to see if genccode can generate simple assembly.
 GENCCODE_ASSEMBLY=
 case "${host}" in
-*-linux*|i*86-*-*bsd*|i*86-pc-gnu)
+*-linux*|*-kfreebsd*-gnu*|i*86-*-*bsd*|i*86-pc-gnu)
     if test "$GCC" = yes; then
         # We're using gcc, and the simple -a gcc command line works for genccode
         GENCCODE_ASSEMBLY="-a gcc"
@@ -632,6 +607,7 @@ AC_MSG_RESULT($GENCCODE_ASSEMBLY)
 AC_CHECK_HEADERS(inttypes.h)
 if test $ac_cv_header_inttypes_h = no; then
  U_HAVE_INTTYPES_H=0
+ CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INTTYPES_H=0" 
 else
  U_HAVE_INTTYPES_H=1
 fi
@@ -639,6 +615,7 @@ if test "$CC" = ccc; then
  AC_MSG_RESULT("C compiler set to CCC ${CC}" )
  case "${host}" in
         alpha*-*-*) U_HAVE_INTTYPES_H=0;
+        CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INTTYPES_H=0"
  esac
 fi
 
@@ -646,79 +623,14 @@ AC_SUBST(U_HAVE_INTTYPES_H)
 
 AC_CHECK_HEADERS(dirent.h)
 if test $ac_cv_header_dirent_h = no; then
- U_HAVE_DIRENT_H=0
+ U_HAVE_DIRENT_H=0             
+ CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_DIRENT_H=0" 
 else
  U_HAVE_DIRENT_H=1
 fi
 
 AC_SUBST(U_HAVE_DIRENT_H)
 
-
-AC_ARG_WITH(iostream,
-       [  --with-iostream=version specify the version of iostream to use (none, old, std, auto) [default=auto]],
-       [case "${withval}" in
-               none) streams=none ;;
-               old) streams=198506 ;;
-               std) streams=199711 ;;
-               auto) streams= ;;
-               *) AC_MSG_ERROR(bad value ${withval} for --with-iostream) ;;
-               esac], 
-        [streams=])
-
-U_IOSTREAM_SOURCE=0
-if test x$streams != xnone
-then
-    AC_LANG_PUSH(C++)
-    OLD_CXXFLAGS="${CXXFLAGS}"
-    case "${icu_cv_host_frag}" in
-        mh-hpux-acc)
-            CXXFLAGS="${CXXFLAGS} -AA"
-        ;;
-    esac
-    AC_MSG_CHECKING([for iostream usability])
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <iostream>]], [[]])],[ac_cv_header_iostream=yes],[ac_cv_header_iostream=no])
-    if test $icu_cv_host_frag = mh-cygwin-msvc
-    then
-        # <iostream> is always there on Windows.
-        # We do this to prevent the C++ preprocessor from being used because
-        # autoconf can't deal with the Windows C++ preprocessor 
-        ac_cv_header_iostream=yes
-    fi
-    AC_MSG_RESULT($ac_cv_header_iostream)
-    if test $ac_cv_header_iostream = yes
-    then
-        U_IOSTREAM_SOURCE=199711
-    else
-        CXXFLAGS="${OLD_CXXFLAGS}"
-        AC_MSG_CHECKING([whether ostream in iostream.h is really defined])
-        AC_CACHE_VAL(ac_cv_iostream_ok,
-            AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream.h>]], [[ostream &testout = cout; testout << "test" << endl;]])],[ac_cv_iostream_ok=yes],[ac_cv_iostream_ok=no]))
-        AC_MSG_RESULT($ac_cv_iostream_ok)
-        if test $ac_cv_iostream_ok = yes
-        then
-            U_IOSTREAM_SOURCE=198506
-        fi
-    fi
-    if test x$streams != x
-    then
-        if test $U_IOSTREAM_SOURCE -ge $streams
-        then
-            U_IOSTREAM_SOURCE=$streams
-            case "${icu_cv_host_frag}" in
-                mh-hpux-acc)
-                    if test $U_IOSTREAM_SOURCE -lt 199711; then
-                        CXXFLAGS=${OLD_CXXFLAGS}
-                    fi
-                ;;
-            esac
-        else
-            AC_MSG_ERROR(${withval} iostream is not available)
-        fi
-    fi
-fi
-AC_SUBST(U_IOSTREAM_SOURCE)
-AC_LANG_POP
-
 # Check for endianness
 AC_C_BIGENDIAN()
 if test $ac_cv_c_bigendian = no; then
@@ -746,6 +658,12 @@ if test $U_HAVE_NL_LANGINFO -eq 1; then
   then
       U_HAVE_NL_LANGINFO_CODESET=1
       U_NL_LANGINFO_CODESET=$ac_cv_nl_langinfo_codeset
+      if test "x${ac_cv_nl_langinfo_codeset}" != "xCODESET"
+      then
+        CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DNL_LANGINFO_CODESET=${ac_cv_nl_langinfo_codeset}"
+      fi
+  else
+      CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_NL_LANGINFO_CODESET=0"
   fi
 fi
 AC_SUBST(U_HAVE_NL_LANGINFO_CODESET)
@@ -760,12 +678,10 @@ AC_CACHE_VAL(ac_cv_namespace_ok,
     using namespace x_version;
     ], [f();])],[ac_cv_namespace_ok=yes],[ac_cv_namespace_ok=no])] )
 AC_MSG_RESULT($ac_cv_namespace_ok)
-U_HAVE_NAMESPACE=1
 if test $ac_cv_namespace_ok = no
 then
-    U_HAVE_NAMESPACE=0
+    AC_MSG_ERROR(Namespace support is required to build ICU.)
 fi
-AC_SUBST(U_HAVE_NAMESPACE)
 
 AC_MSG_CHECKING([for properly overriding new and delete])
 U_OVERRIDE_CXX_ALLOCATION=0
@@ -801,36 +717,22 @@ then
     if test $ac_cv_override_placement_new_ok = yes
     then
         U_HAVE_PLACEMENT_NEW=1
+    else
+        CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_PLACEMENT_NEW=0"
     fi
+else
+    CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_OVERRIDE_CXX_ALLOCATION=0"
 fi
 AC_SUBST(U_OVERRIDE_CXX_ALLOCATION)
 AC_SUBST(U_HAVE_PLACEMENT_NEW)
 
-# gcc atomic built-in functions check
-# AC_TRY_LINK([], [int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 1);],, 
-AC_LANG(C)
-AC_MSG_CHECKING([for gcc atomic functions])
-AC_LINK_IFELSE([AC_LANG_PROGRAM(
-    [[
-        void *p;
-        int   i;
-    ]],
-    [[
-        __sync_fetch_and_add(&i, 1);
-        __sync_fetch_and_sub(&i, 1);
-        __sync_val_compare_and_swap(&p, 0, 0);
-    ]]
-)],
-[U_HAVE_GCC_ATOMICS=1; AC_MSG_RESULT([yes])],
-[U_HAVE_GCC_ATOMICS=0; AC_MSG_RESULT([no])])
-AC_SUBST(U_HAVE_GCC_ATOMICS)
-
 AC_LANG(C)
 AC_CHECK_FUNC(popen)
 if test x$ac_cv_func_popen = xyes
 then
      U_HAVE_POPEN=1
 else
+     CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_POPEN=0"
      U_HAVE_POPEN=0
 fi
 AC_SUBST(U_HAVE_POPEN)
@@ -847,6 +749,8 @@ else
     then
         U_TZSET=_tzset
         U_HAVE_TZSET=1
+    else
+      CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZSET=0"
     fi
 fi
 AC_SUBST(U_HAVE_TZSET)
@@ -873,6 +777,8 @@ else
     if test $ac_cv_var__tzname = yes; then
       U_TZNAME=_tzname
       U_HAVE_TZNAME=1
+    else
+     CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TZNAME=0"
     fi
 fi
 AC_SUBST(U_HAVE_TZNAME)
@@ -903,6 +809,8 @@ else
     if test $ac_cv_var__timezone = yes; then
       U_TIMEZONE=_timezone
       U_HAVE_TIMEZONE=1
+    else
+     CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_TIMEZONE=0"
     fi
   fi
 fi
@@ -920,60 +828,36 @@ AC_CHECK_TYPE(int64_t,signed long long)
 AC_CHECK_TYPE(uint64_t,unsigned long long)
 
 if test $ac_cv_type_int8_t = no; then
-HAVE_INT8_T=0
-else
-HAVE_INT8_T=1
+CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT8_T=0"
 fi
-AC_SUBST(HAVE_INT8_T)
 
 if test $ac_cv_type_uint8_t = no; then
-HAVE_UINT8_T=0
-else
-HAVE_UINT8_T=1
+CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT8_T=0"
 fi
-AC_SUBST(HAVE_UINT8_T)
 
 if test $ac_cv_type_int16_t = no; then
-HAVE_INT16_T=0
-else
-HAVE_INT16_T=1
+CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT16_T=0"
 fi
-AC_SUBST(HAVE_INT16_T)
 
 if test $ac_cv_type_uint16_t = no; then
-HAVE_UINT16_T=0
-else
-HAVE_UINT16_T=1
+CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT16_T=0"
 fi
-AC_SUBST(HAVE_UINT16_T)
 
 if test $ac_cv_type_int32_t = no; then
-HAVE_INT32_T=0
-else
-HAVE_INT32_T=1
+CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT32_T=0"
 fi
-AC_SUBST(HAVE_INT32_T)
 
 if test $ac_cv_type_uint32_t = no; then
-HAVE_UINT32_T=0
-else
-HAVE_UINT32_T=1
+CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT32_T=0"
 fi
-AC_SUBST(HAVE_UINT32_T)
 
 if test $ac_cv_type_int64_t = no; then
-HAVE_INT64_T=0
-else
-HAVE_INT64_T=1
+CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_INT64_T=0"
 fi
-AC_SUBST(HAVE_INT64_T)
 
 if test $ac_cv_type_uint64_t = no; then
-HAVE_UINT64_T=0
-else
-HAVE_UINT64_T=1
+CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_UINT64_T=0"
 fi
-AC_SUBST(HAVE_UINT64_T)
 
 # Do various wchar_t related checks
 AC_CHECK_HEADER(wchar.h)
@@ -981,6 +865,7 @@ if test "$ac_cv_header_wchar_h" = no
 then
     U_HAVE_WCHAR_H=0
     U_HAVE_WCSCPY=0
+    CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_WCHAR_H=0 -DU_HAVE_WCSCPY=0"
 else
     AC_DEFINE([HAVE_WCHAR_H], [1], [wchar.h was found.])
     U_HAVE_WCHAR_H=1
@@ -990,6 +875,7 @@ else
       U_HAVE_WCSCPY=1
     else
       U_HAVE_WCSCPY=0
+      CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_WCSCPY=0"
     fi
 fi
 AC_SUBST(U_HAVE_WCHAR_H)
@@ -1011,7 +897,6 @@ if test $U_SIZEOF_WCHAR_T = 0; then
        AC_MSG_ERROR(There is wchar.h but the size of wchar_t is 0)
     fi
 fi
-AC_SUBST(U_SIZEOF_WCHAR_T)
 
 AC_MSG_CHECKING([for UTF-16 string literal support])
 U_CHECK_UTF16_STRING=1
@@ -1019,7 +904,7 @@ CHECK_UTF16_STRING_RESULT="unknown"
 
 case "${host}" in
 *-*-aix*|powerpc64-*-linux*)
-    if test "$ac_cv_c_compiler_gnu" = no; then
+    if test "$GCC" = no; then
         OLD_CFLAGS="${CFLAGS}"
         OLD_CXXFLAGS="${CXXFLAGS}"
         CFLAGS="${CFLAGS} -qutf"
@@ -1034,7 +919,7 @@ case "${host}" in
     fi
     ;;
 *-*-solaris*)
-    if test "$ac_cv_c_compiler_gnu" = no; then
+    if test "$GCC" = no; then
         OLD_CFLAGS="${CFLAGS}"
         OLD_CXXFLAGS="${CXXFLAGS}"
         CFLAGS="${CFLAGS} -xustr=ascii_utf16_ushort"
@@ -1051,13 +936,13 @@ case "${host}" in
             # Since we can't ensure ICU users use -xustr=ascii_utf16_ushort,
             # we only use this macro within ICU.
             # If an ICU user uses icu-config, this feature will be enabled.
-            CPPFLAGS="${CPPFLAGS} -DU_CHECK_UTF16_STRING=1"
+            CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_CHECK_UTF16_STRING=1"
             U_CHECK_UTF16_STRING=0
         fi
     fi
     ;;
 *-*-hpux*)
-    if test "$ac_cv_c_compiler_gnu" = no; then
+    if test "$GCC" = no; then
         # The option will be detected at compile time without additional compiler options.
         CHECK_UTF16_STRING_RESULT="available"
     fi
@@ -1071,37 +956,40 @@ case "${host}" in
 esac
 
 # GCC >= 4.4 supports UTF16 string literals. The CFLAGS and CXXFLAGS may change in the future.
-# Since we have to use a different standard, if strict is enable, don't enable UTF16 string literals.
-U_CHECK_GNUC_UTF16_STRING=0
-if test "$ac_use_strict_options" = no && test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then
-    if test "$ac_cv_c_compiler_gnu" = yes; then
+if test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then
+    if test "$GCC" = yes; then
         OLD_CFLAGS="${CFLAGS}"
-        OLD_CXXFLAGS="${CXXFLAGS}"
-        CFLAGS="${CFLAGS} -std=gnu99 -D_GCC_"
-        CXXFLAGS="${CXXFLAGS} -std=c++0x"
+        CFLAGS="${CFLAGS} -std=gnu99"
         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
-#ifdef _GCC_
-typedef __CHAR16_TYPE__ char16_t;
-#endif
-char16_t test[] = u"This is a UTF16 literal string.";
-#else
-GCC IS TOO OLD!
-#endif
-        ]], [[]])],[U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0])
-        if test "$U_CHECK_UTF16_STRING" = 1; then
-            CHECK_UTF16_STRING_RESULT="available";
-            U_CHECK_GNUC_UTF16_STRING=1
+static const char16_t test[] = u"This is a UTF16 literal string.";
+        ]], [[]])],[CC_UTF16_STRING=1],[CC_UTF16_STRING=0])
+        if test "$CC_UTF16_STRING" = 1; then
+            CHECK_UTF16_STRING_RESULT="C only";
         else
             CFLAGS="${OLD_CFLAGS}"
+        fi
+    fi
+    if test "$GXX" = yes; then
+        OLD_CXXFLAGS="${CXXFLAGS}"
+        # -Wno-return-type-c-linkage is desired so that stable ICU API is not warned about.
+        CXXFLAGS="${CXXFLAGS} -std=c++11"
+        AC_LANG_PUSH([C++])
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+static const char16_t test[] = u"This is a UTF16 literal string.";
+        ]], [[]])],[CXX_UTF16_STRING=1],[CXX_UTF16_STRING=0])
+        AC_LANG_POP([C++])
+        if test "$CXX_UTF16_STRING" = 1; then
+            if test "$CC_UTF16_STRING" = 1; then
+                CHECK_UTF16_STRING_RESULT="available";
+            else
+                CHECK_UTF16_STRING_RESULT="C++ only";
+            fi
+        else
             CXXFLAGS="${OLD_CXXFLAGS}"
         fi
     fi
 fi
-AC_SUBST(U_CHECK_GNUC_UTF16_STRING)
-
 AC_MSG_RESULT($CHECK_UTF16_STRING_RESULT)
-AC_SUBST(U_CHECK_UTF16_STRING)
 
 # Enable/disable extras
 AC_ARG_ENABLE(extras,
@@ -1225,6 +1113,7 @@ if test "$ICULIBSUFFIX" != ""
 then
     U_HAVE_LIB_SUFFIX=1
     ICULIBSUFFIXCNAME=`echo _$ICULIBSUFFIX | sed 's/[^A-Za-z0-9_]/_/g'`
+    UCONFIG_CPPFLAGS="${UCONFIG_CPPFLAGS} -DU_HAVE_LIB_SUFFIX=1 -DU_LIB_SUFFIX_C_NAME=${ICULIBSUFFIXCNAME} "
 else
     U_HAVE_LIB_SUFFIX=0
 fi
@@ -1267,7 +1156,8 @@ case "${host}" in
        *-*-aix*)       platform=U_AIX ;;
        *-*-hpux*)      platform=U_HPUX ;;
        *-apple-darwin*|*-apple-rhapsody*)      platform=U_DARWIN ;;
-       *-*-cygwin*|*-*-mingw*) platform=U_CYGWIN ;;
+       *-*-cygwin*)    platform=U_CYGWIN ;;
+       *-*-mingw*)     platform=U_MINGW ;;
        *-*ibm-openedition*|*-*-os390*) platform=OS390
                        if test "${ICU_ENABLE_ASCII_STRINGS}" != "1"; then
                                ICUDATA_CHAR="e"
@@ -1295,16 +1185,23 @@ if test "${FORCE_LIBS}" != ""; then
    LIBS=${FORCE_LIBS}
 fi
 
-
 # Now that we're done using CPPFLAGS etc. for tests, we can change it
 # for build.
 
-if test $ICU_USE_THREADS -ne 0
-then
-    CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)"
-    CFLAGS="$CFLAGS \$(THREADSCFLAGS)"
-    CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
-fi
+CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)"
+CFLAGS="$CFLAGS \$(THREADSCFLAGS)"
+CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
+
+AC_SUBST(LIBCFLAGS)
+AC_SUBST(LIBCXXFLAGS)
+
+# append all config cppflags
+CPPFLAGS="$CPPFLAGS $CONFIG_CPPFLAGS $UCONFIG_CPPFLAGS"
+
+echo "CPPFLAGS=$CPPFLAGS"
+echo "CFLAGS=$CFLAGS"
+echo "CXXFLAGS=$CXXFLAGS"
+
 
 # output the Makefiles
 AC_CONFIG_FILES([icudefs.mk \
@@ -1332,7 +1229,7 @@ AC_CONFIG_FILES([icudefs.mk \
                tools/genccode/Makefile \
                tools/gencmn/Makefile \
                tools/gencnval/Makefile \
-               tools/genctd/Makefile \
+               tools/gendict/Makefile \
                tools/gentest/Makefile \
                tools/gennorm2/Makefile \
                tools/genbrk/Makefile \
@@ -1354,11 +1251,14 @@ AC_CONFIG_FILES([icudefs.mk \
                test/letest/Makefile \
                test/perf/Makefile \
                test/perf/collationperf/Makefile \
+               test/perf/collperf/Makefile \
+               test/perf/dicttrieperf/Makefile \
                test/perf/ubrkperf/Makefile \
                test/perf/charperf/Makefile \
                test/perf/convperf/Makefile \
                test/perf/normperf/Makefile \
                test/perf/DateFmtPerf/Makefile \
+               test/perf/howExpensiveIs/Makefile \
                test/perf/strsrchperf/Makefile \
                test/perf/unisetperf/Makefile \
                test/perf/usetperf/Makefile \
@@ -1366,20 +1266,13 @@ AC_CONFIG_FILES([icudefs.mk \
                test/perf/utfperf/Makefile \
                test/perf/utrie2perf/Makefile \
                samples/Makefile samples/date/Makefile \
-               samples/cal/Makefile samples/layout/Makefile \
-               common/unicode/platform.h])
+               samples/cal/Makefile samples/layout/Makefile])
 AC_OUTPUT
 
 echo 
 echo "ICU for C/C++ $VERSION is ready to be built."
 echo "=== Important Notes: ==="
 
-if test $ICU_USE_THREADS = 0; then
-  echo
-  echo  "** ICU was configured without mutex or thread support. Multithread-safe operation will not be tested. If this is unexpected, then run configure with --enable-threads=yes or check the messages [above] to see why thread support was not found." 1>&6
-  echo
-fi
-
 echo "Data Packaging: $datapackaging"
 echo " This means: $datapackaging_msg"
 echo " To locate data: $datapackaging_howfound"
@@ -1391,6 +1284,9 @@ echo "** WARNING: $U_MAKE may not be GNU make."
 echo "This may cause ICU to fail to build. Please make sure that GNU make"
 echo "is in your PATH so that the configure script can detect its location."
 fi
+if test "x$AR" = "xfalse"; then
+  echo "*** WARNING: Archiver ar not found. Set AR= or fix PATH. Some builds (such as static) may fail."
+fi
 
 AC_MSG_CHECKING([the version of "$U_MAKE"])
 if "$U_MAKE" -f "$srcdir/config/gmakever.mk" PLATFORM="$platform"; then
@@ -1399,4 +1295,41 @@ else
 AC_MSG_RESULT([too old or test failed - try upgrading GNU Make])
 fi
 
+if test -n "$UCONFIG_CPPFLAGS"; then
+   HDRFILE="uconfig.h.prepend"
+   echo "*** WARNING: You must set the following flags before code compiled against this ICU will function properly:"
+   echo 
+   echo "   ${UCONFIG_CPPFLAGS}"
+   echo
+   echo 'The recommended way to do this is to prepend the following lines to source/common/unicode/uconfig.h or #include them near the top of that file.'
+   echo "Creating the file ${HDRFILE}"
+   echo
+   echo '---------------   ' "${HDRFILE}"
+   echo > "${HDRFILE}"
+   echo '/* ICU customizations: put these lines at the top of uconfig.h */' >> "${HDRFILE}"
+   echo >> "${HDRFILE}"
+   for flag in ${UCONFIG_CPPFLAGS};
+   do
+        echo " /* $flag */" >> "${HDRFILE}"
+        case "${flag}" in
+        -D*=*)
+          [ \echo "${flag}" | sed -n 's%-D\([^=]*\)=%#define \1 %p' >> "${HDRFILE}" ]
+          \echo >> "${HDRFILE}"
+          ;;
+        -D*)
+          [ \echo "${flag}" | sed -n 's%-D\([^=]*\)%#define \1 %p' >> "${HDRFILE}" ]
+          \echo >> "${HDRFILE}"
+          ;;
+        *)
+          \echo "/*  Not sure how to handle this argument: ${flag} */" >> "${HDRFILE}"
+          \echo >> "${HDRFILE}"
+          ;;
+        esac
+   done
+   cat "${HDRFILE}"
+   \echo  "/* End of ${HDRFILE} ------------ */" >> "${HDRFILE}"
+   echo >> "${HDRFILE}"
+   echo '--------------- end ' "${HDRFILE}"
+fi
+
 $as_unset _CXX_CXXSUFFIX