From: Adrian-Ken Rueegsegger Date: Fri, 18 May 2012 19:19:52 +0000 (+0200) Subject: Add configure option --enable-unit-tests X-Git-Tag: 5.0.3rc1~39^2~106 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0aa5a4666914a5a786e98201fe6ebae81dbe8fbc;p=thirdparty%2Fstrongswan.git Add configure option --enable-unit-tests This configure option enables check-based unit testing. Check is a unit test framework for C [1]. The unit tests can be executed by issuing the following command in the toplevel build directory: make check [1] - http://check.sourceforge.net/ --- diff --git a/HACKING b/HACKING index 830b688412..dbb347e6fe 100644 --- a/HACKING +++ b/HACKING @@ -18,6 +18,7 @@ the code, you need the following tools: - lex/flex - yacc/bison - gperf + - check - optionally Doxygen To check out the master branch, use: diff --git a/configure.in b/configure.in index 716bad5b12..54e4abb302 100644 --- a/configure.in +++ b/configure.in @@ -236,6 +236,7 @@ ARG_ENABL_SET([radattr], [enable plugin to inject and process custom RADI ARG_ENABL_SET([vstr], [enforce using the Vstr string library to replace glibc-like printf hooks.]) ARG_ENABL_SET([monolithic], [build monolithic version of libstrongswan that includes all enabled plugins. Similarly, the plugins of charon are assembled in libcharon.]) ARG_ENABL_SET([bfd-backtraces], [use binutils libbfd to resolve backtraces for memory leaks and segfaults.]) +ARG_ENABL_SET([unit-tests], [enable unit tests using the check test framework.]) # =================================== # option to disable default options @@ -258,6 +259,8 @@ if test -z "$CFLAGS"; then CFLAGS="-g -O2 -Wall -Wno-format -Wno-pointer-sign" fi AC_PROG_CC +AM_PROG_CC_C_O + AC_LIB_PREFIX AC_C_BIGENDIAN @@ -894,6 +897,12 @@ AC_SUBST(dev_headers) CFLAGS="$CFLAGS -include `pwd`/config.h" +if test x$unit_tests = xtrue; then + PKG_CHECK_MODULES(CHECK, [check >= 0.9.4]) + AC_SUBST(CHECK_CFLAGS) + AC_SUBST(CHECK_LIBS) +fi + # =============================================== # collect plugin list for strongSwan components # =============================================== @@ -1208,6 +1217,7 @@ AM_CONDITIONAL(USE_IMCV, test x$imcv = xtrue) AM_CONDITIONAL(USE_PTS, test x$pts = xtrue) AM_CONDITIONAL(USE_TROUSERS, test x$tss = xtrousers) AM_CONDITIONAL(MONOLITHIC, test x$monolithic = xtrue) +AM_CONDITIONAL(UNITTESTS, test x$unit_tests = xtrue) # ======================== # set global definitions