forked from pmodels/argobots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1184 lines (1056 loc) · 41.5 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
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- Mode: Autoconf; -*-
#
# See COPYRIGHT in top-level directory.
#
AC_PREREQ([2.67])
m4_include([maint/version.m4])
AC_INIT([argobots],[ABT_VERSION_m4])
ABT_VERSION=ABT_VERSION_m4
AC_SUBST([ABT_VERSION])
libabt_so_version="libabt_so_version_m4"
AC_SUBST([libabt_so_version])
# Produce a numeric version assuming the following format:
# Version: [MAJ].[MIN].[REV][EXT][EXT_NUMBER]
# Example: 1.0.7rc1 has
# MAJ = 1
# MIN = 0
# REV = 7
# EXT = rc
# EXT_NUMBER = 1
#
# Converting to numeric version will convert EXT to a format number:
# ALPHA (a) = 0
# BETA (b) = 1
# RC (rc) = 2
# PATCH (p) = 3
# Regular releases are treated as patch 0
#
# Numeric version will have 1 digit for MAJ, 2 digits for MIN,
# 2 digits for REV, 1 digit for EXT and 2 digits for EXT_NUMBER.
changequote(<<,>>)
V1=`expr $ABT_VERSION : '\([0-9]*\)\.[0-9]*\.*[0-9]*[a-zA-Z]*[0-9]*'`
V2=`expr $ABT_VERSION : '[0-9]*\.\([0-9]*\)\.*[0-9]*[a-zA-Z]*[0-9]*'`
V3=`expr $ABT_VERSION : '[0-9]*\.[0-9]*\.*\([0-9]*\)[a-zA-Z]*[0-9]*'`
V4=`expr $ABT_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*\([a-zA-Z]*\)[0-9]*'`
V5=`expr $ABT_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*[a-zA-Z]*\([0-9]*\)'`
changequote([,])
if test "$V2" -le 9 ; then V2="0$V2" ; fi
if test "$V3" = "" ; then V3="0"; fi
if test "$V3" -le 9 ; then V3="0$V3" ; fi
if test "$V4" = "a" ; then
V4=0
elif test "$V4" = "b" ; then
V4=1
elif test "$V4" = "rc" ; then
V4=2
elif test "$V4" = "" ; then
V4=3
V5=0
elif test "$V4" = "p" ; then
V4=3
fi
if test "$V5" -le 9 ; then V5="0$V5" ; fi
ABT_NUMVERSION=`expr $V1$V2$V3$V4$V5 + 0`
AC_SUBST(ABT_NUMVERSION)
AC_CONFIG_AUX_DIR(m4)
AC_CONFIG_MACRO_DIR(m4)
dnl ----------------------------------------------------------------------------
dnl empty CFLAGS, CXXFLAGS, CCASFLAGS
dnl ----------------------------------------------------------------------------
: ${CFLAGS=""}
: ${CXXFLAGS=""}
: ${CCASFLAGS=""}
dnl ----------------------------------------------------------------------------
dnl ----------------------------------------------------------------------------
dnl check the compiler
dnl ----------------------------------------------------------------------------
PAC_PROG_CC
dnl ----------------------------------------------------------------------------
dnl ----------------------------------------------------------------------------
dnl configure options
dnl ----------------------------------------------------------------------------
# --enable-visibility
PAC_CHECK_VISIBILITY
AC_SUBST(ABT_VISIBILITY_CFLAGS)
# --enable-affinity
AC_ARG_ENABLE([affinity],
AS_HELP_STRING([--enable-affinity],
[enable ES affinity]),,
[enable_affinity=no])
# --enable-debug
AC_ARG_ENABLE([debug],
[ --enable-debug@<:@=OPTS@:>@ control the level of debugging. "OPTS" is a list of
comma separated names below. Default is "yes".
yes - add compiler flags, -g -Wall
err - print abt_errno information on standard error
log - print debug event logging
(set ABT_USE_LOG to 0 to disable logging)
ub_assert - assert if the runtime detects possible undefined behavior
all - all of the above choices (equal to "yes,err,log,ub_assert")
most - same as "all" but not print logs by default
(set ABT_USE_LOG to 1 to enable logging)
none - no debugging, i.e., --disable-debug
],,[enable_debug=none])
# --enable-fast
AC_ARG_ENABLE(fast,
[ --enable-fast@<:@=OPTS@:>@ control the level of fast execution in the Argobots
implementation. "OPTS" is a list of comma separated
names including
O<n> - append default optimization flags, -O<n>, to CFLAGS
(default is -O2)
ndebug - append -DNDEBUG to CFLAGS
all|yes - "O2" and "ndebug" are enabled
none - none of above options, i.e., --disable-fast
],,enable_fast=O2)
# --enable-tls-model
AC_ARG_ENABLE(tls-model,
[ --enable-tls-model@<:@=OPT@:>@ change the thread-local storage model used by
the compiler. This affects the performance of ES's
local storage. "OPT" can be one of values below.
Please refer to the compiler documentation for
details.
global-dynamic, local-dynamic, initial-exec
yes - same as "initial-exec"
none|no - use the compiler's default model
],,enable_tls_model=none)
# --enable-perf-opt
AC_ARG_ENABLE([perf-opt],
AS_HELP_STRING([--enable-perf-opt], [enable performance optimization]))
# --enable-valgrind
AC_ARG_ENABLE([valgrind],
AS_HELP_STRING([--enable-valgrind], [enable valgrind support]))
# --enable-checks
AC_ARG_ENABLE([checks],
[ --enable-checks@<:@=OPTS@:>@ control the amount of sanity checking.
"OPTS" is a list of comma separated names including
all - checking always enabled (default)
no-error - disable error checks
no-pool-producer - disable pool producer checks
no-pool-consumer - disable pool consumer checks
none|no - no checking
],,[enable_checks=all])
# --disable-fcontext
AC_ARG_ENABLE([fcontext],
AS_HELP_STRING([--disable-fcontext],
[do not use fcontext even though it is supported. If you disable
fcontext, ucontext in libc is used.]),,
[enable_fcontext=yes])
# --disable-preserve-fpu
AC_ARG_ENABLE([preserve-fpu],
AS_HELP_STRING([--disable-preserve-fpu],
[do not preserve fpu registers when fcontext is used]),,
[enable_preserve_fpu=yes])
# --disable-mem-pool
AC_ARG_ENABLE([mem-pool],
AS_HELP_STRING([--disable-mem-pool],
[do not use memory pools for ULT and tasklet creation]),,
[enable_mem_pool=yes])
# --disable-aligned-alloc
AC_ARG_ENABLE([aligned-alloc],
AS_HELP_STRING([--disable-aligned-alloc],
[do not use aligned memory allocation]),,
[enable_aligned_alloc=yes])
# --enable-lazy-stack-alloc
AC_ARG_ENABLE([lazy-stack-alloc],
AS_HELP_STRING([--enable-lazy-stack-alloc],
[lazily allocate and eagerly release ULT stacks]),,
[enable_lazy_stack_alloc=no])
# --enable-feature
AC_ARG_ENABLE([feature],
[ --enable-feature@<:@=OPTS@:>@ enable/disable features.
"OPTS" is a list of comma separated names including
all - all features always enabled (default)
no-cancellation - disable thread cancellation
no-migration - disable thread migration
no-ext-thread - disable supporting external threads
none|no - disable all features above
],,[enable_feature=all])
# --enable-sched-sleep
AC_ARG_ENABLE([sched-sleep],
AS_HELP_STRING([--enable-sched-sleep], [enable scheduler sleep]))
# --enable-tool
AC_ARG_ENABLE([tool],
AS_HELP_STRING([--enable-tool],
[enable the tool interface, which is disabled by default.]))
# --enable-stack-overflow-check
AC_ARG_ENABLE([stack-overflow-check],
[ --enable-stack-overflow-check@<:@=OPT@:>@ enable a stack overflow check
canary|canary-8 - use an 8-byte stack canary.
canary-XX - use an XX-byte stack canary.
mprotect - use mprotect. Ignore the failure of mprotect().
Alternatively, users can set ABT_STACK_OVERFLOW_CHECK=mprotect
mprotect-strict - use mprotect. Assert if mprotect() fails.
Alternatively, users can set ABT_STACK_OVERFLOW_CHECK=mprotect_strict
none|no
],,[enable_stack_overflow_check=no])
# --enable-wait-policy
AC_ARG_ENABLE([wait-policy],
[ --enable-wait-policy@<:@=OPTS@:>@ set a wait policy of blocking operations
default|auto - choose the best policy, which is currently "passive".
active - spin-wait on blocking. It uses more CPU resources.
passive - suspend CPU cores on blocking. It increases latency.
],,[enable_wait_policy=auto])
# --enable-simple-mutex
AC_ARG_ENABLE([simple-mutex],
AS_HELP_STRING([--enable-simple-mutex], [use an old yield-based mutex implementation]),,
[enable_simple_mutex=no])
# --enable-static-cacheline-size
AC_ARG_ENABLE([static-cacheline-size],
[ --enable-static-cacheline-size@<:@=OPTS@:>@ embed cache line size at compile-time.
auto - automatically get size. Use 128 if detection fails
<value> - assume [value] bytes (e.g., <value> = 64)
],,[enable_static_cacheline_size=auto])
# --enable-default-stacksize
AC_ARG_ENABLE([default-stacksize],
[ --enable-default-stacksize@<:@=SIZE@:>@
set a default ULT stack size in bytes (default: 16384)
ABT_THREAD_STACKSIZE=SIZE at run-time supersedes this setting.
],,[enable_default_stacksize=16384])
# --enable-ver20-api
AC_ARG_ENABLE([ver20-api],
AS_HELP_STRING([--enable-ver20-api],
[enable an experimental Argobots 2.0 API, which is disabled by default.]))
# --with-lts
AC_ARG_WITH([lts],
AS_HELP_STRING([--with-lts=PATH],
[specify path where lts include directory and lib directory can be found]))
# --with-hugetlbfs
AC_ARG_WITH([hugetlbfs],
AS_HELP_STRING([--with-hugetlbfs=PATH],
[specify path where hugetlbfs include directory and lib directory can be found]))
# --with-libunwind
AC_ARG_WITH([libunwind],
AS_HELP_STRING([--with-libunwind=PATH],
[specify path where libunwind include directory and lib directory can be found]))
# --enable-stack-unwind
AC_ARG_ENABLE([stack-unwind],
[ --enable-stack-unwind@<:@=OPTS@:>@ enable stack unwinding, which is disabled by default.
yes|verbose - enable stack unwinding. Dump the raw stack information too
unwind-only - enable stack unwinding. Do not dump the raw stack information
no|none - disable stack unwinding
],,[enable_stack_unwind=no])
# --with-papi
AC_ARG_WITH([papi],
AS_HELP_STRING([--with-papi=PATH],
[specify path where papi include directory and lib directory can be found]))
# --enable-papi
AC_ARG_ENABLE([papi],
AS_HELP_STRING([--enable-papi], [use papi in benchmarking]))
dnl ----------------------------------------------------------------------------
dnl ----------------------------------------------------------------------------
dnl check the environment and the function availability
dnl ----------------------------------------------------------------------------
# compute canonical system types
AC_CANONICAL_HOST
# check architecture and OS for fcontext
fctx_arch_bin=""
AS_CASE([$host_cpu],
[i?86], [AS_CASE([$host_os],
[linux*], [fctx_arch_bin="i386_sysv_elf_gas"],
[freebsd*], [fctx_arch_bin="i386_sysv_elf_gas"])],
[x86_64], [AS_CASE([$host_os],
[linux*], [fctx_arch_bin="x86_64_sysv_elf_gas"],
[darwin*], [fctx_arch_bin="x86_64_sysv_macho_gas"],
[freebsd*], [fctx_arch_bin="x86_64_sysv_elf_gas"])],
[p*pc64*], [AS_CASE([$host_os],
[linux*], [fctx_arch_bin="ppc64_sysv_elf_gas"],
[freebsd*], [fctx_arch_bin="ppc64_sysv_elf_gas"])],
[aarch64],[AS_CASE([$host_os],
[linux*], [fctx_arch_bin="arm64_aapcs_elf_gas"],
[darwin*], [fctx_arch_bin="arm64_aapcs_macho_gas"])])
AC_SUBST([fctx_arch_bin])
AM_SUBST_NOTMAKE([fctx_arch_bin])
# check the pointer size
AC_CHECK_SIZEOF([void *])
# check __attribute__((deprecated))
AX_GCC_FUNC_ATTRIBUTE(deprecated)
if test "x$ax_cv_have_func_attribute_deprecated" = "xyes" ; then
ABT_DEPRECATED="__attribute__((deprecated))"
else
ABT_DEPRECATED=""
fi
AC_SUBST([ABT_DEPRECATED])
# check __attribute__((noreturn))
AX_GCC_FUNC_ATTRIBUTE(noreturn)
# check __attribute__((warn_unused_result))
AX_GCC_FUNC_ATTRIBUTE(warn_unused_result)
dnl ----------------------------------------------------------------------------
dnl ----------------------------------------------------------------------------
dnl setup top-level argument handling
dnl ----------------------------------------------------------------------------
# --enable-affinity
AS_IF([test "x$enable_affinity" != "xno"], [
AC_CHECK_LIB(pthread, pthread_setaffinity_np,
[AC_DEFINE(HAVE_PTHREAD_SETAFFINITY_NP, 1,
[Define if pthread_setaffinity_np is available])])
])
# --enable-debug: debug options
# strip off multiple options, separated by commas
save_IFS="$IFS"
IFS=","
debug_flags=no
debug_log=no
debug_log_print=no
debug_err=no
debug_ub_assert=no
for option in $enable_debug ; do
case "$option" in
yes)
debug_flags=yes
;;
log-discard)
# This option is for testing: printing all events creates a giant
# log file and slows down testing. With debug_log_print=discard,
# log will be discarded.
debug_log=yes
debug_log_print=discard
;;
log)
debug_log=yes
debug_log_print=yes
;;
ub_assert)
debug_ub_assert=yes
;;
all-discard)
debug_flags=yes
debug_log=yes
debug_log_print=discard
debug_err=yes
debug_ub_assert=yes
;;
all)
debug_flags=yes
debug_log=yes
debug_log_print=yes
debug_err=yes
debug_ub_assert=yes
;;
most)
debug_flags=yes
debug_log=yes
debug_log_print=no
debug_err=yes
debug_ub_assert=yes
;;
err)
debug_err=yes
;;
no|none)
debug_err=no
debug_flags=no
debug_log=no
debug_ub_assert=no
;;
*)
IFS=$save_IFS
AC_MSG_WARN([Unknown value $option for --enable-debug])
IFS=","
;;
esac
done
IFS="$save_IFS"
if test "x$debug_flags" = "xyes" ; then
PAC_APPEND_FLAG([-g], [CFLAGS])
PAC_APPEND_FLAG([-Wall], [CFLAGS])
PAC_APPEND_FLAG([-g], [CXXFLAGS])
PAC_APPEND_FLAG([-Wall], [CXXFLAGS])
PAC_APPEND_FLAG([-g], [CCASFLAGS])
PAC_APPEND_FLAG([-Wall], [CCASFLAGS])
fi
AS_IF([test "x$debug_log" = "xyes"],
[AC_DEFINE(ABT_CONFIG_USE_DEBUG_LOG, 1, [Define to enable debug logging])])
AS_IF([test "x$debug_log_print" = "xyes" -o "x$debug_log_print" = "xdiscard"],
[AC_DEFINE(ABT_CONFIG_USE_DEBUG_LOG_PRINT, 1,
[Define to enable printing debug log messages])])
AS_IF([test "x$debug_log_print" = "xdiscard"],
[AC_DEFINE(ABT_CONFIG_USE_DEBUG_LOG_DISCARD, 1,
[Define to discard debug log messages])])
AS_IF([test "x$debug_err" = "xyes"],
[AC_DEFINE(ABT_CONFIG_PRINT_ABT_ERRNO, 1,
[Define to enable printing abt_errno upon abt call error])])
AS_IF([test "x$debug_ub_assert" != "xyes"],
[AC_DEFINE(ABT_CONFIG_DISABLE_UB_ASSERT, 1,
[Define to disable undefined-behavior assertion])])
# --enable-fast: compiler optimization flags
# strip off multiple options, separated by commas
save_IFS="$IFS"
IFS=","
for option in $enable_fast ; do
case "$option" in
O*)
enable_fast_opts=$option
;;
ndebug)
enable_fast_ndebug=yes
;;
all|yes)
enable_fast_ndebug=yes
enable_fast_opts=O2
;;
none|no)
enable_fast_ndebug=no
enable_fast_opts=O0
;;
*)
IFS="$save_IFS"
AC_MSG_WARN([Unknown value $option for --enable-fast])
IFS=","
;;
esac
done
IFS="$save_IFS"
if test -n "$enable_fast_opts" ; then
# Allows O<n> where <n> can be [0-9sz] or ' '.
opt_flags=`echo $enable_fast_opts | sed -e 's%\(O[0-9sz] \)%\1%g'`
if test -n "$opt_flags" ; then
CXXFLAGS="$CXXFLAGS -$enable_fast_opts"
CCASFLAGS="$CCASFLAGS -$enable_fast_opts"
PAC_C_CHECK_COMPILER_OPTION( [$ABT_DEFAULT_COPTS],
[CFLAGS="$CFLAGS -$enable_fast_opts"] )
else
AC_MSG_WARN([Unknown value $enable_fast_opts for --enable-fast])
fi
fi
if test "$enable_fast_ndebug" = "yes" ; then
CFLAGS="$CFLAGS -DNDEBUG -DNVALGRIND"
CXXFLAGS="$CXXFLAGS -DNDEBUG -DNVALGRIND"
CCASFLAGS="$CCASFLAGS -DNDEBUG -DNVALGRIND"
fi
# --enable-tls-model: compiler's tls-model flag
case "$enable_tls_model" in
global-dynamic|local-dynamic|initial-exec)
tls_model_flag=$enable_tls_model
;;
yes)
tls_model_flag=initial-exec;
;;
none|no)
;;
*)
AC_MSG_WARN([Unknown value $option for --enable-tls-model])
;;
esac
if test -n "$tls_model_flag" ; then
PAC_APPEND_FLAG([-ftls-model=$tls_model_flag], [CFLAGS])
PAC_APPEND_FLAG([-ftls-model=$tls_model_flag], [CXXFLAGS])
PAC_APPEND_FLAG([-ftls-model=$tls_model_flag], [CCASFLAGS])
fi
# --enable-perf-opt: set CFLAGS for the performance optimization
if test "x$enable_perf_opt" = "xyes"; then
CFLAGS="$CFLAGS -O3"
CXXFLAGS="$CXXFLAGS -O3"
CCASFLAGS="$CCASFLAGS -O3"
if test "$CC" != "xlc" -a "$CC" != "suncc" -a "$CC" != "pgcc" ; then
CFLAGS="$CFLAGS -ftls-model=initial-exec"
CXXFLAGS="$CXXFLAGS -ftls-model=initial-exec"
CCASFLAGS="$CCASFLAGS -ftls-model=initial-exec"
fi
if test "$CC" = "icc"; then
CFLAGS="$CFLAGS -ipo"
CXXFLAGS="$CFLAGS -ipo"
CCASFLAGS="$CCASFLAGS -ipo"
LDFLAGS="$LDFLAGS -O3 -ipo"
AR="xiar"
LD="xild"
else
LDFLAGS="$LDFLAGS -O3"
fi
fi
# inline is broken in XLC-16.1.1, so disable inlining as a fallback
# See https://github.com/pmodels/argobots/issues/244 and
# https:////github.com/pmodels/argobots/issues/251 for details.
if test "$CC" = "xlc" ; then
CFLAGS="$CFLAGS -qnoinline"
CXXFLAGS="$CXXFLAGS -qnoinline"
CCASFLAGS="$CCASFLAGS -qnoinline"
fi
# --enable-valgrind: enable valgrind support if requested
AS_IF([test "x$enable_valgrind" = "xyes"], [
AC_DEFINE(HAVE_VALGRIND_SUPPORT, 1, [Define valgrind support])
])
# --enable-checks
# strip off multiple options, separated by commas
save_IFS="$IFS"
IFS=","
for option in $enable_checks ; do
case "$option" in
all|yes)
enable_error_check=yes
enable_pool_producer_check=yes
enable_pool_consumer_check=yes
;;
no-error)
enable_error_check=no
;;
no-pool-producer)
enable_pool_producer_check=no
;;
no-pool-consumer)
enable_pool_consumer_check=no
;;
none|no)
enable_error_check=no
enable_pool_producer_check=no
enable_pool_consumer_check=no
;;
*)
IFS="$save_IFS"
AC_MSG_WARN([Unknown value $option for --enable-checks])
IFS=","
;;
esac
done
IFS="$save_IFS"
AM_CONDITIONAL([ABT_CONFIG_DISABLE_ERROR_CHECK],
[test "x$enable_error_check" = "xno"])
AS_IF([test "x$enable_error_check" = "xno"],
[AC_DEFINE(ABT_CONFIG_DISABLE_ERROR_CHECK, 1,
[Define to disable error check])
ABT_NULL="1"],
[ABT_NULL="0"])
AC_SUBST([ABT_NULL])
AS_IF([test "x$enable_ver20_api" = "xyes"],
[AC_DEFINE(ABT_CONFIG_ENABLE_VER_20_API, 1,
[Define to enable Argobots 2.0 API])
ABT_ENABLE_VER_20_API="1"],
[ABT_ENABLE_VER_20_API="0"])
AC_SUBST([ABT_ENABLE_VER_20_API])
AS_IF([test "x$enable_error_check" = "xno" -o "x$enable_pool_producer_check" = "xno"],
[AC_DEFINE(ABT_CONFIG_DISABLE_POOL_PRODUCER_CHECK, 1,
[Define to disable pool producer check])])
AS_IF([test "x$enable_error_check" = "xno" -o "x$enable_pool_consumer_check" = "xno"],
[AC_DEFINE(ABT_CONFIG_DISABLE_POOL_CONSUMER_CHECK, 1,
[Define to disable pool consumer check])])
AM_CONDITIONAL([ABT_CONFIG_DISABLE_POOL_ACCESS_CHECK],
[test "x$enable_error_check" = "xno" -o "x$enable_pool_producer_check" = "xno" -o "x$enable_pool_consumer_check" = "xno"])
if test "x$enable_error_check" = "xno" \
-o "x$enable_pool_producer_check" = "xno" \
-o "x$enable_pool_consumer_check" = "xno"; then
WFLAGS=""
case "$CC" in
clang) WFLAGS="-Wno-unused-label" ;;
gcc) WFLAGS="-Wno-unused-label" ;;
icc) WFLAGS="-wd177" ;;
*) ;;
esac
CFLAGS="$CFLAGS $WFLAGS"
fi
# --disable-fcontext
# if fcontext supports this platform and the user does not specify
# --disable-fcontext, we use fcontext instead of ucontext.
AM_CONDITIONAL([ABT_USE_FCONTEXT],
[test "x$fctx_arch_bin" != "x" -a "x$enable_fcontext" != "xno"])
AS_IF([test "x$fctx_arch_bin" != "x" -a "x$enable_fcontext" != "xno"],
[AC_DEFINE(ABT_CONFIG_USE_FCONTEXT, 1, [Define to use fcontext])])
# --disable-preserve-fpu
AS_IF([test "x$enable_preserve_fpu" != "xno"],
[AC_DEFINE(ABTD_FCONTEXT_PRESERVE_FPU, 1,
[Define to 1 if we preserve fpu registers])],
[AC_DEFINE(ABTD_FCONTEXT_PRESERVE_FPU, 0)])
# --disable-mem-pool: Memory pool is enabled by default.
AS_IF([test "x$enable_mem_pool" != "xno"],
[AC_DEFINE(ABT_CONFIG_USE_MEM_POOL, 1,
[Define to use memory pools for ULT and tasklet creation])])
# --disable-aligned-alloc: Aligned memory allocation is enabled by default.
AS_IF([test "x$enable_aligned_alloc" != "xno"],
[AC_DEFINE(ABT_CONFIG_USE_ALIGNED_ALLOC, 1,
[Define to allocate objects aligned to the cache line size])])
# --enable-lazy-stack-alloc
AS_IF([test "x$enable_lazy_stack_alloc" != "xyes"],
[AC_DEFINE(ABT_CONFIG_DISABLE_LAZY_STACK_ALLOC, 1,
[Define to disable lazy stack allocation])])
# --enable-feature
save_IFS="$IFS"
IFS=","
for option in $enable_feature ; do
case "$option" in
all|yes)
enable_cancellation=yes
enable_migration=yes
enable_ext_thread=yes
;;
no-cancellation|no-thread-cancel|no-task-cancel)
# no-thread-cancel|no-task-cancel are old (-v1.1) options
enable_cancellation=no
;;
no-migration)
enable_migration=no
;;
no-ext-thread)
enable_ext_thread=no
;;
none|no)
enable_cancellation=no
enable_migration=no
enable_ext_thread=no
;;
*)
IFS="$save_IFS"
AC_MSG_WARN([Unknown value $option for --enable-feature])
IFS=","
;;
esac
done
IFS="$save_IFS"
AS_IF([test "x$enable_cancellation" = "xno"],
[AC_DEFINE(ABT_CONFIG_DISABLE_CANCELLATION, 1,
[Define to disable thread cancellation])])
AS_IF([test "x$enable_migration" = "xno"],
[AC_DEFINE(ABT_CONFIG_DISABLE_MIGRATION, 1,
[Define to disable thread migration])])
AS_IF([test "x$enable_ext_thread" = "xno"],
[AC_DEFINE(ABT_CONFIG_DISABLE_EXT_THREAD, 1,
[Define to disable supporting external threads])])
AM_CONDITIONAL([ABT_CONFIG_DISABLE_EXT_THREAD],
[test "x$enable_ext_thread" = "xno"])
# --enable-sched-sleep
AS_IF([test "x$enable_sched_sleep" = "xyes"],
[AC_DEFINE(ABT_CONFIG_USE_SCHED_SLEEP, 1,
[Define to make the scheduler sleep when its pools are empty])])
# --enable-tool
AS_IF([test "x$enable_tool" != "xyes"],
[AC_DEFINE(ABT_CONFIG_DISABLE_TOOL_INTERFACE, 1,
[Define to use the tool interface])])
# --enable-stack-overflow-check
stack_overflow_check_type="ABTI_STACK_CHECK_TYPE_NONE"
stack_overflow_canary_size=0
case "$enable_stack_overflow_check" in
canary)
stack_overflow_check_type="ABTI_STACK_CHECK_TYPE_CANARY"
stack_overflow_canary_size="8"
;;
canary-*)
stack_overflow_canary_size_tmp="`echo $enable_stack_overflow_check | sed -e 's/canary-//g'`"
# stack_overflow_canary_size_tmp must be an integer
if test x"`echo $stack_overflow_canary_size_tmp | sed -e 's/[[0-9]]//g'`" = x"" ; then
stack_overflow_check_type="ABTI_STACK_CHECK_TYPE_CANARY"
stack_overflow_canary_size="$stack_overflow_canary_size_tmp"
else
AC_MSG_WARN([Unknown value $enable_stack_overflow_check for --enable-stack-overflow-check])
fi
;;
mprotect)
stack_overflow_check_type="ABTI_STACK_CHECK_TYPE_MPROTECT"
;;
mprotect-strict)
stack_overflow_check_type="ABTI_STACK_CHECK_TYPE_MPROTECT_STRICT"
;;
none|no)
stack_overflow_check_type="ABTI_STACK_CHECK_TYPE_NONE"
;;
*)
AC_MSG_WARN([Unknown value $enable_stack_overflow_check for --enable-stack-overflow-check])
;;
esac
AC_DEFINE_UNQUOTED([ABT_CONFIG_STACK_CHECK_TYPE], [$stack_overflow_check_type],
[Define an algorithm of a stack overflow check])
AC_DEFINE_UNQUOTED([ABT_CONFIG_STACK_CHECK_CANARY_SIZE], [$stack_overflow_canary_size],
[Define the size of a stack canary when it is enabled])
# check if __atomic builtins are supported
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <stdint.h>],
[int *lock = 0, new = 0, old = 0, val = 0;
__atomic_test_and_set((char *)lock, __ATOMIC_ACQ_REL);
__atomic_clear((volatile char *)lock, __ATOMIC_RELEASE);
__atomic_exchange(&val, &new, &old, __ATOMIC_ACQ_REL);
old = __atomic_exchange_n(&val, new, __ATOMIC_ACQ_REL);
val = __atomic_compare_exchange(&val, &old, &new, 0, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE);
val = __atomic_compare_exchange_n(&val, &old, new, 1, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE);
__atomic_load(lock, &val, __ATOMIC_ACQUIRE);
val = __atomic_load_n(lock, __ATOMIC_ACQUIRE);
__atomic_store(lock, &val, __ATOMIC_RELEASE);
__atomic_store_n(lock, val, __ATOMIC_RELEASE);
__atomic_add_fetch(lock, 1, __ATOMIC_ACQ_REL);
__atomic_fetch_add(lock, 1, __ATOMIC_ACQ_REL);
__atomic_thread_fence(__ATOMIC_ACQ_REL);])],
[have_atomic_builtin=yes],
[have_atomic_builtin=no]
)
# __atomic is broken in XLC-16.1.1, so use __sync as a fallback
# See https://github.com/pmodels/argobots/issues/162 for details.
# __atomic is broken in PGI-20.1-0, so use __sunc as a fallback
# See https://github.com/pmodels/argobots/issues/211 for details
if test "$CC" != "xlc" -a "$CC" != "pgcc" -a "x$have_atomic_builtin" = "xyes" ; then
AC_DEFINE(ABT_CONFIG_HAVE_ATOMIC_BUILTIN, 1,
[Define if __atomic builtins are supported])
fi
# check if futex is available. Note that futex() is basically Linux-specific.
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([
#include <unistd.h>
#include <linux/futex.h>
#include <syscall.h>
#include <assert.h>
],[
// Maybe we should not include <futex.h> since it seems that it has some
// compatibility issues (see LLVM OpenMP). We should use a constant value
// for futex_op if we found some compilation issues here.
int ret, futex_val = 0;
// The following does not sleep since futex_val is not 1.
ret = syscall(SYS_futex, &futex_val, FUTEX_WAIT_PRIVATE, 1, 0, 0, 0);
assert(ret == 0);
// The following does not wake up any since no thread is sleeping.
ret = syscall(SYS_futex, &futex_val, FUTEX_WAKE_PRIVATE, 1, 0, 0, 0);
// The return value is 0 since no thread was waken up.
assert(ret == 0);
])],
[have_linux_futex=yes],
[have_linux_futex=no]
)
AS_IF([test "x$have_linux_futex" = "xyes"],
[AC_DEFINE(ABT_CONFIG_USE_LINUX_FUTEX, 1,
[Define to use Linux-type futex])])
# --enable-wait-policy
AS_IF([test "x$enable_wait_policy" = "xactive"],
[AC_DEFINE(ABT_CONFIG_ACTIVE_WAIT_POLICY, 1,
[Define to enable the active wait policy])])
# --enable-simple-mutex
AS_IF([test "x$enable_simple_mutex" = "xyes"],
[AC_DEFINE(ABT_CONFIG_USE_SIMPLE_MUTEX, 1,
[Define to use an old yield-based mutex implementation])])
# --enable-static-cacheline-size
static_cacheline_size=0
default_static_cacheline_size=128
if test "x$enable_static_cacheline_size" = "xauto" ; then
# For Linux
static_cacheline_size=`cat /sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size | grep -Po '^(\d+)$'`
if test "x$static_cacheline_size" = "x" ; then
# For Mac
static_cacheline_size=`sysctl -a | grep hw.cachelinesize | grep -Po '(\d+)$' | grep -Po '^(\d+)$'`
if test "x$static_cacheline_size" = "x" ; then
static_cacheline_size=$default_static_cacheline_size
fi
fi
else
static_cacheline_size=`echo $enable_static_cacheline_size | grep -Po '^(\d+)$'`
if test "x$static_cacheline_size" = "x" ; then
static_cacheline_size=$default_static_cacheline_size
fi
fi
AC_DEFINE_UNQUOTED(ABT_CONFIG_STATIC_CACHELINE_SIZE, [$static_cacheline_size],
[Define to use static cache-line size])
# --enable-default-stacksize
if test x"`echo $enable_default_stacksize | sed -e 's/[[0-9]]//g'`" != x"" ; then
# enable_default_stacksize is not numeric
AC_MSG_WARN([Unknown value $enable_default_stacksize for --enable-default-stacksize])
enable_default_stacksize=16384
fi
AC_DEFINE_UNQUOTED(ABT_CONFIG_DEFAULT_THREAD_STACKSIZE, [$enable_default_stacksize], [Define to set the default ULT stack size])
# --with-lts
if test "x$with_lts" != "x"; then
PAC_PREPEND_FLAG([-I${with_lts}/include], [CFLAGS])
PAC_PREPEND_FLAG([-Wl,-rpath,${with_lts}/lib -L${with_lts}/lib -lthsync], [LDFLAGS])
AC_CHECK_HEADERS(lh_lock.h clh.h)
fi
# --with-hugetlbfs
if test "x$with_hugetlbfs" != "x"; then
PAC_PREPEND_FLAG([-I${with_hugetlbfs}/include], [CFLAGS])
PAC_PREPEND_FLAG([-L${with_hugetlbfs}/lib64 -lhugetlbfs], [LDFLAGS])
AC_CHECK_LIB(hugetlbfs, get_huge_pages)
fi
# --enable-stack-unwind
if test "x$enable_stack_unwind" = "xyes" -o "x$enable_stack_unwind" = "xverbose" -o "x$enable_stack_unwind" = "xunwind-only"; then
# --with-libunwind
if test "x$with_libunwind" != "x"; then
PAC_PREPEND_FLAG([-I${with_libunwind}/include], [CFLAGS])
PAC_PREPEND_FLAG([-Wl,-rpath,${with_libunwind}/lib -L${with_libunwind}/lib], [LDFLAGS])
fi
AC_CHECK_HEADERS(libunwind.h)
AC_CHECK_LIB(unwind, unw_backtrace)
if test x"$ac_cv_header_libunwind_h" = x"yes" -a x"$ac_cv_lib_unwind_unw_backtrace" = x"yes" ; then
AC_DEFINE(ABT_CONFIG_ENABLE_STACK_UNWIND, 1, [Define to use the stack unwinding feature.])
PAC_PREPEND_FLAG([-lunwind], [LDFLAGS])
AS_IF([test "x$enable_stack_unwind" = "xunwind-only"],
[AC_DEFINE(ABT_CONFIG_DISABLE_STACK_UNWIND_DUMP_RAW_STACK, 1,
[Define to disable the raw stack dump by default.])])
else
AC_MSG_ERROR([libunwind is not found. Either remove --enable-stack-unwind or \
set --with-libunwind=LIBUNWIND_PREFIX_PATH.])
fi
fi
# --with-papi
PAPI_CFLAGS=""
PAPI_LDFLAGS=""
if test "x$with_papi" != "x"; then
PAPI_CFLAGS="-I$with_papi/include"
PAPI_LDFLAGS="-Wl,-rpath,$with_papi/lib -L$with_papi/lib -lpapi"
fi
AC_SUBST(PAPI_CFLAGS)
AC_SUBST(PAPI_LDFLAGS)
# --enable-papi
AM_CONDITIONAL([ABT_USE_PAPI], [test "x$enable_papi" = "xyes"])
dnl ----------------------------------------------------------------------------
dnl ----------------------------------------------------------------------------
dnl check the function availability
dnl ----------------------------------------------------------------------------
# check pthread
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_LIB(pthread, pthread_join)
# check pthread_barrier
AC_CHECK_FUNCS(pthread_barrier_init)
# check mprotect
AC_CHECK_FUNCS(mprotect)
# check getpagesize
AC_CHECK_FUNCS(getpagesize)
# check dlvsym
ABT_RT_CFLAGS=""
ABT_RT_LDFLAGS=""
AC_CHECK_LIB(dl, dlvsym)
if test x"$ac_cv_lib_dl_dlvsym" = x"yes"; then
# dl can be used for testing.
# check objdump since it is needed
if test x"$(which objdump || true)" != x; then
# objdump exists. Dump GLIBC versions.
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <pthread.h>
#include <stdint.h>
#include <unistd.h>
],[[
typedef void *(*fty)(void *);
volatile fty fs[] = {
(fty)malloc, (fty)calloc, (fty)realloc, (fty)posix_memalign,
(fty)free, (fty)mmap, (fty)munmap, (fty)pthread_create,
(fty)pthread_join, (fty)pthread_mutex_init,
(fty)pthread_mutex_destroy, (fty)pthread_cond_init,
(fty)pthread_cond_destroy,
#if defined(_POSIX_BARRIERS) && _POSIX_BARRIERS > 0
(fty)pthread_barrier_init, (fty)pthread_barrier_destroy
#endif
};
int i;
for (i = 0; i < (int)(sizeof(fs)/ sizeof(fs[0])); i++) {
pthread_t pth;
volatile int r1 = pthread_create(&pth, 0, fs[i], 0);
volatile int r2 = pthread_join(pth, 0);
(void)r1; (void)r2;
}
]])],[
dump="$(objdump -t conftest$EXEEXT 2>/dev/null || true)"
ABT_RT_CFLAGS="-DABT_RT_USE_DLVSYM=1"
for target_func in malloc calloc realloc posix_memalign free \
mmap munmap pthread_create pthread_join \
pthread_mutex_init pthread_mutex_destroy \
pthread_cond_init pthread_cond_destroy \
pthread_barrier_init pthread_barrier_destroy;
do
ABT_RT_VER="$(echo ${dump} | grep -E -o "${target_func}@@.*" \
| sed -e s/${target_func}@@//g \
| cut -d' ' -f1 \
| sed -e 's/[^a-Z0-9._-]//g' \
|| true)"
ABT_RT_MACRO_NAME="ABT_RT_$(echo ${target_func} | tr a-z A-Z)_VER"
ABT_RT_CFLAGS="${ABT_RT_CFLAGS} -D${ABT_RT_MACRO_NAME}=${ABT_RT_VER}"
done
],[])
fi
ABT_RT_LDFLAGS="-ldl"
fi
AC_SUBST(ABT_RT_LDFLAGS)
AC_SUBST(ABT_RT_CFLAGS)
# check -lrt library
AC_CHECK_LIB(rt, timer_create)
if test "$ac_cv_lib_rt" = "yes" ; then
# -lrt is used for testing
abttest_timer_library="-lrt"
else
abttest_timer_library=""
fi
AC_SUBST(abttest_timer_library)
# check timer functions
AC_CHECK_FUNCS(clock_gettime mach_absolute_time gettimeofday)
if test "$ac_cv_func_clock_gettime" = "yes" ; then
timer_type=clock_gettime
AC_DEFINE(ABT_CONFIG_USE_CLOCK_GETTIME, 1, [Define to use clock_gettime])
# We need to search clock_gettime from librt or libposix4 because they may
# not be included in the standard library.
AC_SEARCH_LIBS([clock_gettime], [rt posix4])
elif test "$ac_cv_func_mach_absolute_time" = "yes" ; then
timer_type=mach_absolute_time
AC_DEFINE(ABT_CONFIG_USE_MACH_ABSOLUTE_TIME, 1,
[Define to use mach_absolute_time])
elif test "$ac_cv_func_gettimeofday" = "yes" ; then
timer_type=gettimeofday
AC_DEFINE(ABT_CONFIG_USE_GETTIMEOFDAY, 1, [Define to use gettimeofday])
fi
if test -z "$timer_type" ; then
AC_MSG_ERROR([No timer function found])
fi
AC_MSG_NOTICE([Timer type selected is $timer_type])
# check __builtin_expect
AX_GCC_BUILTIN(__builtin_expect)
# check __builtin_unreachable()
AX_GCC_BUILTIN(__builtin_unreachable)