1
1

On a day brain-fried from other heavy-duty bug chasing, and while

waiting for a few other things to stabalize in teh tree, tackle one of
my other small to-do items that might as well get done.  
- put doxygen docs in .h file
- re-indent to 4 space tabs, as per team guidelines
- clean up the code and use the notation xflags and xppflags to denote
  that they're for any compiler
- add something that LAM users have been asking about for quite a
  while -- environment variable overrides for just about everything

This commit was SVN r2859.
Этот коммит содержится в:
Jeff Squyres 2004-09-25 19:31:17 +00:00
родитель c3c63b57c4
Коммит cbefdfe013
9 изменённых файлов: 774 добавлений и 708 удалений

Просмотреть файл

@ -1,11 +1,9 @@
# -*- makefile -*- #
# $HEADER$ # $HEADER$
# #
include $(top_srcdir)/config/Makefile.options include $(top_srcdir)/config/Makefile.options
libs = $(top_builddir)/src/libmpi.la
# This is ugly, but we need it so that people can change things at # This is ugly, but we need it so that people can change things at
# "make" time (e.g., "make sysconfdir=/foo/bar all") as documented in # "make" time (e.g., "make sysconfdir=/foo/bar all") as documented in
# autoconf. # autoconf.
@ -15,76 +13,43 @@ AM_CPPFLAGS = \
-DOMPI_INCDIR="\"$(includedir)\"" \ -DOMPI_INCDIR="\"$(includedir)\"" \
-DOMPI_LIBDIR="\"$(libdir)\"" -DOMPI_LIBDIR="\"$(libdir)\""
EXTRA_DIST = wrap.cc wrap_engine.cc $(pkgdata_DATA)
pkgdata_DATA = help-wrapper.txt
bin_PROGRAMS = mpicc mpic++ mpif77 mpif90 bin_PROGRAMS = mpicc mpic++ mpif77 mpif90
# We unfortunately can't make a library for the common sources because noinst_LIBRARIES = libompi_wrap.a
# making a library of C++ sources is not standardized. :-( We also
# can't just list the same .cc files in multiple targets, because some
# C++ compilers will actually compile them multiple times (i.e., once
# for each target). This results in a timestamp for wrap.o being
# later than already-finished targets (e.g., when wrap.o may end up
# with a timestamp before mpif77, but after mpicc). So we have to sym
# link the common sources to unique names for each wrapper compiler
# and let them effectively be compiled once for each wrapper.
EXTRA_DIST = wrap.cc wrap_engine.cc libs = $(noinst_LIBRARIES) $(top_builddir)/src/libmpi.la
mpicc_SOURCES = mpicc.cc wrap_cc.cc wrap_engine_cc.cc ompi_wrap.h libompi_wrap_a_SOURCES = wrap.cc wrap_engine.cc ompi_wrap.h
mpicc_SOURCES = mpicc.cc ompi_wrap.h
mpicc_LDADD = $(libs) $(LIBOMPI_EXTRA_LIBS) mpicc_LDADD = $(libs) $(LIBOMPI_EXTRA_LIBS)
mpicc_LDFLAGS = $(LIBOMPI_EXTRA_LDFLAGS) mpicc_LDFLAGS = $(LIBOMPI_EXTRA_LDFLAGS)
mpicc_DEPENDENCIES = $(libs) mpicc_DEPENDENCIES = $(libs)
mpic___SOURCES = mpicxx.cc wrap_cxx.cc wrap_engine_cxx.cc ompi_wrap.h mpic___SOURCES = mpicxx.cc ompi_wrap.h
mpic___LDADD = $(libs) $(LIBOMPI_EXTRA_LIBS) mpic___LDADD = $(libs) $(LIBOMPI_EXTRA_LIBS)
mpic___LDFLAGS = $(LIBOMPI_EXTRA_LDFLAGS) mpic___LDFLAGS = $(LIBOMPI_EXTRA_LDFLAGS)
mpic___DEPENDENCIES = $(libs) mpic___DEPENDENCIES = $(libs)
mpif77_SOURCES = mpif77.cc wrap_f77.cc wrap_engine_f77.cc ompi_wrap.h mpif77_SOURCES = mpif77.cc ompi_wrap.h
mpif77_LDADD = $(libs) $(LIBOMPI_EXTRA_LIBS) mpif77_LDADD = $(libs) $(LIBOMPI_EXTRA_LIBS)
mpif77_LDFLAGS = $(LIBOMPI_EXTRA_LDFLAGS) mpif77_LDFLAGS = $(LIBOMPI_EXTRA_LDFLAGS)
mpif77_DEPENDENCIES = $(libs) mpif77_DEPENDENCIES = $(libs)
mpif90_SOURCES = mpif90.cc wrap_f90.cc wrap_engine_f90.cc ompi_wrap.h mpif90_SOURCES = mpif90.cc ompi_wrap.h
mpif90_LDADD = $(libs) $(LIBOMPI_EXTRA_LIBS) mpif90_LDADD = $(libs) $(LIBOMPI_EXTRA_LIBS)
mpif90_LDFLAGS = $(LIBOMPI_EXTRA_LDFLAGS) mpif90_LDFLAGS = $(LIBOMPI_EXTRA_LDFLAGS)
mpif90_DEPENDENCIES = $(libs) mpif90_DEPENDENCIES = $(libs)
# Make the sym links
wrap_cc.cc:
ln -s $(top_srcdir)/src/tools/wrappers/wrap.cc wrap_cc.cc
wrap_engine_cc.cc:
ln -s $(top_srcdir)/src/tools/wrappers/wrap_engine.cc wrap_engine_cc.cc
wrap_cxx.cc:
ln -s $(top_srcdir)/src/tools/wrappers/wrap.cc wrap_cxx.cc
wrap_engine_cxx.cc:
ln -s $(top_srcdir)/src/tools/wrappers/wrap_engine.cc wrap_engine_cxx.cc
wrap_f77.cc:
ln -s $(top_srcdir)/src/tools/wrappers/wrap.cc wrap_f77.cc
wrap_engine_f77.cc:
ln -s $(top_srcdir)/src/tools/wrappers/wrap_engine.cc wrap_engine_f77.cc
wrap_f90.cc:
ln -s $(top_srcdir)/src/tools/wrappers/wrap.cc wrap_f90.cc
wrap_engine_f90.cc:
ln -s $(top_srcdir)/src/tools/wrappers/wrap_engine.cc wrap_engine_f90.cc
# Since this is C++ and we use templates (the STL), also ditch the # Since this is C++ and we use templates (the STL), also ditch the
# template repository directory # template repository directory
clean-local: clean-local:
test -z "$(OMPI_CXX_TEMPLATE_REPOSITORY)" || $(RM) -rf $(OMPI_CXX_TEMPLATE_REPOSITORY) test -z "$(OMPI_CXX_TEMPLATE_REPOSITORY)" || $(RM) -rf $(OMPI_CXX_TEMPLATE_REPOSITORY)
rm -f wrap_cc.cc wrap_engine_cc.cc
rm -f wrap_cxx.cc wrap_engine_cxx.cc
rm -f wrap_f77.cc wrap_engine_f77.cc
rm -f wrap_f90.cc wrap_engine_f90.cc
# Per bug 476, the "wipe" command is now "ompi_wipe". So that we don't
# break backwards compatability, we provide sym link names to the old
# names (i.e., ompi_wipe -> wipe). However, we provide a
# --disable-deprecated-executable-names option that will disable this
# behavior. Someday, we'll change the default and the option will
# become --enable-deprecated-executable-names.
if WANT_DEPRECATED_EXECUTABLE_NAMES if WANT_DEPRECATED_EXECUTABLE_NAMES
if CASE_SENSITIVE_FS if CASE_SENSITIVE_FS

