-
Notifications
You must be signed in to change notification settings - Fork 12
/
configure.ac
255 lines (213 loc) · 8.71 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
AC_INIT([SNet], [1.x], [[email protected]], [snet], [http://www.snet-home.org/])
AC_PREREQ([2.68])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux])
AM_INIT_AUTOMAKE([1.11 tar-ustar no-define foreign dist-bzip2 subdir-objects
parallel-tests color-tests silent-rules])
AM_SILENT_RULES([yes])
AC_ARG_ENABLE([dist-scc], [AS_HELP_STRING([--enable-dist-scc],
[Enable the custom distribution layer for the SCC (default is disabled)])],
[], [enable_dist_scc=no])
if test x$enable_dist_scc = xyes; then
AC_DEFINE([ENABLE_DIST_SCC], [1], [Set to 1 to enable the SCC distribution layer])
fi
AM_CONDITIONAL([ENABLE_DIST_SCC], [test x$enable_dist_scc = xyes])
dnl If --enable-dist-mpi=auto is used, try to find MPI, but use standard C compiler if it is not found.
dnl If --enable-dist-mpi=yes is used, try to find MPI and fail if it isn't found.
dnl If --enable-dist-mpi=no is used, use a standard C compiler instead.
AC_ARG_ENABLE([dist-mpi], [AS_HELP_STRING([--enable-dist-mpi],
[Enable the distribution layer using MPI. Set to "yes", "no" (or --disable), or "auto" (default). If "auto", enable if MPI is available.])],
[], [enable_dist_mpi=auto])
dnl try to detect the MPI compiler before any other C tests are run. This
dnl MUST appear before other C tests / configurations so that they can
dnl pick `mpicc' as compiler name.
use_mpi=no
AX_PROG_CC_MPI([test x"$enable_dist_mpi" != xno], [use_mpi=yes],
[if test x"$enable_dist_mpi" = xyes; then
AC_MSG_FAILURE([MPI compiler requested, but couldn't use MPI.])
elif test x"$enable_dist_mpi" = xauto; then
AC_MSG_WARN([No MPI compiler found, won't use MPI.])
fi])
if test $use_mpi = yes; then
AC_DEFINE([ENABLE_DIST_MPI], [1], [Set to 1 to enable the MPI distribution layer])
fi
AM_CONDITIONAL([ENABLE_DIST_MPI], [test $use_mpi = yes])
dnl ensure that either mpicc or cc detected above are configured in c99 mode
AC_PROG_CC_C99
dnl and API extensions are available.
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CPP
AC_PROG_YACC
AC_PROG_LEX
AC_LANG_PUSH([C])
AX_CFLAGS_WARN_ALL
AX_PTHREAD
AX_APPEND_FLAG(["$PTHREAD_CFLAGS"], CFLAGS)
AX_APPEND_FLAG(["$PTHREAD_LIBS"], LIBS)
#LIBS="$LIBS $PTHREAD_LIBS"
#CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AC_ARG_ENABLE([setaffinity], [AS_HELP_STRING([--disable-setaffinity],
[Disable the use of pthread_setaffinity_np to limit the number
of processor cores when the -w option is given to the runtime
system (default is enabled).])])
if test x$enable_setaffinity != xno; then
AC_CHECK_FUNCS([pthread_setaffinity_np])
fi
AC_CHECK_FUNCS([pthread_yield_np])
AC_CHECK_FUNCS([pthread_yield])
AC_CHECK_FUNCS([localtime_r])
AC_CHECK_FUNCS([sched_setaffinity])
AC_SEARCH_LIBS([sqrt], [m])
AC_SEARCH_LIBS([clock_gettime], [rt])
dnl check network functions
AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([inet_aton], [resolv])
dnl check for compiler builtins for
dnl atomic memory access (__sync_fetch_and_add/dec)
dnl !!! we need to try to link the program, on platforms on which
dnl !!! these functions are not available, they are undefined references
AC_MSG_CHECKING([atomic compiler builtins])
have_compiler_atomics=no
AC_TRY_LINK([], [
int a = 0;
(void) __sync_fetch_and_add(&a, 1);
(void) __sync_fetch_and_sub(&a, 1);
(void) __sync_lock_test_and_set(&a, 42);
],
[have_compiler_atomics=yes])
AC_MSG_RESULT([$have_compiler_atomics])
if test $have_compiler_atomics = yes; then
AC_DEFINE([HAVE_SYNC_ATOMIC_BUILTINS], [1], [Define to 1 if compiler builtins for atomic memory access are available.])
fi
have___thread=no
AX_TLS([have___thread=yes])
if test $have___thread = yes; then
AC_DEFINE([HAVE___THREAD], [1], [Define to 1 if compiler supports the __thread storage class.])
fi
AC_LANG_POP([C])
LT_PREREQ([2.2])
LT_INIT()
AC_SUBST([LIBTOOL_DEPS])
dnl check for building lpel threading backend
AC_ARG_WITH([lpel-includes], [AC_HELP_STRING([--with-lpel-includes=DIR], [look up lpel.h in DIR])], [], [with_lpel_includes=])
AC_MSG_CHECKING([for lpel.h in $with_lpel_includes])
if test -r "$with_lpel_includes/lpel_common.h" && test -r "$with_lpel_includes/lpel.h" && test -r "$with_lpel_includes/hrc_lpel.h"
then
with_lpel_includes=`(cd "$with_lpel_includes"; pwd)`
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_WARN([unable to find $with_lpel_includes/lpel_common.h, $with_lpel_includes/lpel.h, $with_lpel_includes/hrc_lpel.h. Cannot use LPEL])
with_lpel_includes=
fi
AC_ARG_WITH([lpel-libs], [AC_HELP_STRING([--with-lpel-libs=DIR], [look up liblpel.la in DIR])], [], [with_lpel_libs=])
AC_MSG_CHECKING([for liblpel.la in $with_lpel_libs])
if test -r "$with_lpel_libs/liblpel.la"; then
with_lpel_libs=`(cd "$with_lpel_libs"; pwd)`
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_WARN([unable to find $with_lpel_libs/liblpel.la, cannot use LPEL])
with_lpel_libs=
fi
have_lpel=no
if test -n "$with_lpel_includes" -a -n "$with_lpel_libs"; then
LPEL_INCLUDES=-I$with_lpel_includes
LIBLPEL_LA=$with_lpel_libs/liblpel.la
AC_SUBST([LIBLPEL_LA])
LIBLPEL_HRC_LA=$with_lpel_libs/liblpel_hrc.la
AC_SUBST([LIBLPEL_HRC_LA])
AC_SUBST([LPEL_INCLUDES])
have_lpel=yes
fi
AM_CONDITIONAL([ENABLE_TH_LPEL], [test $have_lpel = yes])
dnl Check for support of portable hardware locality.
AC_ARG_WITH([hwloc-includes],
[AC_HELP_STRING([--with-hwloc-includes=DIR],
[look up hwloc.h in DIR])],
[],
[with_hwloc_includes=])
if test -n "$with_hwloc_includes"
then
AC_MSG_CHECKING([for hwloc.h in $with_hwloc_includes])
if test -r "$with_hwloc_includes/hwloc.h"
then
with_hwloc_includes=`(cd "$with_hwloc_includes" && pwd)`
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_WARN([unable to find $with_hwloc_includes/hwloc.h. Cannot use hwloc!])
with_hwloc_includes=
fi
fi
if test -n "$with_hwloc_includes"
then
AC_ARG_WITH([hwloc-libs],
[AC_HELP_STRING([--with-hwloc-libs=DIR],
[look up libhwloc.la in DIR])],
[],
[with_hwloc_libs=])
AC_MSG_CHECKING([for libhwloc.la in $with_hwloc_libs])
if test -r "$with_hwloc_libs/libhwloc.la"; then
with_hwloc_libs=`(cd "$with_hwloc_libs" && pwd)`
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_WARN([unable to find $with_hwloc_libs/libhwloc.la. Cannot use hwloc!])
with_hwloc_libs=
fi
fi
if test -n "$with_hwloc_includes" -a -n "$with_hwloc_libs"
then
HWLOC_INCLUDES=-I$with_hwloc_includes
HWLOC_LIBS=-L$with_hwloc_libs
LIBHWLOC_LA=$with_hwloc_libs/libhwloc.la
AC_SUBST([LIBHWLOC_LA])
AC_SUBST([HWLOC_INCLUDES])
AC_SUBST([HWLOC_LIBS])
AC_DEFINE([ENABLE_HWLOC], [1], [Set to 1 to enable the hwloc.])
AM_CONDITIONAL([ENABLE_HWLOC], [true])
else
AM_CONDITIONAL([ENABLE_HWLOC], [false])
fi
dnl Check for support for the resource management service.
AC_ARG_ENABLE([resserv], [AS_HELP_STRING([--enable-resserv],
[Enable support for the resource management service (default is disabled).])],
[], [enable_resserv=no])
if test x$enable_resserv = xyes; then
AC_DEFINE([ENABLE_RESSERV], [1], [Set to 1 to enable the resource management service.])
fi
AM_CONDITIONAL([ENABLE_RESSERV], [test x$enable_resserv = xyes])
dnl check for sac compiler in order to build sac4snet interface
AC_ARG_ENABLE([sac4snet], [AS_HELP_STRING([--enable-sac4snet],
[Enable the SAC interface to S-NET. Set to "yes", "no" (or --disable), or "auto" (default). If "auto", enable if SAC is available.])],
[], [enable_sac4snet=auto])
if test "x$enable_sac4snet" != xno; then
AC_CHECK_PROGS([SAC2C], [sac2c], [no])
AC_CHECK_PROGS([SAC4C], [sac4c], [no])
if test "x$SAC2C" = xno -o "x$SAC4C" = xno; then
if test "x$enable_sac4snet" = xyes; then
AC_MSG_ERROR([sac2c or sac4c not found. Cannot build sac4snet (maybe use --disable-sac4snet?)])
fi
enable_sac4snet=no
else
if test -z "$SAC2CBASE"; then
AC_MSG_WARN([SAC2CBASE is not set, expect problems during build.])
fi
enable_sac4snet=yes
fi
fi
AM_CONDITIONAL([ENABLE_SAC4SNET], [test x$enable_sac4snet = xyes])
AC_ARG_WITH([sac4snet-targets], [AC_HELP_STRING([--with-sac4snet-targets],
[Select which back-end targets to build the sac4snet interface for. Defaults to "seq,mtpth,mtlpel"])],
[], [with_sac4snet_targets=seq,mtpth,mtlpel])
with_sac4snet_targets=`echo "$with_sac4snet_targets" | tr ',' ' '`
for target in $with_sac4snet_targets; do
eval enable_sac4snet__$target=yes
done
AM_CONDITIONAL([ENABLE_SAC4SNET_SEQ], [test x$enable_sac4snet__seq = xyes])
AM_CONDITIONAL([ENABLE_SAC4SNET_MT_PTH], [test x$enable_sac4snet__mtpth = xyes])
AM_CONDITIONAL([ENABLE_SAC4SNET_MT_LPEL], [test x$enable_sac4snet__mtlpel = xyes])
dnl generate output
AC_OUTPUT([Makefile src/interfaces/sac4snet/Makefile])