add --enable-tests flag to ensure dependencies for the tests

This commit is contained in:
Koichiro IWAO
2021-04-20 23:50:21 +09:00
parent bb7b7a3374
commit b86315de42
2 changed files with 16 additions and 5 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
ACLOCAL_AMFLAGS = -I m4
AM_DISTCHECK_CONFIGURE_FLAGS = \
--without-systemdsystemunitdir \
--enable-strict-locations
--enable-strict-locations \
--enable-tests
EXTRA_DIST = \
COPYING \
+14 -4
View File
@@ -65,6 +65,10 @@ if test "x$with_systemdsystemunitdir" != xno; then
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
AC_ARG_ENABLE(tests,
AC_HELP_STRING([--enable-tests],
[Ensure dependencies for the tests are installed]),
[ensure_tests_deps=yes], [])
AC_ARG_ENABLE(pam, AS_HELP_STRING([--enable-pam],
[Build PAM support (default: yes)]),
[], [enable_pam=yes])
@@ -358,9 +362,15 @@ AC_CHECK_HEADER([X11/extensions/Xrandr.h], [],
CFLAGS="$save_CFLAGS"
# 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$ensure_tests_deps" == "xyes"; then
PKG_CHECK_MODULES([CHECK], [check >= 0.10.0],
[perform_unit_tests=yes],
[AC_MSG_ERROR([please install check, the unit test framework])])
else
PKG_CHECK_MODULES([CHECK], [check >= 0.10.0],
[perform_unit_tests=yes],
[perform_unit_tests=no])
fi
if test "x$perform_unit_tests" == "xyes"; then
AC_MSG_NOTICE([libcheck found, unit tests will be performed])
@@ -454,7 +464,7 @@ echo " libdir $libdir"
echo " bindir $bindir"
echo " sysconfdir $sysconfdir"
echo ""
echo " perform unit tests $perform_unit_tests"
echo " unit tests performable $perform_unit_tests"
echo ""
echo " CFLAGS = $CFLAGS"
echo " LDFLAGS = $LDFLAGS"