source: branches/slurm-drmaa-1.2.0/m4/ax_slurm.m4 @ 5

Revision 5, 2.5 KB checked in by mmatloka, 14 years ago (diff)

svn:keywords

  • Property svn:keywords set to Id Revision
Line 
1# $Id$
2#
3# SYNOPSIS
4#
5#   AX_SLURM([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
6#
7# DESCRIPTION
8#
9#   Check for SLURM libraries and headers.
10#
11#   This macro caslurms::
12#
13#     AC_SUBST(SLURM_INCLUDES)
14#     AC_SUBST(SLURM_LDFLAGS)
15#     AC_SUBST(SLURM_LIBS)
16#
17# LAST MODIFICATION
18#
19#   2010-09-09
20#
21# LICENSE
22#
23#   Written by:
24#     Michał Matłoka <michal.matloka@student.put.poznan.pl>
25#   Based on macro for LSF written by
26#     Mariusz Mamoński <mamonski@man.poznan.pl>
27#   Placed under Public Domain.
28#
29
30AC_DEFUN([AX_SLURM],[
31AC_ARG_WITH([slurm-inc], [AC_HELP_STRING([--with-slurm-inc=<include-dir>],
32                [Path to headers directory (containing slurm/slurm.h)])])
33AC_ARG_WITH([slurm-lib], [AC_HELP_STRING([--with-slurm-lib=<lib-dir>],
34                [Path to directory with SLURM libraries (containing libslurm.a)])])
35
36AC_SUBST(SLURM_INCLUDES)
37AC_SUBST(SLURM_LDFLAGS)
38AC_SUBST(SLURM_LIBS)
39
40AC_MSG_NOTICE([checking for SLURM])
41
42AC_MSG_CHECKING([for SLURM compile flags])
43ax_slurm_msg=""
44if test x$with_slurm_inc != x; then
45        SLURM_INCLUDES="-I${with_slurm_inc}"
46else
47        SRUN_PATH=`which srun`
48        if test x"$SRUN_PATH" != x; then
49                SRUN_DIR=`dirname $SRUN_PATH`
50                SLURM_HOME=`dirname $SRUN_DIR`
51                SLURM_INCLUDES="-I$SLURM_HOME/include"
52        else
53                ax_slurm_msg="no srun in PATH"
54        fi
55fi
56
57AC_MSG_RESULT([$SLURM_INCLUDES$ax_slurm_msg])
58
59AC_MSG_CHECKING([for SLURM library dir])
60ax_slurm_msg=""
61if test x$with_slurm_lib == x; then
62       
63        SRUN_PATH=`which srun`
64       
65        if test x"$SRUN_PATH" != x; then
66                SRUN_DIR=`dirname $SRUN_PATH`
67                SLURM_HOME=`dirname $SRUN_DIR`
68                with_slurm_lib=$SLURM_HOME/lib
69        else
70                ax_slurm_msg="no srun in PATH"
71        fi
72fi
73AC_MSG_RESULT([$with_slurm_lib$ax_slurm_msg])
74
75
76SLURM_LIBS="-lslurm "
77SLURM_LDFLAGS="-L${with_slurm_lib}"
78
79
80CPPFLAGS_save="$CPPFLAGS"
81LDFLAGS_save="$LDFLAGS"
82LIBS_save="$LIBS"
83CPPFLAGS="$CPPFLAGS $SLURM_INCLUDES"
84LDFLAGS="$LDFLAGS $SLURM_LDFLAGS"
85LIBS="$LIBS $SLURM_LIBS"
86
87ax_slurm_ok="no"
88
89AC_MSG_CHECKING([for usable SLURM libraries/headers])
90AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include "slurm/slurm.h" ]],
91                [[ job_desc_msg_t job_req; /*at least check for declared structs */
92                   return 0;
93                 ]])],
94        [ ax_slurm_ok="yes"],
95        [ echo "*** The SLURM test program failed to link or run. See the file config.log"
96          echo "*** for the exact error that occured."],
97        [
98                ax_slurm_ok=yes
99                echo $ac_n "cross compiling; assumed OK... $ac_c"
100        ])
101
102CPPFLAGS="$CPPFLAGS_save"
103LDFLAGS="$LDFLAGS_save"
104LIBS="$LIBS_save"
105AC_MSG_RESULT([$ax_slurm_ok])
106
107if test x"$ax_slurm_ok" = xyes; then
108        ifelse([$1], , :, [$1])
109else
110        ifelse([$2], , :, [$2])
111fi
112])
Note: See TracBrowser for help on using the repository browser.