Salome HOME
Issue 0019980: EDF 818 OTHER : Get rid of the RPATH issues in packaging
[modules/kernel.git] / salome_adm / unix / config_files / check_lsf.m4
1 dnl  Copyright (C) 2007-2008  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 for LSF
23 AC_DEFUN([CHECK_LSF],
24 [
25  AC_ARG_WITH([lsf], 
26              AC_HELP_STRING([--with-lsf[[[[[=path]      ]]]]],
27                             [tell configure script to use LSF that is located at <path>. Default is no. If path is not given, it is automaticaly determined from LSF_ENVDIR variable.]),
28              [],
29              [withval=no])
30
31  AC_MSG_CHECKING([for LSF])
32
33  if test ! "x$withval" = "xno"
34  then
35    if test "x$withval" = "xyes"
36    then
37      if test ! "x$LSF_ENVDIR" = "x"
38      then
39        test -f "$LSF_ENVDIR/lsf.conf" && . "$LSF_ENVDIR/lsf.conf"
40        LSF=$LSF_TOP
41      else
42        dnl some default values ...
43        LSF=/usr
44        LSF_INCLUDEDIR=$LSF/include
45        LSF_LIBDIR=$LSF/lib
46      fi
47    else
48      LSF=$withval
49      LSF_INCLUDEDIR=$LSF/include
50      LSF_LIBDIR=$LSF/lib
51    fi
52
53    AC_MSG_RESULT([$LSF])
54
55    dnl INCLUDE directory
56
57    LSF_INCLUDES="-I${LSF_INCLUDEDIR}"
58    saved_CPPFLAGS=${CPPFLAGS}
59    CPPFLAGS="${CPPFLAGS} ${LSF_INCLUDES}"
60    AC_CHECK_HEADER([lsf/lsbatch.h], [lsf_header_found=yes], [lsf_header_found=no], [])
61    test x${lsf_header_found} = xno && AC_MSG_WARN([LSF include file not found])
62    CPPFLAGS=${saved_CPPFLAGS}
63    AC_SUBST(LSF_INCLUDES)
64  
65    dnl LIB directory
66
67    if test "x${LSF_LIBDIR}" = "x/usr/lib"
68    then
69      LSF_LDFLAGS=""
70    else
71      LSF_LDFLAGS="-L${LSF_LIBDIR}"
72    fi
73    LSF_LIBS="-lbat -llsf"
74    saved_LDFLAGS=${LDFLAGS}
75    saved_LIBS=${LIBS}
76    LDFLAGS="${LDFLAGS} ${LSF_LDFLAGS}"
77    lsf_lib_found=yes
78    AC_CHECK_LIB([lsf], [ls_load],  [lsf_libs="-llsf ${lsf_libs}"], [lsf_lib_found=no], [])
79    AC_CHECK_LIB([bat], [lsb_init], [lsf_libs="-lbat ${lsf_libs}"], [lsf_lib_found=no], [-llsf])
80    test x${lsf_lib_found} = xno && AC_MSG_WARN([LSF library not found])
81    LIBS="${LSF_LIBS} ${LIBS}"
82    LDFLAGS=${saved_LDFLAGS}
83    LIBS=${saved_LIBS}
84    AC_SUBST(LSF_LDFLAGS)
85    AC_SUBST(LSF_LIBS)
86
87    test x${lsf_lib_found} = xyes && test x${lsf_header_found} = xyes && WITH_LSF=yes
88
89  else
90    WITH_LSF=no
91
92    AC_MSG_RESULT([no])
93
94  fi
95
96  AM_CONDITIONAL(WITH_LSF, test $WITH_LSF = yes)
97
98  lsf_ok=$WITH_LSF
99  if test $lsf_ok = no ; then
100    lsf_ok=
101  fi
102  AC_SUBST(WITH_LSF)
103
104 ])
105