Require presence of <stdatomic.h> for SMP support

This commit is contained in:
Sebastian Huber
2014-02-14 11:18:13 +01:00
parent dcd97c77f0
commit 8a9568d2e7
8 changed files with 15 additions and 45 deletions

View File

@@ -1,19 +0,0 @@
dnl
AC_DEFUN([RTEMS_CHECK_ATOMIC],
[dnl
AC_REQUIRE([RTEMS_CANONICAL_TARGET_CPU])dnl
AC_CACHE_CHECK([whether CPU supports atomic operations],
[rtems_cv_ATOMIC],[
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <stdatomic.h>]],
[[atomic_uint_fast32_t t; uint_fast32_t m = 1;
atomic_init(&t, 0);
atomic_store( &t, 1 );
atomic_exchange( &t, 2 );
atomic_compare_exchange_strong( &t, &m, 2);
atomic_fetch_add( &t, 3 );]])],
[rtems_cv_ATOMIC="yes"],
[rtems_cv_ATOMIC="no"])
])
])

View File

@@ -159,7 +159,9 @@ RTEMS_CHECK_MULTIPROCESSING
RTEMS_CHECK_POSIX_API
RTEMS_CHECK_NETWORKING
RTEMS_CHECK_SMP
RTEMS_CHECK_ATOMIC
if test "${RTEMS_HAS_SMP}" = "yes"; then
AC_CHECK_HEADERS([stdatomic.h],[],[AC_MSG_ERROR([<stdatomic.h> is required for SMP support])])
fi
rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
@@ -202,11 +204,6 @@ 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["],
@@ -327,7 +324,6 @@ 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"])

View File

@@ -53,7 +53,7 @@ include_rtems_rtems_HEADERS += include/rtems/rtems/tasksimpl.h
include_rtems_rtems_HEADERS += include/rtems/rtems/timer.h
include_rtems_rtems_HEADERS += include/rtems/rtems/timerimpl.h
include_rtems_rtems_HEADERS += include/rtems/rtems/types.h
if ATOMIC
if HAS_SMP
include_rtems_rtems_HEADERS += include/rtems/rtems/atomic.h
endif
include_rtems_rtems_HEADERS += mainpage.h

View File

@@ -191,7 +191,7 @@ $(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
if HAS_SMP
$(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

View File

@@ -84,10 +84,6 @@ include_rtems_score_HEADERS += include/rtems/score/watchdogimpl.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/cpustdatomic.h
endif
if HAS_PTHREADS
include_rtems_score_HEADERS += include/rtems/score/corespinlock.h
@@ -106,6 +102,8 @@ include_rtems_score_HEADERS += include/rtems/score/threadmp.h
endif
if HAS_SMP
include_rtems_score_HEADERS += include/rtems/score/atomic.h
include_rtems_score_HEADERS += include/rtems/score/cpustdatomic.h
include_rtems_score_HEADERS += include/rtems/score/schedulersimplesmp.h
endif

View File

@@ -319,15 +319,6 @@ $(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
$(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
@@ -367,6 +358,14 @@ $(PROJECT_INCLUDE)/rtems/score/threadmp.h: include/rtems/score/threadmp.h $(PROJ
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/threadmp.h
endif
if HAS_SMP
$(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
$(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
$(PROJECT_INCLUDE)/rtems/score/schedulersimplesmp.h: include/rtems/score/schedulersimplesmp.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulersimplesmp.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulersimplesmp.h

View File

@@ -10,9 +10,7 @@ SUBDIRS += smp05
SUBDIRS += smp07
SUBDIRS += smp08
SUBDIRS += smp09
if ATOMIC
SUBDIRS += smpatomic01
endif
SUBDIRS += smplock01
SUBDIRS += smpmigration01
SUBDIRS += smpschedule01

View File

@@ -22,7 +22,6 @@ RTEMS_PROG_CC_FOR_TARGET
RTEMS_PROG_CXX_FOR_TARGET
RTEMS_CANONICALIZE_TOOLS
RTEMS_CHECK_CPUOPTS([RTEMS_ATOMIC])
RTEMS_CHECK_CPUOPTS([RTEMS_POSIX_API])
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
@@ -33,7 +32,6 @@ RTEMS_CHECK_CPUOPTS([RTEMS_SMP])
AM_CONDITIONAL(SMPTESTS,test "$rtems_cv_RTEMS_SMP" = "yes")
AM_CONDITIONAL([ATOMIC],[test x"$rtems_cv_RTEMS_ATOMIC" = xyes])
AM_CONDITIONAL([HAS_POSIX],[test x"${rtems_cv_RTEMS_POSIX_API}" = xyes])
# Explicitly list all Makefiles here