Skip to content

Commit

Permalink
build: Default to building MCA components in the library
Browse files Browse the repository at this point in the history
Default to building MCA components into the library, rather than
as dso objects, since most users are not taking advantage of
per-library packaging, and this results in less stat/open/etc. calls
during application startup.

Clean up the static/dso selection logic for componets at the same time.
Before, it was relatively hard to describe what would happen if
there was a mix of --enable-mca-dso and --enable-mca-static arguments.
Now, the code will first look for a component-specific argument, then
a framework-level argument, then a global argument.  If there is a tie,
static is preferred.

Signed-off-by: Brian Barrett <bbarrett@amazon.com>
  • Loading branch information
bwbarrett committed Oct 28, 2020
1 parent ea63361 commit 3830582
Showing 1 changed file with 37 additions and 22 deletions.
59 changes: 37 additions & 22 deletions config/opal_mca.m4
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ AC_DEFUN([OPAL_MCA],[
type-component pairs that will be built as
run-time loadable components (as opposed to
statically linked in), if supported on this
platform. The default is to build all components
as DSOs.]))
platform.]))
AC_ARG_ENABLE(mca-static,
AC_HELP_STRING([--enable-mca-static=LIST],
[Comma-separated list of types and/or
type-component pairs that will be built statically
linked into the library. The default (if DSOs are
supported) is to build all components as DSOs.
Enabling a component as static disables it
building as a DSO.]))
building as a DSO. The default is to build all
components staticly.]))
AC_ARG_ENABLE(mca-direct,
AC_HELP_STRING([--enable-mca-direct=LIST],
[Comma-separated list of type-component pairs that
Expand Down Expand Up @@ -166,15 +166,21 @@ AC_DEFUN([OPAL_MCA],[
# resolution (prefer static) is done in the big loop below
#
AC_MSG_CHECKING([which components should be run-time loadable])
if test "$enable_static" != "no" || test "$OPAL_ENABLE_DLOPEN_SUPPORT" = 0; then
if test "$enable_static" != "no"; then
DSO_all=0
msg=none
elif test -z "$enable_mca_dso" || test "$enable_mca_dso" = "yes"; then
DSO_all=1
msg=all
msg="none (static libraries built)"
elif test "$OPAL_ENABLE_DLOPEN_SUPPORT" = 0; then
DSO_all=0
msg="none (dlopen disabled)"
elif test -z "$enable_mca_dso"; then
DSO_all=0
msg=default
elif test "$enable_mca_dso" = "no"; then
DSO_all=0
msg=none
elif test "$enable_mca_dso" = "yes"; then
DSO_all=1
msg=all
else
DSO_all=0
ifs_save="$IFS"
Expand All @@ -195,12 +201,15 @@ AC_DEFUN([OPAL_MCA],[
fi

AC_MSG_CHECKING([which components should be static])
if test "$enable_mca_static" = "yes"; then
STATIC_all=1
msg=all
elif test -z "$enable_mca_static" || test "$enable_mca_static" = "no"; then
if test -z "$enable_mca_static" ; then
STATIC_all=0
msg=default
elif test "$enable_mca_static" = "no"; then
STATIC_all=0
msg=none
elif test "$enable_mca_static" = "yes"; then
STATIC_all=1
msg=all
else
STATIC_all=0
ifs_save="$IFS"
Expand Down Expand Up @@ -705,17 +714,23 @@ AC_DEFUN([MCA_COMPONENT_COMPILE_MODE],[
[str="STATIC_COMPONENT=\$STATIC_$2_$3"
eval $str])
# Setup for either shared or static
if test "$STATIC_FRAMEWORK" = "1" || \
test "$STATIC_COMPONENT" = "1" || \
test "$STATIC_all" = "1" ; then
$4="static"
elif test "$SHARED_FRAMEWORK" = "1" || \
test "$SHARED_COMPONENT" = "1" || \
test "$DSO_all" = "1"; then
$4="dso"
# Look for the most specific specifier between static/dso. If
# there is a tie (either neither or both specified), prefer
# static.
if test "$STATIC_COMPONENT" = "1"; then
$4=static
elif test "SHARED_COMPONENT" = "1"; then
$4=dso
elif test "$STATIC_FRAMEWORK" = "1"; then
$4=static
elif test "$SHARED_FRAMEWORK" = "1"; then
$4=dso
elif test "$STATIC_all" = "1"; then
$4=static
elif test "$DSO_all" = "1"; then
$4=dso
else
$4="static"
$4=static
fi
AC_MSG_CHECKING([for MCA component $2:$3 compile mode])
Expand Down

0 comments on commit 3830582

Please sign in to comment.