2 AC_DEFUN([CHECK_CPPUNIT],[
4 AC_CHECKING(for cppunit)
11 [AC_HELP_STRING([--with-cppunit=DIR],[directory path to CPPUNIT installation])],
12 [CPPUNITHOME="$withval"
13 AC_MSG_RESULT("select $withval as path to CPPUNIT")
16 AC_ARG_WITH(cppunit_inc,
17 [AC_HELP_STRING([--with-cppunit_inc=DIR],[directory path to CPPUNIT includes])],
18 [CPPUNIT_INCLUDES="$withval"
19 AC_MSG_RESULT("select $withval as path to CPPUNIT includes")
22 if test -z "$CPPUNITHOME"; then
23 AC_MSG_RESULT(CPPUNITHOME not defined)
25 if test "x$exits_ok" = "xno"; then
26 for d in /usr/local /usr ; do
27 AC_CHECK_FILE(${d}/lib64/libcppunit.so,exits_ok=yes,exits_ok=no)
28 if test "x$exits_ok" = "xyes"; then
30 AC_MSG_RESULT(libcppunit.so detected in $d/lib64)
33 AC_CHECK_FILE(${d}/lib/libcppunit.so,exits_ok=yes,exits_ok=no)
34 if test "x$exits_ok" = "xyes"; then
36 AC_MSG_RESULT(libcppunit.so detected in $d/lib)
41 if test "x$exits_ok" = "xno"; then
42 for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do
43 if test -f $d/libcppunit.so ; then
44 AC_MSG_RESULT(libcppunit.so detected in $d)
46 CPPUNITHOME=`echo ${CPPUNITHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
52 if test "x$exits_ok" = "xyes"; then
53 if test -z "$CPPUNIT_INCLUDES"; then
54 CPPUNIT_INCLUDES=$CPPUNITHOME"/include"
58 if test -z "$CPPUNIT_INCLUDES"; then
59 CPPUNIT_INCLUDES="$CPPUNITHOME/include"
63 if test "x$cppunit_ok" = xno -o ! -d "$CPPUNITHOME" ; then
65 AC_MSG_WARN(cppunit not found)
70 CPPFLAGS_old=$CPPFLAGS
71 CPPFLAGS="$CPPFLAGS -I$CPPUNIT_INCLUDES"
73 AC_CHECK_HEADER(cppunit/extensions/HelperMacros.h,cppunit_ok=yes,cppunit_ok=no)
75 CPPFLAGS=$CPPFLAGS_old
77 if test "x$cppunit_ok" = xno ; then
79 AC_MSG_WARN(cppunit not found)
84 if test "x$cppunit_ok" = "xno"
86 AC_MSG_RESULT(unable to found cppunit headers and library)
87 AC_MSG_RESULT(CPPUNITHOME environment variable may be wrong)
89 if test "x$CPPUNIT_INCLUDES" = "x/usr/include"
93 CPPUNIT_INCLUDES="-I$CPPUNIT_INCLUDES"
95 if test "x$CPPUNITHOME" = "x/usr"
97 CPPUNIT_LIBS=" -lcppunit"
99 CPPUNIT_LIBS="-L$CPPUNITHOME/lib -lcppunit"
102 AC_SUBST(CPPUNIT_INCLUDES)
103 AC_SUBST(CPPUNIT_LIBS)
109 AM_CONDITIONAL(CPPUNIT_IS_OK, [test x"$cppunit_ok" = xyes])