Rework configure script
[lttng-ust.git] / m4 / rw_prog_cxx_works.m4
CommitLineData
94480b71
MJ
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#
8AC_DEFUN([rw_PROG_CXX_WORKS], [
9AC_REQUIRE([AC_PROG_CXX])
10AC_CACHE_CHECK([whether the C++ compiler works],
11 [rw_cv_prog_cxx_works],
12 [AC_LANG_PUSH([C++])
13
14 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
15 check_cxx_designated_initializers=yes
16 ], [
17 rw_cv_prog_cxx_works=no
18 ])
19
20 AS_IF([test "x$check_cxx_designated_initializers" = "xyes"], [
21 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
22 struct foo { int a; int b; };
23 void fct(void)
24 {
25 struct foo f = { .a = 0, .b = 1 };
26 }
27 ]])], [
28 rw_cv_prog_cxx_works=yes
29 ], [
30 rw_cv_prog_cxx_works=no
31 ])
32 ])
33
34 AC_LANG_POP([C++])
35])
36])
This page took 0.025688 seconds and 4 git commands to generate.