Perform unit tests only if check is installed

This commit is contained in:
Koichiro IWAO 2021-04-20 22:57:51 +09:00
parent 859a9d87c3
commit bb7b7a3374
2 changed files with 20 additions and 3 deletions

View File

@ -67,5 +67,9 @@ SUBDIRS = \
tests \
tools
if PERFORM_UNIT_TESTS
SUBDIRS += tests
endif
distclean-local:
-rm -f xrdp_configure_options.h

View File

@ -357,9 +357,20 @@ AC_CHECK_HEADER([X11/extensions/Xrandr.h], [],
CFLAGS="$save_CFLAGS"
# checking for libcheck (used for unit testing)
PKG_CHECK_MODULES([CHECK], [check >= 0.10.0], [],
[AC_MSG_ERROR([please install check])])
# perform unit tests if libcheck found
PKG_CHECK_MODULES([CHECK], [check >= 0.10.0],
[perform_unit_tests=yes],
[perform_unit_tests=no])
if test "x$perform_unit_tests" == "xyes"; then
AC_MSG_NOTICE([libcheck found, unit tests will be performed])
else
AC_MSG_NOTICE([libcheck not found, unit tests will be skipped])
fi
AM_CONDITIONAL(PERFORM_UNIT_TESTS,
[test "x$perform_unit_tests" = "xyes"])
# -- end perform unit tests
AC_SUBST([moduledir], '${libdir}/xrdp')
@ -443,6 +454,8 @@ echo " libdir $libdir"
echo " bindir $bindir"
echo " sysconfdir $sysconfdir"
echo ""
echo " perform unit tests $perform_unit_tests"
echo ""
echo " CFLAGS = $CFLAGS"
echo " LDFLAGS = $LDFLAGS"