| 1 | # SYNOPSIS |
| 2 | # |
| 3 | # RW_PROG_CXX_WORKS |
| 4 | # |
| 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], [ |
| 23 | AC_REQUIRE([AC_PROG_CXX]) |
| 24 | AC_CACHE_CHECK([whether the C++ compiler works], |
| 25 | [rw_cv_prog_cxx_works], |
| 26 | [AC_LANG_PUSH([C++]) |
| 27 | |
| 28 | AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [ |
| 29 | check_cxx_designated_initializers=yes |
| 30 | ], [ |
| 31 | rw_cv_prog_cxx_works=no |
| 32 | ]) |
| 33 | |
| 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 | ]) |
| 47 | |
| 48 | AC_LANG_POP([C++]) |
| 49 | ]) |
| 50 | ]) |