aboutsummaryrefslogtreecommitdiff
path: root/test/common_plat/m4/validation.m4
blob: 67edac7ae9fe63d842d7c248e48cc44d8e0eb446 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
##########################################################################
# Enable/disable Unit tests
##########################################################################
cunit_support=no
test_vald=no
AC_ARG_ENABLE([test_vald],
    [  --enable-test-vald       run test in test/validation],
    [if test x$enableval = xyes; then
        test_vald=yes
        cunit_support=yes
    fi])

##########################################################################
# Enable/disable Unit tests
##########################################################################
AC_ARG_ENABLE([cunit_support],
    [  --enable-cunit-support  include cunit infrastructure],
    [if test x$enableval = xyes; then
        cunit_support=yes
    fi])

##########################################################################
# Set optional CUnit path
##########################################################################
AC_ARG_WITH([cunit-path],
AC_HELP_STRING([--with-cunit-path=DIR   path to CUnit libs and headers],
               [(or in the default path if not specified).]),
    [CUNIT_PATH=$withval
     CUNIT_CPPFLAGS="-I$CUNIT_PATH/include"
     CUNIT_LIBS="-L$CUNIT_PATH/lib"
     cunit_support=yes],[])

##########################################################################
# Save and set temporary compilation flags
##########################################################################
OLD_LIBS=$LIBS
OLD_CPPFLAGS=$CPPFLAGS
LIBS="$CUNIT_LIBS $LIBS"
CPPFLAGS="$CUNIT_CPPFLAGS $CPPFLAGS"

##########################################################################
# Check for CUnit availability
##########################################################################
if test x$cunit_support = xyes
then
    AC_CHECK_LIB([cunit],[CU_get_error], [CUNIT_LIBS="$CUNIT_LIBS -lcunit"],
        [AC_MSG_ERROR([CUnit libraries required])])
    AC_CHECK_HEADERS([CUnit/Basic.h], [],
        [AC_MSG_FAILURE(["can't find cunit headers"])])
else
    cunit_support=no
fi

AC_SUBST([CUNIT_CPPFLAGS])
AC_SUBST([CUNIT_LIBS])

##########################################################################
# Restore old saved variables
##########################################################################
LIBS=$OLD_LIBS
CPPFLAGS=$OLD_CPPFLAGS