lttng-libust-dont-build-cxx-tests-when-not-available.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 01dfa6e944d083db994f0a1165d3124bb6875437 Mon Sep 17 00:00:00 2001
  2. From: Samuel Martin <s.martin49@gmail.com>
  3. Date: Tue, 8 May 2012 15:13:21 +0200
  4. Subject: [PATCH 1/1] don't build C++ example if a C++ compiler isn't
  5. available
  6. By default lttng-ust builds a hello.cxx C++ example that demonstrates
  7. the usage of the userspace tracing library in a C++ program.
  8. Unfortunately, when no C++ support is available, the build of lttng-ust
  9. fails just because of this example code. So we make the compilation of
  10. this code conditional on whether a working C++ compiler was found.
  11. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  12. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  13. ---
  14. configure.ac | 12 ++++++++++++
  15. tests/Makefile.am | 6 +++++-
  16. 2 files changed, 17 insertions(+), 1 deletion(-)
  17. diff --git a/configure.ac b/configure.ac
  18. index 26227cb..56d84db 100644
  19. --- a/configure.ac
  20. +++ b/configure.ac
  21. @@ -45,6 +45,18 @@ AC_PROG_CXX
  22. AC_PROG_MAKE_SET
  23. LT_INIT
  24. +# rw_PROG_CXX_WORKS
  25. +# Check whether the C++ compiler works.
  26. +AC_CACHE_CHECK([whether the C++ compiler works],
  27. + [rw_cv_prog_cxx_works],
  28. + [AC_LANG_PUSH([C++])
  29. + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
  30. + [rw_cv_prog_cxx_works=yes],
  31. + [rw_cv_prog_cxx_works=no])
  32. + AC_LANG_POP([C++])])
  33. +
  34. +AM_CONDITIONAL([CXX_WORKS], [test "x$rw_cv_prog_cxx_works" = "xyes"])
  35. +
  36. ## Checks for libraries.
  37. AC_CHECK_LIB([dl], [dlopen],
  38. [
  39. diff --git a/tests/Makefile.am b/tests/Makefile.am
  40. index 2b12422..7365ce4 100644
  41. --- a/tests/Makefile.am
  42. +++ b/tests/Makefile.am
  43. @@ -1,7 +1,11 @@
  44. SUBDIRS = . hello hello-static-lib fork ust-basic-tracing ust-multi-test \
  45. - demo hello.cxx daemon
  46. + demo daemon
  47. #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
  48. +if CXX_WORKS
  49. +SUBDIRS += hello.cxx
  50. +endif
  51. +
  52. dist_noinst_SCRIPTS = test_loop runtests trace_matches
  53. noinst_LIBRARIES = libtap.a
  54. --
  55. 1.7.10.1