20
src/tools/wrappers/help-wrapper.txt Обычный файл
Просмотреть файл

@ -0,0 +1,20 @@
# -*- text -*-
#
# $HEADER$
#
# This is the US/English help file for Open MPI wrapper compiler error
# messages.
#
[no-fortran-support]
Unfortunately, this installation of Open MPI was not compiled with
Fortran %d support. As such, the %s compiler is non-functional.
[no-profilig-support]
warning: "-lpmpi" was included on the command line indicating use of MPI
warning: profiling layer. However, Open MPI was not compiled with support
warning: for the MPI profiling layer; this flag has been ignored.
[no-compiler-found]
The Open MPI wrapper compiler was unable to find the specified compiler
%s in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.

Просмотреть файл

@ -1,6 +1,5 @@
// //
// $HEADER$ // $HEADER$
// Function: - wrapper for C program compilation
// //
#include "ompi_config.h" #include "ompi_config.h"
@ -12,17 +11,36 @@ main(int argc, char *argv[])
{ {
// The four wrapper compilers are extremely similar. So similar, // The four wrapper compilers are extremely similar. So similar,
// in fact, that they can be parameterized on what is different. // in fact, that they can be parameterized on what is different.
// Hence, we call the "wrapper compiler engine" to do all the work, // Hence, we call the "wrapper compiler engine" to do all the
// and pass in just a few arguments to customize for the language of // work, and pass in just a few arguments to customize for the
// this wrapper compiler. // language of this wrapper compiler.
ompi_sv_t str_vec; ompi_sv_t compiler;
ompi_sv_t cppflags;
ompi_sv_t cflags;
ompi_sv_t ldflags;
ompi_sv_t libs;
str_vec.clear(); compiler.clear();
str_vec.push_back("OMPI_MPICC"); compiler.push_back("OMPI_MPICC");
str_vec.push_back("OMPI_CC");
return ompi_wrap_engine(argc, argv, cppflags.clear();
str_vec, OMPI_CC, false, false, cppflags.push_back("OMPI_MPICC_CPPFLAGS");
WRAPPER_EXTRA_CFLAGS); cppflags.push_back("OMPI_CPPFLAGS");
cflags.clear();
cflags.push_back("OMPI_MPICC_CFLAGS");
cflags.push_back("OMPI_CFLAGS");
ldflags.clear();
ldflags.push_back("OMPI_MPICC_LDFLAGS");
ldflags.push_back("OMPI_LDFLAGS");
libs.clear();
libs.push_back("OMPI_MPICC_LIBS");
libs.push_back("OMPI_LIBS");
return ompi_wrap_engine(argc, argv, compiler, cppflags, cflags,
ldflags, libs, OMPI_CC, WRAPPER_EXTRA_CFLAGS,
false, false);
} }

Просмотреть файл

@ -1,6 +1,5 @@
// //
// $HEADER$ // $HEADER$
// Function: - wrapper for C++ program compilation
// //
#include "ompi_config.h" #include "ompi_config.h"
@ -12,17 +11,36 @@ main(int argc, char *argv[])
{ {
// The four wrapper compilers are extremely similar. So similar, // The four wrapper compilers are extremely similar. So similar,
// in fact, that they can be parameterized on what is different. // in fact, that they can be parameterized on what is different.
// Hence, we call the "wrapper compiler engine" to do all the work, // Hence, we call the "wrapper compiler engine" to do all the
// and pass in just a few arguments to customize for the language of // work, and pass in just a few arguments to customize for the
// this wrapper compiler. // language of this wrapper compiler.
ompi_sv_t str_vec; ompi_sv_t compiler;
ompi_sv_t cxxcppflags;
ompi_sv_t cxxflags;
ompi_sv_t ldflags;
ompi_sv_t libs;
str_vec.clear(); compiler.clear();
str_vec.push_back("OMPI_MPICXX"); compiler.push_back("OMPI_MPICXX");
str_vec.push_back("OMPI_CXX");
return ompi_wrap_engine(argc, argv, cxxcppflags.clear();
str_vec, OMPI_CXX,true, false, cxxcppflags.push_back("OMPI_MPICXX_CXXCPPFLAGS");
WRAPPER_EXTRA_CXXFLAGS); cxxcppflags.push_back("OMPI_CXXCPPFLAGS");
cxxflags.clear();
cxxflags.push_back("OMPI_MPICXX_CXXFLAGS");
cxxflags.push_back("OMPI_CXXFLAGS");
ldflags.clear();
ldflags.push_back("OMPI_MPICXX_LDFLAGS");
ldflags.push_back("OMPI_LDFLAGS");
libs.clear();
libs.push_back("OMPI_MPICXX_LIBS");
libs.push_back("OMPI_LIBS");
return ompi_wrap_engine(argc, argv, compiler, cxxcppflags, cxxflags,
ldflags, libs, OMPI_CXX,
WRAPPER_EXTRA_CXXFLAGS, true, false);
} }

Просмотреть файл

