Salome HOME
Improving path management in the whole module
[modules/adao.git] / adm_local / check_Kernel.m4
1 dnl  Copyright (C) 2007-2011  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 # Check availability of Salome's KERNEL binary distribution
23 #
24 # Author : Jerome Roy (CEA, 2003)
25 #
26
27 AC_DEFUN([CHECK_KERNEL],[
28 AC_REQUIRE([AC_LINKER_OPTIONS])dnl
29
30 AC_CHECKING(for Kernel)
31
32 Kernel_ok=no
33
34 KERNEL_LDFLAGS=""
35 KERNEL_CXXFLAGS=""
36
37 AC_ARG_WITH(kernel,
38             [--with-kernel=DIR  root directory path of KERNEL build or installation],
39             [KERNEL_DIR="$withval"],
40             [KERNEL_DIR=""])
41
42 if test "x${KERNEL_DIR}" = "x" ; then
43   AC_MSG_RESULT(for \${KERNEL_ROOT_DIR}: ${KERNEL_ROOT_DIR})
44   # no --with-kernel-dir option used
45   if test "x${KERNEL_ROOT_DIR}" != "x" ; then
46     # KERNEL_ROOT_DIR environment variable defined
47     KERNEL_DIR=${KERNEL_ROOT_DIR}
48   else
49     # search Kernel binaries in PATH variable
50     AC_PATH_PROG(TEMP,runSalome)
51     if test "x${TEMP}" != "x" ; then
52       AC_MSG_RESULT(runSalome was found at : ${TEMP})
53       KERNEL_BIN_DIR=`dirname ${TEMP}`
54       KERNEL_DIR=`cd ${KERNEL_BIN_DIR}/../..; pwd`
55     fi
56   fi
57 fi
58
59 if test -f ${KERNEL_DIR}/bin/salome/runSalome ; then
60    AC_MSG_RESULT(Using Kernel module distribution in ${KERNEL_DIR})
61    Kernel_ok=yes
62
63    if test "x${KERNEL_ROOT_DIR}" = "x" ; then
64       KERNEL_ROOT_DIR=${KERNEL_DIR}
65    fi
66
67    if test "x${KERNEL_SITE_DIR}" = "x" ; then
68       KERNEL_SITE_DIR=${KERNEL_ROOT_DIR}
69    fi
70
71    AC_SUBST(KERNEL_ROOT_DIR)
72    AC_SUBST(KERNEL_SITE_DIR)
73
74    KERNEL_LDFLAGS=-L${KERNEL_DIR}/lib${LIB_LOCATION_SUFFIX}/salome
75    KERNEL_CXXFLAGS=-I${KERNEL_DIR}/include/salome
76
77    AC_SUBST(KERNEL_LDFLAGS)
78    AC_SUBST(KERNEL_CXXFLAGS)
79 else
80    AC_MSG_WARN("Cannot find compiled Kernel module distribution")
81 fi
82
83 AC_MSG_RESULT(for Kernel: $Kernel_ok)
84  
85 ])dnl
86