mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 17:01:16 +00:00
ICU-12505 U_HAVE_STD_ATOMICS, reduce & simplify configure options. (#52)
This commit is contained in:
parent
388b46426f
commit
0a1513bcc9
3 changed files with 6 additions and 63 deletions
icu4c/source
|
@ -204,30 +204,18 @@ typedef size_t uintptr_t;
|
|||
|
||||
/**
|
||||
* \def U_HAVE_STD_ATOMICS
|
||||
* Defines whether the standard C++11 <atomic> is available.
|
||||
* ICU will use this when available,
|
||||
* otherwise will fall back to compiler or platform specific alternatives.
|
||||
* Defines whether to use the standard C++11 <atomic> functions
|
||||
* If false, ICU will fall back to compiler or platform specific alternatives.
|
||||
* Note: support for these fall back options for atomics will be removed in a future version
|
||||
* of ICU, and the use of C++ 11 atomics will be required.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_HAVE_STD_ATOMICS
|
||||
/* Use the predefined value. */
|
||||
#elif U_CPLUSPLUS_VERSION < 11
|
||||
/* Not C++11, disable use of atomics */
|
||||
# define U_HAVE_STD_ATOMICS 0
|
||||
#elif __clang__ && __clang_major__==3 && __clang_minor__<=1
|
||||
/* Clang 3.1, has atomic variable initializer bug. */
|
||||
# define U_HAVE_STD_ATOMICS 0
|
||||
#else
|
||||
/* U_HAVE_ATOMIC is typically set by an autoconf test of #include <atomic> */
|
||||
/* Can be set manually, or left undefined, on platforms without autoconf. */
|
||||
# if defined(U_HAVE_ATOMIC) && U_HAVE_ATOMIC
|
||||
# define U_HAVE_STD_ATOMICS 1
|
||||
# else
|
||||
# define U_HAVE_STD_ATOMICS 0
|
||||
# endif
|
||||
#else
|
||||
# define U_HAVE_STD_ATOMICS 1
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \def U_HAVE_CLANG_ATOMICS
|
||||
* Defines whether Clang c11 style built-in atomics are available.
|
||||
|
|
32
icu4c/source/configure
vendored
32
icu4c/source/configure
vendored
|
@ -673,7 +673,6 @@ U_HAVE_INTTYPES_H
|
|||
GENCCODE_ASSEMBLY
|
||||
HAVE_MMAP
|
||||
LIB_THREAD
|
||||
U_HAVE_ATOMIC
|
||||
ENABLE_RPATH
|
||||
U_ENABLE_DYLOAD
|
||||
U_HAVE_PLUGINS
|
||||
|
@ -6059,37 +6058,6 @@ $as_echo "$as_me: Adding CXXFLAGS option -std=c++11" >&6;}
|
|||
fi
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if #include <atomic> works" >&5
|
||||
$as_echo_n "checking if #include <atomic> works... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <atomic>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||
ac_cv_header_atomic=yes
|
||||
else
|
||||
ac_cv_header_atomic=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_atomic" >&5
|
||||
$as_echo "$ac_cv_header_atomic" >&6; }
|
||||
if test $ac_cv_header_atomic = yes
|
||||
then
|
||||
U_HAVE_ATOMIC=1
|
||||
else
|
||||
U_HAVE_ATOMIC=0
|
||||
fi
|
||||
# Make this available via CPPFLAGS
|
||||
CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_ATOMIC=${U_HAVE_ATOMIC}"
|
||||
|
||||
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
|
|
|
@ -527,19 +527,6 @@ if [[ "$GXX" = yes ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([[if #include <atomic> works]])
|
||||
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
|
||||
else
|
||||
U_HAVE_ATOMIC=0
|
||||
fi
|
||||
# Make this available via CPPFLAGS
|
||||
CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_ATOMIC=${U_HAVE_ATOMIC}"
|
||||
AC_SUBST(U_HAVE_ATOMIC)
|
||||
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
# Always build ICU with multi-threading support.
|
||||
|
|
Loading…
Add table
Reference in a new issue