File: f90_find_module_include_flag.m4

package info (click to toggle)
openmpi 1.6.5-9.1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 91,628 kB
  • ctags: 44,305
  • sloc: ansic: 408,966; cpp: 44,454; sh: 27,828; makefile: 10,486; asm: 3,882; python: 1,239; lex: 805; perl: 549; csh: 253; fortran: 232; f90: 126; tcl: 12
file content (85 lines) | stat: -rw-r--r-- 2,931 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
dnl                         University Research and Technology
dnl                         Corporation.  All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl                         of Tennessee Research Foundation.  All rights
dnl                         reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 
dnl                         University of Stuttgart.  All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl                         All rights reserved.
dnl Copyright (c) 2010      Cisco Systems, Inc.  All rights reserved.
dnl $COPYRIGHT$
dnl 
dnl Additional copyrights may follow
dnl 
dnl $HEADER$
dnl

AC_DEFUN([OMPI_F90_FIND_MODULE_INCLUDE_FLAG],[
    AS_VAR_PUSHDEF([f90_inc_var], [ompi_cv_f90_module_include_flag])
    
    if test "$OMPI_WANT_F90_BINDINGS" -eq 1 ; then
        AC_CACHE_CHECK([for Fortran 90 compiler module include flag], 
           f90_inc_var,
           [ofi_possible_flags="-I -p -M"
            mkdir conftest.$$
            cd conftest.$$

            # Try to compile an F90 module
            mkdir subdir
            cd subdir
            cat > conftest-module.f90 <<EOF
module OMPI_MOD_FLAG

  type OMPI_MOD_FLAG_TYPE
    integer :: i
  end type OMPI_MOD_FLAG_TYPE

end module OMPI_MOD_FLAG
EOF

            OMPI_LOG_COMMAND([$FC $FCFLAGS $FCFLAGS_f90 -c conftest-module.f90 $LDFLAGS $LIBS], , 
                [cd  ..
                 rm -rf conftest.$$
                 AC_MSG_RESULT([Whoops!])
                 AC_MSG_WARN([*** Cannot seem to compile an f90 module])
                 AC_MSG_ERROR([Cannot continue])])
            cd ..

            #
            # Now try to compile a simple program usinng that module, iterating
            # through the possible flags that the compiler might use
            #

            cat > conftest.f90 <<EOF
program f90usemodule
  use OMPI_MOD_FLAG
end program f90usemodule
EOF

            ofi_module_flag=
            for flag in $ofi_possible_flags; do
                if test "$ofi_module_flag" = ""; then
                    OMPI_LOG_COMMAND([$FC $FCFLAGS $FCFLAGS_f90 conftest.f90 ${flag}subdir $LDFLAGS $LIBS],
                            [AS_VAR_SET(f90_inc_var, [$flag])
                            ofi_module_flag="$flag"])
                fi
            done
            cd ..
            rm -rf conftest.$$
        ])

        AS_VAR_COPY([OMPI_FC_MODULE_FLAG], [f90_inc_var])
        if test "$OMPI_FC_MODULE_FLAG" = ""; then
        AC_MSG_WARN([*** Could not determine the f90 compiler flag to indicate where modules reside])
        AC_MSG_ERROR([*** Cannot continue])
        fi
    else
        OMPI_FC_MODULE_FLAG=
    fi
    AC_SUBST(OMPI_FC_MODULE_FLAG)
    AS_VAR_POPDEF([f90_inc_var])
])dnl