build: Fix precious variable passing to sub-configure
Be more careful than just exporting CPPFLAGS (or not) to sub- configure scripts. This fixes a bug in which --enable-visibility would cause PRRTE's configure to fail, because the top-level configure added -Wmissing-prototypes to CPPFLAGS and then the subconfigure added -Werror at one point. In general, blindly exporting all the CPPFLAGS OMPI adds was a bad idea, so we instead only export precious variables if they were set in the calling environment, on the command line of the top-level configure, or explicitly added to the sub- configure environment (like CPPFLAGS for PMIx/PRRTE). Add some envirnoment scrubbing/saving/restore wrappers and modify PAC_CONFIG_SUBDIR_ARGS to play a little nicer with precious variables so that this all works. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
Этот коммит содержится в:
родитель
57df1084cd
Коммит
f500371a87
@ -73,33 +73,47 @@ AC_DEFUN([PAC_CONFIG_SUBDIR_ARGS],[
|
||||
--disable-option-checking)
|
||||
;;
|
||||
*)
|
||||
# MPICH note: this is a more robust version of the "precious
|
||||
# variable" propagation code that was present in the previous
|
||||
# incarnation of this macro
|
||||
# strip out precious variables from ac_configure_args,
|
||||
# which will include precious variables that are currently
|
||||
# set and were set on the command line or in the
|
||||
# environment at the time configure was invoked. Instead,
|
||||
# we add all precious variables which have been tagged as
|
||||
# set, so that we can more closely control the environment
|
||||
# of sub-configures.
|
||||
is_precious=0
|
||||
for pac_pvar in $ac_precious_vars ; do
|
||||
# check if configure argument token contains the
|
||||
# precious variable, i.e. "name_of_prec_var=".
|
||||
if ( echo $pac_arg | grep "^$pac_pvar=" >/dev/null 2>&1 ) ; then
|
||||
# check if current precious variable is set in env
|
||||
eval pvar_set=\${$pac_pvar+set}
|
||||
if test "$pvar_set" = "set" ; then
|
||||
# Append 'name_of_prec_var=value_of_prec_var'
|
||||
# to the subconfigure arguments list, where
|
||||
# value_of_prec_var is fetched from the env.
|
||||
# this also overrides any value set on the command line
|
||||
eval pac_pval=\${$pac_pvar}
|
||||
pac_arg="$pac_pvar=$pac_pval"
|
||||
break
|
||||
fi
|
||||
is_precious=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
case $pac_arg in
|
||||
*\'*) pac_arg=`AS_ECHO(["$pac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;;
|
||||
esac
|
||||
AS_VAR_APPEND([pac_sub_configure_args], [" '$pac_arg'"]) ;;
|
||||
if test $is_precious -eq 0; then
|
||||
case $pac_arg in
|
||||
*\'*) pac_arg=`AS_ECHO(["$pac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;;
|
||||
esac
|
||||
AS_VAR_APPEND([pac_sub_configure_args], [" '$pac_arg'"])
|
||||
fi ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# add all precious values with a set token to the configure
|
||||
# args. If the caller hasn't artificially manipulated the
|
||||
# environment, this will simply be any precious variables as
|
||||
# they were originally specified on the top-level configure
|
||||
# line (or in the environment at start of configure).
|
||||
# However, callers may manipulate that environment, preferably
|
||||
# with the OPAL_SUBDIR_ENV macros.
|
||||
for temp_var in $ac_precious_vars; do
|
||||
eval temp_var_set=\$ac_env_${temp_var}_set
|
||||
if test "$temp_var_set" = "set" ; then
|
||||
eval temp_val=\$$temp_var
|
||||
temp_arg="$temp_var=$temp_val"
|
||||
AS_VAR_APPEND([pac_sub_configure_args], [" '$temp_arg'"])
|
||||
fi
|
||||
done
|
||||
|
||||
# Always prepend --prefix to ensure using the same prefix
|
||||
# in subdir configurations.
|
||||
# MPICH note: see tt#983 for an example of why this is necessary
|
||||
|
@ -49,7 +49,7 @@ AC_DEFUN([OMPI_SETUP_PRRTE],[
|
||||
])
|
||||
|
||||
AC_DEFUN([OMPI_SETUP_PRRTE_INTERNAL], [
|
||||
OPAL_VAR_SCOPE_PUSH([internal_prrte_args internal_prrte_extra_libs internal_prrte_happy deprecated_prefix_by_default print_prrte_warning])
|
||||
OPAL_VAR_SCOPE_PUSH([internal_prrte_args internal_prrte_extra_libs internal_prrte_happy deprecated_prefix_by_default print_prrte_warning internal_prrte_CPPFLAGS])
|
||||
|
||||
opal_show_subtitle "Configuring PRRTE"
|
||||
|
||||
@ -91,6 +91,7 @@ AC_DEFUN([OMPI_SETUP_PRRTE_INTERNAL], [
|
||||
AS_IF([test "$enable_internal_rte" = "no"],
|
||||
[internal_prrte_happy="no"])
|
||||
|
||||
internal_prrte_CPPFLAGS=
|
||||
internal_prrte_args="--with-proxy-version-string=$OPAL_VERSION --with-proxy-package-name=\"Open MPI\" --with-proxy-bugreport=\"https://www.open-mpi.org/community/help/\""
|
||||
internal_prrte_libs=
|
||||
|
||||
@ -105,14 +106,17 @@ AC_DEFUN([OMPI_SETUP_PRRTE_INTERNAL], [
|
||||
|
||||
AS_IF([test "$opal_libevent_mode" = "internal"],
|
||||
[internal_prrte_args="$internal_prrte_args --with-libevent-header=$opal_libevent_header"
|
||||
internal_prrte_CPPFLAGS="$internal_prrte_CPPFLAGS $opal_libevent_CPPFLAGS"
|
||||
internal_prrte_libs="$internal_prrte_libs $opal_libevent_LIBS"])
|
||||
|
||||
AS_IF([test "$opal_hwloc_mode" = "internal"],
|
||||
[internal_prrte_args="$internal_prrte_args --with-hwloc-header=$opal_hwloc_header"
|
||||
internal_prrte_CPPFLAGS="$internal_prrte_CPPFLAGS $opal_hwloc_CPPFLAGS"
|
||||
internal_prrte_libs="$internal_prrte_libs $opal_hwloc_LIBS"])
|
||||
|
||||
AS_IF([test "$opal_pmix_mode" = "internal"],
|
||||
[internal_prrte_args="$internal_prrte_args --with-pmix-header=$opal_pmix_header"
|
||||
internal_prrte_CPPFLAGS="$internal_prrte_CPPFLAGS $opal_pmix_CPPFLAGS"
|
||||
internal_prrte_libs="$internal_prrte_libs $opal_pmix_LIBS"])
|
||||
|
||||
AS_IF([test "$internal_prrte_happy" = "yes"],
|
||||
@ -143,13 +147,16 @@ dnl [internal_prrte_args="$internal_prrte_args --with-platform=$with_prrt
|
||||
# picks up how to build an internal HWLOC, libevent, and PMIx, plus
|
||||
# picks up any user-specified compiler flags from the master
|
||||
# configure run.
|
||||
export CFLAGS CPPFLAGS LDFLAGS
|
||||
OPAL_SUBDIR_ENV_CLEAN([opal_prrte_configure])
|
||||
AS_IF([test -n "$internal_prrte_CPPFLAGS"],
|
||||
[OPAL_SUBDIR_ENV_APPEND([CPPFLAGS], [$internal_prrte_CPPFLAGS])])
|
||||
PAC_CONFIG_SUBDIR_ARGS([3rd-party/prrte], [$internal_prrte_args],
|
||||
[[--with-libevent=internal], [--with-hwloc=internal],
|
||||
[--with-libevent=external], [--with-hwloc=external],
|
||||
[--with-pmix=internal], [--with-pmix=external],
|
||||
[--with-platform=[[^ ]]*]],
|
||||
[], [internal_prrte_happy="no"])
|
||||
OPAL_SUBDIR_ENV_RESTORE([opal_prrte_configure])
|
||||
OPAL_3RDPARTY_DIST_SUBDIRS="$OPAL_3RDPARTY_DIST_SUBDIRS prrte"
|
||||
|
||||
AS_IF([test "$internal_prrte_happy" = "no" -a "$enable_internal_rte" != "no"],
|
||||
|
@ -154,8 +154,10 @@ AC_DEFUN([_OPAL_CONFIG_HWLOC_INTERNAL], [
|
||||
# Note: To update the version of hwloc shipped, update the
|
||||
# constant in autogen.pl.
|
||||
OPAL_EXPAND_TARBALL([3rd-party/hwloc_tarball], [3rd-party/hwloc_directory], [configure])
|
||||
OPAL_SUBDIR_ENV_CLEAN([opal_hwloc_configure])
|
||||
PAC_CONFIG_SUBDIR_ARGS([3rd-party/hwloc_directory], [], [],
|
||||
[subconfig_happy=1], [subconfig_happy=0])
|
||||
OPAL_SUBDIR_ENV_RESTORE([opal_hwloc_configure])
|
||||
|
||||
AS_IF([test "$subconfig_happy" = "1"],
|
||||
[internal_hwloc_location="3rd-party/hwloc_directory"
|
||||
|
@ -183,9 +183,11 @@ AC_DEFUN([_OPAL_CONFIG_LIBEVENT_INTERNAL], [
|
||||
# Libevent, so we will never actually fix said warnnings and 2)
|
||||
# some of the warning options cause failures with compilers that
|
||||
# fake being GCC (I'm looking at you, PGI).
|
||||
OPAL_SUBDIR_ENV_CLEAN([opal_libevent_configure])
|
||||
PAC_CONFIG_SUBDIR_ARGS([3rd-party/libevent_directory],
|
||||
[--disable-dns --disable-http --disable-rpc --disable-openssl --enable-thread-support --disable-evport --disable-gcc-warnings],
|
||||
[], [subconfig_happy=1], [subconfig_happy=0])
|
||||
OPAL_SUBDIR_ENV_RESTORE([opal_libevent_configure])
|
||||
|
||||
AS_IF([test "$subconfig_happy" = "1"],
|
||||
[internal_libevent_location="3rd-party/libevent_directory"
|
||||
|
@ -57,7 +57,7 @@ dnl LD_LIBRARY_PATH.
|
||||
dnl * CPPFLAGS, LDFLAGS - Updated opal_pmix_CPPFLAGS and
|
||||
dnl opal_pmix_LDFLAGS.
|
||||
AC_DEFUN([OPAL_CONFIG_PMIX], [
|
||||
OPAL_VAR_SCOPE_PUSH([external_pmix_happy internal_pmix_happy internal_pmix_args internal_pmix_libs])
|
||||
OPAL_VAR_SCOPE_PUSH([external_pmix_happy internal_pmix_happy internal_pmix_args internal_pmix_libs internal_pmix_CPPFLAGS])
|
||||
|
||||
opal_show_subtitle "Configuring PMIx"
|
||||
|
||||
@ -71,13 +71,16 @@ AC_DEFUN([OPAL_CONFIG_PMIX], [
|
||||
# make dist always works.
|
||||
internal_pmix_args="--without-tests-examples --disable-pmix-binaries --disable-pmix-backward-compatibility --disable-visibility"
|
||||
internal_pmix_libs=
|
||||
internal_pmix_CPPFLAGS=
|
||||
|
||||
AS_IF([test "$opal_libevent_mode" = "internal"],
|
||||
[internal_pmix_args="$internal_pmix_args --with-libevent=cobuild"
|
||||
internal_pmix_CPPFLAGS="$internal_pmix_CPPFLAGS $opal_libevent_CPPFLAGS"
|
||||
internal_pmix_libs="$internal_pmix_libs $opal_libevent_LIBS"])
|
||||
|
||||
AS_IF([test "$opal_hwloc_mode" = "internal"],
|
||||
[internal_pmix_args="$internal_pmix_args --with-hwloc=cobuild"
|
||||
internal_pmix_CPPFLAGS="$internal_pmix_CPPFLAGS $opal_hwloc_CPPFLAGS"
|
||||
internal_pmix_libs="$internal_pmix_libs $opal_hwloc_LIBS"])
|
||||
|
||||
AS_IF([test ! -z "$internal_pmix_libs"],
|
||||
@ -87,12 +90,15 @@ AC_DEFUN([OPAL_CONFIG_PMIX], [
|
||||
# picks up how to build an internal HWLOC and libevent, plus
|
||||
# picks up any user-specified compiler flags from the master
|
||||
# configure run.
|
||||
export CFLAGS CPPFLAGS LDFLAGS
|
||||
OPAL_SUBDIR_ENV_CLEAN([opal_pmix_configure])
|
||||
AS_IF([test -n "$internal_pmix_CPPFLAGS"],
|
||||
[OPAL_SUBDIR_ENV_APPEND([CPPFLAGS], [$internal_pmix_CPPFLAGS])])
|
||||
PAC_CONFIG_SUBDIR_ARGS([3rd-party/openpmix], [$internal_pmix_args],
|
||||
[[--with-libevent=internal], [--with-hwloc=internal],
|
||||
[--with-libevent=external], [--with-hwloc=external],
|
||||
[--with-pmix=[[^ ]]*], [--with-platform=[[^ ]]*]],
|
||||
[internal_pmix_happy=1])
|
||||
OPAL_SUBDIR_ENV_RESTORE([opal_pmix_configure])
|
||||
OPAL_3RDPARTY_DIST_SUBDIRS="$OPAL_3RDPARTY_DIST_SUBDIRS openpmix"])
|
||||
|
||||
# unless internal specifically requested by the user, try to find
|
||||
|
89
config/opal_subdir_env.m4
Обычный файл
89
config/opal_subdir_env.m4
Обычный файл
@ -0,0 +1,89 @@
|
||||
dnl -*- autoconf -*-
|
||||
dnl
|
||||
dnl Copyright (c) 2020 Amazon.com, Inc. or its affiliates. All Rights
|
||||
dnl reserved.
|
||||
dnl $COPYRIGHT$
|
||||
dnl
|
||||
dnl Additional copyrights may follow
|
||||
dnl
|
||||
dnl $HEADER$
|
||||
dnl
|
||||
|
||||
dnl OPAL_SUBDIR_ENV_CLEAN([prefix])
|
||||
dnl
|
||||
dnl Save all precious variables with the specified prefix and reset
|
||||
dnl all precious variables to their state at the start of configure.
|
||||
dnl That is, if a precious variable (say CPPFLAGS) was set on the
|
||||
dnl configure command line or in the environment at the start of
|
||||
dnl configure, it will be reset to that stored value. Otherwise, it
|
||||
dnl will be unset. The current state is recorded so that it can be
|
||||
dnl restored with OPAL_SUBDIR_ENV_RESTORE. Useful for wrapping calles
|
||||
dnl to subconfigure scripts.
|
||||
AC_DEFUN([OPAL_SUBDIR_ENV_CLEAN], [
|
||||
for temp_var in $ac_precious_vars; do
|
||||
# save all set variables, with a <prefix>_<name>_set and
|
||||
# <prefix>_<name>_value format. _set will always be saved,
|
||||
# _value if _set evaluates to "set".
|
||||
#
|
||||
# Because we may modify the environment with
|
||||
# OPAL_SUBDIR_ENV_APPEND, also store the original values of
|
||||
# ac_env_<name>_set in <prefix>_ac_env_<name>_set
|
||||
eval temp_var_set=\${${temp_var}+set}
|
||||
eval $1_${temp_var}_set=$temp_var_set
|
||||
eval $1_ac_env_${temp_var}_set=\$ac_env_${temp_var}_set
|
||||
if test "$temp_var_set" = "set" ; then
|
||||
eval $1_${temp_var}_value=\$${temp_var}
|
||||
fi
|
||||
unset tmp_var_set
|
||||
|
||||
# restore the variables that were set at the start of
|
||||
# configure and unset the ones that were not.
|
||||
eval temp_var_orig_set=\$ac_env_${temp_var}_set
|
||||
if test "$temp_var_set" = "set" ; then
|
||||
eval ${temp_var}=\$ac_env_${temp_var}_value
|
||||
else
|
||||
unset $temp_var
|
||||
fi
|
||||
done
|
||||
])
|
||||
|
||||
dnl OPAL_SUBDIR_ENV_RESTORE([prefix])
|
||||
dnl
|
||||
dnl Match with call to OPAL_SUBDIR_ENV_CLEAN. Restore will return all
|
||||
dnl precious variables to their state at the time that
|
||||
dnl OPAL_SUBDIR_ENV_CLEAN was called. If a variable was set at that
|
||||
dnl time, it will be set to that value. Otherwise, it will be unset.
|
||||
dnl
|
||||
dnl The state of the ac_env_<var>_set value is also restored to its
|
||||
dnl value from when OPAL_SUBDIR_ENV_CLEAN is called. The
|
||||
dnl ac_env_<var>_set variables may be manipulated by
|
||||
dnl OPAL_SUBDIR_ENV_APPEND.
|
||||
AC_DEFUN([OPAL_SUBDIR_ENV_RESTORE], [
|
||||
for temp_var in $ac_precious_vars; do
|
||||
# always restore the value of ac_env_<name>_set
|
||||
eval ac_env_${temp_var}_set=\$$1_ac_env_${temp_var}_set
|
||||
|
||||
# conditionally restore any variable values that were set at
|
||||
# CLEAN time
|
||||
eval temp_var_set=\$$1_${temp_var}_set
|
||||
if test "$temp_var_set" = "set" ; then
|
||||
eval ${temp_var}=\$$1_${temp_var}_value
|
||||
fi
|
||||
|
||||
unset $1_${temp_var}_value
|
||||
unset $1_${temp_var}_set
|
||||
unset $1_ac_env_${temp_var}_set
|
||||
done
|
||||
])
|
||||
|
||||
dnl OPAL_SUBDIR_ENV_APPEND([precious variable], [append value])
|
||||
dnl
|
||||
dnl Append the contents of [append value] to precious variable
|
||||
dnl [precious variable] and set the ac_env_<param>_set variable so
|
||||
dnl that PAC_CONFIG_SUBDIR_ARGS can pick up the variables for
|
||||
dnl subconfigure runs. Most useful between a call to
|
||||
dnl OPAL_SUBDIR_ENV_CLEAN and OPAL_SUBDIR_ENV_RESTORE
|
||||
AC_DEFUN([OPAL_SUBDIR_ENV_APPEND], [
|
||||
ac_env_$1_set="set"
|
||||
AS_IF([test -z "$$1"], [$1=$2], [$1="$$1 $2"])
|
||||
])
|
Загрузка…
x
Ссылка в новой задаче
Block a user