-
Notifications
You must be signed in to change notification settings - Fork 53
/
ac_cppunit.m4
98 lines (87 loc) · 3.47 KB
/
ac_cppunit.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
85
86
87
88
89
90
91
92
93
94
95
96
97
#
# CHECK_CPPUNIT(MINIMUM-VERSION)
#
AC_DEFUN([CHECK_CPPUNIT], [
min_version=$1
AC_ARG_WITH(cppunit-prefix,
AC_HELP_STRING([--with-cppunit-prefix=PREFIX],
[find CppUnit installed under PREFIX]),
cppunit_prefix="$withval", cppunit_prefix="")
AC_ARG_WITH(cppunit-exec-prefix,
AC_HELP_STRING([--with-cppunit-exec-prefix=EPREFIX],
[the exec prefix where CppUnit binaries were installed]),
cppunit_exec_prefix="$withval", cppunit_exec_prefix="")
if test -n "$cppunit_exec_prefix"; then
AC_PATH_PROG(CPPUNIT_CONFIG_SCRIPT, cppunit-config, no,
"$cppunit_exec_prefix/bin")
else
if test -n "$cppunit_prefix"; then
AC_PATH_PROG(CPPUNIT_CONFIG_SCRIPT, cppunit-config, no,
"$cppunit_prefix/bin")
else
AC_PATH_PROG(CPPUNIT_CONFIG_SCRIPT, cppunit-config, no)
fi
fi
if test "$CPPUNIT_CONFIG_SCRIPT" = "no" ; then
echo "*** CppUnit version $min_version or later is required to build the CppUnit test"
echo "*** suite, but it was not found. Either install the latest CppUnit"
echo "*** (http://cppunit.sourceforge.net/), or"
echo "*** adjust your PATH environment variable or use the --with-cppunit-prefix or"
echo "*** --with-cppunit-exec-prefix options so that the cppunit-config script for"
echo "*** your installation can be found, or don't specify the --enable-cppunit-tests"
echo "*** option."
exit -1
else
#
# Check version
#
AC_MSG_CHECKING(for CppUnit version >= $min_version)
found_lib_version=`$CPPUNIT_CONFIG_SCRIPT --version`
found_major_version=`echo $found_lib_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)[[a-z]]*/\1/'`
found_minor_version=`echo $found_lib_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)[[a-z]]*/\2/'`
found_micro_version=`echo $found_lib_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)[[a-z]]*/\3/'`
min_major_version=`echo "$min_version" | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
min_minor_version=`echo "$min_version" | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
min_micro_version=`echo "$min_version" | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
version_ok=no
if test $found_major_version -gt $min_major_version; then
version_ok=yes
elif test $found_major_version -eq $min_major_version && \
test $found_minor_version -gt $min_minor_version; then
version_ok=yes
elif test $found_major_version -eq $min_major_version && \
test $found_minor_version -eq $min_minor_version && \
test $found_micro_version -ge $min_micro_version; then
version_ok=yes
fi
if test "$version_ok" = "no"; then
AC_MSG_RESULT(no)
echo "*** CppUnit version $min_version or later is required, but an old version"
echo "*** was found ($found_lib_version). Please install the latest CppUnit"
echo "*** (http://cppunit.sourceforge.net/)."
exit -1
else
AC_MSG_RESULT(yes)
fi
#
# Check libs
#
libs_result=`$CPPUNIT_CONFIG_SCRIPT --libs`
if test "x$libs_result" != "x"; then
AC_SUBST(CPPUNIT_LIBS, "$libs_result")
fi
#
# Check includes
#
includes_result=`$CPPUNIT_CONFIG_SCRIPT --cflags`
if test "x$includes_result" != "x"; then
AC_SUBST(CPPUNIT_CFLAGS, "$includes_result")
fi
fi
])