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