2004-01-08 16:34:31 +03:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
2006-02-14 23:28:18 +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.
|
2004-11-28 23:09:25 +03:00
|
|
|
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
dnl University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
dnl All rights reserved.
|
2007-06-05 08:04:44 +04:00
|
|
|
dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
|
|
|
|
dnl reserved.
|
2007-12-14 05:39:58 +03:00
|
|
|
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
dnl $COPYRIGHT$
|
|
|
|
dnl
|
|
|
|
dnl Additional copyrights may follow
|
|
|
|
dnl
|
2004-01-08 16:34:31 +03:00
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
2004-06-07 19:33:53 +04:00
|
|
|
dnl OMPI_SETUP_F90
|
2004-03-28 14:02:38 +04:00
|
|
|
dnl
|
|
|
|
dnl sets:
|
|
|
|
dnl F90 : full pathname to compiler
|
|
|
|
dnl BASEF90 : compiler name (no path)
|
2004-06-07 19:33:53 +04:00
|
|
|
dnl OMPI_WANT_F90_BINDINGS : (actually set by ompi_configure_options, may be
|
2004-03-28 14:02:38 +04:00
|
|
|
dnl redefined here)
|
|
|
|
dnl FC : Same as F90. Side effect of AC_PROG_FC. Should
|
|
|
|
dnl not be used
|
|
|
|
dnl defines:
|
2004-06-07 19:33:53 +04:00
|
|
|
dnl OMPI_F90 : same as F90
|
|
|
|
dnl OMPI_WANT_F90_BINDINGS :
|
2004-03-28 14:02:38 +04:00
|
|
|
dnl am_conditional:
|
2004-06-07 19:33:53 +04:00
|
|
|
dnl OMPI_WANT_F90_BINDINGS :
|
2004-01-08 16:34:31 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFUN([OMPI_SETUP_F90],[
|
2007-06-01 06:31:15 +04:00
|
|
|
AC_REQUIRE([AC_PROG_GREP])
|
2004-01-08 16:34:31 +03:00
|
|
|
|
|
|
|
# Modularize this setup so that sub-configure.in scripts can use this
|
|
|
|
# same setup code.
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_show_subtitle "Fortran 90/95 compiler"
|
2004-01-08 16:34:31 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "$OMPI_WANT_F77_BINDINGS" = "0" ; then
|
2005-08-28 17:10:16 +04:00
|
|
|
AC_MSG_WARN([*** Fortran 90/95 bindings implicitly disabled (because])
|
2005-04-16 04:53:22 +04:00
|
|
|
AC_MSG_WARN([*** Fortran 77 bindings were disabled)])
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_WANT_F90_BINDINGS=0
|
|
|
|
OMPI_F90="none"
|
2004-03-28 14:02:38 +04:00
|
|
|
BASEF90="none"
|
2005-06-17 05:06:36 +04:00
|
|
|
OMPI_F90_ABSOLUTE="none"
|
2005-04-16 04:53:22 +04:00
|
|
|
if test "$enable_f90" = "yes"; then
|
|
|
|
AC_MSG_WARN([*** but --enable-f90 was explicitly specified])
|
|
|
|
AC_MSG_ERROR([Cannot continue])
|
|
|
|
fi
|
2004-06-07 19:33:53 +04:00
|
|
|
elif test "$OMPI_WANT_F90_BINDINGS" = "0" ; then
|
2004-03-28 14:30:36 +04:00
|
|
|
AC_MSG_WARN([*** Fortran 90/95 bindings disabled by user])
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_WANT_F90_BINDINGS=0
|
|
|
|
OMPI_F90="none"
|
2004-03-28 14:02:38 +04:00
|
|
|
BASEF90="none"
|
2005-06-17 05:06:36 +04:00
|
|
|
OMPI_F90_ABSOLUTE="none"
|
2004-01-08 16:34:31 +03:00
|
|
|
else
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for the compiler
|
|
|
|
#
|
|
|
|
# Note that we don't actually *use* the fortran compiler to build
|
2004-06-07 19:33:53 +04:00
|
|
|
# anything in OMPI; it's only used here in configure to find out
|
2004-01-08 16:34:31 +03:00
|
|
|
# symbol conventions, type sizes, etc. We also pass it down to
|
|
|
|
# the wrapper compiler mpif90.
|
|
|
|
#
|
2005-01-26 10:41:06 +03:00
|
|
|
# Note that AC_PROG_FC will look for *any* fortran compiler, and
|
|
|
|
# we don't want it to find an F77 compiler. The AC docs don't
|
|
|
|
# recommend using the "dialect" feature of AC_PROG_FC (and you can
|
|
|
|
# only look for one of Fortran 90 or 95 -- not both), so instead
|
|
|
|
# use the optional first parameter and steal the list of Fortran
|
|
|
|
# compilers (excluding the f77 compiler names) from AC's default
|
|
|
|
# list of 95 and 90 compilers and use it here.
|
|
|
|
#
|
2004-01-08 16:34:31 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_fcflags_save="$FCFLAGS"
|
2005-08-25 02:25:48 +04:00
|
|
|
AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgf95 lf95 f90 xlf90 pgf90 epcf90])
|
2004-06-07 19:33:53 +04:00
|
|
|
FCFLAGS="$ompi_fcflags_save"
|
2004-01-08 16:34:31 +03:00
|
|
|
if test -z "$FC"; then
|
2004-03-28 14:30:36 +04:00
|
|
|
AC_MSG_WARN([*** Fortran 90/95 bindings disabled (could not find compiler)])
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_WANT_F90_BINDINGS=0
|
|
|
|
OMPI_F90="none"
|
2004-03-28 14:52:58 +04:00
|
|
|
BASEF90="none"
|
2005-06-17 05:06:36 +04:00
|
|
|
OMPI_F90_ABSOLUTE="none"
|
2004-01-08 16:34:31 +03:00
|
|
|
else
|
2006-02-12 18:11:36 +03:00
|
|
|
OMPI_WANT_F90_BINDINGS=1
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_F90="$FC"
|
2006-10-21 18:24:30 +04:00
|
|
|
set dummy $OMPI_F90
|
|
|
|
OMPI_F90_ARGV0=[$]2
|
|
|
|
BASEF90="`basename $OMPI_F90_ARGV0`"
|
2007-12-14 05:39:58 +03:00
|
|
|
OMPI_WHICH([$OMPI_F90_ARGV0], [OMPI_F90_ABSOLUTE])
|
2004-01-08 16:34:31 +03:00
|
|
|
fi
|
|
|
|
fi
|
2006-02-05 04:28:05 +03:00
|
|
|
# make sure the compiler actually works, if not cross-compiling
|
|
|
|
# Don't just use the AC macro so that we can have a pretty
|
|
|
|
# message.
|
|
|
|
AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1],
|
Another project that has been brewing for a week or so...
We have repeatedly seen users inadvertantly try to use a C compiler
for $CXX (e.g., using icc instead of icpc in recent versions of the
Intel compiler). Unfortunately, this would "sorta work", meaning that
configure would complete successfully and the build would fail much
later in the process (when $CXX was used to try to link a C++
compiler). This was further compounded by the fact that many C
compilers will switch into "C++ mode" when they compile files that end
in .cc -- meaning that they'll *compile* C++ codes properly, but they
won't *link* properly. Hence, users would get all the way down to
compiling the C++ MPI bindings or ompi_info (i.e., very late in the
build process) before the problem became evident.
We already have a test in configure that tries to compile, link, and
run a sample C++ program. This helped ensure that $CXX was a valid
compiler, but it did not catch if the user accidentally supplied a C
compiler instead of a C++ compiler because the test program was simply
"return 0". This commit updates the test program to use some
C++-specific constructs (std::string) so that if the user supplies a C
compiler in $CXX, the program may *compile*, but it will definitely
fail to *link*.
Hence, the process will fail early in configure (with a descriptive
message about how the compiler failed to work properly) rather than
late in the build.
This commit was SVN r10829.
2006-07-15 14:27:09 +04:00
|
|
|
[OMPI_CHECK_COMPILER_WORKS([Fortran], [], [], [],
|
2006-02-05 04:28:05 +03:00
|
|
|
[AC_MSG_ERROR([Could not run a simple Fortran program. Aborting.])])])
|
2004-01-08 16:34:31 +03:00
|
|
|
|
2006-02-12 18:11:36 +03:00
|
|
|
# check to see if the F77 and F90 compilers are compatible
|
|
|
|
AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1],
|
|
|
|
[AC_MSG_CHECKING([whether $OMPI_F77 and $OMPI_F90 compilers are compatible])
|
|
|
|
OMPI_INTL_F90_F77_INTERACTION([fortran_goodness=1], [fortran_goodness=0])
|
|
|
|
if test "$fortran_goodness" = "0" ; then
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
AC_MSG_WARN([*** Fortran 77 and Fortran 90 compilers are not link compatible])
|
|
|
|
AC_MSG_WARN([*** Disabling MPI Fortran 90/95 bindings])
|
|
|
|
OMPI_WANT_F90_BINDINGS=0
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2006-08-03 04:17:31 +04:00
|
|
|
# BWB - FIX ME - remove once everyone updates to LT 2.0.
|
|
|
|
#
|
|
|
|
AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1],
|
2006-10-21 18:24:30 +04:00
|
|
|
[if test $BASEF77 != $BASEF90; then
|
2007-06-01 06:31:15 +04:00
|
|
|
lt_ver=`$GREP '^VERSION' $srcdir/config/ltmain.sh | cut -f2 -d= | cut -f1 -d'.'`
|
2006-08-03 04:17:31 +04:00
|
|
|
if test $lt_ver -lt 2 ; then
|
|
|
|
AC_MSG_ERROR([You appear to be trying to build the Fortran 90
|
|
|
|
layer with Libtool 1.5.x or earlier and a Fortran 77 / Fortran 90 compiler
|
|
|
|
combination that will not work with this configuration. You must either
|
|
|
|
use a different Fortran 77 / Fortran 90 compiler (one where it is the same
|
|
|
|
compiler for both languages), upgrade to Libtool 2.x, or disable the
|
|
|
|
Fortran 90 bindings.])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2007-06-05 08:04:44 +04:00
|
|
|
# OS X before 10.3 (deployment target) does not allow undefined common
|
|
|
|
# symbols in shared libraries. Because we can't figure out how to
|
|
|
|
# implement MPI_STATUSES_IGNORE and friends wihtout common symbols, on
|
|
|
|
# OS X we can't build the F90 bindings as a shared library.
|
|
|
|
AC_MSG_CHECKING([for extra arguments to build a shard library])
|
2006-08-03 04:17:31 +04:00
|
|
|
case "$host" in
|
|
|
|
*apple-darwin*)
|
2007-06-05 08:04:44 +04:00
|
|
|
if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
|
|
|
|
AC_MSG_RESULT([impossible -- -static])
|
|
|
|
OMPI_F90_EXTRA_SHARED_LIBRARY_FLAGS="-static"
|
|
|
|
else
|
|
|
|
case ${MACOSX_DEPLOYMENT_TARGET} in
|
|
|
|
10.[012])
|
|
|
|
AC_MSG_RESULT([impossible -- -static])
|
|
|
|
OMPI_F90_EXTRA_SHARED_LIBRARY_FLAGS="-static"
|
|
|
|
;;
|
|
|
|
10.*)
|
|
|
|
AC_MSG_RESULT([-Wl,-single_module])
|
|
|
|
OMPI_F90_EXTRA_SHARED_LIBRARY_FLAGS="-Wl,-single_module"
|
|
|
|
esac
|
|
|
|
fi
|
2006-08-03 04:17:31 +04:00
|
|
|
;;
|
|
|
|
*)
|
2007-06-05 08:04:44 +04:00
|
|
|
AC_MSG_RESULT([none needed])
|
|
|
|
OMPI_F90_EXTRA_SHARED_LIBRARY_FLAGS=""
|
2006-08-03 04:17:31 +04:00
|
|
|
;;
|
|
|
|
esac
|
2007-06-05 08:04:44 +04:00
|
|
|
AC_SUBST(OMPI_F90_EXTRA_SHARED_LIBRARY_FLAGS)
|
2006-08-03 04:17:31 +04:00
|
|
|
|
2006-02-12 18:11:36 +03:00
|
|
|
# if we're still good, then save the extra file types. Do this last
|
|
|
|
# because it implies tests that should be invoked by the above tests
|
|
|
|
# (e.g., running the fortran compiler).
|
|
|
|
AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1],
|
|
|
|
[AC_LANG_PUSH(Fortran)
|
|
|
|
AC_FC_SRCEXT(f)
|
|
|
|
AC_FC_SRCEXT(f90)
|
|
|
|
AC_LANG_POP(Fortran)])
|
|
|
|
|
|
|
|
# All done -- save values
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OMPI_WANT_F90_BINDINGS, $OMPI_WANT_F90_BINDINGS,
|
2004-01-29 06:13:45 +03:00
|
|
|
[Whether we want the MPI f90 bindings or not])
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OMPI_F90, "$OMPI_F90", [OMPI underlying F90 compiler])
|
|
|
|
AM_CONDITIONAL(OMPI_WANT_F90_BINDINGS, test "$OMPI_WANT_F90_BINDINGS" = "1")
|
2005-06-17 05:06:36 +04:00
|
|
|
AC_SUBST(OMPI_F90_ABSOLUTE)
|
2004-03-28 14:02:38 +04:00
|
|
|
unset fortran_goodness
|
2004-01-08 16:34:31 +03:00
|
|
|
])
|
2004-03-28 14:02:38 +04:00
|
|
|
|
2006-02-12 18:11:36 +03:00
|
|
|
#############################################################################
|
2004-03-28 14:02:38 +04:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFUN([OMPI_INTL_F90_F77_INTERACTION], [
|
2004-03-28 14:02:38 +04:00
|
|
|
# make sure that we can combine F90 and F77 code
|
|
|
|
AC_LANG_PUSH(Fortran)
|
|
|
|
# Fortran module
|
|
|
|
cat > conftestf77.f <<EOF
|
|
|
|
subroutine Conf1_test()
|
|
|
|
end
|
|
|
|
EOF
|
|
|
|
cat > conftestf90.f <<EOF
|
|
|
|
program main
|
|
|
|
call Conf1_test()
|
|
|
|
end
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Try the compile
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_LOG_COMMAND(
|
|
|
|
[$OMPI_F90 $FCFLAGS $FCFLAGS_f -c conftestf90.f],
|
|
|
|
OMPI_LOG_COMMAND(
|
|
|
|
[$OMPI_F77 $FFLAGS -c conftestf77.f],
|
|
|
|
OMPI_LOG_COMMAND(
|
2007-11-28 02:49:08 +03:00
|
|
|
[$OMPI_F90 $FCFLAGS -o conftest conftestf90.o conftestf77.o $LDFLAGS $LIBS],
|
2004-03-28 14:02:38 +04:00
|
|
|
[HAPPY=1],
|
|
|
|
[HAPPY=0]),
|
|
|
|
[HAPPY=0]),
|
|
|
|
[HAPPY=0])
|
|
|
|
|
|
|
|
if test "$HAPPY" = "1"; then
|
|
|
|
$1
|
|
|
|
else
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_LOG_MSG([here is the F77 program:], 1)
|
|
|
|
OMPI_LOG_FILE([conftestf77.f])
|
|
|
|
OMPI_LOG_MSG([here is the F90 program:], 1)
|
2005-07-28 04:41:54 +04:00
|
|
|
OMPI_LOG_FILE([conftestf90.f])
|
2004-03-28 14:02:38 +04:00
|
|
|
$2
|
|
|
|
fi
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
unset HAPPY ompi_conftest_h
|
2007-11-06 15:20:58 +03:00
|
|
|
rm -rf conftest*
|
2004-03-28 14:02:38 +04:00
|
|
|
|
|
|
|
AC_LANG_POP(Fortran)
|
|
|
|
])dnl
|