Skip to content

Commit 92d8941

Browse files
Merge pull request #5395 from jsquyres/pr/prefer-externals
Change defaults to prefer external libevent/hwloc
2 parents 30fb635 + a70ecf5 commit 92d8941

File tree

4 files changed

+218
-162
lines changed

4 files changed

+218
-162
lines changed

opal/mca/event/configure.m4

+38-7
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,59 @@
11
dnl -*- shell-script -*-
22
dnl
3-
dnl Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
3+
dnl Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved
44
dnl $COPYRIGHT$
55
dnl
66
dnl Additional copyrights may follow
77
dnl
88
dnl $HEADER$
99
dnl
1010

11-
# There will only be one component used in this framework, and it will
12-
# be selected at configure time by priority. Components must set
13-
# their priorities in their configure.m4 files. They must also set
14-
# the shell variable $opal_event_base_include to a header file name
15-
# (relative to opal/mca/event) that will be included in
16-
# opal/mca/event/event.h.
11+
dnl There will only be one component used in this framework, and it will
12+
dnl be selected at configure time by priority. Components must set
13+
dnl their priorities in their configure.m4 files. They must also set
14+
dnl the shell variable $opal_event_base_include to a header file name
15+
dnl (relative to opal/mca/event) that will be included in
16+
dnl opal/mca/event/event.h.
1717

1818
dnl We only want one winning component (vs. STOP_AT_FIRST_PRIORITY,
1919
dnl which will allow all components of the same priority who succeed to
2020
dnl win)
21+
2122
m4_define(MCA_opal_event_CONFIGURE_MODE, STOP_AT_FIRST)
2223

