Commit | Line | Data |
---|---|---|
f1813f3f | 1 | # SYNOPSIS |
a9c2df2b | 2 | # |
f1813f3f | 3 | # RW_PROG_CXX_WORKS |
a9c2df2b | 4 | # |
f1813f3f MJ |
5 | # DESCRIPTION |
6 | # | |
7 | # RW_PROG_CXX_WORKS checks whether the C++ compiler works. | |
8 | # | |
9 | # There's a bit of oversight in autoconf that will set the C++ compiler to | |
10 | # g++ if no compiler is found, even if g++ is not present! So we need an | |
11 | # extra test to make sure that the compiler works. | |
12 | # | |
13 | # LICENSE | |
14 | # | |
15 | # Copying and distribution of this file, with or without modification, are | |
16 | # permitted in any medium without royalty provided the copyright notice | |
17 | # and this notice are preserved. This file is offered as-is, without any | |
18 | # warranty. | |
19 | ||
20 | #serial 1 | |
21 | ||
22 | AC_DEFUN([RW_PROG_CXX_WORKS], [ | |
a9c2df2b FD |
23 | AC_REQUIRE([AC_PROG_CXX]) |
24 | AC_CACHE_CHECK([whether the C++ compiler works], | |
f1813f3f MJ |
25 | [rw_cv_prog_cxx_works], |
26 | [AC_LANG_PUSH([C++]) | |
a9c2df2b | 27 | |
f1813f3f MJ |
28 | AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [ |
29 | check_cxx_designated_initializers=yes | |
30 | ], [ | |
31 | rw_cv_prog_cxx_works=no | |
32 | ]) | |
a9c2df2b | 33 | |
f1813f3f MJ |
34 | AS_IF([test "x$check_cxx_designated_initializers" = "xyes"], [ |
35 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ | |
36 | struct foo { int a; int b; }; | |
37 | void fct(void) | |
38 | { | |
39 | struct foo f = { .a = 0, .b = 1 }; | |
40 | } | |
41 | ]])], [ | |
42 | rw_cv_prog_cxx_works=yes | |
43 | ], [ | |
44 | rw_cv_prog_cxx_works=no | |
45 | ]) | |
46 | ]) | |
a9c2df2b | 47 | |
f1813f3f | 48 | AC_LANG_POP([C++]) |
a9c2df2b FD |
49 | ]) |
50 | ]) |