Implement userspace-probe regression tests
[lttng-tools.git] / m4 / rw_prog_cxx_works.m4
1 # rw_PROG_CXX_WORKS
2 #
3 # Check whether the C++ compiler works. There's a bit of oversight in
4 # autoconf that will set the C++ compiler to g++ if no compiler is found,
5 # even if g++ is not present! So we need an extra test to make sure that
6 # the compiler works.
7 # Script copied from the lttng-ust project.
8 #
9 AC_DEFUN([rw_PROG_CXX_WORKS], [
10 AC_REQUIRE([AC_PROG_CXX])
11 AC_CACHE_CHECK([whether the C++ compiler works],
12 [rw_cv_prog_cxx_works],
13 [AC_LANG_PUSH([C++])
14
15 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
16 check_cxx_designated_initializers=yes
17 ], [
18 rw_cv_prog_cxx_works=no
19 ])
20
21 AS_IF([test "x$check_cxx_designated_initializers" = "xyes"], [
22 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
23 struct foo { int a; int b; };
24 void fct(void)
25 {
26 struct foo f = { .a = 0, .b = 1 };
27 }
28 ]])], [
29 rw_cv_prog_cxx_works=yes
30 ], [
31 rw_cv_prog_cxx_works=no
32 ])
33 ])
34
35 AC_LANG_POP([C++])
36 ])
37 ])
This page took 0.042121 seconds and 4 git commands to generate.