@ -1,39 +1,56 @@
// //
// $HEADER$ // $HEADER$
// Function: - wrapper for fortran program compilation
// //
#include "ompi_config.h" #include "ompi_config.h"
#include "util/show_help.h"
#include "tools/wrappers/ompi_wrap.h" #include "tools/wrappers/ompi_wrap.h"
#include <iostream> #include <iostream>
using namespace std; using namespace std;
int main(int argc, char *argv[]) int
main(int argc, char *argv[])
{ {
// The four wrapper compilers are extremely similar. So similar, // The four wrapper compilers are extremely similar. So similar,
// in fact, that they can be parameterized on what is different. // in fact, that they can be parameterized on what is different.
// Hence, we call the "wrapper compiler engine" to do all the work, // Hence, we call the "wrapper compiler engine" to do all the
// and pass in just a few arguments to customize for the language of // work, and pass in just a few arguments to customize for the
// this wrapper compiler. // language of this wrapper compiler.
#if !OMPI_WANT_F77_BINDINGS #if !OMPI_WANT_F77_BINDINGS
#if 0 ompi_show_help("help-wrapper.txt", "no-fortran-support", true,
show_help("hf77", "no-fortran-support", NULL); 77, "mpif77");
#endif
cerr << "Open MPI was not compiled with f77 support" << endl
<< "(waiting for show_help for a proper error message)" << endl;
return 1; return 1;
#else #else
ompi_sv_t str_vec; ompi_sv_t compiler;
ompi_sv_t fppflags;
ompi_sv_t fflags;
ompi_sv_t ldflags;
ompi_sv_t libs;
str_vec.clear(); compiler.clear();
str_vec.push_back("OMPI_MPIF77"); compiler.push_back("OMPI_MPIF77");
str_vec.push_back("OMPI_F77");
return ompi_wrap_engine(argc, argv, fppflags.clear();
str_vec, OMPI_F77, false, true, fppflags.push_back("OMPI_MPIF77_FPPFLAGS");
WRAPPER_EXTRA_FFLAGS); fppflags.push_back("OMPI_FPPFLAGS");
fflags.clear();
fflags.push_back("OMPI_MPIF77_FFLAGS");
fflags.push_back("OMPI_FFLAGS");
ldflags.clear();
ldflags.push_back("OMPI_MPIF77_LDFLAGS");
ldflags.push_back("OMPI_LDFLAGS");
libs.clear();
libs.push_back("OMPI_MPIF77_LIBS");
libs.push_back("OMPI_LIBS");
return ompi_wrap_engine(argc, argv, compiler, fppflags, fflags,
ldflags, libs, OMPI_F77, WRAPPER_EXTRA_FFLAGS,
false, true);
#endif #endif
} }

Просмотреть файл

@ -1,39 +1,56 @@
// //
// $HEADER$ // $HEADER$
// Function: - wrapper for fortran program compilation
// //
#include "ompi_config.h" #include "ompi_config.h"
#include "util/show_help.h"
#include "tools/wrappers/ompi_wrap.h" #include "tools/wrappers/ompi_wrap.h"
#include <iostream> #include <iostream>
using namespace std; using namespace std;
int main(int argc, char *argv[]) int
main(int argc, char *argv[])
{ {
// The four wrapper compilers are extremely similar. So similar, // The four wrapper compilers are extremely similar. So similar,
// in fact, that they can be parameterized on what is different. // in fact, that they can be parameterized on what is different.
// Hence, we call the "wrapper compiler engine" to do all the work, // Hence, we call the "wrapper compiler engine" to do all the
// and pass in just a few arguments to customize for the language of // work, and pass in just a few arguments to customize for the
// this wrapper compiler. // language of this wrapper compiler.
#if !OMPI_WANT_F90_BINDINGS #if !OMPI_WANT_F90_BINDINGS
#if 0 ompi_show_help("help-wrapper.txt", "no-fortran-support", true,
show_help("hf90", "no-fortran-support", NULL); 90, "mpif90");
#endif
cerr << "Open MPI was not compiled with f90 support" << endl
<< "(waiting for show_help for a proper error message)" << endl;
return 1; return 1;
#else #else
ompi_sv_t str_vec; ompi_sv_t compiler;
ompi_sv_t fcppflags;
ompi_sv_t fcflags;
ompi_sv_t ldflags;
ompi_sv_t libs;
str_vec.clear(); compiler.clear();
str_vec.push_back("OMPI_MPIF90"); compiler.push_back("OMPI_MPIF90");
str_vec.push_back("OMPI_F90");
return ompi_wrap_engine(argc, argv, fcppflags.clear();
str_vec, OMPI_F90, false, false, fcppflags.push_back("OMPI_MPIF90_FCPPFLAGS");
WRAPPER_EXTRA_FCFLAGS); fcppflags.push_back("OMPI_FCPPFLAGS");
fcflags.clear();
fcflags.push_back("OMPI_MPIF90_FCFLAGS");
fcflags.push_back("OMPI_FCFLAGS");
ldflags.clear();
ldflags.push_back("OMPI_MPIF90_LDFLAGS");
ldflags.push_back("OMPI_LDFLAGS");
libs.clear();
libs.push_back("OMPI_MPIF90_LIBS");
libs.push_back("OMPI_LIBS");
return ompi_wrap_engine(argc, argv, compiler, fcflags, fcflags,
ldflags, libs, OMPI_F90, WRAPPER_EXTRA_FCFLAGS,
false, true);
#endif #endif
} }

Просмотреть файл

