summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorWeiY <wei.a.yang@gmail.com>2013-07-15 23:31:13 +0800
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-17 13:07:33 +0200
commit2e7f57986576cf19b20f0fa8a9e8edd810215c73 (patch)
treea9090f44c914871b4c9a6958ec7df51e4adad46d /cpukit
parentsmpatomic test case update (diff)
downloadrtems-2e7f57986576cf19b20f0fa8a9e8edd810215c73.tar.bz2
stdatomic.h support check when configure
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/aclocal/check-atomic.m412
-rw-r--r--cpukit/configure.ac7
-rw-r--r--cpukit/rtems/Makefile.am2
-rw-r--r--cpukit/rtems/preinstall.am2
-rw-r--r--cpukit/score/Makefile.am2
-rw-r--r--cpukit/score/preinstall.am3
6 files changed, 23 insertions, 5 deletions
diff --git a/cpukit/aclocal/check-atomic.m4 b/cpukit/aclocal/check-atomic.m4
index 97943eb768..00149f8a12 100644
--- a/cpukit/aclocal/check-atomic.m4
+++ b/cpukit/aclocal/check-atomic.m4
@@ -5,9 +5,13 @@ AC_REQUIRE([RTEMS_CANONICAL_TARGET_CPU])dnl
AC_CACHE_CHECK([whether CPU supports atomic operations],
[rtems_cv_ATOMIC],[
- AS_IF(
- [test -f "${srcdir}/score/cpu/$RTEMS_CPU/rtems/score/cpuatomic.h"],
- [rtems_cv_ATOMIC="yes"],
- [rtems_cv_ATOMIC="no"])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <stdatomic.h>]],
+ [[atomic_uint_fast32_t t; atomic_init(&t, 0);
+ atomic_store( &t, 1 );
+ atomic_exchange( &t, 2 );
+ atomic_fetch_add( &t, 3 );]])],
+ [rtems_cv_ATOMIC="yes"],
+ [rtems_cv_ATOMIC="no"])
])
])
diff --git a/cpukit/configure.ac b/cpukit/configure.ac
index d82d30f039..f897eced5c 100644
--- a/cpukit/configure.ac
+++ b/cpukit/configure.ac
@@ -149,6 +149,7 @@ RTEMS_CHECK_MULTIPROCESSING
RTEMS_CHECK_POSIX_API
RTEMS_CHECK_NETWORKING
RTEMS_CHECK_SMP
+RTEMS_CHECK_ATOMIC
rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
@@ -186,6 +187,11 @@ RTEMS_CPUOPT([RTEMS_NETWORKING],
[1],
[if networking is enabled])
+RTEMS_CPUOPT([RTEMS_ATOMIC],
+ [test x"$rtems_cv_ATOMIC" = xyes],
+ [1],
+ [if cpu supports atomic operations])
+
RTEMS_CPUOPT([RTEMS_VERSION],
[true],
["]_RTEMS_VERSION["],
@@ -304,6 +310,7 @@ AM_CONDITIONAL(HAS_SMP,[test "$RTEMS_HAS_SMP" = "yes"])
AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
+AM_CONDITIONAL([ATOMIC],[test x"$rtems_cv_ATOMIC" = x"yes"])
AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index a9b4ca848b..31e2c3d4be 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -40,7 +40,9 @@ include_rtems_rtems_HEADERS += include/rtems/rtems/support.h
include_rtems_rtems_HEADERS += include/rtems/rtems/tasks.h
include_rtems_rtems_HEADERS += include/rtems/rtems/timer.h
include_rtems_rtems_HEADERS += include/rtems/rtems/types.h
+if ATOMIC
include_rtems_rtems_HEADERS += include/rtems/rtems/atomic.h
+endif
include_rtems_rtems_HEADERS += mainpage.h
if HAS_MP
diff --git a/cpukit/rtems/preinstall.am b/cpukit/rtems/preinstall.am
index 8a0f780562..128d78f789 100644
--- a/cpukit/rtems/preinstall.am
+++ b/cpukit/rtems/preinstall.am
@@ -131,9 +131,11 @@ $(PROJECT_INCLUDE)/rtems/rtems/types.h: include/rtems/rtems/types.h $(PROJECT_IN
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/types.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/types.h
+if ATOMIC
$(PROJECT_INCLUDE)/rtems/rtems/atomic.h: include/rtems/rtems/atomic.h $(PROJECT_INCLUDE)/rtems/rtems/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/atomic.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/atomic.h
+endif
$(PROJECT_INCLUDE)/rtems/rtems/mainpage.h: mainpage.h $(PROJECT_INCLUDE)/rtems/rtems/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/mainpage.h
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 82bf26d4ae..338c797a30 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -60,10 +60,12 @@ include_rtems_score_HEADERS += include/rtems/score/watchdog.h
include_rtems_score_HEADERS += include/rtems/score/wkspace.h
include_rtems_score_HEADERS += include/rtems/score/cpuopts.h
include_rtems_score_HEADERS += include/rtems/score/basedefs.h
+if ATOMIC
include_rtems_score_HEADERS += include/rtems/score/atomic.h
include_rtems_score_HEADERS += include/rtems/score/genericcpuatomic.h
include_rtems_score_HEADERS += include/rtems/score/genericatomicops.h
include_rtems_score_HEADERS += include/rtems/score/cpustdatomic.h
+endif
if HAS_PTHREADS
include_rtems_score_HEADERS += include/rtems/score/corespinlock.h
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index 1b7955e872..a48d21eec6 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -223,6 +223,7 @@ $(PROJECT_INCLUDE)/rtems/score/basedefs.h: include/rtems/score/basedefs.h $(PROJ
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/basedefs.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/basedefs.h
+if ATOMIC
$(PROJECT_INCLUDE)/rtems/score/atomic.h: include/rtems/score/atomic.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/atomic.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/atomic.h
@@ -238,7 +239,7 @@ PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/genericatomicops.h
$(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h: include/rtems/score/cpustdatomic.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpustdatomic.h
-
+endif
if HAS_PTHREADS
$(PROJECT_INCLUDE)/rtems/score/corespinlock.h: include/rtems/score/corespinlock.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/corespinlock.h