Commit | Line | Data |
---|---|---|
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 | # | |
8 | AC_DEFUN([rw_PROG_CXX_WORKS], [ | |
9 | AC_REQUIRE([AC_PROG_CXX]) | |
10 | AC_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 | ]) |