Skip to content

Commit

Permalink
configury: install Fortran stuff in the subdir DIR specified by the -…
Browse files Browse the repository at this point in the history
…-mpi-fortran-dir=DIR configure option

Refs #2056

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
  • Loading branch information
ggouaillardet committed Sep 14, 2017
1 parent 8d336dd commit c632322
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 12 deletions.
9 changes: 9 additions & 0 deletions config/ompi_configure_options.m4
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ AC_ARG_ENABLE(mpi-fortran,
AC_HELP_STRING([--enable-mpi-fortran],
[specify which Fortran MPI bindings to build: yes, none (or no), best-effort, mpifh (build only mpif.h support), usempi (build mpif.h and the mpi module), or usempif08 (or all, build mpifh, the mpi module, and the mpi_f08 module) (default: "yes" if Fortran compiler found)]))

AC_ARG_WITH(mpi-fortran-dir,
AC_HELP_STRING([--with-mpi-fortran-dir=VALUE],
[install Fortran headers, modules and libs in includeVALEUE and libVALUE instead of include and lib]))

AS_IF([test $with_mpi_fortran_dir = yes || test $with_fortran_dir = no],
[OMPI_FORTRAN_DIR=],
[OMPI_FORTRAN_DIR=$with_mpi_fortran_dir])
AC_SUBST([OMPI_FORTRAN_DIR])

# These are the 4 monotonically-rising values indicating levels of
# Fortran bindings support.
OMPI_FORTRAN_NO_BINDINGS=0
Expand Down
4 changes: 2 additions & 2 deletions config/opal_setup_wrappers.m4
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
AC_MSG_CHECKING([for OMPI FCFLAGS])
OMPI_WRAPPER_EXTRA_FCFLAGS="$wrapper_extra_fcflags $with_wrapper_fcflags"
if test "$OMPI_FC_MODULE_FLAG" != "" ; then
OMPI_WRAPPER_EXTRA_FCFLAGS="$OMPI_WRAPPER_EXTRA_FCFLAGS $OMPI_FC_MODULE_FLAG"'${libdir}'
OMPI_WRAPPER_EXTRA_FCFLAGS="$OMPI_WRAPPER_EXTRA_FCFLAGS $OMPI_FC_MODULE_FLAG"'${libdir}''${opalfortrandir}'
fi
AC_SUBST([OMPI_WRAPPER_EXTRA_FCFLAGS])
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_FCFLAGS])
Expand All @@ -444,7 +444,7 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[

AC_MSG_CHECKING([for OMPI LDFLAGS])
OMPI_WRAPPER_EXTRA_LDFLAGS="$ompi_mca_wrapper_extra_ldflags $wrapper_extra_ldflags $with_wrapper_ldflags"
OMPI_WRAPPER_EXTRA_FC_LDFLAGS=$OMPI_WRAPPER_EXTRA_LDFLAGS
OMPI_WRAPPER_EXTRA_FC_LDFLAGS=-L'${libdir}${opalfortrandir}'" ${OMPI_WRAPPER_EXTRA_LDFLAGS}"
RPATHIFY_LDFLAGS([OMPI_WRAPPER_EXTRA_LDFLAGS])
AC_SUBST([OMPI_WRAPPER_EXTRA_LDFLAGS])
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LDFLAGS])
Expand Down
15 changes: 10 additions & 5 deletions ompi/include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# All rights reserved.
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved.
# Copyright (c) 2014-2015 Research Organization for Information Science
# Copyright (c) 2014-2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
Expand All @@ -26,15 +26,18 @@ include $(top_srcdir)/Makefile.ompi-rules
# not ${includedir}/
headers = ompi_config.h
nodist_headers =
fincludedir = $(includedir)@OMPI_FORTRAN_DIR@

# Install these in $(includedir)
include_HEADERS =
# Install those in $(finclude)
finclude_HEADERS =

# Always install these in $(pkgincludedir)
pkginclude_HEADERS =

if OMPI_BUILD_FORTRAN_MPIFH_BINDINGS
include_HEADERS += \
finclude_HEADERS += \
mpif-constants.h \
mpif-externals.h \
mpif-handles.h \
Expand All @@ -50,14 +53,16 @@ endif
nodist_include_HEADERS = \
mpi.h \
mpi-ext.h \
mpi_portable_platform.h

nodist_finclude_HEADERS = \
mpif.h \
mpif-ext.h \
mpif-sizeof.h \
mpif-c-constants-decl.h \
mpi_portable_platform.h
mpif-c-constants-decl.h

if OMPI_BUILD_FORTRAN_MPIFH_BINDINGS
nodist_include_HEADERS += \
nodist_finclude_HEADERS += \
mpif-config.h
endif

Expand Down
2 changes: 2 additions & 0 deletions ompi/mpi/fortran/mpiext/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# $HEADER$
#

libdir = @libdir@@OMPI_FORTRAN_DIR@

#
# Only do the stuff in this file if we're going to build one/both of
# the mpi/mpi_f08 ext modules.
Expand Down
4 changes: 3 additions & 1 deletion ompi/mpi/fortran/mpif-h/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Copyright (c) 2011-2013 Universite Bordeaux 1
# Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2015 Research Organization for Information Science
# Copyright (c) 2015-2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
# $COPYRIGHT$
Expand All @@ -26,6 +26,8 @@

include $(top_srcdir)/Makefile.ompi-rules

libdir = @libdir@@OMPI_FORTRAN_DIR@

SUBDIRS = profile

