2 dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
4 AC_DEFUN([AM_PATH_CPPUNIT],
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="")
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
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
25 AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
26 cppunit_version_min=$1
28 AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
30 if test "$CPPUNIT_CONFIG" = "no" ; then
33 CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
34 CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
35 cppunit_version=`$CPPUNIT_CONFIG --version`
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/'`
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/'`
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 `
59 if test "$cppunit_version_proper" = "1" ; then
60 AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
67 if test "x$no_cppunit" = x ; then
68 ifelse([$2], , :, [$2])
72 ifelse([$3], , :, [$3])
75 AC_SUBST(CPPUNIT_CFLAGS)
76 AC_SUBST(CPPUNIT_LIBS)