From 7203806ffb5701ceefba1692758b1ba6c8e45c5d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 23 Sep 2010 14:37:45 +0100 Subject: [PATCH] tests: fix 'make check' build for setups where no c++ compiler is available Only try to build (pseudo-)C++ unit test if a working C++ compiler has been found, otherwise the build will fail. (We do this to make sure our headers are 'C++ clean'). --- configure.ac | 11 ++++++++--- tests/check/Makefile.am | 7 ++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index c434b09..be99576 100644 --- a/configure.ac +++ b/configure.ac @@ -228,10 +228,15 @@ AM_PROG_CC_C_O dnl find an assembler AM_PROG_AS -dnl determine c++ compiler -AC_PROG_CXX dnl determine if c++ is available on this system -AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no) +AC_PROG_CXX +dnl CXX may be set to some default even if no c++ compiler is available +dnl (thanks autotools!), so just try to compile some c++ code to make sure +AC_LANG_PUSH([C++]) +AC_TRY_COMPILE([ class Foo { int bar; };], , working_cxx=yes, working_cxx=no) +AC_LANG_POP([C++]) +AC_MSG_NOTICE([working c++ compiler found: $working_cxx]) +AM_CONDITIONAL(HAVE_CXX, test "x$working_cxx" == "xyes") dnl Perl is used in building documentation and in the version checks AC_PATH_PROG(PERL_PATH, perl, no) diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 26fe8a7..31db03d 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -43,6 +43,11 @@ endif endif endif +if HAVE_CXX +CXX_CHECKS = gst/gstcpp +else +CXX_CHECKS = +endif # if it's calling gst_element_factory_make(), it will probably not work without # a registry @@ -89,7 +94,7 @@ check_PROGRAMS = \ gst/gstbufferlist \ gst/gstbus \ gst/gstcaps \ - gst/gstcpp \ + $(CXX_CHECKS) \ gst/gstdatetime \ gst/gstinfo \ gst/gstiterator \ -- 2.7.4