Skip to content

Commit f1346cb

Browse files
authored
Merge pull request #5533 from jsquyres/pr/fix-libevent-hwloc-gwlargflappbt
Fix internal/external hwloc and libevent
2 parents 09ad725 + 01e4570 commit f1346cb

File tree

2 files changed

+91
-60
lines changed

2 files changed

+91
-60
lines changed

opal/mca/event/libevent2022/configure.m4

Lines changed: 73 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414
#
1515
AC_DEFUN([MCA_opal_event_libevent2022_PRIORITY], [80])
1616

17-
#
18-
# Force this component to compile in static-only mode
19-
#
17+
dnl
18+
dnl Force this component to compile in static-only mode
19+
dnl
2020
AC_DEFUN([MCA_opal_event_libevent2022_COMPILE_MODE], [
2121
AC_MSG_CHECKING([for MCA component $2:$3 compile mode])
2222
$4="static"
2323
AC_MSG_RESULT([$$4])
2424
])
2525

2626
AC_DEFUN([MCA_opal_event_libevent2022_POST_CONFIG], [
27-
AM_CONDITIONAL(OPAL_EVENT_HAVE_THREAD_SUPPORT, test "$enable_event_thread_support" = "yes")
27+
AM_CONDITIONAL(OPAL_EVENT_HAVE_THREAD_SUPPORT,
28+
[test "$enable_event_thread_support" = "yes"])
2829
AS_IF([test "$1" = "1"],
2930
[ # Build libevent/include/event2/event-config.h. If we
3031
# don't do it here, then libevent's Makefile.am will build
@@ -34,8 +35,8 @@ AC_DEFUN([MCA_opal_event_libevent2022_POST_CONFIG], [
3435
# copied from libevent's Makefile.am.
3536

3637
AC_CONFIG_COMMANDS([opal/mca/event/libevent2022/libevent/include/event2/event-config.h],
37-
[libevent_basedir="opal/mca/event/libevent2022"
38-
libevent_file="$libevent_basedir/libevent/include/event2/event-config.h"
38+
[opal_event_libevent2022_basedir="opal/mca/event/libevent2022"
39+
libevent_file="$opal_event_libevent2022_basedir/libevent/include/event2/event-config.h"
3940
rm -f "$libevent_file.new"
4041
cat > "$libevent_file.new" <<EOF
4142
/* event2/event-config.h
@@ -55,7 +56,7 @@ EOF
5556

5657
sed -e 's/#define /#define _EVENT_/' \
5758
-e 's/#undef /#undef _EVENT_/' \
58-
-e 's/#ifndef /#ifndef _EVENT_/' < "$libevent_basedir/libevent/config.h" >> "$libevent_file.new"
59+
-e 's/#ifndef /#ifndef _EVENT_/' < "$opal_event_libevent2022_basedir/libevent/config.h" >> "$libevent_file.new"
5960
echo "#endif" >> "$libevent_file.new"
6061

6162
# Only make a new .h libevent_file if the
@@ -74,37 +75,59 @@ EOF
7475

7576
# Add some stuff to CPPFLAGS so that the rest of the source
7677
# tree can be built
77-
libevent_file=$libevent_basedir/libevent
78+
libevent_file=$opal_event_libevent2022_basedir/libevent
7879
CPPFLAGS="-I$OPAL_TOP_SRCDIR/$libevent_file -I$OPAL_TOP_SRCDIR/$libevent_file/include $CPPFLAGS"
7980
AS_IF([test "$OPAL_TOP_BUILDDIR" != "$OPAL_TOP_SRCDIR"],
8081
[CPPFLAGS="-I$OPAL_TOP_BUILDDIR/$libevent_file/include $CPPFLAGS"])
8182
unset libevent_file
8283
])
8384
])
8485

85-
# MCA_event_libevent2022_CONFIG([action-if-can-compile],
86-
# [action-if-cant-compile])
87-
# ------------------------------------------------
86+
dnl MCA_event_libevent2022_CONFIG([action-if-can-compile],
87+
dnl [action-if-cant-compile])
88+
dnl ------------------------------------------------
8889
AC_DEFUN([MCA_opal_event_libevent2022_CONFIG],[
90+
AC_CONFIG_FILES([opal/mca/event/libevent2022/Makefile])
91+
opal_event_libevent2022_basedir="opal/mca/event/libevent2022"
92+
8993
# We know that the external event component will be configured
9094
# before this one because of its priority. This component is only
9195
# needed if the external component was not successful in selecting
9296
# itself.
9397
AC_MSG_CHECKING([if event external component succeeded])
9498
AS_IF([test "$opal_event_external_support" = "yes"],
9599
[AC_MSG_RESULT([yes])
96-
AC_MSG_NOTICE([event:external succeeded, so this component will be skipped])
97-
$2],
100+
AC_MSG_NOTICE([event:external succeeded, so this component will be configured, but then will be skipped])
101+
MCA_opal_event_libevent2022_FAKE_CONFIG($2)],
98102
[AC_MSG_RESULT([no])
99103
AC_MSG_NOTICE([event:external failed, so this component will be used])
100-
MCA_opal_event_libevent2022_BACKEND_CONFIG($1, $2)])
104+
MCA_opal_event_libevent2022_REAL_CONFIG($1, $2)])
101105
])
102106

103-
AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[
104-
OPAL_VAR_SCOPE_PUSH([CFLAGS_save CPPFLAGS_save libevent_file event_args libevent_happy])
107+
dnl
108+
dnl This macro is invoked when event:external is going to be used (and
109+
dnl this component is *not* going to be used).
110+
dnl
111+
dnl $1: action if this component can compile
112+
dnl (we still invoke $1 so that "make distclean" and friends will work)
113+
dnl
114+
AC_DEFUN([MCA_opal_event_libevent2022_FAKE_CONFIG],[
115+
MCA_opal_event_libevent2022_SUB_CONFIGURE([], [], [])
116+
AC_MSG_NOTICE([remember: event:external will be used; this component was configured, but will be skipped])
117+
$1
118+
])
105119

106-
AC_CONFIG_FILES([opal/mca/event/libevent2022/Makefile])
107-
libevent_basedir="opal/mca/event/libevent2022"
120+
dnl
121+
dnl This macro has a bunch of side effects. It is only meant to be
122+
dnl invoked when this component is going to be used (i.e., when
123+
dnl event:external is *not* going to be used). If this macro is invoked
124+
dnl when event:external is used, Terrible Things will happen.
125+
dnl
126+
dnl $1: action if this component can compile
127+
dnl $2: action if this component cannot compile
128+
dnl
129+
AC_DEFUN([MCA_opal_event_libevent2022_REAL_CONFIG],[
130+
OPAL_VAR_SCOPE_PUSH([CFLAGS_save CPPFLAGS_save libevent_file event_args libevent_happy])
108131

109132
CFLAGS_save="$CFLAGS"
110133
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"
@@ -174,14 +197,14 @@ AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[
174197

175198
AC_MSG_RESULT([$event_args])
176199

200+
# Invoke the embedded configure script.
177201
# We define "random" to be "opal_random" so that Libevent will not
178202
# use random(3) internally (and potentially unexpectedly perturb
179203
# values returned by rand(3) to the application).
180-
181204
CPPFLAGS="$CPPFLAGS -Drandom=opal_random"
182-
OPAL_CONFIG_SUBDIR([$libevent_basedir/libevent],
183-
[$event_args $opal_subdir_args 'CPPFLAGS=$CPPFLAGS'],
184-
[libevent_happy="yes"], [libevent_happy="no"])
205+
MCA_opal_event_libevent2022_SUB_CONFIGURE([$event_args],
206+
[libevent_happy="yes"],
207+
[libevent_happy="no"])
185208
if test "$libevent_happy" = "no"; then
186209
AC_MSG_WARN([Event library failed to configure])
187210
AC_MSG_ERROR([Cannot continue])
@@ -199,26 +222,34 @@ AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[
199222
# the value in the generated libevent/config.h (NOT
200223
# libevent/include/event2/event-config.h!). Otherwise, set it to
201224
# 0.
202-
libevent_file=$libevent_basedir/libevent/config.h
203-
204-
# If we are not building the internal libevent, then indicate that
205-
# this component should not be built. NOTE: we still did all the
206-
# above configury so that all the proper GNU Autotools
207-
# infrastructure is setup properly (e.g., w.r.t. SUBDIRS=libevent in
208-
# this directory's Makefile.am, we still need the Autotools "make
209-
# distclean" infrastructure to work properly).
210-
211-
AS_IF([test "$with_libevent" != "internal" && test -n "$with_libevent" && test "$with_libevent" != "yes"],
212-
[AC_MSG_WARN([using an external libevent; disqualifying this component])
213-
libevent_happy=no],
214-
215-
[AS_IF([test "$libevent_happy" = "yes" && test -r $libevent_file],
216-
[OPAL_HAVE_WORKING_EVENTOPS=`grep HAVE_WORKING_EVENTOPS $libevent_file | awk '{print [$]3 }'`
217-
$1],
218-
[$2
219-
OPAL_HAVE_WORKING_EVENTOPS=0])
220-
]
221-
)
225+
libevent_file=$opal_event_libevent2022_basedir/libevent/config.h
226+
227+
AS_IF([test "$libevent_happy" = "yes" && test -r $libevent_file],
228+
[OPAL_HAVE_WORKING_EVENTOPS=`grep HAVE_WORKING_EVENTOPS $libevent_file | awk '{print [$]3 }'`
229+
$1],
230+
[$2
231+
OPAL_HAVE_WORKING_EVENTOPS=0])
222232

223233
OPAL_VAR_SCOPE_POP
224234
])
235+
236+
dnl Call configure in the embedded libevent.
237+
dnl
238+
dnl We still do this so that all the proper GNU Autotools
239+
dnl infrastructure is setup properly (e.g., w.r.t. SUBDIRS=libevent in
240+
dnl this directorys Makefile.am, we still need the Autotools "make
241+
dnl distclean" infrastructure to work properly).
242+
dnl
243+
dnl $1: extra configure arguments
244+
dnl $2: action on success
245+
dnl $3: action on failure
246+
dnl
247+
AC_DEFUN([MCA_opal_event_libevent2022_SUB_CONFIGURE],[
248+
# We define "random" to be "opal_random" so that Libevent will not
249+
# use random(3) internally (and potentially unexpectedly perturb
250+
# values returned by rand(3) to the application).
251+
252+
OPAL_CONFIG_SUBDIR([$opal_event_libevent2022_basedir/libevent],
253+
[$1 $opal_subdir_args 'CPPFLAGS=$CPPFLAGS'],
254+
[$2], [$3])
255+
])

opal/mca/hwloc/hwloc201/configure.m4

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,23 @@ AC_DEFUN([MCA_opal_hwloc_hwloc201_POST_CONFIG],[
6969
# MCA_hwloc_hwloc201_CONFIG([action-if-found], [action-if-not-found])
7070
# --------------------------------------------------------------------
7171
AC_DEFUN([MCA_opal_hwloc_hwloc201_CONFIG],[
72+
# Hwloc needs to know if we have Verbs support
73+
AC_REQUIRE([OPAL_CHECK_VERBS_DIR])
74+
75+
AC_CONFIG_FILES([opal/mca/hwloc/hwloc201/Makefile])
76+
77+
OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_hwloc_hwloc201_save_CPPFLAGS opal_hwloc_hwloc201_save_LDFLAGS opal_hwloc_hwloc201_save_LIBS opal_hwloc_hwloc201_save_cairo opal_hwloc_hwloc201_save_xml opal_hwloc_hwloc201_save_mode opal_hwloc_hwloc201_basedir opal_hwloc_hwloc201_file opal_hwloc_hwloc201_save_cflags CPPFLAGS_save LIBS_save opal_hwloc_external])
78+
7279
# We know that the external hwloc component will be configured
7380
# before this one because of its priority. This component is only
7481
# needed if the external component was not successful in selecting
75-
# itself.
82+
# itself. Print out a message explaining this.
7683
AC_MSG_CHECKING([if hwloc external component succeeded])
7784
AS_IF([test "$opal_hwloc_external_support" = "yes"],
7885
[AC_MSG_RESULT([yes])
79-
AC_MSG_NOTICE([hwloc:external succeeded, so this component will be skipped])
80-
$2],
86+
AC_MSG_NOTICE([hwloc:external succeeded, so this component will be configured, but then will be skipped])],
8187
[AC_MSG_RESULT([no])
82-
AC_MSG_NOTICE([hwloc:external failed, so this component will be used])
83-
MCA_opal_hwloc_hwloc201_BACKEND_CONFIG($1, $2)])
84-
])
85-
86-
AC_DEFUN([MCA_opal_hwloc_hwloc201_BACKEND_CONFIG],[
87-
# Hwloc needs to know if we have Verbs support
88-
AC_REQUIRE([OPAL_CHECK_VERBS_DIR])
89-
90-
AC_CONFIG_FILES([opal/mca/hwloc/hwloc201/Makefile])
91-
92-
OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_hwloc_hwloc201_save_CPPFLAGS opal_hwloc_hwloc201_save_LDFLAGS opal_hwloc_hwloc201_save_LIBS opal_hwloc_hwloc201_save_cairo opal_hwloc_hwloc201_save_xml opal_hwloc_hwloc201_save_mode opal_hwloc_hwloc201_basedir opal_hwloc_hwloc201_file opal_hwloc_hwloc201_save_cflags CPPFLAGS_save LIBS_save opal_hwloc_external])
88+
AC_MSG_NOTICE([hwloc:external failed, so this component will be used])])
9389

9490
# default to this component not providing support
9591
opal_hwloc_hwloc201_basedir=opal/mca/hwloc/hwloc201
@@ -99,8 +95,6 @@ AC_DEFUN([MCA_opal_hwloc_hwloc201_BACKEND_CONFIG],[
9995
opal_hwloc_hwloc201_save_LDFLAGS=$LDFLAGS
10096
opal_hwloc_hwloc201_save_LIBS=$LIBS
10197

102-
HWLOC_SET_SYMBOL_PREFIX([opal_hwloc201_])
103-
10498
# save XML or graphical options
10599
opal_hwloc_hwloc201_save_cairo=$enable_cairo
106100
opal_hwloc_hwloc201_save_xml=$enable_xml
@@ -143,6 +137,12 @@ AC_DEFUN([MCA_opal_hwloc_hwloc201_BACKEND_CONFIG],[
143137
AS_IF([test -n "$opal_datatype_cuda_CPPFLAGS"],
144138
[CPPFLAGS="$CPPFLAGS $opal_datatype_cuda_CPPFLAGS"])
145139

140+
# Only set the symbol prefix if this component is being used
141+
# (i.e., if the external component is not being used).
142+
AS_IF([test "$opal_hwloc_external_support" = "no"],
143+
[HWLOC_SET_SYMBOL_PREFIX([opal_hwloc201_])])
144+
145+
# Do the bulk of the hwloc core setup
146146
HWLOC_SETUP_CORE([opal/mca/hwloc/hwloc201/hwloc],
147147
[AC_MSG_CHECKING([whether hwloc configure succeeded])
148148
AC_MSG_RESULT([yes])
@@ -202,8 +202,8 @@ AC_DEFUN([MCA_opal_hwloc_hwloc201_BACKEND_CONFIG],[
202202
# infrastructure is setup properly (e.g., w.r.t. SUBDIRS=hwloc in
203203
# this directory's Makefile.am, we still need the Autotools "make
204204
# distclean" infrastructure to work properly).
205-
AS_IF([test "$opal_hwloc_external" = "yes"],
206-
[AC_MSG_WARN([using an external hwloc; disqualifying this component])
205+
AS_IF([test "$opal_hwloc_external_support" = "yes"],
206+
[AC_MSG_NOTICE([using an external hwloc; disqualifying this component])
207207
opal_hwloc_hwloc201_support=no],
208208
[AC_DEFINE([HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC], [1])
209209
AC_DEFINE([HAVE_HWLOC_TOPOLOGY_DUP], [1])])

0 commit comments

Comments
 (0)