From: Steven R. Loomis Date: Fri, 30 Aug 2013 22:45:31 +0000 (+0000) Subject: ICU-10308 add back only the flags which make a difference X-Git-Tag: milestone-59-0-1~2641 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=97f490833e76ccc181624619c91583e907f235b6;p=icu ICU-10308 add back only the flags which make a difference X-SVN-Rev: 34157 --- diff --git a/icu4c/source/config/icu.pc.in b/icu4c/source/config/icu.pc.in index ce5251f3ea9..187b4d1489f 100644 --- a/icu4c/source/config/icu.pc.in +++ b/icu4c/source/config/icu.pc.in @@ -1,5 +1,11 @@ # Copyright (C) 2010-2013, International Business Machines Corporation. All Rights Reserved. +# CFLAGS contains only anything end users should set +CFLAGS = @UCONFIG_CFLAGS@ +# CXXFLAGS contains only anything end users should set +CXXFLAGS = @UCONFIG_CXXFLAGS@ +# DEFS only contains those UCONFIG_CPPFLAGS which are not auto-set by platform.h +DEFS = @UCONFIG_CPPFLAGS@ prefix = @prefix@ exec_prefix = @exec_prefix@ #bindir = @bindir@ diff --git a/icu4c/source/configure b/icu4c/source/configure index df318e9094e..a0f4f9e74c2 100755 --- a/icu4c/source/configure +++ b/icu4c/source/configure @@ -602,7 +602,10 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='LTLIBOBJS +ac_subst_vars='UCONFIG_CXXFLAGS +UCONFIG_CFLAGS +UCONFIG_CPPFLAGS +LTLIBOBJS LIBOBJS LIBCXXFLAGS LIBCFLAGS @@ -2712,6 +2715,9 @@ CONFIG_CPPFLAGS="" # with, for example, "#define U_DISABLE_RENAMING 1" # Example: ICU configuration stuff UCONFIG_CPPFLAGS="" +# UCONFIG_CFLAGS: contains a copy of anything that needs to be set by end users +# such as -std +UCONFIG_CFLAGS="" # Check whether to build debug libraries { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build debug libraries" >&5 @@ -5646,6 +5652,7 @@ $as_echo "$cxx11_okay" >&6; } if [ $cxx11_okay = yes ]; then { $as_echo "$as_me:${as_lineno-$LINENO}: Adding CXXFLAGS option --std=c++0x" >&5 $as_echo "$as_me: Adding CXXFLAGS option --std=c++0x" >&6;} + UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} --std=c++0x" else CXXFLAGS="$OLD_CXXFLAGS" fi @@ -5937,7 +5944,9 @@ fi CXXFLAGS="${CXXFLAGS} -mt" if test x"`${CXX} ${CXXFLAGS} 2>&1`" != x""; then CXXFLAGS="${OLD_CXXFLAGS}" - fi + else + UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -mt" + fi ;; esac ;; @@ -7031,6 +7040,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="${OLD_CFLAGS}" CXXFLAGS="${OLD_CXXFLAGS}" else + UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -qutf" CHECK_UTF16_STRING_RESULT="-qutf" fi fi @@ -7063,7 +7073,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS="${OLD_CXXFLAGS}" else CHECK_UTF16_STRING_RESULT="-xustr=ascii_utf16_ushort" - + UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -xustr=ascii_utf16_ushort" + UCONFIG_CFLAGS="${UCONFIG_CFLAGS} -xustr=ascii_utf16_ushort" # Since we can't detect the availability of this UTF-16 syntax at compile time, # we depend on configure telling us that we can use it. # Since we can't ensure ICU users use -xustr=ascii_utf16_ushort, @@ -7113,6 +7124,7 @@ else fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$CC_UTF16_STRING" = 1; then + UCONFIG_CFLAGS="${UCONFIG_CFLAGS} -std=gnu99" CHECK_UTF16_STRING_RESULT="C only"; else CFLAGS="${OLD_CFLAGS}" @@ -8720,6 +8732,7 @@ else $as_echo "too old or test failed - try upgrading GNU Make" >&6; } 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:" @@ -8757,6 +8770,15 @@ if test -n "$UCONFIG_CPPFLAGS"; then echo '--------------- end ' "${HDRFILE}" fi + +if test -n "$UCONFIG_CFLAGS"; then + echo "C apps may want to build with CFLAGS = ${UCONFIG_CFLAGS}" +fi + +if test -n "$UCONFIG_CXXFLAGS"; then + echo "C++ apps may want to build with CXXFLAGS = ${UCONFIG_CXXFLAGS}" +fi + if test "$tools" = false; then echo "## Note: you have disabled ICU's tools. This ICU cannot build its own data or tests." diff --git a/icu4c/source/configure.in b/icu4c/source/configure.in index c458ba19697..f3c1e19fbfd 100644 --- a/icu4c/source/configure.in +++ b/icu4c/source/configure.in @@ -95,6 +95,9 @@ CONFIG_CPPFLAGS="" # with, for example, "#define U_DISABLE_RENAMING 1" # Example: ICU configuration stuff UCONFIG_CPPFLAGS="" +# UCONFIG_CFLAGS: contains a copy of anything that needs to be set by end users +# such as -std +UCONFIG_CFLAGS="" # Check whether to build debug libraries AC_MSG_CHECKING([whether to build debug libraries]) @@ -478,6 +481,7 @@ if [[ "$GXX" = yes ]]; then AC_MSG_RESULT($cxx11_okay) if [[ $cxx11_okay = yes ]]; then AC_MSG_NOTICE([Adding CXXFLAGS option --std=c++0x]) + UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} --std=c++0x" else CXXFLAGS="$OLD_CXXFLAGS" fi @@ -567,7 +571,9 @@ if test $threads = true; then CXXFLAGS="${CXXFLAGS} -mt" if test x"`${CXX} ${CXXFLAGS} 2>&1`" != x""; then CXXFLAGS="${OLD_CXXFLAGS}" - fi + else + UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -mt" + fi ;; esac ;; @@ -959,6 +965,7 @@ case "${host}" in CFLAGS="${OLD_CFLAGS}" CXXFLAGS="${OLD_CXXFLAGS}" else + UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -qutf" CHECK_UTF16_STRING_RESULT="-qutf" fi fi @@ -975,7 +982,8 @@ case "${host}" in CXXFLAGS="${OLD_CXXFLAGS}" else CHECK_UTF16_STRING_RESULT="-xustr=ascii_utf16_ushort" - + UCONFIG_CXXFLAGS="${UCONFIG_CXXFLAGS} -xustr=ascii_utf16_ushort" + UCONFIG_CFLAGS="${UCONFIG_CFLAGS} -xustr=ascii_utf16_ushort" # Since we can't detect the availability of this UTF-16 syntax at compile time, # we depend on configure telling us that we can use it. # Since we can't ensure ICU users use -xustr=ascii_utf16_ushort, @@ -1009,6 +1017,7 @@ if test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then 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 + UCONFIG_CFLAGS="${UCONFIG_CFLAGS} -std=gnu99" CHECK_UTF16_STRING_RESULT="C only"; else CFLAGS="${OLD_CFLAGS}" @@ -1360,6 +1369,7 @@ else AC_MSG_RESULT([too old or test failed - try upgrading GNU Make]) fi +AC_SUBST(UCONFIG_CPPFLAGS) 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:" @@ -1397,6 +1407,15 @@ if test -n "$UCONFIG_CPPFLAGS"; then echo '--------------- end ' "${HDRFILE}" fi +AC_SUBST(UCONFIG_CFLAGS) +if test -n "$UCONFIG_CFLAGS"; then + echo "C apps may want to build with CFLAGS = ${UCONFIG_CFLAGS}" +fi +AC_SUBST(UCONFIG_CXXFLAGS) +if test -n "$UCONFIG_CXXFLAGS"; then + echo "C++ apps may want to build with CXXFLAGS = ${UCONFIG_CXXFLAGS}" +fi + if test "$tools" = false; then echo "## Note: you have disabled ICU's tools. This ICU cannot build its own data or tests."