ICU-10310 C++11 checking in configure script.
X-SVN-Rev: 34057
This commit is contained in:
parent
53ddd94796
commit
7c9e0aa2e8
55
icu4c/source/configure
vendored
55
icu4c/source/configure
vendored
@ -3628,12 +3628,6 @@ 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'
|
||||
@ -5603,6 +5597,42 @@ $as_echo "no" >&6; }
|
||||
as_fn_error $? "C++ compiler $CXX does not work or no compiler found" "$LINENO" 5
|
||||
fi
|
||||
|
||||
if [ "$GXX" = yes ]; then
|
||||
# if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++0x,
|
||||
# and check that the compiler still works.
|
||||
if ! echo "$CXXFLAGS" | grep '\-std=' >/dev/null 2>&1; then
|
||||
OLD_CXXFLAGS="${CXXFLAGS}"
|
||||
CXXFLAGS="$CXXFLAGS --std=c++0x"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have a C++11 compiler" >&5
|
||||
$as_echo_n "checking if we have a C++11 compiler... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||
cxx11_okay=yes
|
||||
else
|
||||
cxx11_okay=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cxx11_okay" >&5
|
||||
$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;}
|
||||
else
|
||||
CXXFLAGS="$OLD_CXXFLAGS"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if #include <string> works" >&5
|
||||
$as_echo_n "checking if #include <string> works... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
@ -5636,10 +5666,6 @@ 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}"
|
||||
if [ $CXX_STD_SET = no ]; then
|
||||
CXXFLAGS="${CXXFLAGS} -std=c++0x"
|
||||
fi
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <atomic>
|
||||
@ -5662,10 +5688,8 @@ $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
|
||||
# Make this available via CPPFLAGS
|
||||
CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_ATOMIC=${U_HAVE_ATOMIC}"
|
||||
@ -7076,11 +7100,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
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.
|
||||
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'
|
||||
@ -7118,9 +7138,6 @@ 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
|
||||
fi
|
||||
fi
|
||||
|
@ -155,12 +155,6 @@ 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
|
||||
@ -468,6 +462,23 @@ else
|
||||
AC_MSG_ERROR([[C++ compiler $CXX does not work or no compiler found]])
|
||||
fi
|
||||
|
||||
if [[ "$GXX" = yes ]]; then
|
||||
# if CXXFLAGS does not have a "-std=" setting, set it now to -std=c++0x,
|
||||
# and check that the compiler still works.
|
||||
if ! echo "$CXXFLAGS" | grep '\-std=' >/dev/null 2>&1; then
|
||||
OLD_CXXFLAGS="${CXXFLAGS}"
|
||||
CXXFLAGS="$CXXFLAGS --std=c++0x"
|
||||
AC_MSG_CHECKING([[if we have a C++11 compiler]])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[cxx11_okay=yes],[cxx11_okay=no])
|
||||
AC_MSG_RESULT($cxx11_okay)
|
||||
if [[ $cxx11_okay = yes ]]; then
|
||||
AC_MSG_NOTICE([Adding CXXFLAGS option --std=c++0x])
|
||||
else
|
||||
CXXFLAGS="$OLD_CXXFLAGS"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([[if #include <string> works]])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string>]], [[]])], [ac_cv_header_stdstring=yes], [ac_cv_header_stdstring=no])
|
||||
AC_MSG_RESULT($ac_cv_header_stdstring)
|
||||
@ -482,19 +493,13 @@ AC_SUBST(U_HAVE_STD_STRING)
|
||||
|
||||
|
||||
AC_MSG_CHECKING([[if #include <atomic> works]])
|
||||
OLD_CXXFLAGS="${CXXFLAGS}"
|
||||
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
|
||||
# Make this available via CPPFLAGS
|
||||
CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_ATOMIC=${U_HAVE_ATOMIC}"
|
||||
@ -1005,11 +1010,7 @@ static const char16_t test[] = u"This is a UTF16 literal string.";
|
||||
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.
|
||||
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.";
|
||||
@ -1021,9 +1022,6 @@ 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
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user