-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
544 lines (476 loc) · 15.2 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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
# Copyright (C) 2020, Lawrence Berkeley National Laboratory.
# All rights reserved.
#
# This file is part of Taskworks. The full Taskworks copyright notice,
# including terms governing use, modification, and redistribution, is
# contained in the file COPYING at the root of the source code distribution
# tree.
AC_PREREQ(2.59)
AC_INIT([taskworks], [0.1], [])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/include/taskworks.h.in])
AC_CONFIG_HEADER([src/config.h])
# Init automake
AM_INIT_AUTOMAKE
AM_SILENT_RULES
AC_DEFUN([UD_MSG_DEBUG],
[if test "x${te_ac_debug}" = xyes ; then
AC_MSG_NOTICE([DEBUG: $1])
fi
]
)
# Set the prefix to an taskworks directory in the source root.
# AC_PREFIX_DEFAULT([`pwd`/taskworks])
AH_TEMPLATE([HAVE_MPI], [Enable MPI support.])
AH_TEMPLATE([TWI_DEBUG], [Debug build.])
AH_TEMPLATE([HAVE_ABT], [Enable Argobots integration.])
AH_TEMPLATE([HAVE_LIBEVENT], [Enable libevent integration.])
# Make tests
AM_EXTRA_RECURSIVE_TARGETS([tests])
## ----------------------------------------------------------------------
## Source any special files that we need. These files normally aren't
## present but can be used by the maintainers to fine tune things like
## turning on debug or profiling flags for the compiler. The search order
## is:
##
## CPU-VENDOR-OS
## VENDOR-OS
## CPU-OS
## CPU-VENDOR
## OS
## VENDOR
## CPU
##
## If the `OS' ends with a version number then remove it. For instance,
## `freebsd3.1' would become `freebsd'
AC_CANONICAL_HOST
case $host_os in
aix*)
host_os_novers=aix
;;
freebsd*)
host_os_novers=freebsd
;;
netbsd*)
host_os_novers=netbsd
;;
solaris*)
host_os_novers=solaris
;;
*)
host_os_novers=$host_os
;;
esac
host_config="none"
for f in $host_cpu-$host_vendor-$host_os \
$host_cpu-$host_vendor-$host_os_novers \
$host_vendor-$host_os \
$host_vendor-$host_os_novers \
$host_cpu-$host_os \
$host_cpu-$host_os_novers \
$host_cpu-$host_vendor \
$host_os \
$host_os_novers \
$host_vendor \
$host_cpu ; do
AC_MSG_CHECKING([for config $f])
if test -f "$srcdir/hdf5_config_scripts/$f"; then
host_config=$srcdir/hdf5_config_scripts/$f
AC_MSG_RESULT([found])
break
fi
AC_MSG_RESULT([no])
done
if test "X$host_config" != "Xnone"; then
CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`"
. $host_config
fi
# ----------------------------------------------------------------------
## Source any special site-specific file
# ----------------------------------------------------------------------
hname="`hostname`"
while test -n "$hname"; do
file=$srcdir/hdf5_config_scripts/site-specific/host-$hname
AC_MSG_CHECKING([for config $file])
if test -f "$file"; then
. $file
AC_MSG_RESULT([found])
break
fi
AC_MSG_RESULT([no])
hname_tmp=$hname
hname="`echo $hname | cut -d. -f2-99`"
test "$hname_tmp" = "$hname" && break
done
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Search for mpi compiler if parallel is enabled
# ----------------------------------------------------------------------
AC_ARG_ENABLE([parallel], [AS_HELP_STRING([--enable-parallel], [Search for MPI-IO and MPI support files])],[enable_parallel=${enableval}], [enable_parallel=no])
if test "x$enable_parallel" = "xyes"; then
AC_ARG_VAR(MPICC, [MPI C compiler, @<:@default: CC@:>@])
AC_ARG_VAR(MPICXX, [MPI C++ compiler, @<:@default: CXX@:>@])
ac_user_MPICC=$MPICC
ac_user_MPICXX=$MPICXX
if test "x$MPICC" = x && test "x$CC" != x ; then ac_user_MPICC=$CC ; fi
if test "x$MPICXX" = x && test "x$CXX" != x ; then ac_user_MPICXX=$CXX ; fi
CANDIDATE_MPICC="${MPICC} mpicc mpicc_r"
CANDIDATE_MPICXX="${MPICXX} mpicxx mpic++ mpiCC mpcxx mpc++ mpicxx_r mpiCC_r mpcxx_r mpic++_r mpc++_r"
dnl add GNU MPI compilers
CANDIDATE_MPICC="$CANDIDATE_MPICC mpigcc mpgcc mpigcc_r mpgcc_r"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX mpig++ mpg++ mpig++_r mpg++_r"
dnl add IBM MPI compilers
CANDIDATE_MPICC="$CANDIDATE_MPICC mpcc_r mpcc mpixlc_r mpixlc"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX mpCC_r mpCC mpixlcxx_r mpixlcxx mpixlC_r mpixlC"
dnl add IBM BGL MPI compilers
CANDIDATE_MPICC="$CANDIDATE_MPICC blrts_xlc mpxlc_r mpxlc"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX blrts_xlC mpxlC_r mpxlC mpixlc++ mpxlcxx mpxlc++ mpxlCC mpixlc++_r mpxlcxx_r mpxlc++_r mpxlCC_r"
dnl add Fujitsu MPI compilers
CANDIDATE_MPICC="$CANDIDATE_MPICC mpifccpx"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX mpiFCCpx"
dnl add Cray MPI compiler wrappers
CANDIDATE_MPICC="$CANDIDATE_MPICC cc"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX CC"
dnl add Intel MPI compiler wrappers
CANDIDATE_MPICC="$CANDIDATE_MPICC mpiicc icc"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX mpiicpc mpiicxx mpiic++ mpiiCC icpc"
dnl add PGI MPI compiler wrappers
CANDIDATE_MPICC="$CANDIDATE_MPICC mpipgcc mppgcc"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX mpipgCC mppgCC"
dnl find the full path of MPICC from CANDIDATE_MPICC and MPI_INSTALL
if test "x${ac_user_MPICC}" = x ; then
dnl if MPICC or CC has not been set by users, then search from
dnl CANDIDATE_MPICC, and find the full path of MPICC
UD_MPI_PATH_PROGS([MPICC], [$CANDIDATE_MPICC])
else
dnl check whether user specified MPICC is valid
UD_MPI_PATH_PROG([MPICC], [$ac_user_MPICC])
fi
if test "x${MPICC}" = x ; then
if test "x$ac_user_MPICC" = x ; then
ERR_MSG="No MPI C compiler can be found"
else
ERR_MSG="Specified MPI C compiler \"$ac_user_MPICC\" cannot be found"
fi
if test "x$MPI_INSTALL" != x ; then
ERR_MSG="$ERR_MSG under $MPI_INSTALL"
fi
AC_MSG_ERROR([
-----------------------------------------------------------------------
$ERR_MSG
--enable-parallel is set, but no working MPI C compiler.
Abort.
-----------------------------------------------------------------------])
fi
CC=${MPICC}
fi
# ----------------------------------------------------------------------
# Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_MAKE_SET
# Default to building static library, because opa by default builds itself
# statically without -fPIC, preventing it from working with a shared library.
AC_DISABLE_SHARED
# Initialize libtool.
LT_INIT
# ----------------------------------------------------------------------
# Check if we can compile MPI program
# ----------------------------------------------------------------------
HAVE_MPI=no
MPI_DEF="#undef"
if test "x$enable_parallel" = "xyes"; then
echo "enable_parallel=$enable_parallel"
AC_MSG_CHECKING([whether a simple MPI-IO C program can be linked])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpi.h>]],
[[ MPI_Init(0, (void *)0);
MPI_File_open(0, (void *)0, 0, 0, (void *)0);]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([unable to link a simple MPI-IO C program])])
# Require MPI 3.x
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <mpi.h>
]],
[[
MPI_Message message;
MPI_Init(0, (void *) 0);
MPI_Mprobe(0, 0, 0, &message, (void *) 0);
MPI_Imrecv((void *) 0, 0, 0, (void *) 0, (void *) 0);
]]
)],
[AC_MSG_RESULT([yes])
PARALLEL_FILTERED_WRITES=yes],
[AC_MSG_RESULT([no])
AC_MSG_WARN([A simple MPI program using the MPI_Mprobe and MPI_Imrecv functions could not be compiled and linked.
Parallel writes of filtered data will be disabled.])])
# We are building a parallel library
HAVE_MPI=yes
AC_DEFINE(HAVE_MPI, 1)
MPI_DEF="#define"
fi
AM_CONDITIONAL(HAVE_MPI, [test x$enable_parallel = xyes])
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Check for pthread, reuqired for posix build
# ----------------------------------------------------------------------
AC_CHECK_HEADERS([pthread.h], [], [
echo "Required headers missing!"
exit 1
])
AC_CHECK_LIB(pthread, pthread_create, [], [
echo "pthread not found!"
exit 1
])
# Check for presence of sched_yield. If not present, check for pthread_yield.
AC_CHECK_HEADER(sched.h,
[AC_CHECK_FUNCS(sched_yield,
,
[AC_CHECK_FUNCS(pthread_yield)]
)],
[AC_CHECK_FUNCS(pthread_yield)]
)
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Check for opa
# ----------------------------------------------------------------------
AC_ARG_WITH([opa],
[AC_HELP_STRING([--with-opa=DIR],
[Use opa library [default=yes]])],,
[withval=yes])
case "$withval" in
yes)
HAVE_OPA="yes"
AC_CHECK_HEADERS([opa_primitives.h opa_queue.h],, [unset HAVE_OPA])
AC_CHECK_LIB([opa], [OPA_Interprocess_lock_init],, [unset HAVE_OPA])
if test -z "$HAVE_OPA"; then
AC_MSG_ERROR([could not find opa library])
fi
;;
no)
AC_MSG_ERROR([opa library required to build AXE])
;;
*)
HAVE_OPA="yes"
case "$withval" in
*,*)
opa_inc="`echo $withval | cut -f1 -d,`"
opa_lib="`echo $withval | cut -f2 -d, -s`"
;;
*)
if test -n "$withval"; then
opa_inc="$withval/include"
opa_lib="$withval/lib"
fi
;;
esac
## Trying to include -I/usr/include and -L/usr/lib is redundant and
## can mess some compilers up.
if test "X$opa_inc" = "X/usr/include"; then
opa_inc=""
fi
if test "X$opa_lib" = "X/usr/lib"; then
opa_lib=""
fi
if test -n "$opa_inc"; then
CPPFLAGS="$CPPFLAGS -I$opa_inc"
fi
AC_CHECK_HEADERS([opa_primitives.h opa_queue.h],, [unset HAVE_OPA])
if test -n "$opa_lib"; then
LDFLAGS="$LDFLAGS -L$opa_lib"
fi
AC_CHECK_LIB([opa], [OPA_Interprocess_lock_init],, [unset HAVE_OPA])
if test -z "$HAVE_OPA"; then
AC_MSG_ERROR([could not find opa library])
fi
;;
esac
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Whether to enable debug build
# ----------------------------------------------------------------------
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Build with debug information. Turn off all optimizations])],[enable_debug=${enableval}], [enable_debug=no])
if test "x$enable_debug" = "xyes"; then
CFLAGS=`echo $CFLAGS | ${SED} 's/-O. *//g' | ${SED} 's/-fast *//g'`
CFLAGS+=" -O0 -g"
AC_DEFINE(TWI_DEBUG, 1)
fi
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Whether to enable argobots driver
# ----------------------------------------------------------------------
enable_abt=no
AC_ARG_WITH([argobots],
[AC_HELP_STRING([--with-argobots=DIR],
[Enable argobots backend [default=yes]])],[enable_abt=yes],
[enable_abt=no])
if test "x$enable_abt" = "xyes"; then
case "$withval" in
yes)
;;
no)
enable_abt=no
;;
*)
HAVE_ABT="yes"
case "$withval" in
*,*)
abt_inc="`echo $withval | cut -f1 -d,`"
abt_lib="`echo $withval | cut -f2 -d, -s`"
;;
*)
if test -n "$withval"; then
abt_inc="$withval/include"
abt_lib="$withval/lib"
fi
;;
esac
## Trying to include -I/usr/include and -L/usr/lib is redundant and
## can mess some compilers up.
if test "X$abt_inc" = "X/usr/include"; then
abt_inc=""
fi
if test "X$abt_lib" = "X/usr/lib"; then
abt_lib=""
fi
if test -n "$abt_inc"; then
CPPFLAGS="$CPPFLAGS -I$abt_inc"
fi
AC_CHECK_HEADERS([abt.h],, [unset HAVE_ABT])
if test -n "$abt_lib"; then
LDFLAGS="$LDFLAGS -L$abt_lib"
fi
AC_CHECK_LIB([abt], [ABT_init],, [unset HAVE_ABT])
if test -z "$HAVE_ABT"; then
AC_MSG_ERROR([could not find opa library])
fi
;;
esac
fi
ABT_DEF="#undef"
if test "x$enable_abt" = "xyes"; then
HAVE_ABT="yes"
AC_CHECK_HEADERS([abt.h],, [unset HAVE_ABT])
AC_CHECK_LIB([abt], [ABT_init],, [unset HAVE_ABT])
if test -z "$HAVE_ABT"; then
AC_MSG_ERROR([could not find argobots library])
fi
AC_DEFINE(HAVE_ABT, 1)
ABT_DEF="#define"
fi
AM_CONDITIONAL(HAVE_ABT, [test x$enable_abt = xyes])
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Whether to enable libevent driver
# ----------------------------------------------------------------------
enable_libevent=no
AC_ARG_WITH([libevent],
[AC_HELP_STRING([--with-libevent=DIR],
[Enable libevent event backend [default=yes]])],[enable_libevent=yes],
[enable_libevent=no])
if test "x$enable_libevent" = "xyes"; then
case "$withval" in
yes)
;;
no)
enable_libevent=no
;;
*)
HAVE_LIBEVENT="yes"
case "$withval" in
*,*)
libevent_inc="`echo $withval | cut -f1 -d,`"
libevent_lib="`echo $withval | cut -f2 -d, -s`"
;;
*)
if test -n "$withval"; then
libevent_inc="$withval/include"
libevent_lib="$withval/lib"
fi
;;
esac
## Trying to include -I/usr/include and -L/usr/lib is redundant and
## can mess some compilers up.
if test "X$libevent_inc" = "X/usr/include"; then
libevent_inc=""
fi
if test "X$libevent_lib" = "X/usr/lib"; then
libevent_lib=""
fi
if test -n "$libevent_inc"; then
CPPFLAGS="$CPPFLAGS -I$libevent_inc"
fi
AC_CHECK_HEADERS([event2/event.h event.h],, [unset HAVE_LIBEVENT])
if test -n "$libevent_lib"; then
LDFLAGS="$LDFLAGS -L$libevent_lib"
fi
AC_CHECK_LIB([event], [event_init],, [unset HAVE_LIBEVENT])
if test -z "$HAVE_LIBEVENT"; then
AC_MSG_ERROR([could not find libevent library])
fi
;;
esac
fi
LIBEVENT_DEF="#undef"
if test "x$enable_libevent" = "xyes"; then
HAVE_LIBEVENT="yes"
AC_CHECK_HEADERS([event.h],, [unset HAVE_LIBEVENT])
AC_CHECK_LIB([event], [event_init],, [unset HAVE_LIBEVENT])
if test -z "$HAVE_LIBEVENT"; then
AC_MSG_ERROR([could not find libevent library])
fi
AC_DEFINE(HAVE_LIBEVENT, 1)
LIBEVENT_DEF="#define"
fi
AM_CONDITIONAL(HAVE_LIBEVENT, [test x$enable_libevent = xyes])
# ----------------------------------------------------------------------
echo "TW_CFLAGS=$TW_CFLAGS"
CFLAGS="$CFLAGS $TW_CFLAGS"
CXXFLAGS="$CXXFLAGS $TW_CXXFLAGS"
CPPFLAGS="$CPPFLAGS $TW_CPPFLAGS"
AC_SUBST([prefix])
AC_SUBST([CC])
AC_SUBST([CXX])
AC_SUBST([LDFLAGS])
AC_SUBST([AM_LDFLAGS])
AC_SUBST([LIBS])
AC_SUBST([CPPFLAGS])
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([CFLAGS])
AC_SUBST([CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([enable_shared])
AC_SUBST([enable_static])
AC_SUBST([HAVE_MPI])
AC_SUBST([HAVE_ABT])
AC_SUBST([HAVE_LIBEVENT])
AC_SUBST([MPI_DEF])
AC_SUBST([ABT_DEF])
AC_SUBST([LIBEVENT_DEF])
AC_CONFIG_FILES([
Makefile
src/Makefile
src/include/taskworks.settings
src/include/taskworks.h
src/driver/Makefile
src/driver/argobots/Makefile
src/driver/native/Makefile
src/eal/Makefile
src/eal/libevent/Makefile
src/common/Makefile
src/dispatcher/Makefile
src/tal/Makefile
src/tal/posix/Makefile
examples/Makefile
test/Makefile
test/common/Makefile
test/advanced/Makefile
test/task/Makefile
test/event/Makefile
test/wrong/Makefile])
AC_OUTPUT
cat src/include/taskworks.settings