-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck.m4
84 lines (70 loc) · 1.7 KB
/
check.m4
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#------------------------------------------------------------------------
# OD_LIBCHECK --
#
# Decipher the correct ldflags and cflags to link against libcheck
#
# Arguments:
# None.
#
# Requires:
# None.
#
# Depends:
# AC_PROG_CC
#
# Results:
#
# Adds the following arguments to configure:
# --with-libcheck switch to configure.
#
# Result is cached.
#
# Defines and substitutes the following vars:
# LIBCHECK_CFLAGS
# LIBCHECK_LIBS
#
#------------------------------------------------------------------------
dnl Test for check, and define CHECK_CFLAGS and CHECK_LIBS
dnl
AC_DEFUN(OD_LIBCHECK, [
AC_ARG_WITH(check, AC_HELP_STRING([--with-check=PATH], [Prefix where check unit test library is installed. Defaults to auto-detection]), [with_libcheck_prefix=${withval}])
if test x"${with_libcheck_prefix}" != x; then
CHECK_CFLAGS="-I$with_check/include"
CHECK_LIBS="-L$with_check/lib -lcheck"
else
CHECK_CFLAGS=""
CHECK_LIBS="-lcheck"
fi
AC_MSG_CHECKING([for check unit test library])
AC_CACHE_VAL(od_cv_libcheck, [
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $CHECK_CFLAGS"
LIBS="$CHECK_LIBS $LIBS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#include <check.h>
], [
Suite *s;
SRunner *sr;
])
], [
od_cv_libcheck="yes"
], [
od_cv_libcheck="no"
]
)
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
])
AC_MSG_RESULT(${od_cv_libcheck})
if test x"${od_cv_libcheck}" = "xyes"; then
CHECK_DIRS="tests"
else
CHECK_DIRS=""
AC_MSG_WARN([Check library not found. Unit tests will not be built or run.])
fi
AC_SUBST(CHECK_CFLAGS)
AC_SUBST(CHECK_LIBS)
AC_SUBST(CHECK_DIRS)
])