ICU-13670 Changing CFLAGS to C11 and fixing check for unicode string literals.

X-SVN-Rev: 41263
This commit is contained in:
Shane Carr 2018-04-23 21:16:52 +00:00
parent 328730604b
commit 16aedd5e1a
4 changed files with 11 additions and 21 deletions

View file

@ -464,12 +464,12 @@ AC_DEFUN([AC_CHECK_STRICT_COMPILE],
then
case "${host}" in
*-*-solaris*)
# Don't use -std=c99 on Solaris because of timezone check fails
# Don't use -std=c11 on Solaris because of timezone check fails
;;
*)
# Do not use -ansi. It limits us to C90, and it breaks some platforms.
# We use -std=c99 to disable the gnu99 defaults and its associated warnings
CFLAGS="$CFLAGS -std=c99"
# We use -std=c11 to disable the gnu99 defaults and its associated warnings
CFLAGS="$CFLAGS -std=c11"
;;
esac

View file

@ -7,7 +7,7 @@
## Flags for ICU 59+
CXXFLAGS += -std=c++11
CFLAGS += -std=c99
CFLAGS += -std=c11
## Flags for position independent code
SHAREDLIBCFLAGS = -KPIC

View file

@ -4354,12 +4354,12 @@ $as_echo "$ac_use_strict_options" >&6; }
then
case "${host}" in
*-*-solaris*)
# Don't use -std=c99 on Solaris because of timezone check fails
# Don't use -std=c11 on Solaris because of timezone check fails
;;
*)
# Do not use -ansi. It limits us to C90, and it breaks some platforms.
# We use -std=c99 to disable the gnu99 defaults and its associated warnings
CFLAGS="$CFLAGS -std=c99"
# We use -std=c11 to disable the gnu99 defaults and its associated warnings
CFLAGS="$CFLAGS -std=c11"
;;
esac
@ -7473,15 +7473,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
esac
# GCC >= 4.4 supports UTF16 string literals. The CFLAGS and CXXFLAGS may change in the future.
# GCC >= 4.4 supports UTF16 string literals. As of ICU 62, both C and C++ files require them.
if test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then
if test "$GCC" = yes; then
OLD_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} -std=gnu99"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
static const char16_t test[] = u"This is a UTF16 literal string.";
static const unsigned short test[] = u"This is a UTF16 literal string.";
int
main ()
@ -7498,10 +7496,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}"
fi
fi
if test "$GXX" = yes; then

View file

@ -1038,19 +1038,14 @@ case "${host}" in
;;
esac
# GCC >= 4.4 supports UTF16 string literals. The CFLAGS and CXXFLAGS may change in the future.
# GCC >= 4.4 supports UTF16 string literals. As of spring 2018, all tested compilers support them.
if test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then
if test "$GCC" = yes; then
OLD_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} -std=gnu99"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
static const char16_t test[] = u"This is a UTF16 literal string.";
static const unsigned short 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}"
fi
fi
if test "$GXX" = yes; then