ICU-10310 Improve C++11 handling in configure script
X-SVN-Rev: 34055
This commit is contained in:
parent
c3b0565eea
commit
53ddd94796
18
icu4c/source/configure
vendored
18
icu4c/source/configure
vendored
@ -3628,6 +3628,12 @@ if test "$GCC" = yes; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if CXXFLAGS has a "-std=" setting, do not override it later if does. -std=c++11, for example.
|
||||
CXX_STD_SET="no"
|
||||
if echo "$CXXFLAGS" | grep '\-std=' >/dev/null 2>&1 ; then
|
||||
CXX_STD_SET="yes"
|
||||
fi
|
||||
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
@ -5631,7 +5637,9 @@ fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if #include <atomic> works" >&5
|
||||
$as_echo_n "checking if #include <atomic> works... " >&6; }
|
||||
OLD_CXXFLAGS="${CXXFLAGS}"
|
||||
CXXFLAGS="${CXXFLAGS} -std=c++11"
|
||||
if [ $CXX_STD_SET = no ]; then
|
||||
CXXFLAGS="${CXXFLAGS} -std=c++0x"
|
||||
fi
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <atomic>
|
||||
@ -5654,10 +5662,11 @@ $as_echo "$ac_cv_header_atomic" >&6; }
|
||||
if test $ac_cv_header_atomic = yes
|
||||
then
|
||||
U_HAVE_ATOMIC=1
|
||||
CXX_STD_SET="yes"
|
||||
else
|
||||
U_HAVE_ATOMIC=0
|
||||
CXXFLAGS="${OLD_CXXFLAGS}"
|
||||
fi
|
||||
CXXFLAGS="${OLD_CXXFLAGS}"
|
||||
# Make this available via CPPFLAGS
|
||||
CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_ATOMIC=${U_HAVE_ATOMIC}"
|
||||
|
||||
@ -7069,7 +7078,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
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"
|
||||
if [ ${CXX_STD_SET} = "no" ]; then
|
||||
CXXFLAGS="${CXXFLAGS} -std=c++0x"
|
||||
fi
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
@ -7107,6 +7118,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
else
|
||||
CHECK_UTF16_STRING_RESULT="C++ only";
|
||||
fi
|
||||
CXX_STD_SET="yes"
|
||||
else
|
||||
CXXFLAGS="${OLD_CXXFLAGS}"
|
||||
fi
|
||||
|
@ -155,6 +155,12 @@ if test "$GCC" = yes; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if CXXFLAGS has a "-std=" setting, do not override it later if does. -std=c++11, for example.
|
||||
CXX_STD_SET="no"
|
||||
if [ echo "$CXXFLAGS" | grep '\-std=' >/dev/null 2>&1 ]; then
|
||||
CXX_STD_SET="yes"
|
||||
fi
|
||||
|
||||
AC_PROG_CPP
|
||||
|
||||
AC_PROG_INSTALL
|
||||
@ -477,16 +483,19 @@ AC_SUBST(U_HAVE_STD_STRING)
|
||||
|
||||
AC_MSG_CHECKING([[if #include <atomic> works]])
|
||||
OLD_CXXFLAGS="${CXXFLAGS}"
|
||||
CXXFLAGS="${CXXFLAGS} -std=c++11"
|
||||
if [[ $CXX_STD_SET = no ]]; then
|
||||
CXXFLAGS="${CXXFLAGS} -std=c++0x"
|
||||
fi
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <atomic>]], [[]])], [ac_cv_header_atomic=yes], [ac_cv_header_atomic=no])
|
||||
AC_MSG_RESULT($ac_cv_header_atomic)
|
||||
if test $ac_cv_header_atomic = yes
|
||||
then
|
||||
U_HAVE_ATOMIC=1
|
||||
CXX_STD_SET="yes"
|
||||
else
|
||||
U_HAVE_ATOMIC=0
|
||||
CXXFLAGS="${OLD_CXXFLAGS}"
|
||||
fi
|
||||
CXXFLAGS="${OLD_CXXFLAGS}"
|
||||
# Make this available via CPPFLAGS
|
||||
CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_ATOMIC=${U_HAVE_ATOMIC}"
|
||||
AC_SUBST(U_HAVE_ATOMIC)
|
||||
@ -998,7 +1007,9 @@ static const char16_t test[] = u"This is a UTF16 literal string.";
|
||||
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"
|
||||
if [[ ${CXX_STD_SET} = "no" ]]; then
|
||||
CXXFLAGS="${CXXFLAGS} -std=c++0x"
|
||||
fi
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
static const char16_t test[] = u"This is a UTF16 literal string.";
|
||||
@ -1010,6 +1021,7 @@ static const char16_t test[] = u"This is a UTF16 literal string.";
|
||||
else
|
||||
CHECK_UTF16_STRING_RESULT="C++ only";
|
||||
fi
|
||||
CXX_STD_SET="yes"
|
||||
else
|
||||
CXXFLAGS="${OLD_CXXFLAGS}"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user