Skip to content

Commit ff3df16

Browse files
hjelmnawlauria
authored andcommitted
configure: fix --enable-mca-direct
This option appears to have been silently broken for some time due to the following issues: - The cut tool returns the entire input if no delimiter exists despite the -f sswitch. Added -s to ensure the output is empty in this case as expected. Without this fix it would erroneously accept --enable-mca-direct=foo. - Use braces around expansion of local variables. Without this the DIRECT_whatever variables are not set properly. - Check if more than one direct component has been specified for a framework. - Check if a direct component actually exists. Tested the fix with pml-ob1 and it now works as expected. Signed-off-by: Nathan Hjelm <hjelmn@google.com> (cherry picked from commit c153220)
1 parent 62f2e6f commit ff3df16

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

config/opal_mca.m4

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ AC_DEFUN([OPAL_MCA],[
9393
if test "$enable_mca_no_build" = "yes"; then
9494
AC_MSG_RESULT([yes])
9595
AC_MSG_ERROR([*** The enable-mca-no-build flag requires an explicit list
96-
*** of type-component pairs. For example, --enable-mca-no-build=pml-ob1])
96+
of type-component pairs. For example, --enable-mca-no-build=pml-ob1])
9797
else
9898
ifs_save="$IFS"
9999
IFS="${IFS}$PATH_SEPARATOR,"
@@ -123,11 +123,7 @@ AC_DEFUN([OPAL_MCA],[
123123
# in the form DIRECT_[type]=[component]
124124
#
125125
AC_MSG_CHECKING([which components should be direct-linked into the library])
126-
if test "$enable_mca_direct" = "yes" ; then
127-
AC_MSG_RESULT([yes])
128-
AC_MSG_ERROR([*** The enable-mca-direct flag requires an explicit list of
129-
*** type-component pairs. For example, --enable-mca-direct=pml-ob1,coll-basic])
130-
elif test ! -z "$enable_mca_direct" && test "$enable_mca_direct" != "" ; then
126+
if test -n "$enable_mca_direct" ; then
131127
#
132128
# we need to add this into the static list, unless the static list
133129
# is everything
@@ -145,15 +141,21 @@ AC_DEFUN([OPAL_MCA],[
145141
IFS="${IFS}$PATH_SEPARATOR,"
146142
msg=
147143
for item in $enable_mca_direct; do
148-
type="`echo $item | cut -f1 -d-`"
149-
comp="`echo $item | cut -f2- -d-`"
144+
type="`echo $item | cut -s -f1 -d-`"
145+
comp="`echo $item | cut -s -f2- -d-`"
150146
if test -z $type || test -z $comp ; then
151-
AC_MSG_ERROR([*** The enable-mca-direct flag requires a
152-
*** list of type-component pairs. Invalid input detected.])
153-
else
154-
AS_VAR_SET([AS_TR_SH([DIRECT_$type])], [AS_TR_SH([$comp])])
155-
msg="$item $msg"
147+
AC_MSG_ERROR([enable-mca-direct requires a list of type-component pairs (ex. --enable-mca-direct=pml-ob1,smsc-xpmem)])
156148
fi
149+
150+
var_name=AS_TR_SH([DIRECT_${type}])
151+
AS_VAR_COPY([var_value], [$var_name])
152+
153+
if test -n "$var_value" ; then
154+
AC_MSG_ERROR([enable-mca-direct can only enable a single component per framwork: specified both ${type}-${var_value} and ${type}-${comp}.])
155+
fi
156+
157+
AS_VAR_SET([$var_name], AS_TR_SH([${comp}]))
158+
msg="$item $msg"
157159
done
158160
IFS="$ifs_save"
159161
fi
@@ -456,6 +458,18 @@ AC_DEFUN([MCA_CONFIGURE_FRAMEWORK],[
456458
[static_components], [dso_components],
457459
[static_ltlibs])])])])])
458460
461+
AS_VAR_SET_IF([OPAL_EVAL_ARG([DIRECT_$2])], [
462+
AC_MSG_CHECKING([if direct-selection component exists for $2 framework])
463+
direct_component_happy=no
464+
for component in $all_components ; do
465+
AS_IF([test $component = "$DIRECT_$2"], [direct_component_happy=yes])
466+
done
467+
if test $direct_component_happy = no ; then
468+
AC_MSG_ERROR([direct component $DIRECT_$2 requested but not found in $all_components])
469+
fi
470+
AC_MSG_RESULT([$DIRECT_$2])
471+
])
472+
459473
MCA_$1_$2_ALL_COMPONENTS="$all_components"
460474
MCA_$1_$2_STATIC_COMPONENTS="$static_components"
461475
MCA_$1_$2_DSO_COMPONENTS="$dso_components"

0 commit comments

Comments
 (0)