source: trunk/m4/ax_pbs.m4 @ 15

Revision 15, 2.6 KB checked in by mmamonski, 9 years ago (diff)

other minor fixies

  • 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
62if test x"$enable_pbs_log" != "xno"; then
63        ax_pbs_lib_log=" -llog"
64else
65        ax_pbs_lib_log=""
66        AC_DEFINE(PBS_PROFESSIONAL_NO_LOG,[1])
67fi
68
69if test x"$ax_pbs_ok" = xno; then
70        ax_pbs_ok="yes"
71        AC_CHECK_LIB([pbs], [pbs_submit], [:], [ax_pbs_ok="no"])
72        AC_CHECK_LIB([log], [pbse_to_txt], [:], [ax_pbs_ok="no"])
73        if test x"$ax_pbs_ok" = xyes; then
74                ax_pbs_libs="-lpbs $ax_pbs_lib_log"
75        fi
76fi
77
78AS_UNSET([ac_cv_lib_pbs_pbs_submit])
79AS_UNSET([ac_cv_lib_log_pbse_to_txt])
80
81if test x"$ax_pbs_ok" = xno; then
82        ax_pbs_ok="yes"
83        AC_CHECK_LIB([pbs], [pbs_submit], [:], [ax_pbs_ok="no"], [-lssl -lcrypto])
84        AC_CHECK_LIB([log], [pbse_to_txt], [:], [ax_pbs_ok="no"], [-lssl -lcrypto] )
85        if test x"$ax_pbs_ok" = xyes; then
86                ax_pbs_libs="-lpbs $ax_pbs_lib_log -lssl -lcrypto"
87        fi
88fi
89
90
91if test x"$ax_pbs_ok" = xno; then
92        ax_pbs_ok="yes"
93        AC_CHECK_LIB([torque], [pbs_submit], [:], [ax_pbs_ok="no"])
94        AC_CHECK_LIB([torque], [pbse_to_txt], [:], [ax_pbs_ok="no"])
95        if test x"$ax_pbs_ok" = xyes; then
96                ax_pbs_libs="-ltorque"
97        fi
98else
99        AC_DEFINE(PBS_PROFESSIONAL,[1])
100fi
101
102if test x"$ax_pbs_ok" = xyes; then
103        AC_CHECK_HEADERS([pbs_ifl.h pbs_error.h],[:],[ax_pbs_ok="no"])
104fi
105
106LDFLAGS="$LDFLAGS_save"
107CPPFLAGS="$CPPFLAGS_save"
108
109if test x"$ax_pbs_ok" = xyes; then
110        PBS_LIBS="$ax_pbs_libs"
111        ifelse($1, , :, $1)
112else
113        ifelse($2, , :, $2)
114fi
115])
Note: See TracBrowser for help on using the repository browser.