1 dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 dnl This library is free software; you can redistribute it and/or
7 dnl modify it under the terms of the GNU Lesser General Public
8 dnl License as published by the Free Software Foundation; either
9 dnl version 2.1 of the License.
11 dnl This library is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 dnl Lesser General Public License for more details.
16 dnl You should have received a copy of the GNU Lesser General Public
17 dnl License along with this library; if not, write to the Free Software
18 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 AC_DEFUN([CHECK_CPPUNIT],[
24 AC_CHECKING(for cppunit)
31 [AC_HELP_STRING([--with-cppunit=DIR],[directory path to CPPUNIT installation])],
32 [CPPUNITHOME="$withval"
33 AC_MSG_RESULT("select $withval as path to CPPUNIT")
36 AC_ARG_WITH(cppunit_inc,
37 [AC_HELP_STRING([--with-cppunit_inc=DIR],[directory path to CPPUNIT includes])],
38 [CPPUNIT_INCLUDES="$withval"
39 AC_MSG_RESULT("select $withval as path to CPPUNIT includes")
42 if test -z "$CPPUNITHOME"; then
43 AC_MSG_RESULT(CPPUNITHOME not defined)
45 if test "x$exits_ok" = "xno"; then
46 for d in /usr/local /usr ; do
47 AC_CHECK_FILE(${d}/lib64/libcppunit.so,exits_ok=yes,exits_ok=no)
48 if test "x$exits_ok" = "xyes"; then
50 AC_MSG_RESULT(libcppunit.so detected in $d/lib64)
53 AC_CHECK_FILE(${d}/lib/libcppunit.so,exits_ok=yes,exits_ok=no)
54 if test "x$exits_ok" = "xyes"; then
56 AC_MSG_RESULT(libcppunit.so detected in $d/lib)
61 if test "x$exits_ok" = "xno"; then
62 for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do
63 if test -f $d/libcppunit.so ; then
64 AC_MSG_RESULT(libcppunit.so detected in $d)
66 CPPUNITHOME=`echo ${CPPUNITHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
72 if test "x$exits_ok" = "xyes"; then
73 if test -z "$CPPUNIT_INCLUDES"; then
74 CPPUNIT_INCLUDES=$CPPUNITHOME"/include"
78 if test -z "$CPPUNIT_INCLUDES"; then
79 CPPUNIT_INCLUDES="$CPPUNITHOME/include"
83 if test "x$cppunit_ok" = xno -o ! -d "$CPPUNITHOME" ; then
85 AC_MSG_WARN(cppunit not found)
90 CPPFLAGS_old=$CPPFLAGS
91 CPPFLAGS="$CPPFLAGS -I$CPPUNIT_INCLUDES"
93 AC_CHECK_HEADER(cppunit/extensions/HelperMacros.h,cppunit_ok=yes,cppunit_ok=no)
95 CPPFLAGS=$CPPFLAGS_old
97 if test "x$cppunit_ok" = xno ; then
99 AC_MSG_WARN(cppunit not found)
104 if test "x$cppunit_ok" = "xno"
106 AC_MSG_RESULT(unable to found cppunit headers and library)
107 AC_MSG_RESULT(CPPUNITHOME environment variable may be wrong)
109 if test "x$CPPUNIT_INCLUDES" = "x/usr/include"
113 CPPUNIT_INCLUDES="-I$CPPUNIT_INCLUDES"
115 if test "x$CPPUNITHOME" = "x/usr"
117 CPPUNIT_LIBS=" -lcppunit"
119 CPPUNIT_LIBS="-L$CPPUNITHOME/lib -lcppunit"
122 AC_SUBST(CPPUNIT_INCLUDES)
123 AC_SUBST(CPPUNIT_LIBS)
129 AM_CONDITIONAL(CPPUNIT_IS_OK, [test x"$cppunit_ok" = xyes])