]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/configure.in
ICU-511.25.tar.gz
[apple/icu.git] / icuSources / configure.in
index 26853b26dc5edb6f0d0610d2a2155879d12abee3..2e33779997d8cfadcf064f1d1b67ed2f2e1e06b9 100644 (file)
@@ -120,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
@@ -276,7 +278,7 @@ if test "$ENABLE_STATIC" = "YES"; then
             
             case "${host}" in
             *-linux*|i*86-*-*bsd*|i*86-pc-gnu)
-                if test "$ac_cv_c_compiler_gnu" = yes; then
+                if test "$GCC" = yes; then
                     CPPFLAGS="${CPPFLAGS} -ffunction-sections -fdata-sections"
                     LDFLAGS="${LDFLAGS} -Wl,--gc-sections"
                 fi
@@ -465,20 +467,9 @@ 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
@@ -545,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
@@ -689,13 +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
     AC_MSG_ERROR(Namespace support is required to build ICU.)
-    U_HAVE_NAMESPACE=0
 fi
-AC_SUBST(U_HAVE_NAMESPACE)
 
 AC_MSG_CHECKING([for properly overriding new and delete])
 U_OVERRIDE_CXX_ALLOCATION=0
@@ -918,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"
@@ -933,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"
@@ -956,7 +942,7 @@ case "${host}" in
     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
@@ -970,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,
@@ -1199,14 +1188,9 @@ 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)"
-else
-    CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DICU_USE_THREADS=0"
-fi
+CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)"
+CFLAGS="$CFLAGS \$(THREADSCFLAGS)"
+CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
 
 AC_SUBST(LIBCFLAGS)
 AC_SUBST(LIBCXXFLAGS)
@@ -1245,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 \
@@ -1267,6 +1251,7 @@ 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 \
@@ -1288,12 +1273,6 @@ 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"