~ubuntu-branches/ubuntu/precise/code-saturne/precise

« back to all changes in this revision

Viewing changes to m4/cs_modules.m4

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-24 00:00:08 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20111124000008-2vo99e38267942q5
Tags: 2.1.0-3
Install a missing file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl--------------------------------------------------------------------------------
 
2
dnl
 
3
dnl This file is part of Code_Saturne, a general-purpose CFD tool.
 
4
dnl
 
5
dnl Copyright (C) 1998-2011 EDF S.A.
 
6
dnl
 
7
dnl This program is free software; you can redistribute it and/or modify it under
 
8
dnl the terms of the GNU General Public License as published by the Free Software
 
9
dnl Foundation; either version 2 of the License, or (at your option) any later
 
10
dnl version.
 
11
dnl
 
12
dnl This program is distributed in the hope that it will be useful, but WITHOUT
 
13
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
14
dnl FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
15
dnl details.
 
16
dnl
 
17
dnl You should have received a copy of the GNU General Public License along with
 
18
dnl this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
19
dnl Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
20
dnl
 
21
dnl--------------------------------------------------------------------------------
 
22
 
 
23
# CS_AC_TEST_ENV_MODULES
 
24
#-----------------------
 
25
# checks for environement modules
 
26
 
 
27
AC_DEFUN([CS_AC_TEST_ENV_MODULES], [
 
28
 
 
29
AC_ARG_WITH(modules,
 
30
            [AS_HELP_STRING([--with-modules=LIST],
 
31
                            [colon-separated list of environment modules])],
 
32
            [with_modules=$withval],
 
33
            [with_modules=check])
 
34
 
 
35
# Attempt at auto-detection
 
36
 
 
37
cs_env_modules="no"
 
38
 
 
39
if test "x$with_modules" = "xcheck" ; then
 
40
 
 
41
  # Test for environment modules
 
42
 
 
43
  if test "x$MODULESHOME" != "x" ; then
 
44
 
 
45
    AC_MSG_CHECKING([for environment modules])
 
46
 
 
47
    cs_env_modules=""
 
48
    try_modules=""
 
49
    try_modules_p=""
 
50
 
 
51
    oldIFS=$IFS; IFS=:
 
52
    for m in $LOADEDMODULES; do try_modules="$try_modules $m"; done
 
53
    IFS=$oldIFS
 
54
 
 
55
    module purge
 
56
 
 
57
    while test "x$try_modules" != "x$try_modules_p" ;
 
58
    do
 
59
      try_modules_p=$try_modules
 
60
      try_modules=""
 
61
      for m in $try_modules_p ; do
 
62
        prv_LOADED=$LOADEDMODULES
 
63
        module load $m > /dev/null 2>&1
 
64
        if test "$prv_LOADED" != "$LOADEDMODULES" ; then
 
65
          cs_env_modules="$cs_env_modules $m"
 
66
        else
 
67
          try_modules="$retry_modules $m"
 
68
        fi
 
69
      done
 
70
    done
 
71
    module list
 
72
 
 
73
  fi
 
74
 
 
75
elif test "x$with_modules" != "xno" ; then
 
76
 
 
77
  cs_env_modules=""
 
78
  oldIFS=$IFS; IFS=:
 
79
  for m in $with_modules; do cs_env_modules="$cs_env_modules $m"; done
 
80
  IFS=$oldIFS
 
81
 
 
82
fi
 
83
 
 
84
# Find the modulecmd executable
 
85
AC_PATH_PROG([MODULECMD], [modulecmd], [], [${MODULESHOME}/bin:$PATH])
 
86
 
 
87
AC_SUBST(cs_env_modules)
 
88
 
 
89
])dnl
 
90