Salome HOME
Copyright update 2022
[modules/yacs.git] / adm / unix / config_files / check_cppunit.m4
1 dnl Copyright (C) 2006-2022  CEA/DEN, EDF R&D
2 dnl
3 dnl This library is free software; you can redistribute it and/or
4 dnl modify it under the terms of the GNU Lesser General Public
5 dnl License as published by the Free Software Foundation; either
6 dnl version 2.1 of the License, or (at your option) any later version.
7 dnl
8 dnl This library is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 dnl Lesser General Public License for more details.
12 dnl
13 dnl You should have received a copy of the GNU Lesser General Public
14 dnl License along with this library; if not, write to the Free Software
15 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 dnl
17 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 dnl
19
20 # Check presence of "CPPUNIT" product presence
21 #
22 # Author : Anthony GEAY (CEA, 2006)
23 #
24
25 AC_DEFUN([CHECK_CPPUNIT],[
26 AC_REQUIRE([AC_PROG_CC])dnl
27 AC_REQUIRE([AC_PROG_CPP])dnl
28
29 AC_CHECKING(for CPPUNIT)
30 AC_LANG_SAVE
31 AC_LANG_CPLUSPLUS
32 cppunit_ok=no
33 AC_ARG_WITH(cppunit,
34     [AC_HELP_STRING([--with-cppunit=DIR],[cppunit directory path where cppunit is installed])],
35     [CPPUNITINSTDIR="$withval"
36       AC_MSG_RESULT("select $withval as path to cppunit")
37     ])
38
39 AC_SUBST(CPPUNIT_INCLUDES)
40 AC_SUBST(CPPUNIT_LIBS)
41 AC_SUBST(CPPUNIT_LIBS_DIR)
42 AC_SUBST(CPPUNITINSTDIR)
43
44 CPPUNIT_INCLUDES=""
45 CPPUNIT_LIBS=""
46
47 LOCAL_INCLUDES=""
48 LOCAL_LIBS=""
49
50 if test "x$CPPUNITINSTDIR" = "x"  
51 then
52    LOCAL_INCLUDES=""
53    LOCAL_LIBS_DIR=""
54 else
55    LOCAL_INCLUDES="-I$CPPUNITINSTDIR/include"
56    LOCAL_LIBS_DIR="$CPPUNITINSTDIR/lib"
57 fi
58
59 dnl cppunit headers
60
61 CPPFLAGS_old="$CPPFLAGS"
62 CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
63 AC_LANG_CPLUSPLUS
64 AC_CHECK_HEADER(cppunit/ui/text/TestRunner.h,cppunit_ok=yes ,cppunit_ok=no)
65 CPPFLAGS="$CPPFLAGS_old"
66
67 if test "x$cppunit_ok" = "xyes"
68 then
69   if test "x$LOCAL_INCLUDES" = "x"
70   then
71      CPPUNIT_INCLUDES=""
72      CPPUNIT_LIBS="-lcppunit"
73      CPPUNIT_LIBS_DIR=""
74   else
75      CPPUNIT_INCLUDES="$LOCAL_INCLUDES"
76      CPPUNIT_LIBS="-L$LOCAL_LIBS_DIR -lcppunit"
77      CPPUNIT_LIBS_DIR="$LOCAL_LIBS_DIR"
78   fi
79 fi
80 AM_CONDITIONAL(CPPUNIT_IS_OK, [test x"$cppunit_ok" = xyes])
81 AC_LANG_RESTORE
82 AC_MSG_RESULT(for cppunit: $cppunit_ok)
83
84 ])dnl