diff --git a/ompi/config/ompi_setup_wrappers.m4 b/ompi/config/ompi_setup_wrappers.m4 index 8c202d0708..be530ef06b 100644 --- a/ompi/config/ompi_setup_wrappers.m4 +++ b/ompi/config/ompi_setup_wrappers.m4 @@ -10,8 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. -dnl Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. -dnl Use is subject to license terms. +dnl Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl @@ -31,9 +30,13 @@ dnl # unexpected behavior for the user in the past. AC_DEFUN([OMPI_SETUP_WRAPPER_INIT],[ WRAPPER_EXTRA_FFLAGS= + WRAPPER_EXTRA_FFLAGS_PREFIX= WRAPPER_EXTRA_FCFLAGS= + WRAPPER_EXTRA_FCFLAGS_PREFIX= USER_WRAPPER_EXTRA_FFLAGS= + USER_WRAPPER_EXTRA_FFLAGS_PREFIX= USER_WRAPPER_EXTRA_FCFLAGS= + USER_WRAPPER_EXTRA_FCLAGS_PREFIX= AC_ARG_WITH([wrapper-fflags], [AC_HELP_STRING([--with-wrapper-fflags], @@ -44,6 +47,15 @@ AC_DEFUN([OMPI_SETUP_WRAPPER_INIT],[ USER_WRAPPER_EXTRA_FFLAGS="$with_wrapper_fflags" fi + AC_ARG_WITH([wrapper-fflags-prefix], + [AC_HELP_STRING([--with-wrapper-fflags-prefix], + [Extra flags (before user flags) to add to FFLAGS when using mpif77])]) + if test "$with_wrapper_fflags_prefix" = "yes" -o "$with_wrapper_fflags_prefix" = "no"; then + AC_MSG_ERROR([--with-wrapper-fflags-prefix must have an argument. Aborting]) + elif test ! -z "$with_wrapper_fflags_prefix" ; then + USER_WRAPPER_EXTRA_FFLAGS_PREFIX="$with_wrapper_fflags_prefix" + fi + AC_ARG_WITH([wrapper-fcflags], [AC_HELP_STRING([--with-wrapper-fcflags], [Extra flags to add to FCFLAGS when using mpif90])]) @@ -52,6 +64,16 @@ AC_DEFUN([OMPI_SETUP_WRAPPER_INIT],[ elif test ! -z "$with_wrapper_fcflags" ; then USER_WRAPPER_EXTRA_FCFLAGS="$with_wrapper_fcflags" fi + + AC_ARG_WITH([wrapper-fcflags-prefix], + [AC_HELP_STRING([--with-wrapper-fcflags-prefix], + [Extra flags (before user flags) to add to FCFLAGS when using mpif90])]) + if test "$with_wrapper_fcflags_prefix" = "yes" -o "$with_wrapper_fcflags_prefix" = "no"; then + AC_MSG_ERROR([--with-wrapper-fcflags-prefix must have an argument. Aborting]) + elif test ! -z "$with_wrapper_fcflags_prefix" ; then + USER_WRAPPER_EXTRA_FCFLAGS_PREFIX="$with_wrapper_fcflags_prefix" + fi + ]) AC_DEFUN([_OMPI_SETUP_ORTE_WRAPPERS],[ @@ -65,21 +87,41 @@ AC_DEFUN([_OMPI_SETUP_ORTE_WRAPPERS],[ AC_SUBST([OMPI_WRAPPER_EXTRA_CFLAGS]) AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_CFLAGS]) + AC_MSG_CHECKING([for OMPI CFLAGS_PREFIX]) + OMPI_WRAPPER_EXTRA_CFLAGS_PREFIX="$ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX" + AC_SUBST([OMPI_WRAPPER_EXTRA_CFLAGS_PREFIX]) + AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_CFLAGS_PREFIX]) + AC_MSG_CHECKING([for OMPI CXXFLAGS]) OMPI_WRAPPER_EXTRA_CXXFLAGS="$ORTE_WRAPPER_EXTRA_CXXFLAGS" AC_SUBST([OMPI_WRAPPER_EXTRA_CXXFLAGS]) AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_CXXFLAGS]) + AC_MSG_CHECKING([for OMPI CXXFLAGS_PREFIX]) + OMPI_WRAPPER_EXTRA_CXXFLAGS_PREFIX="$ORTE_WRAPPER_EXTRA_CXXFLAGS_PREFIX" + AC_SUBST([OMPI_WRAPPER_EXTRA_CXXFLAGS_PREFIX]) + AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_CXXFLAGS_PREFIX]) + AC_MSG_CHECKING([for OMPI FFLAGS]) OMPI_WRAPPER_EXTRA_FFLAGS="$WRAPPER_EXTRA_FFLAGS $USER_WRAPPER_EXTRA_FFLAGS" AC_SUBST([OMPI_WRAPPER_EXTRA_FFLAGS]) AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_FFLAGS]) + AC_MSG_CHECKING([for OMPI FFLAGS_PREFIX]) + OMPI_WRAPPER_EXTRA_FFLAGS_PREFIX="$WRAPPER_EXTRA_FFLAGS_PREFIX $USER_WRAPPER_EXTRA_FFLAGS_PREFIX" + AC_SUBST([OMPI_WRAPPER_EXTRA_FFLAGS_PREFIX]) + AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_FFLAGS_PREFIX]) + AC_MSG_CHECKING([for OMPI FCFLAGS]) OMPI_WRAPPER_EXTRA_FCFLAGS="$WRAPPER_EXTRA_FCFLAGS $USER_WRAPPER_EXTRA_FCFLAGS" AC_SUBST([OMPI_WRAPPER_EXTRA_FCFLAGS]) AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_FCFLAGS]) + AC_MSG_CHECKING([for OMPI FCFLAGS_PREFIX]) + OMPI_WRAPPER_EXTRA_FCFLAGS_PREFIX="$WRAPPER_EXTRA_FCFLAGS_PREFIX $USER_WRAPPER_EXTRA_FCFLAGS_PREFIX" + AC_SUBST([OMPI_WRAPPER_EXTRA_FCFLAGS_PREFIX]) + AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_FCFLAGS_PREFIX]) + AC_MSG_CHECKING([for OMPI LDFLAGS]) OMPI_WRAPPER_EXTRA_LDFLAGS="$ompi_WRAPPER_EXTRA_LDFLAGS $ORTE_WRAPPER_EXTRA_LDFLAGS" AC_SUBST([OMPI_WRAPPER_EXTRA_LDFLAGS]) @@ -107,21 +149,41 @@ AC_DEFUN([_OMPI_SETUP_OPAL_WRAPPERS],[ AC_SUBST([OMPI_WRAPPER_EXTRA_CFLAGS]) AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_CFLAGS]) + AC_MSG_CHECKING([for OMPI CFLAGS_PREFIX]) + OMPI_WRAPPER_EXTRA_CFLAGS_PREFIX="$OPAL_WRAPPER_EXTRA_CFLAGS_PREFIX" + AC_SUBST([OMPI_WRAPPER_EXTRA_CFLAGS_PREFIX]) + AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_CFLAGS_PREFIX]) + AC_MSG_CHECKING([for OMPI CXXFLAGS]) OMPI_WRAPPER_EXTRA_CXXFLAGS="$OPAL_WRAPPER_EXTRA_CXXFLAGS" AC_SUBST([OMPI_WRAPPER_EXTRA_CXXFLAGS]) AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_CXXFLAGS]) + AC_MSG_CHECKING([for OMPI CXXFLAGS_PREFIX]) + OMPI_WRAPPER_EXTRA_CXXFLAGS_PREFIX="$OPAL_WRAPPER_EXTRA_CXXFLAGS_PREFIX" + AC_SUBST([OMPI_WRAPPER_EXTRA_CXXFLAGS_PREFIX]) + AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_CXXFLAGS]) + AC_MSG_CHECKING([for OMPI FFLAGS]) OMPI_WRAPPER_EXTRA_FFLAGS="$WRAPPER_EXTRA_FFLAGS $USER_WRAPPER_EXTRA_FFLAGS" AC_SUBST([OMPI_WRAPPER_EXTRA_FFLAGS]) AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_FFLAGS]) + AC_MSG_CHECKING([for OMPI FFLAGS_PREFIX]) + OMPI_WRAPPER_EXTRA_FFLAGS_PREFIX="$WRAPPER_EXTRA_FFLAGS_PREFIX $USER_WRAPPER_EXTRA_FFLAGS_PREFIX" + AC_SUBST([OMPI_WRAPPER_EXTRA_FFLAGS_PREFIX]) + AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_FFLAGS_PREFIX]) + AC_MSG_CHECKING([for OMPI FCFLAGS]) OMPI_WRAPPER_EXTRA_FCFLAGS="$WRAPPER_EXTRA_FCFLAGS $USER_WRAPPER_EXTRA_FCFLAGS" AC_SUBST([OMPI_WRAPPER_EXTRA_FCFLAGS]) AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_FCFLAGS]) + AC_MSG_CHECKING([for OMPI FCFLAGS_PREFIX]) + OMPI_WRAPPER_EXTRA_FCFLAGS_PREFIX="$WRAPPER_EXTRA_FCFLAGS_PREFIX $USER_WRAPPER_EXTRA_FCFLAGS_PREFIX" + AC_SUBST([OMPI_WRAPPER_EXTRA_FCFLAGS_PREFIX]) + AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_FCFLAGS_PREFIX]) + AC_MSG_CHECKING([for OMPI LDFLAGS]) OMPI_WRAPPER_EXTRA_LDFLAGS="$ompi_WRAPPER_EXTRA_LDFLAGS $OPAL_WRAPPER_EXTRA_LDFLAGS" AC_SUBST([OMPI_WRAPPER_EXTRA_LDFLAGS]) @@ -140,7 +202,9 @@ AC_DEFUN([_OMPI_SETUP_OPAL_WRAPPERS],[ AC_DEFUN([OMPI_SETUP_WRAPPER_FINAL],[ OMPI_UNIQ([WRAPPER_EXTRA_FFLAGS]) + OMPI_UNIQ([WRAPPER_EXTRA_FFLAGS_PREFIX]) OMPI_UNIQ([WRAPPER_EXTRA_FCFLAGS]) + OMPI_UNIQ([WRAPPER_EXTRA_FCFLAGS_PREFIX]) OMPI_UNIQ([ompi_WRAPPER_EXTRA_LDFLAGS]) OMPI_UNIQ([ompi_WRAPPER_EXTRA_LIBS]) @@ -190,14 +254,23 @@ AC_DEFUN([OMPI_SETUP_WRAPPER_FINAL],[ # compatibility defines that will eventually go away WRAPPER_EXTRA_FFLAGS="$OMPI_WRAPPER_EXTRA_FFLAGS" + WRAPPER_EXTRA_FFLAGS_PREFIX="$OMPI_WRAPPER_EXTRA_FFLAGS_PREFIX" WRAPPER_EXTRA_FCFLAGS="$OMPI_WRAPPER_EXTRA_FCFLAGS" + WRAPPER_EXTRA_FCFLAGS_PREFIX="$OMPI_WRAPPER_EXTRA_FCFLAGS_PREFIX" AC_SUBST([WRAPPER_EXTRA_FFLAGS]) + AC_SUBST([WRAPPER_EXTRA_FFLAGS_PREFIX]) AC_SUBST([WRAPPER_EXTRA_FCFLAGS]) + AC_SUBST([WRAPPER_EXTRA_FCFLAGS_PREFIX]) AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_FFLAGS, "$WRAPPER_EXTRA_FFLAGS", [Additional FFLAGS to pass through the wrapper compilers]) + AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_FFLAGS_PREFIX, "$WRAPPER_EXTRA_FFLAGS_PREFIX", + [Additional FFLAGS to pass through the wrapper compilers]) AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_FCFLAGS, "$WRAPPER_EXTRA_FCFLAGS", [Additional FCFLAGS to pass through the wrapper compilers]) + AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_FCFLAGS_PREFIX, "$WRAPPER_EXTRA_FCFLAGS_PREFIX", + [Additional FCFLAGS to pass through the wrapper compilers]) + # if wrapper compilers were requested, set the ompi one up if test "$WANT_SCRIPT_WRAPPER_COMPILERS" = "1" ; then diff --git a/ompi/tools/wrappers/mpic++-wrapper-data.txt.in b/ompi/tools/wrappers/mpic++-wrapper-data.txt.in index 0360848c3d..279c8b484f 100644 --- a/ompi/tools/wrappers/mpic++-wrapper-data.txt.in +++ b/ompi/tools/wrappers/mpic++-wrapper-data.txt.in @@ -14,6 +14,7 @@ compiler_flags_env=CXXFLAGS compiler=@CXX@ extra_includes=@OMPI_WRAPPER_EXTRA_INCLUDES@ preprocessor_flags=@OMPI_WRAPPER_EXTRA_CPPFLAGS@ +compiler_flags_prefix=@OMPI_WRAPPER_EXTRA_CXXFLAGS_PREFIX@ compiler_flags=@OMPI_WRAPPER_EXTRA_CXXFLAGS@ linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@ libs=@OMPI_WRAPPER_CXX_LIB@ -lmpi @OMPI_WRAPPER_EXTRA_LIBS@ diff --git a/ompi/tools/wrappers/mpicc-wrapper-data.txt.in b/ompi/tools/wrappers/mpicc-wrapper-data.txt.in index 7e50f46643..78b74c29fb 100644 --- a/ompi/tools/wrappers/mpicc-wrapper-data.txt.in +++ b/ompi/tools/wrappers/mpicc-wrapper-data.txt.in @@ -14,6 +14,7 @@ compiler_flags_env=CFLAGS compiler=@CC@ extra_includes=@OMPI_WRAPPER_EXTRA_INCLUDES@ preprocessor_flags=@OMPI_WRAPPER_EXTRA_CPPFLAGS@ +compiler_flags_prefix=@OMPI_WRAPPER_EXTRA_CFLAGS_PREFIX@ compiler_flags=@OMPI_WRAPPER_EXTRA_CFLAGS@ linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@ libs=-lmpi @OMPI_WRAPPER_EXTRA_LIBS@ diff --git a/ompi/tools/wrappers/mpif77-wrapper-data.txt.in b/ompi/tools/wrappers/mpif77-wrapper-data.txt.in index ba2675e1ed..dd4abd99b8 100644 --- a/ompi/tools/wrappers/mpif77-wrapper-data.txt.in +++ b/ompi/tools/wrappers/mpif77-wrapper-data.txt.in @@ -14,6 +14,7 @@ compiler_flags_env=FFLAGS compiler=@F77@ extra_includes= preprocessor_flags= +compiler_flags_prefix=@OMPI_WRAPPER_EXTRA_FFLAGS_PREFIX@ compiler_flags=@OMPI_WRAPPER_EXTRA_FFLAGS@ linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@ libs=-lmpi_f77 -lmpi @OMPI_WRAPPER_EXTRA_LIBS@ diff --git a/ompi/tools/wrappers/mpif90-wrapper-data.txt.in b/ompi/tools/wrappers/mpif90-wrapper-data.txt.in index 91a3272fb2..719d5e919d 100644 --- a/ompi/tools/wrappers/mpif90-wrapper-data.txt.in +++ b/ompi/tools/wrappers/mpif90-wrapper-data.txt.in @@ -15,6 +15,7 @@ compiler=@FC@ module_option=@OMPI_FC_MODULE_FLAG@ extra_includes= preprocessor_flags= +compiler_flags_prefix=@OMPI_WRAPPER_EXTRA_FCFLAGS_PREFIX@ compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@ linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@ libs=-lmpi_f90 -lmpi_f77 -lmpi @OMPI_WRAPPER_EXTRA_LIBS@ diff --git a/ompi/tools/wrappers/ompi_wrapper_script.in b/ompi/tools/wrappers/ompi_wrapper_script.in index 54361a5f8d..f8571d10f2 100644 --- a/ompi/tools/wrappers/ompi_wrapper_script.in +++ b/ompi/tools/wrappers/ompi_wrapper_script.in @@ -2,10 +2,11 @@ # -*- perl -*- # # Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. # $COPYRIGHT$ -# +# # Additional copyrights may follow -# +# # $HEADER$ # @@ -32,8 +33,11 @@ my $FC = "@FC@"; my $extra_includes = "@OMPI_WRAPPER_EXTRA_INCLUDES@"; my $extra_cppflags = "@OMPI_WRAPPER_EXTRA_CPPFLAGS@"; my $extra_cflags = "@OMPI_WRAPPER_EXTRA_CFLAGS@"; +my $extra_cflags_prefix = "@ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX@"; my $extra_cxxflags = "@OMPI_WRAPPER_EXTRA_CXXFLAGS@"; +my $extra_cxxflags_prefix = "@ORTE_WRAPPER_EXTRA_CXXFLAGS_PREFIX@"; my $extra_fflags = "@OMPI_WRAPPER_EXTRA_FFLAGS@"; +my $extra_fflags_prefix = "@OMPI_WRAPPER_EXTRA_FFLAGS_PREFIX@"; my $extra_ldflags = "@OMPI_WRAPPER_EXTRA_LDFLAGS@"; my $extra_libs = "@OMPI_WRAPPER_EXTRA_LIBS@"; my $cxx_lib = "@OMPI_WRAPPER_CXX_LIB@"; @@ -47,6 +51,7 @@ my $lang = "none"; my $comp = ""; # this is a sentinal from configure my $preproc_flags = $include_flag . $includedir; my $comp_flags = ""; +my $comp_flags_prefix = ""; my $linker_flags = $libdir_flag . $libdir . " " . $extra_ldflags; my $libs = "-lmpi -lopen-rte -lopen-pal " . $extra_libs; @@ -82,18 +87,21 @@ if (basename($0) eq "mpicc") { $comp = check_env("CC", $CC); $preproc_flags .= " " . add_extra_includes(); $comp_flags = $extra_cflags; + $comp_flags_prefix = $extra_cflags_prefix; # no special libs for C } elsif (basename($0) eq "mpic++" || basename($0) eq "mpiCC" || basename($0) eq "mpicxx") { $lang = "C++"; $comp = check_env("CXX", $CXX); $preproc_flags .= " " . add_extra_includes(); $comp_flags = $extra_cxxflags; + $comp_flags_prefix = $extra_cxxflags_prefix; $libs = $cxx_lib . " " . $libs; } elsif (basename($0) eq "mpif77") { $lang = "F77"; $comp = check_env("F77", $F77); # no extra includes for F77. $comp_flags = $extra_fflags; + $comp_flags_prefix = $extra_fflags_prefix; $libs = "-lmpi_f77 " . $libs; } elsif (basename($0) eq "mpif90") { $lang = "F90"; @@ -160,8 +168,12 @@ my @exec_argv = (); # assemble command push(@exec_argv, split(' ', $comp)); -# Per https://svn.open-mpi.org/trac/ompi/ticket/2201, add all the user -# arguments before anything else. +# Per tickets https://svn.open-mpi.org/trac/ompi/ticket/2474, and +# https://svn.open-mpi.org/trac/ompi/ticket/2201, construct command +# with some system arguments before user arguments and some after. +if ($want_compile == 1) { + push(@exec_argv, split(' ', $comp_flags_prefix)); +} push(@exec_argv, @appargs); if ($want_preproc == 1) { push(@exec_argv, split(' ', $preproc_flags)); diff --git a/opal/config/opal_setup_wrappers.m4 b/opal/config/opal_setup_wrappers.m4 index a304fbe2b5..c604a2f0a6 100644 --- a/opal/config/opal_setup_wrappers.m4 +++ b/opal/config/opal_setup_wrappers.m4 @@ -10,8 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. -dnl Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. -dnl Use is subject to license terms. +dnl Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl @@ -32,12 +31,16 @@ dnl AC_DEFUN([OPAL_SETUP_WRAPPER_INIT],[ WRAPPER_EXTRA_CPPFLAGS= WRAPPER_EXTRA_CFLAGS= + WRAPPER_EXTRA_CFLAGS_PREFIX= WRAPPER_EXTRA_CXXFLAGS= + WRAPPER_EXTRA_CXXFLAGS_PREFIX= WRAPPER_EXTRA_LDFLAGS= WRAPPER_EXTRA_LIBS= USER_WRAPPER_EXTRA_CFLAGS= + USER_WRAPPER_EXTRA_CFLAGS_PREFIX= USER_WRAPPER_EXTRA_CXXFLAGS= + USER_WRAPPER_EXTRA_CXXFLAGS_PREFIX= USER_WRAPPER_EXTRA_LDFLAGS= USER_WRAPPER_EXTRA_LIBS= @@ -50,6 +53,15 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_INIT],[ USER_WRAPPER_EXTRA_CFLAGS="$with_wrapper_cflags" fi + AC_ARG_WITH([wrapper-cflags-prefix], + [AC_HELP_STRING([--with-wrapper-cflags-prefix], + [Extra flags to add to CFLAGS when using mpicc])]) + if test "$with_wrapper_cflags_prefix" = "yes" -o "$with_wrapper_cflags_prefix" = "no"; then + AC_MSG_ERROR([--with-wrapper-cflags-prefix must have an argument. Aborting]) + elif test ! -z "$with_wrapper_cflags_prefix" ; then + USER_WRAPPER_EXTRA_CFLAGS_PREFIX="$with_wrapper_cflags_prefix" + fi + AC_ARG_WITH([wrapper-cxxflags], [AC_HELP_STRING([--with-wrapper-cxxflags], [Extra flags to add to CXXFLAGS when using mpiCC/mpic++])]) @@ -59,6 +71,14 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_INIT],[ USER_WRAPPER_EXTRA_CXXFLAGS="$with_wrapper_cxxflags" fi + AC_ARG_WITH([wrapper-cxxflags-prefix], + [AC_HELP_STRING([--with-wrapper-cxxflags-prefix], + [Extra flags to add to CXXFLAGS when using mpiCC/mpic++])]) + if test "$with_wrapper_cxxflags_prefix" = "yes" -o "$with_wrapper_cxxflags_prefix" = "no"; then + AC_MSG_ERROR([--with-wrapper-cxxflags-prefix must have an argument. Aborting]) + elif test ! -z "$with_wrapper_cxxflags_prefix" ; then + USER_WRAPPER_EXTRA_CXXFLAGS_PREFIX="$with_wrapper_cxxflags_prefix" + fi AC_ARG_WITH([wrapper-ldflags], [AC_HELP_STRING([--with-wrapper-ldflags], @@ -83,7 +103,9 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_INIT],[ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[ OMPI_UNIQ([WRAPPER_EXTRA_CPPFLAGS]) OMPI_UNIQ([WRAPPER_EXTRA_CFLAGS]) + OMPI_UNIQ([WRAPPER_EXTRA_CFLAGS_PREFIX]) OMPI_UNIQ([WRAPPER_EXTRA_CXXFLAGS]) + OMPI_UNIQ([WRAPPER_EXTRA_CXXFLAGS_PREFIX]) OMPI_UNIQ([WRAPPER_EXTRA_LDFLAGS]) OMPI_UNIQ([opal_WRAPPER_EXTRA_LDFLAGS]) @@ -99,11 +121,21 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[ AC_SUBST([OPAL_WRAPPER_EXTRA_CFLAGS]) AC_MSG_RESULT([$OPAL_WRAPPER_EXTRA_CFLAGS]) + AC_MSG_CHECKING([for OPAL CFLAGS_PREFIX]) + OPAL_WRAPPER_EXTRA_CFLAGS_PREFIX="$WRAPPER_EXTRA_CFLAGS_PREFIX $USER_WRAPPER_EXTRA_CFLAGS_PREFIX" + AC_SUBST([OPAL_WRAPPER_EXTRA_CFLAGS_PREFIX]) + AC_MSG_RESULT([$OPAL_WRAPPER_EXTRA_CFLAGS_PREFIX]) + AC_MSG_CHECKING([for OPAL CXXFLAGS]) OPAL_WRAPPER_EXTRA_CXXFLAGS="$WRAPPER_EXTRA_CXXFLAGS $USER_WRAPPER_EXTRA_CXXFLAGS" AC_SUBST([OPAL_WRAPPER_EXTRA_CXXFLAGS]) AC_MSG_RESULT([$OPAL_WRAPPER_EXTRA_CXXFLAGS]) + AC_MSG_CHECKING([for OPAL CXXFLAGS_PREFIX]) + OPAL_WRAPPER_EXTRA_CXXFLAGS_PREFIX="$WRAPPER_EXTRA_CXXFLAGS_PREFIX $USER_WRAPPER_EXTRA_CXXFLAGS_PREFIX" + AC_SUBST([OPAL_WRAPPER_EXTRA_CXXFLAGS_PREFIX]) + AC_MSG_RESULT([$OPAL_WRAPPER_EXTRA_CXXFLAGS_PREFIX]) + AC_MSG_CHECKING([for OPAL LDFLAGS]) OPAL_WRAPPER_EXTRA_LDFLAGS="$opal_WRAPPER_EXTRA_LDFLAGS $WRAPPER_EXTRA_LDFLAGS $USER_WRAPPER_EXTRA_LDFLAGS" AC_SUBST([OPAL_WRAPPER_EXTRA_LDFLAGS]) @@ -136,19 +168,27 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[ # compatibility defines that will eventually go away WRAPPER_EXTRA_CFLAGS="$OPAL_WRAPPER_EXTRA_CFLAGS" + WRAPPER_EXTRA_CFLAGS_PREFIX="$OPAL_WRAPPER_EXTRA_CFLAGS_PREFIX" WRAPPER_EXTRA_CXXFLAGS="$OPAL_WRAPPER_EXTRA_CXXFLAGS" + WRAPPER_EXTRA_CXXFLAGS_PREFIX="$OPAL_WRAPPER_EXTRA_CXXFLAGS_PREFIX" WRAPPER_EXTRA_LDFLAGS="$OPAL_WRAPPER_EXTRA_LDFLAGS" WRAPPER_EXTRA_LIBS="$OPAL_WRAPPER_EXTRA_LIBS" AC_SUBST([WRAPPER_EXTRA_CFLAGS]) + AC_SUBST([WRAPPER_EXTRA_CFLAGS_PREFIX]) AC_SUBST([WRAPPER_EXTRA_CXXFLAGS]) + AC_SUBST([WRAPPER_EXTRA_CXXFLAGS_PREFIX]) AC_SUBST([WRAPPER_EXTRA_LDFLAGS]) AC_SUBST([WRAPPER_EXTRA_LIBS]) AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_CFLAGS, "$WRAPPER_EXTRA_CFLAGS", [Additional CFLAGS to pass through the wrapper compilers]) + AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_CFLAGS_PREFIX, "$WRAPPER_EXTRA_CFLAGS_PREFIX", + [Additional CFLAGS_PREFIX to pass through the wrapper compilers]) AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_CXXFLAGS, "$WRAPPER_EXTRA_CXXFLAGS", [Additional CXXFLAGS to pass through the wrapper compilers]) + AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_CXXFLAGS_PREFIX, "$WRAPPER_EXTRA_CXXFLAGS_PREFIX", + [Additional CXXFLAGS_PREFIX to pass through the wrapper compilers]) AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_LDFLAGS, "$WRAPPER_EXTRA_LDFLAGS", [Additional LDFLAGS to pass through the wrapper compilers]) AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_LIBS, "$WRAPPER_EXTRA_LIBS", diff --git a/opal/tools/wrappers/opal_wrapper.c b/opal/tools/wrappers/opal_wrapper.c index 6c1dd4f3d8..c3743f52f4 100644 --- a/opal/tools/wrappers/opal_wrapper.c +++ b/opal/tools/wrappers/opal_wrapper.c @@ -12,6 +12,7 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -75,6 +76,7 @@ struct options_data_t { char *module_option; char **preproc_flags; char **comp_flags; + char **comp_flags_prefix; char **link_flags; char **libs; char *req_file; @@ -116,6 +118,8 @@ options_data_init(struct options_data_t *data) data->preproc_flags[0] = NULL; data->comp_flags = (char **) malloc(sizeof(char*)); data->comp_flags[0] = NULL; + data->comp_flags_prefix = (char **) malloc(sizeof(char*)); + data->comp_flags_prefix[0] = NULL; data->link_flags = (char **) malloc(sizeof(char*)); data->link_flags[0] = NULL; data->libs = (char **) malloc(sizeof(char*)); @@ -142,6 +146,7 @@ options_data_free(struct options_data_t *data) if (NULL != data->module_option) free(data->module_option); opal_argv_free(data->preproc_flags); opal_argv_free(data->comp_flags); + opal_argv_free(data->comp_flags_prefix); opal_argv_free(data->link_flags); opal_argv_free(data->libs); if (NULL != data->req_file) free(data->req_file); @@ -298,6 +303,13 @@ data_callback(const char *key, const char *value) values); expand_flags(options_data[parse_options_idx].comp_flags); opal_argv_free(values); + } else if (0 == strcmp(key, "compiler_flags_prefix")) { + char **values = opal_argv_split(value, ' '); + opal_argv_insert(&options_data[parse_options_idx].comp_flags_prefix, + opal_argv_count(options_data[parse_options_idx].comp_flags_prefix), + values); + expand_flags(options_data[parse_options_idx].comp_flags_prefix); + opal_argv_free(values); } else if (0 == strcmp(key, "linker_flags")) { char **values = opal_argv_split(value, ' '); opal_argv_insert(&options_data[parse_options_idx].link_flags, @@ -712,6 +724,12 @@ main(int argc, char *argv[]) exec_argc = 0; } + if (flags & COMP_WANT_COMPILE) { + opal_argv_insert(&exec_argv, exec_argc, + options_data[user_data_idx].comp_flags_prefix); + exec_argc = opal_argv_count(exec_argv); + } + /* Per https://svn.open-mpi.org/trac/ompi/ticket/2201, add all the user arguments before anything else. */ opal_argv_insert(&exec_argv, exec_argc, user_argv); diff --git a/opal/tools/wrappers/opalc++-wrapper-data.txt.in b/opal/tools/wrappers/opalc++-wrapper-data.txt.in index 9c71262766..3224ff5587 100644 --- a/opal/tools/wrappers/opalc++-wrapper-data.txt.in +++ b/opal/tools/wrappers/opalc++-wrapper-data.txt.in @@ -14,6 +14,7 @@ compiler_flags_env=CXXFLAGS compiler=@CXX@ extra_includes=@OPAL_WRAPPER_EXTRA_INCLUDES@ preprocessor_flags=@OPAL_WRAPPER_EXTRA_CPPFLAGS@ +compiler_flags_prefix=@OPAL_WRAPPER_EXTRA_CXXFLAGS_PREFIX@ compiler_flags=@OPAL_WRAPPER_EXTRA_CXXFLAGS@ linker_flags=@OPAL_WRAPPER_EXTRA_LDFLAGS@ libs=-lopen-pal @OPAL_WRAPPER_EXTRA_LIBS@ diff --git a/opal/tools/wrappers/opalcc-wrapper-data.txt.in b/opal/tools/wrappers/opalcc-wrapper-data.txt.in index 22a4f86958..3e951a7635 100644 --- a/opal/tools/wrappers/opalcc-wrapper-data.txt.in +++ b/opal/tools/wrappers/opalcc-wrapper-data.txt.in @@ -14,6 +14,7 @@ compiler_flags_env=CFLAGS compiler=@CC@ extra_includes=@OPAL_WRAPPER_EXTRA_INCLUDES@ preprocessor_flags=@OPAL_WRAPPER_EXTRA_CPPFLAGS@ +compiler_flags_prefix=@OPAL_WRAPPER_EXTRA_CFLAGS_PREFIX@ compiler_flags=@OPAL_WRAPPER_EXTRA_CFLAGS@ linker_flags=@OPAL_WRAPPER_EXTRA_LDFLAGS@ libs=-lopen-pal @OPAL_WRAPPER_EXTRA_LIBS@ diff --git a/orte/config/orte_setup_wrappers.m4 b/orte/config/orte_setup_wrappers.m4 index 747a3eafdd..182bcc7880 100644 --- a/orte/config/orte_setup_wrappers.m4 +++ b/orte/config/orte_setup_wrappers.m4 @@ -34,11 +34,21 @@ AC_DEFUN([ORTE_SETUP_WRAPPER_FINAL],[ AC_SUBST([ORTE_WRAPPER_EXTRA_CXXFLAGS]) AC_MSG_RESULT([$ORTE_WRAPPER_EXTRA_CXXFLAGS]) + AC_MSG_CHECKING([for ORTE CXXFLAGS_PREFIX]) + ORTE_WRAPPER_EXTRA_CXXFLAGS_PREFIX="$WRAPPER_EXTRA_CXXFLAGS_PREFIX" + AC_SUBST([ORTE_WRAPPER_EXTRA_CXXFLAGS_PREFIX]) + AC_MSG_RESULT([$ORTE_WRAPPER_EXTRA_CXXFLAGS_PREFIX]) + AC_MSG_CHECKING([for ORTE CFLAGS]) ORTE_WRAPPER_EXTRA_CFLAGS="$WRAPPER_EXTRA_CFLAGS" AC_SUBST([ORTE_WRAPPER_EXTRA_CFLAGS]) AC_MSG_RESULT([$ORTE_WRAPPER_EXTRA_CFLAGS]) + AC_MSG_CHECKING([for ORTE CFLAGS_PREFIX]) + ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX="$WRAPPER_EXTRA_CFLAGS_PREFIX" + AC_SUBST([ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX]) + AC_MSG_RESULT([$ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX]) + AC_MSG_CHECKING([for ORTE LDFLAGS]) ORTE_WRAPPER_EXTRA_LDFLAGS="$orte_WRAPPER_EXTRA_LDFLAGS $WRAPPER_EXTRA_LDFLAGS" AC_SUBST([ORTE_WRAPPER_EXTRA_LDFLAGS]) diff --git a/orte/tools/wrappers/orte_wrapper_script.in b/orte/tools/wrappers/orte_wrapper_script.in index 2fad9c2e69..6a203d7c40 100644 --- a/orte/tools/wrappers/orte_wrapper_script.in +++ b/orte/tools/wrappers/orte_wrapper_script.in @@ -2,10 +2,11 @@ # -*- perl -*- # # Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. # $COPYRIGHT$ -# +# # Additional copyrights may follow -# +# # $HEADER$ # @@ -30,7 +31,9 @@ my $CXX = "@CXX@"; my $extra_includes = "@ORTE_WRAPPER_EXTRA_INCLUDES@"; my $extra_cppflags = "@ORTE_WRAPPER_EXTRA_CPPFLAGS@"; my $extra_cflags = "@ORTE_WRAPPER_EXTRA_CFLAGS@"; +my $extra_cflags_prefix = "@ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX@"; my $extra_cxxflags = "@ORTE_WRAPPER_EXTRA_CXXFLAGS@"; +my $extra_cxxflags_prefix = "@ORTE_WRAPPER_EXTRA_CXXFLAGS_PREFIX@"; my $extra_ldflags = "@ORTE_WRAPPER_EXTRA_LDFLAGS@"; my $extra_libs = "@ORTE_WRAPPER_EXTRA_LIBS@"; #my $cxx_lib = "@ORTE_WRAPPER_CXX_LIB@"; @@ -43,6 +46,7 @@ my $lang = "none"; my $comp = ""; # this is a sentinal from configure my $preproc_flags = $include_flag . $includedir; my $comp_flags = ""; +my $comp_flags_prefix = ""; my $linker_flags = $libdir_flag . $libdir . " " . $extra_ldflags; my $libs = "-lopen-rte -lopen-pal " . $extra_libs; @@ -78,12 +82,14 @@ if (basename($0) eq "ortecc") { $comp = check_env("CC", $CC); $preproc_flags .= " " . add_extra_includes(); $comp_flags = $extra_cflags; + $comp_flags_prefix = $extra_cflags_prefix; # no special libs for C } elsif (basename($0) eq "ortec++") { $lang = "C++"; $comp = check_env("CXX", $CXX); $preproc_flags .= " " . add_extra_includes(); $comp_flags = $extra_cxxflags; + $comp_flags_prefix = $extra_cxxflags_prefix; # $libs = $cxx_lib . " " . $libs; } @@ -142,8 +148,12 @@ my @exec_argv = (); # assemble command push(@exec_argv, split(' ', $comp)); -# Per https://svn.open-mpi.org/trac/ompi/ticket/2201, add all the user -# arguments before anything else. +# Per tickets https://svn.open-mpi.org/trac/ompi/ticket/2474, and +# https://svn.open-mpi.org/trac/ompi/ticket/2201, construct command +# with some system arguments before user arguments and some after. +if ($want_compile == 1) { + push(@exec_argv, split(' ', $comp_flags_prefix)); +} push(@exec_argv, @appargs); if ($want_preproc == 1) { push(@exec_argv, split(' ', $preproc_flags)); diff --git a/orte/tools/wrappers/ortec++-wrapper-data.txt.in b/orte/tools/wrappers/ortec++-wrapper-data.txt.in index 8240f0f4be..b262d12089 100644 --- a/orte/tools/wrappers/ortec++-wrapper-data.txt.in +++ b/orte/tools/wrappers/ortec++-wrapper-data.txt.in @@ -14,6 +14,7 @@ compiler_flags_env=CXXFLAGS compiler=@CXX@ extra_includes=@ORTE_WRAPPER_EXTRA_INCLUDES@ preprocessor_flags=@ORTE_WRAPPER_EXTRA_CPPFLAGS@ +compiler_flags_prefix=@ORTE_WRAPPER_EXTRA_CXXFLAGS_PREFIX@ compiler_flags=@ORTE_WRAPPER_EXTRA_CXXFLAGS@ linker_flags=@ORTE_WRAPPER_EXTRA_LDFLAGS@ libs=-lopen-rte @ORTE_WRAPPER_EXTRA_LIBS@ diff --git a/orte/tools/wrappers/ortecc-wrapper-data.txt.in b/orte/tools/wrappers/ortecc-wrapper-data.txt.in index 831d87d578..d030f1ab4d 100644 --- a/orte/tools/wrappers/ortecc-wrapper-data.txt.in +++ b/orte/tools/wrappers/ortecc-wrapper-data.txt.in @@ -14,6 +14,7 @@ compiler_flags_env=CFLAGS compiler=@CC@ extra_includes=@ORTE_WRAPPER_EXTRA_INCLUDES@ preprocessor_flags=@ORTE_WRAPPER_EXTRA_CPPFLAGS@ +compiler_flags_prefix=@ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX@ compiler_flags=@ORTE_WRAPPER_EXTRA_CFLAGS@ linker_flags=@ORTE_WRAPPER_EXTRA_LDFLAGS@ libs=-lopen-rte @ORTE_WRAPPER_EXTRA_LIBS@