@ -1,7 +1,13 @@
// //
// $HEADER$ // $HEADER$
// //
/** @file **/ /// @file
///
/// All of these types, global variables, and functions are internal
/// to the ompi_info program. There is probably noting here of value
/// outside of ompi_info.
///
#ifndef OMPI_WRAP_H #ifndef OMPI_WRAP_H
#define OMPI_WRAP_H 1 #define OMPI_WRAP_H 1
@ -10,66 +16,181 @@
#include <string> #include <string>
#include <vector> #include <vector>
// ///
// Commonly used type /// Commonly used type
// ///
typedef std::vector <std::string> ompi_sv_t;
typedef std::vector<std::string> ompi_sv_t;
// //
// Global variables // Global variables
// //
/// Whether we're showing the entire command or not
extern bool fl_libs;
extern bool fl_building;
extern bool fl_profile;
extern bool fl_cpp;
extern bool showme_cmd; extern bool showme_cmd;
/// Whether we're showing the compile command or not
extern bool showme_compile; extern bool showme_compile;
/// Whether we're showing the link command or not
extern bool showme_link; extern bool showme_link;
// ///
// Functions in the helper OMPI wrapper compiler library /// Functions in the helper OMPI wrapper compiler library;
// /// this is the granddaddy that will invoke the rest
///
/// \param argc argc from main()
/// \param argv argv from main()
/// \param compiler_env_var List of environment variables for the compiler
/// \param xppflags_env_var List of environment variables for
/// preprocessor flags
/// \param xflags_env_var List of environment variables for compiler flags
/// \param ldflags_env_var List of environment variables for linker flags
/// \param libs_env_var List of environment variables for linker flags
/// \param default_compiler The compiler chosen by configure
/// \param default_xflags Flags chosen by configure
/// \param want_cxx_libs Do we want to link in the C++ libraries?
/// \param want_f77_inclues Do we want to force the f77 includes?
///
int ompi_wrap_engine(int argc, char *argv[],
const ompi_sv_t & compiler_env_var,
const ompi_sv_t & xppflags_env_var,
const ompi_sv_t & xflags_env_var,
const ompi_sv_t & ldflags_env_var,
const ompi_sv_t & libs_env_var,
const std::string & default_compiler,
const std::string & default_xflags,
bool want_cxx_libs, bool want_f77_includes);
// This is the granddaddy that will invoke the rest ///
/// Parse the command line arguments of the wrapper compiler
///
/// \param argc Number of command line parameters
/// \param argv Vector containing command line parameters
/// \param want_flags True if extra flags are needed
///
void ompi_wrap_parse_args(int argc, char *argv[], bool & want_flags);
int ///
ompi_wrap_engine(int argc, char* argv[], /// Figure out what the back-end compiler is (even if it's multiple
const ompi_sv_t& env_vars, const std::string& default_compiler, /// tokens)
bool want_cxx_libs, bool want_f77_includes, ///
const std::string& extra_args); /// \param env_list List of environment variables passed by the user
/// \param default_comp Defaultl backend compiler
/// \param out Compiler to use (return value)
///
void ompi_wrap_get_compiler(const ompi_sv_t & env_list,
const std::string & default_comp, ompi_sv_t & out);
// Parse the command line and get some environment information ///
/// Build up a list of arguments for XPPFLAGS (CPPFLAGS, CXXCPPFLAGS
/// or FPPFFLAGS, depending on what the front-end wrapper compiler
/// is).
///
/// \param want_f77_includes If F77 includes are wanted
/// \param cflags Vector of strings containing the cflags (returned)
///
void ompi_wrap_build_xppflags(const ompi_sv_t & env_list,
bool want_f77_includes, ompi_sv_t & xppflags);
void ompi_wrap_parse_args(int argc, char* argv[], bool& want_flags); ///
/// Build of a list of XFLAGS (CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS) to
/// go to the back-end compiler. These are typically extra flags that
/// come from the configure script.
///
/// \param extra_string Extra flags to be passed to backend compiler
/// \param extra_flags Vector of strings to be pased to backend
/// compiler (return value)
///
void ompi_wrap_build_xflags(const ompi_sv_t & env_list,
const std::string & default_xflags,
ompi_sv_t & xflags);
// Build up various argument lists ///
/// Build up a list of user arguments (from argc/argv) that will be
/// plugged into the command line that will invoke the back-end
/// compiler.
///
/// \param argc Number of command line parameters
/// \param argv Vector containing the command line parameters
/// \param user_args List of user arguments that will be passed to
/// the back-end compiler (return value)
///
void ompi_wrap_build_user_args(int argc, char *argv[], ompi_sv_t & user_args);
void ompi_wrap_get_compiler(const ompi_sv_t& env_list, ///
const std::string& default_comp, ompi_sv_t& out); /// Build up a list of LDFLAGS that will be given to the back-end
void ompi_wrap_build_user_args(int argc, char* argv[], ompi_sv_t& user_args); /// compiler.
void ompi_wrap_build_cflags(bool want_f77_includes, ompi_sv_t& cflags); ///
void ompi_wrap_build_ldflags(ompi_sv_t& ldflags); /// \param ldflags Vector of strings comtaining the LDFLAGS
void ompi_wrap_build_libs(bool want_cxx_libs, ompi_sv_t& libs); ///
void ompi_wrap_build_extra_flags(const std::string& extra_string, void ompi_wrap_build_ldflags(const ompi_sv_t & env_list, ompi_sv_t & ldflags);
ompi_sv_t& extra_flags);
// Print or execute the file list of arguments ///
/// Build up a list of LIBS that will be given to the back-end
/// compiler.
///
/// \param want_cxx_libs Are we building mpiCC?
/// \param libs Vector of strings containing the libraries to be
/// linked to the backend compiler
///
void ompi_wrap_build_libs(const ompi_sv_t & env_list,
bool want_cxx_libs, ompi_sv_t & libs);
void ompi_wrap_print_sv(const ompi_sv_t& sv); ///
int ompi_wrap_exec_sv(const ompi_sv_t& sv); /// Print out a vector of strings
///
/// \param sv Vector of strings to be printed out
///
void ompi_wrap_print_sv(const ompi_sv_t & sv);
// Various helper functions ///
/// Execute a vector of strings (ultimately results down to a call to
/// some flavor of exec()).
///
/// \param sv Vector of strings to be exec()'ed
///
int ompi_wrap_exec_sv(const ompi_sv_t & sv);
///
/// Remove leading and trailing white space from a given string.
/// Must be sent a null-terminated string.
///
/// \param str String from which leading and trailing spaces should
/// be removed
///
void ompi_wrap_strip_white(std::string & str); void ompi_wrap_strip_white(std::string & str);
bool ompi_wrap_split(const std::string& str, char c,
ompi_sv_t& out); ///
void ompi_wrap_split_append_sv(const std::string& str, ompi_sv_t& out); /// Split a string into a vector of strings
void ompi_wrap_append_sv(const ompi_sv_t& in, ompi_sv_t& out); //
bool ompi_wrap_check_file(const std::string& dir, const std::string& file); /// \param str String which has to be split into a vector of strings
/// \param c Charecter which demarkates 2 strings
/// \param out Vector of strings (return value)
///
bool ompi_wrap_split(const std::string & str, char c, ompi_sv_t & out);
///
/// Take a string, split it into tokens, and append it to an existing
/// vector of strings
///
/// \param str String which is to be split into tokens
/// \param out Vector of strings to which the tokens are appended
///
void ompi_wrap_split_append_sv(const std::string & str, ompi_sv_t & out);
///
/// Append one vector of strings onto the end of another.
///
/// \param in Vector of strings to be appended
/// \param out Vector of strings to which "in" will be appended
///
void ompi_wrap_append_sv(const ompi_sv_t & in, ompi_sv_t & out);
///
/// Check for the presence of a file
///
/// \param dir Directory in which the file should be present
/// \param file Name of the file
///
bool ompi_wrap_check_file(const std::string & dir, const std::string & file);
#endif // OMPI_WRAP_H #endif // OMPI_WRAP_H

Просмотреть файл

