-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·3197 lines (2566 loc) · 109 KB
/
configure
File metadata and controls
executable file
·3197 lines (2566 loc) · 109 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# automatic configuration and SConstruct creation
#
import os, os.path
import sys
import stat
import platform
import re
import subprocess, shlex
import string
import urllib.request
import tarfile
import tempfile
###############################################################
###############################################################
##
## default settings
##
###############################################################
###############################################################
cache = 'config.cache'
logfile = 'config.log'
check = True
show = False
verbose = 1
contribdir = 'contrib'
# compiler/library/function test data
cconf = { 'source' : 'conftest.c',
'obj' : 'conftest.o',
'prog' : 'conftest' }
cxxconf = { 'source' : 'conftest.C',
'obj' : 'conftest.o',
'prog' : 'conftest' }
fconf = { 'source' : 'conftest.f',
'obj' : 'conftest.o',
'prog' : 'conftest' }
# default compilation options
compenv = { 'LIBNAME' : 'hpro',
'MAJVERSION' : '3',
'MINVERSION' : '1',
'PREFIX' : '.',
'OBJDIR' : '',
'NET_TYPE' : 'SEQ',
'HPRODEBUG' : 'no',
#
# programs
#
'CC' : 'cc',
'CXX' : 'c++',
'FC' : 'f77',
# 'USE_CPUFLAGS' : 'check',
# 'CPUFLAGS' : 'bin/cpuflags',
'HAS_PKGCONFIG': 'check',
'PKGCONFIG' : 'pkg-config',
#
# compilation and linker flags
#
'DEFINES' : '',
'NOOPT' : '',
'CFLAGS' : '',
'CXXFLAGS' : '',
'FCFLAGS' : '',
'LFLAGS' : '-lm',
'ARCHFLAGS' : '',
'DBGFLAGS' : '-g -march=native',
'OPTFLAGS' : '-O3 -fomit-frame-pointer -ffast-math -funroll-loops -march=native',
'PROFLAGS' : '-pg',
#
# libraries
#
'LAPACK_SRC' : 'IGNORE',
'LAPACK_LIB' : '-llapack -lblas',
'LAPACK_BASE' : '',
'BOOSTDIR' : '',
'BOOSTCFLAGS' : '-I@BOOSTDIR@/include',
'BOOSTLFLAGS' : '-L@BOOSTDIR@/lib -lboost_filesystem -lboost_system -lboost_program_options',
'TBB' : 'check',
'TBBDIR' : '',
'TBBCFLAGS' : '-I@TBBDIR@/include',
'TBBLFLAGS' : '-L@TBBDIR@/lib -ltbb',
'ZLIB' : 'check',
'ZLIBDIR' : '',
'ZLIBCFLAGS' : '-I@ZLIBDIR@/include',
'ZLIBLFLAGS' : '-L@ZLIBDIR@/lib -lz',
'METIS' : 'check',
'METISDIR' : '',
'METISCFLAGS' : '-I@METISDIR@/include',
'METISLFLAGS' : '-L@METISDIR@/lib -lmetis',
'SCOTCH' : 'check',
'SCOTCHDIR' : '',
'SCOTCHCFLAGS' : '-I@SCOTCHDIR@/include',
'SCOTCHLFLAGS' : '-L@SCOTCHDIR@/lib -lscotch -lscotcherr',
'CHACO' : 'no',
'CHACODIR' : '',
'CHACOLFLAGS' : '-lchaco',
'MONGOOSE' : 'check',
'MONGOOSEDIR' : '',
'MONGOOSECFLAGS' : '-I@MONGOOSEDIR@/include -I@MONGOOSEDIR@/include/suitesparse',
'MONGOOSELFLAGS' : '-L@MONGOOSEDIR@/lib -lmongoose',
'GSL' : 'check',
'GSLCFLAGS' : '$pkgconfig( --cflags gsl )$',
'GSLLFLAGS' : '$pkgconfig( --libs gsl )$',
'CAIRO' : 'check',
'CAIROCFLAGS' : '$pkgconfig( --cflags cairo-pdf )$',
'CAIROLFLAGS' : '$pkgconfig( --libs cairo-pdf )$',
'HDF5' : 'check',
'HDF5CFLAGS' : '$pkgconfig( --cflags hdf5-serial )$',
'HDF5LFLAGS' : '$pkgconfig( --libs hdf5-serial )$ -lhdf5_cpp',
'NETCDF' : 'check',
'NETCDFCFLAGS' : '$pkgconfig( --cflags netcdf )$',
'NETCDFLFLAGS' : '$pkgconfig( --libs netcdf )$',
'CGAL' : 'check',
'CGALDIR' : '',
'CGALCFLAGS' : '-I@CGALDIR@/include',
'AMDLIBM' : 'check',
'AMDLIBMDIR' : '',
'AMDLIBMLFLAGS': '-L@AMDLIBMDIR@/lib/static -lamdlibm',
'ACML' : 'check',
'ACMLDIR' : '',
'ACMLLFLAGS' : '-L@ACMLDIR@/lib -lacml_mv',
'SVML' : 'check',
'SVMLDIR' : '',
'SVMLLFLAGS' : '', # '-L@SVMLDIR/lib -lsvml',
'LIBMVEC' : 'check',
'MKL' : 'check',
'MKLDIR' : '@MKLROOT@',
'MKLCFLAGS' : '-I@MKLDIR@/include',
'MKLLFLAGS' : '-L@MKLDIR@/lib/intel64 -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lm',
# 'MKLLFLAGS' : '-L@MKLROOT@/lib/intel64 -lmkl_gf_lp64 -lmkl_tbb_thread -lmkl_core -lm -ltbb',
'MKL_SEQ' : 'check',
'CUDA' : 'check',
'CUDADIR' : '@CUDA_ROOT@',
'CUDACFLAGS' : '-I@CUDADIR@/include',
'CUDALFLAGS' : '-L@CUDADIR@/lib64 -lcudart -lcublasLt -lcublas -lcusolver',
'HIP' : 'check',
'HIPDIR' : '/opt/rocm',
'HIPDEFINES' : '-D__HIP_PLATFORM_AMD__', # for AMD GPUs
'HIPCFLAGS' : '-I@HIPDIR@/include',
'HIPLFLAGS' : '-L@HIPDIR@/lib -lhipsolver -lamdhip64',
'VAMPIRTRACE' : 'no',
#
# functions and features
#
'HAS_CLOCKGETTIME' : 'check',
'HAS_GETTIMEOFDAY' : 'check',
'HAS_GETTICKCOUNT' : 'check',
'HAS_GETPROCESSTIMES' : 'check',
'HAS_LOCALTIME_R' : 'check',
'HAS_GETRUSAGE' : 'check',
'HAS_LWPINFO' : 'check',
'HAS_GETPAGESIZE' : 'check',
'HAS_MMAP' : 'check',
'HAS_STRERROR_R' : 'check',
'HAS_BACKTRACE' : 'check',
'HAS_CXXDEMANGLE' : 'check',
'HAS_UNORDERED_MAP' : 'no', # since C++11 is required, no check necessary
'HAS_BOOST_IOSTREAMS' : 'check', # this is optional
'HAS_GEJSV' : 'no',
'HAS_GESVJ' : 'check',
'HAS_SINCOS' : 'check',
'HAS_SSE2' : 'check',
'HAS_SSE3' : 'check',
'HAS_AVX' : 'check',
'HAS_AVX2' : 'check',
'HAS_MIC' : 'check',
'HAS_AVX512F' : 'check',
'HAS_VSX' : 'check',
'HAS_NEON' : 'check',
'ILP64' : 'yes',
'HAS_C99COMPLEX' : 'check',
'HAS_CPUID' : 'check',
}
# Linux options
linux_env = { 'CC' : 'gcc',
'CXX' : 'g++',
'FC' : 'gfortran',
'DEFINES' : '-DLINUX',
'LFLAGS' : '-lm -lrt -lpthread',
'HAS_GETPROCESSTIMES' : 'no',
'HAS_GETTICKCOUNT' : 'no',
'HAS_LWPINFO' : 'no',
}
# SunOS/Solaris options
sunos_env = { 'CXX' : 'CC',
'FC' : 'f90',
'DEFINES' : '-DSUNOS',
'LFLAGS' : '-lrt -lm -lsunmath',
'THRCFLAGS' : '-mt',
'THRLFLAGS' : '-mt',
'LAPACK_LIB' : '-xlic_lib=sunperf',
'HAS_GETPROCESSTIMES' : 'no',
'HAS_GETTICKCOUNT' : 'no',
}
# IBM AIX options
aix_env = { 'CC' : 'xlc',
'CXX' : 'xlC',
'FC' : 'xlf',
'DEFINES' : '-DAIX',
'HAS_GETPROCESSTIMES' : 'no',
'HAS_GETTICKCOUNT' : 'no',
'HAS_LWPINFO' : 'no',
}
# Compaq Tru64 options
tru64_env = { 'CXX' : 'cxx',
'DEFINES' : '-DTRU64',
'THRCFLAGS' : '-pthread -D_REENTRANT',
'THRLFLAGS' : '-pthread',
'LAPACK_LIB' : '-lcxml',
'HAS_GETPROCESSTIMES' : 'no',
'HAS_GETTICKCOUNT' : 'no',
'HAS_LWPINFO' : 'no',
}
# HP-UX options
hpux_env = { 'CXX' : 'aCC -AA',
'DEFINES' : '-DHPUX',
'THRCFLAGS' : '-mt -D_REENTRANT',
'THRLFLAGS' : '-mt -lpthread',
'LAPACK_LIB' : '-Wl,-aarchive_shared,-L/opt/mlib/lib/pa20_64 -llapack',
'HAS_GETPROCESSTIMES' : 'no',
'HAS_GETTICKCOUNT' : 'no',
'HAS_LWPINFO' : 'no',
}
# Darwin options
darwin_env = { 'CC' : 'gcc',
'CXX' : 'g++',
'FC' : 'gfortran',
'DEFINES' : '-DDARWIN',
'LFLAGS' : '-lm',
'THRCFLAGS' : '-D_REENTRANT',
'THRLFLAGS' : '-lpthread',
'LAPACK_LIB' : '-Wl,-framework,Accelerate',
'HAS_GETPROCESSTIMES' : 'no',
'HAS_GETTICKCOUNT' : 'no',
'HAS_LWPINFO' : 'no',
}
# Windows options
windows_env = { 'CC' : 'cl /nologo',
'CXX' : 'cl /nologo /EHsc',
'DBGFLAGS' : '/Zi',
'OPTFLAGS' : '/Ox /fp:fast',
'DEFINES' : '-DWINDOWS',
'LFLAGS' : '',
'THRCFLAGS' : '',
'THRLFLAGS' : '',
'HAS_LWPINFO' : 'no',
}
#
# terminal colour options
# (N: normal, F: bold, R: red, G: green, B: blue)
#
tput = 'tput'
tc = { 'N' : '', 'F' : '', 'R' : '', 'G' : '', 'B' : '', 'Y' : '' , 'W' : '' }
tmsg = { 'success' : 'ok',
'failure' : 'failed',
'hell' : '.' }
###############################################################
###############################################################
##
## general functions
##
###############################################################
###############################################################
#
# print usage informations
#
def usage ( status ):
"""print usage informations"""
print( 'Usage: configure [OPTIONS]' )
print( 'Options:' )
print( ' -c | --check check if specified tools and libraries really work' )
print( ' -n | --no-check disable tool and library check' )
print( ' -f | --config <file> set configuration file (default = config.cache)' )
print( ' -h | --help print this usage information' )
print( ' -q | --quiet be quiet while configuring' )
print( ' -s | --show determine flags and show config without writing files' )
print( ' -v | --verbose be verbose while configuring' )
print( '' )
print( ' Directories' )
print( ' --prefix=dir prefix directory for installation' )
print( '' )
print( ' Library Type' )
print( ' --comm=type inter process comm. support (type = SEQ,MPI,SHM)' )
print( '' )
print( ' Compilers and Tools' )
print( ' --cc=C-COMPILER set C compiler to use' )
print( ' --cxx=C++-COMPILER set C++ compiler to use' )
print( ' --fc=Fortran-COMPILER set Fortran compiler to use' )
print( '' )
print( ' Compilation flags' )
print( ' --enable-FEATURE enable FEATURE' )
print( ' --disable-FEATURE disable FEATURE' )
print( '' )
print( ' --cflags=FLAGS set C compilation flags (overwrite other flags)' )
print( ' --cxxflags=FLAGS set C++ compilation flags (overwrite other flags)' )
print( ' --fcflags=FLAGS set Fortran compilation flags (overwrite other flags)' )
print( '' )
print( ' --arch-flags=FLAGS define architecture flags' )
print( ' --debug-flags=FLAGS define debugging flags' )
print( ' --opt-flags=FLAGS define optimisation flags' )
print( ' --profile-flags=FLAGS define profile flags' )
print( '' )
print( ' --enable-debug turn on additional debugging features' )
print( ' --enable-ilp64 use 64-bit integers for BLAS/LAPACK (default)' )
print( '' )
print( ' Optional libraries and tools' )
print( ' --with-LIBRARY use LIBRARY (or tool)' )
print( ' --without-LIBRARY do not use LIBRARY (or tool)' )
print( '' )
# print( ' --with-cpuflags[=path] use cpuflags to determine CFLAGS/CXXFLAGS (default = off)' )
print( ' --lapack=LFLAGS linking flags for LAPACK' )
print( ' --with-mkl=dir set installation directory of Intel MKL' )
print( ' --mkl-cflags flags to compile with Intel MKL' )
print( ' --mkl-lflags flags to link with Intel MKL' )
print( ' --with-cuda=dir set installation directory of NVidia CUDA' )
print( ' --cuda-cflags flags to compile with NVidia CUDA' )
print( ' --cuda-lflags flags to link with NVidia CUDA' )
print( ' --with-hip=dir set installation directory of HIP' )
print( ' --hip-cflags flags to compile with HIP' )
print( ' --hip-lflags flags to link with HIP' )
print( ' --with-boost=dir set installation directory of Boost (default = none)' )
print( ' --boost-cflags flags to compile with boost' )
print( ' --boost-lflags flags to link with boost' )
print( ' --with-zlib[=dir] turn on/off usage of zlib with optional prefix "dir"' )
print( ' --zlib-cflags flags to compile with zlib' )
print( ' --zlib-lflags flags to link with zlib' )
print( ' --with-metis[=dir] turn on/off usage of METIS with optional prefix "dir"' )
print( ' --metis-cflags flags to compile with METIS' )
print( ' --metis-lflags flags to link with METIS' )
print( ' --with-scotch[=dir] turn on/off usage of Scotch with optional prefix "dir"' )
print( ' --scotch-cflags flags to compile with Scotch' )
print( ' --scotch-lflags flags to link with Scotch' )
print( ' --with-chaco[=dir] turn on/off usage of Chaco with optional prefix "dir"' )
print( ' --chaco-lflags flags to link with Chaco' )
print( ' --with-mongoose[=dir] turn on/off usage of Mongoose with optional prefix "dir"' )
print( ' --mongoose-cflags flags to compile with Mongoose' )
print( ' --mongoose-lflags flags to link with Mongoose' )
print( ' --with-gsl turn on/off usage of GSL' )
print( ' --gsl-cflags flags to compile with GSL' )
print( ' --gsl-lflags flags to link with GSL' )
print( ' --with-hdf5 turn on/off usage of HDF5' )
print( ' --hdf5-cflags flags to compile with HDF5' )
print( ' --hdf5-lflags flags to link with HDF5' )
print( ' --with-netcdf turn on/off usage of NetCDF' )
print( ' --netcdf-cflags flags to compile with NetCDF' )
print( ' --netcdf-lflags flags to link with NetCDF' )
print( ' --with-cgal[=dir] turn on/off usage of CGAL with optional prefix "dir"' )
print( ' --cgal-cflags flags to compile with CGAL' )
print( ' --with-amdlibm[=dir] turn on/off usage of AMDLIBM with optional prefix "dir"' )
print( ' --amdlibm-cflags=lflags flags to compile with AMDLIBM' )
print( ' --amdlibm-lflags=lflags flags to link with AMDLIBM' )
print( ' --with-acml[=dir] turn on/off usage of ACML with optional prefix "dir"' )
print( ' --acml-lflags=lflags flags to link with ACML' )
sys.exit( status )
#
# read commandline options
#
def parse_cmdline ( args, env ):
"""Read command line parameters"""
global cache, check, show, verbose
opts, args = getopt( args, [ [ '-c', 'none', None ],
[ '--check', 'none', None ],
[ '-n', 'none', None ],
[ '--no-check', 'none', None ],
[ '-f', 'required', '' ],
[ '--config', 'required', '' ],
[ '-h', 'none', None ],
[ '--help', 'none', None ],
[ '-q', 'none', None ],
[ '--quiet', 'none', None ],
[ '-s', 'none', None ],
[ '--show', 'none', None ],
[ '-v', 'optional', 1 ],
[ '--verbose', 'optional', 1 ],
[ '--prefix', 'required', env['PREFIX'] ],
[ '--cc', 'required', env['CC'] ],
[ '--cxx', 'required', env['CXX'] ],
[ '--fc', 'required', env['FC'] ],
[ '--cflags', 'required', env['CFLAGS'] ],
[ '--cxxflags', 'required', env['CXXFLAGS'] ],
[ '--fcflags', 'required', env['FCFLAGS'] ],
[ '--arch-flags', 'required', env['ARCHFLAGS'] ],
[ '--debug-flags', 'required', env['DBGFLAGS'] ],
[ '--opt-flags', 'required', env['OPTFLAGS'] ],
[ '--profile-flags', 'required', env['PROFLAGS'] ],
[ '--enable-debug', 'none', None ],
[ '--disable-debug', 'none', None ],
[ '--enable-single', 'none', None ],
[ '--disable-single', 'none', None ],
[ '--enable-double', 'none', None ],
[ '--disable-double', 'none', None ],
[ '--enable-ilp64', 'none', None ],
[ '--disable-ilp64', 'none', None ],
# [ '--with-cpuflags', 'optional', env['CPUFLAGS'] ],
# [ '--without-cpuflags', 'none', None ],
[ '--with-boost', 'required', env['BOOSTDIR'] ],
[ '--boost-cflags', 'required', env['BOOSTCFLAGS'] ],
[ '--boost-lflags', 'required', env['BOOSTLFLAGS'] ],
[ '--with-zlib', 'optional', env['ZLIBDIR'] ],
[ '--without-zlib', 'none', None ],
[ '--zlib-cflags', 'required', env['ZLIBCFLAGS'] ],
[ '--zlib-lflags', 'required', env['ZLIBLFLAGS'] ],
[ '--with-metis', 'optional', env['METISDIR'] ],
[ '--without-metis', 'none', None ],
[ '--metis-cflags', 'required', env['METISCFLAGS'] ],
[ '--metis-lflags', 'required', env['METISLFLAGS'] ],
[ '--with-scotch', 'optional', env['SCOTCHDIR'] ],
[ '--without-scotch', 'none', None ],
[ '--scotch-cflags', 'required', env['SCOTCHCFLAGS'] ],
[ '--scotch-lflags', 'required', env['SCOTCHLFLAGS'] ],
# [ '--with-chaco', 'optional', env['CHACODIR'] ],
# [ '--without-chaco', 'none', None ],
# [ '--chaco-lflags', 'required', env['CHACOLFLAGS'] ],
[ '--with-mongoose', 'optional', env['MONGOOSEDIR'] ],
[ '--without-mongoose', 'none', None ],
[ '--mongoose-cflags', 'required', env['MONGOOSECFLAGS'] ],
[ '--mongoose-lflags', 'required', env['MONGOOSELFLAGS'] ],
[ '--with-hdf5', 'none', None ],
[ '--without-hdf5', 'none', None ],
[ '--hdf5-cflags', 'required', env['HDF5CFLAGS'] ],
[ '--hdf5-lflags', 'required', env['HDF5LFLAGS'] ],
[ '--with-netcdf', 'none', None ],
[ '--without-netcdf', 'none', None ],
[ '--netcdf-cflags', 'required', env['NETCDFCFLAGS'] ],
[ '--netcdf-lflags', 'required', env['NETCDFLFLAGS'] ],
[ '--with-cgal', 'optional', env['CGALDIR'] ],
[ '--without-cgal', 'none', None ],
[ '--cgal-cflags', 'required', env['CGALCFLAGS'] ],
[ '--with-amdlibm', 'optional', env['AMDLIBMDIR'] ],
[ '--without-amdlibm', 'none', None ],
[ '--amdlibm-lflags', 'required', env['AMDLIBMLFLAGS'] ],
[ '--with-acml', 'optional', env['ACMLDIR'] ],
[ '--without-acml', 'none', None ],
[ '--acml-lflags', 'required', env['ACMLLFLAGS'] ],
[ '--with-gsl', 'none', None ],
[ '--without-gsl', 'none', None ],
[ '--gsl-cflags', 'required', env['GSLCFLAGS'] ],
[ '--gsl-lflags', 'required', env['GSLLFLAGS'] ],
[ '--with-vtrace', 'none', None ],
[ '--without-vtrace', 'none', None ],
[ '--lapack', 'required', env['LAPACK_LIB'] ],
[ '--with-mkl', 'optional', env['MKLDIR'] ],
[ '--without-mkl', 'none', None ],
[ '--mkl-cflags', 'required', env['MKLCFLAGS'] ],
[ '--mkl-lflags', 'required', env['MKLLFLAGS'] ],
[ '--with-cuda', 'optional', env['CUDADIR'] ],
[ '--without-cuda', 'none', None ],
[ '--cuda-cflags', 'required', env['CUDACFLAGS'] ],
[ '--cuda-lflags', 'required', env['CUDALFLAGS'] ],
[ '--with-hip', 'optional', env['HIPDIR'] ],
[ '--without-hip', 'none', None ],
[ '--hip-cflags', 'required', env['HIPCFLAGS'] ],
[ '--hip-lflags', 'required', env['HIPLFLAGS'] ],
[ '--with-libmvec', 'none', None ],
[ '--without-libmvec', 'none', None ],
] )
for opt, arg in opts:
if opt in ( '-c', '--check' ):
check = True
elif opt in ( '-n', '--no-check' ):
check = False
elif opt in ( '-f', '--config' ):
cache = arg
elif opt in ( '-h', '--help' ):
usage( 0 )
elif opt in ( '-q', '--quiet' ):
verbose = 0
elif opt in ( '-s', '--show' ):
show = True
elif opt in ( '-v', '--verbose' ):
verbose = int( arg )
elif opt in ( '--prefix' ):
env['PREFIX'] = arg
elif opt in ( '--cc' ):
env['CC'] = arg
elif opt in ( '--cxx' ):
env['CXX'] = arg
elif opt in ( '--fc' ):
env['FC'] = arg
elif opt in ( '--cflags' ):
env['CFLAGS'] = arg
elif opt in ( '--cxxflags' ):
env['CXXFLAGS'] = arg
elif opt in ( '--fcflags' ):
env['FCFLAGS'] = arg
elif opt in ( '--arch-flags' ):
env['ARCHFLAGS'] = arg
elif opt in ( '--debug-flags' ):
env['DBGFLAGS'] = arg
elif opt in ( '--opt-flags' ):
env['OPTFLAGS'] = arg
elif opt in ( '--profile-flags' ):
env['PROFLAGS'] = arg
elif opt in ( '--enable-debug' ):
env['HPRODEBUG'] = 'yes'
elif opt in ( '--disable-debug' ):
env['HPRODEBUG'] = 'no'
elif opt in ( '--enable-ilp64' ):
env['ILP64'] = 'yes'
elif opt in ( '--disable-ilp64' ):
env['ILP64'] = 'no'
# elif opt in ( '--with-cpuflags' ):
# env['USE_CPUFLAGS'] = 'yes'
# env['CPUFLAGS'] = arg
# elif opt in ( '--without-cpuflags' ):
# env['USE_CPUFLAGS'] = 'no'
elif opt in ( '--with-boost' ):
env['BOOSTDIR'] = arg
env['BOOSTCFLAGS'] = '-I@BOOSTDIR@/include ' + env['BOOSTCFLAGS']
env['BOOSTLFLAGS'] = '-L@BOOSTDIR@/lib ' + env['BOOSTLFLAGS']
elif opt in ( '--boost-cflags' ):
env['BOOSTCFLAGS'] = arg
elif opt in ( '--boost-lflags' ):
env['BOOSTLFLAGS'] = arg
elif opt in ( '--with-zlib' ):
env['ZLIB'] = 'yes'
env['ZLIBDIR'] = arg
elif opt in ( '--without-zlib' ):
env['ZLIB'] = 'no'
elif opt in ( '--zlib-cflags' ):
env['ZLIBCFLAGS'] = arg
elif opt in ( '--zlib-lflags' ):
env['ZLIBLFLAGS'] = arg
elif opt in ( '--with-metis' ):
env['METIS'] = 'yes'
env['METISDIR'] = arg
elif opt in ( '--without-metis' ):
env['METIS'] = 'no'
elif opt in ( '--metis-cflags' ):
env['METISCFLAGS'] = arg
elif opt in ( '--metis-lflags' ):
env['METISLFLAGS'] = arg
elif opt in ( '--with-scotch' ):
env['SCOTCH'] = 'yes'
env['SCOTCHDIR'] = arg
elif opt in ( '--without-scotch' ):
env['SCOTCH'] = 'no'
elif opt in ( '--scotch-cflags' ):
env['SCOTCHCFLAGS'] = arg
elif opt in ( '--scotch-lflags' ):
env['SCOTCHLFLAGS'] = arg
# elif opt in ( '--with-chaco' ):
# env['CHACO'] = 'yes'
# env['CHACODIR'] = arg
# elif opt in ( '--without-chaco' ):
# env['CHACO'] = 'no'
# elif opt in ( '--chaco-lflags' ):
# env['CHACOLFLAGS'] = arg
elif opt in ( '--with-mongoose' ):
env['MONGOOSE'] = 'yes'
env['MONGOOSEDIR'] = arg
elif opt in ( '--without-mongoose' ):
env['MONGOOSE'] = 'no'
elif opt in ( '--mongoose-cflags' ):
env['MONGOOSECFLAGS'] = arg
elif opt in ( '--mongoose-lflags' ):
env['MONGOOSELFLAGS'] = arg
elif opt in ( '--with-gsl' ):
env['GSL'] = 'yes'
elif opt in ( '--without-gsl' ):
env['GSL'] = 'no'
elif opt in ( '--gsl-cflags' ):
env['GSLCFLAGS'] = arg
elif opt in ( '--gsl-lflags' ):
env['GSLLFLAGS'] = arg
elif opt in ( '--with-hdf5' ):
env['HDF5'] = 'yes'
elif opt in ( '--without-hdf5' ):
env['HDF5'] = 'no'
elif opt in ( '--hdf5-cflags' ):
env['HDF5CFLAGS'] = arg
elif opt in ( '--hdf5-lflags' ):
env['HDF5LFLAGS'] = arg
elif opt in ( '--with-netcdf' ):
env['NETCDF'] = 'yes'
elif opt in ( '--without-netcdf' ):
env['NETCDF'] = 'no'
elif opt in ( '--netcdf-cflags' ):
env['NETCDFCFLAGS'] = arg
elif opt in ( '--netcdf-lflags' ):
env['NETCDFLFLAGS'] = arg
elif opt in ( '--with-cgal' ):
env['CGAL'] = 'yes'
env['CGALDIR'] = arg
elif opt in ( '--without-cgal' ):
env['CGAL'] = 'no'
elif opt in ( '--cgal-cflags' ):
env['CGALCFLAGS'] = arg
elif opt in ( '--with-vtrace' ):
env['VAMPIRTRACE'] = 'yes'
elif opt in ( '--without-vtrace' ):
env['VAMPIRTRACE'] = 'no'
elif opt in ( '--with-amdlibm' ):
env['AMDLIBM'] = 'yes'
env['AMDLIBMDIR'] = arg
elif opt in ( '--without-amdlibm' ):
env['AMDLIBM'] = 'no'
elif opt in ( '--amdlibm-lflags' ):
env['AMDLIBMLFLAGS'] = arg
elif opt in ( '--with-acml' ):
env['ACML'] = 'yes'
env['ACMLDIR'] = arg
elif opt in ( '--without-acml' ):
env['ACML'] = 'no'
elif opt in ( '--acml-lflags' ):
env['ACMLLFLAGS'] = arg
elif opt in ( '--lapack' ):
env['LAPACK_LIB'] = arg
env['LAPACK_SRC'] = 'LOCAL'
elif opt in ( '--with-mkl' ):
env['MKLDIR'] = arg
env['MKL'] = 'check'
elif opt in ( '--without-mkl' ):
env['MKL'] = 'no'
elif opt in ( '--mkl-cflags' ):
env['MKLCFLAGS'] = arg
elif opt in ( '--mkl-lflags' ):
env['MKLLFLAGS'] = arg
elif opt in ( '--with-cuda' ):
env['CUDADIR'] = arg
env['CUDA'] = 'check'
elif opt in ( '--without-cuda' ):
env['CUDA'] = 'no'
elif opt in ( '--cuda-cflags' ):
env['CUDACFLAGS'] = arg
elif opt in ( '--cuda-lflags' ):
env['CUDALFLAGS'] = arg
elif opt in ( '--with-hip' ):
env['HIPDIR'] = arg
env['HIP'] = 'check'
elif opt in ( '--without-hip' ):
env['HIP'] = 'no'
elif opt in ( '--hip-cflags' ):
env['HIPCFLAGS'] = arg
elif opt in ( '--hip-lflags' ):
env['HIPLFLAGS'] = arg
elif opt in ( '--with-libmvec' ):
env['LIBMVEC'] = 'check'
elif opt in ( '--without-libmvec' ):
env['LIBMVEC'] = 'no'
# adjust prefix directory
if env['PREFIX'] == '.':
env['PREFIX'] = os.getcwd()
#
# print content of environment
#
def print_env ( env ):
"""Print compilation environment"""
def print_bold ( name, val, flags = '' ):
"""Format name and value for environment printing"""
if val != '' and val != None:
if flags != '' :
print( bold( '%-12s' % name ) + ' = ' + val + ( ' (%s)' % flags ) )
else :
print( bold( '%-12s' % name ) + ' = ' + val )
print_bold( 'PREFIX', env['PREFIX'] )
print( '' )
print_bold( 'CC', env['CC'] )
print_bold( 'CXX', env['CXX'] )
print_bold( 'FC', env['FC'] )
print( '' )
print_bold( 'DEFINES', env['DEFINES'] )
print_bold( 'CFLAGS', env['CFLAGS'] )
print_bold( 'CXXFLAGS', env['CXXFLAGS'] )
print_bold( 'FCFLAGS', env['FCFLAGS'] )
print_bold( 'OPTFLAGS', env['OPTFLAGS'] )
print_bold( 'LFLAGS', env['LFLAGS'] )
# if env['USE_CPUFLAGS'] == 'yes':
# print( '' )
# print_bold( 'CPUFLAGS', env['CPUFLAGS'] )
print( '' )
print_bold( 'LAPACK', env['LAPACK_LIB'] )
if env['ILP64'] == 'yes':
print_bold( 'ILP64', 'yes' )
if env['CUDA'] == 'yes':
if verbose > 1:
print_bold( 'CUDA', 'yes' )
print_bold( 'CUDADIR', env['CUDADIR'] )
print_bold( 'CUDACFLAGS', env['CUDACFLAGS'] )
print_bold( 'CUDALFLAGS', env['CUDALFLAGS'] )
else :
print_bold( 'CUDA', 'yes', env['CUDACFLAGS'] + ' ' + env['CUDALFLAGS'] )
if env['HIP'] == 'yes':
if verbose > 1:
print_bold( 'HIP', 'yes' )
print_bold( 'HIPDIR', env['HIPDIR'] )
print_bold( 'HIPCFLAGS', env['HIPCFLAGS'] )
print_bold( 'HIPLFLAGS', env['HIPLFLAGS'] )
else :
print_bold( 'HIP', 'yes', env['HIPCFLAGS'] + ' ' + env['HIPLFLAGS'] )
print( '' )
if env['BOOSTDIR'] != '':
print_bold( 'BOOSTDIR', env['BOOSTDIR'] )
if verbose > 1:
print_bold( 'BOOSTCFLAGS', env['BOOSTCFLAGS'] )
print_bold( 'BOOSTLFLAGS', env['BOOSTLFLAGS'] )
if env['ZLIB'] == 'yes':
if verbose > 1:
print_bold( 'ZLIB', 'yes' )
print_bold( 'ZLIBDIR', env['ZLIBDIR'] )
print_bold( 'ZLIBCFLAGS', env['ZLIBCFLAGS'] )
print_bold( 'ZLIBLFLAGS', env['ZLIBLFLAGS'] )
else :
print_bold( 'ZLIB', 'yes', env['ZLIBCFLAGS'] + ' ' + env['ZLIBLFLAGS'] )
if env['METIS'] == 'yes':
if verbose > 1:
print_bold( 'METIS', 'yes' )
print_bold( 'METISDIR', env['METISDIR'] )
print_bold( 'METISCFLAGS', env['METISCFLAGS'] )
print_bold( 'METISLFLAGS', env['METISLFLAGS'] )
else :
print_bold( 'METIS', 'yes', env['METISCFLAGS'] + ' ' + env['METISLFLAGS'] )
if env['SCOTCH'] == 'yes':
if verbose > 1:
print_bold( 'Scotch', 'yes' )
print_bold( 'SCOTCHDIR', env['SCOTCHDIR'] )
print_bold( 'SCOTCHCFLAGS', env['SCOTCHCFLAGS'] )
print_bold( 'SCOTCHLFLAGS', env['SCOTCHLFLAGS'] )
else :
print_bold( 'Scotch', 'yes', env['SCOTCHCFLAGS'] + ' ' + env['SCOTCHLFLAGS'] )
# if env['CHACO'] == 'yes':
# if verbose > 1:
# print_bold( 'Chaco', 'yes' )
# print_bold( 'CHACODIR', env['CHACODIR'] )
# print_bold( 'CHACOLFLAGS', env['CHACOLFLAGS'] )
# else :
# print_bold( 'Chaco', 'yes', env['CHACOLFLAGS'] )
if env['MONGOOSE'] == 'yes':
if verbose > 1:
print_bold( 'MONGOOSE', 'yes' )
print_bold( 'MONGOOSEDIR', env['MONGOOSEDIR'] )
print_bold( 'MONGOOSECFLAGS', env['MONGOOSECFLAGS'] )
print_bold( 'MONGOOSELFLAGS', env['MONGOOSELFLAGS'] )
else :
print_bold( 'MONGOOSE', 'yes', env['MONGOOSECFLAGS'] + ' ' + env['MONGOOSELFLAGS'] )
if env['GSL'] == 'yes':
if verbose > 1:
print_bold( 'GSL', 'yes' )
print_bold( 'GSLCFLAGS', env['GSLCFLAGS'] )
print_bold( 'GSLLFLAGS', env['GSLLFLAGS'] )
else :
print_bold( 'GSL', 'yes', env['GSLCFLAGS'] + ' ' + env['GSLLFLAGS'] )
if env['HDF5'] == 'yes':
if verbose > 1:
print_bold( 'HDF5', 'yes' )
print_bold( 'HDF5CFLAGS', env['HDF5CFLAGS'] )
print_bold( 'HDF5LFLAGS', env['HDF5LFLAGS'] )
else :
print_bold( 'HDF5', 'yes', env['HDF5CFLAGS'] + ' ' + env['HDF5LFLAGS'] )
if env['NETCDF'] == 'yes':
if verbose > 1:
print_bold( 'NETCDF', 'yes' )
print_bold( 'NETCDFCFLAGS', env['NETCDFCFLAGS'] )
print_bold( 'NETCDFLFLAGS', env['NETCDFLFLAGS'] )
else :
print_bold( 'NETCDF', 'yes', env['NETCDFCFLAGS'] + ' ' + env['NETCDFLFLAGS'] )
if env['CGAL'] == 'yes':
if verbose > 1:
print_bold( 'CGAL', 'yes' )
print_bold( 'CGALDIR', env['CGALDIR'] )
print_bold( 'CGALCFLAGS', env['CGALCFLAGS'] )
else :
print_bold( 'CGAL', 'yes', env['CGALCFLAGS'] )
if env['AMDLIBM'] == 'yes':
if verbose > 1:
print_bold( 'AMDLIBM', 'yes' )
print_bold( 'AMDLIBMDIR', env['AMDLIBMDIR'] )
print_bold( 'AMDLIBMLFLAGS', env['AMDLIBMLFLAGS'] )
else :
print_bold( 'AMDLIBM', 'yes', env['AMDLIBMLFLAGS'] )
if env['ACML'] == 'yes':
if verbose > 1:
print_bold( 'ACML', 'yes' )
print_bold( 'ACMLDIR', env['ACMLDIR'] )
print_bold( 'ACMLLFLAGS', env['ACMLLFLAGS'] )
else :
print_bold( 'ACML', 'yes', env['ACMLLFLAGS'] )
#
# return first line of output of given program
#
def readln ( prog ):
text = ''
try :
file = os.popen( prog, 'r' )
text = file.readline()
file.close()
except :
pass
return text
#
# open logfile and return handle
#
def open_log ( truncate = False ) :
opt = "w"
if truncate == False :
opt = "a"
return open( logfile, opt )
#
# clear log file
#
def clear_log () :
log = open_log( truncate = True )
log.close()
#
# print string unbuffered
#
def print_unbuf ( str ) :
print( str, end = '' )
sys.stdout.flush()
#
# init colour output
#
def init_colours ( env ):
unic = False
if get_system() != 'Windows':
nc = int( readln( tput + ' colors' ) )
if nc >= 8:
tc['N'] = readln( tput + ' sgr0' )
tc['F'] = readln( tput + ' bold' )