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').
This commit is contained in:
Tim-Philipp Müller 2010-09-23 14:37:45 +01:00
parent 7e1d9c8c0d
commit 7203806ffb
2 changed files with 14 additions and 4 deletions

View file

@ -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)

View file

@ -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 \