From f1813f3f79c102fec4c58a3aa9b77a178a4b0a10 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 16 Apr 2019 16:43:46 -0400 Subject: [PATCH] Harmonize rw_prog_cxx_works macro across projects MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- configure.ac | 2 +- m4/rw_prog_cxx_works.m4 | 69 ++++++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 29 deletions(-) diff --git a/configure.ac b/configure.ac index 256b52227..0327bc6a0 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_SYS_LARGEFILE AC_PROG_CC AC_PROG_CC_STDC AC_PROG_CXX -rw_PROG_CXX_WORKS +RW_PROG_CXX_WORKS AM_CONDITIONAL([CXX_WORKS], [test "x$rw_cv_prog_cxx_works" = "xyes"]) LTTNG_CHECK_SDT_WORKS diff --git a/m4/rw_prog_cxx_works.m4 b/m4/rw_prog_cxx_works.m4 index 1950d94d0..f3d6bde6b 100644 --- a/m4/rw_prog_cxx_works.m4 +++ b/m4/rw_prog_cxx_works.m4 @@ -1,37 +1,50 @@ -# rw_PROG_CXX_WORKS +# SYNOPSIS # -# Check whether the C++ compiler works. There's a bit of oversight in -# autoconf that will set the C++ compiler to g++ if no compiler is found, -# even if g++ is not present! So we need an extra test to make sure that -# the compiler works. -# Script copied from the lttng-ust project. +# RW_PROG_CXX_WORKS # -AC_DEFUN([rw_PROG_CXX_WORKS], [ +# DESCRIPTION +# +# RW_PROG_CXX_WORKS checks whether the C++ compiler works. +# +# There's a bit of oversight in autoconf that will set the C++ compiler to +# g++ if no compiler is found, even if g++ is not present! So we need an +# extra test to make sure that the compiler works. +# +# LICENSE +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +AC_DEFUN([RW_PROG_CXX_WORKS], [ AC_REQUIRE([AC_PROG_CXX]) AC_CACHE_CHECK([whether the C++ compiler works], - [rw_cv_prog_cxx_works], - [AC_LANG_PUSH([C++]) + [rw_cv_prog_cxx_works], + [AC_LANG_PUSH([C++]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [ - check_cxx_designated_initializers=yes - ], [ - rw_cv_prog_cxx_works=no - ]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [ + check_cxx_designated_initializers=yes + ], [ + rw_cv_prog_cxx_works=no + ]) - AS_IF([test "x$check_cxx_designated_initializers" = "xyes"], [ - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ - struct foo { int a; int b; }; - void fct(void) - { - struct foo f = { .a = 0, .b = 1 }; - } - ]])], [ - rw_cv_prog_cxx_works=yes - ], [ - rw_cv_prog_cxx_works=no - ]) - ]) + AS_IF([test "x$check_cxx_designated_initializers" = "xyes"], [ + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + struct foo { int a; int b; }; + void fct(void) + { + struct foo f = { .a = 0, .b = 1 }; + } + ]])], [ + rw_cv_prog_cxx_works=yes + ], [ + rw_cv_prog_cxx_works=no + ]) + ]) - AC_LANG_POP([C++]) + AC_LANG_POP([C++]) ]) ]) -- 2.34.1