]> git.saurik.com Git - wxWidgets.git/blob - build/aclocal/cppunit.m4
Backport fix from bakefile svn for autoconf 2.65.
[wxWidgets.git] / build / aclocal / cppunit.m4
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 AC_MSG_RESULT(no)
32 no_cppunit=yes
33 else
34 CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
35 CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
36 cppunit_version=`$CPPUNIT_CONFIG --version`
37
38 cppunit_major_version=`echo $cppunit_version | \
39 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
40 cppunit_minor_version=`echo $cppunit_version | \
41 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
42 cppunit_micro_version=`echo $cppunit_version | \
43 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
44
45 cppunit_major_min=`echo $cppunit_version_min | \
46 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
47 cppunit_minor_min=`echo $cppunit_version_min | \
48 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
49 cppunit_micro_min=`echo $cppunit_version_min | \
50 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
51
52 cppunit_version_proper=`expr \
53 $cppunit_major_version \> $cppunit_major_min \| \
54 $cppunit_major_version \= $cppunit_major_min \& \
55 $cppunit_minor_version \> $cppunit_minor_min \| \
56 $cppunit_major_version \= $cppunit_major_min \& \
57 $cppunit_minor_version \= $cppunit_minor_min \& \
58 $cppunit_micro_version \>= $cppunit_micro_min `
59
60 if test "$cppunit_version_proper" = "1" ; then
61 AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
62 else
63 AC_MSG_RESULT(no)
64 no_cppunit=yes
65 fi
66 fi
67
68 if test "x$no_cppunit" = x ; then
69 ifelse([$2], , :, [$2])
70 else
71 CPPUNIT_CFLAGS=""
72 CPPUNIT_LIBS=""
73 ifelse([$3], , :, [$3])
74 fi
75
76 AC_SUBST(CPPUNIT_CFLAGS)
77 AC_SUBST(CPPUNIT_LIBS)
78 ])
79
80
81