@@ -35,8 +35,8 @@ AC_DEFUN([MCA_opal_event_libevent2022_POST_CONFIG], [
35
35
# copied from libevent's Makefile.am.
36
36
37
37
AC_CONFIG_COMMANDS([opal/mca/event/libevent2022/libevent/include/event2/event-config.h],
38
- [libevent_basedir = " opal/mca/event/libevent2022"
39
- 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"
40
40
rm -f " $libevent_file .new"
41
41
cat > " $libevent_file .new" << EOF
42
42
/* event2/event-config.h
56
56
57
57
sed -e ' s/#define /#define _EVENT_/' \
58
58
-e ' s/#undef /#undef _EVENT_/' \
59
- -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"
60
60
echo " #endif" >> " $libevent_file .new"
61
61
62
62
# Only make a new .h libevent_file if the
75
75
76
76
# Add some stuff to CPPFLAGS so that the rest of the source
77
77
# tree can be built
78
- libevent_file= $libevent_basedir /libevent
78
+ libevent_file= $opal_event_libevent2022_basedir /libevent
79
79
CPPFLAGS= " -I$OPAL_TOP_SRCDIR /$libevent_file -I$OPAL_TOP_SRCDIR /$libevent_file /include $CPPFLAGS "
80
80
AS_IF([test " $OPAL_TOP_BUILDDIR " != " $OPAL_TOP_SRCDIR " ],
81
81
[CPPFLAGS= " -I$OPAL_TOP_BUILDDIR /$libevent_file /include $CPPFLAGS " ])
@@ -87,25 +87,47 @@ dnl MCA_event_libevent2022_CONFIG([action-if-can-compile],
87
87
dnl [action-if-cant-compile])
88
88
dnl ------------------------------------------------
89
89
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
+
90
93
# We know that the external event component will be configured
91
94
# before this one because of its priority. This component is only
92
95
# needed if the external component was not successful in selecting
93
96
# itself.
94
97
AC_MSG_CHECKING([if event external component succeeded])
95
98
AS_IF([test " $opal_event_external_support " = " yes" ],
96
99
[AC_MSG_RESULT([yes])
97
- AC_MSG_NOTICE([event:external succeeded, so this component will be skipped])
98
- $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 ) ],
99
102
[AC_MSG_RESULT([no])
100
103
AC_MSG_NOTICE([event:external failed, so this component will be used])
101
- MCA_opal_event_libevent2022_BACKEND_CONFIG ($1 , $2 )])
104
+ MCA_opal_event_libevent2022_REAL_CONFIG ($1 , $2 )])
102
105
])
103
106
104
- AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[
105
- 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
+ ])
106
119
107
- AC_CONFIG_FILES([opal/mca/event/libevent2022/Makefile])
108
- 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])
109
131
110
132
CFLAGS_save= " $CFLAGS "
111
133
CFLAGS= " $OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS "
@@ -175,14 +197,14 @@ AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[
175
197
176
198
AC_MSG_RESULT([$event_args ])
177
199
200
+ # Invoke the embedded configure script.
178
201
# We define "random" to be "opal_random" so that Libevent will not
179
202
# use random(3) internally (and potentially unexpectedly perturb
180
203
# values returned by rand(3) to the application).
181
-
182
204
CPPFLAGS=" $CPPFLAGS -Drandom=opal_random"
183
- OPAL_CONFIG_SUBDIR ([$libevent_basedir /libevent ],
184
- [ $event_args $opal_subdir_args ' CPPFLAGS=$CPPFLAGS ' ],
185
- [libevent_happy = " yes " ], [libevent_happy= " no" ])
205
+ MCA_opal_event_libevent2022_SUB_CONFIGURE ([$event_args ],
206
+ [libevent_happy = " yes " ],
207
+ [libevent_happy= " no" ])
186
208
if test " $libevent_happy " = " no" ; then
187
209
AC_MSG_WARN([Event library failed to configure])
188
210
AC_MSG_ERROR([Cannot continue])
@@ -200,26 +222,34 @@ AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[
200
222
# the value in the generated libevent/config.h (NOT
201
223
# libevent/include/event2/event-config.h!). Otherwise, set it to
202
224
# 0.
203
- libevent_file=$libevent_basedir /libevent/config.h
204
-
205
- # If we are not building the internal libevent, then indicate that
206
- # this component should not be built. NOTE: we still did all the
207
- # above configury so that all the proper GNU Autotools
208
- # infrastructure is setup properly (e.g., w.r.t. SUBDIRS=libevent in
209
- # this directory's Makefile.am, we still need the Autotools "make
210
- # distclean" infrastructure to work properly).
211
-
212
- AS_IF([test " $with_libevent " != " internal" && test -n " $with_libevent " && test " $with_libevent " != " yes" ],
213
- [AC_MSG_WARN([using an external libevent; disqualifying this component])
214
- libevent_happy= no],
215
-
216
- [AS_IF([test " $libevent_happy " = " yes" && test -r $libevent_file ],
217
- [OPAL_HAVE_WORKING_EVENTOPS= ` grep HAVE_WORKING_EVENTOPS $libevent_file | awk ' {print [$]3 }' `
218
- $1 ],
219
- [$2
220
- OPAL_HAVE_WORKING_EVENTOPS= 0])
221
- ]
222
- )
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])
223
232
224
233
OPAL_VAR_SCOPE_POP
225
234
])
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
+ ])
0 commit comments