[lttng-dev] [PATCH lttng-ust] Fix: Check g++ version before compiling 'hello.cxx' test

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Sat Jun 15 14:37:26 EDT 2013


* Christian Babeux (christian.babeux at efficios.com) wrote:
> Hi Zifei,
> 
> Checking specific version numbers might be a bit counterproductive
> (e.g. what if some embedded platform as a GCC 4.7 with designated
> initializer explicitly patched out?).
> 
> Going forward, I think checking for the designated initializer feature
> via a small C++ testfile is more in line with the Autoconf philosophy.
> Also, we should conditionally disable the compilation of the
> tracepoint probes requiring designated initializers if not supported.

Moreover, the documentation and patches should take LLVM into account.

Thanks,

Mathieu

> 
> Thanks,
> 
> Christian
> 
> On Sat, Jun 15, 2013 at 2:08 PM, Zifei Tong <soariez at gmail.com> wrote:
> > Designated initializer support that is required to compile c++
> > tracepoint probes is only available since g++ 4.7.
> >
> > Fixes #557
> >
> > Signed-off-by: Zifei Tong <soariez at gmail.com>
> > ---
> >  README       |  3 ++-
> >  configure.ac | 16 ++++++++++++++--
> >  2 files changed, 16 insertions(+), 3 deletions(-)
> >
> > diff --git a/README b/README
> > index 1f6b9d2..1c7a2f8 100644
> > --- a/README
> > +++ b/README
> > @@ -111,7 +111,8 @@ USAGE:
> >    - Enable instrumentation and control tracing with the "lttng" command
> >      from lttng-tools. See lttng-tools doc/quickstart.txt.
> >    - Note for C++ support: since LTTng-UST 2.3, both tracepoints and
> > -    tracepoint probes can be compiled with g++.
> > +    tracepoint probes can be compiled with g++. To compile tracepoint probes
> > +    in g++, you need version 4.7 or above.
> >
> >
> >  ENVIRONMENT VARIABLES:
> > diff --git a/configure.ac b/configure.ac
> > index 802ccaa..85a64a1 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -83,9 +83,21 @@ AC_CACHE_CHECK([whether the C++ compiler works],
> >                 [rw_cv_prog_cxx_works],
> >                 [AC_LANG_PUSH([C++])
> >                 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
> > -                               [rw_cv_prog_cxx_works=yes],
> > +                               [check_gcc_cxx_version=yes],
> >                                 [rw_cv_prog_cxx_works=no])
> > -               AC_LANG_POP([C++])])
> > +               AC_LANG_POP([C++])
> > +               if test "$check_gcc_cxx_version" = "yes"; then
> > +                       gcc_cxx_version=`$CXX -dumpversion`
> > +                       gcc_cxx_major_version=$(echo $gcc_cxx_version | sed
> > 's/^\([[0-9]]*\)\.[[0-9]]*.*$/\1/')
> > +                       gcc_cxx_minor_version=$(echo $gcc_cxx_version | sed
> > 's/^[[0-9]]*\.\([[0-9]]*\).*$/\1/')
> > +                       if test "$gcc_cxx_major_version" -gt 4; then
> > +                               rw_cv_prog_cxx_works="yes"
> > +                       elif test "$gcc_cxx_major_version" -eq 4 -a
> > "$gcc_cxx_minor_version" -ge 7; then
> > +                               rw_cv_prog_cxx_works="yes"
> > +                       else
> > +                               rw_cv_prog_cxx_works="no"
> > +                       fi
> > +               fi])
> >
> >  AM_CONDITIONAL([CXX_WORKS], [test "x$rw_cv_prog_cxx_works" = "xyes"])
> >
> > --
> > 1.8.3.1
> >
> > --
> > Best Regards,
> > 仝子飞 (Zifei Tong)
> >
> > _______________________________________________
> > lttng-dev mailing list
> > lttng-dev at lists.lttng.org
> > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list