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

« back to all changes in this revision

Viewing changes to config/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   This file is part of the Code_Saturne Kernel, element of the
3
 
dnl   Code_Saturne CFD tool.
4
 
dnl
5
 
dnl   Copyright (C) 2011 EDF S.A., France
6
 
dnl
7
 
dnl   The Code_Saturne Kernel is free software; you can redistribute it
8
 
dnl   and/or modify it under the terms of the GNU General Public License
9
 
dnl   as published by the Free Software Foundation; either version 2 of
10
 
dnl   the License, or (at your option) any later version.
11
 
dnl
12
 
dnl   The Code_Saturne Kernel is distributed in the hope that it will be
13
 
dnl   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14
 
dnl   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
dnl   GNU General Public License for more details.
16
 
dnl
17
 
dnl   You should have received a copy of the GNU General Public Licence
18
 
dnl   along with the Code_Saturne Preprocessor; if not, write to the
19
 
dnl   Free Software Foundation, Inc.,
20
 
dnl   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
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
 
AC_SUBST(cs_env_modules)
85
 
 
86
 
])dnl
87