-
Notifications
You must be signed in to change notification settings - Fork 204
/
Copy pathconfigure
executable file
·946 lines (840 loc) · 24.7 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
#!/bin/bash
# configure script for Trick
# type configure --help for usage
# $Id: configure 3785 2015-01-26 14:12:13Z alin $
ver_out=""
ver_min=""
ver_url=""
prefix=/usr/local
cc=/usr/bin/cc
cxx=/usr/bin/c++
ld=/usr/bin/c++
llvm=""
llvm_min_ver=3.1
llvm_config="llvm-config"
python=/usr/bin/python
javac=javac
perl=/usr/bin/perl
flex=/usr/bin/flex
flex_min_ver=2.5.33
bison=/usr/bin/bison
bfd=""
bfd_min_ver=2.20
libxml=""
swig=""
swig_min_ver=1.3.29
gtest=""
motif=""
hdf5=""
dmtcp=""
dmtcp_min_ver=1.2.4
tprocte=""
bc635=""
java_min_ver=1.6.0
no_create=0
dev=0
help=0
lsb_release=/usr/bin/lsb_release
# Get the path this script is running
abspath=$(cd ${0%/*} 2>&1 /dev/null && echo $PWD/${0##*/})
TRICK_HOME=`dirname "$abspath"`
TRICK_HOST_TYPE=`uname -s`
###################### Beginning of Internal Functions #########################
function check_cc_version() {
ver=`$cc -dumpversion 2>&1 /dev/null`
maj_ver=`echo "$ver"| perl -ne 'if (/(\d+)\.(\d+)/) {print $1;} ;'`
min_ver=`echo "$ver"| perl -ne 'if (/(\d+)\.(\d+)/) {print $2;} ;'`
if [ $maj_ver == 4 -a $min_ver == 1 ] ; then
echo "Warning: Trick will work with GCC 4.1.x but will display errors during compiliation."
echo " Consider updating GCC"
return 0
else
return 0
fi
return 0
}
################################################################################
function check_flex_version() {
ver=`$flex --version 2>&1 /dev/null`
ver=`echo "$ver"|sed -n '/[0-9]\.[0-9]*$/p'`
ver_out=`echo "$ver"|sed 's/[_a-zA-Z\/ ]//g'`
ver_min=$flex_min_ver
if echo $ver_out $ver_min | sed 's/[.a-z]/ /g' | awk -F " " \
'{ if (($1 < $4) || \
($1 == $4 && $2 < $5) || \
($1 == $4 && $2 == $5 && $3 < $6)) \
exit 0; else exit 1;}'
then
ver_url="(http://flex.sourceforge.net)"
return 1
fi
return 0
}
################################################################################
function check_swig_version() {
ver=`$test_ver_prog -version 2>&1 /dev/null`
ver=`echo "$ver"|sed -n '/[0-9]\.[0-9]*$/p'`
ver_out=`echo "$ver"|sed 's/SWIG Version //g'`
ver_min=$swig_min_ver
if echo $ver_out $ver_min | sed 's/[.a-z]/ /g' | awk -F " " \
'{ if (($1 < $4) || \
($1 == $4 && $2 < $5) || \
($1 == $4 && $2 == $5 && $3 < $6)) \
exit 0; else exit 1;}'
then
ver_url="(http://swig.sourceforge.net)"
return 1
fi
return 0
}
################################################################################
function check_java_version() {
ver=`java -version 2>&1 /dev/null`
ver=`echo "$ver"|sed -n '/[0-9]\.[0-9_"]*$/p'`
ver=`echo "$ver"|sed 's/java version \"//g'`
ver_out=`echo "$ver"|sed 's/[_a-zA-Z].*//g'`
ver_min=$java_min_ver
if echo $ver_out $ver_min | sed 's/[.a-z]/ /g' | awk -F " " \
'{ if (($1 < $4) || \
($1 == $4 && $2 < $5) || \
($1 == $4 && $2 == $5 && $3 < $6)) \
exit 0; else exit 1;}'
then
ver_url="(http://www.java.com/en)"
return 1
fi
return 0
}
################################################################################
function check_dmtcp_version() {
ver=`${dmtcp}/bin/dmtcp_checkpoint --version 2>&1`
ver=`echo "$ver"|sed -n '/[0-9]\.[0-9_"]*$/p'`
ver_out=`echo "$ver"|sed 's/[_a-zA-Z\()+/ ]//g'`
ver_min=$dmtcp_min_ver
if echo $ver_out $ver_min | sed 's/[.a-z]/ /g' | awk -F " " \
'{ if (($1 < $4) || \
($1 == $4 && $2 < $5) || \
($1 == $4 && $2 == $5 && $3 < $6)) \
exit 0; else exit 1;}'
then
ver_url="(http://dmtcp.sourceforge.net)"
return 1
fi
return 0
}
################################################################################
function check_bfd_version() {
ver=`${bfd}/bin/objdump --version | perl -n -e 'if (/(\d+\.\d+)/) { print $1; }'`
ver_min=$bfd_min_ver
if echo $ver $ver_min | sed 's/[.a-z]/ /g' | awk -F " " \
'{ if (($1 < $3) || \
($1 == $3 && $2 < $4)) \
exit 0; else exit 1;}'
then
ver_url="(http://www.gun.org/software/binutils)"
return 1
fi
return 0
}
################################################################################
function check_llvm_version() {
ver=`$test_ver_prog --version 2>&1 /dev/null`
ver=`echo "$ver"|sed -n '/[0-9]\.[0-9]*$/p'`
ver_out=`echo "$ver"|sed 's/[_a-zA-Z].*//g'`
ver_min=$llvm_min_ver
if echo $ver_out $ver_min | sed 's/[.a-z]/ /g' | awk -F " " \
'{ if (($1 < $3) || \
($1 == $3 && $2 < $4)) \
exit 0; else exit 1;}'
then
ver_url="(http://www.llvm.org)"
return 1
fi
return 0
}
################################################################################
function check_avail() {
for d in ${dir[*]}
do
if test -e "$d/$prog"
then
if test -n "$ver_check"
then
test_ver_prog="$d/$prog"
$ver_check
if test $? -eq 0
then
return_dir=$d
return 0
fi
else
return 0
fi
fi
done
return 1
}
################################################################################
function check_exists() {
echo -n "checking for $1 $2... "
if [ -e "$2" ] ; then
echo "yes"
return 0
fi
echo "no"
error_exit
}
################################################################################
function search_exists() {
for d in ${dir[*]}
do
if [ -e "$d/$1" ] ; then
return_dir=$d
return 0
fi
done
return 1
}
################################################################################
function error_exit() {
# STDERR warning
echo "[33m" >&2
if [ "$ver_url" != "" ] ; then
echo "version $ver_min or later is required." >&2
echo "info @ $ver_url" >&2
fi
#echo "Enter \"$0 --help\" for more options." >&2
#echo "[00m" >&2
echo "[31mConfigure failed[0m"
exit 1
}
###################### End of Internal Functions ###############################
# Loop through all args. Copied from autoconfig scripts
for arg
do
# If the previous option needs an argument, assign it.
if test -n "$prev"; then
eval "$prev=\$arg"
prev=
continue
fi
optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
case $arg in
--bc635)
prev=bc635 ;;
--bc635=*)
bc635=$optarg ;;
--bfd)
prev=bfd ;;
--bfd=*)
bfd=$optarg ;;
--bison | --yacc)
prev=bison ;;
--bison=* | --yacc=*)
bison=$optarg ;;
--cc)
prev=cc ;;
--cc=*)
cc=$optarg ;;
--cxx)
prev=cxx ;;
--cxx=*)
cxx=$optarg ;;
--dmtcp)
prev=dmtcp ;;
--dmtcp=*)
dmtcp=$optarg ;;
--flex | --lex)
prev=flex ;;
--flex=* | --lex=*)
flex=$optarg ;;
--gsl)
prev=gsl ;;
--gsl=*)
gsl=$optarg ;;
--gtest)
prev=gtest ;;
--gtest=*)
gtest=$optarg ;;
--hdf5)
prev=hdf5 ;;
--hdf5=*)
hdf5=$optarg ;;
--javac)
prev=javac ;;
--javac=*)
javac=$optarg ;;
--ld)
prev=ld ;;
--ld=*)
ld=$optarg ;;
--llvm)
prev=llvm ;;
--llvm=*)
llvm=$optarg ;;
--llvm-config)
prev=llvm_config ;;
--llvm-config=*)
llvm_config=$optarg ;;
--motif)
prev=motif ;;
--motif=*)
motif=$optarg ;;
--perl)
prev=perl ;;
--perl=*)
perl=$optarg ;;
--prefix)
prev=prefix ;;
--prefix=*)
prefix=$optarg ;;
--python)
prev=python ;;
--python=*)
python=$optarg ;;
--no_create)
no_create=1 ;;
--swig)
prev=swig ;;
--swig=*)
swig=$optarg ;;
--std=*)
std=$optarg ;;
--tprocte)
prev=tprocte ;;
--tprocte=*)
tprocte=$optarg ;;
--dev)
dev=1 ;;
--help | -help | -h)
help=1 ;;
*)
echo $1: unknown argument
help=1 ;;
esac
done
# If help requested, print it, otherwise write out config to config.mk
if [ $help -eq 1 ] ; then
cat <<EOF
'`basename $0`' configures Trick and verifies prerequisites are installed.
Usage: $0 [OPTION]...
Defaults for each option are specified in brackets. If a default path fails,
try setting the option equal to "" and `basename $0` will attempt to find a path,
or provide desired path.
Configuration:
[1m--bfd[0m=/path/to/bfd.h Specify the Binary File Descriptor's header
file directory. The BFD library is part of the
binutils-dev package installation.
This is a Linux only flag.
[$bfd]
[1m--cc[0m=/path/to/cc Specify an alternative C compiler
[$cc]
[1m--cxx[0m=/path/to/c++ Specify an alternative C++ compiler
[$cxx]
[1m--dmtcp[0m=/root/of/dmtcp Specify a root location for Distributed Multi-
Threaded CheckPointing include files and libs
[$dmtcp]
[1m--fermi-ware[0m=/path/to/fermi-ware Specify the fermi-ware directory
[$gsl]
[1m--gsl[0m=/path/to/gsl_home Specify the GNU Scientific Library home
directory
[$gsl]
[1m--hdf5[0m=/root/of/hdf5 Specify a root location for Hierarchical Data
Format include files and libs
[$hdf5]
[1m--javac[0m=/path/to/javac Specify an alternative javac compiler to use
[$javac]
[1m--ld[0m=/path/to/ld Specify an alternative linker.
[$ld]
[1m--libxml[0m=/path/to/libxml Specify the library directory that contains
libxml2.a
[$libxml]
[1m--llvm[0m=/path/to/llvm_root Specify the LLVM root directory
[$llvm]
[1m--llvm-config[0m=exe_name Specify the llvm-config executable name
[$llvm_config]
[1m--motif[0m=/path/to/motif_home Specify the Motif home directory.
[$motif]
[1m--perl[0m=/path/to/perl Specify an alternative Perl program to use
[$perl]
[1m--python[0m=/path/to/python Specify an alternative Python interpreter to use
[$python]
[1m--swig[0m=/path/to/swig Specify an alternative SWIG program to use
[$swig]
[1m--std[0m=compilerFlag Specify which version of -std=c++0x or -std=c++11 compile flag
[$std]
[1m--help, -h[0m Display this help and exit
Optional External Clock directories:
[1m--bc635[0m=/root/of/bc635 Specify a root location for BC635 driver
directory
[$bc635]
[1m--tprocte[0m=/root/of/tprocte Specify a root location for TPRO CTE headers
[$tprocte]
Trick Developer options:
[1m--dev[0m Check for developer prerequisites. Defaults on
if svn repository detected.
[1m--bison[0m=/path/to/bison Specify an alternative GNU Bison program to use
[$bison]
[1m--flex[0m=/path/to/flex Specify an alternative Flex program to use
[$flex]
[1m--gtest[0m=/root/of/gtest Specify a root location for Google Test
include files and libs (internal Trick use)
[$gtest]
Report bugs to <[email protected]>.
EOF
exit
fi
hostname=`hostname -s`
if [ $no_create == 0 ] ; then
cat > ${TRICK_HOME}/config.status.${hostname} << EOF
#!/bin/bash
# Generated by configure.
# Run this script to call configure with same arguments as the previous run
# The "--no_create" argument tells the configure script not to overwrite this file.
echo "./configure $*"
./configure $* --no_create
EOF
chmod +x config.status.${hostname}
fi
if [ $TRICK_HOST_TYPE = "Darwin" ] ; then
echo -n "checking for Xcode... "
if [ -e "/usr/bin/xcode-select" ] ; then
xcode_dir=`/usr/bin/xcode-select -print-path`
if [ -e "$xcode_dir" ] ; then
echo "yes"
else
echo "[33mA problem was detected in the Xcode installation.[00m"
error_exit
fi
else
echo "[33mPlease install Xcode. Xcode is a free download in the Apple App store.[00m"
error_exit
fi
fi
# These list of directories include the default locations for fink (/sw) and Macports (/opt/local).
std_dir=("/usr" "/usr/local" "/sw" "/opt/local")
std_lib_dir=("/usr/lib" "/usr/lib64" "/usr/lib/i386-linux-gnu" "/usr/lib/x86_64-linux-gnu" "/usr/local/lib" "/sw/lib" "/opt/local/lib" "/usr/lib/arm-linux-gnueabihf")
if [ "$cc" != "" ] ; then
check_exists "C compiler" $cc
else
dir=${std_dir[*]}
echo -n "checking for C compiler... "
prog="bin/cc"
search_exists $prog ${dir[*]}
if [ $? -eq 0 ] ; then
cc=$return_dir/$prog
echo "$cc"
else
echo "no"
error_exit
fi
fi
check_cc_version
if [ "$cxx" != "" ] ; then
check_exists "C++ compiler" $cxx
else
dir=${std_dir[*]}
echo -n "checking for C++ compiler... "
prog="bin/c++"
search_exists $prog ${dir[*]}
if [ $? -eq 0 ] ; then
cxx=$return_dir/$prog
echo "$cxx"
else
echo "no"
error_exit
fi
fi
if [ "$ld" != "" ] ; then
check_exists "Linker" $ld
else
dir=${std_dir[*]}
echo -n "checking for Linker... "
prog="bin/c++"
search_exists $prog ${dir[*]}
if [ $? -eq 0 ] ; then
ld=$return_dir/$prog
echo "$ld"
else
echo "no"
error_exit
fi
fi
if [ "$perl" != "" ] ; then
check_exists "Perl program" $perl
else
dir=${std_dir[*]}
echo -n "checking for Perl program... "
prog="bin/perl"
search_exists $prog ${dir[*]}
if [ $? -eq 0 ] ; then
perl=$return_dir/$prog
echo "$perl"
else
echo "no"
error_exit
fi
fi
if [ "$python" != "" ] ; then
check_exists "Python interpreter" $python
else
dir=${std_dir[*]}
echo -n "checking for Python interpreter... "
prog="bin/python"
search_exists $prog ${dir[*]}
if [ $? -eq 0 ] ; then
python=$return_dir/$prog
echo "$python"
else
echo "no"
error_exit
fi
fi
if [ "$swig" != "" ] ; then
check_exists "SWIG program" $swig
if [ $? -eq 0 ] ; then
echo -n "checking for SWIG version >= $swig_min_ver... "
check_swig_version
if [ $? -eq 0 ] ; then
echo "yes"
else
echo "no"
error_exit
fi
else
echo "no"
error_exit
fi
else
echo -n "checking for SWIG version >= $swig_min_ver... "
dir=${std_dir[*]}
prog="bin/swig"
ver_check="check_swig_version"
check_avail $prog ${dir[*]}
if [ $? -eq 0 ] ; then
swig=$return_dir/$prog
echo "yes"
else
echo "no"
error_exit
fi
fi
if [ "$libxml" != "" ] ; then
check_exists "Libxml directory" "$libxml/libxml2.a"
else
dir=${std_lib_dir[*]}
echo -n "checking for XML library home... "
search_exists "libxml2.a"
if [ $? -eq 1 ] ; then
search_exists "libxml2.so"
if [ $? -eq 1 ] ; then
search_exists "libxml2.dylib"
fi
fi
if [ $? -eq 0 ] ; then
libxml=$return_dir
echo "$libxml"
if [ $libxml == "/usr/lib" -o "$libxml" == "/usr/lib64" ] ; then
libxml="-lxml2"
else
libxml="-L$return_dir -lxml2"
fi
else
echo " [33mPlease install XML library using your OS distribution package manager.[00m"
error_exit
fi
fi
if [ "$motif" != "" ] ; then
dir=$motif
echo -n "checking for Openmotif devel home $motif/include/Xm... "
search_exists "include/Xm"
if [ $? -eq 0 ] ; then
echo "yes"
else
echo "no"
error_exit
fi
else
dir=${std_dir[*]}
echo -n "checking for Openmotif devel home... "
search_exists "include/Xm"
if [ $? -eq 0 ] ; then
motif=$return_dir
echo "$motif/include/Xm"
else
echo "no"
error_exit
fi
fi
echo -n "checking for Java version >= $java_min_ver... "
check_java_version
if [ $? -eq 0 ] ; then
echo "yes"
else
echo " [33mPlease install JRE using your OS distribution package manager.[00m"
fi
if [ "$bfd" != "" ] ; then
dir=$bfd
echo -n "checking for binutils-devel $bfd/include/bfd.h... "
search_exists "include/bfd.h"
if [ $? -eq 0 ] ; then
check_bfd_version
if [ $? -eq 0 ] ; then
echo "yes"
else
echo "no"
error_exit
fi
else
#don't exit if missing
echo "not available"
fi
fi
# OPTIONAL PACKAGES.
if [ "$dmtcp" != "" ] ; then
check_exists "DMTCP dmtcpaware dir" "$dmtcp/dmtcpaware"
echo -n "checking for DMTCP version >= $dmtcp_min_ver... "
check_dmtcp_version
if [ $? -eq 0 ] ; then
echo "yes"
else
echo " [33mPlease update DMTCP package.[00m"
error_exit
fi
fi
if [ "$gsl" != "" ] ; then
check_exists "GNU Scientific Library include directory" "$gsl/include/gsl"
fi
if [ "$hdf5" != "" ] ; then
check_exists "HDF5 include files" "$hdf5/include/hdf5.h"
fi
if [ "$tprocte" != "" ] ; then
check_exists "TPRO-CTE include files" "$tprocte/h/tpro.h"
fi
if [ "$bc635" != "" ] ; then
check_exists "BC635 include files" "$bc635/sample/bcuser.h"
fi
# If this TRICK_HOME is from our repository.
if [ -e "$TRICK_HOME/.git" -o $dev == 1 ] ; then
echo "Trick development repository detected. Additional developer configuration continuing"
# go ahead and set dev to 1.
dev=1
if [ "$llvm" != "" ] ; then
check_exists "$llvm_config" "$llvm/bin/$llvm_config"
if [ $? -eq 0 ] ; then
echo -n "checking for $llvm_config version >= $llvm_min_ver... "
check_llvm_version
if [ $? -eq 0 ] ; then
echo "yes"
else
echo "no"
error_exit
fi
else
echo "no"
error_exit
fi
else
echo -n "checking for $llvm_config version >= $llvm_min_ver... "
dir=${std_dir[*]}
prog="bin/$llvm_config"
ver_check="check_llvm_version"
check_avail $prog ${dir[*]}
if [ $? -eq 0 ] ; then
llvm=$return_dir
echo "$llvm/bin/$llvm_config"
else
echo "no"
error_exit
fi
fi
check_exists "clang compiler" `$llvm/bin/$llvm_config --bindir`/clang
check_exists "clang header files" `$llvm/bin/$llvm_config --includedir`/clang
check_exists "clang library" `$llvm/bin/$llvm_config --libdir`/libclang.a
if [ "$gtest" != "" ] ; then
check_exists "Google Test" "$gtest/include/gtest"
else
dir=${std_dir[*]}
echo -n "checking for Google Test... "
search_exists "include/gtest"
if [ $? -eq 0 ] ; then
gtest=$return_dir
echo "$gtest/include/gtest"
else
echo "no"
echo "[33mWarning: Please install the Google Test package[00m"
fi
fi
if [ "$flex" != "" ] ; then
check_exists "Flex program" $flex
if [ $? -eq 0 ] ; then
echo -n "checking for Flex version >= $flex_min_ver... "
check_flex_version
if [ $? -eq 0 ] ; then
echo "yes"
else
echo "no"
error_exit
fi
else
echo "no"
error_exit
fi
else
echo -n "checking for Flex version >= $flex_min_ver... "
dir=${std_dir[*]}
prog="bin/flex"
ver_check="check_flex_version"
check_avail $prog ${dir[*]}
if [ $? -eq 0 ] ; then
flex=$return_dir/$prog
echo "yes"
else
echo "no"
error_exit
fi
fi
if [ "$bison" != "" ] ; then
check_exists "GNU Bison program" $bison
else
dir=${std_dir[*]}
echo -n "checking for GNU Bison program... "
prog="bin/bison"
search_exists $prog ${dir[*]}
if [ $? -eq 0 ] ; then
bison=$return_dir/$prog
echo "$bison"
else
echo "no"
error_exit
fi
fi
fi
echo "# This file was autogenerated on" `date +"%B %d, %G."` > ${TRICK_HOME}/config_${TRICK_HOST_TYPE}.mk #Overwrite file
# sed/awk in a different location in Linux and MacOSX.
if test $TRICK_HOST_TYPE = "Linux"
then
sed="/bin/sed"
awk="/bin/awk"
elif test $TRICK_HOST_TYPE = "Darwin"
then
sed="/usr/bin/sed"
awk="/usr/bin/awk"
else
sed="/bin/sed"
awk="/bin/awk"
fi
cat >> ${TRICK_HOME}/config_${TRICK_HOST_TYPE}.mk << EOF
SHELL := /bin/sh
AWK := $awk
SED := $sed
CD := cd
MV := /bin/mv
RM := /bin/rm
CP := /bin/cp
PWD = \$(shell /bin/pwd)
CC = $cc
CXX = $cxx
LD = $ld
PERL = $perl
LEX = $flex
YACC = $bison
SWIG = $swig
PYTHON = $python
JAVAC = $javac
LLVM_HOME = $llvm
LLVM_CONFIG = $llvm_config
DEVELOPER = $dev
HDF5 = $hdf5
DMTCP = $dmtcp
TPROCTE = $tprocte
BC635 = $bc635
GSL_HOME = $gsl
GTEST_HOME = $gtest
LIBXML = $libxml
MOTIF_HOME = $motif
# experimental, default to 0
HAVE_ZEROCONF = 0
PREFIX = $prefix
CONFIG_MK = 1
TRICK_RANLIB =
PYTHON_VERSION := \$(shell \$(PYTHON) -V 2>&1 | \$(SED) -e 's/Python //' -e 's/\([0-9]\.[0-9]*\).*/\1/')
HAVE_PYTHON_CONFIG := \$(shell test -e \${PYTHON}-config && echo "1")
ifeq (\$(HAVE_PYTHON_CONFIG),1)
# Get python-config ver
FIRSTLINE := \$(shell head -n 1 \${PYTHON}-config | \$(SED) -e 's/\#\\!//')
# In python 2.7+ python-config changed to a shell script
ifneq (\$(FIRSTLINE),/bin/sh)
PYCONFIG_VER := \$(shell \$(FIRSTLINE) -V 2>&1 | \$(SED) -e 's/Python //' -e 's/\([0-9]\.[0-9]*\).*/\1/')
# if there is a python/python-config version mismatch, don't use the config
ifneq (\$(PYTHON_VERSION),\$(PYCONFIG_VER))
HAVE_PYTHON_CONFIG = 0
endif
endif
# if running python-config produces a Traceback error, don't use the config
PYCONFIG_ERR := \$(shell test -n "\`\${PYTHON}-config --include 2>&1 /dev/null | grep Traceback\`" && echo "1")
ifeq (\$(PYCONFIG_ERR),1)
HAVE_PYTHON_CONFIG = 0
endif
endif
ifeq (\$(HAVE_PYTHON_CONFIG),1)
PYTHON_INCLUDES := \$(shell \${PYTHON}-config --includes)
PYTHON_LIB := \$(shell \${PYTHON}-config --libs)
else
PYTHON_INCLUDES := -I/usr/include/python\${PYTHON_VERSION}
PYTHON_LIB := -lpython\${PYTHON_VERSION}
endif
EOF
if test $TRICK_HOST_TYPE = "Linux"
then
cat >> ${TRICK_HOME}/config_${TRICK_HOST_TYPE}.mk << EOF
BFD_HOME := $bfd
SHARED_LIB_OPT := -shared
ifeq (\$(MAKELEVEL),0)
export TRICK_LDFLAGS += -Wl,--export-dynamic
export TRICK_EXEC_LINK_LIBS += -lm -lrt -lpthread -ldl -lz \$(PYTHON_LIB)
endif
LD_WHOLE_ARCHIVE := -Wl,-whole-archive
LD_NO_WHOLE_ARCHIVE := -Wl,-no-whole-archive
ifneq (\$(DMTCP),)
TRICK_EXEC_LINK_LIBS += -L\$(DMTCP)/dmtcpaware -ldmtcpaware
endif
ifneq (\$(TPROCTE),)
TRICK_ADDITIONAL_CXXFLAGS += -D_TPRO_CTE -I\$(TPROCTE)/h
TRICK_EXEC_LINK_LIBS += \$(TPROCTE)/lib/libtpro.a
endif
ifneq (\$(BC635),)
# BC635 driver ver 118 and earlier do not have proper include and lib dirs.
TRICK_ADDITIONAL_CXXFLAGS += -D_BC635 -DLINUX -I\$(BC635)/sample
TRICK_EXEC_LINK_LIBS += \$(BC635)/sample/bcsdklib.a
endif
ifeq (\$(HAVE_ZEROCONF),1)
TRICK_EXEC_LINK_LIBS += -lavahi-client
endif
# Check BFD library version
ifneq (\$(BFD_HOME),)
HAVE_BFD := 1
TRICK_EXEC_LINK_LIBS += -lbfd
endif
# determine if -std=c++0x or -std=c++11 compile flags are desired
ifeq "$std" "c++0x"
TRICK_ADDITIONAL_CXXFLAGS += -std=c++0x -D_HAVE_TR1_RANDOM
endif
ifeq "$std" "c++11"
TRICK_ADDITIONAL_CXXFLAGS += -std=c++11 -D_HAVE_STL_RANDOM
endif
EOF
elif test $TRICK_HOST_TYPE = "Darwin"
then
cat >> ${TRICK_HOME}/config_${TRICK_HOST_TYPE}.mk << EOF
HAVE_BFD := 0
SHARED_LIB_OPT := -dynamiclib -Wl,-undefined,dynamic_lookup
TRICK_LDFLAGS +=
LD_WHOLE_ARCHIVE := -Wl,-all_load
LD_NO_WHOLE_ARCHIVE :=
TRICK_EXEC_LINK_LIBS += -lm -lpthread -ldl -lz \$(PYTHON_LIB)
EOF
fi
echo ""
echo "[32mTrick is ready to compile.[0m"
echo "Ready to run \"make\"."