-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ac
More file actions
118 lines (103 loc) · 3.17 KB
/
configure.ac
File metadata and controls
118 lines (103 loc) · 3.17 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([QS3-ED2], [1.0.0],[qsss.inquiry{at}gmail.com])
AC_CONFIG_SRCDIR([source/main.f90])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign])
# Checks for compilers
AC_PROG_CC
FCFLAGS_PRESERVE=$FCFLAGS
AC_LANG(Fortran)
AC_PROG_FC(ifort gfortran)
FCFLAGS=$FCFLAGS_PRESERVE
## FCFLAGS:
case "$FC" in
gfortran*)
test -n "$FCFLAGS" || FCFLAGS="-fopenmp -Ofast"
;;
ifort)
test -n "$FCFLAGS" || FCFLAGS="-O3 -ipo -no-prec-div -fp-model fast=2 -xHost -parallel -qopenmp"
;;
esac
## LAPACK / BLAS
AC_ARG_WITH(lapack,[AS_HELP_STRING([--with-lapack=ARG],[LAPACK library.
ARG must be one of
lapack (default),
mkl (Intel MKL).])])
case "$with_lapack" in
lapack | yes | "")
BLAS_FOUND=no
AC_CHECK_LIB(openblas, dsymv,
[AC_MSG_NOTICE([BLAS... found in -lopenblas])
BLAS_LIBS="-lopenblas"
BLAS_FOUND=yes],
[AC_CHECK_LIB(blas, dsymv,
[AC_MSG_NOTICE([BLAS... found in -lblas])
BLAS_LIBS="-lblas"
BLAS_FOUND=yes],
[AC_CHECK_LIB(f77blas, dsymv,
[AC_MSG_NOTICE([BLAS... found in -lf77blas])
BLAS_LIBS="-lf77blas"
BLAS_FOUND=yes],
[BLAS_FOUND=no])])])
# MKL fallback (only when FC=ifort)
if test "x$BLAS_FOUND" = "xno" && echo "$FC" | grep -q '^ifort'; then
AC_MSG_NOTICE([BLAS... not found; falling back to Intel MKL (-qmkl=parallel)])
LIBS="$LIBS -qmkl=parallel"
BLAS_FOUND=yes
BLAS_LIBS=""
fi
if test "x$BLAS_FOUND" = "xno"; then
AC_MSG_ERROR([BLAS library not found.
Try loading a BLAS module or re-run configure with explicit LIBS/LDFLAGS.])
fi
# LAPACK
LAPACK_FOUND=no
AC_CHECK_LIB(lapack, dsyevx,
[AC_MSG_NOTICE([LAPACK... found in -llapack])
LAPACK_LIBS="-llapack"
LAPACK_FOUND=yes],
[LAPACK_FOUND=no])
# Assume MKL provides LAPACK if -qmkl=parallel is active
if test "x$LAPACK_FOUND" = "xno" && echo "$LIBS" | grep -q -- '-qmkl=parallel'; then
AC_MSG_NOTICE([LAPACK... assuming MKL provides LAPACK via -qmkl=parallel])
LAPACK_FOUND=yes
LAPACK_LIBS=""
fi
if test "x$LAPACK_FOUND" = "xno"; then
AC_MSG_ERROR([LAPACK library not found.
Try loading a LAPACK module or re-run configure with explicit LIBS/LDFLAGS.])
fi
LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS"
;;
mkl)
case "$FC" in
ifort)
AC_MSG_NOTICE([Using Intel MKL via -qmkl=parallel])
LIBS="$LIBS -qmkl=parallel"
;;
*)
AC_MSG_ERROR([--with-lapack=mkl requires Intel ifort compiler])
;;
esac
;;
*)
AC_MSG_ERROR([Unknown LAPACK option: $with_lapack])
;;
esac
AC_CONFIG_FILES([
Makefile
source/Makefile
tests/Makefile
script_chain/Makefile
script_cubic/Makefile
script_cubic_sp_HB/Makefile
script_honeycomb/Makefile
script_j1j2_chain/Makefile
script_kagome/Makefile
script_mixed_spin_chain/Makefile
script_square/Makefile
script_triangular/Makefile
])
AC_OUTPUT