1# Copyright © 2012 Inria. All rights reserved. 2# See COPYING in top-level directory. 3 4 5# HWLOC_PREPARE_FILTER_COMPONENTS 6# 7# Given a comma-separated list of names, define hwloc_<name>_component_maybeplugin=1. 8# 9# $1 = command-line given list of components to build as plugins 10# 11AC_DEFUN([HWLOC_PREPARE_FILTER_COMPONENTS], [ 12 for name in `echo [$1] | sed -e 's/,/ /g'` ; do 13 str="hwloc_${name}_component_wantplugin=1" 14 eval $str 15 done 16]) 17 18 19# HWLOC_FILTER_COMPONENTS 20# 21# For each component in hwloc_components, 22# check if hwloc_<name>_component_wantplugin=1 or enable_plugin=yes, 23# and check if hwloc_<name>_component_maybeplugin=1. 24# Add <name> to hwloc_[static|plugin]_components accordingly. 25# And set hwloc_<name>_component=[static|plugin] accordingly. 26# 27AC_DEFUN([HWLOC_FILTER_COMPONENTS], [ 28for name in $hwloc_components ; do 29 str="maybeplugin=\$hwloc_${name}_component_maybeplugin" 30 eval $str 31 str="wantplugin=\$hwloc_${name}_component_wantplugin" 32 eval $str 33 if test x$hwloc_have_plugins = xyes && test x$maybeplugin = x1 && test x$wantplugin = x1 -o x$enable_plugins = xyes; then 34 hwloc_plugin_components="$hwloc_plugin_components $name" 35 str="hwloc_${name}_component=plugin" 36 else 37 hwloc_static_components="$hwloc_static_components $name" 38 str="hwloc_${name}_component=static" 39 fi 40 eval $str 41done 42]) 43 44 45# HWLOC_LIST_STATIC_COMPONENTS 46# 47# Append to file $1 an array of components by listing component names in $2. 48# 49# $1 = filename 50# $2 = list of component names 51# 52AC_DEFUN([HWLOC_LIST_STATIC_COMPONENTS], [ 53for comp in [$2]; do 54 echo "HWLOC_DECLSPEC extern const struct hwloc_component hwloc_${comp}_component;" >>[$1] 55done 56cat <<EOF >>[$1] 57static const struct hwloc_component * hwloc_static_components[[]] = { 58EOF 59for comp in [$2]; do 60 echo " &hwloc_${comp}_component," >>[$1] 61done 62cat <<EOF >>[$1] 63 NULL 64}; 65EOF 66]) 67