Check unit test framework can be disabled

using --disable-check configure option
This commit is contained in:
Yann Weber 2017-05-15 16:01:29 +02:00
commit 4d2fed6c92
2 changed files with 22 additions and 6 deletions

View file

@ -7,6 +7,10 @@ docs:
.PHONY: docs
endif
SUBDIRS += src . tests
SUBDIRS += src .
if CHECK
SUBDIRS += tests
endif
CLEANFILES =

View file

@ -21,6 +21,15 @@ AC_ARG_ENABLE([debug],[ --enable-debug turn on debugging],
esac],[debug=false])
AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
AC_ARG_ENABLE([check],[ --disable-check disable unit test support],
[case "${enableval}" in
yes) check=true ;;
no) check=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-check]) ;;
esac],[check=true])
AM_CONDITIONAL([CHECK], [test x$check = xtrue])
AC_CONFIG_HEADERS([src/include/config.h])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_MACRO_DIR([m4])
@ -51,11 +60,14 @@ else
fi
# Checks for libraries.
AC_SEARCH_LIBS([dlopen], [dl dld], [], [
AC_MSG_ERROR([unable to find the dlopen() function])
])
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
AS_IF([test x$debug = xtrue], [CK_FORK=no],[])
if test x$check = xtrue
then
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [],
AC_MSG_FAILURE([Unable to locate (check unit test c framework).
You can run ./configure --disable-check if you do not need unit tests.
]))
AS_IF([test x$debug = xtrue], [CK_FORK=no],[])
fi
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h])