forked from ofiwg/libfabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
305 lines (258 loc) · 8.28 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
dnl
dnl Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
dnl
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.60])
AC_INIT([libfabric], [1.4.0], [[email protected]])
AC_CONFIG_SRCDIR([src/fabric.c])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([1.11 dist-bzip2 foreign -Wall -Werror subdir-objects parallel-tests tar-ustar])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CANONICAL_HOST
macos=0
linux=0
freebsd=0
case $host_os in
*darwin*)
macos=1
;;
*linux*)
linux=1
;;
*freebsd*)
freebsd=1
;;
*)
AC_MSG_ERROR([libfabric only builds on Linux, OS X, and FreeBSD])
;;
esac
AM_CONDITIONAL([MACOS], [test "x$macos" = "x1"])
AM_CONDITIONAL([LINUX], [test "x$linux" = "x1"])
AM_CONDITIONAL([FREEBSD], [test "x$freebsd" = "x1"])
base_c_warn_flags="-Wall -Wundef -Wpointer-arith"
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Enable debugging @<:@default=no@:>@])
],
[CFLAGS="-g -O0 ${base_c_warn_flags} -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers $CFLAGS"
dbg=1],
[enable_debug=no
dbg=0])
AC_DEFINE_UNQUOTED([ENABLE_DEBUG],[$dbg],
[defined to 1 if libfabric was configured with --enable-debug, 0 otherwise])
# Fix autoconf's habit of setting CFLAGS="-g -O2" by default while still
# allowing the user to explicitly set CFLAGS=""
: ${CFLAGS="-fvisibility=hidden -O2 -DNDEBUG ${base_c_warn_flags}"}
# AM PROG_AR did not exist pre AM 1.11.x (where x is somewhere >0 and
# <3), but it is necessary in AM 1.12.x.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_ARG_WITH([valgrind],
AC_HELP_STRING([--with-valgrind],
[Enable valgrind annotations @<:@default=no@:>@]))
if test "$with_valgrind" != "" && test "$with_valgrind" != "no"; then
AC_DEFINE([INCLUDE_VALGRIND], 1,
[Define to 1 to enable valgrind annotations])
if test -d $with_valgrind; then
CPPFLAGS="$CPPFLAGS -I$with_valgrind/include"
fi
fi
AC_ARG_ENABLE([direct],
[AS_HELP_STRING([--enable-direct=@<:@provider@:>@],
[Enable direct calls to a fabric provider @<:@default=no@:>@])
],
[],
[enable_direct=no])
dnl Checks for programs
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_CPP
dnl Checks for header files.
AC_HEADER_STDC
dnl Check for compiler features
AC_C_TYPEOF
LT_INIT
LT_OUTPUT
dnl dlopen support is optional
AC_ARG_WITH([dlopen],
AC_HELP_STRING([--with-dlopen],
[dl-loadable provider support @<:@default=yes@:>@]),
)
if test "$freebsd" == "0"; then
AS_IF([test x"$with_dlopen" != x"no"], [
AC_CHECK_LIB(dl, dlopen, [],
AC_MSG_ERROR([dlopen not found. libfabric requires libdl.]))
])
fi
dnl Checks for libraries
AC_CHECK_LIB(pthread, pthread_mutex_init, [],
AC_MSG_ERROR([pthread_mutex_init() not found. libfabric requires libpthread.]))
AC_CHECK_FUNC([pthread_spin_init],
[have_spinlock=1],
[have_spinlock=0])
dnl shm_open not used in the common code on os-x
if test "$macos" -eq 0; then
AC_CHECK_FUNC([shm_open],
[],
[AC_SEARCH_LIBS([shm_open],[rt],[],
[AC_MSG_ERROR([shm_open() not found. libfabric requires shm_open.])])])
fi
AC_DEFINE_UNQUOTED([PT_LOCK_SPIN], [$have_spinlock],
[Define to 1 if pthread_spin_init is available.])
have_clock_gettime=0
have_host_get_clock_service=0
AC_CHECK_FUNCS([epoll_create])
if test "$ac_cv_func_epoll_create" = yes; then
AC_DEFINE([HAVE_EPOLL], [1], [Define if you have epoll support.])
fi
AC_SEARCH_LIBS([clock_gettime],[rt],
[have_clock_gettime=1],
[AC_CHECK_FUNCS([host_get_clock_service],
[have_host_get_clock_service=1],
[AC_MSG_ERROR([clock_gettime or host_get_clock_service
not found.])])])
AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME, [$have_clock_gettime],
[Define to 1 if clock_gettime is available.])
AC_DEFINE_UNQUOTED(HAVE_HOST_GET_CLOCK_SERVICE, [$have_host_get_clock_service],
[Define to 1 if host_clock_get_service is available.])
dnl Check for gcc atomic intrinsics
AC_MSG_CHECKING(compiler support for c11 atomics)
AC_TRY_LINK([#include <stdatomic.h>],
[atomic_int a;
atomic_init(&a, 0);
#ifdef __STDC_NO_ATOMICS__
#error c11 atomics are not supported
#else
return 0;
#endif
],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ATOMICS, 1, [Set to 1 to use c11 atomic functions])
],
[AC_MSG_RESULT(no)])
if test "$with_valgrind" != "" && test "$with_valgrind" != "no"; then
AC_CHECK_HEADER(valgrind/memcheck.h, [],
AC_MSG_ERROR([valgrind requested but <valgrind/memcheck.h> not found.]))
fi
AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
[if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
ac_cv_version_script=yes
else
ac_cv_version_script=no
fi])
AC_ARG_ENABLE([embedded],
[AS_HELP_STRING([--enable-embedded],
[Enable embedded support (turns off symbol versioning) @<:@default=no@:>@])
],
[ac_asm_symver_support=0
icc_symver_hack=1],
[enable_embedded=no])
AM_CONDITIONAL([EMBEDDED], [test x"$enable_embedded" = x"yes"])
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$ac_cv_version_script" = "yes")
dnl Disable symbol versioning when -ipo is in CFLAGS or ipo is disabled by icc.
dnl The gcc equivalent ipo (-fwhole-program) seems to work fine.
AS_CASE([$CFLAGS],
[*-ipo*],[
AC_MSG_NOTICE([disabling symbol versioning support with -ipo CFLAG])
icc_symver_hack=1
ac_asm_symver_support=0
],
[]
)
dnl Check for symbol versioning compiler + linker support.
dnl If icc + ipo, then print disabled and skip check
AC_MSG_CHECKING(for .symver assembler support)
AS_IF([test "$icc_symver_hack"],
[AC_MSG_RESULT(disabled)],
[
AC_TRY_LINK([],
[__asm__(".symver main_, main@ABIVER_1.0");],
[
AC_MSG_RESULT(yes)
ac_asm_symver_support=1
],
[
AC_MSG_RESULT(no)
ac_asm_symver_support=0
])
]) dnl AS_IF icc_symver_hack
AC_DEFINE_UNQUOTED([HAVE_SYMVER_SUPPORT], [$ac_asm_symver_support],
[Define to 1 if compiler/linker support symbol versioning.])
AC_MSG_CHECKING(for __alias__ attribute support)
AC_TRY_LINK(
[
int foo(int arg);
int foo(int arg) { return arg + 3; };
int foo2(int arg) __attribute__ (( __alias__("foo")));
],
[ /* empty main */ ],
[
AC_MSG_RESULT(yes)
ac_prog_cc_alias_symbols=1
],
[
AC_MSG_RESULT(no)
ac_prog_cc_alias_symbols=0
])
AC_DEFINE_UNQUOTED([HAVE_ALIAS_ATTRIBUTE], [$ac_prog_cc_alias_symbols],
[Define to 1 if the linker supports alias attribute.])
AC_CHECK_FUNCS([getifaddrs])
dnl Provider-specific checks
FI_PROVIDER_INIT
FI_PROVIDER_SETUP([psm])
FI_PROVIDER_SETUP([psm2])
FI_PROVIDER_SETUP([sockets])
FI_PROVIDER_SETUP([verbs])
dnl The usnic provider must be setup after the verbs provider. See
dnl prov/usnic/configure.m4 for details.
FI_PROVIDER_SETUP([usnic])
FI_PROVIDER_SETUP([mxm])
FI_PROVIDER_SETUP([gni])
FI_PROVIDER_SETUP([udp])
FI_PROVIDER_SETUP([rxm])
FI_PROVIDER_SETUP([rxd])
FI_PROVIDER_FINI
dnl Configure the .pc file
FI_PROVIDER_SETUP_PC
# If the user requested to build in direct mode, but
# we have more than one provider, error.
PROVIDER_DIRECT=no
FI_DIRECT_PROVIDER_API_10=/dev/null
AS_IF([test x"$enable_direct" != x"no"],
[AS_IF([test "$PROVIDERS_COUNT" -gt 1],
[AC_MSG_WARN([Only one provider can be chosen when using --enable-direct])
AC_MSG_ERROR(Cannot continue)])
PROVIDER_DIRECT=$enable_direct
AC_DEFINE_UNQUOTED([FABRIC_DIRECT_ENABLED], [1], [define when building with FABRIC_DIRECT support])
FI_DIRECT_PROVIDER_API_10="$srcdir/prov/$enable_direct/provider_FABRIC_1.0.map"
AS_IF([test ! -r "$FI_DIRECT_PROVIDER_API_10"],
[AC_MSG_WARN([--enable-direct=$enable_direct specified, but $FI_DIRECT_PROVIDER_API_10 does not exist])
AC_MSG_ERROR([Cannot continue])])])
AC_SUBST(PROVIDER_DIRECT)
AC_SUBST_FILE(FI_DIRECT_PROVIDER_API_10)
AM_CONDITIONAL([HAVE_DIRECT], [test x"$enable_direct" != x"no"])
AC_CONFIG_FILES([Makefile libfabric.spec libfabric.map])
AC_OUTPUT
dnl helpful output
if test "$PROVIDERS_TO_BUILD" = ""; then
echo "***"
echo "*** No providers were configured. This may not be what you wanted."
echo "***"
exit 1
fi
for i in $PROVIDERS_TO_BUILD; do
v=${i}_dl
if test `eval echo \\$${v}` == "1"; then
dso="$i ${dso}"
else
builtin="$i ${builtin}"
fi
done
cat <<EOF
***
*** Built-in providers: ${builtin}
*** DSO providers: ${dso}
***
EOF