1414#
1515AC_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
2020AC_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
2626AC_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
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
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 ------------------------------------------------
8889AC_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+ ])
0 commit comments