Salome HOME
Issue 0020406: Time compilation when recompiling
[modules/kernel.git] / salome_adm / unix / config_files / check_openpbs.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 OpenPBS
23 AC_DEFUN([CHECK_OPENPBS],
24 [
25  AC_ARG_VAR([OPENPBS], [OpenPBS home directory])
26  AC_ARG_WITH([openpbs], 
27              AC_HELP_STRING([--with-openpbs=<path>],
28                             [tell configure script to use OpenPBS that is located at <path>]),
29              [test ! x"${withval}" = xyes && OPENPBS=${withval}],
30              [])
31
32  dnl AC_ARG_VAR([OPENPBSSERVERNAME], [OpenPBS server_name file])
33  dnl AC_ARG_WITH([openpbs-server-name], 
34  dnl             AC_HELP_STRING([--with-openpbs-server-name=<path>],
35  dnl                            [tell configure script to use OpenPBS server_name file that is located at <path>]),
36  dnl             [test ! x"${withval}" = xyes && OPENPBSSERVERNAME=${withval}],
37  dnl             [with_openpbs_server_name=""])
38
39
40  if test -z "${OPENPBS}"
41  then
42    AC_MSG_WARN([Environment variable OPENPBS not set. Skipping OpenPBS configuration.])
43
44  else
45
46    OPENPBS_INCLUDES="-I${OPENPBS}/include"
47    saved_CPPFLAGS=${CPPFLAGS}
48    CPPFLAGS="${CPPFLAGS} ${OPENPBS_INCLUDES}"
49    AC_CHECK_HEADER([pbs_ifl.h], [openpbs_header_found=yes], [openpbs_header_found=no], [])
50    test x${openpbs_header_found} = xno && AC_MSG_WARN([OpenPBS include file not found])
51    CPPFLAGS=${saved_CPPFLAGS}
52    AC_SUBST(OPENPBS_INCLUDES)
53  
54    if test "x${OPENPBS}" = "x/usr"
55    then
56      OPENPBS_LIBDIR=""
57    else
58      OPENPBS_LIBDIR="-L${OPENPBS}/lib"
59    fi
60    OPENPBS_LIBS="-lpbs"
61    saved_LDFLAGS=${LDFLAGS}
62    saved_LIBS=${LIBS}
63    LDFLAGS="${LDFLAGS} ${OPENPBS_LIBDIR}"
64    AC_CHECK_LIB([pbs], [pbs_connect], [openpbs_lib_found=yes], [openpbs_lib_found=no], [])
65    test x${openpbs_lib_found} = xno && AC_MSG_WARN([OpenPBS library not found])
66    LIBS="${LIBS} ${OPENPBS_LIBS}"
67    LDFLAGS=${saved_LDFLAGS}
68    LIBS=${saved_LIBS}
69    AC_SUBST(OPENPBS_LIBDIR)
70    AC_SUBST(OPENPBS_LIBS)
71  
72    dnl test -z "${OPENPBSSERVERNAME}" && OPENPBSSERVERNAME="/usr/spool/PBS/server_name"
73    dnl AC_CHECK_FILE([${OPENPBSSERVERNAME}], [openpbs_server_name_found=yes], [openpbs_server_name_found=no])
74
75    test x${openpbs_header_found} = xyes && test x${openpbs_lib_found} = xyes  && openpbs_ok="yes"
76
77  fi
78
79  WITHOPENPBS=$openpbs_ok
80  if test x$WITHOPENPBS = x ; then
81    WITHOPENPBS=no
82  fi
83  AC_SUBST(WITHOPENPBS)
84
85  AM_CONDITIONAL(WITH_OPENPBS, test $WITHOPENPBS = yes)
86
87 ])
88