Salome HOME
0dbe0b6aeb689f96a2992b41ed1c70c039cde234
[modules/gui.git] / adm_local / unix / config_files / check_TestRecorder.m4
1 dnl  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 dnl
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
5 dnl
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.
10 dnl
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.
15 dnl
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
19 dnl
20 dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 dnl
22 #
23 # Check existence of Test recorder sources and libraries.
24 # Set ENABLE_TESTRECORDER to yes|no
25 #
26 # Author : Margarita KARPUNINA (OCN, 2008)
27 #
28
29 AC_DEFUN([CHECK_TESTRECORDER],[
30
31 AC_ARG_WITH(testrecorder,
32             [  --with-testrecorder=DIR       root directory path of TestRecorder installation],
33             [],
34             [with_testrecorder=no])
35
36 AS_IF([test "x$with_testrecorder" != xno || test "$with_testrecorder" != "no"],[
37
38   echo
39   echo ---------------------------------------------
40   echo Testing TestRecorder
41   echo ---------------------------------------------
42   echo
43
44   AC_REQUIRE([CHECK_QT])dnl
45   AC_REQUIRE([AC_PROG_CXX])dnl
46   AC_REQUIRE([AC_PROG_CXXCPP])dnl
47   
48   AC_CHECKING(for TestRecorder product)
49   
50   AC_LANG_SAVE
51   AC_LANG_CPLUSPLUS
52   
53   TESTRECORDER_INCLUDES=""
54   TESTRECORDER_LIBS=""
55   ENABLE_TESTRECORDER="no"
56   
57   TestRecorder_ok=no
58
59   if test "$with_testrecorder" == "yes" || test "$with_testrecorder" == "auto"; then
60       TESTRECORDER_HOME=""
61   else
62       TESTRECORDER_HOME="$with_testrecorder"
63   fi
64   
65   if test "$TESTRECORDER_HOME" == "" ; then
66       if test "x$TESTRECORDERHOME" != "x" ; then
67           TESTRECORDER_HOME=$TESTRECORDERHOME
68       fi
69   fi
70   
71   if test "x$TESTRECORDER_HOME" != "x"; then
72     TESTRECORDER_INCLUDES="-I$TESTRECORDER_HOME/include"
73     TESTRECORDER_LIBS="-L$TESTRECORDER_HOME/lib -lTestRecorder"
74   
75     CPPFLAGS_old="$CPPFLAGS"
76     CXXFLAGS_old="$CXXFLAGS"
77     CPPFLAGS="$TESTRECORDER_INCLUDES $QT_INLCUDES $CPPFLAGS"
78     CXXFLAGS="$TESTRECORDER_INCLUDES $QT_INCLUDES $CXXFLAGS"
79   
80     AC_MSG_CHECKING(for TestRecorder header file)
81   
82     AC_CHECK_HEADER(TestApplication.h,TestRecorder_ok=yes,TestRecorder_ok=no)
83   
84     if test "x$TestRecorder_ok" == "xyes"; then
85   
86       AC_MSG_CHECKING(for TestRecorder library)
87   
88       LDFLAGS_old="$LDFLAGS"
89       LDFLAGS="-L. -$TESTRECORDER_LIBS $QT_LIBS $LDFLAGS"
90   
91       AC_TRY_LINK(
92           #include "TestApplication.h",
93           TESTRECORDER_init();,
94           TestRecorder_ok=yes,TestRecorder_ok=no
95           )
96   
97       LDFLAGS="$LDFLAGS_old"
98   
99       AC_MSG_RESULT($TestRecorder_ok)
100     fi
101   
102     CPPFLAGS="$CPPFLAGS_old"
103     CXXFLAGS="$CXXFLAGS_old"
104   
105   fi
106   
107   if test "x$TestRecorder_ok" == xno ; then
108     AC_MSG_RESULT(for TestRecorder: no)
109     AC_MSG_WARN(TestRecorder is not found or not properly installed)
110   else
111     AC_MSG_RESULT(for TestRecorder: yes)
112     ENABLE_TESTRECORDER="yes"
113   fi
114   
115   AC_SUBST(TESTRECORDER_INCLUDES)
116   AC_SUBST(TESTRECORDER_LIBS)
117   
118   AC_LANG_RESTORE
119
120   ])
121   
122 ])dnl