forked from abinit/abinit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1217 lines (981 loc) · 31.1 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- Autoconf -*-
#
# Copyright (C) 2005-2018 ABINIT Group (Yann Pouillon)
#
# This file is part of the ABINIT software package. For license information,
# please see the COPYING file in the top-level directory of the ABINIT source
# distribution.
#
# ---------------------------------------------------------------------------- #
#
# IMPORTANT NOTE
#
# Please DO NOT EDIT this file unless you REALLY know what you are doing.
# Everything is important, in particular the order of the various commands
# executed here. YOU HAVE BEEN WARNED !
#
# ---------------------------------------------------------------------------- #
#
# Autoconf & Automake startup
#
# Initialize Autoconf
AC_INIT([ABINIT],[8.10.1],[https://bugs.launchpad.net/abinit/],[abinit])
AC_REVISION([Autotools support for ABINIT 7])
AC_CONFIG_AUX_DIR([config/gnu])
AC_CONFIG_MACRO_DIR([config/m4])
AC_CONFIG_SRCDIR([src/98_main/abinit.F90])
# ---------------------------------------------------------------------------- #
#
# Startup
#
ABI_MSG_SECTION([Overall startup])
# Initial setup
AC_CANONICAL_TARGET
# Disable pax
alias pax='/bin/false'
AM_INIT_AUTOMAKE([1.10 tar-ustar])
unalias pax
AC_CONFIG_HEADERS([config.h])
# Early Abinit setup - the order is important!
ABI_INIT_DIRS
ABI_INIT_VERSION
ABI_INIT_CPU_INFO
ABI_INIT_OS_INFO
ABI_INIT_HEADER
ABI_INIT_ARCH
# Check for common programs
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_SED
AC_PROG_AWK
AC_PROG_GREP
# Workaround for the "grep -e" issue on Solaris systems
AC_PROG_EGREP
# Workaround for the wrong path to install-sh on Mac systems
ABI_PROG_MKDIR_P
# Look for a command that provide absolute paths
AC_CHECK_PROGS(REALPATH,[realpath,readlink],[true])
test "${REALPATH}" = "readlink" && REALPATH="${REALPATH} -f"
# Define command-line arguments
ABI_OPTIONS_DEFINE
# Read config file and ensure that priorities are respected
ABI_ENV_BACKUP
ABI_OPTIONS_BACKUP
test "${enable_config_file}" = "" && enable_config_file="yes"
ABI_LOAD_OPTIONS
ABI_OPTIONS_RECALL
ABI_ENV_RECALL
# Set still undefined options
ABI_OPTIONS_SETUP
# Initialize environment, taking options into account
ABI_ENV_INIT
AC_SUBST(CC_LDFLAGS)
AC_SUBST(CC_LIBS)
AC_SUBST(CXX_LDFLAGS)
AC_SUBST(CXX_LIBS)
AC_SUBST(FC_LDFLAGS)
AC_SUBST(FC_LIBS)
# Initialize install dirs (requires version and config options to be set)
ABI_INIT_INSTALL_DIRS
# Translate optimization level
abi_optflags_mode="${enable_optim}"
# Disable wrapping of Fortran compiler by default
abi_fc_wrap="no"
# Save user-defined CPP
abi_cpp_user="${CPP}"
# Set-up required information for core libraries
ABI_CORELIBS_INIT
# ---------------------------------------------------------------------------- #
#
# Build-system information
#
ABI_MSG_SECTION([Build-system information])
# Display ABINIT version
AC_MSG_NOTICE([ABINIT version ${ABINIT_VERSION}])
# Display Autotools version information
ABI_INFO_AUTOTOOLS
# Display UI changes
ABI_OPTIONS_CHANGED
# ---------------------------------------------------------------------------- #
#
# Check option consistency
#
# NOTE: please hack this section with EXTREME CARE
ABI_MSG_SECTION([Option consistency checking])
# --------- #
# Libraries #
# --------- #
abi_optchk_ok="yes"
AC_MSG_NOTICE([checking consistency of library-related options])
# Closing remarks
if test "${abi_optchk_ok}" = "yes"; then
AC_MSG_NOTICE([ |---> all OK])
fi
AC_MSG_NOTICE([])
# -------------------- #
# Experimental options #
# -------------------- #
abi_optchk_ok="yes"
AC_MSG_NOTICE([checking consistency of experimental options])
# Bindings require exports
if test "${enable_bindings}" = "yes"; then
if test "${enable_exports}" != "yes"; then
enable_exports="yes"
AC_MSG_NOTICE([|---> enabling exports (required for bindings])
abi_optchk_ok="no"
fi
fi
# Closing remarks
if test "${abi_optchk_ok}" = "yes"; then
AC_MSG_NOTICE([ |---> all OK])
fi
AC_MSG_NOTICE([])
# ------------------ #
# Maintainer options #
# ------------------ #
abi_optchk_ok="yes"
AC_MSG_NOTICE([checking consistency of maintainer options])
# Fast check conflicts with package check
if test "${enable_fast_check}" = "yes"; then
if test "${enable_pkg_check}" = "yes"; then
AC_MSG_ERROR([--enable-fast-check conflicts with --enable-pkg-check])
abi_optchk_ok="no"
fi
fi
# Closing remarks
if test "${abi_optchk_ok}" = "yes"; then
AC_MSG_NOTICE([ |---> all OK])
fi
AC_MSG_NOTICE([])
# ------------------- #
# Final step: parsing #
# ------------------- #
ABI_OPTIONS_PARSE
# ---------------------------------------------------------------------------- #
#
# Multicore architecture startup
#
ABI_MSG_SECTION([Multicore architecture startup])
# Prepare MPI support
ABI_MPI_INIT
# GPU support requires MPI
if test "${enable_gpu}" = "yes" -a "${enable_mpi}" != "yes"; then
AC_MSG_ERROR([GPU support requires MPI])
fi
# Prepare GPU support
ABI_GPU_INIT
# ScaLAPACK support requires MPI
if test "${enable_scalapack}" = "yes" -a "${enable_mpi}" != "yes"; then
AC_MSG_ERROR([ScaLAPACK support requires MPI])
fi
# ---------------------------------------------------------------------------- #
#
# Miscellaneous utilities
#
ABI_MSG_SECTION([Utilities])
# Check for various programs
AC_PATH_PROG(BOURNE_SHELL,sh,/bin/sh)
AC_PATH_PROG(MV,mv,/bin/false)
AC_PATH_PROG(PERL,perl,/bin/false)
AC_PATH_PROG(RM,rm,/bin/false)
AC_CHECK_PROGS(PATCH,[patch])
AC_CHECK_PROGS(TAR,[tar])
# ---------------------------------------------------------------------------- #
#
# C support
#
ABI_MSG_SECTION([C support])
# Preserve environment
ABI_ENV_BACKUP
# Look for the C compiler
if test "${CC}" != "" -a ! -x "${CC}"; then
abi_cc_probe=`echo "${CC}" | sed -e 's/ .*//'`
if test ! -x "${abi_cc_probe}"; then
AC_PATH_PROG([abi_cc_path],[${abi_cc_probe}])
if test "${abi_cc_path}" = ""; then
AC_MSG_ERROR([could not run C compiler "${CC}"])
fi
fi
fi
AC_PROG_CC
# Fail if no C compiler is available
if test "${CC}" = ""; then
AC_MSG_ERROR([no C compiler available])
fi
# Look for the C preprocessor
if test "${CPP}" != "" -a ! -x "${CPP}"; then
AC_PATH_PROG([abi_cpp_path],[${CPP}])
if test "${abi_cpp_path}" = ""; then
AC_MSG_ERROR([could not run C preprocessor "${CPP}"])
fi
fi
AC_PROG_CPP
# Fail if no C preprocessor is available
if test "${CPP}" = ""; then
AC_MSG_ERROR([no C preprocessor available])
fi
# Set Abinit C parameters
ABI_PROG_CC
# Restore back CPPFLAGS and CFLAGS
CPPFLAGS="${abi_env_CPPFLAGS}"
CFLAGS="${abi_env_CFLAGS}"
# Check for system peculiarities
AC_C_BIGENDIAN
AC_HEADER_ASSERT
# Look for malloc.h
CPPFLAGS_MALLOC=""
AC_CHECK_HEADERS([malloc.h], [abi_hdr_malloc="yes"], [abi_hdr_malloc="no"])
if test "${abi_hdr_malloc}" = "no"; then
AC_CHECK_HEADERS([malloc/malloc.h],
[abi_hdr_malloc="yes"], [abi_hdr_malloc="no"])
fi
# ---------------------------------------------------------------------------- #
#
# C++ support
#
ABI_MSG_SECTION([C++ support])
# Preserve environment
ABI_ENV_BACKUP
# Look for the C++ compiler
if test "${CXX}" != "" -a ! -x "${CXX}"; then
abi_cxx_probe=`echo "${CXX}" | sed -e 's/ .*//'`
if test ! -x "${abi_cxx_probe}"; then
AC_PATH_PROG([abi_cxx_path],[${abi_cxx_probe}])
if test "${abi_cxx_path}" = ""; then
AC_MSG_ERROR([could not run C++ compiler "${CXX}"])
fi
fi
fi
AC_PROG_CXX
# Warn if no C++ compiler is available
if test "${CXX}" = ""; then
AC_MSG_WARN([no C++ compiler available])
fi
# Set Abinit C++ parameters
if test "${CXX}" != ""; then
ABI_PROG_CXX
fi
# Restore back CXXFLAGS
CXXFLAGS="${abi_env_CXXFLAGS}"
# ---------------------------------------------------------------------------- #
#
# Fortran support
#
ABI_MSG_SECTION([Fortran support])
# Preserve environment
ABI_ENV_BACKUP
# Look for the Fortran compiler
if test "${FC}" != "" -a ! -x "${FC}"; then
abi_fc_probe=`echo "${FC}" | sed -e 's/ .*//'`
if test ! -x "${abi_fc_probe}"; then
AC_PATH_PROG([abi_fc_path],[${abi_fc_probe}])
if test "${abi_fc_path}" = ""; then
AC_MSG_ERROR([could not run Fortran compiler "${FC}"])
fi
fi
fi
AC_PROG_FC
# Fail if no Fortran compiler is available
if test "${FC}" = ""; then
AC_MSG_ERROR([no Fortran compiler available])
fi
# Look for the Fortran preprocessor
if test "${FPP}" != "" -a ! -x "${FPP}"; then
AC_PATH_PROG([abi_fpp_path],[${FPP}])
if test "${abi_fpp_path}" = ""; then
AC_MSG_ERROR([could not run Fortran preprocessor "${FPP}"])
fi
fi
#AC_PROG_FPP
# Set Abinit Fortran parameters
ABI_PROG_FC
# Set default file extensions
ABI_FC_EXTENSIONS
# Get module file case
ABI_FC_MOD_CASE
# Restore back FCFLAGS
FCFLAGS="${abi_env_FCFLAGS}"
# Wrap Fortran compiler calls if needed or requested
if test "${enable_fc_wrapper}" = "yes"; then
abi_fc_wrap="yes"
fi
# Determine Fortran-C name mangling scheme
AC_FC_WRAPPERS
# The IBM Fortran compiler crashes if the mpi module is included
# more than once
if test "${abi_fc_vendor}" = "ibm" -a "${enable_mpi}" = "yes"; then
AC_MSG_NOTICE([activating MPI workaround for the IBM Fortran compiler])
AC_DEFINE([HAVE_MPI_INCLUDED_ONCE],1,[Define to 1 if you are using XLF.])
fi
# ---------------------------------------------------------------------------- #
#
# Python support
#
ABI_MSG_SECTION([Python support])
# Look for programs
AC_CHECK_PROGS(PYTHON,[python python2.6 python2.5 python2.4])
# Get Python preprocessing options
AC_MSG_CHECKING([for Python CPPFLAGS])
if test "${PYTHON}" != "" -a "${PYTHON_CPPFLAGS}" = ""; then
PYTHON_CPPFLAGS=`${PYTHON} -c "\
try:
import distutils.sysconfig
print '-I' + distutils.sysconfig.get_python_inc(),
except:
pass
try:
import numpy
print '-I' + numpy.get_include(),
except:
pass"`
fi
AC_MSG_RESULT([${PYTHON_CPPFLAGS}])
# Check whether Bazaar is installed
if test "${PYTHON}" != ""; then
AC_CHECK_PROGS(BAZAAR,[bzr])
fi
ABI_CHECK_PYTHON
# Set Bazaar variables
bzr_branch=""
bzr_revno=""
bzr_clean=""
if test "${BAZAAR}" != "" -a -d "${abinit_srcdir}/.bzr"; then
AC_MSG_NOTICE([retrieving Bazaar branch information])
eval `bzr version-info \
--check-clean \
--custom \
--template='bzr_branch="{revision_id}"\nbzr_revno="{revno}"\nbzr_clean="{clean}"\n' \
${abinit_srcdir}`
AC_DEFINE([HAVE_BZR_BRANCH],1,[Define to 1 if you are working in a Bazaar branch.])
fi
# Substitute Python-related variables
AC_SUBST(bzr_branch)
AC_SUBST(bzr_revno)
AC_SUBST(bzr_clean)
# ---------------------------------------------------------------------------- #
#
# Libraries and linking
#
ABI_MSG_SECTION([Libraries and linking])
# Preserve environment
ABI_ENV_BACKUP
# Disable shared objects (may change in a distant future)
# Note: Libtool-provided macro
#AC_DISABLE_SHARED
# Look for archiver
if test "${AR}" = ""; then
AC_CHECK_PROGS(AR,[ar xiar])
fi
# Set archiver command flag
test "${ARFLAGS_CMD}" = "" && ARFLAGS_CMD="rc"
AC_SUBST(ARFLAGS_CMD)
# Look for ranlib
AC_PROG_RANLIB
# Look for linker (not used for now)
#AC_PROG_LD
# Restore back compile flags
CFLAGS="${abi_env_CFLAGS}"
CXXFLAGS="${abi_env_CXXFLAGS}"
FCFLAGS="${abi_env_FCFLAGS}"
# We want to be able access the archiver from anywhere
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
# Report the use of libtool-related options
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
AC_SUBST(with_gnu_ld)
# ---------------------------------------------------------------------------- #
#
# Hints
#
ABI_MSG_SECTION([Hints])
# Look for a true C preprocessor
if test "${TRUE_CPP}" = ""; then
AC_CHECK_PROGS([TRUE_CPP],[cpp])
fi
if test "${TRUE_CPP}" = ""; then
AC_PATH_PROG([TRUE_CPP],[cpp])
fi
if test "${TRUE_CPP}" = ""; then
if test -x "/lib/cpp"; then
TRUE_CPP="/lib/cpp"
fi
fi
AC_MSG_CHECKING([for a true C preprocessor])
if test "${TRUE_CPP}" = ""; then
AC_MSG_RESULT([none])
else
AC_MSG_RESULT([${TRUE_CPP}])
fi
# Set Fortran preprocessor when needed
if test "${abi_fc_wrap}" = "yes"; then
if test "${FPP}" = ""; then
if test "${abi_cpp_user}" != ""; then
FPP="${abi_cpp_user}"
else
if test "${TRUE_CPP}" != ""; then
FPP="${TRUE_CPP}"
else
FPP="${CPP}"
fi
fi
fi
fi
# FIXME: set CPP vendor
case "${target_os}" in
aix*)
abi_cpp_vendor="ibm"
abi_xpp_vendor="ibm"
abi_fpp_vendor="ibm"
;;
*)
abi_cpp_vendor="default"
abi_xpp_vendor="default"
abi_fpp_vendor="default"
;;
esac
case "${abi_fc_vendor}" in
ibm)
abi_fpp_vendor="ibm"
;;
esac
# Preset flags to have the source building properly
if test "${enable_hints}" = "yes"; then
# C support
ABI_CPP_HINTS
ABI_CC_HINTS
# C++ support
ABI_XPP_HINTS
ABI_CXX_HINTS
# Fortran support
ABI_FPP_HINTS
ABI_FC_HINTS
# Library archiver support
ABI_AR_HINTS
fi
# Adjust OpenMP flags
if test "${enable_openmp}" != "yes"; then
FCFLAGS_OPENMP=""
fi
# Set Fortran preprocessing flags
if test "${abi_fc_wrap}" = "yes"; then
test "${FPPFLAGS}" = "" && FPPFLAGS="${FPPFLAGS_HINTS_EXT}"
fi
# Display Fortran preprocessing parameters
AC_MSG_CHECKING([which Fortran preprocessor to use])
AC_MSG_RESULT([${FPP}])
AC_MSG_CHECKING([which Fortran preprocessor flags to apply])
AC_MSG_RESULT([${FPPFLAGS}])
# Set flags for bindings
# FIXME: this is not generic enough (should use Libtool)
if test "${enable_exports}" = "yes"; then
AC_MSG_NOTICE([setting PIC flags for C compiler])
CFLAGS_HINTS="${CFLAGS_HINTS} ${CFLAGS_PIC}"
AC_MSG_NOTICE([setting PIC flags for C++ compiler])
CXXFLAGS_HINTS="${CXXFLAGS_HINTS} ${CXXFLAGS_PIC}"
AC_MSG_NOTICE([setting PIC flags for Fortran compiler])
FCFLAGS_HINTS="${FCFLAGS_HINTS} ${FCFLAGS_PIC}"
fi
# Display Fortran compiler wrapper status
AC_MSG_CHECKING([whether to wrap Fortran compiler calls])
AC_MSG_RESULT([${abi_fc_wrap}])
# Export true CPPFLAGS (required by LibXC)
AC_SUBST(CPPFLAGS_HINTS_EXT)
# ---------------------------------------------------------------------------- #
#
# Debugging
#
# NOTE:
#
# * Please do not try to set-up the *FLAGS_DEBUG variables manually,
# as they will systematically be overwritten. These flags should be
# modified by the --with-*-dbgflags options only, and --enable-debug
# set to "yes" in this case.
#
ABI_MSG_SECTION([Debugging])
# Init debug flags
ABI_DEBUG_INIT([${enable_debug}],[${enable_optim}])
# Get debug flags from database when in profile mode
if test "${enable_debug}" != "no" -a "${enable_debug}" != "yes"; then
if test "${CFLAGS}" = ""; then
ABI_CC_DBGFLAGS
else
AC_MSG_NOTICE([debugging profile overriden by user-defined CFLAGS])
fi
if test "${CXXFLAGS}" = ""; then
ABI_CXX_DBGFLAGS
else
AC_MSG_NOTICE([debugging profile overriden by user-defined CXXFLAGS])
fi
if test "${FCFLAGS}" = ""; then
ABI_FC_DBGFLAGS
else
AC_MSG_NOTICE([debugging profile overriden by user-defined FCFLAGS])
fi
fi
# Disable optimizations if debug mode is activated in source files
if test "${src_debug_mode}" = "yes"; then
if test "${enable_optim}" != "no"; then
AC_MSG_WARN([disabling optimizations])
fi
enable_optim="no"
fi
# Activate "design-by-contract" debugging tests when paranoid
AC_MSG_CHECKING([whether to activate design-by-contract debugging])
if test "${enable_debug}" = "paranoid"; then
AC_DEFINE([DEBUG_CONTRACT],1,[Define to 1 if you want to activate design-by-contract debugging tests.])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(DO_BUILD_32_CONTRACT,[test "${enable_debug}" = "paranoid"])
# ---------------------------------------------------------------------------- #
#
# Optimizations
#
# NOTE: The optimizations will be taken from *FLAGS_OPTIM environment
# variables if enable_optim is set to yes, or set to predefined values
# for other optimization profiles.
#
ABI_MSG_SECTION([Optimizations])
# Init optimization flags
# Note: must be done only once debugging is configured
ABI_OPTIM_INIT([${enable_optim}])
# Get optimization flags from database when in profile mode
if test "${enable_optim}" != "no" -a "${enable_optim}" != "yes"; then
if test "${CFLAGS}" = ""; then
ABI_CC_OPTFLAGS
else
AC_MSG_NOTICE([optimization profile overriden by user-defined CFLAGS])
fi
if test "${CXXFLAGS}" = ""; then
ABI_CXX_OPTFLAGS
else
AC_MSG_NOTICE([optimization profile overriden by user-defined CXXFLAGS])
fi
if test "${FCFLAGS}" = ""; then
ABI_FC_OPTFLAGS
else
AC_MSG_NOTICE([optimization profile overriden by user-defined FCFLAGS])
fi
fi
# Disable optimization in directories containing big F90 files (efficiency is not critical here)
fcflags_opt_20_datashare="-O0"
fcflags_opt_43_ptgroups="-O0"
# Set per-directory Fortran optimizations
# Note: must be done only once FCFLAGS_OPTIM is set
ABI_OPTFLAGS_DIRS([${FCFLAGS_OPTIM}])
# ---------------------------------------------------------------------------- #
#
# 64-bit support
#
# NOTES:
#
# * This step requires that the hints have been looked for.
#
# * Please do not try to set-up the *_64BITS variables manually, as they
# will systematically be overwritten.
#
ABI_MSG_SECTION([64-bit support])
# Display status
AC_MSG_CHECKING([for a 64-bit architecture])
AC_MSG_RESULT([${abi_cpu_64bits}])
AC_MSG_CHECKING([whether to use 64-bit flags])
AC_MSG_RESULT([${enable_64bit_flags}])
AC_MSG_CHECKING([for user-defined 64-bit flags])
AC_MSG_RESULT([${with_64bit_flags}])
# C preprocessing
if test "${enable_64bit_flags}" = "yes"; then
AC_MSG_CHECKING([for 64-bit C preprocessor flags])
if test "${CPPFLAGS_64BITS}" = ""; then
AC_MSG_RESULT([none])
else
AC_MSG_RESULT([${CPPFLAGS_64BITS}])
CPP="${CPP} ${CPPFLAGS_64BITS}"
fi
else
CPPFLAGS_64BITS=""
fi
# C compilation
if test "${enable_64bit_flags}" = "yes"; then
AC_MSG_CHECKING([for 64-bit C flags])
if test "${CFLAGS_64BITS}" = ""; then
AC_MSG_RESULT([none])
else
AC_MSG_RESULT([${CFLAGS_64BITS}])
CC="${CC} ${CFLAGS_64BITS}"
fi
else
CFLAGS_64BITS=""
fi
# C++ preprocessing
if test "${XPP}" != ""; then
if test "${enable_64bit_flags}" = "yes"; then
AC_MSG_CHECKING([for 64-bit C++ preprocessor flags])
if test "${XPPFLAGS_64BITS}" = ""; then
AC_MSG_RESULT([none])
else
AC_MSG_RESULT([${XPPFLAGS_64BITS}])
XPP="${XPP} ${XPPFLAGS_64BITS}"
fi
else
XPPFLAGS_64BITS=""
fi
fi
# C++ compilation
if test "${CXX}" != ""; then
if test "${enable_64bit_flags}" = "yes"; then
AC_MSG_CHECKING([for 64-bit C++ flags])
if test "${CXXFLAGS_64BITS}" = ""; then
AC_MSG_RESULT([none])
else
AC_MSG_RESULT([${CXXFLAGS_64BITS}])
CXX="${CXX} ${CXXFLAGS_64BITS}"
fi
else
CXXFLAGS_64BITS=""
fi
fi
# Fortran preprocessing
if test "${FPP}" != ""; then
if test "${enable_64bit_flags}" = "yes"; then
AC_MSG_CHECKING([for 64-bit Fortran preprocessor flags])
if test "${FPPFLAGS_64BITS}" = ""; then
AC_MSG_RESULT([none])
else
AC_MSG_RESULT([${FPPFLAGS_64BITS}])
FPP="${FPP} ${FPPFLAGS_64BITS}"
fi
else
FPPFLAGS_64BITS=""
fi
fi
# Fortran compilation
if test "${enable_64bit_flags}" = "yes"; then
AC_MSG_CHECKING([for 64-bit Fortran flags])
if test "${FCFLAGS_64BITS}" = ""; then
AC_MSG_RESULT([none])
else
AC_MSG_RESULT([${FCFLAGS_64BITS}])
FC="${FC} ${FCFLAGS_64BITS}"
fi
else
FCFLAGS_64BITS=""
fi
# Archiver
if test "${enable_64bit_flags}" = "yes"; then
AC_MSG_CHECKING([for 64-bit archiver flags])
if test "${ARFLAGS_64BITS}" = ""; then
AC_MSG_RESULT([none])
else
AC_MSG_RESULT([${ARFLAGS_64BITS}])
AR="${AR} ${ARFLAGS_64BITS}"
fi
else
ARFLAGS_64BITS=""
fi
# ---------------------------------------------------------------------------- #
# ---------------------------------------------------------------------------- #
#
# Save configuration
#
ABI_MSG_SECTION([Build flags])
# Set-up target and binary package names
# Note: requires knowledge of Fortran compiler
ABI_INIT_TARGET
ABINIT_BINARY_PACKAGE="${PACKAGE}-${VERSION}_${ABINIT_TARGET}"
AC_SUBST(ABINIT_BINARY_PACKAGE)
# Final adjustments for library archiver
test "${ARFLAGS}" = "" && \
ARFLAGS="${ARFLAGS_64BITS} ${ARFLAGS_DEBUG} ${ARFLAGS_OPTIM} ${ARFLAGS_HINTS} ${ARFLAGS_EXTRA} ${ARFLAGS_CMD}"
# Final adjustments for C
test "${CFLAGS}" = "" && \
CFLAGS="${CFLAGS_64BITS} ${CFLAGS_DEBUG} ${CFLAGS_OPTIM} ${CFLAGS_HINTS} ${CFLAGS_EXTRA}"
test "${CC_LDFLAGS}" = "" && \
CC_LDFLAGS="${CC_LDFLAGS_64BITS} ${CC_LDFLAGS_DEBUG} ${CC_LDFLAGS_OPTIM} ${CC_LDFLAGS_HINTS} ${CC_LDFLAGS_EXTRA}"
test "${CC_LIBS}" = "" && \
CC_LIBS="${CC_LIBS_64BITS} ${CC_LIBS_DEBUG} ${CC_LIBS_OPTIM} ${CC_LIBS_HINTS} ${CC_LIBS_EXTRA}"
# Final adjustments for C++
test "${CXXFLAGS}" = "" && \
CXXFLAGS="${CXXFLAGS_64BITS} ${CXXFLAGS_DEBUG} ${CXXFLAGS_OPTIM} ${CXXFLAGS_HINTS} ${CXXFLAGS_EXTRA}"
test "${CXX_LDFLAGS}" = "" && \
CXX_LDFLAGS="${CXX_LDFLAGS_64BITS} ${CXX_LDFLAGS_DEBUG} ${CXX_LDFLAGS_OPTIM} ${CXX_LDFLAGS_HINTS} ${CXX_LDFLAGS_EXTRA}"
test "${CXX_LIBS}" = "" && \
CXX_LIBS="${CXX_LIBS_64BITS} ${CXX_LIBS_DEBUG} ${CXX_LIBS_OPTIM} ${CXX_LIBS_HINTS} ${CXX_LIBS_EXTRA}"
# Final adjustments for Fortran
# Note: FCFLAGS_OPTIM must not be included (per-directory optimizations)
test "${FCFLAGS}" = "" && \
FCFLAGS="${FCFLAGS_64BITS} ${FCFLAGS_DEBUG} ${FCFLAGS_HINTS} ${FCFLAGS_EXTRA} ${FCFLAGS_OPENMP}"
test "${FC_LDFLAGS}" = "" && \
FC_LDFLAGS="${FC_LDFLAGS_64BITS} ${FC_LDFLAGS_DEBUG} ${FC_LDFLAGS_OPTIM} ${FC_LDFLAGS_HINTS} ${FC_LDFLAGS_EXTRA}"
test "${FC_LIBS}" = "" && \
FC_LIBS="${FC_LIBS_64BITS} ${FC_LIBS_DEBUG} ${FC_LIBS_OPTIM} ${FC_LIBS_HINTS} ${FC_LIBS_EXTRA}"
# FIXME: temporary workaround for Macs
if test "${abi_cpu_platform}" = "apple"; then
AC_MSG_WARN([${abi_cpu_platform} is not able to handle full link information])
AC_MSG_WARN([static builds will fail])
else
AC_MSG_NOTICE([static builds may be performed])
FC_LIBS="${FC_LIBS} ${FCLIBS}"
fi
# Final adjustments for preprocessors
test "${CPPFLAGS}" = "" && \
CPPFLAGS="${CPPFLAGS_64BITS} ${CPPFLAGS_DEBUG} ${CPPFLAGS_OPTIM} ${CPPFLAGS_HINTS} ${CPPFLAGS_EXTRA}"
test "${XPPFLAGS}" = "" && \
XPPFLAGS="${XPPFLAGS_64BITS} ${XPPFLAGS_DEBUG} ${XPPFLAGS_OPTIM} ${XPPFLAGS_HINTS} ${XPPFLAGS_EXTRA}"
test "${FPPFLAGS}" = "" -a "${abi_fc_wrap}" = "no" && \
FPPFLAGS="${FPPFLAGS_64BITS} ${FPPFLAGS_DEBUG} ${FPPFLAGS_OPTIM} ${FPPFLAGS_HINTS} ${FPPFLAGS_EXTRA}"
# ---------------------------------------------------------------------------- #
# ---------------------------------------------------------------------------- #
#
# Advanced compiler features
#
# Note: these tests have to be performed after the flags have been
# saved.
ABI_MSG_SECTION([Advanced compiler features])
ABI_CC_FEATURES
ABI_FC_FEATURES
# ---------------------------------------------------------------------------- #
# ---------------------------------------------------------------------------- #
#
# Multicore architecture support
# Note: the following settings will be used by the connectors.
ABI_MSG_SECTION([Multicore architecture support])
# OpenMP support
AC_MSG_CHECKING([whether to enable OpenMP support])
AC_MSG_RESULT([${enable_openmp}])
if test "${enable_openmp}" = "yes"; then
AC_MSG_CHECKING([Fortran flags for OpenMP])
AC_MSG_RESULT([${FCFLAGS_OPENMP}])
ABI_OMP_CHECK_COLLAPSE
AC_MSG_NOTICE([OpenMP support is enabled in Fortran source code only])
fi
# MPI support
ABI_MPI_DETECT
if test "${enable_maintainer_checks}" = "yes"; then
ABI_MPI_DUMP
fi
# GPU support
ABI_GPU_DETECT
# ---------------------------------------------------------------------------- #
# ---------------------------------------------------------------------------- #
#
# Feature triggers
#
ABI_MSG_SECTION([Feature triggers])
# Init
abi_fallbacks=""
# Make sure ~/.abinit/tarballs exists
if test "${with_tardir}" = ""; then
abinit_tardir="${HOME}/.abinit/tarballs"
else
abinit_tardir="${with_tardir}"
fi
if test ! -e "${abinit_tardir}"; then
AC_MSG_NOTICE([creating ${abinit_tardir}])
${INSTALL} -d -m 755 "${abinit_tardir}"
fi
AC_MSG_NOTICE([using tarball repository ${abinit_tardir}])
AC_SUBST(abinit_tardir)
# Make fallbacks usable by Abinit
fallbacks_instdir="${abinit_builddir}/fallbacks/exports"
fallbacks_incs='-I$(fallbacks_instdir)/include'
AC_SUBST(fallbacks_instdir)
AC_SUBST(fallbacks_incs)
# Linear algebra support
ABI_LINALG_DETECT
# FIXME: copying linear algebra tarball for now
tmp_linalg_tarball="lapack-abinit_6.10.tar.gz"
if test ! -s "${abinit_tardir}/${tmp_linalg_tarball}"; then
AC_MSG_NOTICE([copying linear algebra tarball to tarball repository])
cp "${abinit_srcdir}/fallbacks/transient/${tmp_linalg_tarball}" \
"${abinit_tardir}"
fi
# External FFT support
ABI_CONNECT_FFT
# Parallel I/O support
# TODO
# LibXC support
# TODO
# ---------------------------------------------------------------------------- #
# ---------------------------------------------------------------------------- #
#
# Connectors to external packages
#