From c63232233b75119e32b01e65e6f2fb0ab825a97b Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 14 Sep 2017 13:03:40 +0900 Subject: [PATCH] configury: install Fortran stuff in the subdir DIR specified by the --mpi-fortran-dir=DIR configure option Refs open-mpi/ompi#2056 Signed-off-by: Gilles Gouaillardet --- config/ompi_configure_options.m4 | 9 +++++++++ config/opal_setup_wrappers.m4 | 4 ++-- ompi/include/Makefile.am | 15 ++++++++++----- ompi/mpi/fortran/mpiext/Makefile.am | 2 ++ ompi/mpi/fortran/mpif-h/Makefile.am | 4 +++- ompi/mpi/fortran/use-mpi-f08/Makefile.am | 2 ++ ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am | 4 +++- ompi/mpi/fortran/use-mpi-tkr/Makefile.am | 2 ++ ompi/tools/wrappers/mpifort-wrapper-data.txt.in | 3 ++- .../base/installdirs_base_components.c | 4 +++- .../installdirs/base/installdirs_base_expand.c | 3 +++ opal/mca/installdirs/config/install_dirs.h.in | 4 ++++ .../installdirs/config/opal_installdirs_config.c | 5 ++++- opal/mca/installdirs/env/opal_installdirs_env.c | 3 +++ opal/mca/installdirs/installdirs.h | 3 +++ opal/tools/wrappers/opal_wrapper.c | 5 +++++ 16 files changed, 60 insertions(+), 12 deletions(-) diff --git a/config/ompi_configure_options.m4 b/config/ompi_configure_options.m4 index 3b9bb0473bd..f0f181bbaff 100644 --- a/config/ompi_configure_options.m4 +++ b/config/ompi_configure_options.m4 @@ -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 diff --git a/config/opal_setup_wrappers.m4 b/config/opal_setup_wrappers.m4 index 6f0e2a2b387..5ca20fb5ac6 100644 --- a/config/opal_setup_wrappers.m4 +++ b/config/opal_setup_wrappers.m4 @@ -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]) @@ -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]) diff --git a/ompi/include/Makefile.am b/ompi/include/Makefile.am index 7a37223619d..02159ed9da0 100644 --- a/ompi/include/Makefile.am +++ b/ompi/include/Makefile.am @@ -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$ # @@ -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 \ @@ -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 diff --git a/ompi/mpi/fortran/mpiext/Makefile.am b/ompi/mpi/fortran/mpiext/Makefile.am index f25a5cb6656..15e3caaf022 100644 --- a/ompi/mpi/fortran/mpiext/Makefile.am +++ b/ompi/mpi/fortran/mpiext/Makefile.am @@ -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. diff --git a/ompi/mpi/fortran/mpif-h/Makefile.am b/ompi/mpi/fortran/mpif-h/Makefile.am index 437adcb1228..bf10b7f4eba 100644 --- a/ompi/mpi/fortran/mpif-h/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/Makefile.am @@ -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$ @@ -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 diff --git a/ompi/mpi/fortran/use-mpi-f08/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/Makefile.am index 0446e4a9e4c..37600d4c824 100644 --- a/ompi/mpi/fortran/use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/Makefile.am @@ -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 diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am index 87f85d4faee..3d853cbaf6d 100644 --- a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am @@ -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. # @@ -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 diff --git a/ompi/mpi/fortran/use-mpi-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-tkr/Makefile.am index a1f3105ddd8..2248acc17f2 100644 --- a/ompi/mpi/fortran/use-mpi-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-tkr/Makefile.am @@ -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 diff --git a/ompi/tools/wrappers/mpifort-wrapper-data.txt.in b/ompi/tools/wrappers/mpifort-wrapper-data.txt.in index 27a7c05ea4a..6e98cd9da05 100644 --- a/ompi/tools/wrappers/mpifort-wrapper-data.txt.in +++ b/ompi/tools/wrappers/mpifort-wrapper-data.txt.in @@ -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@ @@ -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} diff --git a/opal/mca/installdirs/base/installdirs_base_components.c b/opal/mca/installdirs/base/installdirs_base_components.c index 0c10e12fb6f..7faaa73d7a9 100644 --- a/opal/mca/installdirs/base/installdirs_base_components.c +++ b/opal/mca/installdirs/base/installdirs_base_components.c @@ -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$ * @@ -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 */ diff --git a/opal/mca/installdirs/base/installdirs_base_expand.c b/opal/mca/installdirs/base/installdirs_base_expand.c index 139ec229a02..89d4b633dad 100644 --- a/opal/mca/installdirs/base/installdirs_base_expand.c +++ b/opal/mca/installdirs/base/installdirs_base_expand.c @@ -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 @@ -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); } diff --git a/opal/mca/installdirs/config/install_dirs.h.in b/opal/mca/installdirs/config/install_dirs.h.in index 0cde2478fb4..72f1bb290db 100644 --- a/opal/mca/installdirs/config/install_dirs.h.in +++ b/opal/mca/installdirs/config/install_dirs.h.in @@ -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 @@ -125,4 +127,6 @@ this package. */ #define OPAL_MANDIR "@mandir@" +#define OPAL_FORTRANDIR "@OMPI_FORTRAN_DIR@" + #endif diff --git a/opal/mca/installdirs/config/opal_installdirs_config.c b/opal/mca/installdirs/config/opal_installdirs_config.c index d2f8fa8d1de..8b41d66e69e 100644 --- a/opal/mca/installdirs/config/opal_installdirs_config.c +++ b/opal/mca/installdirs/config/opal_installdirs_config.c @@ -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 @@ -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 } }; diff --git a/opal/mca/installdirs/env/opal_installdirs_env.c b/opal/mca/installdirs/env/opal_installdirs_env.c index 340008e91d4..8c9cbf9ded1 100644 --- a/opal/mca/installdirs/env/opal_installdirs_env.c +++ b/opal/mca/installdirs/env/opal_installdirs_env.c @@ -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 @@ -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; } diff --git a/opal/mca/installdirs/installdirs.h b/opal/mca/installdirs/installdirs.h index 7015adf31ea..e5aa7a1cfce 100644 --- a/opal/mca/installdirs/installdirs.h +++ b/opal/mca/installdirs/installdirs.h @@ -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 @@ -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; diff --git a/opal/tools/wrappers/opal_wrapper.c b/opal/tools/wrappers/opal_wrapper.c index 4c4374cd61e..587d4123f75 100644 --- a/opal/tools/wrappers/opal_wrapper.c +++ b/opal/tools/wrappers/opal_wrapper.c @@ -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); + } } }