| 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 |     if test "x${cppunit_major_min}" = "x" ; then
 | 
|---|
| 48 |        cppunit_major_min=0
 | 
|---|
| 49 |     fi
 | 
|---|
| 50 |     
 | 
|---|
| 51 |     cppunit_minor_min=`echo $cppunit_version_min | \
 | 
|---|
| 52 |            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
 | 
|---|
| 53 |     if test "x${cppunit_minor_min}" = "x" ; then
 | 
|---|
| 54 |        cppunit_minor_min=0
 | 
|---|
| 55 |     fi
 | 
|---|
| 56 |     
 | 
|---|
| 57 |     cppunit_micro_min=`echo $cppunit_version_min | \
 | 
|---|
| 58 |            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 | 
|---|
| 59 |     if test "x${cppunit_micro_min}" = "x" ; then
 | 
|---|
| 60 |        cppunit_micro_min=0
 | 
|---|
| 61 |     fi
 | 
|---|
| 62 | 
 | 
|---|
| 63 |     cppunit_version_proper=`expr \
 | 
|---|
| 64 |         $cppunit_major_version \> $cppunit_major_min \| \
 | 
|---|
| 65 |         $cppunit_major_version \= $cppunit_major_min \& \
 | 
|---|
| 66 |         $cppunit_minor_version \> $cppunit_minor_min \| \
 | 
|---|
| 67 |         $cppunit_major_version \= $cppunit_major_min \& \
 | 
|---|
| 68 |         $cppunit_minor_version \= $cppunit_minor_min \& \
 | 
|---|
| 69 |         $cppunit_micro_version \>= $cppunit_micro_min `
 | 
|---|
| 70 | 
 | 
|---|
| 71 |     if test "$cppunit_version_proper" = "1" ; then
 | 
|---|
| 72 |       AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
 | 
|---|
| 73 |     else
 | 
|---|
| 74 |       AC_MSG_RESULT(no)
 | 
|---|
| 75 |       no_cppunit=yes
 | 
|---|
| 76 |     fi
 | 
|---|
| 77 |   fi
 | 
|---|
| 78 | 
 | 
|---|
| 79 |   if test "x$no_cppunit" = x ; then
 | 
|---|
| 80 |      ifelse([$2], , :, [$2])     
 | 
|---|
| 81 |   else
 | 
|---|
| 82 |      CPPUNIT_CFLAGS=""
 | 
|---|
| 83 |      CPPUNIT_LIBS=""
 | 
|---|
| 84 |      ifelse([$3], , :, [$3])
 | 
|---|
| 85 |   fi
 | 
|---|
| 86 | 
 | 
|---|
| 87 |   AC_SUBST(CPPUNIT_CFLAGS)
 | 
|---|
| 88 |   AC_SUBST(CPPUNIT_LIBS)
 | 
|---|
| 89 | ])
 | 
|---|
| 90 | 
 | 
|---|
| 91 | 
 | 
|---|
| 92 | 
 | 
|---|