2004-01-08 16:34:31 +03:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
2005-11-05 22:57:48 +03:00
|
|
|
dnl Copyright (c) 2004-2005 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.
|
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.
|
2006-11-30 04:59:44 +03:00
|
|
|
dnl Copyright (c) 2006 Los Alamos National Security, LLC. All rights
|
|
|
|
dnl 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-03-28 14:02:38 +04:00
|
|
|
dnl sets:
|
|
|
|
dnl F77 : full pathname to compiler
|
|
|
|
dnl BASEF77 : compiler name (no path)
|
2004-06-07 19:33:53 +04:00
|
|
|
dnl OMPI_WANT_F77_BINDINGS : (actually set by ompi_configure_options, may be
|
2004-03-28 14:02:38 +04:00
|
|
|
dnl redefined here)
|
|
|
|
dnl FC : Same as F77. Side effect of AC_PROG_FC. Should
|
|
|
|
dnl not be used
|
|
|
|
dnl defines:
|
2004-06-07 19:33:53 +04:00
|
|
|
dnl OMPI_F77 : same as F77
|
|
|
|
dnl OMPI_WANT_F77_BINDINGS :
|
2004-03-28 14:02:38 +04:00
|
|
|
dnl am_conditional:
|
2004-06-07 19:33:53 +04:00
|
|
|
dnl OMPI_WANT_F77_BINDINGS :
|
2004-01-08 16:34:31 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFUN([OMPI_SETUP_F77],[
|
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 77 compiler"
|
2004-01-08 16:34:31 +03:00
|
|
|
|
2004-03-28 14:02:38 +04:00
|
|
|
#
|
|
|
|
# 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-03-28 14:02:38 +04:00
|
|
|
# symbol conventions, type sizes, etc. We also pass it down to
|
|
|
|
# the wrapper compiler mpif77.
|
|
|
|
#
|
|
|
|
# Always run this test, even if fortran isn't wanted so that F77 has
|
|
|
|
# value for the Fint tests
|
|
|
|
#
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_fflags_save="$FFLAGS"
|
2005-08-25 02:25:48 +04:00
|
|
|
AC_PROG_F77([gfortran g77 f77 xlf frt ifort pgf77 fort77 fl32 af77])
|
2004-06-07 19:33:53 +04:00
|
|
|
FFLAGS="$ompi_fflags_save"
|
2004-03-28 14:02:38 +04:00
|
|
|
if test -z "$F77"; then
|
2004-03-28 14:30:36 +04:00
|
|
|
AC_MSG_WARN([*** Fortran 77 bindings disabled (could not find compiler)])
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_WANT_F77_BINDINGS=0
|
|
|
|
OMPI_F77="none"
|
2004-03-28 14:02:38 +04:00
|
|
|
BASEF77="none"
|
2005-06-17 05:06:36 +04:00
|
|
|
OMPI_F77_ABSOLUTE="none"
|
2004-01-08 16:34:31 +03:00
|
|
|
else
|
2005-06-17 05:06:36 +04:00
|
|
|
OMPI_F77="$F77"
|
2006-10-21 18:24:30 +04:00
|
|
|
set dummy $OMPI_F77
|
|
|
|
OMPI_F77_ARGV0=[$]2
|
|
|
|
BASEF77="`basename $OMPI_F77_ARGV0`"
|
|
|
|
OMPI_F77_ABSOLUTE="`which $OMPI_F77_ARGV0`"
|
2005-06-17 05:06:36 +04:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "$OMPI_WANT_F77_BINDINGS" = "0" ; then
|
2004-03-28 14:30:36 +04:00
|
|
|
AC_MSG_WARN([*** Fortran 77 bindings disabled by user])
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_WANT_F77_BINDINGS=0
|
2004-01-08 16:34:31 +03:00
|
|
|
else
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_WANT_F77_BINDINGS=1
|
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_F77_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 77], [], [], [],
|
2006-02-05 04:28:05 +03:00
|
|
|
[AC_MSG_ERROR([Could not run a simple Fortran 77 program. Aborting.])])])
|
|
|
|
|
2006-11-30 04:59:44 +03:00
|
|
|
# now make sure we know our linking convention...
|
|
|
|
OMPI_F77_FIND_EXT_SYMBOL_CONVENTION
|
|
|
|
|
|
|
|
# Make sure we can link with C code...
|
|
|
|
AS_IF([test $OMPI_WANT_F77_BINDINGS -eq 1],
|
|
|
|
[OMPI_LANG_LINK_WITH_C([Fortran 77], [],
|
|
|
|
[cat <<EOF
|
|
|
|
**********************************************************************
|
|
|
|
* It appears that your Fortran 77 compiler is unable to link against
|
|
|
|
* object files created by your C compiler. This generally indicates
|
|
|
|
* either a conflict between the options specified in CFLAGS and FFLAGS
|
|
|
|
* or a problem with the local compiler installation. More
|
|
|
|
* information (including exactly what command was given to the
|
|
|
|
* compilers and what error resulted when the commands were executed) is
|
|
|
|
* available in the config.log file in this directory.
|
|
|
|
**********************************************************************
|
|
|
|
EOF
|
|
|
|
AC_MSG_ERROR([C and Fortran 77 compilers are not link compatible. Can not continue.])])])
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OMPI_WANT_F77_BINDINGS, $OMPI_WANT_F77_BINDINGS,
|
2004-01-29 06:13:45 +03:00
|
|
|
[Whether we want the MPI f77 bindings or not])
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OMPI_F77, "$OMPI_F77", [OMPI underlying F77 compiler])
|
|
|
|
AM_CONDITIONAL(OMPI_WANT_F77_BINDINGS, test "$OMPI_WANT_F77_BINDINGS" = "1")
|
2005-06-17 05:06:36 +04:00
|
|
|
AC_SUBST(OMPI_F77_ABSOLUTE)
|
2004-01-08 16:34:31 +03:00
|
|
|
])
|