-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
5280 lines (4788 loc) · 195 KB
/
configure.in
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
dnl -*- m4 -*-
# $Source: bitbucket.org:berkeleylab/gasnet.git/configure.in $
# Description: GASNet configure script
# Copyright 2002, Dan Bonachea <bonachea@cs.berkeley.edu>
# Copyright (c) 2014-2015 Intel Corporation. All rights reserved.
# Based in part on the Titanium project configure script
# Terms of use are as specified in license.txt
AC_DEFUN([cv_prefix],[gasnet_cv_])
dnl Note that dist-hook rewrites AC_REVISION in the generated configure
dnl GASNET_TOOLSONLY_FALSE_BEGIN
AC_REVISION("no-version-control-info")
dnl GASNET_TOOLSONLY_FALSE_END
dnl GASNET_TOOLSONLY_TRUE_BEGIN
dnl AC_REVISION("no-version-control-info (tools only)")
dnl GASNET_TOOLSONLY_TRUE_END
# the "new" way
# AC_INIT(GASNet, 0.2)
# AC_CONFIG_SRCDIR(gasnet_tools.h)
# AM_INIT_AUTOMAKE([no-define])
# the "old" way
AC_INIT(gasnet_tools.h)
AC_PREREQ(2.13)
GASNET_FIX_SHELL
AC_CONFIG_AUX_DIR(config-aux)
AC_CANONICAL_SYSTEM
AC_VALIDATE_CACHED_SYSTEM_TUPLE
dnl Public release version packaging identifier:
AC_DEFUN([GASNET_RELEASE_VERSION_MAJOR_D],[1])
AC_DEFUN([GASNET_RELEASE_VERSION_MINOR_D],[29])
AC_DEFUN([GASNET_RELEASE_VERSION_PATCH_D],[3])
dnl GASNet spec version:
AC_DEFUN([GASNET_SPEC_VERSION_MAJOR_D],[1])
AC_DEFUN([GASNET_SPEC_VERSION_MINOR_D],[8])
dnl GASNet tools spec version:
AC_DEFUN([GASNETT_SPEC_VERSION_MAJOR_D],[1])
AC_DEFUN([GASNETT_SPEC_VERSION_MINOR_D],[9])
AC_DEFUN([GASNET_RELEASE_VERSION_D],
[GASNET_RELEASE_VERSION_MAJOR_D.GASNET_RELEASE_VERSION_MINOR_D.GASNET_RELEASE_VERSION_PATCH_D])
dnl GASNET_TOOLSONLY_FALSE_BEGIN
AM_INIT_AUTOMAKE(GASNet, GASNET_RELEASE_VERSION_D, no-define)
dnl GASNET_TOOLSONLY_FALSE_END
dnl GASNET_TOOLSONLY_TRUE_BEGIN
dnl AM_INIT_AUTOMAKE(GASNet_Tools, GASNET_RELEASE_VERSION_D, no-define)
dnl GASNET_TOOLSONLY_TRUE_END
AC_PREFIX_DEFAULT(/usr/local/gasnet)
AM_CONFIG_HEADER(gasnet_config.h)
GASNET_START_CONFIGURE([AWK])
GASNET_DEFINE_CONFIGURE_VARS([GASNETI])
AM_CONDITIONAL(ALWAYS_TRUECOND, test -z "")
AM_CONDITIONAL(ALWAYS_FALSECOND, test -n "")
# Wish to define docdir in Makefiles if-and-only-if autoconf does not.
# If/when we raise the mimumin required version of autoconf to 2.60,
# then we can remove this and all uses of NEED_DOCDIR.
AM_CONDITIONAL(NEED_DOCDIR, test -z "$docdir")
# Don't warn about unknown configure options (which probably belong to client)
GASNET_NO_CHECK_OPTS
# Set gasnet_toolsonly_mode based on how we Bootstrapped
gasnet_toolsonly_mode=no
dnl GASNET_TOOLSONLY_TRUE_BEGIN
dnl gasnet_toolsonly_mode=yes
dnl GASNET_TOOLSONLY_TRUE_END
dnl define version identifiers
AC_DEFINE_UNQUOTED(GASNET_RELEASE_VERSION_MAJOR,GASNET_RELEASE_VERSION_MAJOR_D)
AC_DEFINE_UNQUOTED(GASNET_RELEASE_VERSION_MINOR,GASNET_RELEASE_VERSION_MINOR_D)
AC_DEFINE_UNQUOTED(GASNET_RELEASE_VERSION_PATCH,GASNET_RELEASE_VERSION_PATCH_D)
AC_DEFINE_UNQUOTED(GASNETI_SPEC_VERSION_MAJOR,GASNET_SPEC_VERSION_MAJOR_D)
AC_DEFINE_UNQUOTED(GASNETI_SPEC_VERSION_MINOR,GASNET_SPEC_VERSION_MINOR_D)
AC_DEFINE_UNQUOTED(GASNETIT_SPEC_VERSION_MAJOR,GASNETT_SPEC_VERSION_MAJOR_D)
AC_DEFINE_UNQUOTED(GASNETIT_SPEC_VERSION_MINOR,GASNETT_SPEC_VERSION_MINOR_D)
dnl legacy defines:
AC_DEFINE_UNQUOTED(GASNETI_RELEASE_VERSION,GASNET_RELEASE_VERSION_D)
AC_PROG_AWK
########################################################################
##
## Misc configure option processing
##
# default: support pthreads if library found
# --enable-pthreads: fail if pthreads lib not found
# --disable-pthreads: don't even look for pthreads library
GASNET_IF_ENABLED_WITH_AUTO(pthreads, [enable use of pthreads (required to support pthreaded GASNet clients)],
[use_pthreads="yes"], [use_pthreads="no"], [use_pthreads="try"])
GASNET_FORBID_PROGRAM_TRANSFORM
# This is to support a very conservative implementation of
# GASNETE_FAST_ALIGNED_MEMCPY and other type-punning operations.
# It is to be enabled only to test if a given problem is related
# to our type-punning issues (see bug 1389)
GASNET_IF_ENABLED(conservative-local-copy, [enable use of conservative (slower) mechanism for local data movement (default is no)],[
AC_DEFINE(GASNETI_BUG1389_WORKAROUND)
GASNET_MSG_WARN([
-----------------------------------------------------------------------
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
You passed --enable-conservative-local-copy
This usually has a SERIOUS impact on performance, so you should NOT
trust any performance numbers obtained from programs built
using this GASNet installation!!!
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-----------------------------------------------------------------------])])
########################################################################
##
## Supporting Command-Line Tools
##
dnl Store full paths, so we find right ones even if users have
dnl some other version in their path
GASNET_PATH_PROGS(GMAKE, gmake make $MAKE, GNU make)
AC_MSG_CHECKING(for GNU make)
if $GMAKE --version | grep GNU ; then
AC_MSG_RESULT(yes)
else
# We don't actually require GNU Make at the moment
# AC_MSG_ERROR(cannot find a version of GNU make - please install GNU make and/or set \$GMAKE to indicate where it's located)
GASNET_MSG_WARN([cannot find a version of GNU make - if you encounter make problems, install GNU make and/or set \$GMAKE to indicate where it's located])
fi
AC_SUBST(GMAKE)
dnl Other tools checked later, after PROG_CC check sets cross_compiling
########################################################################
##
## Perl
##
## We do this early so we can use "$PERL -e" for complex configure tests.
GASNET_PROG_PERL
AC_SUBST(PERL)
PERLSTART=$TOP_BUILDDIR/other/perlstart
AC_SUBST_FILE(PERLSTART)
########################################################################
##
## C/C++ Compilers
##
GASNET_PROG_CC
AC_PROG_LN_S
GASNET_BIGENDIAN
AC_CHECK_PROG(have_mpcc_r,mpcc_r,yes,no)
## specific compiler families
GASNET_FAMILY_CACHE_CHECK(C, CC, gasnet_cv_cc_family)
## compiler family early initialization
gcc_flag_prefix=''
case "$CC_FAMILY" in
GNU) GASNET_GCC_VERSION_CHECK(CC)
gcc_flag_delim=' '
case "$CC_SUBFAMILY" in
GCCFSS) AC_DEFINE(GASNETI_GCC_GCCFSS) ;;
APPLE) AC_DEFINE(GASNETI_GCC_APPLE) ;;
NVIDIA) gcc_flag_prefix='-Xcompiler '
gcc_flag_delim=','
;;
esac
;;
MTA) # override target_os for MTA, which may be wrong if cross-compiling
target_os="mtx" ;;
esac
if test "$cross_compiling" = "yes" ; then
AC_DEFINE(GASNETI_CROSS_COMPILING)
fi
## discover bit width
GASNET_CHECK_SIZEOF(void *)
GASNETI_PTR_BITS=`expr $SIZEOF_VOID_P \* 8`
AC_SUBST(GASNETI_PTR_BITS)
###
# Allow user forced ARCH and/or ISA settings w/o the corresponding probes
# XXX: Incomplete...
GASNET_IF_ENABLED_NOHELP(arch-altix, [force_arch_altix=yes])
GASNET_IF_ENABLED_NOHELP(arch-ibmpe, [force_arch_ibmpe=yes])
##
# Look for a Cray-provided header allowing for the possibility we are not using Cray's wrapper compiler
# There are two distinct "success" cases:
# 1) The header is found w/o any extra CPPFLAGS
# 2) The system is a Cray and the header is found only when the env var named by the 2nd arg is appended to CPPFLAGS
# GASNET_CHECK_CRAY_HEADER(header, includes_var [, action-on-success-1] [, action-on-success-2] [, action-on-failure])
AC_DEFUN([GASNET_CHECK_CRAY_HEADER],[
pushdef([cvname],ac_cv_header_[]translit($1,'.-','__')) dnl Any others?
AC_CHECK_HEADERS([$1], [$3], [
if expr "$target" : ".*-cnl-" >/dev/null; then
AC_MSG_CHECKING([for [\$]$2 in the environment])
if test "${$2+set}" = set; then
AC_MSG_RESULT([yes (rechecking there for $1)])
unset cvname
GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS ${$2}")
AC_CHECK_HEADERS([$1]) dnl Any action passed here could not set CPPFLAGS
GASNET_POPVAR(CPPFLAGS)
if test $cvname = yes; then
:
$4
fi
else
AC_MSG_RESULT(no)
fi
fi
if test $cvname = no; then
:
$5
fi
cvname=no dnl Otherwise recheck makes wrong choice
])
popdef([cvname])
])
dnl GASNET_TRY_WNO_FLAG(type,flag,action-on-success,action-on-failure) type=C or CXX
dnl As per bug 2718 gcc might silently ignore -Wno-such-flag, but not -Wsuch-flag
dnl XXX: Probably sufficient to just probe for -Wsuch-flag (but lie in AC_MSG_CHECKING)
AC_DEFUN([GASNET_TRY_WNO_FLAG],[
]GASNET_TRY_[$1]FLAG[([$2],
]GASNET_TRY_[$1]FLAG[(patsubst([$2],[Wno-],[W]),[$3],[$4]),[$4])])
dnl GASNET_GET_GNUWARNINGFLAGS(type, family, flagprefix) type=C or CXX
AC_DEFUN([GASNET_GET_GNUWARNINGFLAGS],[
if test "$enabled_dev_warnings" = "yes" ; then
# enable additional supported warnings
]GASNET_TRY_[$1]FLAG[([$3-Wall],
[[$1]FLAGS="$[$1]FLAGS $3-Wall"])
]GASNET_TRY_[$1]FLAG[([$3-Wpointer-arith],
[[$1]FLAGS="$[$1]FLAGS $3-Wpointer-arith"])
]GASNET_TRY_[$1]FLAG[([$3-Wnested-externs],
[[$1]FLAGS="$[$1]FLAGS $3-Wnested-externs"])
]GASNET_TRY_[$1]FLAG[([$3-Wwrite-strings],
[[$1]FLAGS="$[$1]FLAGS $3-Wwrite-strings"])
]GASNET_TRY_[$1]FLAG[([$3-Wmissing-format-attribute],
[[$1]FLAGS="$[$1]FLAGS $3-Wmissing-format-attribute"])
fi
if test "$2" = "Pathscale" ; then
# pathcc default enables -Wformat-security which we don't want
GASNET_TRY_WNO_FLAG([$1],[$3-Wno-format-security],
[[$1]FLAGS="$[$1]FLAGS $3-Wno-format-security"])
fi
# disable warnings that should always be off (not supported by our headers)
GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unused],
[[$1]FLAGS="$[$1]FLAGS $3-Wno-unused"],
[ # -Wno-unused meta disable failed, try to disable the problematic sub-options individually
GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unused-function],
[[$1]FLAGS="$[$1]FLAGS $3-Wno-unused-function"])
GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unused-value],
[[$1]FLAGS="$[$1]FLAGS $3-Wno-unused-value"])
GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unused-variable],
[[$1]FLAGS="$[$1]FLAGS $3-Wno-unused-variable"])
])
# -Wno-unused is not enough to ignore unused params on clang -Wall -Wextra (clang 3.8.1)
GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unused-parameter],
[[$1]FLAGS="$[$1]FLAGS $3-Wno-unused-parameter"])
GASNET_TRY_WNO_FLAG([$1],[$3-Wno-address],
[[$1]FLAGS="$[$1]FLAGS $3-Wno-address"])
if test "$use_pthreads" != "no" ; then
# some crappy pthread mutex implementations generate warnings without -Wno-missing-braces
AC_MSG_CHECKING(for buggy pthread.h mutex initializers)
old[$1]FLAGS="$[$1]FLAGS"
# FREEBSD requires the -pthread compiler flag when including pthread.h
case "$target_os" in
freebsd*) [$1]FLAGS="-pthread $[$1]FLAGS" ;;
esac
]GASNET_TRY_[$1]COMPILE_WITHWARN[([#include <pthread.h>],
[pthread_mutex_t fastmutex = PTHREAD_MUTEX_INITIALIZER;],
[AC_MSG_RESULT(ok)], [AC_MSG_RESULT(buggy)
GASNET_TRY_WNO_FLAG([$1],[$3-Wno-missing-braces],
[old[$1]FLAGS="$old[$1]FLAGS $3-Wno-missing-braces"])],
[#bug611: ignore failures here, which may be due to broken/missing pthreads support
#AC_MSG_ERROR(failure while checking for buggy pthread.h mutexes)
AC_MSG_RESULT(failure - ignored)
]
)
[$1]FLAGS="$old[$1]FLAGS"
fi
case "$target_os" in
solaris*) # hide pragma warnings in system header files included by absolute path
GASNET_TRY_WNO_FLAG([$1],[$3-Wno-unknown-pragmas],[[$1]FLAGS="$[$1]FLAGS $3-Wno-unknown-pragmas"])
esac
#]GASNET_TRY_[$1]FLAG[([-ansi -U__STRICT_ANSI__],[[$1]FLAGS="$[$1]FLAGS -ansi -U__STRICT_ANSI__"])
])
###
#
# choose the default CC flags
# NOTE: we intentionally *overwrite* CFLAGS with reasonable, well-tested values,
# to avoid picking up bad default flags from AC_PROG_CC or the default user environment
# Users who want to insert a specific compiler flag for all builds should append it to $CC
case "$CC_FAMILY" in
GNU) GASNET_PUSHVAR(CFLAGS,"-O3")
# prefer the --param inliner option(s), which give us finer control
GASNET_TRY_CFLAG([${gcc_flag_prefix}--param${gcc_flag_delim}max-inline-insns-single=35000],
[CFLAGS="$CFLAGS ${gcc_flag_prefix}--param${gcc_flag_delim}max-inline-insns-single=35000"
GASNET_TRY_CFLAG([${gcc_flag_prefix}--param${gcc_flag_delim}max-inline-insns=100000],
[CFLAGS="$CFLAGS ${gcc_flag_prefix}--param${gcc_flag_delim}max-inline-insns=100000"])],
GASNET_TRY_CFLAG([${gcc_flag_prefix}-finline-limit=10000],
[CFLAGS="$CFLAGS ${gcc_flag_prefix}-finline-limit=10000"])
)
# gcc 3.4+ require new flags to enable full inlining
GASNET_TRY_CFLAG([${gcc_flag_prefix}--param${gcc_flag_delim}inline-unit-growth=10000],
[CFLAGS="$CFLAGS ${gcc_flag_prefix}--param${gcc_flag_delim}inline-unit-growth=10000"])
GASNET_TRY_CFLAG([${gcc_flag_prefix}--param${gcc_flag_delim}large-function-growth=200000],
[CFLAGS="$CFLAGS ${gcc_flag_prefix}--param${gcc_flag_delim}large-function-growth=200000"])
# We'd like to use -Winline to detect call sites where the optimizer
# ignores our inline function modifier (usually due to technical limitations)
# However, some versions of gcc issue spurious warnings with -Winline
# for inlining operations which the user did not request.
# Detect that gcc bug and avoid -Winline for those versions
GASNET_TRY_CFLAG([${gcc_flag_prefix}-Winline],[
noninlineCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS ${gcc_flag_prefix}-Winline"
AC_MSG_CHECKING(for buggy -Winline)
GASNET_TRY_CCOMPILE_WITHWARN([
int foo() { return 0; }
int bar() { return foo() + bar(); }
], [
int x = bar();
], [ AC_MSG_RESULT(ok) # keep -Winline
], [ AC_MSG_RESULT(buggy)
CFLAGS="$noninlineCFLAGS" # remove -Winline
], [ GASNET_MSG_ERROR(failure when detecting buggy -Winline)])
])
CCOPTFLAGS="$CFLAGS"
GASNET_POPVAR(CFLAGS)
;;
Pathscale)
GASNET_PUSHVAR(CFLAGS,"-O3")
# We'd like to use -Winline (for the same reasons as with gcc).
# However, some installations have been observed to complain
# on every inline keyword, due to -fno-inline being inserted
# by the compiler driver. Avoid using -Winline in such a case.
GASNET_TRY_CFLAG([-Winline],[
noninlineCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Winline"
AC_MSG_CHECKING(for -Winline flags conflict)
GASNET_TRY_CCOMPILE_WITHWARN([
inline int foo() { return 0; }
], [
int x = foo();
], [ AC_MSG_RESULT(ok) # keep -Winline
], [ AC_MSG_RESULT(conflict)
CFLAGS="$noninlineCFLAGS" # remove -Winline
], [ GASNET_MSG_ERROR(failure when detecting -Winline conflict)])
])
CCOPTFLAGS="$CFLAGS"
GASNET_POPVAR(CFLAGS)
;;
Sun) if test "$GASNETI_PTR_BITS" = 64; then # -fast => -xarch=v8 which clobbers user's 64-bit choice
SUN_ARCH_FLAG=`echo "$CC $CFLAGS" | $PERL -ne 'foreach(split(/ /,$_)) { print "$_" if (m/^-xarch/);}'`
else
SUN_ARCH_FLAG=
fi
CCOPTFLAGS="-fast $SUN_ARCH_FLAG -xO5"
;;
Cray) CCOPTFLAGS="-O2" ;; # DOB: -O3 is unstable on Cray cc
XLC)
case "$target_os" in
darwin*)
# enabling ipa (-O4 or higher) breaks linking to MPI (and thus ibv).
case `/usr/sbin/sysctl hw.cpusubtype | cut '-d ' -f2` in
# bug926: on G5 (cpusubtype 100) -qarch={ppc970,auto} causes corruption of 64-bit integer arithmetic
100) CCOPTFLAGS="-O3 -qhot -qarch=g5 -qtune=auto -qthreaded -qmaxmem=-1" ;;
*) CCOPTFLAGS="-O3 -qhot -qarch=auto -qtune=auto -qthreaded -qmaxmem=-1" ;;
esac
;;
linux*) CCOPTFLAGS="-O3 -qarch=auto -qtune=auto -qthreaded -qmaxmem=-1";;
*) #CCOPTFLAGS="-O5 -qthreaded -qmaxmem=-1" ;; # -O5 == -O3 w/ intra-procedural analysis, maxmem=-1 is default for -O3 or higher
CCOPTFLAGS="-O3 -qarch=auto -qtune=auto -qthreaded -qmaxmem=-1" ;; # -O5 causes linker to hang on Titanium
esac
GASNET_TRY_CFLAG([-qnosmp], [CCOPTFLAGS="$CCOPTFLAGS -qnosmp"])
# If $CC sets -q<something>, then remove conflicting options from CCOPTFLAGS
for flag in arch tune hot threaded smp; do
if echo "$CC" | grep "q\(no\)\?${flag}" >/dev/null; then
CCOPTFLAGS=`echo "$CCOPTFLAGS" | sed -e "s/-q\(no\)\?${flag}\(=[[a-z0-9_]]*\)\?//"`
fi
done
;;
Intel) CCOPTFLAGS="-O3" ;;
MTA) CCOPTFLAGS="-O3" ;; # MTA C actually ignores -O, optimization controlled by presence/absence of -g
PGI)
CCOPTFLAGS="-O2" # Default
# Work-aroung bug 2842: bad code gen by pgcc 10.5-0 through 10.7-0 at -O2
# XXX: Need an ending version here when known
GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS -I$TOP_SRCDIR/other")
GASNET_TRY_CACHE_CHECK([if PGI compiler misoptimizes assignment to (const char *)], bug2842, [
#include "gasnet_portable_platform.h"
#if PLATFORM_COMPILER_VERSION_LT(10,5,0) || PLATFORM_COMPILER_VERSION_GT(10,7,0)
#error "GOOD pgcc version should FAIL this test"
#endif
],[(void)0],[CCOPTFLAGS="-O1"])
GASNET_POPVAR(CPPFLAGS)
;;
TINY) CCOPTFLAGS="" # optimization not supported
SEPARATE_CC=1 # force separate compilation - multiple -c compilation not supported
;;
Open64)
if test "$GASNETI_PTR_BITS" = 32; then
# See bug 2725 for info on test failures at -O3
# Also see "opencc -m32 -O2" crashing when building libupcr
CCOPTFLAGS="-O1"
else
# See bug 2724 for info on "-OPT:wrap_around_unsafe=off"
CCOPTFLAGS="-O3 -OPT:wrap_around_unsafe=off"
fi
;;
Clang) CCOPTFLAGS="-O3" ;;
*) CCOPTFLAGS="-O" ;;
esac
AC_SUBST(SEPARATE_CC)
case "$CC_FAMILY" in
GNU) GASNET_PUSHVAR(CFLAGS,"${gcc_flag_prefix}-g3")
case "$target_os" in
darwin*) # Want -gstabs+ instead of -g3, if supported
GASNET_TRY_CFLAG([${gcc_flag_prefix}-gstabs+], [CFLAGS="${gcc_flag_prefix}-gstabs+"])
;;
esac
CCDEBUGFLAGS="$CFLAGS"
GASNET_POPVAR(CFLAGS)
;;
MTA) CCDEBUGFLAGS="-g2" ;; # need +ESdbgasm to use -g with _asm()
Pathscale) CCDEBUGFLAGS="-g3 -O0" ;; # need to explicitly disable optimization
Open64) CCDEBUGFLAGS="-g3" ;;
Clang) CCDEBUGFLAGS="-g -O0" ;;
*) CCDEBUGFLAGS="-g" ;;
esac
dnl GASNET_GET_ULTRASPARC_FLAGS(type,flags) type=C or CXX
# attempt to enable the ultrasparc ISA in MISC_C(XX)FLAGS, and test for related capabilities
# flags is compiler options which enable ultrasparc instructions for 32-bit ABI
GASNET_IF_DISABLED([ultrasparc-probe],[Disable probe for UltraSPARC compiler options],[DISABLE_ULTRASPARC=1])
AC_DEFUN([GASNET_GET_ULTRASPARC_FLAGS],[
pushdef([ultrasparc3code],[
void foo(void) {
#ifdef __GNUC__
register void * addr = 0;
register int oldval = 0;
register int newval = 1;
__asm__ __volatile__ ("cas [[%2]], %0, %1"
: "=&r"(oldval), "=&r"(newval) : "r" (addr) : "memory");
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
__asm("cas [[%i0]], %i1, %i2");
#else
#error unknown sparc compiler
#endif
}
])
if test "$GASNETI_PTR_BITS" = 32 -a "$DISABLE_ULTRASPARC" != 1; then
for flag in $2 ; do
]GASNET_TRY_[$1]FLAG[([$flag],[ultrasparc_flag_worked=1],[ultrasparc_flag_worked=0])
if test "$ultrasparc_flag_worked" = 1; then
GASNET_PUSHVAR([$1]FLAGS,"$[$1]FLAGS $MISC_[$1]FLAGS $flag")
AC_MSG_CHECKING(for working flag $flag)
AC_TRY_RUN(ultrasparc3code [ int main(void) { return 0; } ],
[ultrasparc_flag_worked=1], [ultrasparc_flag_worked=0], [ultrasparc_flag_worked=1])
GASNET_POPVAR([$1]FLAGS)
if test "$ultrasparc_flag_worked" = 1; then
AC_MSG_RESULT(yes)
MISC_[$1]FLAGS="$flag"
break
else
AC_MSG_RESULT(no)
fi
fi
done
fi
AC_MSG_CHECKING(for UltraSPARC instruction support)
GASNET_PUSHVAR([$1]FLAGS,"$[$1]FLAGS $MISC_[$1]FLAGS")
]GASNET_TRY_[$1]COMPILE_WITHWARN[( [ ultrasparc3code ] , [ ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(GASNETI_ARCH_ULTRASPARC)
], [ AC_MSG_RESULT(no/warning) ], [ AC_MSG_RESULT(no/error) ])
GASNET_POPVAR([$1]FLAGS)
popdef([ultrasparc3code])
])
dnl GASNET_GET_PPC64_FLAGS(type,flags) type=C or CXX
# attempt to enable 64-bit inline asm in MISC_C(XX)FLAGS, and test for related capabilities
# flags is compiler options which enable ppc64 instructions for 32-bit ABI
GASNET_IF_DISABLED([ppc64-probe],[Disable probe for PPC64 compiler options],[DISABLE_PPC64=1])
AC_DEFUN([GASNET_GET_PPC64_FLAGS],[
pushdef([ppc64code],[[
#include <stdio.h>
#if defined(__xlC__)
static int testme(double *p);
#pragma mc_func testme { \\
/* ARGS: r3 = p LOCAL: r4, r5 */ \\
"38a00001" /* li r5,1 */ \\
"38800000" /* li r4,0 */ \\
"f8830000" /* std r4,0(r3) */ \\
"e8a30000" /* ld r5,0(r3) */ \\
"7ca32b78" /* mr r3,r5 */ \\
}
#pragma reg_killed_by testme cr0, gr4, gr5
#else
static int testme(double *p) {
int tmp, result;
__asm__ __volatile__ (
"li %2,1 \n\t"
"li %1,0 \n\t"
"std %1,0(%3) \n\t"
"ld %2,0(%3) \n\t"
: "=m" (*p), "=&b" (tmp), "=&r" (result)
: "b" (p) );
return result;
}
#endif
]])
if test "$GASNETI_PTR_BITS" = 32 -a "$DISABLE_PPC64" != 1 -a "$cross_compiling" != "yes"; then
# Bug 1587: "for flag in ; do" chokes the shell on Solaris
# Bug 1588: Use of m4_ifval([$2]) to avoid bug 1587 chokes autoconf 2.13
# So, we add a dummy element to keep the for-loop list non-empty, and then skip it.
for flag in $2 DUMMY ; do
if test "$flag" != DUMMY ; then
]GASNET_TRY_[$1]FLAG[([$flag],[ppc64_flag_worked=1],[ppc64_flag_worked=0])
if test "$ppc64_flag_worked" = 1; then
GASNET_PUSHVAR([$1]FLAGS,"$[$1]FLAGS $MISC_[$1]FLAGS $flag")
AC_MSG_CHECKING(for working flag $flag)
AC_TRY_RUN(ppc64code [ int main(void) { double x; return testme(&x); } ],
[ppc64_flag_worked=1], [ppc64_flag_worked=0], [ppc64_flag_worked=1])
GASNET_POPVAR([$1]FLAGS)
if test "$ppc64_flag_worked" = 1; then
AC_MSG_RESULT(yes)
MISC_[$1]FLAGS="$flag"
break
else
AC_MSG_RESULT(no)
fi
fi
fi
done
fi
AC_MSG_CHECKING(for PPC64 instruction support)
GASNET_PUSHVAR([$1]FLAGS,"$[$1]FLAGS $MISC_[$1]FLAGS")
]GASNET_TRY_[$1]COMPILE_WITHWARN[( [ ppc64code ] , [ ],
AC_TRY_RUN(ppc64code [ int main(void) { double x; return testme(&x); } ],
[AC_MSG_RESULT(yes)
AC_DEFINE(GASNETI_ARCH_PPC64)],
[AC_MSG_RESULT(no/failure)],
[ # Cross compiling. For now just trust PTR_BITS.
if test "$GASNETI_PTR_BITS" = 64; then
AC_MSG_RESULT([yes (cross-compiling w/ 64-bit pointers)])
AC_DEFINE(GASNETI_ARCH_PPC64)
else
AC_MSG_RESULT([no (cross-compiling w/ 32-bit pointers)])
fi
]),
[ AC_MSG_RESULT(no/warning) ], [ AC_MSG_RESULT(no/error) ])
GASNET_POPVAR([$1]FLAGS)
popdef([ppc64code])
])
dnl GASNET_SET_MISCFLAGS(CC|MPI_CC, compliancecode)
AC_DEFUN([GASNET_SET_MISCFLAGS],[
# Set MISC_CFLAGS: flags to be used by all C compilations, regardless of optimization/debugging level
# This should include architectural/CPU flags, warning flags, and anything required for C99 conformance
# We do not currently allow a user override of MISC_C(PP)FLAGS
MISC_CFLAGS=""
misc_flag_prefix=''
misc_flag_delim=' '
case "$CC_FAMILY" in
GNU)
case "$CC_SUBFAMILY" in
NVIDIA) misc_flag_prefix='-Xcompiler '
misc_flag_delim=','
;;
esac
case "$target_cpu" in
sparc) GASNET_GET_ULTRASPARC_FLAGS(C,["-mcpu=ultrasparc3 -mtune=ultrasparc3" "-mcpu=ultrasparc -mtune=ultrasparc"]);;
rs6000|powerpc*) GASNET_GET_PPC64_FLAGS(C,["-force_cpusubtype_ALL" "-Wa,-mppc64"]);;
ia64) GASNET_TRY_CFLAG([-mtls-size=64], [MISC_CFLAGS="$MISC_CFLAGS -mtls-size=64"]);;
esac
case "$target_os" in
darwin*)
GASNET_TRY_WNO_FLAG([C],[${misc_flag_prefix}-Wno-long-double],
[MISC_CFLAGS="$MISC_CFLAGS ${misc_flag_prefix}-Wno-long-double"])
;;
esac
;;
Cray)
AC_MSG_CHECKING([for Cray C warning flags])
crayc_warn_flags="236:3185" # 3185 = bug 3306
GASNET_TRY_CCOMPILE_WITHWARN(
[ typedef struct { int f1; } S;
S foo(void) {
S s;
s.f1 = 1;
return s;
} ], [], [],
[ crayc_warn_flags="${crayc_warn_flags}:7212" ], # bug 3309, Cray C 8.5+
[GASNET_MSG_ERROR(failure building struct warning test)])
case "$target_cpu" in
x86_64) MISC_CFLAGS="-hnomessage=$crayc_warn_flags" ;; # XT, XE, XK, XC, etc.
*) AC_MSG_ERROR(Cray C compiler for unknown target CPU) ;;
esac
AC_MSG_RESULT([$MISC_CFLAGS])
;;
Intel) MISC_CFLAGS="-wd177 -wd279"
GASNET_TRY_CFLAG([-wd1572],
[MISC_CFLAGS="$MISC_CFLAGS -wd1572"])
;;
PGI) MISC_CFLAGS="-Masmkeyword -Msignextend";; # get inline assembly and sign-extended narrowing
MTA) MISC_CFLAGS="-display_error_number -WS 111,174,238" ;;
Sun) if test "$target_cpu" = "sparc"; then
GASNET_GET_ULTRASPARC_FLAGS(C,["-xarch=v8plusb" "-xarch=v8plusa" "-xarch=v8plus" "-xarch=sparcvis2" "-xarch=sparcvis" "-xarch=sparc"])
fi
MISC_CFLAGS="$MISC_CFLAGS -errtags" ;; # show warning tag ids in warnings
XLC) GASNET_GET_PPC64_FLAGS(C)
# Try to suppress certain warnings:
# 1500-010 = infinite loop (such as in our tests)
# 1500-029 = could not inline (e.g. varargs, alloc, etc.)
# 1506-229 = empty source file (some linux headers)
GASNET_TRY_CFLAG([-qsuppress=1500-010:1500-029:1506-229],
[MISC_CFLAGS="$MISC_CFLAGS -qsuppress=1500-010:1500-029:1506-229"])
;;
*) ;;
esac
# Add warning enable/suppression flags to MISC_CFLAGS
case "$CC_FAMILY" in
GNU | Pathscale | Open64 | Clang)
GASNET_PUSHVAR(CFLAGS,"$MISC_CFLAGS")
GASNET_GET_GNUWARNINGFLAGS(C,$CC_FAMILY,[${misc_flag_prefix}])
MISC_CFLAGS="$CFLAGS"
GASNET_POPVAR(CFLAGS)
;;
*) ;;
esac
# Set MISC_CPPFLAGS: flags to be used by all C preprocesses and compilations
# Note this is ALSO used for C++ compilation, so only generic language-independent options should go in here
# We do not currently allow a user override of MISC_C(PP)FLAGS
MISC_CPPFLAGS=""
case "$CC_FAMILY" in
GNU)
case "$target_os" in
darwin*) # add some options which are specific to the Apple Inc version of gcc
GASNET_TRY_CFLAG([${misc_flag_prefix}-no-cpp-precomp],
[MISC_CPPFLAGS="$MISC_CPPFLAGS ${misc_flag_prefix}-no-cpp-precomp"])
;;
esac ;;
*) ;;
esac
# Determine the minimal CFLAGS we need to add for C99 compliance
# This is done incrementally to avoid passing options on newer compiler versions where the
# required compliance is provided by default, making the flag redundant (and potentially detrimental)
# This also allows the user to pass a specific compliance flag in $CC without conflict
case "$CC_FAMILY" in
# Some known oddball cases:
XLC) gasnet_c99_flags="-qlanglvl=extc99 -qlanglvl=stdc99";;
Sun) gasnet_c99_flags="-xc99=all";;
Cray) gasnet_c99_flags="'-h c99'";;
PGI) gasnet_c99_flags="-c99 -c9x" ;;
# One of these should work for the rest:
# std=c99 requests strict C99 conformance from gcc and look-alikes, whereas
# std=gnu99 additionally requests GNU-specific language extensions.
# All GASNet code should adhere to the subset of strict C99 in the README coding standards,
# (a subset of std=c99), however these flags are also used to compile network API headers
# and client code that may require more general support. Therefore std=gnu99 is default.
*) gasnet_c99_flags="${misc_flag_prefix}-std=gnu99 ${misc_flag_prefix}-c99 ${misc_flag_prefix}-std=c99";;
esac
# NOTE: We do not currently cache this check because it is expanded in multiple contexts
GASNET_C99_FLAG=unknown
eval set - $gasnet_c99_flags
for flag in "" "[$]@"; do
GASNET_PUSHVAR(CFLAGS, "$CFLAGS $MISC_CFLAGS $MISC_CPPFLAGS")
# first see if the flag generates warnings
GASNET_TRY_CFLAG([$flag],[
# now see if it gives us the support we want
GASNET_PUSHVAR(CFLAGS, "$CFLAGS $flag")
AC_TRY_COMPILE($2,[],[GASNET_C99_FLAG="$flag"])
GASNET_POPVAR(CFLAGS)
])
GASNET_POPVAR(CFLAGS)
if test "$GASNET_C99_FLAG" != "unknown"; then break; fi
done
AC_MSG_CHECKING([for flags required for C99 subset compliance])
if test "$GASNET_C99_FLAG" = "unknown"; then
AC_MSG_ERROR([Could not determine \$$1 flag to accept ISO C99 input. You may need to append flags in \$$1 to enable C99 support])
elif test "$GASNET_C99_FLAG" = ""; then
AC_MSG_RESULT([none required])
else
AC_MSG_RESULT([$GASNET_C99_FLAG])
MISC_CFLAGS="$MISC_CFLAGS $GASNET_C99_FLAG"
fi
]) dnl GASNET_SET_MISCFLAGS
dnl Test code for compliance to the C99 subset required to compile gasnet.h
dnl The following should ONLY include C99 features we officially adopt in the GASNet/README coding standards
AC_DEFUN([GASNET_C99_TEST],
[ void foo(void) {
int a = 1; // C99 comment
for (int i=0; i < 100; i++) a += i; // Conditional expression declaration
int i = a; // mid-block decl
}
])
dnl The following is required for $CC (when compiling libgasnet) and optional for clients compiling gasnet.h
AC_DEFUN([GASNET_VA_ARGS_TEST],[
#define GASNETI_AMNUMARGS(...) GASNETI_AMNUMARGS_(__VA_ARGS__,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0)
#define GASNETI_AMNUMARGS_(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,N,...) N
int b[[GASNETI_AMNUMARGS(1)+1]];
int c[[GASNETI_AMNUMARGS(1,2)+1]];
int d[[GASNETI_AMNUMARGS(1,2,3)+1]];
])
GASNET_IF_ENABLED(debug, Build GASNet in a debugging mode,
[
if test -z "$GASNET_SUPPRESS_DEBUG_WARNING" ; then
GASNET_MSG_WARN([
-----------------------------------------------------------------------
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
Configuring the system for global, forced debugging mode.
This usually has a SERIOUS impact on performance, so you should NOT
trust any performance numbers obtained from programs built
using this GASNet installation!!!
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-----------------------------------------------------------------------])
fi
GASNET_OPT_CFLAGS="$CCDEBUGFLAGS"
AC_DEFINE(GASNET_DEBUG)
BUILDCONFIG="debug"
enabled_debug=yes],
[ GASNET_OPT_CFLAGS="$CCOPTFLAGS"
AC_DEFINE(GASNET_NDEBUG)
BUILDCONFIG="optimize"
enabled_debug=no])
AM_CONDITIONAL(BUILDCONFIG_DEBUG, test "$enabled_debug" = yes)
GASNET_IF_ENABLED_WITH_AUTO(dev-warnings, Build GASNet with developer compiler warnings (enabled by default with --enable-debug),
enabled_dev_warnings=yes, enabled_dev_warnings=no, enabled_dev_warnings=$enabled_debug)
GASNET_SET_MISCFLAGS(CC,[ GASNET_VA_ARGS_TEST GASNET_C99_TEST ])
# Some C compilers disable OS POSIX entry points when strict c99 conformance is selected
# _GNU_SOURCE implies _XOPEN_SOURCE and enables other features we probe for, like "adaptive" mutex_t and pthread_rwlock_t
# Known to work on Linux, cygwin, and expected to be safe or at worst ignored on other OS's
GASNET_EXTRA_DEFINES="-D_GNU_SOURCE=1"
AC_SUBST(GASNET_EXTRA_DEFINES)
# MISC_C(PP)FLAGS are added to C(PP)FLAGS here to ensure they are used for the remaining configure tests,
# but they retain a separate identity post-configure
CFLAGS="$GASNET_OPT_CFLAGS $MISC_CFLAGS"
CPPFLAGS="$GASNET_EXTRA_DEFINES $MISC_CPPFLAGS"
AC_SUBST(MISC_CFLAGS) # warning suppression and other misc C flags
AC_SUBST(MISC_CPPFLAGS) # misc preprocessor flags
AC_SUBST(GASNET_OPT_CFLAGS)
# Final check to ensure everything works together -- possibly redundant
GASNET_TRY_CACHE_CHECK(for working GASNet-required ISO C99 subset, gasnet_c99_subset,
[ GASNET_VA_ARGS_TEST GASNET_C99_TEST ], [], [],
[ AC_MSG_ERROR(Unable to find sufficient C99 support features in $CC to build GASNet. You may need to append flags in \$CC to enable C99 support) ])
GASNET_IF_ENABLED(gasnet-verbose, Build GASNet lib with debugging status messages,
[ enabled_debug_verbose=yes ], [ enabled_debug_verbose=no ])
if test "$enabled_debug_verbose" = yes; then
AC_DEFINE(GASNET_DEBUG_VERBOSE)
fi
AM_CONDITIONAL(BUILDCONFIG_DEBUG_VERBOSE, test "$enabled_debug_verbose" = yes)
GASNET_IF_ENABLED_WITH_AUTO(trace, Build GASNet with tracing enabled (enabled by default with --enable-debug),
enabled_trace=yes, enabled_trace=no, enabled_trace=$enabled_debug)
if test "$enabled_trace" = yes; then
AC_DEFINE(GASNET_TRACE)
fi
AM_CONDITIONAL(BUILDCONFIG_TRACE, test "$enabled_trace" = yes)
GASNET_IF_ENABLED_WITH_AUTO(stats, Build GASNet with statistical collection enabled (enabled by default with --enable-debug),
enabled_stats=yes, enabled_stats=no, enabled_stats=$enabled_debug)
if test "$enabled_stats" = yes; then
AC_DEFINE(GASNET_STATS)
fi
AM_CONDITIONAL(BUILDCONFIG_STATS, test "$enabled_stats" = yes)
GASNET_IF_ENABLED(srclines, Build GASNet with srclines support (enabled by default with --enable-trace),
[ enabled_srclines=yes ])
if test "$enabled_srclines" = yes; then
AC_DEFINE(GASNET_SRCLINES)
fi
AM_CONDITIONAL(BUILDCONFIG_SRCLINES, test "$enabled_srclines" = yes)
GASNET_IF_ENABLED_WITH_AUTO(debug-malloc, Build GASNet with debugging malloc implementation enabled (enabled by default with --enable-debug),
enabled_debug_malloc=yes, enabled_debug_malloc=no, enabled_debug_malloc=$enabled_debug)
if test "$enabled_debug_malloc" = yes; then
AC_DEFINE(GASNET_DEBUGMALLOC)
fi
AM_CONDITIONAL(BUILDCONFIG_DEBUGMALLOC, test "$enabled_debug_malloc" = yes)
GASNET_CORRECT_OPTIMIZEDDEBUG(CC,CFLAGS,CC,[$CPPFLAGS],[])
case "$CC_FAMILY" in
GNU) KEEPTMP_CFLAGS="-save-temps" ;;
Clang) KEEPTMP_CFLAGS="-save-temps" ;;
Pathscale) KEEPTMP_CFLAGS="-keep" ;;
Open64) KEEPTMP_CFLAGS="-keep" ;;
XLC) KEEPTMP_CFLAGS="-qlist" ;; # XXX: generates .lst w/ asm. Can't find a way to preserve .i
PGI) KEEPTMP_CFLAGS="-Mkeepasm" ;; # XXX: only keeps .s. Can't find a way to preserve .i
Intel) KEEPTMP_CFLAGS="-save-temps" ;; # XXX: only keeps .s. Can't find a way to preserve .i
Sun) KEEPTMP_CFLAGS="-keeptmp" ;;
Cray) KEEPTMP_CFLAGS="-hkeepfiles" ;; # XXX: only keeps .s. Can't find a way to preserve .i
*) KEEPTMP_CFLAGS="" ;;
esac
AC_SUBST(KEEPTMP_CFLAGS) # flags to preserve intermediate file (,i, .s, etc.)
segconfig=""
GASNET_IF_ENABLED(segment-fast, Build GASNet in the FAST shared segment configuration,
segconfig="fast$segconfig", )
GASNET_IF_ENABLED(segment-large, Build GASNet in the LARGE shared segment configuration,
segconfig="large$segconfig", )
GASNET_IF_ENABLED(segment-everything, Build GASNet in the EVERYTHING shared segment configuration,
segconfig="everything$segconfig", )
case "$segconfig" in
"") segconfig=fast; #for AM_CONDITIONAL, below
AC_DEFINE(GASNET_SEGMENT_FAST) ;; # default is fast
fast) AC_DEFINE(GASNET_SEGMENT_FAST) ;;
large) AC_DEFINE(GASNET_SEGMENT_LARGE) ;;
everything) AC_DEFINE(GASNET_SEGMENT_EVERYTHING) ;;
*) AC_MSG_ERROR(Conflicting shared segment configurations specified) ;;
esac
# Do it all again because AM_CONDITIONAL()s can't go inside if or case.
# Groan.
AM_CONDITIONAL(GASNET_SEGMENT_FAST, test "$segconfig" = fast)
AM_CONDITIONAL(GASNET_SEGMENT_LARGE, test "$segconfig" = large)
AM_CONDITIONAL(GASNET_SEGMENT_EVERYTHING, test "$segconfig" = everything)
GASNET_WITH(segment-mmap-max,
[Upper bound for mmap-based GASNet segments (ex: "2GB", "1045MB")],
[case "$withval" in
[[1-9]]*G*)
AC_DEFINE_UNQUOTED(GASNETI_MMAP_MAX_SIZE,
[((uint64_t)(`expr "${withval}" : "\([[1-9]][[0-9]]*\)"`ull << 30))])
;;
[[1-9]]*M*)
AC_DEFINE_UNQUOTED(GASNETI_MMAP_MAX_SIZE,
[((uint64_t)(`expr "${withval}" : "\([[1-9]][[0-9]]*\)"`ull << 20))])
;;
[[1-9]][[0-9]]*)
AC_DEFINE_UNQUOTED(GASNETI_MMAP_MAX_SIZE,
[((uint64_t)${withval}ull)])
;;
*) AC_MSG_ERROR(Illegal value for --with-segment-mmap-max=$withval) ;;
esac])
dnl GASNET_GET_PLATFORM_ID(CCVAR, opt compiler-desc)
dnl probe a compiler for version information
AC_DEFUN([GASNET_GET_PLATFORM_COMPILER], [
GASNET_TRY_CACHE_EXTRACT_$4($2 for PLATFORM_COMPILER_$3, PLATFORM_$1_$3,
[ #include "gasnet_portable_platform.h" ], [ PLATFORM_COMPILER_$3 ], GASNETI_PLATFORM_$1_$3)
AC_DEFINE_UNQUOTED(GASNETI_PLATFORM_$1_$3,
ifelse([$4],[STR],["$GASNETI_PLATFORM_$1_$3"],[$GASNETI_PLATFORM_$1_$3]))
])
AC_DEFUN([GASNET_GET_PLATFORM_ID], [
GASNET_PUSHVAR(CPPFLAGS,"$CPPFLAGS -I$TOP_SRCDIR/other")
GASNET_GET_PLATFORM_COMPILER([$1],[$2],[IDSTR],[STR])
GASNET_GET_PLATFORM_COMPILER([$1],[$2],[FAMILYID],[EXPR])
GASNET_GET_PLATFORM_COMPILER([$1],[$2],[ID],[EXPR])
GASNET_GET_PLATFORM_COMPILER([$1],[$2],[VERSION],[EXPR])
GASNET_POPVAR(CPPFLAGS)
])
dnl Try to discover the C compiler's inline modifier
dnl GASNET_INLINE_MODIFIER(compiler-display-name, compiler-type)
dnl Where compiler-type is CC|MPI_CC
AC_DEFUN([GASNET_TRY_INLINE],[ dnl INTERNAL USE BY GASNET_INLINE_MODIFIER ONLY
if test -z "$inlinemod"; then
GASNET_TRY_CACHE_CHECK([$1 for $3 modifier], $2[]mod$3,
[$3 int dummy(void) { return 1; }], [], [inlinemod="$3"])
fi
])
AC_DEFUN([GASNET_INLINE_MODIFIER],[
pushdef([lowername],translit($2,'A-Z','a-z'))
pushdef([uppername],translit($2,'a-z','A-Z'))
inlinemod=""
case "$[]uppername[]_FAMILY" in
XLC) # force __inline on XLC, to avoid warnings
inlinemod=__inline
;;
esac
GASNET_TRY_INLINE($1,lowername,[inline])
GASNET_TRY_INLINE($1,lowername,[__inline__])
GASNET_TRY_INLINE($1,lowername,[__inline])
GASNET_TRY_INLINE($1,lowername,[_inline])
GASNET_TRY_INLINE($1,lowername,[_Inline])
if test -n "$inlinemod"; then
GASNET_TRY_CACHE_CHECK($1 for working 'static $inlinemod', lowername[_static_inline],
[static $inlinemod int dummy() { return 1; }], [], [inlinemod="static $inlinemod"])
AC_DEFINE_UNQUOTED(GASNET_[]uppername[]_INLINE_MODIFIER, $inlinemod)
fi
popdef([uppername])
popdef([lowername])
])
dnl Check for compilers with varying support for inline asm and atomics
dnl GASNET_CHECK_ASM_SUPPORT(compiler-display-name, compiler-type)
dnl Where compiler-type is CC|CXX|MPI_CC
AC_DEFUN([GASNET_CHECK_ASM_SUPPORT],[
GASNET_FUN_BEGIN([$0($1,$2)])
pushdef([lowername],translit($2,'A-Z','a-z'))
pushdef([uppername],translit($2,'a-z','A-Z'))
pushdef([flagsvar],ifelse(index([$2],[CXX]),[-1],[C],[CXX])[]FLAGS)
case "$[]uppername[]_FAMILY" in
XLC)
GASNET_TRY_CACHE_LINK([$1 for XLC mc_func support], lowername[]_mc_func, [
#pragma mc_func _gasneti_do_sync { "7c2004ac" }
#pragma reg_killed_by _gasneti_do_sync
#define gasneti_local_sync() _gasneti_do_sync()
],
[ gasneti_local_sync(); ],
[ AC_DEFINE(GASNETI_HAVE_[]uppername[]_XLC_ASM) ])
GASNET_TRY_CACHE_LINK([$1 for GCC inline asm support], lowername[]_gcc_asm, [],
[ __asm__ __volatile__ ("sync"); ],
[ AC_DEFINE(GASNETI_HAVE_[]uppername[]_GCC_ASM) ])
;;
esac
GASNET_PUSHVAR(flagsvar,"$flagsvar -I$TOP_SRCDIR/other")
dnl TODO: factor this and loop over "32" and "64" ?
dnl TODO: we should probe if test-and-set is swap
GASNET_TRY_CACHE_LINK([$1 for 32-bit __sync atomics support], lowername[]_sync_atomics_32, [
#include "portable_inttypes.h"
],[
struct { volatile uint32_t ctr; } x = { 2 };
uint32_t op = 1;
uint32_t oval = 2;
uint32_t nval = 3;
volatile uint32_t result;
result = __sync_bool_compare_and_swap(&(x.ctr), oval, nval)
+ __sync_val_compare_and_swap(&(x.ctr), nval, oval)
+ __sync_fetch_and_add(&(x.ctr), op);
],[ AC_DEFINE(GASNETI_HAVE_[]uppername[]_SYNC_ATOMICS_32) ])
GASNET_TRY_CACHE_LINK([$1 for 64-bit __sync atomics support], lowername[]_sync_atomics_64, [
#include "portable_inttypes.h"
],[
struct { volatile uint64_t ctr; } x = { 2 };
uint64_t op = 1;
uint64_t oval = 2;
uint64_t nval = 3;
volatile uint64_t result;
result = __sync_bool_compare_and_swap(&(x.ctr), oval, nval)
+ __sync_val_compare_and_swap(&(x.ctr), nval, oval)
+ __sync_fetch_and_add(&(x.ctr), op);
],[ AC_DEFINE(GASNETI_HAVE_[]uppername[]_SYNC_ATOMICS_64) ])
GASNET_POPVAR(flagsvar)
popdef([flagsvar])
popdef([uppername])
popdef([lowername])
GASNET_FUN_END([$0])
])
GASNET_LIBGCC
GASNET_CHECK_RESTRICT([GASNETI_CC])
GASNET_CHECK_ASM_SUPPORT([C compiler],[CC])
GASNET_INLINE_MODIFIER([C compiler],[CC])
GASNET_GET_GNU_ATTRIBUTES([GASNETI_HAVE_CC])
GASNET_GET_PLATFORM_ID([COMPILER])
GASNET_IFDEF([__PIC__],[AC_DEFINE(GASNETI_CONFIGURED_PIC)])
########################################################################
# hunt for 16-, 32-, and 64-bit integer types
GASNET_SETUP_INTTYPES()
########################################################################
# get sizes of additional types for the "anytype" unions
GASNET_CHECK_SIZEOF(float)
GASNET_CHECK_SIZEOF(double)