2005-04-13 15:54:36 +04:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
2006-02-12 18:11:36 +03:00
|
|
|
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
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.
|
2005-04-13 15:54:36 +04:00
|
|
|
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$
|
|
|
|
dnl
|
|
|
|
dnl Additional copyrights may follow
|
|
|
|
dnl
|
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
|
|
|
AC_DEFUN([OMPI_F90_FIND_MODULE_INCLUDE_FLAG],[
|
2006-02-12 18:11:36 +03:00
|
|
|
AS_VAR_PUSHDEF([f90_inc_var], [ompi_cv_f90_module_include_flag])
|
|
|
|
|
2006-02-12 19:59:56 +03:00
|
|
|
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.$$
|
2005-04-13 15:54:36 +04:00
|
|
|
|
2006-02-12 19:59:56 +03:00
|
|
|
# Try to compile an F90 module
|
|
|
|
mkdir subdir
|
|
|
|
cd subdir
|
|
|
|
cat > conftest-module.f90 <<EOF
|
2005-04-13 15:54:36 +04:00
|
|
|
module OMPI_MOD_FLAG
|
|
|
|
|
|
|
|
type OMPI_MOD_FLAG_TYPE
|
|
|
|
integer :: i
|
|
|
|
end type OMPI_MOD_FLAG_TYPE
|
|
|
|
|
|
|
|
end module OMPI_MOD_FLAG
|
|
|
|
EOF
|
|
|
|
|
2006-02-12 19:59:56 +03:00
|
|
|
OMPI_LOG_COMMAND([$FC $FCFLAGS $FCFLAGS_f90 -c conftest-module.f90 $LDFLAGS $LIBS], ,
|
|
|
|
[cd ..
|
|
|
|
rm -rf conftest.$$
|
2005-04-13 15:54:36 +04:00
|
|
|
AC_MSG_RESULT([Whoops!])
|
|
|
|
AC_MSG_WARN([*** Cannot seem to compile an f90 module])
|
2006-02-12 19:59:56 +03:00
|
|
|
AC_MSG_ERROR([Cannot continue])])
|
|
|
|
cd ..
|
2005-04-13 15:54:36 +04:00
|
|
|
|
2006-02-12 19:59:56 +03:00
|
|
|
#
|
|
|
|
# Now try to compile a simple program usinng that module, iterating
|
|
|
|
# through the possible flags that the compiler might use
|
|
|
|
#
|
2005-04-13 15:54:36 +04:00
|
|
|
|
2006-02-12 19:59:56 +03:00
|
|
|
cat > conftest.f90 <<EOF
|
2006-02-12 18:11:36 +03:00
|
|
|
program f90usemodule
|
2005-04-13 15:54:36 +04:00
|
|
|
use OMPI_MOD_FLAG
|
2006-02-12 18:11:36 +03:00
|
|
|
end program f90usemodule
|
2005-04-13 15:54:36 +04:00
|
|
|
EOF
|
|
|
|
|
2006-02-12 19:59:56 +03:00
|
|
|
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.$$
|
|
|
|
])
|
2006-02-12 18:11:36 +03:00
|
|
|
|
2006-02-12 19:59:56 +03:00
|
|
|
OMPI_FC_MODULE_FLAG=AS_VAR_GET(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=
|
2005-04-13 15:54:36 +04:00
|
|
|
fi
|
2006-02-12 18:11:36 +03:00
|
|
|
AC_SUBST(OMPI_FC_MODULE_FLAG)
|
|
|
|
AS_VAR_POPDEF([f90_inc_var])
|
|
|
|
])dnl
|