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