Salome HOME
Merge from V6_main 01/04/2013
[modules/gui.git] / adm_local / unix / config_files / check_GUI.m4
1 dnl Copyright (C) 2007-2013  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 availability of Salome binary distribution
24 #
25 #  Author : Marc Tajchman (CEA, 2002)
26 #------------------------------------------------------------
27
28 AC_DEFUN([CHECK_GUI_MODULE],[
29 AC_REQUIRE([AC_LINKER_OPTIONS])dnl
30
31 LightGUI_ok=no
32 FullGUI_ok=no
33
34 GUI_LDFLAGS=""
35 GUI_CXXFLAGS=""
36
37 SALOME_GUI_DIR=""
38
39 AC_ARG_WITH(gui, 
40             [--with-gui=DIR root directory path of SALOME GUI installation],
41             [],
42             [with_gui=auto])
43
44 if test "${with_gui}" = "no"; then
45   SalomeGUI_need=no
46 else
47   # define SALOME_GUI_DIR
48   if test "${with_gui}" = "yes" -o "${with_gui}" = "auto"; then
49     SalomeGUI_need="$with_gui"
50     AC_MSG_RESULT(try \${GUI_ROOT_DIR}: ${GUI_ROOT_DIR})
51     if test "x${GUI_ROOT_DIR}" != "x" ; then
52       # GUI_ROOT_DIR environment variable defined
53       SALOME_GUI_DIR=${GUI_ROOT_DIR}
54     else
55       # search Salome binaries in PATH variable
56       AC_PATH_PROG(TEMP, SUITApp)
57       if test "x${TEMP}" != "x" ; then
58         AC_MSG_RESULT(SUITApp was found at : ${TEMP})
59         SALOME_BIN_DIR=`dirname ${TEMP}`
60         SALOME_GUI_DIR=`cd ${SALOME_BIN_DIR}/../..; pwd`
61       fi
62     fi 
63   else
64     # GUI directory defined by user
65     SalomeGUI_need=yes
66     SALOME_GUI_DIR="$with_gui"
67   fi
68
69   # check GUI installation
70   AC_CHECKING(for light GUI)
71   if test -f ${SALOME_GUI_DIR}/bin/salome/SUITApp ; then
72     LightGUI_ok=yes
73     AC_MSG_RESULT(Using SALOME GUI distribution in ${SALOME_GUI_DIR})
74         
75     GUI_ROOT_DIR=${SALOME_GUI_DIR}
76
77     GUI_LDFLAGS=-L${SALOME_GUI_DIR}/lib${LIB_LOCATION_SUFFIX}/salome
78     GUI_CXXFLAGS=-I${SALOME_GUI_DIR}/include/salome
79
80     AC_CHECKING(for full GUI)
81     if test -f ${SALOME_GUI_DIR}/bin/salome/SALOME_Session_Server ; then
82       FullGUI_ok=yes
83     fi
84   else
85     AC_MSG_WARN("Cannot find compiled SALOME GUI distribution")
86   fi
87   AC_MSG_RESULT(for light GUI: ${LightGUI_ok})
88   AC_MSG_RESULT(for full GUI: ${FullGUI_ok})
89 fi
90
91 AC_SUBST(GUI_LDFLAGS)
92 AC_SUBST(GUI_CXXFLAGS)
93 AC_SUBST(GUI_ROOT_DIR)
94  
95 ])dnl
96
97 AC_DEFUN([CHECK_SALOME_GUI],[
98   CHECK_GUI_MODULE()
99   SalomeGUI_ok=${LightGUI_ok}
100 ])dnl
101
102 AC_DEFUN([CHECK_CORBA_IN_GUI],[
103   CHECK_GUI_MODULE()
104   CORBA_IN_GUI=${FullGUI_ok}
105   AC_SUBST(CORBA_IN_GUI)
106 ])dnl