2008-10-28 20:22:29 +03:00
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
2015-02-09 22:45:54 +03:00
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
2008-10-28 20:22:29 +03:00
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
2016-05-03 17:24:06 +03:00
dnl Copyright (c) 2010-2016 Cisco Systems, Inc. All rights reserved.
2017-09-23 02:02:57 +03:00
dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
2018-05-17 20:11:12 +03:00
dnl Copyright (c) 2018 Amazon.com, Inc. or its affiliates.
dnl All Rights reserved.
2008-10-28 20:22:29 +03:00
dnl $COPYRIGHT$
2015-02-09 22:45:54 +03:00
dnl
2008-10-28 20:22:29 +03:00
dnl Additional copyrights may follow
2015-02-09 22:45:54 +03:00
dnl
2008-10-28 20:22:29 +03:00
dnl $HEADER$
dnl
2014-05-08 01:48:53 +04:00
# OPAL_EVAL_ARG(arg)
2008-10-28 20:22:29 +03:00
# ------------------
# evaluates and returns argument
2014-05-08 01:48:53 +04:00
AC_DEFUN([OPAL_EVAL_ARG], [$1])
2008-10-28 20:22:29 +03:00
######################################################################
#
2014-05-08 01:48:53 +04:00
# OPAL_MCA
2008-10-28 20:22:29 +03:00
#
# configure the MCA (modular component architecture). Works hand in hand
2010-09-18 03:04:06 +04:00
# with Open MPI's autogen.pl, requiring it's specially formatted lists
2008-10-28 20:22:29 +03:00
# of frameworks, components, etc.
#
# USAGE:
2014-05-08 01:48:53 +04:00
# OPAL_MCA()
2008-10-28 20:22:29 +03:00
#
######################################################################
2014-05-08 01:48:53 +04:00
AC_DEFUN([OPAL_MCA],[
2010-11-13 02:22:11 +03:00
dnl for OPAL_CONFIGURE_USER env variable
AC_REQUIRE([OPAL_CONFIGURE_SETUP])
2008-10-28 20:22:29 +03:00
2013-01-29 04:00:43 +04:00
# Set a special flag so that we can detect if the user calls
# OPAL_WRAPPER_FLAGS_ADD and error.
m4_define([mca_component_configure_active], [1])
2008-10-28 20:22:29 +03:00
# Find which components should be built as run-time loadable components
# Acceptable combinations:
#
# [default -- no option given]
# --enable-mca-dso
# --enable-mca-dso=[.+,]*COMPONENT_TYPE[.+,]*
# --enable-mca-dso=[.+,]*COMPONENT_TYPE-COMPONENT_NAME[.+,]*
# --disable-mca-dso
#
AC_ARG_ENABLE([mca-no-build],
[AC_HELP_STRING([--enable-mca-no-build=LIST],
2015-02-09 22:45:54 +03:00
[Comma-separated list of <type>-<component> pairs
2016-11-03 16:11:51 +03:00
that will not be built. Example:
"--enable-mca-no-build=btl-portals,oob-ud" will
disable building the "portals" btl and the "ud"
oob components.])])
2008-10-28 20:22:29 +03:00
AC_ARG_ENABLE(mca-dso,
AC_HELP_STRING([--enable-mca-dso=LIST],
[Comma-separated list of types and/or
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.]))
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.]))
AC_ARG_ENABLE(mca-direct,
AC_HELP_STRING([--enable-mca-direct=LIST],
[Comma-separated list of type-component pairs that
will be hard coded as the one component to use for
a given component type, saving the (small)
overhead of the component architecture. LIST must
not be empty and implies given component pairs are
build as static components.]))
AC_MSG_CHECKING([which components should be disabled])
if test "$enable_mca_no_build" = "yes"; then
AC_MSG_RESULT([yes])
AC_MSG_ERROR([*** The enable-mca-no-build flag requires an explicit list
2016-05-03 17:24:06 +03:00
*** of type-component pairs. For example, --enable-mca-no-build=pml-ob1])
2008-10-28 20:22:29 +03:00
else
ifs_save="$IFS"
IFS="${IFS}$PATH_SEPARATOR,"
msg=
for item in $enable_mca_no_build; do
type="`echo $item | cut -s -f1 -d-`"
comp="`echo $item | cut -s -f2- -d-`"
if test -z $type ; then
type=$item
fi
if test -z $comp ; then
str="`echo DISABLE_${type}=1 | sed s/-/_/g`"
eval $str
msg="$item $msg"
else
str="`echo DISABLE_${type}_${comp}=1 | sed s/-/_/g`"
eval $str
msg="$item $msg"
fi
done
IFS="$ifs_save"
fi
AC_MSG_RESULT([$msg])
unset msg
#
# First, add all the mca-direct components / types into the mca-static
# lists and create a list of component types that are direct compile,
# in the form DIRECT_[type]=[component]
#
AC_MSG_CHECKING([which components should be direct-linked into the library])
if test "$enable_mca_direct" = "yes" ; then
AC_MSG_RESULT([yes])
AC_MSG_ERROR([*** The enable-mca-direct flag requires an explicit list of
*** type-component pairs. For example, --enable-mca-direct=pml-ob1,coll-basic])
2015-02-03 09:19:22 +03:00
elif test ! -z "$enable_mca_direct" && test "$enable_mca_direct" != "" ; then
2008-10-28 20:22:29 +03:00
#
# we need to add this into the static list, unless the static list
# is everything
#
if test "$enable_mca_static" = "no" ; then
AC_MSG_WARN([*** Re-enabling static component support for direct call])
enable_mca_static="$enable_mca_direct"
elif test -z "$enable_mca_static" ; then
enable_mca_static="$enable_mca_direct"
elif test "$enable_mca_static" != "yes" ; then
enable_mca_static="$enable_mca_direct,$enable_mca_static"
fi
ifs_save="$IFS"
IFS="${IFS}$PATH_SEPARATOR,"
msg=
for item in $enable_mca_direct; do
type="`echo $item | cut -f1 -d-`"
comp="`echo $item | cut -f2- -d-`"
2015-02-03 09:19:22 +03:00
if test -z $type || test -z $comp ; then
2008-10-28 20:22:29 +03:00
AC_MSG_ERROR([*** The enable-mca-direct flag requires a
*** list of type-component pairs. Invalid input detected.])
else
str="`echo DIRECT_$type=$comp | sed s/-/_/g`"
eval $str
msg="$item $msg"
fi
done
IFS="$ifs_save"
fi
AC_MSG_RESULT([$msg])
unset msg
#
# Second, set the DSO_all and STATIC_all variables. conflict
# 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"; then
DSO_all=0
msg=none
2015-02-03 09:19:22 +03:00
elif test -z "$enable_mca_dso" || test "$enable_mca_dso" = "yes"; then
2008-10-28 20:22:29 +03:00
DSO_all=1
msg=all
elif test "$enable_mca_dso" = "no"; then
DSO_all=0
msg=none
2017-09-23 02:02:57 +03:00
enable_dlopen=no
2008-10-28 20:22:29 +03:00
else
DSO_all=0
ifs_save="$IFS"
IFS="${IFS}$PATH_SEPARATOR,"
msg=
for item in $enable_mca_dso; do
str="`echo DSO_$item=1 | sed s/-/_/g`"
eval $str
msg="$item $msg"
done
IFS="$ifs_save"
fi
AC_MSG_RESULT([$msg])
unset msg
if test "$enable_static" != "no"; then
AC_MSG_WARN([*** Shared libraries have been disabled (--disable-shared)])
AC_MSG_WARN([*** Building MCA components as DSOs automatically disabled])
fi
AC_MSG_CHECKING([which components should be static])
if test "$enable_mca_static" = "yes"; then
STATIC_all=1
msg=all
2015-02-03 09:19:22 +03:00
elif test -z "$enable_mca_static" || test "$enable_mca_static" = "no"; then
2008-10-28 20:22:29 +03:00
STATIC_all=0
msg=none
else
STATIC_all=0
ifs_save="$IFS"
IFS="${IFS}$PATH_SEPARATOR,"
msg=
for item in $enable_mca_static; do
str="`echo STATIC_$item=1 | sed s/-/_/g`"
eval $str
msg="$item $msg"
done
IFS="$ifs_save"
fi
AC_MSG_RESULT([$msg])
unset msg
AC_MSG_CHECKING([for projects containing MCA frameworks])
AC_MSG_RESULT([mca_project_list])
# if there isn't a project list, abort
m4_ifdef([mca_project_list], [],
2010-09-18 03:04:06 +04:00
[m4_fatal([Could not find project list - please rerun autogen.pl!])])
2008-10-28 20:22:29 +03:00
2014-01-04 02:35:20 +04:00
# now configure all the projects, frameworks, and components. Most
2008-10-28 20:22:29 +03:00
# of the hard stuff is in here
MCA_PROJECT_SUBDIRS=
2018-05-17 20:11:12 +03:00
MCA_PROJECT_DIST_SUBDIRS=
2015-02-09 22:45:54 +03:00
m4_foreach(mca_project, [mca_project_list],
2018-04-09 18:44:48 +03:00
[# BWB: Until projects have separate configure scripts
2013-01-28 05:29:23 +04:00
# and can skip running all of ORTE, just avoid recursing
# into orte sub directory if orte disabled
2015-02-03 09:19:22 +03:00
if (test "mca_project" = "ompi" && test "$enable_mpi" != "no") || test "mca_project" = "opal" || test "mca_project" = "orte" || test "mca_project" = "oshmem"; then
2013-01-28 05:29:23 +04:00
MCA_PROJECT_SUBDIRS="$MCA_PROJECT_SUBDIRS mca_project"
2018-05-17 20:11:12 +03:00
MCA_PROJECT_DIST_SUBDIRS="$MCA_PROJECT_DIST_SUBDIRS mca_project"
2013-01-28 05:29:23 +04:00
fi
2008-10-28 20:22:29 +03:00
MCA_CONFIGURE_PROJECT(mca_project)])
AC_SUBST(MCA_PROJECT_SUBDIRS)
2018-05-17 20:11:12 +03:00
AC_SUBST(MCA_PROJECT_DIST_SUBDIRS)
2013-01-29 04:00:43 +04:00
m4_undefine([mca_component_configure_active])
2008-10-28 20:22:29 +03:00
])
######################################################################
#
# MCA_CONFIGURE_PROJECT
#
# Configure all frameworks inside the given project name. Assumes that
# the frameworks are located in [project_name]/mca/[frameworks] and that
# there is an m4_defined list named mca_[project]_framework_list with
# the list of frameworks.
#
# USAGE:
# MCA_CONFIGURE_PROJECT(project_name)
#
######################################################################
AC_DEFUN([MCA_CONFIGURE_PROJECT],[
# can't use a variable rename here because these need to be evaled
# at auto* time.
2014-05-06 02:35:23 +04:00
opal_show_subtitle "Configuring MCA for $1"
2008-10-28 20:22:29 +03:00
AC_MSG_CHECKING([for frameworks for $1])
AC_MSG_RESULT([mca_$1_framework_list])
# iterate through the list of frameworks. There is something
# funky with m4 foreach if the list is defined, but empty. It
# will call the 3rd argument once with an empty value for the
# first argument. Protect against calling MCA_CONFIGURE_FRAMEWORK
# with an empty second argument. Grrr....
# if there isn't a project list, abort
#
# Also setup two variables for Makefiles:
# MCA_project_FRAMEWORKS - list of frameworks in that project
# MCA_project_FRAMEWORK_LIBS - list of libraries (or variables pointing
# to more libraries) that must be included
# in the project's main library
2015-02-09 22:45:54 +03:00
m4_ifdef([mca_$1_framework_list], [],
2010-09-18 03:04:06 +04:00
[m4_fatal([Could not find mca_$1_framework_list - please rerun autogen.pl])])
2008-10-28 20:22:29 +03:00
MCA_$1_FRAMEWORKS=
MCA_$1_FRAMEWORKS_SUBDIRS=
MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS=
MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS=
MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS=
MCA_$1_FRAMEWORK_LIBS=
2010-09-18 03:04:06 +04:00
2008-10-28 20:22:29 +03:00
m4_foreach(mca_framework, [mca_$1_framework_list],
2015-02-09 22:45:54 +03:00
[m4_ifval(mca_framework,
2010-09-18 03:04:06 +04:00
[dnl common has to go up front
m4_if(mca_framework, [common],
[MCA_$1_FRAMEWORKS="mca_framework $MCA_$1_FRAMEWORKS"
MCA_$1_FRAMEWORKS_SUBDIRS="[mca/]mca_framework $MCA_$1_FRAMEWORKS_SUBDIRS"
MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS="[\$(MCA_]$1[_]mca_framework[_ALL_SUBDIRS)] $MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS"
MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS="[\$(MCA_]$1[_]mca_framework[_DSO_SUBDIRS)] $MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS"
MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS="[\$(MCA_]$1[_]mca_framework[_STATIC_SUBDIRS)] $MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS"
], [
MCA_$1_FRAMEWORKS="$MCA_$1_FRAMEWORKS mca_framework"
MCA_$1_FRAMEWORKS_SUBDIRS="$MCA_$1_FRAMEWORKS_SUBDIRS [mca/]mca_framework"
MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS="$MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS [\$(MCA_]$1[_]mca_framework[_ALL_SUBDIRS)]"
MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS="$MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS [\$(MCA_]$1[_]mca_framework[_DSO_SUBDIRS)]"
MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS="$MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS [\$(MCA_]$1[_]mca_framework[_STATIC_SUBDIRS)]"
MCA_$1_FRAMEWORK_LIBS="$MCA_$1_FRAMEWORK_LIBS [mca/]mca_framework[/libmca_]mca_framework[.la]"])
MCA_$1_FRAMEWORK_LIBS="$MCA_$1_FRAMEWORK_LIBS [\$(MCA_]$1[_]mca_framework[_STATIC_LTLIBS)]"
m4_ifdef([MCA_]$1[_]mca_framework[_CONFIG],
[MCA_]$1[_]mca_framework[_CONFIG]($1, mca_framework),
2008-10-28 20:22:29 +03:00
[MCA_CONFIGURE_FRAMEWORK($1, mca_framework, 1)])])])
2013-01-29 04:00:43 +04:00
# note that mca_wrapper_extra_* is a running list, and we take checkpoints at the end of our project
$1_mca_wrapper_extra_cppflags="$mca_wrapper_extra_cppflags"
$1_mca_wrapper_extra_ldflags="$mca_wrapper_extra_ldflags"
$1_mca_wrapper_extra_libs="$mca_wrapper_extra_libs"
2008-10-28 20:22:29 +03:00
AC_SUBST(MCA_$1_FRAMEWORKS)
AC_SUBST(MCA_$1_FRAMEWORKS_SUBDIRS)
AC_SUBST(MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS)
AC_SUBST(MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS)
AC_SUBST(MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS)
AC_SUBST(MCA_$1_FRAMEWORK_LIBS)
])
2010-09-18 03:04:06 +04:00
# MCA_ORDER_COMPONENT_LIST(project_name, framework_name)
AC_DEFUN([MCA_ORDER_COMPONENT_LIST], [
m4_foreach(mca_component, [mca_$1_$2_m4_config_component_list],
[m4_ifval(mca_component,
2015-02-09 22:45:54 +03:00
[m4_ifdef([MCA_]$1[_]$2[_]mca_component[_PRIORITY], [],
2010-09-18 03:04:06 +04:00
[m4_fatal([MCA_$1_$2_]mca_component[_PRIORITY not found, but required.])])])])
2015-02-09 22:45:54 +03:00
m4_define([component_list],
2014-05-06 07:20:16 +04:00
[esyscmd([config/opal_mca_priority_sort.pl] m4_foreach([mca_component], [mca_$1_$2_m4_config_component_list],
2014-05-08 01:48:53 +04:00
[m4_ifval(mca_component, [mca_component ]OPAL_EVAL_ARG([MCA_]$1[_]$2[_]mca_component[_PRIORITY ]))]))])
2010-09-18 03:04:06 +04:00
])
AC_DEFUN([MCA_CHECK_IGNORED_PRIORITY], [
m4_foreach(mca_component, [mca_$1_$2_m4_config_component_list],
[m4_ifval(mca_component,
[m4_ifdef([MCA_]$1[_]$2[_]mca_component[_PRIORITY],
[m4_warn([unsupported], [MCA_]$1[_]$2[_]mca_component[_PRIORITY found, but ignored.])])])])
])
2008-10-28 20:22:29 +03:00
######################################################################
#
# MCA_CONFIGURE_FRAMEWORK
#
# Configure the given framework and all components inside the
# framework. Assumes that the framework is located in
# [project_name]/mca/[framework], and that all components are
# available under the framework directory. Will configure all
# no-configure and builtin components, then search for components with
# configure scripts. Assumes that no component is marked as builtin
# AND has a configure script.
#
# USAGE:
# MCA_CONFIGURE_PROJECT(project_name, framework_name, allow_succeed)
#
######################################################################
AC_DEFUN([MCA_CONFIGURE_FRAMEWORK],[
2014-05-07 19:45:47 +04:00
opal_show_subsubtitle "Configuring MCA framework $2"
2008-10-28 20:22:29 +03:00
2015-02-09 22:45:54 +03:00
m4_ifdef([mca_$1_$2_no_config_component_list], [],
2010-09-18 03:04:06 +04:00
[m4_fatal([Could not find mca_$1_$2_no_config_component_list - please rerun autogen.pl])])
2015-02-09 22:45:54 +03:00
m4_ifdef([mca_$1_$2_m4_config_component_list], [],
2010-09-18 03:04:06 +04:00
[m4_fatal([Could not find mca_$1_$2_m4_config_component_list - please rerun autogen.pl])])
2008-10-28 20:22:29 +03:00
# setup for framework
all_components=
static_components=
dso_components=
static_ltlibs=
# Ensure that the directory where the #include file is to live
# exists. Need to do this for VPATH builds, because the directory
# may not exist yet. For the "common" type, it's not really a
# component, so it doesn't have a base.
2010-09-18 03:04:06 +04:00
m4_if([$2], [common], [outdir=$1/mca/common], [outdir=$1/mca/$2/base])
2008-10-28 20:22:29 +03:00
AS_MKDIR_P([$outdir])
2010-09-18 03:04:06 +04:00
# emit Makefile rule
AC_CONFIG_FILES([$1/mca/$2/Makefile])
2008-10-28 20:22:29 +03:00
# remove any previously generated #include files
outfile_real=$outdir/static-components.h
outfile=$outfile_real.new
rm -f $outfile $outfile.struct $outfile.extern
touch $outfile.struct $outfile.extern
# print some nice messages about what we're about to do...
AC_MSG_CHECKING([for no configure components in framework $2])
2010-09-18 03:04:06 +04:00
AC_MSG_RESULT([mca_$1_$2_no_config_component_list])
2008-10-28 20:22:29 +03:00
AC_MSG_CHECKING([for m4 configure components in framework $2])
2010-09-18 03:04:06 +04:00
AC_MSG_RESULT([mca_$1_$2_m4_config_component_list])
# If there are components in the no configure list, but we're
# doing one of the "special" selection logics, abort with a
# reasonable message.
2014-05-08 01:48:53 +04:00
m4_if(OPAL_EVAL_ARG([MCA_$1_$2_CONFIGURE_MODE]), [STOP_AT_FIRST],
2010-09-18 03:04:06 +04:00
[m4_ifval(mca_$1_$2_no_config_component_list,
2008-10-28 20:22:29 +03:00
[m4_fatal([Framework $2 using STOP_AT_FIRST but at least one component has no configure.m4])])])
2014-05-08 01:48:53 +04:00
m4_if(OPAL_EVAL_ARG([MCA_$1_$2_CONFIGURE_MODE]), [STOP_AT_FIRST_PRIORITY],
2010-09-18 03:04:06 +04:00
[m4_ifval(mca_$1_$2_no_config_component_list,
2009-01-03 04:03:28 +03:00
[m4_fatal([Framework $2 using STOP_AT_FIRST_PRIORITY but at least one component has no configure.m4])])])
2014-05-08 01:48:53 +04:00
m4_if(OPAL_EVAL_ARG([MCA_$1_$2_CONFIGURE_MODE]), [PRIORITY],
2010-10-28 05:03:16 +04:00
[m4_ifval(mca_$1_$2_no_config_component_list,
[m4_fatal([Framework $2 using PRIORITY but at least one component has no configure.m4])])])
2010-09-18 03:04:06 +04:00
# run the configure logic for the no-config components
m4_foreach(mca_component, [mca_$1_$2_no_config_component_list],
2008-10-28 20:22:29 +03:00
[m4_ifval(mca_component,
2015-02-09 22:45:54 +03:00
[MCA_CONFIGURE_NO_CONFIG_COMPONENT($1, $2, mca_component,
2008-10-28 20:22:29 +03:00
[all_components],
[static_components],
[dso_components],
[static_ltlibs],
[$3])])])
2010-09-18 03:04:06 +04:00
# configure components that use built-in configuration scripts
m4_ifdef([component_list], [m4_undefine([component_list])])
2014-05-08 01:48:53 +04:00
m4_if(OPAL_EVAL_ARG([MCA_$1_$2_CONFIGURE_MODE]), [STOP_AT_FIRST], [MCA_ORDER_COMPONENT_LIST($1, $2)],
[m4_if(OPAL_EVAL_ARG([MCA_$1_$2_CONFIGURE_MODE]), [STOP_AT_FIRST_PRIORITY], [MCA_ORDER_COMPONENT_LIST($1, $2)],
[m4_if(OPAL_EVAL_ARG([MCA_$1_$2_CONFIGURE_MODE]), [PRIORITY], [MCA_ORDER_COMPONENT_LIST($1, $2)],
2010-10-28 05:03:16 +04:00
[m4_define([component_list], [mca_$1_$2_m4_config_component_list])])])])
2010-09-18 03:04:06 +04:00
2008-10-28 20:22:29 +03:00
best_mca_component_priority=0
components_looking_for_succeed=$3
components_last_result=0
2010-09-18 03:04:06 +04:00
m4_foreach(mca_component, [component_list],
2008-10-28 20:22:29 +03:00
[m4_ifval(mca_component,
2014-05-08 01:48:53 +04:00
[m4_if(OPAL_EVAL_ARG([MCA_$1_$2_CONFIGURE_MODE]), [STOP_AT_FIRST_PRIORITY],
2010-09-18 03:04:06 +04:00
[AS_IF([test $best_mca_component_priority -gt MCA_$1_$2_]mca_component[_PRIORITY], [components_looking_for_succeed=0])])
2015-02-09 22:45:54 +03:00
MCA_CONFIGURE_M4_CONFIG_COMPONENT($1, $2, mca_component,
2008-10-28 20:22:29 +03:00
[all_components],
[static_components],
[dso_components],
[static_ltlibs],
[$components_looking_for_succeed],
[components_last_result=1],
[components_last_result=0])
2014-05-08 01:48:53 +04:00
m4_if(OPAL_EVAL_ARG([MCA_$1_$2_CONFIGURE_MODE]), [STOP_AT_FIRST],
2008-10-28 20:22:29 +03:00
[AS_IF([test $components_last_result -eq 1], [components_looking_for_succeed=0])])
2014-05-08 01:48:53 +04:00
m4_if(OPAL_EVAL_ARG([MCA_$1_$2_CONFIGURE_MODE]), [STOP_AT_FIRST_PRIORITY],
[AS_IF([test $components_last_result -eq 1], [best_mca_component_priority=]OPAL_EVAL_ARG([MCA_$1_$2_]mca_component[_PRIORITY]))])
2010-09-18 03:04:06 +04:00
])])
2008-10-28 20:22:29 +03:00
# configure components that provide their own configure script.
# It would be really hard to run these for "find first that
# works", so we don't :)
2014-05-08 01:48:53 +04:00
m4_if(OPAL_EVAL_ARG([MCA_$1_]$2[_CONFIGURE_MODE]), [STOP_AT_FIRST], [],
[m4_if(OPAL_EVAL_ARG([MCA_$1_]$2[_CONFIGURE_MODE]), [STOP_AT_FIRST_PRIORITY], [],
[m4_if(OPAL_EVAL_ARG([MCA_$1_]$2[_CONFIGURE_MODE]), [PRIORITY], [],
2010-09-18 03:04:06 +04:00
[MCA_CHECK_IGNORED_PRIORITY($1, $2)
AS_IF([test "$3" != "0"],
2008-10-28 20:22:29 +03:00
[MCA_CONFIGURE_ALL_CONFIG_COMPONENTS($1, $2, [all_components],
[static_components], [dso_components],
2010-10-28 05:03:16 +04:00
[static_ltlibs])])])])])
2008-10-28 20:22:29 +03:00
2010-09-18 03:04:06 +04:00
MCA_$1_$2_ALL_COMPONENTS="$all_components"
MCA_$1_$2_STATIC_COMPONENTS="$static_components"
MCA_$1_$2_DSO_COMPONENTS="$dso_components"
MCA_$1_$2_STATIC_LTLIBS="$static_ltlibs"
2008-10-28 20:22:29 +03:00
2010-09-18 03:04:06 +04:00
AC_SUBST(MCA_$1_$2_ALL_COMPONENTS)
AC_SUBST(MCA_$1_$2_STATIC_COMPONENTS)
AC_SUBST(MCA_$1_$2_DSO_COMPONENTS)
AC_SUBST(MCA_$1_$2_STATIC_LTLIBS)
2008-10-28 20:22:29 +03:00
2014-05-08 01:48:53 +04:00
OPAL_MCA_MAKE_DIR_LIST(MCA_$1_$2_ALL_SUBDIRS, $2, [$all_components])
OPAL_MCA_MAKE_DIR_LIST(MCA_$1_$2_STATIC_SUBDIRS, $2, [$static_components])
OPAL_MCA_MAKE_DIR_LIST(MCA_$1_$2_DSO_SUBDIRS, $2, [$dso_components])
2008-10-28 20:22:29 +03:00
# Create the final .h file that will be included in the type's
# top-level glue. This lists all the static components. We don't
# need to do this for "common".
if test "$2" != "common"; then
cat > $outfile <<EOF
/*
* \$HEADER\$
*/
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
`cat $outfile.extern`
const mca_base_component_t *mca_$2_base_static_components[[]] = {
`cat $outfile.struct`
NULL
};
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
EOF
# Only replace the header file if a) it doesn't previously
# exist, or b) the contents are different. Do this to not
# trigger recompilation of certain .c files just because the
# timestamp changed on $outfile_real (similar to the way AC
# handles AC_CONFIG_HEADER files).
diff $outfile $outfile_real > /dev/null 2>&1
if test "$?" != "0"; then
mv $outfile $outfile_real
else
rm -f $outfile
fi
fi
2015-02-09 22:45:54 +03:00
rm -f $outfile.struct $outfile.extern
2008-10-28 20:22:29 +03:00
unset all_components static_components dso_components outfile outfile_real
])
######################################################################
#
# MCA_CONFIGURE_NO_CONFIG_COMPONENT
#
# Configure the given framework and all components inside the framework.
# Assumes that the framework is located in [project_name]/mca/[framework],
# and that all components are available under the framework directory.
# Will configure all builtin components, then search for components with
# configure scripts. Assumes that no component is marked as builtin
# AND has a configure script.
#
# USAGE:
# MCA_CONFIGURE_PROJECT(project_name, framework_name, component_name
2015-02-09 22:45:54 +03:00
# all_components_variable,
2008-10-28 20:22:29 +03:00
# static_components_variable,
# dso_components_variable,
# static_ltlibs_variable,
# allowed_to_succeed)
#
######################################################################
AC_DEFUN([MCA_CONFIGURE_NO_CONFIG_COMPONENT],[
2014-05-07 19:51:20 +04:00
opal_show_subsubsubtitle "MCA component $2:$3 (no configuration)"
2008-10-28 20:22:29 +03:00
2014-12-03 04:50:44 +03:00
opal_show_verbose "OPAL_MCA_NO_CONFIG_COMPONENT: before, should_build=$8"
2015-02-09 22:45:54 +03:00
MCA_COMPONENT_BUILD_CHECK($1, $2, $3,
2008-10-28 20:22:29 +03:00
[should_build=$8], [should_build=0])
MCA_COMPONENT_COMPILE_MODE($1, $2, $3, compile_mode)
2014-12-03 04:50:44 +03:00
opal_show_verbose "OPAL_MCA_NO_CONFIG_COMPONENT: after, should_build=$should_build"
2008-10-28 20:22:29 +03:00
if test "$should_build" = "1" ; then
MCA_PROCESS_COMPONENT($1, $2, $3, $4, $5, $6, $7, $compile_mode)
else
MCA_PROCESS_DEAD_COMPONENT($1, $2, $3)
# add component to all component list
$4="$$4 $3"
fi
# set the AM_CONDITIONAL on how we should build
if test "$compile_mode" = "dso" ; then
2010-09-18 03:04:06 +04:00
BUILD_$1_$2_$3_DSO=1
2008-10-28 20:22:29 +03:00
else
2010-09-18 03:04:06 +04:00
BUILD_$1_$2_$3_DSO=0
2008-10-28 20:22:29 +03:00
fi
2010-09-18 03:04:06 +04:00
AM_CONDITIONAL(MCA_BUILD_$1_$2_$3_DSO, test "$BUILD_$1_$2_$3_DSO" = "1")
AC_CONFIG_FILES([$1/mca/$2/$3/Makefile])
2008-10-28 20:22:29 +03:00
unset compile_mode
])
######################################################################
#
# MCA_CONFIGURE_M4_CONFIG_COMPONENT
#
#
# USAGE:
# MCA_CONFIGURE_PROJECT(project_name, framework_name, component_name
2015-02-09 22:45:54 +03:00
# all_components_variable,
2008-10-28 20:22:29 +03:00
# static_components_variable,
# dso_components_variable,
# static_ltlibs_variable,
# allowed_to_succeed,
2015-02-09 22:45:54 +03:00
# [eval if should build],
2008-10-28 20:22:29 +03:00
# [eval if should not build])
#
######################################################################
AC_DEFUN([MCA_CONFIGURE_M4_CONFIG_COMPONENT],[
2010-09-18 03:04:06 +04:00
m4_ifdef([MCA_$1_$2_$3_PRIORITY],
2014-05-07 19:51:20 +04:00
[opal_show_subsubsubtitle "MCA component $2:$3 (m4 configuration macro, priority MCA_$1_$2_$3_PRIORITY)"],
[opal_show_subsubsubtitle "MCA component $2:$3 (m4 configuration macro)"])
2008-10-28 20:22:29 +03:00
2014-12-03 04:50:44 +03:00
opal_show_verbose "OPAL_MCA_M4_CONFIG_COMPONENT: before, should_build=$8"
2008-10-28 20:22:29 +03:00
MCA_COMPONENT_BUILD_CHECK($1, $2, $3, [should_build=$8], [should_build=0])
# Allow the component to override the build mode if it really wants to.
# It is, of course, free to end up calling MCA_COMPONENT_COMPILE_MODE
2010-09-18 03:04:06 +04:00
m4_ifdef([MCA_$1_$2_$3_COMPILE_MODE],
[MCA_$1_$2_$3_COMPILE_MODE($1, $2, $3, compile_mode)],
2008-10-28 20:22:29 +03:00
[MCA_COMPONENT_COMPILE_MODE($1, $2, $3, compile_mode)])
2015-02-09 22:44:00 +03:00
# try to configure the component
2010-09-18 03:04:06 +04:00
m4_ifdef([MCA_$1_$2_$3_CONFIG],
2015-02-09 22:45:54 +03:00
[MCA_$1_$2_$3_CONFIG([should_build=$should_build],
2010-09-18 03:04:06 +04:00
[should_build=0])],
[m4_fatal([MCA_$1_$2_$3_CONFIG macro not found])])
2014-12-03 04:50:44 +03:00
opal_show_verbose "OPAL_MCA_M4_CONFIG_COMPONENT: after, should_build=$should_build"
2008-10-28 20:22:29 +03:00
AS_IF([test "$should_build" = "1"],
[MCA_PROCESS_COMPONENT($1, $2, $3, $4, $5, $6, $7, $compile_mode)],
[MCA_PROCESS_DEAD_COMPONENT($1, $2, $3)
# add component to all component list
$4="$$4 $3"])
2010-09-18 03:04:06 +04:00
m4_ifdef([MCA_$1_$2_$3_POST_CONFIG],
2013-01-29 04:00:43 +04:00
[ MCA_$1_$2_$3_POST_CONFIG($should_build)])
2008-10-28 20:22:29 +03:00
# set the AM_CONDITIONAL on how we should build
2015-02-09 22:45:54 +03:00
AS_IF([test "$compile_mode" = "dso"],
2010-09-18 03:04:06 +04:00
[BUILD_$1_$2_$3_DSO=1],
[BUILD_$1_$2_$3_DSO=0])
AM_CONDITIONAL(MCA_BUILD_$1_$2_$3_DSO, test "$BUILD_$1_$2_$3_DSO" = "1")
2008-10-28 20:22:29 +03:00
AS_IF([test "$should_build" = "1"], [$9], [$10])
unset compile_mode
])
######################################################################
#
# MCA_CONFIGURE_ALL_CONFIG_COMPONENTS
#
# configure all components in the given framework that have configure
# scripts and should be configured according to the usual rules...
#
# USAGE:
2015-02-09 22:45:54 +03:00
# MCA_CONFIGURE_ALL_CONFIG_COMPONENTS(project_name,
2008-10-28 20:22:29 +03:00
# framework_name,
2015-02-09 22:45:54 +03:00
# all_components_variable,
2008-10-28 20:22:29 +03:00
# static_components_variable,
# dso_components_variable,
# static_ltlibs_variable)
#
######################################################################
AC_DEFUN([MCA_CONFIGURE_ALL_CONFIG_COMPONENTS],[
for component_path in $srcdir/$1/mca/$2/* ; do
component="`basename $component_path`"
2015-02-03 09:19:22 +03:00
if test -d $component_path && test -x $component_path/configure ; then
2014-05-07 19:51:20 +04:00
opal_show_subsubsubtitle "MCA component $2:$component (need to configure)"
2008-10-28 20:22:29 +03:00
2014-12-03 04:50:44 +03:00
opal_show_verbose "OPAL_MCA_ALL_CONFIG_COMPONENTS: before, should_build=$8"
2015-02-09 22:45:54 +03:00
MCA_COMPONENT_BUILD_CHECK($1, $2, $component,
2008-10-28 20:22:29 +03:00
[should_build=1], [should_build=0])
MCA_COMPONENT_COMPILE_MODE($1, $2, $component, compile_mode)
2014-12-03 04:50:44 +03:00
opal_show_verbose "OPAL_MCA_ALL_CONFIG_COMPONENTS: after, should_build=$should_build"
2008-10-28 20:22:29 +03:00
if test "$should_build" = "1" ; then
2014-05-06 20:27:38 +04:00
OPAL_CONFIG_SUBDIR([$1/mca/$2/$component],
2014-05-08 01:48:53 +04:00
[$opal_subdir_args],
2010-09-21 02:07:03 +04:00
[should_build=1], [should_build=0])
2014-12-03 04:50:44 +03:00
opal_show_verbose "OPAL_MCA_ALL_CONFIG_COMPONENTS: after subdir, should_build=$should_build"
2008-10-28 20:22:29 +03:00
fi
if test "$should_build" = "1" ; then
2013-01-29 04:00:43 +04:00
# do some extra work to pass flags back from the
# top-level configure, the way a configure.m4
# component would.
infile="$srcdir/$1/mca/$2/$3/post_configure.sh"
if test -f $infile; then
# First check for the ABORT tag
line="`$GREP ABORT= $infile | cut -d= -f2-`"
2015-02-03 09:19:22 +03:00
if test -n "$line" && test "$line" != "no"; then
2013-01-29 04:00:43 +04:00
AC_MSG_WARN([MCA component configure script told me to abort])
AC_MSG_ERROR([cannot continue])
fi
m4_foreach(flags, [LDFLAGS, LIBS],
[[line="`$GREP WRAPPER_EXTRA_]flags[= $infile | cut -d= -f2-`"]
eval "line=$line"
if test -n "$line"; then
$2[_]$3[_WRAPPER_EXTRA_]flags[="$line"]
fi
])dnl
fi
2008-10-28 20:22:29 +03:00
MCA_PROCESS_COMPONENT($1, $2, $component, $3, $4, $5, $6, $compile_mode)
else
MCA_PROCESS_DEAD_COMPONENT($1, $2, $component)
fi
fi
done
])
2013-01-29 04:00:43 +04:00
# MCA_COMPONENT_COMPILE_MODE(project_name (1), framework_name (2),
# component_name (3), compile_mode_variable (4))
# -------------------------------------------------------------------------
2008-10-28 20:22:29 +03:00
# set compile_mode_variable to the compile mode for the given component
#
# NOTE: component_name may not be determined until runtime....
AC_DEFUN([MCA_COMPONENT_COMPILE_MODE],[
2013-01-29 04:00:43 +04:00
SHARED_FRAMEWORK="$DSO_$2"
AS_LITERAL_IF([$3],
[SHARED_COMPONENT="$DSO_$2_$3"],
[str="SHARED_COMPONENT=\$DSO_$2_$3"
eval $str])
STATIC_FRAMEWORK="$STATIC_$2"
AS_LITERAL_IF([$3],
[STATIC_COMPONENT="$STATIC_$2_$3"],
[str="STATIC_COMPONENT=\$STATIC_$2_$3"
eval $str])
2008-10-28 20:22:29 +03:00
shared_mode_override=static
# Setup for either shared or static
2015-02-03 09:19:22 +03:00
if test "$STATIC_FRAMEWORK" = "1" || \
test "$STATIC_COMPONENT" = "1" || \
test "$STATIC_all" = "1" ; then
2008-10-28 20:22:29 +03:00
$4="static"
2015-02-03 09:19:22 +03:00
elif test "$shared_mode_override" = "dso" || \
test "$SHARED_FRAMEWORK" = "1" || \
test "$SHARED_COMPONENT" = "1" || \
test "$DSO_all" = "1"; then
2008-10-28 20:22:29 +03:00
$4="dso"
else
$4="static"
fi
2013-01-29 04:00:43 +04:00
AC_MSG_CHECKING([for MCA component $2:$3 compile mode])
if test "$DIRECT_$2" = "$3" ; then
2008-10-28 20:22:29 +03:00
AC_MSG_RESULT([$$4 - direct])
else
AC_MSG_RESULT([$$4])
fi
])
2013-01-29 04:00:43 +04:00
# MCA_PROCESS_COMPONENT(project_name(1), framework_name (2), component_name (3),
# all_components_variable (4), static_components_variable (5)
# dso_components_variable (6), static_ltlibs_variable (7),
# compile_mode_variable (8))
#---------------------------------------------------------------------
# Final setup work for a given component. It should be known before
2008-10-28 20:22:29 +03:00
# calling that this component can build properly (and exists)
#
# NOTE: component_name may not be determined until runtime....
AC_DEFUN([MCA_PROCESS_COMPONENT],[
AC_REQUIRE([AC_PROG_GREP])
# See if it dropped an output file for us to pick up some
2015-02-09 22:45:54 +03:00
# shell variables in.
2013-01-29 04:00:43 +04:00
infile="$srcdir/$1/mca/$2/$3/post_configure.sh"
2008-10-28 20:22:29 +03:00
# Add this subdir to the mast list of all MCA component subdirs
2013-01-29 04:00:43 +04:00
$4="$$4 $3"
2008-10-28 20:22:29 +03:00
if test "$8" = "dso" ; then
2013-01-29 04:00:43 +04:00
$6="$$6 $3"
2008-10-28 20:22:29 +03:00
else
2014-10-29 03:13:14 +03:00
if test "$2" = "common"; then
# Static libraries in "common" frameworks are installed, and
# therefore must obey the $FRAMEWORK_LIB_PREFIX that was
# set.
$7="mca/$2/$3/lib${m4_translit([$1], [a-z], [A-Z])_LIB_PREFIX}mca_$2_$3.la $$7"
else
# Other frameworks do not have to obey the
# $FRAMEWORK_LIB_PREFIX prefix.
$7="mca/$2/$3/libmca_$2_$3.la $$7"
fi
2013-01-29 04:00:43 +04:00
echo "extern const mca_base_component_t mca_$2_$3_component;" >> $outfile.extern
echo " &mca_$2_$3_component, " >> $outfile.struct
$5="$$5 $3"
2008-10-28 20:22:29 +03:00
fi
# Output pretty results
2013-01-29 04:00:43 +04:00
AC_MSG_CHECKING([if MCA component $2:$3 can compile])
2008-10-28 20:22:29 +03:00
AC_MSG_RESULT([yes])
2015-02-09 22:45:54 +03:00
2013-01-29 04:00:43 +04:00
dnl BWB: FIX ME: We still use the post_configure.sh for frameworks that use the direct call infrastructure.
dnl All other uses we can ignore here, because config_components will have read it in and set all the
dnl proper environment variables. At some point, we should handle the direct call stuff the same way we
dnl handle the headers for static components like timers in opal, ie, have a framework level configure.m4 that
dnl does the right thing
2008-10-28 20:22:29 +03:00
if test -f $infile; then
2013-01-29 04:00:43 +04:00
# check for direct call header to include. This will be
# AC_SUBSTed later.
if test "$DIRECT_$2" = "$3" ; then
2008-10-28 20:22:29 +03:00
if test "`$GREP DIRECT_CALL_HEADER $infile`" != "" ; then
line="`$GREP DIRECT_CALL_HEADER $infile | cut -d= -f2-`"
2013-01-29 04:00:43 +04:00
str="MCA_$1_$2_DIRECT_CALL_HEADER=$line"
2008-10-28 20:22:29 +03:00
eval $str
else
2013-01-29 04:00:43 +04:00
AC_MSG_ERROR([*** $2 component $3 was supposed to be direct-called, but
2008-10-28 20:22:29 +03:00
*** does not appear to support direct calling.
*** Aborting])
fi
fi
else
2015-02-09 22:45:54 +03:00
# were we supposed to have found something in the
2008-10-28 20:22:29 +03:00
# post_configure.sh, but the file didn't exist?