1
1

In short: this commit removes a bunch of code by switching the opal

event framework to STOP_AT_FIRST, and then moves a bunch of
side-effect-inducing code in the libevent2019 configure.m4 up to
POST_CONFIG.

== More detail ==

Change the event framework from STOP_AT_FIRST_PRIORITY to
STOP_AT_FIRST.  This means that only one component can win (vs. all
STOP_AT_FIRST_PRIORITY, in which multiple components of the same
priority can all win).

You still need to ensure that there are no side-effects from the
winner, however, so check for winning during POST_CONFIG, and set
things like the base_include there.

This simplifies the configury quite a bit -- you don't have to assume
that mulitple components can win: zero or one components will win.

Also change the libevent 2019 priority to 50 so that some other
(developer-specific/local) component could win, if it wanted to.

This commit was SVN r27794.
Этот коммит содержится в:
Jeff Squyres 2013-01-12 01:28:37 +00:00
родитель d94c249781
Коммит 569a60c2de
2 изменённых файлов: 80 добавлений и 112 удалений

Просмотреть файл

@ -1,6 +1,6 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
@ -11,47 +11,28 @@ 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 $opal_event_<component>_include to a header file
# name (relative to opal/mca/event) that will be included in
# the shell variable $opal_event_base_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 following shell variables:
#
# opal_event_<component>_ADD_CPPFLAGS
# opal_event_<component>_ADD_LDFLAGS
# opal_event_<component>_ADD_LIBS
# opal_event_<component>_ADD_WRAPPER_EXTRA_CPPFLAGS
# opal_event_<component>_ADD_WRAPPER_EXTRA_LDFLAGS
# opal_event_<component>_ADD_WRAPPER_EXTRA_LIBS
#
# The first 3 will be added to the over all CPPFLAGS/LDFLAGS/LIBS if
# that component is chosen as the winning component. Similarly, the
# latter 3 will be added to WRAPPER_EXTRA_* if that component wins.
dnl We only want one winning component.
m4_define(MCA_opal_event_CONFIGURE_MODE, STOP_AT_FIRST_PRIORITY)
dnl We only want one winning component (vs. STOP_AT_FIRST_PRIORITY,
dnl which will allow all components of the same priority who succeed to
dnl win)
m4_define(MCA_opal_event_CONFIGURE_MODE, STOP_AT_FIRST)
AC_DEFUN([MCA_opal_event_CONFIG],[
opal_event_base_include=
# configure all the components
MCA_CONFIGURE_FRAMEWORK($1, $2, 1)
# We must have found exactly 1 static component, or we can't
# continue. STOP_AT_FIRST_PRIORITY will guarantee that we find at
# most one. We need to check here that we found *at least* one.
# continue. STOP_AT_FIRST will guarantee that we find at most
# one. We need to check here that we found *at least* one.
AS_IF([test "$MCA_opal_event_STATIC_COMPONENTS" = ""],
[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
@ -73,34 +54,12 @@ AC_DEFUN([MCA_opal_event_CONFIG],[
# 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/$opal_event_base_include"],
[Header to include for event implementation])
# See if they set any flags for us
_MCA_opal_event_base_flags([CPPFLAGS], [CPPFLAGS])
_MCA_opal_event_base_flags([LDFLAGS], [LDFLAGS])
_MCA_opal_event_base_flags([LIBS], [LIBS])
_MCA_opal_event_base_flags([wrapper CPPFLAGS], [WRAPPER_EXTRA_CPPFLAGS])
_MCA_opal_event_base_flags([wrapper LDFLAGS], [WRAPPER_EXTRA_LDFLAGS])
_MCA_opal_event_base_flags([wrapper LIBS], [WRAPPER_EXTRA_LIBS])
])
dnl Helper function
dnl $1 = message to display
dnl $2 = output variable to set / input variable suffix
AC_DEFUN([_MCA_opal_event_base_flags],[
AC_MSG_CHECKING([for winning event component additional $1])
eval "opal_event_base_tmp=\`echo \$opal_event_${opal_event_winner}_ADD_$2\`"
AS_IF([test "$opal_event_base_tmp" != ""],
[AC_MSG_RESULT([$opal_event_base_tmp])
$2="[$]$2 $opal_event_base_tmp"],
[AC_MSG_RESULT([none])])
AC_MSG_RESULT([$opal_event_base_include])
])dnl

Просмотреть файл

@ -1,6 +1,6 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved.
#
# $COPYRIGHT$
@ -9,7 +9,7 @@
#
# $HEADER$
#
AC_DEFUN([MCA_opal_event_libevent2019_PRIORITY], [100])
AC_DEFUN([MCA_opal_event_libevent2019_PRIORITY], [50])
#
# Force this component to compile in static-only mode
@ -20,6 +20,72 @@ AC_DEFUN([MCA_opal_event_libevent2019_COMPILE_MODE], [
AC_MSG_RESULT([$$4])
])
AC_DEFUN([MCA_opal_event_libevent2019_POST_CONFIG], [
AS_IF([test "$1" = "1"],
[ # Build libevent/include/event2/event-config.h. If we
# don't do it here, then libevent's Makefile.am will build
# it during "make all", which is too late for us (because
# other things are built before the event framework that
# end up including event-config.h). The steps below were
# copied from libevent's Makefile.am.
echo =================happy
AC_CONFIG_COMMANDS([opal/mca/event/libevent2019/libevent/include/event2/event-config.h],
[basedir="opal/mca/event/libevent2019"
file="$basedir/libevent/include/event2/event-config.h"
rm -f "$file.new"
cat > "$file.new" <<EOF
/* event2/event-config.h
*
* This file was generated by autoconf when libevent was built, and
* post- processed by Open MPI's component configure.m4 (so that
* Libevent wouldn't build it during "make all") so that its macros
* would have a uniform prefix.
*
* DO NOT EDIT THIS FILE.
*
* Do not rely on macros in this file existing in later versions
*/
#ifndef _EVENT2_EVENT_CONFIG_H_
#define _EVENT2_EVENT_CONFIG_H_
EOF
sed -e 's/#define /#define _EVENT_/' \
-e 's/#undef /#undef _EVENT_/' \
-e 's/#ifndef /#ifndef _EVENT_/' < "$basedir/libevent/config.h" >> "$file.new"
echo "#endif" >> "$file.new"
# Only make a new .h file if the
# contents haven't changed
diff -q $file "$file.new" > /dev/null 2> /dev/null
if test "$?" = "0"; then
echo $file is unchanged
else
cp "$file.new" $file
fi
rm -f "$file.new"])
# Must set this variable so that the framework m4 knows
# what file to include in opal/mca/event/event.h
opal_event_base_include="libevent2019/libevent2019.h"
# Add some stuff to CPPFLAGS so that the rest of the source
# tree can be built
file=$basedir/libevent
CPPFLAGS="$CPPFLAGS -I$OMPI_TOP_SRCDIR/$file -I$OMPI_TOP_SRCDIR/$file/include"
AS_IF([test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"],
[CPPFLAGS="$CPPFLAGS -I$OMPI_TOP_BUILDDIR/$file/include"])
unset file
# Finally, add some flags to the wrapper compiler if we're
# building with developer headers so that our headers can
# be found.
if test "$with_devel_headers" = "yes" ; then
OPAL_WRAPPER_EXTRA_CPPFLAGS="$OPAL_WRAPPER_EXTRA_CPPFLAGS "'-I${includedir}/openmpi/opal/mca/event/libevent2019/libevent -I${includedir}/openmpi/opal/mca/event/libevent2019/libevent/include'
fi
])
])
# MCA_event_libevent2019_CONFIG([action-if-can-compile],
# [action-if-cant-compile])
# ------------------------------------------------
@ -124,63 +190,6 @@ AC_DEFUN([MCA_opal_event_libevent2019_CONFIG],[
file=$basedir/libevent/config.h
AS_IF([test "$libevent_happy" = "yes" -a -r $file],
[OPAL_HAVE_WORKING_EVENTOPS=`grep HAVE_WORKING_EVENTOPS $file | awk '{print [$]3 }'`
# Build libevent/include/event2/event-config.h. If we
# don't do it here, then libevent's Makefile.am will build
# it during "make all", which is too late for us (because
# other things are built before the event framework that
# end up including event-config.h). The steps below were
# copied from libevent's Makefile.am.
AC_CONFIG_COMMANDS([opal/mca/event/libevent2019/libevent/include/event2/event-config.h],
[basedir="opal/mca/event/libevent2019"
file="$basedir/libevent/include/event2/event-config.h"
rm -f "$file.new"
cat > "$file.new" <<EOF
/* event2/event-config.h
*
* This file was generated by autoconf when libevent was built, and
* post- processed by Open MPI's component configure.m4 (so that
* Libevent wouldn't build it during "make all") so that its macros
* would have a uniform prefix.
*
* DO NOT EDIT THIS FILE.
*
* Do not rely on macros in this file existing in later versions
*/
#ifndef _EVENT2_EVENT_CONFIG_H_
#define _EVENT2_EVENT_CONFIG_H_
EOF
sed -e 's/#define /#define _EVENT_/' \
-e 's/#undef /#undef _EVENT_/' \
-e 's/#ifndef /#ifndef _EVENT_/' < "$basedir/libevent/config.h" >> "$file.new"
echo "#endif" >> "$file.new"
# Only make a new .h file if the
# contents haven't changed
diff -q $file "$file.new" > /dev/null 2> /dev/null
if test "$?" = "0"; then
echo $file is unchanged
else
cp "$file.new" $file
fi
rm -f "$file.new"])
# Must set this variable so that the framework m4 knows
# what file to include in opal/mca/event/event.h
opal_event_libevent2019_include="libevent2019/libevent2019.h"
# Also pass some *_ADD_* flags upwards to the framework m4
# for various compile/link flags that are needed a) to
# build the rest of the source tree, and b) for the wrapper
# compilers (in the --with-devel-headers case).
file=$basedir/libevent
opal_event_libevent2019_ADD_CPPFLAGS="-I$OMPI_TOP_SRCDIR/$file -I$OMPI_TOP_SRCDIR/$file/include"
AS_IF([test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"],
[opal_event_libevent2019_ADD_CPPFLAGS="$opal_event_libevent2019_ADD_CPPFLAGS -I$OMPI_TOP_BUILDDIR/$file/include"])
if test "$with_devel_headers" = "yes" ; then
opal_event_libevent2019_ADD_WRAPPER_EXTRA_CPPFLAGS='-I${includedir}/openmpi/opal/mca/event/libevent2019/libevent -I${includedir}/openmpi/opal/mca/event/libevent2019/libevent/include'
fi
$1],
[$2
OPAL_HAVE_WORKING_EVENTOPS=0])