]>
Commit | Line | Data |
---|---|---|
948b08e2 VZ |
1 | dnl |
2 | dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) | |
3 | dnl | |
4 | AC_DEFUN([AM_PATH_CPPUNIT], | |
5 | [ | |
6 | ||
7 | AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)], | |
8 | cppunit_config_prefix="$withval", cppunit_config_prefix="") | |
9 | AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)], | |
10 | cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="") | |
11 | ||
12 | if test x$cppunit_config_exec_prefix != x ; then | |
13 | cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix" | |
14 | if test x${CPPUNIT_CONFIG+set} != xset ; then | |
15 | CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config | |
16 | fi | |
17 | fi | |
18 | if test x$cppunit_config_prefix != x ; then | |
19 | cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix" | |
20 | if test x${CPPUNIT_CONFIG+set} != xset ; then | |
21 | CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config | |
22 | fi | |
23 | fi | |
24 | ||
25 | AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no) | |
26 | cppunit_version_min=$1 | |
27 | ||
28 | AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min) | |
29 | no_cppunit="" | |
30 | if test "$CPPUNIT_CONFIG" = "no" ; then | |
31 | no_cppunit=yes | |
32 | else | |
33 | CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags` | |
34 | CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs` | |
35 | cppunit_version=`$CPPUNIT_CONFIG --version` | |
36 | ||
37 | cppunit_major_version=`echo $cppunit_version | \ | |
38 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
39 | cppunit_minor_version=`echo $cppunit_version | \ | |
40 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
41 | cppunit_micro_version=`echo $cppunit_version | \ | |
42 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
43 | ||
44 | cppunit_major_min=`echo $cppunit_version_min | \ | |
45 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
46 | cppunit_minor_min=`echo $cppunit_version_min | \ | |
47 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
48 | cppunit_micro_min=`echo $cppunit_version_min | \ | |
49 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
50 | ||
51 | cppunit_version_proper=`expr \ | |
52 | $cppunit_major_version \> $cppunit_major_min \| \ | |
53 | $cppunit_major_version \= $cppunit_major_min \& \ | |
54 | $cppunit_minor_version \> $cppunit_minor_min \| \ | |
55 | $cppunit_major_version \= $cppunit_major_min \& \ | |
56 | $cppunit_minor_version \= $cppunit_minor_min \& \ | |
57 | $cppunit_micro_version \>= $cppunit_micro_min ` | |
58 | ||
59 | if test "$cppunit_version_proper" = "1" ; then | |
60 | AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version]) | |
61 | else | |
62 | AC_MSG_RESULT(no) | |
63 | no_cppunit=yes | |
64 | fi | |
65 | fi | |
66 | ||
67 | if test "x$no_cppunit" = x ; then | |
68 | ifelse([$2], , :, [$2]) | |
69 | else | |
70 | CPPUNIT_CFLAGS="" | |
71 | CPPUNIT_LIBS="" | |
72 | ifelse([$3], , :, [$3]) | |
73 | fi | |
74 | ||
75 | AC_SUBST(CPPUNIT_CFLAGS) | |
76 | AC_SUBST(CPPUNIT_LIBS) | |
77 | ]) | |
78 | ||
79 | ||
80 |