source: trunk/m4/ax_pbs.m4 @ 97

Revision 97, 3.0 KB checked in by mmamonski, 7 years ago (diff)

DRMAA 1.0.17

  • Property svn:keywords set to Id
Line 
1# $Id$
2#
3# SYNOPSIS
4#
5#   AX_PBS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
6#
7# DESCRIPTION
8#
9#   Check for PBS libraries and headers.
10#
11#   This macro calls::
12#
13#     AC_SUBST(PBS_INCLUDES)
14#     AC_SUBST(PBS_LIBS)
15#     AC_SUBST(PBS_LDFLAGS)
16#
17# LAST MODIFICATION
18#
19#   2008-06-13
20#
21# LICENSE
22#
23#   Written by Łukasz Cieśnik <lukasz.ciesnik@gmail.com>
24#   and placed under Public Domain.
25#   
26#   Further contribution: Mariusz Mamonski <mamonski@man.poznan.pl>
27#
28
29AC_DEFUN([AX_PBS],[
30AC_ARG_WITH([pbs], [AC_HELP_STRING([--with-pbs=<pbs-prefix>],
31                [Path to existing PBS installation root])])
32AC_ARG_ENABLE([disable-pbs-log], [AC_HELP_STRING([--disable-pbs-log],
33                [Do not use liblog while linking with PBS Professional])])
34               
35AC_SUBST(PBS_INCLUDES)
36AC_SUBST(PBS_LIBS)
37AC_SUBST(PBS_LDFLAGS)
38
39if test x"$with_pbs" != x; then
40        PBS_HOME=$with_pbs
41        PBS_INCLUDES="-I${with_pbs}/include "
42        PBS_LDFLAGS="-L${with_pbs}/lib "
43else
44        T1=`which pbsnodes`
45        if test x"$T1" != x; then
46                T2=`dirname $T1`
47                PBS_HOME=`dirname $T2`
48                PBS_INCLUDES="-I${PBS_HOME}/include "
49                PBS_LDFLAGS="-L${PBS_HOME}/lib "
50        fi
51fi
52
53
54PBS_INCLUDES="$PBS_INCLUDES -I${PBS_HOME}/include/torque "
55LDFLAGS_save="$LDFLAGS"
56CPPFLAGS_save="$CPPFLAGS"
57LDFLAGS="$LDFLAGS $PBS_LDFLAGS"
58CPPFLAGS="$CPPFLAGS $PBS_INCLUDES"
59
60ax_pbs_ok="no"
61
62AH_TEMPLATE([PBS_PROFESSIONAL], [compiling against PBS Professional])
63AH_TEMPLATE([PBS_PROFESSIONAL_NO_LOG], [Do not use liblog while linking with PBS Professional])
64AH_TEMPLATE([HAVE_PBS_SUBMIT_HASH], [Torque 4 pbs_submit_hash function found])
65
66if test x"$enable_pbs_log" != "xno"; then
67        ax_pbs_lib_log=" -llog"
68else
69        ax_pbs_lib_log=""
70        AC_DEFINE(PBS_PROFESSIONAL_NO_LOG,[1])
71fi
72
73if test x"$ax_pbs_ok" = xno; then
74        ax_pbs_ok="yes"
75        AC_CHECK_LIB([pbs], [pbs_submit], [:], [ax_pbs_ok="no"])
76        AC_CHECK_LIB([log], [pbse_to_txt], [:], [ax_pbs_ok="no"])
77        if test x"$ax_pbs_ok" = xyes; then
78                ax_pbs_libs="-lpbs $ax_pbs_lib_log"
79        fi
80fi
81
82AS_UNSET([ac_cv_lib_pbs_pbs_submit])
83AS_UNSET([ac_cv_lib_log_pbse_to_txt])
84
85if test x"$ax_pbs_ok" = xno; then
86        ax_pbs_ok="yes"
87        AC_CHECK_LIB([pbs], [pbs_submit], [:], [ax_pbs_ok="no"], [-lssl -lcrypto])
88        AC_CHECK_LIB([log], [pbse_to_txt], [:], [ax_pbs_ok="no"], [-lssl -lcrypto] )
89        if test x"$ax_pbs_ok" = xyes; then
90                ax_pbs_libs="-lpbs $ax_pbs_lib_log -lssl -lcrypto"
91        fi
92fi
93
94ax_pbs_submit_hash="no"
95
96if test x"$ax_pbs_ok" = xno; then
97        ax_pbs_ok="yes"
98        AC_CHECK_LIB([torque], [pbs_submit], [:], [ax_pbs_ok="no"])
99        AC_CHECK_LIB([torque], [pbse_to_txt], [:], [ax_pbs_ok="no"])
100        AC_CHECK_LIB([torque], [pbs_submit_hash], [AC_DEFINE(HAVE_PBS_SUBMIT_HASH) ax_pbs_submit_hash="yes"], [:])
101
102
103        if test x"$ax_pbs_ok" = xyes; then
104                ax_pbs_libs="-ltorque"
105        fi
106else
107        AC_DEFINE(PBS_PROFESSIONAL,[1])
108fi
109
110AM_CONDITIONAL([TORQUE4], [test x$ax_pbs_submit_hash = xyes])
111
112if test x"$ax_pbs_ok" = xyes; then
113        AC_CHECK_HEADERS([pbs_ifl.h pbs_error.h],[:],[ax_pbs_ok="no"])
114fi
115
116LDFLAGS="$LDFLAGS_save"
117CPPFLAGS="$CPPFLAGS_save"
118
119if test x"$ax_pbs_ok" = xyes; then
120        PBS_LIBS="$ax_pbs_libs"
121        ifelse($1, , :, $1)
122else
123        ifelse($2, , :, $2)
124fi
125])
Note: See TracBrowser for help on using the repository browser.