24+
dnl
25+
dnl Setup --with-libevent and --with-libevent-libdir
26+
dnl
27+
AC_DEFUN([MCA_opal_event_SETUP],[
28+
AC_ARG_WITH([libevent],
29+
[AC_HELP_STRING([--with-libevent=DIR],
30+
[Search for libevent headers and libraries in DIR. Should only be used if an external copy of libevent is being used.])])
31+
32+
# Bozo check
33+
AS_IF([test "$with_libevent" = "no"],
34+
[AC_MSG_WARN([It is not possible to configure Open MPI --without-libevent])
35+
AC_MSG_ERROR([Cannot continue])])
36+
AS_IF([test "$with_libevent" = "yes"],
37+
[with_libevent=])
38+
39+
AC_ARG_WITH([libevent-libdir],
40+
[AC_HELP_STRING([--with-libevent-libdir=DIR],
41+
[Search for libevent libraries in DIR. Should only be used if an external copy of libevent is being used.])])
42+
43+
# Make sure the user didn't specify --with-libevent=internal and
44+
# --with-libevent-libdir=whatever (because you can only specify
45+
# --with-libevent-libdir when external libevent is being used).
46+
AS_IF([test "$with_libevent" = "internal" && test -n "$with_libevent_libdir"],
47+
[AC_MSG_WARN([Both --with-libevent=internal and --with-libevent-libdir=DIR])
48+
AC_MSG_WARN([were specified, which does not make sense.])
49+
AC_MSG_ERROR([Cannot continue])])
50+
])
51+
2352
AC_DEFUN([MCA_opal_event_CONFIG],[
2453
opal_event_base_include=
2554

55+
MCA_opal_event_SETUP
56+
2657
# configure all the components
2758
MCA_CONFIGURE_FRAMEWORK($1, $2, 1)
2859

opal/mca/event/external/configure.m4

+101-88
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# -*- shell-script -*-
22
#
3-
# Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved.
3+
# Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved
44
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
5-
# Copyright (c) 2015-2017 Research Organization for Information Science
5+
# Copyright (c) 2015-2018 Research Organization for Information Science
66
# and Technology (RIST). All rights reserved.
77
#
88
# Copyright (c) 2017 Intel, Inc. All rights reserved.
@@ -56,72 +56,59 @@ AC_DEFUN([MCA_opal_event_external_POST_CONFIG],[
5656
AC_DEFUN([MCA_opal_event_external_CONFIG],[
5757
AC_CONFIG_FILES([opal/mca/event/external/Makefile])
5858

59-
OPAL_VAR_SCOPE_PUSH([opal_event_external_CPPFLAGS_save opal_event_external_CFLAGS_save opal_event_external_LDFLAGS_save opal_event_external_LIBS_save])
60-
61-
AC_ARG_WITH([libevent],
62-
[AC_HELP_STRING([--with-libevent=DIR],
63-
[Search for libevent headers and libraries in DIR. Should only be used if an external copy of libevent is being used.])])
64-
65-
# Bozo check
66-
AS_IF([test "$with_libevent" = "no"],
67-
[AC_MSG_WARN([It is not possible to configure Open MPI --without-libevent])
68-
AC_MSG_ERROR([Cannot continue])])
69-
70-
AC_ARG_WITH([libevent-libdir],
71-
[AC_HELP_STRING([--with-libevent-libdir=DIR],
72-
[Search for libevent libraries in DIR. Should only be used if an external copy of libevent is being used.])])
73-
74-
# Make sure the user didn't specify --with-libevent=internal and
75-
# --with-libevent-libdir=whatever (because you can only specify
76-
# --with-libevent-libdir when external libevent is being used).
77-
AS_IF([test "$with_libevent" = "internal" && test -n "$with_libevent_libdir"],
78-
[AC_MSG_WARN([Both --with-libevent=internal and --with-libevent-libdir=DIR])
79-
AC_MSG_WARN([were specified, which does not make sense.])
80-
AC_MSG_ERROR([Cannot continue])])
81-
82-
# Do we want this external component? (slightly redundant logic,
83-
# but hopefully slightly more clear...)
84-
opal_event_external_want=no
85-
AS_IF([test "$with_libevent" = "external"], [opal_event_external_want=yes])
86-
AS_IF([test -n "$with_libevent_libdir"], [opal_event_external_want=yes])
87-
AS_IF([test -n "$with_libevent" && test "$with_libevent" != "no" && test "$with_libevent" != "internal"], [opal_event_external_want=yes])
88-
89-
# If we want external support, try it
90-
AS_IF([test "$opal_event_external_want" = "yes"],
91-
[ # Error out if the specified dir does not exist
92-
OPAL_CHECK_WITHDIR([libevent-libdir], [$with_libevent_libdir],
93-
[libevent.*])
94-
95-
AC_MSG_CHECKING([for external libevent in])
96-
AS_IF([test "$with_libevent" != "external" && test "$with_libevent" != "yes"],
97-
[opal_event_dir=$with_libevent
98-
AC_MSG_RESULT([$opal_event_dir])
99-
OPAL_CHECK_WITHDIR([libevent], [$opal_event_dir],
100-
[include/event.h])
101-
AS_IF([test -z "$with_libevent_libdir" || test "$with_libevent_libdir" = "yes"],
102-
[AC_MSG_CHECKING([for $with_libevent/lib64])
103-
AS_IF([test -d "$with_libevent/lib64"],
104-
[opal_event_libdir_found=yes
105-
AC_MSG_RESULT([found])],
106-
[opal_event_libdir_found=no
107-
AC_MSG_RESULT([not found])])
108-
AS_IF([test "$opal_event_libdir_found" = "yes"],
109-
[opal_event_libdir="$with_libevent/lib64"],
110-
[AC_MSG_CHECKING([for $with_libevent/lib])
111-
AS_IF([test -d "$with_libevent/lib"],
112-
[AC_MSG_RESULT([found])
113-
opal_event_libdir="$with_libevent/lib"],
114-
[AC_MSG_RESULT([not found])
115-
AC_MSG_WARN([Library directories were not found:])
116-
AC_MSG_WARN([ $with_libevent/lib64])
117-
AC_MSG_WARN([ $with_libevent/lib])
118-
AC_MSG_WARN([Please use --with-libevent-libdir to identify it.])
119-
AC_MSG_ERROR([Cannot continue])])])])],
120-
[AC_MSG_RESULT([(default search paths)])])
121-
AS_IF([test ! -z "$with_libevent_libdir" && test "$with_libevent_libdir" != "yes"],
122-
[opal_event_libdir="$with_libevent_libdir"])
123-
124-
opal_event_external_CPPFLAGS_save=$CPPFLAGS
59+
OPAL_VAR_SCOPE_PUSH([opal_event_external_CPPFLAGS_save opal_event_external_CFLAGS_save opal_event_external_LDFLAGS_save opal_event_external_LIBS_save opal_event_dir opal_event_external_support opal_event_summary_msg])
60+
61+
# Make some processing below easier ($with_libevent==yes and
62+
# $with_libevent==no has already been filtered out).
63+
AS_IF([test "$with_libevent" = "external"],
64+
[with_libevent=])
65+
66+
opal_event_summary_msg="internal"
67+
68+
# Once we get to this point, $with_libevent is either: blank, a
69+
# directory location, or "internal".
70+
71+
# Check the value of $with_libevent_libdir. This macro safely
72+
# handles "yes", "no", blank, and directory name values.
73+
OPAL_CHECK_WITHDIR([libevent-libdir], [$with_libevent_libdir],
74+
[libevent.*])
75+
76+
# Did the user want us to check for libevent in a specific location?
77+
AC_MSG_CHECKING([for external libevent in])
78+
AS_IF([test -n "$with_libevent" && \
79+
test "$with_libevent" != "external" && \
80+
test "$with_libevent" != "internal" && \
81+
test "$with_libevent" != "yes" && \
82+
test "$with_libevent" != "no"],
83+
[opal_event_dir=$with_libevent
84+
AC_MSG_RESULT([$opal_event_dir])
85+
OPAL_CHECK_WITHDIR([libevent], [$opal_event_dir],
86+
[include/event.h])
87+
AS_IF([test -z "$with_libevent_libdir" || test "$with_libevent_libdir" = "yes"],
88+
[AC_MSG_CHECKING([for $with_libevent/lib64])
89+
AS_IF([test -d "$with_libevent/lib64"],
90+
[opal_event_libdir_found=yes
91+
AC_MSG_RESULT([found])],
92+
[opal_event_libdir_found=no
93+
AC_MSG_RESULT([not found])])
94+
AS_IF([test "$opal_event_libdir_found" = "yes"],
95+
[opal_event_libdir="$with_libevent/lib64"],
96+
[AC_MSG_CHECKING([for $with_libevent/lib])
97+
AS_IF([test -d "$with_libevent/lib"],
98+
[AC_MSG_RESULT([found])
99+
opal_event_libdir="$with_libevent/lib"],
100+
[AC_MSG_RESULT([not found])
101+
AC_MSG_WARN([Library directories were not found:])
102+
AC_MSG_WARN([ $with_libevent/lib64])
103+
AC_MSG_WARN([ $with_libevent/lib])
104+
AC_MSG_WARN([Please use --with-libevent-libdir to identify it.])
105+
AC_MSG_ERROR([Cannot continue])])])])],
106+
[AC_MSG_RESULT([(default search paths)])])
107+
AS_IF([test ! -z "$with_libevent_libdir" && test "$with_libevent_libdir" != "yes"],
108+
[opal_event_libdir="$with_libevent_libdir"])
109+
110+
AS_IF([test "$with_libevent" != "internal"],
111+
[opal_event_external_CPPFLAGS_save=$CPPFLAGS
125112
opal_event_external_CFLAGS_save=$CFLAGS
126113
opal_event_external_LDFLAGS_save=$LDFLAGS
127114
opal_event_external_LIBS_save=$LIBS
@@ -136,23 +123,42 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[
136123
[opal_event_external_support=yes],
137124
[opal_event_external_support=no])
138125

139-
# Ensure that this libevent has the symbol
140-
# "evthread_set_lock_callbacks", which will only exist if
141-
# libevent was configured with thread support.
142-
LIBS="$opal_event_external_LDFLAGS $LIBS"
143-
AC_CHECK_LIB([event], [evthread_set_lock_callbacks],
144-
[],
145-
[AC_MSG_WARN([External libevent does not have thread support])
146-
AC_MSG_WARN([Open MPI requires libevent to be compiled with])
147-
AC_MSG_WARN([thread support enabled])
148-
AC_MSG_ERROR([Cannot continue])])
149-
150-
AC_CHECK_LIB([event_pthreads], [evthread_use_pthreads],
151-
[],
152-
[AC_MSG_WARN([External libevent does not have thread support])
153-
AC_MSG_WARN([Open MPI requires libevent to be compiled with])
154-
AC_MSG_WARN([thread support enabled])
155-
AC_MSG_ERROR([Cannot continue])])
126+
AS_IF([test "$opal_event_external_support" = "yes"],
127+
[# Ensure that this libevent has the symbol
128+
# "evthread_set_lock_callbacks", which will only exist if
129+
# libevent was configured with thread support.
130+
LIBS="$opal_event_external_LDFLAGS $LIBS"
131+
AC_CHECK_LIB([event], [evthread_set_lock_callbacks],
132+
[],
133+
[AC_MSG_WARN([External libevent does not have thread support])
134+
AC_MSG_WARN([Open MPI requires libevent to be compiled with])
135+
AC_MSG_WARN([thread support enabled])
136+
opal_event_external_support=no])])
137+
138+
AS_IF([test "$opal_event_external_support" = "yes"],
139+
[AC_CHECK_LIB([event_pthreads], [evthread_use_pthreads],
140+
[],
141+
[AC_MSG_WARN([External libevent does not have thread support])
142+
AC_MSG_WARN([Open MPI requires libevent to be compiled with])
143+
AC_MSG_WARN([thread support enabled])
144+
opal_event_external_support=no])])
145+
146+
AS_IF([test "$opal_event_external_support" = "yes"],
147+
[AS_IF([test -z "$with_libevent" || test "$with_libevent" = "yes"],
148+
[AC_MSG_CHECKING([if external libevent version is 2.0.21 or greater])
149+
AC_COMPILE_IFELSE(
150+
[AC_LANG_PROGRAM([[#include <event.h>]],
151+
[[
152+
#if _EVENT_NUMERIC_VERSION < 0x02001500
153+
#error "libevent API version is less than 0x02001500"
154+
#endif
155+
]])],
156+
[AC_MSG_RESULT([yes])],
157+
[AC_MSG_RESULT([no])
158+
opal_event_summary_msg="internal (external libevent version is less that internal version 2.0.21)"
159+
AC_MSG_WARN([external libevent version is less than internal version (2.0.21)])
160+
AC_MSG_WARN([using internal libevent])
161+
opal_event_external_support=no])])])
156162

157163
CPPFLAGS=$opal_event_external_CPPFLAGS_save
158164
CFLAGS=$opal_event_external_CFLAGS_save
@@ -171,20 +177,27 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[
171177
# building with developer headers so that our headers can
172178
# be found.
173179
event_external_WRAPPER_EXTRA_LDFLAGS=$opal_event_external_LDFLAGS
174-
event_external_WRAPPER_EXTRA_LIBS=$opal_event_external_LIBS
175-
])
180+
event_external_WRAPPER_EXTRA_LIBS=$opal_event_external_LIBS])
181+
182+
##################################################################
176183

177184
# Done!
178185
AS_IF([test "$opal_event_external_support" = "yes"],
179-
[ # If we configured successfully, set
186+
[# If we configured successfully, set
180187
# OPAL_HAVE_WORKING_EVENTOPS to 1 (it's a calculated value
181188
# in the embedded Open MPI libevent, so we can only assume
182189
# what it is in the installed libevent :-\ ).
183190
file=$opal_event_dir/include/libevent/config.h
184191
OPAL_HAVE_WORKING_EVENTOPS=1
192+
opal_event_summary_msg="external"
185193
$1],
186194
[OPAL_HAVE_WORKING_EVENTOPS=0
195+
AS_IF([test "$with_libevent" != internal && test -n "$with_libevent"],
196+
[AC_MSG_WARN([external libevent requested but cannot be built])
197+
AC_MSG_ERROR([Cannot continue.])])
187198
$2])
188199

200+
OPAL_SUMMARY_ADD([[Miscellaneous]],[[Libevent support]], [], [$opal_event_summary_msg])
201+
189202
OPAL_VAR_SCOPE_POP
190203
])dnl

0 commit comments

Comments
 (0)