From 9568b342091cecda1304563bf161a943d0fe8207 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 15 Aug 2017 14:20:20 -0600 Subject: [PATCH] configure: add an option to set wrapper CC This commit adds a new configure option: --with-wrapper-cc. This option can be used to set which C compiler is invoked by mpicc. This feature may necessary when building for compiler suites that do not support C11 (Ex: icc) if Open MPI chooses to require a C11 compiler. A version of Open MPI that is set up for these compilers can be built with: ./configure --with-wrapper-cc=icc CC=gcc FC=ifort CXX=icpc Signed-off-by: Nathan Hjelm --- config/opal_setup_cc.m4 | 7 +------ config/opal_setup_wrappers.m4 | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/config/opal_setup_cc.m4 b/config/opal_setup_cc.m4 index 14e29265ba2..4c2aeb265c0 100644 --- a/config/opal_setup_cc.m4 +++ b/config/opal_setup_cc.m4 @@ -12,7 +12,7 @@ dnl Copyright (c) 2004-2006 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2012 Los Alamos National Security, LLC. All rights +dnl Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2015 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. @@ -36,11 +36,6 @@ AC_DEFUN([OPAL_SETUP_CC],[ AC_REQUIRE([_OPAL_PROG_CC]) AC_REQUIRE([AM_PROG_CC_C_O]) - # AC_PROG_CC_C99 changes CC (instead of CFLAGS) so save CC (without c99 - # flags) for use in our wrappers. - WRAPPER_CC="$CC" - AC_SUBST([WRAPPER_CC]) - # From Open MPI 1.7 on we require a C99 compiant compiler AC_PROG_CC_C99 # The result of AC_PROG_CC_C99 is stored in ac_cv_prog_cc_c99 diff --git a/config/opal_setup_wrappers.m4 b/config/opal_setup_wrappers.m4 index 16c48591452..c26a450faa9 100644 --- a/config/opal_setup_wrappers.m4 +++ b/config/opal_setup_wrappers.m4 @@ -15,6 +15,8 @@ dnl Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2015-2016 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2016 IBM Corporation. All rights reserved. +dnl Copyright (c) 2017 Los Alamos National Security, LLC. All rights +dnl reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -75,6 +77,22 @@ AC_DEFUN([OPAL_WRAPPER_FLAGS_ADD], [ # _prefix, configure is not. There's no known use case for # doing so, and we'd like to force the issue. AC_DEFUN([OPAL_SETUP_WRAPPER_INIT],[ + AC_ARG_WITH([wrapper-cc], + [AC_HELP_STRING([--with-wrapper-cc], + [C compiler to use when using mpicc])]) + + AS_IF([test "$with_wrapper_cc" = "yes" || test "$with_wrapper_cc" = "no"], + [AC_MSG_ERROR([--with-wrapper-cc must have an argument.])]) + if test -n "$with_wrapper_cc" ; then + WRAPPER_CC="$with_wrapper_cc" + else + # Just grab the compiler. If the user wants to also set CFLAGS there + # is an option for that. + WRAPPER_CC=$(echo "$CC" | cut -d' ' -f1) + fi + + AC_SUBST([WRAPPER_CC]) + AC_ARG_WITH([wrapper-cflags], [AC_HELP_STRING([--with-wrapper-cflags], [Extra flags to add to CFLAGS when using mpicc])])