<p dir="ltr">I think this is a good idea. It reduces the configuration options a bit and doesn't add any run time code. It barely adds any build time.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Aug 9, 2016 10:11 PM, "Chris Johns" <<a href="mailto:chrisj@rtems.org">chrisj@rtems.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We always build a C++ compiler and building with C++ does not effect<br>
RTEMS or the runtime. This patch always enabled the support. There is<br>
no need to manually enable it any more.<br>
<br>
You can disable C++ with '--disable-cxx'.<br>
<br>
If an architecture does not have a C++ compiler support is automatically<br>
disabled.<br>
---<br>
aclocal/enable-cxx.m4 | 4 ++--<br>
c/src/aclocal/enable-cxx.m4 | 5 +++--<br>
c/src/aclocal/prog-cxx.m4 | 37 +++++++++++++++++++++---------<wbr>-------<br>
c/src/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> | 2 ++<br>
cpukit/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> | 6 ++++--<br>
testsuites/aclocal/enable-cxx.<wbr>m4 | 5 +++--<br>
testsuites/aclocal/prog-cxx.m4 | 39 ++++++++++++++++++++++--------<wbr>---------<br>
testsuites/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> | 6 +++++-<br>
8 files changed, 62 insertions(+), 42 deletions(-)<br>
<br>
diff --git a/aclocal/enable-cxx.m4 b/aclocal/enable-cxx.m4<br>
index ddd37dc..952f015 100644<br>
--- a/aclocal/enable-cxx.m4<br>
+++ b/aclocal/enable-cxx.m4<br>
@@ -2,10 +2,10 @@ AC_DEFUN([RTEMS_ENABLE_CXX],<br>
[<br>
AC_ARG_ENABLE(cxx,<br>
[AS_HELP_STRING([--enable-cxx]<wbr>,<br>
-[enable C++ support and build the rtems++ library])],<br>
+[enable C++ support])],<br>
[case "${enable_cxx}" in<br>
yes) RTEMS_HAS_CPLUSPLUS=yes ;;<br>
no) RTEMS_HAS_CPLUSPLUS=no ;;<br>
*) AC_MSG_ERROR(bad value ${enableval} for enable-cxx option) ;;<br>
-esac], [RTEMS_HAS_CPLUSPLUS=no])<br>
+esac], [RTEMS_HAS_CPLUSPLUS=yes])<br>
])<br>
diff --git a/c/src/aclocal/enable-cxx.m4 b/c/src/aclocal/enable-cxx.m4<br>
index 759d81b..952f015 100644<br>
--- a/c/src/aclocal/enable-cxx.m4<br>
+++ b/c/src/aclocal/enable-cxx.m4<br>
@@ -1,10 +1,11 @@<br>
AC_DEFUN([RTEMS_ENABLE_CXX],<br>
[<br>
AC_ARG_ENABLE(cxx,<br>
-[AS_HELP_STRING(--enable-cxx,<wbr>enable C++ support and build the rtems++ library)],<br>
+[AS_HELP_STRING([--enable-<wbr>cxx],<br>
+[enable C++ support])],<br>
[case "${enable_cxx}" in<br>
yes) RTEMS_HAS_CPLUSPLUS=yes ;;<br>
no) RTEMS_HAS_CPLUSPLUS=no ;;<br>
*) AC_MSG_ERROR(bad value ${enableval} for enable-cxx option) ;;<br>
-esac], [RTEMS_HAS_CPLUSPLUS=no])<br>
+esac], [RTEMS_HAS_CPLUSPLUS=yes])<br>
])<br>
diff --git a/c/src/aclocal/prog-cxx.m4 b/c/src/aclocal/prog-cxx.m4<br>
index 957a595..66c986c 100644<br>
--- a/c/src/aclocal/prog-cxx.m4<br>
+++ b/c/src/aclocal/prog-cxx.m4<br>
@@ -1,6 +1,6 @@<br>
-dnl<br>
+dnl<br>
dnl Check for target g++<br>
-dnl<br>
+dnl<br>
<br>
AC_DEFUN([RTEMS_PROG_CXX_FOR_<wbr>TARGET],<br>
[<br>
@@ -18,21 +18,26 @@ fi<br>
RTEMS_CHECK_TOOL(CXX,g++)<br>
if test "$RTEMS_HAS_CPLUSPLUS" = "yes";<br>
then<br>
-dnl Only accept g++<br>
-dnl NOTE: This might be too restrictive<br>
-test -z "$CXX" \<br>
- && AC_MSG_ERROR([no acceptable c++ found in \$PATH])<br>
-AC_PROG_CXX<br>
-AC_PROG_CXXCPP<br>
-<br>
- if test "$ac_cv_prog_cc_cross" != "$ac_cv_prog_cxx_cross"; then<br>
- AC_MSG_ERROR([***]<br>
- [Inconsistency in compiler configuration:]<br>
- [Target C compiler and target C++ compiler]<br>
- [must both either be cross compilers or native compilers])<br>
+ dnl Only accept g++<br>
+ dnl NOTE: This might be too restrictive<br>
+ if test -z "$CXX";<br>
+ then<br>
+ RTEMS_HAS_CPLUSPLUS=no<br>
+ HAS_CPLUSPLUS=no<br>
+ ## Work-around to a bug in automake<br>
+ AM_CONDITIONAL([am__<wbr>fastdepCXX],[false])<br>
+ else<br>
+ AC_PROG_CXX<br>
+ AC_PROG_CXXCPP<br>
+ if test "$ac_cv_prog_cc_cross" != "$ac_cv_prog_cxx_cross"; then<br>
+ AC_MSG_ERROR([***]<br>
+ [Inconsistency in compiler configuration:]<br>
+ [Target C compiler and target C++ compiler]<br>
+ [must both either be cross compilers or native compilers])<br>
+ fi<br>
fi<br>
else<br>
-## Work-around to a bug in automake<br>
-AM_CONDITIONAL([am__<wbr>fastdepCXX],[false])<br>
+ ## Work-around to a bug in automake<br>
+ AM_CONDITIONAL([am__<wbr>fastdepCXX],[false])<br>
fi<br>
])<br>
diff --git a/c/src/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> b/c/src/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
index f0d482c..6b34eb5 100644<br>
--- a/c/src/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
+++ b/c/src/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
@@ -16,6 +16,7 @@ AM_MAINTAINER_MODE<br>
<br>
RTEMS_ENABLE_MULTILIB<br>
RTEMS_ENABLE_MULTIPROCESSING<br>
+RTEMS_ENABLE_CXX<br>
RTEMS_ENV_RTEMSBSP<br>
<br>
RTEMS_CHECK_CUSTOM_BSP(RTEMS_<wbr>BSP)<br>
@@ -93,6 +94,7 @@ rtems_cv_CFLAGS_set="${CFLAGS+<wbr>set}"<br>
CFLAGS="${CFLAGS-${CPU_CFLAGS} ${CFLAGS_OPTIMIZE_V}}"<br>
<br>
RTEMS_PROG_CC_FOR_TARGET<br>
+RTEMS_PROG_CXX_FOR_TARGET<br>
AM_PROG_CC_C_O<br>
RTEMS_PROG_CCAS<br>
RTEMS_CANONICALIZE_TOOLS<br>
diff --git a/cpukit/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> b/cpukit/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
index 054e60e..136630b 100644<br>
--- a/cpukit/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
+++ b/cpukit/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
@@ -13,6 +13,7 @@ AM_MAINTAINER_MODE<br>
RTEMS_ENABLE_MULTILIB<br>
RTEMS_ENABLE_MULTIPROCESSING<br>
RTEMS_ENABLE_POSIX<br>
+RTEMS_ENABLE_CXX<br>
RTEMS_ENABLE_RTEMS_DEBUG<br>
RTEMS_ENABLE_NETWORKING<br>
RTEMS_ENABLE_PARAVIRT<br>
@@ -31,9 +32,10 @@ else<br>
fi<br>
<br>
RTEMS_PROG_CC_FOR_TARGET<br>
-RTEMS_PROG_CCAS<br>
-RTEMS_CANONICALIZE_TOOLS<br>
+RTEMS_PROG_CXX_FOR_TARGET<br>
AM_PROG_CC_C_O<br>
+RTEMS_CANONICALIZE_TOOLS<br>
+RTEMS_PROG_CCAS<br>
AC_PROG_RANLIB<br>
<br>
RTEMS_CHECK_NEWLIB<br>
diff --git a/testsuites/aclocal/enable-<wbr>cxx.m4 b/testsuites/aclocal/enable-<wbr>cxx.m4<br>
index 759d81b..952f015 100644<br>
--- a/testsuites/aclocal/enable-<wbr>cxx.m4<br>
+++ b/testsuites/aclocal/enable-<wbr>cxx.m4<br>
@@ -1,10 +1,11 @@<br>
AC_DEFUN([RTEMS_ENABLE_CXX],<br>
[<br>
AC_ARG_ENABLE(cxx,<br>
-[AS_HELP_STRING(--enable-cxx,<wbr>enable C++ support and build the rtems++ library)],<br>
+[AS_HELP_STRING([--enable-<wbr>cxx],<br>
+[enable C++ support])],<br>
[case "${enable_cxx}" in<br>
yes) RTEMS_HAS_CPLUSPLUS=yes ;;<br>
no) RTEMS_HAS_CPLUSPLUS=no ;;<br>
*) AC_MSG_ERROR(bad value ${enableval} for enable-cxx option) ;;<br>
-esac], [RTEMS_HAS_CPLUSPLUS=no])<br>
+esac], [RTEMS_HAS_CPLUSPLUS=yes])<br>
])<br>
diff --git a/testsuites/aclocal/prog-cxx.<wbr>m4 b/testsuites/aclocal/prog-cxx.<wbr>m4<br>
index c71bac9..91f2b7f 100644<br>
--- a/testsuites/aclocal/prog-cxx.<wbr>m4<br>
+++ b/testsuites/aclocal/prog-cxx.<wbr>m4<br>
@@ -1,6 +1,6 @@<br>
-dnl<br>
+dnl<br>
dnl Check for target g++<br>
-dnl<br>
+dnl<br>
<br>
AC_DEFUN([RTEMS_PROG_CXX_FOR_<wbr>TARGET],<br>
[<br>
@@ -9,7 +9,7 @@ AC_REQUIRE([RTEMS_ENABLE_CXX])<br>
RTEMS_CHECK_CPUOPTS([RTEMS_<wbr>SMP])<br>
<br>
# If CXXFLAGS is not set, default to CFLAGS<br>
-if test x"$rtems_cv_RTEMS_SMP" = x"yes" ; then<br>
+if test x"$rtems_cv_HAS_SMP" = x"yes" ; then<br>
CXXFLAGS=${CXXFLAGS-${CFLAGS} -std=gnu++11}<br>
else<br>
CXXFLAGS=${CXXFLAGS-${CFLAGS}}<br>
@@ -18,21 +18,26 @@ fi<br>
RTEMS_CHECK_TOOL(CXX,g++)<br>
if test "$RTEMS_HAS_CPLUSPLUS" = "yes";<br>
then<br>
-dnl Only accept g++<br>
-dnl NOTE: This might be too restrictive<br>
-test -z "$CXX" \<br>
- && AC_MSG_ERROR([no acceptable c++ found in \$PATH])<br>
-AC_PROG_CXX<br>
-AC_PROG_CXXCPP<br>
-<br>
- if test "$ac_cv_prog_cc_cross" != "$ac_cv_prog_cxx_cross"; then<br>
- AC_MSG_ERROR([***]<br>
- [Inconsistency in compiler configuration:]<br>
- [Target C compiler and target C++ compiler]<br>
- [must both either be cross compilers or native compilers])<br>
+ dnl Only accept g++<br>
+ dnl NOTE: This might be too restrictive<br>
+ if test -z "$CXX";<br>
+ then<br>
+ RTEMS_HAS_CPLUSPLUS=no<br>
+ HAS_CPLUSPLUS=no<br>
+ ## Work-around to a bug in automake<br>
+ AM_CONDITIONAL([am__<wbr>fastdepCXX],[false])<br>
+ else<br>
+ AC_PROG_CXX<br>
+ AC_PROG_CXXCPP<br>
+ if test "$ac_cv_prog_cc_cross" != "$ac_cv_prog_cxx_cross"; then<br>
+ AC_MSG_ERROR([***]<br>
+ [Inconsistency in compiler configuration:]<br>
+ [Target C compiler and target C++ compiler]<br>
+ [must both either be cross compilers or native compilers])<br>
+ fi<br>
fi<br>
else<br>
-## Work-around to a bug in automake<br>
-AM_CONDITIONAL([am__<wbr>fastdepCXX],[false])<br>
+ ## Work-around to a bug in automake<br>
+ AM_CONDITIONAL([am__<wbr>fastdepCXX],[false])<br>
fi<br>
])<br>
diff --git a/testsuites/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> b/testsuites/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
index 963e05b..086f636 100644<br>
--- a/testsuites/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
+++ b/testsuites/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
@@ -17,8 +17,12 @@ RTEMS_ENV_RTEMSBSP<br>
<br>
RTEMS_PROJECT_ROOT<br>
<br>
+RTEMS_PROG_CC_FOR_TARGET<br>
+RTEMS_PROG_CXX_FOR_TARGET<br>
+RTEMS_CANONICALIZE_TOOLS<br>
+AM_PROG_CC_C_O<br>
+<br>
RTEMS_CHECK_CUSTOM_BSP(RTEMS_<wbr>BSP)<br>
-RTEMS_PROG_CC<br>
<br>
RTEMS_CHECK_CPUOPTS([RTEMS_<wbr>POSIX_API])<br>
RTEMS_CHECK_CPUOPTS([RTEMS_<wbr>MULTIPROCESSING])<br>
--<br>
2.4.6<br>
<br>
______________________________<wbr>_________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/<wbr>mailman/listinfo/devel</a><br>
</blockquote></div></div>