1 dnl Copyright (C) 2007-2010 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
23 AC_DEFUN([CHECK_CPPUNIT],[
25 AC_CHECKING(for cppunit)
32 [AC_HELP_STRING([--with-cppunit=DIR],[directory path to CPPUNIT installation])],
33 [CPPUNITHOME="$withval"
34 AC_MSG_RESULT("select $withval as path to CPPUNIT")
37 AC_ARG_WITH(cppunit_inc,
38 [AC_HELP_STRING([--with-cppunit_inc=DIR],[directory path to CPPUNIT includes])],
39 [CPPUNIT_INCLUDES="$withval"
40 AC_MSG_RESULT("select $withval as path to CPPUNIT includes")
43 if test -z "$CPPUNITHOME"; then
44 AC_MSG_RESULT(CPPUNITHOME not defined)
46 if test "x$exits_ok" = "xno"; then
47 for d in /usr/local /usr ; do
48 AC_CHECK_FILE(${d}/lib64/libcppunit.so,exits_ok=yes,exits_ok=no)
49 if test "x$exits_ok" = "xyes"; then
51 AC_MSG_RESULT(libcppunit.so detected in $d/lib64)
54 AC_CHECK_FILE(${d}/lib/libcppunit.so,exits_ok=yes,exits_ok=no)
55 if test "x$exits_ok" = "xyes"; then
57 AC_MSG_RESULT(libcppunit.so detected in $d/lib)
62 if test "x$exits_ok" = "xno"; then
63 for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do
64 if test -f $d/libcppunit.so ; then
65 AC_MSG_RESULT(libcppunit.so detected in $d)
67 CPPUNITHOME=`echo ${CPPUNITHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
73 if test "x$exits_ok" = "xyes"; then
74 if test -z "$CPPUNIT_INCLUDES"; then
75 CPPUNIT_INCLUDES=$CPPUNITHOME"/include"
79 if test -z "$CPPUNIT_INCLUDES"; then
80 CPPUNIT_INCLUDES="$CPPUNITHOME/include"
84 if test "x$cppunit_ok" = xno -o ! -d "$CPPUNITHOME" ; then
86 AC_MSG_WARN(cppunit not found)
91 CPPFLAGS_old=$CPPFLAGS
92 CPPFLAGS="$CPPFLAGS -I$CPPUNIT_INCLUDES"
94 AC_CHECK_HEADER(cppunit/extensions/HelperMacros.h,cppunit_ok=yes,cppunit_ok=no)
96 CPPFLAGS=$CPPFLAGS_old
98 if test "x$cppunit_ok" = xno ; then
100 AC_MSG_WARN(cppunit not found)
105 if test "x$cppunit_ok" = "xno"
107 AC_MSG_RESULT(unable to found cppunit headers and library)
108 AC_MSG_RESULT(CPPUNITHOME environment variable may be wrong)
110 if test "x$CPPUNIT_INCLUDES" = "x/usr/include"
114 CPPUNIT_INCLUDES="-I$CPPUNIT_INCLUDES"
116 if test "x$CPPUNITHOME" = "x/usr"
118 CPPUNIT_LIBS=" -lcppunit"
120 CPPUNIT_LIBS="-L$CPPUNITHOME/lib -lcppunit"
123 AC_SUBST(CPPUNIT_INCLUDES)
124 AC_SUBST(CPPUNIT_LIBS)
130 AM_CONDITIONAL(CPPUNIT_IS_OK, [test x"$cppunit_ok" = xyes])