Commit 4153c8f8 authored by David Goodell's avatar David Goodell
Browse files

[svn-r9135] completely overhaul the build system

Use automake+libtool instead of simplemake+createshlib.  Parallel make
now works for real, and shared library creation should be more robust on
more platforms.  "make dist" now works, modulo building the documentation,
although for boring reasons we can't actually use it for the final
distribution tarball generation.

This is a massive change and without a doubt has some bugs in it.  We'll
work through them as we find them.

No reviewer.
parent 5283393c
# -*- Mode: Makefile; -*-
#
# (C) 2011 by Argonne National Laboratory.
# See COPYRIGHT in top-level directory.
#
ACLOCAL_AMFLAGS = -I confdb
# automake requires that we initialize variables to something, even just empty,
# before appending to them with "+="
AM_CPPFLAGS =
AM_FFLAGS =
AM_FCFLAGS =
include_HEADERS =
nodist_include_HEADERS =
nodist_noinst_HEADERS =
BUILT_SOURCES =
bin_PROGRAMS =
bin_SCRIPTS =
dist_noinst_SCRIPTS =
noinst_DATA =
dist_noinst_DATA =
noinst_HEADERS =
noinst_LIBRARIES =
sysconf_DATA =
nodist_pkgconfig_DATA =
CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
SUFFIXES =
EXTRA_DIST =
# used by nodist_pkgconfig_DATA
pkgconfigdir = $(libdir)/pkgconfig
# contains all of the "errnames.txt" files that are used by maint/extracterrmsgs
# to build src/mpi/errhan/defmsg.h
errnames_txt_files =
external_subdirs = src/mpl src/openpa
# FIXME how/where does external_libs/ldflags get used?
external_ldflags = -L$(top_builddir)/src/mpl -L$(top_builddir)/src/openpa/src
external_libs = -lmpl -lopa
# NOTE on our semi-unconventional usage of DIST_SUBDIRS:
# The automake manual recommends thinking of DIST_SUBDIRS as the list of all
# *configured* subdirectories. The normal autotools model involves
# unconditional configure steps for all/most directories with conditional make
# steps (i.e., conditional inclusion in SUBDIRS). But in the MPICH2 case we
# almost always configure exactly the directories that will be included in
# SUBDIRS. So most additions to DIST_SUBDIRS should be conditional on the same
# condition as the corresponding SUBDIRS addition.
DIST_SUBDIRS = ${external_subdirs}
SUBDIRS = ${external_subdirs}
# lib/lib@MPILIBNAME@.la always contains the "PMPI_" functions and all of the
# functions and symbols that actually make up the MPICH2 implementation. If
# weak symbols are fully supported (such as on Linux), then this library also
# contains weak symbols for "MPI_" aliasing the "PMPI_" symbols. This lib also
# always contains the F77 bindings, but not the F90 or C++ bindings.
#
# if weak symbols are not supported (such as on Darwin), then
# lib/lib@PMPILIBNAME@.la contains duplicate builds of all of the "PMPI_" routines
# as "MPI_" routines, but none of the implementation routines under the hood
# (such as MPIR_Bcast_impl).
lib_LTLIBRARIES = lib/lib@MPILIBNAME@.la
lib_lib@MPILIBNAME@_la_SOURCES =
nodist_lib_lib@MPILIBNAME@_la_SOURCES =
lib_lib@MPILIBNAME@_la_LIBADD = $(external_libs)
lib_lib@MPILIBNAME@_la_LDFLAGS = $(external_ldflags) -version-info $(ABIVERSION)
## Automake attempts to guess the correct linker among the various compilers
## for each language (see "How the Linker is Chosen" in the AM manual).
## However, this process is static and doesn't assume that you will "disable"
## Fortran support for a library and still actually build that library.
## lib@MPILIBNAME@.la contains both C and F77 source, so AM picks "F77LD" as the
## linker. Instead we manually override automake's choice based on the value of
## enable_f77.
if BUILD_F77_BINDING
# link with libtool+F77LD
lib_lib@MPILIBNAME@_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(F77LD) \
$(AM_FFLAGS) $(FFLAGS) $(lib_lib@MPILIBNAME@_la_LDFLAGS) \
$(LDFLAGS) -o $@
else !BUILD_F77_BINDING
# link with libtool+CCLD
lib_lib@MPILIBNAME@_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(lib_lib@MPILIBNAME@_la_CFLAGS) $(CFLAGS) \
$(lib_lib@MPILIBNAME@_la_LDFLAGS) $(LDFLAGS) -o $@
endif !BUILD_F77_BINDING
if BUILD_PROFILING_LIB
lib_LTLIBRARIES += lib/lib@PMPILIBNAME@.la
## FIXME XXX DJG is this "-DMPICH..." flag is in CFLAGS now, should it really be in CPPFLAGS?
lib_lib@PMPILIBNAME@_la_CFLAGS = $(AM_CFLAGS) -DMPICH_MPI_FROM_PMPI
lib_lib@PMPILIBNAME@_la_SOURCES =
lib_lib@PMPILIBNAME@_la_LIBADD =
lib_lib@PMPILIBNAME@_la_LDFLAGS = -version-info $(ABIVERSION)
endif BUILD_PROFILING_LIB
# these are files that provide "MPI_" functions with "PMPI_" profiling versions
# (for the C language bindings only, fortran & C++ are handled separately)
mpi_sources =
# include our subdir automake fragments
include maint/Makefile.mk
include src/Makefile.mk
lib_lib@MPILIBNAME@_la_SOURCES += $(mpi_sources)
if BUILD_PROFILING_LIB
lib_lib@PMPILIBNAME@_la_SOURCES += $(mpi_sources)
endif BUILD_PROFILING_LIB
# FIXME this is the simplemake way, translate to the automake way if it's different
#doc_HTML_SOURCES = ${mpi_sources}
#doc_MAN_SOURCES = ${mpi_sources}
#doc_LATEX_SOURCES = ${mpi_sources}
# FIXME do we want to make this conditional on actually finding a working
# doctext installation?
#
# FIXME also: the doctext program expects the output directories to exit
#
# the automake way to add new suffixes for suffix rules is to use the SUFFIXES
# variable and allow automake to generate the appropriate .SUFFIXES rule for us
SUFFIXES += .man .html .latex
.c.man:
$(DOCTEXT) -man -mpath man/man3 -ext 3 -heading MPI \
-quotefmt ${top_srcdir}/maint/docnotes $<
.c.html:
$(DOCTEXT) -html -mpath www/www3 -heading MPI \
-quotefmt ${top_srcdir}/maint/docnotes $<
.c.latex:
$(DOCTEXT) -latex -mpath doc/refman -heading MPI \
-quotefmt ${top_srcdir}/maint/docnotes $<
mandoc: $(mpi_sources:.c=.man)
htmldoc: $(mpi_sources:.c=.man)
latexdoc: $(mpi_sources:.c=.man)
# FIXME is this what we want to do here? What about for html and latex
# use the "dist_" prefix to cause the man pages to be included in a "make dist"
# tarball
#
# double FIXME: we are lying to make... the doctext program does not create any
# ".man" files, instead it creates ".3" files that are named after the C routine
# instead of being named after the C source file ("MPI_Comm_create.3" instead of
# "comm_create.3" or "comm_create.man").
#dist_man3_MANS = $(mpi_sources:.c=.man)
# build the current directory and then the examples directory after everything else
SUBDIRS += . examples
DIST_SUBDIRS += . examples test
EXTRA_DIST += README CHANGES COPYRIGHT README.envvar
# README.vin is tricky, we don't actually distribute it when we use release.pl,
# but we do need to distribute it in order for ./maint/updatefiles to work
# correctly on a distribution tarball. For now we distribute it when we "make
# dist".
EXTRA_DIST += README.vin
testing:
( cd test && $(MAKE) testing )
install-exec-local:
## FIXME this should live in src/mpi/debugger/Makefile.mk, right?
-if [ "$(BUILD_TVDLL)" = "yes" ] ; then \
$(INSTALL_DATA) src/mpi/debugger/libtvmpich2.$(SHLIB_EXT) \
${DESTDIR}${libdir}/libtvmpich2.$(SHLIB_EXT) ; fi
# the configure step checks for the 'lib' dir to decide whether a source
# directory has been previously used for an in-path build before allowing a
# VPATH build to continue
distclean-local:
-rm -rf $(top_builddir)/lib
-rm -rf $(top_builddir)/bin
-rm -rf $(top_builddir)/include
-rm -rf $(top_builddir)/share
# created by confdb/aclocal_cache.m4
DISTCLEANFILES += config.system
# created by configure
DISTCLEANFILES += .mpich2
# -*- Mode: makefile; -*-
SUBDIRS = . @EXTERNAL_SRC_DIRS@ src
# Do not include test in the basic build.
OTHER_DIRS = test examples
DOC_SUBDIRS = doc
# The all-local target makes sure that when different subsystems are selected
# for the configure step, the libraries are removed and the object files
# cleaned out. Without this step, it is possible to run make and encounter
# errors caused by out-of-date objects in the directories and in the
# library. We do not replace the pkglist file until the make completes,
# using the all-postamble target.
#
# Here is the logic:
# A new configure creates lib/newconfig
# A cleanobjsandlibs step removes that file, as well as removing the
# libraries and object files
# The test for whether the clean step is performed is this:
# Create a file lib/pkglist.new
# Compare lib/pkglist.new to lib/pkglist
# If the same, rm lib/pkglist.new and done.
# If different, then cleanout the libraries and object files,
# then mv lib/pkglist.new lib/pkglist
#
all-local:
@if [ ! -d lib ] ; then mkdir lib ; date > lib/.mpich2created ; \
else \
echo "@subsystems@" > lib/pkglist.new ; \
echo "@CC@ @CFLAGS@" >>lib/pkglist.new ;\
echo "@CXX@ @CXXFLAGS@" >> lib/pkglist.new ;\
echo "@F77@ @FFLAGS@" >> lib/pkglist.new ;\
echo "@FC@ @FCFLAGS@" >> lib/pkglist.new ;\
echo "@CONFIGURE_ARGUMENTS@" >>lib/pkglist.new ; \
echo "@LDFLAGS@" >> lib/pkglist.new ;\
if diff lib/pkglist lib/pkglist.new >/dev/null 2>&1 ; then \
rm -f lib/pkglist.new ; \
else \
${MAKE} cleanobjsandlibs ; \
rm -f lib/pkglist ; \
mv -f lib/pkglist.new lib/pkglist ; \
fi ; \
fi
clean-preamble:
${MAKE} cleanlibs
clean-postamble:
cd examples && ${MAKE} clean
cleanobjsandlibs:
${MAKE} clean && cd test && ${MAKE} clean
rm -f lib/newconfig
# cleanlibs makes sure that we clean all of the library files
cleanlibs:
rm -f lib/lib${MPILIBNAME}.a lib/lib${PMPILIBNAME}.a
rm -f lib/lib${MPICXXLIBNAME}.a
rm -f lib/libf${MPILIBNAME}.a lib/lib${MPILIBNAME}f90.a
rm -f lib/lib${MPILIBNAME}.@SHLIB_EXT@*
rm -f lib/lib${PMPILIBNAME}.@SHLIB_EXT@*
rm -f lib/lib${MPICXXLIBNAME}.@SHLIB_EXT@*
rm -f lib/libf${MPILIBNAME}.@SHLIB_EXT@*
rm -f lib/lib${MPILIBNAME}f90.@SHLIB_EXT@*
rm -f lib/lib${MPILIBNAME}f90.*.@SHLIB_EXT@*
rm -f lib/lib${MPILIBNAME}.*.@SHLIB_EXT@*
rm -f lib/lib${PMPILIBNAME}.*.@SHLIB_EXT@*
rm -f lib/lib${MPICXXLIBNAME}.*.@SHLIB_EXT@*
rm -f lib/libf${MPILIBNAME}.*.@SHLIB_EXT@*
rm -f lib/lib${MPILIBNAME}.la* lib/lib${PMPILIBNAME}.la*
rm -f lib/lib${MPILIBNAME}f90.la*
rm -f lib/lib${MPICXXLIBNAME}.la*
rm -f lib/libf${MPILIBNAME}.la*
all-preamble:
@echo "Beginning make"
@echo "Using variables CC='@CC@' CFLAGS='@CFLAGS@' LDFLAGS='@LDFLAGS@' F77='@F77@' FFLAGS='@FFLAGS@' FC='@FC@' FCFLAGS='@FCFLAGS@' CXX='@CXX@' CXXFLAGS='@CXXFLAGS@' AR='@AR@' CPP='@CPP@' CPPFLAGS='@CPPFLAGS@'"
# Add any final extras:
# 1) Build the debugger interface if requested
# Move the "pkglist.new" file to "pkglist" on successful completion
all-postamble:
( cd examples && $(MAKE) )
@if [ "@BUILD_TVDLL@" = "yes" ] ; then \
( cd src/mpi/debugger && $(MAKE) ./libtvmpich2.@SHLIB_EXT@ ) ; fi
@if [ -s lib/pkglist.new ] ; then mv -f lib/pkglist.new lib/pkglist ; fi
@echo "Make completed"
# The test on lib/.mpich2created lets us delete the local lib directory
# if we created it, and not otherwise
distclean-local:
-@rm -f lib/lib${MPILIBNAME}.a lib/pkglist lib/pkglist.new
-@rm -f lib/lib${MPILIBNAME}.@SHLIB_EXT@* lib/lib${MPILIBNAME}.la
-@if [ -s lib/.mpich2created ] ; then rm -rf lib ; fi
-@rm -f src/include/${MPILIBNAME}conf.h
-@rm -f src/include/mpio.h
-@rm -f bin/mpicc
-@rm -f bin/mpich2version
-@cd test && $(MAKE) distclean
# With PACKAGE set, all mpich2 and mpe2 documentation
# will go to docdir=$datarootdir/doc/$PACKAGE,
# and mpe2's exaamples_*/ and logfiles/ go to $datadir/$PACKAGE.
# Unsetting PACKAGE enables docdir=$datarootdir/doc and mpe2 data in $datadir
# User can do "make install PACKAGE=mpich2-xxx" enables
# docdir=$datarootdir/doc/mpich2-xxx and mpe2 data in $datadir/mpich2-xxx.
# PACKAGE = mpich2-@MPICH2_VERSION@
# We skip the mpid/mm directories because mm is no longer active
# mpe2 is an outside project and is tested against the default
# checks
coding-check:
@if [ -z $(CODINGCHECK) ] ;then \
echo "You must define CODINGCHECK for this target" ; \
else \
echo "Checking the MPICH2 sources" ;\
$(CODINGCHECK) -addchecks=mpich2,funcstates,funcnests \
-skipfiles=src/mpe2,src/mpid/mm src examples test ;\
if [ -d src/mpe2 ] ; then \
echo "Checking mpe2 sources" ;\
$(CODINGCHECK) src/mpe2 ; \
fi ; \
fi
# Set the document sources and types (empty lists still cause recursion)
# These should be empty; any source files should be described in the
# directory that contains those source files. The presence of these
# items simply indicates that there are such documents
doc_HTML_SOURCES =
doc_MAN_SOURCES =
doc_LATEX_SOURCES =
# Add the www index pages
htmldoc-local:
doc/mansrc/createhtmlindex
# Testing requires installation first
testing:
(cd test && $(MAKE) testing)
profilelib_${MPILIBNAME} = ${PMPILIBNAME}
MPICXXLIBNAME = @MPICXXLIBNAME@
MPIFLIBNAME = @MPIFLIBNAME@
MPIFWRAPNAME = @FWRAPNAME@
install_LIB = lib/lib${MPILIBNAME}.a
optinstall_LIB = lib/lib${MPIFLIBNAME}.a
optinstall_LIB = lib/lib${MPICXXLIBNAME}.a
optinstall_LIB = lib/lib${MPIFWRAPNAME}.a
#optinstall_SHLIB = lib/lib${MPIFLIBNAME}.@SHLIB_EXT@
#optinstall_SHLIB = lib/lib${MPICXXLIBNAME}.@SHLIB_EXT@
# Extra information on creating shared libraries, needed on some platforms
# On the platforms that require these options, we require that
# PMPILIBNAME and MPILIBNAME be the same.
# UNUSED, example for experimentation only
#lib${MPILIBNAME}_so_EXPORTS = maint/mpi.def
#libf${MPILIBNAME}_so_EXPORTS = maint/fmpi.def
lib${MPILIBNAME}_so_LIBS = -L. @LDFLAGS_DEPS@ @LIB_DEPS@
libf${MPILIBNAME}_so_LIBS = -L. @LDFLAGS_DEPS@ -l$(MPILIBNAME) @LIB_DEPS@
lib${MPILIBNAME}f90_so_LIBS = -L. @LDFLAGS_DEPS@ -l$(MPILIBNAME) @LIB_DEPS@
lib${MPICXXLIBNAME}_so_LIBS = -L. @LDFLAGS_DEPS@ -l$(MPILIBNAME) @LIB_DEPS@
# Add CXXFLAGS to the linker incase the user has used the CXXFLAGS to
# change the architecture (e.g., -m64 to force 64-bit)
lib${MPICXXLIBNAME}_so_LINKER = @CXX_SHL@ @CXXFLAGS@
install_INCLUDE = src/include/mpi.h $(srcdir)/src/include/mpix.h
optinstall_LIB = lib/lib${PMPILIBNAME}.a
optinstall_SHLIB = lib/lib${MPILIBNAME}.@SHLIB_EXT@
optinstall_SHLIB = lib/lib${PMPILIBNAME}.@SHLIB_EXT@
optinstall_INCLUDE = src/mpi/romio/include/mpiof.h src/mpi/romio/include/mpio.h
optinstall_LIB = lib/libf${MPILIBNAME}.a
optinstall_SHLIB = lib/libf${MPILIBNAME}.@SHLIB_EXT@
optinstall_LIB = lib/lib${MPILIBNAME}f90.a
optinstall_SHLIB = lib/lib${MPILIBNAME}f90.@SHLIB_EXT@
optinstall_SHLIB = lib/lib${MPICXXLIBNAME}.@SHLIB_EXT@
# Some of the subsidiary packages may need to be installed. This target will
# invoke their install targets as part of the installation process
INSTALL_SUBDIRS = src/env src/packaging/pkgconfig src/packaging/envmods \
@bindings_dirs@ @other_install_dirs@
# Install preamble checks for possible problems
install-preamble:
@if [ "@ENABLE_SHLIB@" = none ] ; then\
found=no ; \
for file in ${libdir}/lib*${MPILIBNAME}.@SHLIB_EXT@ ; do \
if [ -f $$file ] ; then \
echo "Remove $$file and rerun ${MAKE} install" ; \
found=yes ; \
fi ; \
done ; \
if [ $$found != no ] ; then exit 1 ; fi ;\
fi
# Install optional features which require special actions:
# The debugger interface (the "Totalview" DLL)
# The "other" process managers when more that one are built
install_local_DIR = libdir
#
# The variables used in the make of install-alt below must be
# the ones within the Makefile - otherwise, if those variables are
# not defined in the shell, the command-line will cause the make step
# to attempt to install into / and the user's home directory
# (This explanation is here to explain why values in the shell must not
# be used.)
install-local:
-if [ "@BUILD_TVDLL@" = "yes" ] ; then \
$(INSTALL_DATA) src/mpi/debugger/libtvmpich2.@SHLIB_EXT@ \
${DESTDIR}${libdir}/libtvmpich2.@SHLIB_EXT@ ; fi
-if [ -n "@other_pm_names@" ] ; then \
for pm in @other_pm_names@ /dev/null ; do \
if [ -d src/pm/$$pm ] ; then \
(cd src/pm/$$pm && \
$(MAKE) DESTDIR=${DESTDIR} prefix=${prefix} bindir=${bindir} install-alt ) ; \
fi ; \
done ; \
fi
#
# The install-examples target may be used if you want to install the cpi
# program for others to use. This is nto part of the default installation
# because there isn't a good place to put this in the GNU recommended
# installation targets (its a kind of hardware-architecture-specific
# documentation)
install-examples:
if [ ! -d ${DESTDIR}${exec_prefix}/examples ] ; then \
$(MKDIR_P) ${DESTDIR}${exec_prefix}/examples ; \
fi
$(INSTALL_PROGRAM) examples/cpi ${DESTDIR}${exec_prefix}/examples/cpi
install-devdocs:
(cd doc && $(MAKE) install-devdocs)
# installcheck-postable adds checks that may require special
# handling.
# FIXME: Some install checks require that the Process Manager be
# started first. This step does not handle that.
installcheck-postamble:
@if [ -n "@mpe_dir@" -a -d "src/@mpe_dir@" ] ; then \
(cd src/@mpe_dir@ && $(MAKE) installcheck-all PACKAGE=$(PACKAGE) ; ) ; fi
#
# The documents are shipped as part of the release, and so should be
# installed from the source directory, not a VPATH build directory
install_DOC =
optinstall_DOC = \
$(srcdir)/doc/userguide/user.pdf \
$(srcdir)/doc/installguide/install.pdf \
$(srcdir)/doc/smpd/smpd_pmi.pdf \
$(srcdir)/doc/logging/logging.pdf
installdir_HTML = $(srcdir)/www
installdir_MAN = $(srcdir)/man
#install_BIN =
#install_SBIN =
# Still to do: figure out the appropriate target for installing the html
# versions of the documents.
dnl PAC_CXX_SEARCH_LIST - expands to a whitespace separated list of C++
dnl compilers for use with AC_PROG_CXX that is more suitable for HPC software
dnl packages
AC_DEFUN([PAC_CXX_SEARCH_LIST],[$CCC c++ g++ gcc CC cxx cc++ cl pgCC xlC icpc pathCC])
dnl PAC_PROG_CXX - reprioritize the C++ compiler search order
dnl NOTE: this macro suffers from a basically intractable "expanded before it
dnl was required" problem when libtool is also used
AC_DEFUN([PAC_PROG_CXX],[
PAC_PUSH_FLAG([CXXFLAGS])
AC_PROG_CXX([g++ icpc pgCC xlC pathCC cl])
# This test uses the list from a recent PROG_CXX, but with the
# addition of the Portland group, IBM, and Intel C++ compilers
# (While the Intel icc compiler will compile C++ programs, it will
# not *link* C++ object files unless there is at least one C++ source
# file present on the command that performs the linking. icpc is the
# Intel C++ compiler that both compiles and links C++ programs)
AC_PROG_CXX([PAC_CXX_SEARCH_LIST])
PAC_POP_FLAG([CXXFLAGS])
])
dnl This is from crypt.to/autoconf-archive, slightly modified.
dnl It defines bool as int if it is not availalbe
dnl
AC_DEFUN([AC_CXX_BOOL],
AC_DEFUN([AX_CXX_BOOL],
[AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
ac_cv_cxx_bool,
[AC_LANG_SAVE
......@@ -28,7 +40,7 @@ fi
dnl This is from crypt.to/autoconf-archive, slightly modified (name defined)
dnl
AC_DEFUN([AC_CXX_EXCEPTIONS],
AC_DEFUN([AX_CXX_EXCEPTIONS],
[AC_CACHE_CHECK(whether the compiler supports exceptions,
ac_cv_cxx_exceptions,
[AC_LANG_SAVE
......@@ -44,7 +56,7 @@ fi
dnl This is from crypt.to/autoconf-archive
dnl
AC_DEFUN([AC_CXX_NAMESPACES],
AC_DEFUN([AX_CXX_NAMESPACES],
[AC_CACHE_CHECK(whether the compiler implements namespaces,
ac_cv_cxx_namespaces,
[AC_LANG_SAVE
......@@ -61,8 +73,8 @@ fi
dnl Some compilers support namespaces but don't know about std
dnl
AC_DEFUN([AC_CXX_NAMESPACE_STD],
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_DEFUN([AX_CXX_NAMESPACE_STD],
[AC_REQUIRE([AX_CXX_NAMESPACES])
AC_CACHE_CHECK(whether the compiler implements the namespace std,
ac_cv_cxx_namespace_std,
[ac_cv_cxx_namespace_std=no
......
dnl PAC_F77_SEARCH_LIST - expands to a whitespace separated list of fortran 77
dnl compilers for use with AC_PROG_F77 that is more suitable for HPC software
dnl packages
AC_DEFUN([PAC_F77_SEARCH_LIST],[ifort pgf77 af77 xlf frt cf77 fort77 fl32 fort ifc efc ftn gfortran f77 g77])
dnl PAC_PROG_F77 - reprioritize the F77 compiler search order
dnl NOTE: this macro suffers from a basically intractable "expanded before it
dnl was required" problem when libtool is also used
AC_DEFUN([PAC_PROG_F77],[
PAC_PUSH_FLAG([FFLAGS])
AC_PROG_F77([ifort pgf77 af77 xlf frt cf77 fort77 fl32 fort ifc efc ftn \
gfortran f77 g77])
AC_PROG_F77([PAC_F77_SEARCH_LIST])
PAC_POP_FLAG([FFLAGS])
])
dnl
......
dnl PAC_FC_SEARCH_LIST - expands to a whitespace separated list of modern
dnl fortran compilers for use with AC_PROG_FC that is more suitable for HPC
dnl software packages
AC_DEFUN([PAC_FC_SEARCH_LIST],
[ifort pgf90 pathf90 pathf95 xlf90 xlf95 xlf2003 gfortran f90 epcf90 f95 fort lf95 g95 ifc efc gfc])
dnl /*D
dnl PAC_PROG_FC([COMPILERS])
dnl
......@@ -31,11 +36,11 @@ dnl the Fortran compiler (e.g., fc=file system check!)
dnl gfortran - The GNU Fortran compiler (not the same as g95)
dnl gfc - An alias for gfortran recommended in cygwin installations
dnl D*/
dnl NOTE: this macro suffers from a basically intractable "expanded before it
dnl was required" problem when libtool is also used
AC_DEFUN([PAC_PROG_FC],[
PAC_PUSH_FLAG([FCFLAGS])
AC_PROG_FC([m4_default([$1],
[ifort pgf90 pathf90 pathf95 xlf90 xlf95 xlf2003 gfortran f90 epcf90 f95 fort lf95 \
g95 ifc efc gfc])])
AC_PROG_FC([m4_default([$1],[PAC_FC_SEARCH_LIST])])
PAC_POP_FLAG([FCFLAGS])
])
dnl
......@@ -241,9 +246,9 @@ dnl
dnl
dnl PAC_FC_MODULE_INCFLAG
AC_DEFUN([PAC_FC_MODULE_INCFLAG],[
AC_REQUIRE([PAC_FC_MODULE_EXT])
AC_CACHE_CHECK([for Fortran 90 module include flag],
pac_cv_fc_module_incflag,[
AC_REQUIRE([PAC_FC_MODULE_EXT])
AC_LANG_PUSH(Fortran)
AC_LANG_CONFTEST([
AC_LANG_SOURCE([
......@@ -343,7 +348,93 @@ dnl
AC_DEFUN([PAC_FC_MODULE],[
PAC_FC_MODULE_EXT
PAC_FC_MODULE_INCFLAG
PAC_FC_MODULE_OUTFLAG
])
dnl
dnl PAC_FC_MODULE_OUTFLAG
AC_DEFUN([PAC_FC_MODULE_OUTFLAG],[
AC_REQUIRE([PAC_FC_MODULE_EXT])
AC_CACHE_CHECK([for Fortran 90 module output directory flag],
[pac_cv_fc_module_outflag],
[
AC_LANG_PUSH([Fortran])
AC_LANG_CONFTEST([
AC_LANG_SOURCE([
module conf
integer n
parameter (n=1)
end module conf
])
])
pac_madedir="no"
if test ! -d conf ; then mkdir conftestdir ; pac_madedir="yes"; fi
if test "$pac_cv_fc_module_case" = "upper" ; then
pac_module="CONF.$pac_cv_fc_module_ext"
else
pac_module="conf.$pac_cv_fc_module_ext"
fi
# check base case that the compiler can create modules and that they endup in
# the current directory
AC_COMPILE_IFELSE([],[
if test -s "$pac_module" ; then
rm -f "$pac_module"
# Remove any temporary files, and hide the work.pc file
# (if the compiler generates them)
if test -f work.pc ; then
mv -f work.pc conftest.pc
fi
rm -f work.pcl
else
AC_MSG_WARN([Unable to build a simple Fortran 90 module])
# echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
# cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
_AC_MSG_LOG_CONFTEST
fi
],[])
# known flags for reasonably recent versions of various f90 compilers:
# gfortran -J${dir}
# xlf -qmoddir=${dir}
# pgf90 -module ${dir}
# ifort -module ${dir}
# nagfor -mdir ${dir}
# ftn -J ${dir} ## the Cray fortran compiler
# f95 -YMOD_OUT_DIR=${dir} ## the Absoft fortran compiler
# lf95 -Am -mod ${dir} ## the Lahey/Fujitsu fortran compiler
#
# If there are any compilers still out there that are totally brain-dead and
# don't support an output directory flag, we can write a wrapper script to tell
# users to use. Alternatively they can use an older version of MPICH2.
pac_cv_fc_module_outflag=
for mod_flag in '-J' '-J ' '-qmoddir=' '-module ' '-YMOD_OUT_DIR=' '-mdir ' ; do
rm -f conftestdir/NONEXISTENT conftestdir/*
PAC_PUSH_FLAG([FCFLAGS])
FCFLAGS="$FCFLAGS ${mod_flag}conftestdir"
AC_COMPILE_IFELSE([],[pac_build_success=yes],[pac_build_success=no])
AS_IF([test "X$pac_build_success" = Xyes],
[AS_IF([test -s "conftestdir/${pac_module}"],
[pac_cv_fc_module_outflag="$mod_flag"])])
PAC_POP_FLAG([FCFLAGS])
AS_IF([test "X$pac_cv_fc_module_outflag" = X],[:],[break])
done
# Remove the conftest* after AC_LANG_CONFTEST
rm -rf conftest.dSYM
rm -f conftest.$ac_ext
if test "$pac_madedir" = "yes" ; then rm -rf conftestdir ; fi
AS_UNSET([pac_madedir])
# Remove the conftest* after AC_LANG_CONFTEST
# This is needed for Mac OSX 10.5
rm -rf conftest.dSYM
rm -f conftest*
AC_LANG_POP(Fortran)
])dnl end AC_CACHE_CHECK
AC_SUBST([FCMODOUTFLAG],[$pac_cv_fc_module_outflag])
])dnl end AC_DEFUN([PAC_FC_MODULE_OUTFLAG])
dnl
dnl PAC_FC_AND_F77_COMPATIBLE([action-if-true],[action-if-false])
dnl
......
......@@ -405,3 +405,104 @@ if test "$SHLIB_EXT" = "unknown" ; then