AM_CPPFLAGS = -DOMPI_BUILD_MPI_PROFILING=0 -DOMPI_COMPILING_FORTRAN_WRAPPERS=1
Expand Down
2 changes: 2 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

include $(top_srcdir)/Makefile.ompi-rules

libdir = @libdir@@OMPI_FORTRAN_DIR@

# This Makefile is only relevant if we're building the "use mpi_f08"
# MPI bindings.
if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS
Expand Down
4 changes: 3 additions & 1 deletion ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- makefile -*-
#
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# Copyright (c) 2015-2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
#
Expand All @@ -14,6 +14,8 @@

include $(top_srcdir)/Makefile.ompi-rules

libdir = @libdir@@OMPI_FORTRAN_DIR@

# This Makefile is only relevant if we're building the ignore-TKR "use
# mpi" MPI bindings.
if OMPI_BUILD_FORTRAN_USEMPI_IGNORE_TKR_BINDINGS
Expand Down
2 changes: 2 additions & 0 deletions ompi/mpi/fortran/use-mpi-tkr/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

include $(top_srcdir)/Makefile.ompi-rules

libdir = @libdir@@OMPI_FORTRAN_DIR@

# THIS MAKEFILE IS OLD AND ONLY TO SUPPORT FORTRAN COMPILERS THAT DO
# NOT SUPPORT "IGNORE TKR" FUNCTIONALITY (i.e., gfortran before v4.9).
# All other Fortran compilers support ignore TKR and don't compile
Expand Down
3 changes: 2 additions & 1 deletion ompi/tools/wrappers/mpifort-wrapper-data.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ project=Open MPI
project_short=OMPI
version=@OMPI_VERSION@
language=Fortran
fortrandir=@OMPI_FORTRAN_DIR@
compiler_env=FC
compiler_flags_env=FCFLAGS
compiler=@FC@
Expand All @@ -24,5 +25,5 @@ libs_static=@OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ -l@OMPI_LIBMP
dyn_lib_file=lib@OMPI_LIBMPI_NAME@.@OPAL_DYN_LIB_SUFFIX@
static_lib_file=lib@OMPI_LIBMPI_NAME@.a
required_file=@OMPI_WRAPPER_FORTRAN_REQUIRED_FILE@
includedir=${includedir}
includedir=${includedir}${opalfortrandir}
libdir=${libdir}
4 changes: 3 additions & 1 deletion opal/mca/installdirs/base/installdirs_base_components.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -81,6 +81,8 @@ opal_installdirs_base_open(mca_base_open_flag_t flags)
opallibdir);
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
opalincludedir);
CONDITIONAL_COPY(opal_install_dirs, component->install_dirs_data,
opalfortrandir);
}

/* expand out all the fields */
Expand Down
3 changes: 3 additions & 0 deletions opal/mca/installdirs/base/installdirs_base_expand.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007 Sun Microsystem, Inc. All rights reserved.
* Copyright (c) 2010 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -144,6 +146,7 @@ opal_install_dirs_expand_internal(const char* input, bool is_setup)
EXPAND_STRING2(opaldatadir, pkgdatadir);
EXPAND_STRING2(opallibdir, pkglibdir);
EXPAND_STRING2(opalincludedir, pkgincludedir);
EXPAND_STRING(opalfortrandir);
} while (changed);
}

Expand Down
4 changes: 4 additions & 0 deletions opal/mca/installdirs/config/install_dirs.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -125,4 +127,6 @@
this package. */
#define OPAL_MANDIR "@mandir@"

#define OPAL_FORTRANDIR "@OMPI_FORTRAN_DIR@"

#endif
5 changes: 4 additions & 1 deletion opal/mca/installdirs/config/opal_installdirs_config.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/*
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -51,6 +53,7 @@ const opal_installdirs_base_component_t mca_installdirs_config_component = {
OPAL_MANDIR,
OPAL_PKGDATADIR,
OPAL_PKGLIBDIR,
OPAL_PKGINCLUDEDIR
OPAL_PKGINCLUDEDIR,
OPAL_FORTRANDIR
}
};
3 changes: 3 additions & 0 deletions opal/mca/installdirs/env/opal_installdirs_env.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -78,6 +80,7 @@ installdirs_env_open(void)
SET_FIELD(opaldatadir, "OPAL_PKGDATADIR");
SET_FIELD(opallibdir, "OPAL_PKGLIBDIR");
SET_FIELD(opalincludedir, "OPAL_PKGINCLUDEDIR");
SET_FIELD(opalfortrandir, "OPAL_FORTRANDIR");

return OPAL_SUCCESS;
}
3 changes: 3 additions & 0 deletions opal/mca/installdirs/installdirs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/*
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -58,6 +60,7 @@ struct opal_install_dirs_t {
char* opaldatadir;
char* opallibdir;
char* opalincludedir;
char* opalfortrandir;
};
typedef struct opal_install_dirs_t opal_install_dirs_t;

Expand Down
5 changes: 5 additions & 0 deletions opal/tools/wrappers/opal_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@ data_callback(const char *key, const char *value)
opal_argv_append_nosize(&options_data[parse_options_idx].link_flags, line);
free(line);
}
} else if (0 == strcmp(key, "fortrandir")) {
char *env = getenv("OPAL_FORTRANDIR");
if (NULL == env) {
opal_install_dirs.opalfortrandir = strdup((NULL==value)?"":value);
}
}
}

Expand Down

0 comments on commit c632322

Please sign in to comment.