Skip to content

Commit ad81839

Browse files
authored
Merge pull request #7916 from hjelmn/allow_splitting_ompi_c_compiler_and_end_user_c_compiler_so_eventually_we_can_require_a_sane_standards_compliance_compiler_for_building_open_mpi
config: add support for setting the wrapper C compiler
2 parents 27d30f3 + ade1b58 commit ad81839

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

config/opal_setup_cc.m4

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,6 @@ AC_DEFUN([OPAL_SETUP_CC],[
153153

154154
OPAL_VAR_SCOPE_PUSH([opal_prog_cc_c11_helper__Thread_local_available opal_prog_cc_c11_helper_atomic_var_available opal_prog_cc_c11_helper__Atomic_available opal_prog_cc_c11_helper__static_assert_available opal_prog_cc_c11_helper__Generic_available opal_prog_cc__thread_available opal_prog_cc_c11_helper_atomic_fetch_xor_explicit_available])
155155

156-
# AC_PROG_CC_C99 changes CC (instead of CFLAGS) so save CC (without c99
157-
# flags) for use in our wrappers.
158-
WRAPPER_CC="$CC"
159-
AC_SUBST([WRAPPER_CC])
160-
161156
OPAL_PROG_CC_C11
162157

163158
OPAL_CHECK_CC_IQUOTE

config/opal_setup_wrappers.m4

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,32 @@ AC_DEFUN([OPAL_WRAPPER_FLAGS_ADD], [
7777
# <flag>_prefix, configure is not. There's no known use case for
7878
# doing so, and we'd like to force the issue.
7979
AC_DEFUN([OPAL_SETUP_WRAPPER_INIT],[
80+
OPAL_VAR_SCOPE_PUSH([wrapper_cc_tmp])
81+
# AC_PROG_CC_C99 changes CC (instead of CFLAGS) so this method
82+
# must be called before OPAL_SETUP_CC.
83+
AC_ARG_WITH([wrapper_cc],
84+
[AC_HELP_STRING([--with-wrapper-cc=path],
85+
[Set a different wrapper C compiler than the one used to build Open MPI])],
86+
[], [with_wrapper_cc="$CC"])
87+
88+
AC_MSG_CHECKING([for wrapper C compiler])
89+
90+
if test "$with_wrapper_cc" = "yes" || test "$with_wrapper_cc" = "no" ; then
91+
AC_MSG_ERROR([--with-wrapper-cc must have an argument.])
92+
fi
93+
94+
# Get the full path to the wrapper compiler. If it doesn't exist
95+
# assume that the path is not currently valid.
96+
wrapper_tmp="$(type -p "$with_wrapper_cc")"
97+
WRAPPER_CC="${wrapper_tmp:-$with_wrapper_cc}"
98+
if test -z "$wrapper_tmp" ; then
99+
AC_MSG_WARN([could not find \"$with_wrapper_cc\" in path])
100+
fi
101+
102+
AC_MSG_RESULT([$WRAPPER_CC])
103+
104+
AC_SUBST([WRAPPER_CC])
105+
80106
AC_ARG_WITH([wrapper-cflags],
81107
[AC_HELP_STRING([--with-wrapper-cflags],
82108
[Extra flags to add to CFLAGS when using mpicc])])
@@ -142,6 +168,7 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_INIT],[
142168

143169
AS_IF([test "$enable_wrapper_rpath" = "no" && test "$enable_wrapper_runpath" = "yes"],
144170
[AC_MSG_ERROR([--enable-wrapper-runpath cannot be selected with --disable-wrapper-rpath])])
171+
OPAL_VAR_SCOPE_POP
145172
])
146173

147174
# OPAL_LIBTOOL_CONFIG(libtool-variable, result-variable,

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ m4_ifdef([project_ompi],
305305
AM_ENABLE_SHARED
306306
AM_DISABLE_STATIC
307307

308+
# Must be called before OPAL_SETUP_CC to get the value of CC
309+
# before it is modified by the C99/C11 checks.
308310
OPAL_SETUP_WRAPPER_INIT
309311

310312
##################################

0 commit comments

Comments
 (0)