Fix: don't build C++ example if a C++ compiler isn't available
authorSamuel Martin <s.martin49@gmail.com>
Sun, 13 Jan 2013 16:40:10 +0000 (11:40 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 13 Jan 2013 16:43:51 +0000 (11:43 -0500)
By default lttng-ust builds a hello.cxx C++ example that demonstrates
the usage of the userspace tracing library in a C++ program.
Unfortunately, when no C++ support is available, the build of lttng-ust
fails just because of this example code. So we make the compilation of
this code conditional on whether a working C++ compiler was found.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure.ac
tests/Makefile.am

index b442a81dc271eb7bb1f10739d6e0defb04b49931..24d16e9d4bfdbfd3615db0ac490dff1949dd0d78 100644 (file)
@@ -72,6 +72,18 @@ AC_PROG_CXX
 AC_PROG_MAKE_SET
 LT_INIT
 
+# rw_PROG_CXX_WORKS
+# Check whether the C++ compiler works.
+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],
+                               [rw_cv_prog_cxx_works=no])
+               AC_LANG_POP([C++])])
+
+AM_CONDITIONAL([CXX_WORKS], [test "x$rw_cv_prog_cxx_works" = "xyes"])
+
 ## Checks for libraries.
 AC_CHECK_LIB([dl], [dlopen])
 AC_CHECK_LIB([pthread], [pthread_create])
index e79ab7cec1760c256a1b25589ca8037f217608da..1a8b795c691744f7352317db26fd8a54531fee86 100644 (file)
@@ -1,6 +1,10 @@
-SUBDIRS = . hello hello-static-lib fork ust-basic-tracing ust-multi-test demo hello.cxx
+SUBDIRS = . hello hello-static-lib fork ust-basic-tracing ust-multi-test demo
 #SUBDIRS = . hello2 basic basic_long simple_include snprintf test-nevents test-libustinstr-malloc dlopen same_line_marker trace_event register_test tracepoint libustctl_function_tests exit-fast
 
+if CXX_WORKS
+SUBDIRS += hello.cxx
+endif
+
 dist_noinst_SCRIPTS = test_loop runtests trace_matches
 
 noinst_LIBRARIES = libtap.a
This page took 0.025572 seconds and 4 git commands to generate.