Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/kernel.git] / salome_adm / unix / config_files / check_Kernel.m4
1 dnl Copyright (C) 2007-2012  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'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 Kernel_ok=no
34
35 KERNEL_LDFLAGS=""
36 KERNEL_CXXFLAGS=""
37
38 AC_ARG_WITH(kernel,
39             [--with-kernel=DIR  root directory path of KERNEL build or installation],
40             [KERNEL_DIR="$withval"],
41             [KERNEL_DIR=""])
42
43 if test "x${KERNEL_DIR}" = "x" ; then
44   AC_MSG_RESULT(for \${KERNEL_ROOT_DIR}: ${KERNEL_ROOT_DIR})
45   # no --with-kernel-dir option used
46   if test "x${KERNEL_ROOT_DIR}" != "x" ; then
47     # KERNEL_ROOT_DIR environment variable defined
48     KERNEL_DIR=${KERNEL_ROOT_DIR}
49   else
50     # search Kernel binaries in PATH variable
51     AC_PATH_PROG(TEMP,runSalome)
52     if test "x${TEMP}" != "x" ; then
53       AC_MSG_RESULT(runSalome was found at : ${TEMP})
54       KERNEL_BIN_DIR=`dirname ${TEMP}`
55       KERNEL_DIR=`cd ${KERNEL_BIN_DIR}/../..; pwd`
56     fi
57   fi
58 fi
59
60 if test -f ${KERNEL_DIR}/bin/salome/runSalome ; then
61    AC_MSG_RESULT(Using Kernel module distribution in ${KERNEL_DIR})
62    Kernel_ok=yes
63
64    if test "x${KERNEL_ROOT_DIR}" = "x" ; then
65       KERNEL_ROOT_DIR=${KERNEL_DIR}
66    fi
67
68    if test "x${KERNEL_SITE_DIR}" = "x" ; then
69       KERNEL_SITE_DIR=${KERNEL_ROOT_DIR}
70    fi
71
72    AC_SUBST(KERNEL_ROOT_DIR)
73    AC_SUBST(KERNEL_SITE_DIR)
74
75    KERNEL_LDFLAGS=-L${KERNEL_DIR}/lib${LIB_LOCATION_SUFFIX}/salome
76    KERNEL_CXXFLAGS=-I${KERNEL_DIR}/include/salome
77
78    AC_SUBST(KERNEL_LDFLAGS)
79    AC_SUBST(KERNEL_CXXFLAGS)
80 else
81    AC_MSG_WARN("Cannot find compiled Kernel module distribution")
82 fi
83
84 AC_MSG_RESULT(for Kernel: $Kernel_ok)
85  
86 ])dnl
87