source: trunk/m4/ax_pbs.m4 @ 14

Revision 14, 2.7 KB checked in by mmamonski, 11 years ago (diff)

forgot to save ;-)

  • 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_INCLUDES="-I${with_pbs}/include "
41        PBS_LDFLAGS="-L${with_pbs}/lib "
42else
43        T1=`which pbsnodes`
44        if test x"$T1" != x; then
45                T2=`dirname $T1`
46                PBS_HOME=`dirname $T2`
47                PBS_INCLUDES="-I${PBS_HOME}/include "
48                PBS_LDFLAGS="-L${PBS_HOME}/lib "
49        fi
50fi
51
52LDFLAGS_save="$LDFLAGS"
53CPPFLAGS_save="$CPPFLAGS"
54LDFLAGS="$LDFLAGS $PBS_LDFLAGS"
55CPPFLAGS="$CPPFLAGS $PBS_INCLUDES"
56
57ax_pbs_ok="no"
58
59AH_TEMPLATE([PBS_PROFESSIONAL], [compiling against PBS Professional])
60AH_TEMPLATE([PBS_PROFESSIONAL_NO_LOG], [Do not use liblog while linking with PBS Professional])
61
62AS_IF([test "x$enable_foo" != "xno"], [
63  dnl Do the stuff needed for enabling the feature
64])
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
94
95if test x"$ax_pbs_ok" = xno; then
96        ax_pbs_ok="yes"
97        AC_CHECK_LIB([torque], [pbs_submit], [:], [ax_pbs_ok="no"])
98        AC_CHECK_LIB([torque], [pbse_to_txt], [:], [ax_pbs_ok="no"])
99        if test x"$ax_pbs_ok" = xyes; then
100                ax_pbs_libs="-ltorque"
101        fi
102else
103        AC_DEFINE(PBS_PROFESSIONAL,[1])
104fi
105
106if test x"$ax_pbs_ok" = xyes; then
107        AC_CHECK_HEADERS([pbs_ifl.h pbs_error.h],[:],[ax_pbs_ok="no"])
108fi
109
110LDFLAGS="$LDFLAGS_save"
111CPPFLAGS="$CPPFLAGS_save"
112
113if test x"$ax_pbs_ok" = xyes; then
114        PBS_LIBS="$ax_pbs_libs"
115        ifelse($1, , :, $1)
116else
117        ifelse($2, , :, $2)
118fi
119])
Note: See TracBrowser for help on using the repository browser.