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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Do not build C++ example if a C++ compiler isn't available
  2. By default lttng-ust builds a hello.cxx C++ example that demonstrates
  3. the usage of the userspace tracing library in a C++
  4. program. Unfortunately, when no C++ support is available, the build
  5. of lttng-ust fails just because of this example code. So we make the
  6. compilation of this code conditional on whether a working C++ compiler
  7. was found.
  8. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  9. Index: lttng-ust-1.9.2/configure.ac
  10. ===================================================================
  11. --- lttng-ust-1.9.2.orig/configure.ac 2012-02-04 14:49:45.387325814 +0100
  12. +++ lttng-ust-1.9.2/configure.ac 2012-02-04 14:50:08.156920117 +0100
  13. @@ -38,6 +38,18 @@
  14. AC_PROG_MAKE_SET
  15. LT_INIT
  16. +# rw_PROG_CXX_WORKS
  17. +# Check whether the C++ compiler works.
  18. +AC_CACHE_CHECK([whether the C++ compiler works],
  19. + [rw_cv_prog_cxx_works],
  20. + [AC_LANG_PUSH([C++])
  21. + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
  22. + [rw_cv_prog_cxx_works=yes],
  23. + [rw_cv_prog_cxx_works=no])
  24. + AC_LANG_POP([C++])])
  25. +
  26. +AM_CONDITIONAL([CXX_WORKS], [test "x$rw_cv_prog_cxx_works" = "xyes"])
  27. +
  28. ## Checks for libraries.
  29. AC_CHECK_LIB([dl], [dlopen])
  30. AC_CHECK_LIB([pthread], [pthread_create])
  31. Index: lttng-ust-1.9.2/tests/Makefile.am
  32. ===================================================================
  33. --- lttng-ust-1.9.2.orig/tests/Makefile.am 2012-02-04 14:49:49.157258640 +0100
  34. +++ lttng-ust-1.9.2/tests/Makefile.am 2012-02-04 14:50:15.096796474 +0100
  35. @@ -1,6 +1,10 @@
  36. -SUBDIRS = . hello fork ust-basic-tracing ust-multi-test demo hello.cxx
  37. +SUBDIRS = . hello fork ust-basic-tracing ust-multi-test demo
  38. #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
  39. +if CXX_WORKS
  40. +SUBDIRS += hello.cxx
  41. +endif
  42. +
  43. dist_noinst_SCRIPTS = test_loop runtests trace_matches
  44. noinst_LIBRARIES = libtap.a