From 82c93611e6fec7b02e7e1c8df314817cef17bad0 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 21 Sep 2011 23:06:13 +0000 Subject: [PATCH] Fix some problems with the libevent and hwloc frameworks: * change components from setting _base_include to opal___include; the framework m4 will figure out the winning component and pick the right "include" shell variable. Ditto for the other shell variables (cppflags, ldflags, etc.). * misc fixes to hwloc/external * add a bunch of missing "opal_" prefixes to shell variables * add a few more / update a few comments in framework m4's This commit was SVN r25174. --- opal/mca/event/configure.m4 | 48 ++++++++---- opal/mca/event/libevent2013/.ompi_unignore | 1 + opal/mca/event/libevent2013/configure.m4 | 8 +- opal/mca/event/libevent207/configure.m4 | 8 +- opal/mca/hwloc/configure.m4 | 78 +++++++++++++------ opal/mca/hwloc/external/configure.m4 | 23 +++++- .../hwloc/external/hwloc_external_component.c | 12 ++- opal/mca/hwloc/hwloc121/configure.m4 | 10 +-- 8 files changed, 132 insertions(+), 56 deletions(-) diff --git a/opal/mca/event/configure.m4 b/opal/mca/event/configure.m4 index 3a8c68a0e4..34a9524ca9 100644 --- a/opal/mca/event/configure.m4 +++ b/opal/mca/event/configure.m4 @@ -1,6 +1,6 @@ dnl -*- shell-script -*- dnl -dnl Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -11,13 +11,15 @@ dnl # There will only be one component used in this framework, and it will # be selected at configure time by priority. Components must set # their priorities in their configure.m4 files. They must also set -# the shell variable $event_base_include to a header file name -# (relative to the top OMPI source directory) that will be included in -# opal/mca/event/event.h. Optionally, components may also set the -# shell variable $event_base_include_cppflags if additional CPPFLAGS -# must be used with this header file. The event framework will add -# the winning component's $event_base_include_cppflags to the global -# $CPPFLAGS. +# the shell variable $opal_event__include to a header file +# name (relative to opal/mca/event) that will be included in +# opal/mca/event/event.h. + +# Optionally, components may also set the shell variable +# $opal_event__include_cppflags if additional CPPFLAGS must +# be used with this header file. The event framework will add the +# winning component's $opal_event__include_cppflags to the +# global $CPPFLAGS. dnl We only want one winning component. m4_define(MCA_opal_event_CONFIGURE_MODE, STOP_AT_FIRST_PRIORITY) @@ -33,6 +35,16 @@ AC_DEFUN([MCA_opal_event_CONFIG],[ [AC_MSG_WARN([Did not find a suitable static opal event component]) AC_MSG_ERROR([Cannot continue])]) + # If there's any spaces in the middle of the string, then we found + # more than 1 eligible static component. That's no good (and + # should never happen, but let's be sure)! + opal_event_winner=`echo $MCA_opal_event_STATIC_COMPONENTS | sed -e 's/^[ ]+//' | sed -e 's/[ ]+$//'` + + AS_IF([test "`echo $opal_event_winner | sed 's/ //'`" != "$opal_event_winner"], + [AC_MSG_WARN([Found more than 1 eligible static opal event component]) + AC_MSG_WARN([This should never happen!]) + AC_MSG_ERROR([Cannot continue])]) + # We need to find out what the underlying component set # HAVE_WORKING_EVENTOPS was set to. This is for systems that # don't have working poll(), etc. (e.g., Cray) -- we still need an @@ -51,17 +63,23 @@ AC_DEFUN([MCA_opal_event_CONFIG],[ [$OPAL_HAVE_WORKING_EVENTOPS], [Whether our event component has working event operations or not (if not, then assumedly it only has working timers and signals)]) - # someone should have set this... - AS_IF([test "$event_base_include" = ""], - [AC_MSG_WARN([Missing implementation header]) + # The winning component will have told us where their header file + # is located + AC_MSG_CHECKING([for winning event component header file]) + eval "opal_event_base_include=\`echo \$opal_event_${opal_event_winner}_include\`" + AS_IF([test "$opal_event_base_include" = ""], + [AC_MSG_RESULT([missing]) + AC_MSG_WARN([Missing implementation header]) AC_MSG_ERROR([Cannot continue])]) + AC_MSG_RESULT([$opal_event_base_include]) AC_DEFINE_UNQUOTED([MCA_event_IMPLEMENTATION_HEADER], - ["opal/mca/event/$event_base_include"], + ["opal/mca/event/$opal_event_base_include"], [Header to include for event implementation]) AC_MSG_CHECKING([for winning component additional CPPFLAGS]) - AS_IF([test "$event_base_include_cppflags" != ""], - [AC_MSG_RESULT([$event_base_include_cppflags]) - CPPFLAGS="$CPPFLAGS $event_base_include_cppflags"], + eval "opal_event_base_include_cppflags=\`echo \$opal_event_${opal_event_winner}_include_cppflags\`" + AS_IF([test "$opal_event_base_include_cppflags" != ""], + [AC_MSG_RESULT([$opal_event_base_include_cppflags]) + CPPFLAGS="$CPPFLAGS $opal_event_base_include_cppflags"], [AC_MSG_RESULT([none])]) ]) diff --git a/opal/mca/event/libevent2013/.ompi_unignore b/opal/mca/event/libevent2013/.ompi_unignore index cc2139240d..b173e86852 100644 --- a/opal/mca/event/libevent2013/.ompi_unignore +++ b/opal/mca/event/libevent2013/.ompi_unignore @@ -1,2 +1,3 @@ +jsquyres rhc hjelmn diff --git a/opal/mca/event/libevent2013/configure.m4 b/opal/mca/event/libevent2013/configure.m4 index d07a85557f..ff399f85e5 100644 --- a/opal/mca/event/libevent2013/configure.m4 +++ b/opal/mca/event/libevent2013/configure.m4 @@ -1,6 +1,6 @@ # -*- shell-script -*- # -# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved. # # $COPYRIGHT$ # @@ -169,16 +169,16 @@ EOF # Must set this variable so that the framework m4 knows # what file to include in opal/mca/event/event.h - event_base_include="libevent2013/libevent2013.h" + opal_event_libevent2013_include="libevent2013/libevent2013.h" # We also set _cppflags so that when including # libevent2013.h, it can find all the actual libevent files. # Be a little friendly and only include the -I for the # builddir if it's different than the srcdir. file=$basedir/libevent - event_base_include_cppflags="-I$OMPI_TOP_SRCDIR/$file -I$OMPI_TOP_SRCDIR/$file/include" + opal_event_libevent2013_include_cppflags="-I$OMPI_TOP_SRCDIR/$file -I$OMPI_TOP_SRCDIR/$file/include" AS_IF([test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"], - [event_base_include_cppflags="$event_base_include_cppflags -I$OMPI_TOP_BUILDDIR/$file/include"]) + [opal_event_libevent2013_include_cppflags="$opal_event_libevent2013_include_cppflags -I$OMPI_TOP_BUILDDIR/$file/include"]) if test "$with_devel_headers" = "yes" ; then WRAPPER_EXTRA_CPPFLAGS="$WRAPPER_EXTRA_CPPFLAGS "'-I${includedir}/openmpi/opal/mca/event/libevent2013/libevent -I${includedir}/openmpi/opal/mca/event/libevent2013/libevent/include' fi diff --git a/opal/mca/event/libevent207/configure.m4 b/opal/mca/event/libevent207/configure.m4 index fbcc219eb0..e941fcaac6 100644 --- a/opal/mca/event/libevent207/configure.m4 +++ b/opal/mca/event/libevent207/configure.m4 @@ -1,6 +1,6 @@ # -*- shell-script -*- # -# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved. # # $COPYRIGHT$ # @@ -169,16 +169,16 @@ EOF # Must set this variable so that the framework m4 knows # what file to include in opal/mca/event/event.h - event_base_include="libevent207/libevent207.h" + opal_event_libevent207_include="libevent207/libevent207.h" # We also set _cppflags so that when including # libevent207.h, it can find all the actual libevent files. # Be a little friendly and only include the -I for the # builddir if it's different than the srcdir. file=$basedir/libevent - event_base_include_cppflags="-I$OMPI_TOP_SRCDIR/$file -I$OMPI_TOP_SRCDIR/$file/include" + opal_event_libevent207_include_cppflags="-I$OMPI_TOP_SRCDIR/$file -I$OMPI_TOP_SRCDIR/$file/include" AS_IF([test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"], - [event_base_include_cppflags="$event_base_include_cppflags -I$OMPI_TOP_BUILDDIR/$file/include"]) + [opal_event_libevent207_include_cppflags="$opal_event_libevent207_include_cppflags -I$OMPI_TOP_BUILDDIR/$file/include"]) if test "$with_devel_headers" = "yes" ; then WRAPPER_EXTRA_CPPFLAGS="$WRAPPER_EXTRA_CPPFLAGS "'-I${includedir}/openmpi/opal/mca/event/libevent207/libevent -I${includedir}/openmpi/opal/mca/event/libevent207/libevent/include' fi diff --git a/opal/mca/hwloc/configure.m4 b/opal/mca/hwloc/configure.m4 index 3ca1f45c3d..3ab2358fa8 100644 --- a/opal/mca/hwloc/configure.m4 +++ b/opal/mca/hwloc/configure.m4 @@ -11,14 +11,19 @@ dnl # There will only be one component used in this framework, and it will # be selected at configure time by priority. Components must set # their priorities in their configure.m4 files. They must also set -# the shell variable $hwloc_base_include to a header file name -# (relative to the top OMPI source directory) that will be included in -# opal/mca/hwloc/hwloc.h. Optionally, components may also set the -# shell variable $hwloc_base_cppflags if additional CPPFLAGS must be -# used with this header file, and $hwloc_base_ldflags and -# $hwloc_base_libs. The hwloc framework will add the winning -# component's $hwloc_base_* to CPPFLAGS, LDFLAGS, and LIBS, -# respectively. +# the shell variable $opal_hwloc__include to a header file +# name (relative to the top OMPI source directory) that will be +# included in opal/mca/hwloc/hwloc.h. + +# Optionally, components may also set the shell variable +# $opal_hwloc__cppflags if additional CPPFLAGS must be used +# with this header file, and $opal_hwloc__ldflags and +# $opal_hwloc__libs. The hwloc framework will add the +# winning component's $opal_hwloc__* to CPPFLAGS, LDFLAGS, +# and LIBS, respectively. + +# Finally, components set $opal_hwloc__enable_xml to 0 or +# 1, indicating whether they have XML support or not. dnl We only want one winning component. m4_define(MCA_opal_hwloc_CONFIGURE_MODE, STOP_AT_FIRST_PRIORITY) @@ -38,6 +43,8 @@ AC_DEFUN([MCA_opal_hwloc_CONFIG],[ AC_REQUIRE([MCA_opal_hwloc_CONFIG_REQUIRE]) ]) +# See comments above for why this is a separate macro. + AC_DEFUN([MCA_opal_hwloc_CONFIG_REQUIRE],[ # If this shell variable is not 1, then this m4 is being invoked @@ -54,7 +61,7 @@ AC_DEFUN([MCA_opal_hwloc_CONFIG_REQUIRE],[ [Build hwloc support. DIR can take one of three values: "internal", "external", or a valid directory name. "internal" (or no DIR value) forces Open MPI to use its internal copy of hwloc. "external" forces Open MPI to use an external installation of hwloc. Supplying a valid directory name also forces Open MPI to use an external installation of hwloc, and adds DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries.])) # set defaults of not having any support - hwloc_base_enable_xml=0 + opal_hwloc_base_enable_xml=0 OPAL_HAVE_HWLOC=0 # Configure all the components - always have to do this, even if @@ -64,6 +71,9 @@ AC_DEFUN([MCA_opal_hwloc_CONFIG_REQUIRE],[ # REQUIRE. MCA_CONFIGURE_FRAMEWORK([opal], [hwloc], 1) + # Strip any leading/trailing spaces + opal_hwloc_winner=`echo $MCA_opal_hwloc_STATIC_COMPONENTS | sed -e 's/^[ ]+//' | sed -e 's/[ ]+$//'` + # Give a blank line to separate these messages from the last # component's configure.m4 output. echo " " @@ -76,6 +86,14 @@ AC_DEFUN([MCA_opal_hwloc_CONFIG_REQUIRE],[ AS_IF([test "$MCA_opal_hwloc_STATIC_COMPONENTS" = ""], [AC_MSG_WARN([Did not find a suitable static opal hwloc component]) AC_MSG_ERROR([Cannot continue])]) + + # If there's any spaces in the middle of the string, then we + # found more than 1 eligible static component. That's no good + # (and should never happen, but let's be sure)! + AS_IF([test "`echo $opal_hwloc_winner | sed 's/ //'`" != "$opal_hwloc_winner"], + [AC_MSG_WARN([Found more than 1 eligible static opal hwloc component]) + AC_MSG_WARN([This should never happen!]) + AC_MSG_ERROR([Cannot continue])]) ]) # If we have a winning component, do some more logic @@ -83,37 +101,51 @@ AC_DEFUN([MCA_opal_hwloc_CONFIG_REQUIRE],[ [ # We had a winner -- w00t! OPAL_HAVE_HWLOC=1 - # The winning component will have set this. - AS_IF([test "$hwloc_base_include" = ""], - [AC_MSG_WARN([Missing implementation header]) + # The winning component will have told us where their header file + # is located + AC_MSG_CHECKING([for winning hwloc component header file]) + eval "opal_hwloc_base_include=\`echo \$opal_hwloc_${opal_hwloc_winner}_include\`" + AS_IF([test "$opal_hwloc_base_include" = ""], + [AC_MSG_RESULT([missing]) + AC_MSG_WARN([Missing implementation header]) AC_MSG_ERROR([Cannot continue])]) + AC_MSG_RESULT([$opal_hwloc_base_include]) AC_DEFINE_UNQUOTED([MCA_hwloc_IMPLEMENTATION_HEADER], - ["$hwloc_base_include"], + ["$opal_hwloc_base_include"], [Header to include for hwloc implementation]) # See if they set any flags for us AC_MSG_CHECKING([for winning hwloc component additional CPPFLAGS]) - AS_IF([test "$hwloc_base_cppflags" != ""], - [AC_MSG_RESULT([$hwloc_base_cppflags]) - CPPFLAGS="$CPPFLAGS $hwloc_base_cppflags"], + eval "opal_hwloc_base_cppflags=\`echo \$opal_hwloc_${opal_hwloc_winner}_cppflags\`" + AS_IF([test "$opal_hwloc_base_cppflags" != ""], + [AC_MSG_RESULT([$opal_hwloc_base_cppflags]) + CPPFLAGS="$CPPFLAGS $opal_hwloc_base_cppflags"], [AC_MSG_RESULT([none])]) AC_MSG_CHECKING([for winning hwloc component additional LDFLAGS]) - AS_IF([test "$hwloc_base_ldflags" != ""], - [AC_MSG_RESULT([$hwloc_base_ldflags]) - LDFLAGS="$LDFLAGS $hwloc_base_ldflags"], + eval "opal_hwloc_base_ldflags=\`echo \$opal_hwloc_${opal_hwloc_winner}_ldflags\`" + AS_IF([test "$opal_hwloc_base_ldflags" != ""], + [AC_MSG_RESULT([$opal_hwloc_base_ldflags]) + LDFLAGS="$LDFLAGS $opal_hwloc_base_ldflags"], [AC_MSG_RESULT([none])]) AC_MSG_CHECKING([for winning hwloc component additional LIBS]) - AS_IF([test "$hwloc_base_libs" != ""], - [AC_MSG_RESULT([$hwloc_base_libs]) - LIB="$LIBS $hwloc_base_libs"], + eval "opal_hwloc_base_libs=\`echo \$opal_hwloc_${opal_hwloc_winner}_libs\`" + AS_IF([test "$opal_hwloc_base_libs" != ""], + [AC_MSG_RESULT([$opal_hwloc_base_libs]) + LIB="$LIBS $opal_hwloc_base_libs"], [AC_MSG_RESULT([none])]) + + AC_MSG_CHECKING([if winning hwloc supports XML]) + eval "opal_hwloc_base_enable_xml=\`echo \$opal_hwloc_${opal_hwloc_winner}_enable_xml\`" + AS_IF([test "$opal_hwloc_base_enable_xml" = "1"], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) ]) AM_CONDITIONAL(OPAL_HAVE_HWLOC, test $OPAL_HAVE_HWLOC -eq 1) AC_DEFINE_UNQUOTED(OPAL_HAVE_HWLOC, $OPAL_HAVE_HWLOC, [Whether we have hwloc support or not]) - AC_DEFINE_UNQUOTED(OPAL_HAVE_HWLOC_XML, $hwloc_base_enable_xml, + AC_DEFINE_UNQUOTED(OPAL_HAVE_HWLOC_XML, $opal_hwloc_base_enable_xml, [Enable xml support or not]) # Similar to above, if this m4 is being invoked "early" via AC diff --git a/opal/mca/hwloc/external/configure.m4 b/opal/mca/hwloc/external/configure.m4 index fac57183b5..504f6a99bc 100644 --- a/opal/mca/hwloc/external/configure.m4 +++ b/opal/mca/hwloc/external/configure.m4 @@ -36,7 +36,7 @@ AC_DEFUN([MCA_opal_hwloc_external_POST_CONFIG],[ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[ AC_CONFIG_FILES([opal/mca/hwloc/external/Makefile]) - OPAL_VAR_SCOPE_PUSH([opal_hwloc_external_CPPFLAGS_save opal_hwloc_external_CFLAGS_save opal_hwloc_external_LDFLAGS_save opal_hwloc_external_LIBS_save opal_hwloc_external_want]) + OPAL_VAR_SCOPE_PUSH([opal_hwloc_external_CPPFLAGS_save opal_hwloc_external_CFLAGS_save opal_hwloc_external_LDFLAGS_save opal_hwloc_external_LIBS_save opal_hwloc_external_want opal_hwloc_external_tmp opal_hwloc_external_lstopo]) AC_ARG_WITH([hwloc-libdir], [AC_HELP_STRING([--with-hwloc-libdir=DIR], @@ -85,7 +85,7 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[ [opal_hwloc_external_support=yes], [opal_hwloc_external_support=no]) - CPPFLAGS=$opal_hwloc_external_CPPFLAGS_save + CPPFLAGS=$opal_hwloc_external_CPPFLAGS_savew CFLAGS=$opal_hwloc_external_CFLAGS_save LDFLAGS=$opal_hwloc_external_LDFLAGS_save LIBS=$opal_hwloc_external_LIBS_save @@ -96,10 +96,25 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[ [AC_DEFINE_UNQUOTED([HWLOC_EXTERNAL_HWLOC_VERSION], [external], [Version of hwloc]) + + # See if the external hwloc supports XML + AC_MSG_CHECKING([if external hwloc supports XML]) + AS_IF([test "$opal_hwloc_dir" != ""], + [opal_hwloc_external_lstopo="$opal_hwloc_dir/bin/lstopo"], + [OPAL_WHICH(lstopo, opal_hwloc_external_lstopo)]) + opal_hwloc_external_tmp=`$opal_hwloc_external_lstopo --help | $GREP "Supported output file formats" | grep xml` + AS_IF([test "$opal_hwloc_external_tmp" = ""], + [opal_hwloc_external_enable_xml=0 + AC_MSG_RESULT([no])], + [opal_hwloc_external_enable_xml=1 + AC_MSG_RESULT([yes])]) + # Must set this variable so that the framework m4 knows # what file to include in opal/mca/hwloc/hwloc.h - hwloc_base_include="$opal_hwloc_dir/include/hwloc.h" - hwloc_base_cppflags=$opal_hwloc_external_CPPFLAGS + opal_hwloc_external_include="$opal_hwloc_dir/include/hwloc.h" + opal_hwloc_external_cppflags=$opal_hwloc_external_CPPFLAGS + opal_hwloc_external_ldflags=$opal_hwloc_external_LDFLAGS + opal_hwloc_external_libs=$opal_hwloc_external_LIBS # These flags need to get passed to the wrapper compilers # (this is unnecessary for the internal/embedded hwloc) diff --git a/opal/mca/hwloc/external/hwloc_external_component.c b/opal/mca/hwloc/external/hwloc_external_component.c index 745add21fd..508da98373 100644 --- a/opal/mca/hwloc/external/hwloc_external_component.c +++ b/opal/mca/hwloc/external/hwloc_external_component.c @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + #include "opal_config.h" #include "opal/constants.h" @@ -30,7 +40,7 @@ const opal_hwloc_component_t mca_hwloc_external_component = { OPAL_HWLOC_BASE_VERSION_2_0_0, /* Component name and version */ - "hwloc_external", + "external", OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, OPAL_RELEASE_VERSION, diff --git a/opal/mca/hwloc/hwloc121/configure.m4 b/opal/mca/hwloc/hwloc121/configure.m4 index f3a28c4bb1..697170c3f6 100644 --- a/opal/mca/hwloc/hwloc121/configure.m4 +++ b/opal/mca/hwloc/hwloc121/configure.m4 @@ -68,10 +68,10 @@ AC_DEFUN([MCA_opal_hwloc_hwloc121_CONFIG],[ [enable xml support for hwloc (experimental)])) if test "$enable_hwloc_xml" = "yes"; then enable_xml=yes - hwloc_base_enable_xml=1 + opal_hwloc_hwloc121_enable_xml=1 else enable_xml=no - hwloc_base_enable_xml=0 + opal_hwloc_hwloc121_enable_xml=0 fi HWLOC_SETUP_CORE([opal/mca/hwloc/hwloc121/hwloc], @@ -115,7 +115,7 @@ AC_DEFUN([MCA_opal_hwloc_hwloc121_CONFIG],[ # Set these variables so that the framework m4 knows # what file to include in opal/mca/hwloc/hwloc.h - hwloc_base_include="$opal_hwloc_hwloc121_basedir/hwloc121.h" + opal_hwloc_hwloc121_include="$opal_hwloc_hwloc121_basedir/hwloc121.h" # We also set _cppflags so that when including # opal/mca/hwloc/hwloc.h (and therefore this component's @@ -123,9 +123,9 @@ AC_DEFUN([MCA_opal_hwloc_hwloc121_CONFIG],[ # files. Be a little friendly and only include the -I for # the builddir if it's different than the srcdir. opal_hwloc_hwloc121_file=$opal_hwloc_hwloc121_basedir/hwloc - hwloc_base_cppflags="-I$OMPI_TOP_SRCDIR/$opal_hwloc_hwloc121_file/include" + opal_hwloc_hwloc121_cppflags="-I$OMPI_TOP_SRCDIR/$opal_hwloc_hwloc121_file/include" AS_IF([test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"], - [hwloc_base_cppflags="$hwloc_base_cppflags -I$OMPI_TOP_BUILDDIR/$opal_hwloc_hwloc121_file/include"]) + [opal_hwloc_hwloc121_cppflags="$opal_hwloc_hwloc121_cppflags -I$OMPI_TOP_BUILDDIR/$opal_hwloc_hwloc121_file/include"]) if test "$with_devel_headers" = "yes" ; then hwloc_hwloc121_WRAPPER_EXTRA_CPPFLAGS="$WRAPPER_EXTRA_CPPFLAGS "'-I${includedir}/openmpi/'"$opal_hwloc_hwloc121_basedir/hwloc/include" fi