14
14
#
15
15
AC_DEFUN([MCA_opal_event_libevent2022_PRIORITY], [80])
16
16
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
20
20
AC_DEFUN([MCA_opal_event_libevent2022_COMPILE_MODE], [
21
21
AC_MSG_CHECKING([for MCA component $2 :$3 compile mode])
22
22
$4 = " static"
23
23
AC_MSG_RESULT([$$ 4])
24
24
])
25
25
26
26
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" ])
28
29
AS_IF([test " $1 " = " 1" ],
29
30
[ # Build libevent/include/event2/event-config.h. If we
30
31
# don't do it here, then libevent's Makefile.am will build
@@ -34,8 +35,8 @@ AC_DEFUN([MCA_opal_event_libevent2022_POST_CONFIG], [
34
35
# copied from libevent's Makefile.am.
35
36
36
37
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"
39
40
rm -f " $libevent_file .new"
40
41
cat > " $libevent_file .new" << EOF
41
42
/* event2/event-config.h
55
56
56
57
sed -e ' s/#define /#define _EVENT_/' \
57
58
-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"
59
60
echo " #endif" >> " $libevent_file .new"
60
61
61
62
# Only make a new .h libevent_file if the
74
75
75
76
# Add some stuff to CPPFLAGS so that the rest of the source
76
77
# tree can be built
77
- libevent_file= $libevent_basedir /libevent
78
+ libevent_file= $opal_event_libevent2022_basedir /libevent
78
79
CPPFLAGS= " -I$OPAL_TOP_SRCDIR /$libevent_file -I$OPAL_TOP_SRCDIR /$libevent_file /include $CPPFLAGS "
79
80
AS_IF([test " $OPAL_TOP_BUILDDIR " != " $OPAL_TOP_SRCDIR " ],
80
81
[CPPFLAGS= " -I$OPAL_TOP_BUILDDIR /$libevent_file /include $CPPFLAGS " ])
81
82
unset libevent_file
82
83
])
83
84
])
84
85
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 ------------------------------------------------
88
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
+
89
93
# We know that the external event component will be configured
90
94
# before this one because of its priority. This component is only
91
95
# needed if the external component was not successful in selecting
92
96
# itself.
93
97
AC_MSG_CHECKING([if event external component succeeded])
94
98
AS_IF([test " $opal_event_external_support " = " yes" ],
95
99
[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 ) ],
98
102
[AC_MSG_RESULT([no])
99
103
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 )])
101
105
])
102
106
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
+ ])
105
119
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])
108
131
109
132
CFLAGS_save= " $CFLAGS "
110
133
CFLAGS= " $OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS "
@@ -174,14 +197,14 @@ AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[
174
197
175
198
AC_MSG_RESULT([$event_args ])
176
199
200
+ # Invoke the embedded configure script.
177
201
# We define "random" to be "opal_random" so that Libevent will not
178
202
# use random(3) internally (and potentially unexpectedly perturb
179
203
# values returned by rand(3) to the application).
180
-
181
204
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" ])
185
208
if test " $libevent_happy " = " no" ; then
186
209
AC_MSG_WARN([Event library failed to configure])
187
210
AC_MSG_ERROR([Cannot continue])
@@ -199,26 +222,34 @@ AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[
199
222
# the value in the generated libevent/config.h (NOT
200
223
# libevent/include/event2/event-config.h!). Otherwise, set it to
201
224
# 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])
222
232
223
233
OPAL_VAR_SCOPE_POP
224
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