@ -1,10 +1,7 @@
// //
// $HEADER$ // $HEADER$
// Function: - helper library for wrapper compilers
// //
/** @file **/
#include "ompi_config.h" #include "ompi_config.h"
#include <iostream> #include <iostream>
@ -20,10 +17,11 @@
#include <errno.h> #include <errno.h>
#include "util/path.h" #include "util/path.h"
#include "tools/wrappers/ompi_wrap.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/few.h" #include "util/few.h"
#include "util/path.h" #include "util/path.h"
#include "util/show_help.h"
#include "tools/wrappers/ompi_wrap.h"
extern char **environ; extern char **environ;
@ -50,17 +48,8 @@ bool showme_link(false);
static string cmd_name("<unknown>"); static string cmd_name("<unknown>");
///
/// \internal
///
/// Parse the command line arguments of the wrapper compiler
///
/// \param argc Number of command line parameters
/// \param argv Vector containing command line parameters
/// \param want_flags True if extra flags are needed
///
void void
ompi_wrap_parse_args(int argc, char* argv[], bool& want_flags) ompi_wrap_parse_args(int argc, char *argv[], bool & want_flags)
{ {
string str; string str;
bool have_arg; bool have_arg;
@ -73,8 +62,8 @@ ompi_wrap_parse_args(int argc, char* argv[], bool& want_flags)
want_flags = false; want_flags = false;
for (int i = 1; i < argc; ++i) { for (int i = 1; i < argc; ++i) {
str = argv[i]; str = argv[i];
if ("-showme" == str.substr(0, 7) || "--showme" == str.substr(0, 8) || if ("-showme" == str.substr(0, 7) || "--showme" == str.substr(0, 8)
"-show" == str || "--show" == str) { || "-show" == str || "--show" == str) {
want_flags = true; want_flags = true;
fl_want_show_error = true; fl_want_show_error = true;
if ("-showme:" == str.substr(0, 8)) { if ("-showme:" == str.substr(0, 8)) {
@ -111,46 +100,35 @@ ompi_wrap_parse_args(int argc, char* argv[], bool& want_flags)
fl_want_show_error = true; fl_want_show_error = true;
} }
} }
#if !OMPI_ENABLE_MPI_PROFILING #if !OMPI_ENABLE_MPI_PROFILING
// Sanity check // Sanity check
if (fl_profile) { if (fl_profile) {
#if 0 ompi_show_help("help-wrapper.txt", "no-profiling-support", true,
show_help("compile", "no-profiling-support", argv[0], NULL); argv[0], NULL);
#endif
fl_profile = false; fl_profile = false;
} }
#endif #endif
} }
///
/// \internal
///
/// Figure out what the back-end compiler is (even if it's multiple
/// tokens)
///
/// \param env_list List of environment variables passed by the user
/// \param default_comp Defaultl backend compiler
/// \param out Compiler to use (return value)
///
void void
ompi_wrap_get_compiler(const ompi_sv_t& env_list, const string& default_comp, ompi_wrap_get_compiler(const ompi_sv_t & env_list,
ompi_sv_t& out) const string & default_comp, ompi_sv_t & out)
{ {
int i;
char *env; char *env;
string comp; string comp;
string temp1, temp2; string temp1, temp2;
string::size_type pos; string::size_type i, pos;
string compiler0; string compiler0;
out.clear(); out.clear();
// Check for environment variable overrides // Check for environment variable overrides
for (i = 0; (string::size_type) i < env_list.size(); ++i) { for (i = 0; i < env_list.size(); ++i) {
env = getenv(env_list[i].c_str()); env = getenv(env_list[i].c_str());
if (0 != env) { if (NULL != env) {
comp = env; comp = env;
ompi_wrap_split(comp, ' ', out); ompi_wrap_split(comp, ' ', out);
break; break;
@ -162,7 +140,6 @@ ompi_wrap_get_compiler(const ompi_sv_t& env_list, const string& default_comp,
if (out.empty()) { if (out.empty()) {
ompi_wrap_split(default_comp, ' ', out); ompi_wrap_split(default_comp, ' ', out);
} }
// If we're preprocessing, we need to know the basename of argv0 // If we're preprocessing, we need to know the basename of argv0
// (see below). // (see below).
@ -175,7 +152,6 @@ ompi_wrap_get_compiler(const ompi_sv_t& env_list, const string& default_comp,
compiler0 = out[0]; compiler0 = out[0];
} }
} }
// Ugh. If we're acting as the preprocessor, ditch any libtool // Ugh. If we're acting as the preprocessor, ditch any libtool
// arguments. // arguments.
@ -186,8 +162,7 @@ ompi_wrap_get_compiler(const ompi_sv_t& env_list, const string& default_comp,
if ("libtool" == compiler0) { if ("libtool" == compiler0) {
i = 1; i = 1;
while ((string::size_type) i < out.size() && while (i < out.size() && "--" == out[i].substr(0, 2)) {
"--" == out[i].substr(0, 2)){
++i; ++i;
} }
out.erase(out.begin(), out.begin() + i); out.erase(out.begin(), out.begin() + i);
@ -196,22 +171,27 @@ ompi_wrap_get_compiler(const ompi_sv_t& env_list, const string& default_comp,
} }
///
/// \internal
///
/// Build up a list of arguments for CFLAGS (a bit of a misnomer,
/// because it may actually be CXXFLAGS or FFLAGS, depending on what
/// the front-end wrapper compiler is).
///
/// \param want_f77_includes If F77 includes are wanted
/// \param cflags Vector of strings containing the cflags (returned)
///
void void
ompi_wrap_build_cflags(bool want_f77_includes, ompi_sv_t& cflags) ompi_wrap_build_xppflags(const ompi_sv_t & env_list,
bool want_f77_includes, ompi_sv_t & xppflags)
{ {
string incdir(OMPI_INCDIR); string incdir(OMPI_INCDIR);
char *env;
string temp;
cflags.clear(); xppflags.clear();
// Check for environment variable overrides. If we find some, use
// them, regardless of the f77_include setting.
for (string::size_type i = 0; i < env_list.size(); ++i) {
env = getenv(env_list[i].c_str());
if (NULL != env) {
temp = env;
ompi_wrap_split(temp, ' ', xppflags);
return;
}
}
// Ensure that we don't -I/usr/include, for the reasons listed // Ensure that we don't -I/usr/include, for the reasons listed
// above. EXCEPTION: If this is fortran, then we add -I regardless // above. EXCEPTION: If this is fortran, then we add -I regardless
@ -219,11 +199,11 @@ ompi_wrap_build_cflags(bool want_f77_includes, ompi_sv_t& cflags)
// -I/usr/include automatically. // -I/usr/include automatically.
if (want_f77_includes || "/usr/include" != incdir) { if (want_f77_includes || "/usr/include" != incdir) {
cflags.push_back("-I" + incdir); xppflags.push_back("-I" + incdir);
} }
#if OMPI_WANT_CXX_BINDINGS #if OMPI_WANT_CXX_BINDINGS
cflags.push_back("-I" + incdir + "/openmpi"); xppflags.push_back("-I" + incdir + "/openmpi");
#endif #endif
#if defined(WIN32) && WIN32 #if defined(WIN32) && WIN32
@ -232,20 +212,33 @@ ompi_wrap_build_cflags(bool want_f77_includes, ompi_sv_t& cflags)
} }
///
/// \internal
///
/// Build up a list of user arguments (from argc/argv) that will be
/// plugged into the command line that will invoke the back-end
/// compiler.
///
/// \param argc Number of command line parameters
/// \param argv Vector containing the command line parameters
/// \param user_args List of user arguments that will be passed to
/// the back-end compiler (return value)
///
void void
ompi_wrap_build_user_args(int argc, char* argv[], ompi_sv_t& user_args) ompi_wrap_build_xflags(const ompi_sv_t & env_list,
const string & default_xflags, ompi_sv_t & xflags)
{
char *env;
string temp;
// Check for environment variable overrides. If we find some, use
// them, regardless of the f77_include setting.
for (string::size_type i = 0; i < env_list.size(); ++i) {
env = getenv(env_list[i].c_str());
if (NULL != env) {
temp = env;
ompi_wrap_split(temp, ' ', xflags);
return;
}
}
if (!default_xflags.empty()) {
ompi_wrap_split_append_sv(default_xflags, xflags);
}
}
void
ompi_wrap_build_user_args(int argc, char *argv[], ompi_sv_t & user_args)
{ {
string str; string str;
@ -256,27 +249,19 @@ ompi_wrap_build_user_args(int argc, char* argv[], ompi_sv_t& user_args)
str = argv[i]; str = argv[i];
if ("-showme" != str.substr(0, 7) && if ("-showme" != str.substr(0, 7) &&
"--showme" != str.substr(0, 8) && "--showme" != str.substr(0, 8) &&
"-show" != str && "-show" != str && "--show" != str && "-lpmpi" != str) {
"--show" != str &&
"-lpmpi" != str){
user_args.push_back(str); user_args.push_back(str);
} }
} }
} }
///
/// \internal
///
/// Build up a list of LDFLAGS that will be given to the back-end
/// compiler.
///
/// \param ldflags Vector of strings comtaining the LDFLAGS
///
void void
ompi_wrap_build_ldflags(ompi_sv_t& ldflags) ompi_wrap_build_ldflags(const ompi_sv_t & env_list, ompi_sv_t & ldflags)
{ {
char *env;
string s; string s;
string temp;
string libdir(OMPI_LIBDIR); string libdir(OMPI_LIBDIR);
ompi_sv_t sv; ompi_sv_t sv;
ompi_sv_t::iterator svi; ompi_sv_t::iterator svi;
@ -289,6 +274,16 @@ ompi_wrap_build_ldflags(ompi_sv_t& ldflags)
if (!fl_libs) { if (!fl_libs) {
return; return;
} }
// Check for environment variable overrides
for (string::size_type i = 0; i < env_list.size(); ++i) {
env = getenv(env_list[i].c_str());
if (NULL != env) {
temp = env;
ompi_wrap_split(temp, ' ', ldflags);
return;
}
}
// Add in the extra flags passed by configure. Do the same kinds of // Add in the extra flags passed by configure. Do the same kinds of
// checks that we do below -- ensure that we don't add a "-L/usr" to // checks that we do below -- ensure that we don't add a "-L/usr" to
@ -297,14 +292,13 @@ ompi_wrap_build_ldflags(ompi_sv_t& ldflags)
s = WRAPPER_EXTRA_LDFLAGS; s = WRAPPER_EXTRA_LDFLAGS;
ompi_wrap_split(s, ' ', sv); ompi_wrap_split(s, ' ', sv);
if (!sv.empty()){ if (!sv.empty()) {
for (svi = sv.begin(); svi != sv.end(); ++svi) { for (svi = sv.begin(); svi != sv.end(); ++svi) {
if ("-L/usr" != *svi){ if ("-L/usr" != *svi) {
ompi_wrap_split_append_sv(*svi, ldflags); ompi_wrap_split_append_sv(*svi, ldflags);
} }
} }
} }
// Form library directory pathname. // Form library directory pathname.
// //
// Add "-L$prefix/lib". // Add "-L$prefix/lib".
@ -313,59 +307,40 @@ ompi_wrap_build_ldflags(ompi_sv_t& ldflags)
// /usr/lib, there's no need to explicitly add it, because the // /usr/lib, there's no need to explicitly add it, because the
// compiler will already be looking there. // compiler will already be looking there.
if ("/usr/lib" != libdir){ if ("/usr/lib" != libdir) {
ldflags.push_back("-L" + libdir); ldflags.push_back("-L" + libdir);
} }
} }
///
/// \internal
///
/// Build up a list of LIBS that will be given to the back-end
/// compiler.
///
/// \param want_cxx_libs Are we building mpiCC?
/// \param libs Vector of strings containing the libraries to be
/// linked to the backend compiler
void void
ompi_wrap_build_libs(bool want_cxx_libs, ompi_sv_t& libs) ompi_wrap_build_libs(const ompi_sv_t & env_list,
bool want_cxx_libs, ompi_sv_t & libs)
{ {
char *env;
string temp;
string libdir(OMPI_LIBDIR); string libdir(OMPI_LIBDIR);
#if 0
#if OMPI_WANT_ROMIO && HAVE_LIBAIO
bool want_aio(false);
#endif
#endif
libs.clear(); libs.clear();
// If we don't want the libs, then return with libs empty // If we don't want the libs, then return with libs empty
if (!fl_libs){ if (!fl_libs) {
return; return;
} }
// Check for environment variable overrides
for (string::size_type i = 0; i < env_list.size(); ++i) {
env = getenv(env_list[i].c_str());
if (NULL != env) {
temp = env;
ompi_wrap_split(temp, ' ', libs);
return;
}
}
// Now we start adding libraries to libs // Now we start adding libraries to libs
// ROMIO comes first. Check to ensure that it exists (and that the
// profiling library was previously found).
#if 0
#if OMPI_WANT_ROMIO
if (!ompi_wrap_check_file(libdir, "libompi_mpio.a") &&
!ompi_wrap_check_file(libdir, "libompi_mpio.so")) {
cerr << "WARNING: " << cmd_name
<< " expected to find libompi_mpio.* in " << libdir << endl
<< "WARNING: MPI-2 IO support will be disabled" << endl;
} else {
libs.push_back("-lompi_mpio");
#if HAVE_LIBAIO
want_aio = true;
#endif
}
#endif
#endif
#if OMPI_WANT_CXX_BINDINGS #if OMPI_WANT_CXX_BINDINGS
// The C++ bindings come next // The C++ bindings come next
if (want_cxx_libs) { if (want_cxx_libs) {
@ -381,93 +356,37 @@ ompi_wrap_build_libs(bool want_cxx_libs, ompi_sv_t& libs)
} }
#endif #endif
// Next comes the fortran MPI library
#if 0
#if BUILD_MPI_F77
if (!ompi_wrap_check_file(libdir, "libompif77mpi.a") &&
!ompi_wrap_check_file(libdir, "libompif77mpi.so")) {
cerr << "WARNING: " << cmd_name
<< " expected to find libompif77mpi.* in " << libdir << endl
<< "WARNING: MPI Fortran support will be disabled" << endl;
} else {
libs.push_back("-lompif77mpi");
}
#endif
#endif
// Next comes the MPI library // Next comes the MPI library
libs.push_back("-lmpi"); libs.push_back("-lmpi");
// Finally, any system libraries
#if 0
#if OMPI_WANT_ROMIO && HAVE_LIBAIO
if (want_aio) {
libs.push_back("-laio");
}
#endif
#endif
ompi_wrap_split_append_sv(WRAPPER_EXTRA_LIBS, libs); ompi_wrap_split_append_sv(WRAPPER_EXTRA_LIBS, libs);
} }
///
/// \internal
///
/// Build of a list of extra flags to go to the back-end compiler.
/// These are typically extra flags that come from the configure
/// script.
///
/// \param extra_string Extra flags to be passed to backend compiler
/// \param extra_flags Vector of strings to be pased to backend
/// compiler (return value)
///
void void
ompi_wrap_build_extra_flags(const string& extra_string, ompi_sv_t& extra_flags) ompi_wrap_print_sv(const ompi_sv_t & sv)
{ {
if (!extra_string.empty()) { for (string::size_type i = 0; i < sv.size(); ++i) {
ompi_wrap_split_append_sv(extra_string, extra_flags);
}
}
///
/// \internal
///
/// Print out a vector of strings
///
/// \param sv Vector of strings to be printed out
///
void
ompi_wrap_print_sv(const ompi_sv_t& sv)
{
for (int i = 0; (string::size_type) i < sv.size(); ++i) {
cout << sv[i] << " "; cout << sv[i] << " ";
} }
} }
///
/// \internal
///
/// Execute a vector of strings (ultimately results down to a call to
/// some flavor of exec()).
///
/// \param sv Vector of strings to be exec()'ed
///
int int
ompi_wrap_exec_sv(const ompi_sv_t& sv) ompi_wrap_exec_sv(const ompi_sv_t & sv)
{ {
int status; int status;
int ret; int ret;
int i, ac = 0; int ac = 0;
char **av = 0; char **av = 0;
char *tmp = NULL; char *tmp = NULL;
string::size_type i;
// Build up a C array of the args // Build up a C array of the args
for (i = 0; (string::size_type) i < sv.size(); ++i) { for (i = 0; i < sv.size(); ++i) {
ompi_argv_append(&ac, &av, (char*) sv[i].c_str()); ompi_argv_append(&ac, &av, (char *) sv[i].c_str());
} }
// There is no way to tell whether ompi_few returned non-zero because // There is no way to tell whether ompi_few returned non-zero because
@ -476,9 +395,8 @@ ompi_wrap_exec_sv(const ompi_sv_t& sv)
// compiler first, just to try to eliminate that case. // compiler first, just to try to eliminate that case.
tmp = ompi_path_env_findv(av[0], 0, environ, NULL); tmp = ompi_path_env_findv(av[0], 0, environ, NULL);
if (NULL == tmp) { if (NULL == tmp) {
#if 0 ompi_show_help("help-wrapper.txt", "no-compiler-found", true,
show_help("compile", "no-compiler-found", av[0], NULL); av[0], NULL);
#endif
errno = 0; errno = 0;
status = -1; status = -1;
} else { } else {
@ -500,31 +418,22 @@ ompi_wrap_exec_sv(const ompi_sv_t& sv)
} }
///
/// \internal
///
/// Remove leading and trailing white space from a given string.
/// Must be sent a null-terminated string.
///
/// \param str String from which leading and trailing spaces should
/// be removed
///
void void
ompi_wrap_strip_white(string& str) ompi_wrap_strip_white(string & str)
{ {
int start, end, size(str.size()); int start, end, size(str.size());
/* Remove leading whitespace */ /* Remove leading whitespace */
for (start = 0; start < size; ++start){ for (start = 0; start < size; ++start) {
if (!isspace(str[start])){ if (!isspace(str[start])) {
break; break;
} }
} }
/* Remove trailing whitespace */ /* Remove trailing whitespace */
for (end = start; end < size; ++end){ for (end = start; end < size; ++end) {
if (isspace(str[end])) { if (isspace(str[end])) {
break; break;
} }
@ -534,40 +443,30 @@ ompi_wrap_strip_white(string& str)
} }
///
/// \internal
///
/// Split a string into a vector of strings
//
/// \param str String which has to be split into a vector of strings
/// \param c Charecter which demarkates 2 strings
/// \param out Vector of strings (return value)
///
bool bool
ompi_wrap_split(const string& str, char c, ompi_sv_t& out) ompi_wrap_split(const string & str, char c, ompi_sv_t & out)
{ {
int start, i(0), size(str.size()); int start, i(0), size(str.size());
out.clear(); out.clear();
// Strip off the first bunch of c's // Strip off the first bunch of c's
while (i < size && str[i] == c){ while (i < size && str[i] == c) {
++i; ++i;
} }
if (i >= size){ if (i >= size) {
return false; return false;
} }
// Now start making a vector of the strings // Now start making a vector of the strings
while (i < size) { while (i < size) {
start = i; start = i;
while (i < size && str[i] != c){ while (i < size && str[i] != c) {
++i; ++i;
} }
out.push_back(str.substr(start, i - start)); out.push_back(str.substr(start, i - start));
while (i < size && str[i] == c){ while (i < size && str[i] == c) {
++i; ++i;
} }
} }
@ -576,56 +475,30 @@ ompi_wrap_split(const string& str, char c, ompi_sv_t& out)
} }
///
/// \internal
///
/// Take a string, split it into tokens, and append it to an existing
/// vector of strings
///
/// \param str String which is to be split into tokens
/// \param out Vector of strings to which the tokens are appended
///
void void
ompi_wrap_split_append_sv(const string& str, ompi_sv_t& out) ompi_wrap_split_append_sv(const string & str, ompi_sv_t & out)
{ {
int i;
ompi_sv_t temp; ompi_sv_t temp;
ompi_wrap_split(str, ' ', temp); ompi_wrap_split(str, ' ', temp);
for (i = 0; (string::size_type) i < temp.size(); ++i){ for (string::size_type i = 0; i < temp.size(); ++i) {
out.push_back(temp[i]); out.push_back(temp[i]);
} }
} }
///
/// \internal
///
/// Append one vector of strings onto the end of another.
///
/// \param in Vector of strings to be appended
/// \param out Vector of strings to which "in" will be appended
///
void void
ompi_wrap_append_sv(const ompi_sv_t& in, ompi_sv_t& out) ompi_wrap_append_sv(const ompi_sv_t & in, ompi_sv_t & out)
{ {
// JMS Is there a better way to do this? // JMS Is there a better way to do this?
for (int i = 0; (string::size_type) i < in.size(); ++i){ for (string::size_type i = 0; i < in.size(); ++i) {
out.push_back(in[i]); out.push_back(in[i]);
} }
} }
///
/// \internal
///
/// Check for the presence of a file
///
/// \param dir Directory in which the file should be present
/// \param file Name of the file
///
bool bool
ompi_wrap_check_file(const string& dir, const string& file) ompi_wrap_check_file(const string & dir, const string & file)
{ {
int ret; int ret;
struct stat buf; struct stat buf;

Просмотреть файл

@ -20,11 +20,25 @@ using namespace std;
/// \param want_f77_includes Whether F77 include path should be added /// \param want_f77_includes Whether F77 include path should be added
/// \param extra_args Extra arguments which need to be added /// \param extra_args Extra arguments which need to be added
/// ///
/// At most, we end up with a command line in the following form:
///
/// [compiler(*)] [Xppflags(*)] [Xflags(*)] [user args] [ldflags(*)] [libs(*)]
///
/// Items with (*) can be overridden at run time with environment variables.
///
/// X can be replaced with C, CXX, F, and FC for C, C++, Fortran 77,
/// and Fortran 90, respectively.
///
int int
ompi_wrap_engine(int argc, char* argv[], ompi_wrap_engine(int argc, char *argv[],
const ompi_sv_t& env_vars, const string& default_compiler, const ompi_sv_t & compiler_env_var,
bool want_cxx_libs, bool want_f77_includes, const ompi_sv_t & xppflags_env_var,
const string& extra_args) const ompi_sv_t & xflags_env_var,
const ompi_sv_t & ldflags_env_var,
const ompi_sv_t & libs_env_var,
const std::string & default_compiler,
const std::string & default_xflags,
bool want_cxx_libs, bool want_f77_includes)
{ {
int ret(0); int ret(0);
@ -33,7 +47,8 @@ ompi_wrap_engine(int argc, char* argv[],
ompi_sv_t str_vec; ompi_sv_t str_vec;
ompi_sv_t compiler; ompi_sv_t compiler;
ompi_sv_t cflags; ompi_sv_t xppflags;
ompi_sv_t xflags;
ompi_sv_t user_args; ompi_sv_t user_args;
ompi_sv_t ldflags; ompi_sv_t ldflags;
ompi_sv_t libs; ompi_sv_t libs;
@ -47,49 +62,50 @@ ompi_wrap_engine(int argc, char* argv[],
// Get the compiler // Get the compiler
ompi_wrap_get_compiler(env_vars, default_compiler, compiler); ompi_wrap_get_compiler(compiler_env_var, default_compiler, compiler);
// Build the CFLAGS // Build the XPPFLAGS (-I stuff only)
ompi_wrap_build_cflags(want_f77_includes, cflags); ompi_wrap_build_xppflags(xppflags_env_var, want_f77_includes,
xppflags);
// Build any XFLAGS
ompi_wrap_build_xflags(xflags_env_var, default_xflags, xflags);
// Build the user arguments // Build the user arguments
ompi_wrap_build_user_args(argc, argv, user_args); ompi_wrap_build_user_args(argc, argv, user_args);
// Build the LDFLAGS // Build the LDFLAGS (-L stuff and WRAPPER_EXTRA_LDFLAGS)
ompi_wrap_build_ldflags(ldflags); ompi_wrap_build_ldflags(ldflags_env_var, ldflags);
// Build the LIBS // Build the LIBS (-l stuff and WRAPPER_EXTRA_LIBS)
ompi_wrap_build_libs(want_cxx_libs, libs); ompi_wrap_build_libs(libs_env_var, want_cxx_libs, libs);
// Build any extra arguments
ompi_wrap_build_extra_flags(extra_args, extra_flags);
// Now assemble the command line // Now assemble the command line
cmd_line.clear(); cmd_line.clear();
ompi_wrap_append_sv(compiler, cmd_line); ompi_wrap_append_sv(compiler, cmd_line);
if (want_flags) { if (want_flags) {
ompi_wrap_append_sv(cflags, cmd_line); ompi_wrap_append_sv(xppflags, cmd_line);
ompi_wrap_append_sv(extra_flags, cmd_line); ompi_wrap_append_sv(xflags, cmd_line);
} }
ompi_wrap_append_sv(user_args, cmd_line); ompi_wrap_append_sv(user_args, cmd_line);
if (want_flags) { if (want_flags) {
ompi_wrap_append_sv(ldflags, cmd_line); ompi_wrap_append_sv(ldflags, cmd_line);
ompi_wrap_append_sv(libs, cmd_line); ompi_wrap_append_sv(libs, cmd_line);
} }
// Display or execute? // Display or execute?
if (showme_cmd) if (showme_cmd) {
ompi_wrap_print_sv(compiler); ompi_wrap_print_sv(compiler);
}
if (showme_cmd || showme_compile) { if (showme_cmd || showme_compile) {
ompi_wrap_print_sv(cflags); ompi_wrap_print_sv(xppflags);
ompi_wrap_print_sv(extra_flags); ompi_wrap_print_sv(xflags);
} }
if (showme_cmd || showme_compile || showme_link) if (showme_cmd || showme_compile || showme_link)
ompi_wrap_print_sv(user_args); ompi_wrap_print_sv(user_args);
@ -97,10 +113,11 @@ ompi_wrap_engine(int argc, char* argv[],
ompi_wrap_print_sv(ldflags); ompi_wrap_print_sv(ldflags);
ompi_wrap_print_sv(libs); ompi_wrap_print_sv(libs);
} }
if (showme_cmd || showme_compile || showme_link) if (showme_cmd || showme_compile || showme_link) {
cout << endl; cout << endl;
else } else {
ret = ompi_wrap_exec_sv(cmd_line); ret = ompi_wrap_exec_sv(cmd_line);
}
// That's all she wrote // That's all she wrote