Salome HOME
updated copyright message
[modules/kernel.git] / salome_adm / unix / config_files / check_Kernel.m4
1 dnl Copyright (C) 2007-2023  CEA, EDF, 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, or (at your option) any later version.
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's KERNEL binary distribution
24 #
25 # Author : Jerome Roy (CEA, 2003)
26 #
27
28 AC_DEFUN([CHECK_KERNEL],[
29 AC_REQUIRE([AC_LINKER_OPTIONS])dnl
30
31 AC_CHECKING(for Kernel)
32
33 # We check for Boost here because an exported header in Kernel depends on Boost shared
34 # pointers
35 if test "x$boost_ok" = "x" 
36 then
37   CHECK_BOOST
38 fi
39
40 Kernel_ok=no
41
42 KERNEL_LDFLAGS=""
43 KERNEL_CXXFLAGS=""
44
45 AC_ARG_WITH(kernel,
46             [--with-kernel=DIR  root directory path of KERNEL build or installation],
47             [KERNEL_DIR="$withval"],
48             [KERNEL_DIR=""])
49
50 if test "x${KERNEL_DIR}" = "x" ; then
51   AC_MSG_RESULT(for \${KERNEL_ROOT_DIR}: ${KERNEL_ROOT_DIR})
52   # no --with-kernel-dir option used
53   if test "x${KERNEL_ROOT_DIR}" != "x" ; then
54     # KERNEL_ROOT_DIR environment variable defined
55     KERNEL_DIR=${KERNEL_ROOT_DIR}
56   else
57     # search Kernel binaries in PATH variable
58     AC_PATH_PROG(TEMP,runSalome.py)
59     if test "x${TEMP}" != "x" ; then
60       AC_MSG_RESULT(runSalome.py was found at : ${TEMP})
61       KERNEL_BIN_DIR=`dirname ${TEMP}`
62       KERNEL_DIR=`cd ${KERNEL_BIN_DIR}/../..; pwd`
63     fi
64   fi
65 fi
66
67 if test -f ${KERNEL_DIR}/bin/salome/runSalome.py ; then
68    AC_MSG_RESULT(Using Kernel module distribution in ${KERNEL_DIR})
69    Kernel_ok=yes
70
71    if test "x${KERNEL_ROOT_DIR}" = "x" ; then
72       KERNEL_ROOT_DIR=${KERNEL_DIR}
73    fi
74
75    if test "x${KERNEL_SITE_DIR}" = "x" ; then
76       KERNEL_SITE_DIR=${KERNEL_ROOT_DIR}
77    fi
78
79    AC_SUBST(KERNEL_ROOT_DIR)
80    AC_SUBST(KERNEL_SITE_DIR)
81
82    KERNEL_LDFLAGS=-L${KERNEL_DIR}/lib${LIB_LOCATION_SUFFIX}/salome
83    KERNEL_CXXFLAGS="-I${KERNEL_DIR}/include/salome ${BOOST_CPPFLAGS}"
84
85    AC_SUBST(KERNEL_LDFLAGS)
86    AC_SUBST(KERNEL_CXXFLAGS)
87 else
88    AC_MSG_WARN("Cannot find compiled Kernel module distribution")
89 fi
90
91 AC_MSG_RESULT(for Kernel: $Kernel_ok)
92
93 ])dnl
94