[PATCH] Add -std=gnu++11 to CXXFLAGS if SMP is enabled

Nick Withers nick.withers at anu.edu.au
Tue Sep 9 02:00:55 UTC 2014


On Mon, 2014-09-08 at 11:14 +0200, Sebastian Huber wrote:
> This is necessary to use the <atomic> header file used for the atomic
> operations.

"-std=c++11" wouldn't cut it?

> ---
>  c/src/aclocal/prog-cxx.m4      | 11 +++++++++--
>  testsuites/aclocal/prog-cxx.m4 |  7 ++++++-
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/c/src/aclocal/prog-cxx.m4 b/c/src/aclocal/prog-cxx.m4
> index ba596ba..957a595 100644
> --- a/c/src/aclocal/prog-cxx.m4
> +++ b/c/src/aclocal/prog-cxx.m4
> @@ -6,11 +6,18 @@ AC_DEFUN([RTEMS_PROG_CXX_FOR_TARGET],
>  [
>  AC_BEFORE([$0], [RTEMS_CANONICALIZE_TOOLS])dnl
>  AC_REQUIRE([RTEMS_ENABLE_CXX])
> +AC_REQUIRE([RTEMS_CHECK_SMP])
> +
> +# If CXXFLAGS is not set, default to CFLAGS
> +if test x"$rtems_cv_HAS_SMP" = x"yes" ; then
> +  CXXFLAGS=${CXXFLAGS-${CFLAGS} -std=gnu++11}
> +else
> +  CXXFLAGS=${CXXFLAGS-${CFLAGS}}
> +fi
> +
>  RTEMS_CHECK_TOOL(CXX,g++)
>  if test "$RTEMS_HAS_CPLUSPLUS" = "yes";
>  then
> -  CXXFLAGS=${CXXFLAGS-${CFLAGS}}
> -
>  dnl Only accept g++
>  dnl NOTE: This might be too restrictive
>  test -z "$CXX" \
> diff --git a/testsuites/aclocal/prog-cxx.m4 b/testsuites/aclocal/prog-cxx.m4
> index fdbb129..c71bac9 100644
> --- a/testsuites/aclocal/prog-cxx.m4
> +++ b/testsuites/aclocal/prog-cxx.m4
> @@ -6,9 +6,14 @@ AC_DEFUN([RTEMS_PROG_CXX_FOR_TARGET],
>  [
>  AC_BEFORE([$0], [RTEMS_CANONICALIZE_TOOLS])dnl
>  AC_REQUIRE([RTEMS_ENABLE_CXX])
> +RTEMS_CHECK_CPUOPTS([RTEMS_SMP])
>  
>  # If CXXFLAGS is not set, default to CFLAGS
> -CXXFLAGS=${CXXFLAGS-${CFLAGS}}
> +if test x"$rtems_cv_RTEMS_SMP" = x"yes" ; then
> +  CXXFLAGS=${CXXFLAGS-${CFLAGS} -std=gnu++11}
> +else
> +  CXXFLAGS=${CXXFLAGS-${CFLAGS}}
> +fi
>  
>  RTEMS_CHECK_TOOL(CXX,g++)
>  if test "$RTEMS_HAS_CPLUSPLUS" = "yes";
-- 
Nick Withers

Embedded Systems Programmer
Department of Nuclear Physics, Research School of Physics and Engineering
The Australian National University (CRICOS: 00120C)




More information about the devel mailing list