-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure
executable file
·1452 lines (1254 loc) · 38.8 KB
/
configure
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
#!/bin/bash
#
# Copyright (c) 2011 - 2016
# University of Houston System and UT-Battelle, LLC.
# Copyright (c) 2009 - 2016
# Silicon Graphics International Corp. SHMEM is copyrighted
# by Silicon Graphics International Corp. (SGI) The OpenSHMEM API
# (shmem) is released by Open Source Software Solutions, Inc., under an
# agreement with Silicon Graphics International Corp. (SGI).
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# o Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# o Neither the name of the University of Houston System,
# UT-Battelle, LLC. nor the names of its contributors may be used to
# endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# NB: this will turn into the GNU autotools setup at some point.
#
# -- defaults --
prefix=/usr/local
comms_layer=
gasnet_root=
gasnet_incdir=
gasnet_bindir=
gasnet_conduit=
gasnet_threnv=par
exe_incdir=/usr/include
exe_libdir=/usr/lib64
feature_experimental=disabled
feature_debug=disabled
feature_trace=disabled
feature_pshmem=disabled
libdir=
incdir=
bindir=
modulefilesdir=
show_progress=YES
cc_type=
known_compilers="GNU, Intel, PGI, Oracle, OpenUH, Open64, Clang, IBMXL"
# -- end defaults --
# find out where things are
progname="`basename -- $0`"
# canonicalize where source is
srctreedir="`dirname -- $0`"
srctreedir="`cd $srctreedir && pwd`"
# same for where we are
buildtreedir="`pwd`"
tell()
{
if [ "$show_progress" = "YES" ]
then
echo "$progname: $*"
fi
}
bailout()
{
tell ""
tell "Bailing out..."
exit 1
}
bail_unknown_compiler()
{
tell "Choose one of the following compiler suites:"
tell " $known_compilers"
bailout
}
deprecated()
{
local old="$1"
shift
tell "Warning: option $old is deprecated, use $@ instead"
}
show_usage()
{
if [ $# -gt 0 ]
then
tell ""
tell "unknown option \"$@\""
tell ""
fi
cat <<__EOT__
Usage: $progname [options]
Installation choices:
--prefix=PREFIX Install to directory root PREFIX
(default: /usr/local)
--with-bindir=DIR Executables installed to DIR
(default: PREFIX/bin)
--with-libdir=DIR Libraries installed to DIR
(default: PREFIX/lib)
--with-includedir=DIR Header files installed to DIR
(default: PREFIX/include)
--with-modulefilesdir=DIR pkg-config file installed to DIR
(default: PREFIX/modulefiles)
Compiler Suite:
--with-compiler=S Use compiler suite "S", from:
$known_compilers
(default: CC from environment, or detect)
Communications Layer:
--with-comms-layer=L Use "L" for communications, e.g. GASNet, ...
(currently just a stub)
Per-layer options:
--with-gasnet-root=G Use the GASNet installed under directory G
--with-gasnet-incdir=H GASNet include files are under directory H
(default: <gasnet-root>/include)
--with-gasnet-bindir=B GASNet launchers are under directory B
(default: <gasnet-root>/bin)
--with-gasnet-conduit=C Use GASNet conduit C
(if only 1 conduit configured, use it)
--with-gasnet-threnv=P Threading environment
(default: par; or: parsync, seq)
(N.B. parsync & seq don't fully
support all of OpenSHMEM)
(These imply --with-comms-layer=... as appropriate)
Optional Support Libraries:
--with-libelf=LE Libelf header and library files under
directory LE (.../include, .../lib)
--with-libelf-incdir=H Libelf header files in directory H
(default: /usr/include)
--with-libelf-libdir=L Libelf library files in directory L
(default: /usr/lib64)
Optional features:
--enable-trace Run-time traces
--disable-trace No run-time traces
(default)
--enable-debug Run-time debugging checks
Will enable tracing at the same time
--disable-debug No run-time debugging checks
(default)
Optional and not-stable-yet:
--enable-experimental Include experimental features of future
OpenSHMEM versions
--disable-experimental No experimental features (default)
--enable-pshmem Build the PSHMEM profiling interface
--disable-pshmem No PSHMEM profiling interface (default)
Informational:
--help Show this summary and exit
--quiet Don't provide progress messages
Environment Variables:
CC C compiler
(default: gcc)
CFLAGS User-supplied options for C compiler
(default: none)
CXX C++ compiler
(default: g++, but not used for build)
CXXFLAGS User-supplied options for C++ compiler
(default: same as CC)
FC Fortran 90 compiler
(default: gfortran, but not used for build)
FFLAGS User-supplied options for Fortran compiler
(default: same as CC)
LD To link the library
(default: same as CC)
LDFLAGS User-supplied options for linker
(default: none)
__EOT__
}
# ------------------------------------------------------------------------------
# split out value from key=value
chompit()
{
echo $@ | cut -d= -f2-
}
# lower/upper case things
downcase()
{
echo $* | tr '[:upper:]' '[:lower:]'
}
upcase()
{
echo $* | tr '[:lower:]' '[:upper:]'
}
# lower case things to remember them canonically
setcanonical()
{
local var=$1
shift
local tmp="`downcase $*`"
eval "$var=\"$tmp\""
}
#
# parse command line
#
for o in $@
do
case $o in
--prefix=*)
prefix="`chompit $o`"
;;
--with-bindir=*)
bindir="`chompit $o`"
;;
--with-libdir=*)
libdir="`chompit $o`"
;;
--with-includedir=*)
incdir="`chompit $o`"
;;
--with-modulefilesdir=*)
modulefilesdir="`chompit $o`"
;;
--with-comms-layer=*)
setcanonical comms_layer "`chompit $o`"
;;
--with-gasnet-root=*)
gasnet_root="`chompit $o`"
setcanonical comms_layer GASNet
;;
--with-gasnet-incdir=*)
gasnet_incdir="`chompit $o`"
setcanonical comms_layer GASNet
;;
--with-gasnet-bindir=*)
gasnet_bindir="`chompit $o`"
setcanonical comms_layer GASNet
;;
--with-gasnet-conduit=*)
gasnet_conduit="`chompit $o`"
setcanonical comms_layer GASNet
;;
--with-gasnet-threnv=*)
gasnet_threnv="`chompit $o`"
setcanonical comms_layer GASNet
;;
--with-compiler=*)
ct="`chompit $o`"
[ -z "$ct" ] && bail_unknown_compiler
setcanonical cc_type "$ct"
;;
--with-compiler)
bail_unknown_compiler
;;
--with-libelf=*)
exe_format=ELF
exe_top_dir="`chompit $o`"
exe_incdir="$exe_top_dir/include"
exe_libdir="$exe_top_dir/lib"
exe_headers="-I$exe_incdir"
# TODO: try to defer to per-compiler section
# exe_libs="-L$exe_libdir -Wl,-rpath,$exe_libdir"
;;
--with-libelf-headers=* | --with-libelf-incdir=*)
exe_format=ELF
exe_incdir="`chompit $o`"
exe_headers="-I$exe_incdir"
;;
--with-libelf-libs=* | --with-libelf-libdir=*)
exe_format=ELF
exe_libdir="`chompit $o`"
# TODO: try to defer to per-compiler section
# exe_libs="-L$exe_lib_dir -Wl,-rpath,$exe_lib_dir"
;;
--enable-debug)
feature_debug=enabled
;;
--disable-debug)
feature_debug=disabled
;;
--enable-trace)
feature_trace=enabled
;;
--disable-trace)
feature_trace=disabled
;;
--enable-pshmem)
feature_pshmem=enabled
;;
--disable-pshmem)
feature_pshmem=disabled
;;
--enable-experimental)
feature_experimental=enabled
;;
--disable-experimental)
feature_experimental=disabled
;;
--help)
show_usage
bailout
;;
--quiet)
show_progress=NO
;;
*)
show_usage $o
bailout
;;
esac
done
# --------------------------------------------------------------------
# debug requires trace
if [ "$feature_debug" = "enabled" ]
then
if [ "$feature_trace" = "disabled" ]
then
tell "Debug requires tracing, enabling..."
feature_trace=enabled
fi
fi
# --------------------------------------------------------------------
# See if we're building directly from the source directory, or in a
# separate build directory. Use this info later to see if we need to
# populate a build area.
if [ "$srctreedir" = "$buildtreedir" ]
then
separate_build=0
else
separate_build=1
fi
# --------------------------------------------------------------------
tell ""
tell "Starting configuration"
tell ""
# -- ELF (TODO: expand for other exe formats) --
tell "Looking for executable format library ... "
exe_format=ELF
case "$exe_format" in
ELF)
gelf_h="$exe_incdir/gelf.h"
if [ ! -r "$gelf_h" ]
then
tell " Can't find header <gelf.h> for $exe_format executable support"
tell " in $exe_incdir"
bailout
fi
elf_lib_so="$exe_libdir/libelf.so"
if [ -r "$elf_lib_so" ]
then
found_libexe="shared"
else
elf_lib_a="$exe_libdir/libelf.a"
if [ -r "$elf_lib_a" ]
then
found_libexe="static"
else
tell " Can't find library -lelf for $exe_format executable support"
tell " in $exe_libdir"
bailout
fi
fi
tell " Found $exe_format support"
;;
*)
tell " I don't know executable format \"$exe_format\""
tell " I should not be here; please report this"
bailout
;;
esac
exe_headers="-I$exe_incdir"
tell " Headers in $exe_incdir"
tell " Libraries in $exe_libdir"
tell "Looking for executable format library ... done"
tell ""
# -- make sure we can find compilers --
tell "Searching for compilers ..."
# if not told by user, work out which compiler
if [ -z "$cc_type" ]
then
told_compiler=0
# -- either gnu (guess) or from environment --
cc_cmd="${CC-gcc}"
which $cc_cmd >/dev/null 2>&1
if [ $? -ne 0 ]
then
tell " I couldn't find the C compiler \"$cc_cmd\""
bailout
fi
# try to work out the compiler family by querying the C command
cc_ver="`$cc_cmd -V 2>&1`"
if [ $? -ne 0 ]
then
cc_ver="`$cc_cmd --version 2>&1`"
fi
case "$cc_ver" in
*"Free Software Foundation"*)
cc_type="gnu"
;;
*"Intel Corporation"*)
cc_type="intel"
;;
*"The Portland Group"*)
cc_type="pgi"
;;
*"Sun C"*)
cc_type="oracle"
;;
*OpenUH*)
cc_type="openuh"
;;
*Open64*)
cc_type="open64"
;;
*clang*)
cc_type="clang"
;;
*"IBM XL C/C++"*)
cc_type="ibmxl"
;;
*)
cc_type="UNKNOWN"
;;
esac
else
told_compiler=1
fi
# 2013-04-23,tonyc: TODO I know some of the exe_libs flags below may
# be wrong for specific compilers
#
# Might be nicer with bash arrays, but coding down to sh
case "$cc_type" in
"gnu")
c99_flags="-std=c99"
warn_flags="-Wall"
# pic_flags="-fPIC"
thread_flags="-pthread"
so_flags="-shared"
exe_libs="-L$exe_libdir"
if [ "$found_libexe" = "shared" ]
then
exe_libs="$exe_libs -Wl,-rpath,$exe_libdir"
fi
cc_cmd="gcc"
fc_cmd="gfortran"
cxx_cmd="g++"
ld_cmd="$cc_cmd"
;;
"intel")
c99_flags="-std=c99"
warn_flags="" # enabled by default
# pic_flags="-fPIC"
thread_flags="-pthread"
so_flags="-shared"
exe_libs="-L$exe_libdir"
if [ "$found_libexe" = "shared" ]
then
exe_libs="$exe_libs -Wl,-rpath,$exe_libdir"
fi
cc_cmd="icc"
fc_cmd="ifort"
cxx_cmd="icpc"
ld_cmd="$cc_cmd"
;;
"pgi")
c99_flags="-c99"
warn_flags="" # enabled by default
# pic_flags="-fPIC"
thread_flags=""
so_flags="-shared"
exe_libs="-L$exe_libdir"
if [ "$found_libexe" = "shared" ]
then
exe_libs="$exe_libs -Wl,-rpath,$exe_libdir"
fi
cc_cmd="pgcc"
fc_cmd="pgfortran"
cxx_cmd="pgCC"
ld_cmd="$cc_cmd"
;;
"oracle")
c99_flags="-xc99"
warn_flags="" # enabled by default
# pic_flags="-PIC"
thread_flags="-pthread"
so_flags="-shared"
exe_libs="-L$exe_libdir"
if [ "$found_libexe" = "shared" ]
then
exe_libs="$exe_libs -Wl,-rpath,$exe_libdir"
fi
cc_cmd="suncc"
fc_cmd="sunf90"
cxx_cmd="sunCC"
ld_cmd="$cc_cmd"
;;
"openuh")
c99_flags="-std=c99"
warn_flags="-Wall"
# pic_flags="-fPIC"
thread_flags="-pthread"
so_flags="-shared"
exe_libs="-L$exe_libdir"
if [ "$found_libexe" = "shared" ]
then
exe_libs="$exe_libs -Wl,-rpath,$exe_libdir"
fi
cc_cmd="uhcc"
fc_cmd="uhf90"
cxx_cmd="uhCC"
ld_cmd="$cc_cmd"
;;
"open64")
c99_flags="-std=c99"
warn_flags="-Wall"
# pic_flags="-fPIC"
thread_flags="-pthread"
so_flags="-shared"
exe_libs="-L$exe_libdir"
if [ "$found_libexe" = "shared" ]
then
exe_libs="$exe_libs -Wl,-rpath,$exe_libdir"
fi
cc_cmd="opencc"
fc_cmd="openf90"
cxx_cmd="openCC"
ld_cmd="$cc_cmd"
;;
"clang")
c99_flags="-std=c99"
warn_flags="-Wall"
# pic_flags="-fPIC"
thread_flags="-pthread"
so_flags="-shared"
exe_libs="-L$exe_libdir"
if [ "$found_libexe" = "shared" ]
then
exe_libs="$exe_libs -Wl,-rpath,$exe_libdir"
fi
cc_cmd="clang"
fc_cmd="false"
cxx_cmd="clang++"
ld_cmd="$cc_cmd"
;;
"ibmxl")
c99_flags="-qlanglvl=stdc99"
warn_flags=""
# pic_flags="-qpic"
thread_flags="-qthreaded"
exe_libs="-L$exe_libdir"
if [ "$found_libexe" = "shared" ]
then
exe_libs="$exe_libs -Wl,-rpath,$exe_libdir"
fi
so_flags="-G"
cc_cmd="xlc"
fc_cmd="xlf"
cxx_cmd="xlc++"
# TODO: not sure if DCMF works with 64-bit
# c_flags="$c_flags -q64"
# fc_flags="$fc_flags -q64"
# cxx_flags="$cxx_flags -q64"
# ld_flags="$ld_flags -q64"
;;
*)
tell " Unknown compiler suite \"$cc_type\""
bailout
# c99_flags=""
# warn_flags=""
# pic_flags=""
# thread_flags=""
# so_flags=""
# exe_headers=""
# exe_libs=""
# fc_cmd="false"
# cxx_cmd="false"
# ld_cmd="false" # what else to do?
;;
esac
# -- allow user to override from environment --
if [ x"$CC" != x ]
then
cc_cmd="$CC"
pass_CC="$CC"
else
cc_cmd="$cc_cmd"
fi
if [ x"$CPPFLAGS" != x ]
then
cpp_flags="$CPPFLAGS"
pass_CPPFLAGS="$CPPFLAGS"
else
cpp_flags="$cpp_flags"
fi
if [ x"$CFLAGS" != x ]
then
c_flags="$CFLAGS"
pass_CFLAGS="$CFLAGS"
else
c_flags="$c_flags"
fi
if [ x"$CXX" != x ]
then
cxx_cmd="$CXX"
pass_CXX="$CXX"
else
cxx_cmd="$cxx_cmd"
fi
if [ x"$CXXFLAGS" != x ]
then
cxx_flags="$CXXFLAGS"
pass_CXXFLAGS="$CXXFLAGS"
else
cxx_flags="$cxx_flags"
fi
if [ x"$FC" != x ]
then
fc_cmd="$FC"
pass_FC="$FC"
else
fc_cmd="$fc_cmd"
fi
if [ x"$FCFLAGS" != x ]
then
fc_flags="$FCFLAGS"
pass_FCFLAGS="$FCFLAGS"
else
fc_flags="$fc_flags"
fi
if [ x"$LD" != x ]
then
ld_cmd="$LD"
pass_LD="$LD"
else
ld_cmd="$ld_cmd"
fi
if [ x"$LDFLAGS" != x ]
then
ld_flags="$LDFLAGS"
pass_LDFLAGS="$LDFLAGS"
else
ld_flags="$ld_flags"
fi
tell " Compiler suite set to $cc_type"
# TODO: we're not actually using these during build, so don't really check
#
# which $cxx_cmd >/dev/null 2>&1
# if [ $? -ne 0 ]
# then
# tell "I couldn't find the C++ compiler \"$cxx_cmd\""
# bailout
# fi
#
# which $fc_cmd >/dev/null 2>&1
# if [ $? -ne 0 ]
# then
# tell "I couldn't find the Fortran compiler \"$fc_cmd\""
# bailout
# fi
tell "Searching for compilers ... done"
tell ""
# -- Comms. detection --
tell "Looking for communication layer ... "
bail_gasnet()
{
tell ""
tell "GASNet problem:"
tell ""
tell " I can't find a GASNet installation:"
tell " $@"
tell ""
tell " Specify GASNet location with"
tell ""
tell " --with-gasnet-root=DIR"
tell ""
tell " or indicate where separate GASNet components are installed with"
tell ""
tell " --with-gasnet-incdir=DIR (headers)"
tell " --with-gasnet-bindir=DIR (launchers)"
bailout
}
case "$comms_layer" in
gasnet)
if [ -z "$gasnet_bindir" ]
then
if [ -z "$gasnet_root" ]
then
bail_gasnet "No GASNet installation found"
fi
gasnet_bindir="$gasnet_root/bin"
fi
if [ ! -d "$gasnet_bindir" ]
then
bail_gasnet "No directory $gasnet_bindir found"
fi
if [ -z "$gasnet_incdir" ]
then
if [ -z "$gasnet_root" ]
then
bail_gasnet "No GASNet installation found"
fi
gasnet_incdir="$gasnet_root/include"
fi
if [ ! -d "$gasnet_incdir" ]
then
bail_gasnet "No directory $gasnet_incdir found"
fi
tell " Checking for GASNet configuration under"
tell " $gasnet_incdir"
gasnet_h="gasnet_config.h"
gasnet_path_h="$gasnet_incdir/$gasnet_h"
if [ ! -r "$gasnet_path_h" ]
then
basil_gasnet "Can't find header file $gasnet_path_h"
fi
# check GASNet version
find_ver_macro()
{
local var=$1
local file=$2
local cmd="awk '/GASNET_RELEASE_VERSION_$var/ {print \$3}' $file"
eval $cmd
}
gasnet_ver_maj="`find_ver_macro MAJOR $gasnet_path_h`"
gasnet_ver_min="`find_ver_macro MINOR $gasnet_path_h`"
gasnet_ver_pch="`find_ver_macro PATCH $gasnet_path_h`"
if [ -z "$gasnet_ver_maj" -o -z $"gasnet_ver_min" -o -z "$gasnet_ver_pch" ]
then
tell ""
tell " Couldn't discover full GASNet version in $gasnet_root"
tell " (should be major.minor.patch)"
bailout
fi
gasnet_ver="$gasnet_ver_maj.$gasnet_ver_min.$gasnet_ver_pch"
tell " Found version $gasnet_ver"
gasnet_version_numeric()
{
local v
(( v=($1 << 16) | ($2 << 8) | $3 ))
echo $v
}
# make sure gasnet new enough for node locality query
gasnet_maj_atleast=1
gasnet_min_atleast=18
gasnet_pch_atleast=0
minval=`gasnet_version_numeric $gasnet_maj_atleast $gasnet_min_atleast $gasnet_pch_atleast`
thisval=`gasnet_version_numeric $gasnet_ver_maj $gasnet_ver_min $gasnet_ver_pch`
if [ $thisval -lt $minval ]
then
tell ""
tell " GASNet $gasnet_ver is too old"
tell " We require version $gasnet_maj_atleast.$gasnet_min_atleast.$gasnet_pch_atleast or newer"
bailout
fi
case "$gasnet_threnv" in
par | parsync | seq )
;;
*)
tell " Unknown GASNet threading environment \"$gasnet_threnv\""
tell " Must be one of par (default), parsync, seq"
bailout
;;
esac
tell " Use threading environment \"$gasnet_threnv\""
#
# see if we can autodetect which conduit to use. if not, offer
# all installed under the gasnet directory
#
KNOWN_CONDUITS="`( cd $gasnet_incdir; echo *-conduit |
sed -e 's/-conduit//g' )`"
if [ "$KNOWN_CONDUITS" = '*' ]
then
bail_gasnet "no conduits found"
fi
tell " Found conduits: $KNOWN_CONDUITS"
cdt_auto=""
#
# if no conduit asked for on command-line, see if we can
# auto-detect
#
if [ -z "$gasnet_conduit" ]
then
kc=`echo $KNOWN_CONDUITS | wc -w`
if [ $kc -eq 0 ]
then
tell " I couldn't find any GASNet conduits under $gasnet_root"
bailout
fi
if [ $kc -eq 1 ]
then
# only one there, just use it
gasnet_conduit="$KNOWN_CONDUITS"
cdt_auto="(auto-detected)"
tell ""
tell " Only conduit \"$gasnet_conduit\" is configured, selecting it."
tell ""
else
# multiple configured, let the user decide
tell " I found the following conduits: \"$KNOWN_CONDUITS\""
tell " Indicate which one to use via --with-gasnet-conduit=NAME"
bailout
fi
fi
# -- ok, we have a candidate conduit --
gasnet_core_h="gasnet_core.h"
gasnet_cdt_dir="$gasnet_incdir/${gasnet_conduit}-conduit"
gasnet_path_core_h="$gasnet_cdt_dir/$gasnet_core_h"
if [ ! -r "$gasnet_path_core_h" ]
then
tell " The $gasnet_cdt_dir directory doesn't look like a configured conduit"
tell " (no $core_h header file)"
bailout
fi
tell " Chosen conduit \"$gasnet_conduit\" looks OK"
;; # end of gasnet section
*)
tell " I don't know what to do with communications layer \"$comms_layer\""
bailout
;;
esac
tell "Looking for communication layer ... done"
tell ""
# -- fill in install locations if not known yet --
[ -z "$bindir" ] && bindir=$prefix/bin
[ -z "$libdir" ] && libdir=$prefix/lib
[ -z "$incdir" ] && incdir=$prefix/include
[ -z "$modulefilesdir" ] && modulefilesdir=$prefix/modulefiles
# directories in which to compile things
build_me_dirs="
doc
src
"
# files at source root that are templates
top_levels="
./Makefile.in
./openshmem.module.in
"
if [ $separate_build = 1 ]
then
# -- create build directory tree --
# from the source tree, pull in doc, src, and top-level input files
tell "Populating build directory tree ... "
for d in $build_me_dirs $top_levels
do
find $srctreedir/$d \! -type d -print |
while read f
do
# tell "Found source file $f"
treepart="`dirname -- $f`"
treepart="`echo $treepart | sed -e "s%^$srctreedir/%%"`"
[ -z "$treepart" ] && treepart="."
mkdir -p $treepart
(
cd $treepart
thispart="`basename -- $f`"
rm -f $thispart
ln -s $f
)
done
done
tell "Populating build directory tree ... done"
tell ""
fi