-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
233 lines (211 loc) · 6.79 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
AC_INIT(qopqdp, 0.21.1, [osborn at alcf.anl.gov])
AC_CONFIG_AUX_DIR(config)
#AM_INIT_AUTOMAKE
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_SRCDIR(include/qop.h)
AC_CONFIG_SRCDIR(lib/common.c)
AC_CONFIG_HEADER(include/qop_config.h)
dnl --enable-nc=<ColorLib>
AC_ARG_ENABLE(
nc,
AC_HELP_STRING([--enable-nc],
[make just the libraries necessary for the given color]),
AC_SUBST(NC, [$enableval]),
AC_SUBST(NC, [all])
)
if test "X$NC" = X; then NC="all"; fi
#for n in `echo $NC |tr , ' '`; do
if test "X$NC" = Xn; then NC="N"; fi
if test `expr $NC : '[0-9]*$' \& $NC \> 3` -ne 0; then NC="N"; fi
if test "X$NC" != X1 -a "X$NC" != X2 -a "X$NC" != X3 -a "X$NC" != XN; then NC="all"; fi
AM_CONDITIONAL(NC1, [test "X$NC" = "X1" -o "X$NC" = "Xall"])
AM_CONDITIONAL(NC2, [test "X$NC" = "X2" -o "X$NC" = "Xall"])
AM_CONDITIONAL(NC3, [test "X$NC" = "X3" -o "X$NC" = "Xall"])
AM_CONDITIONAL(NCN, [test "X$NC" = "XN" -o "X$NC" = "Xall"])
if test "X$NC" = "X1" -o "X$NC" = "Xall"; then
AC_DEFINE(HAVE_NC1, [], [build Nc=1 libraries])
fi
if test "X$NC" = "X2" -o "X$NC" = "Xall"; then
AC_DEFINE(HAVE_NC2, [], [build Nc=2 libraries])
fi
if test "X$NC" = "X3" -o "X$NC" = "Xall"; then
AC_DEFINE(HAVE_NC3, [], [build Nc=3 libraries])
fi
if test "X$NC" = "XN" -o "X$NC" = "Xall"; then
AC_DEFINE(HAVE_NCN, [], [build Nc=N libraries])
AC_DEFINE(USE_MG, [], [use multigrid])
fi
#done
dnl --enable-blas
AC_ARG_ENABLE(
blas,
AC_HELP_STRING([--enable-blas],
[enable routines that use blas (set LDFLAGS and LIBS to link to blas, see --enable-underscores)]),
if test "X${enableval}X" == "XyesX"; then
AC_DEFINE(HAVE_BLAS, [], [have blas])
fi
)
dnl --enable-lapack
AC_ARG_ENABLE(
lapack,
AC_HELP_STRING([--enable-lapack],
[enable routines that use lapack and blas (set LDFLAGS and LIBS to link to lapack and blas, see --enable-underscores)]),
if test "X${enableval}X" == "XyesX"; then
AC_DEFINE(HAVE_BLAS, [], [have blas])
AC_DEFINE(HAVE_LAPACK, [], [have lapack])
fi
)
dnl --enable-underscores
AC_ARG_ENABLE(
underscores,
AC_HELP_STRING([--enable-underscores],
[append underscores to lapack and blas routines]),
if test "X${enableval}X" == "XyesX"; then
AC_DEFINE(USE_UNDERSCORES, [], [use underscores])
fi
)
AC_ARG_WITH(
quda,
AC_HELP_STRING([--with-quda=<QUDA dir>],
[location of QUDA library]),
[QUDADIR="$with_quda"; WITH_QUDA=1]
)
AC_SUBST(QUDADIR)
CUDADIR="/usr/local/cuda"
AC_ARG_WITH(
cuda,
AC_HELP_STRING([--with-cuda=<CUDA dir>],
[location of CUDA library]),
[CUDADIR="$with_cuda"; WITH_CUDA=1]
)
AC_SUBST(CUDADIR)
AC_ARG_WITH(
qll,
AC_HELP_STRING([--with-qll=<QLL dir>],
[location of QLL library]),
[QLLDIR="$with_qll"; WITH_QLL=1]
)
AC_SUBST(QLLDIR)
AC_ARG_WITH(
qdp,
AC_HELP_STRING([--with-qdp=<QDP dir>],
[location of QDP libraries]),
[QDPDIR="$with_qdp"; WITH_QDP=1]
)
AC_SUBST(QDPDIR)
AC_ARG_WITH(
qla,
AC_HELP_STRING([--with-qla=<QLA dir>],
[location of QLA libraries]),
[QLADIR="$with_qla"; WITH_QLA=1]
)
AC_SUBST(QLADIR)
AC_ARG_WITH(
qio,
AC_HELP_STRING([--with-qio=<QIO dir>],
[location of QIO libraries]),
[QIODIR="$with_qio"; WITH_QIO=1]
)
AC_SUBST(QIODIR)
AC_ARG_WITH(
qmp,
AC_HELP_STRING([--with-qmp=<QMP dir>],
[location of QMP libraries]),
[QMPDIR="$with_qmp"; WITH_QMP=1]
)
AC_SUBST(QMPDIR)
if test -n "$WITH_QUDA"; then
AC_DEFINE(HAVE_QUDA, [], [use quda])
AC_SUBST(QUDA_CFLAGS, "-I${CUDADIR}/include -I${QUDADIR}/include")
AC_SUBST(QUDA_LIBS, "${QUDADIR}/lib/libquda.a")
AC_SUBST(CUDA_LIBS, "${CUDADIR}/lib64/libcudart_static.a -ldl")
fi
if test -n "$WITH_QLL"; then
AC_DEFINE(HAVE_QLL, [], [use qll])
AC_SUBST(QLL_CFLAGS, "-I${QLLDIR}/include")
AC_SUBST(QLL_LIBS, "${QLLDIR}/lib/libqll.a")
fi
AC_SUBST(QDP_CFLAGS, "-I${QDPDIR}/include")
AC_SUBST(QDP_LDFLAGS, "-L${QDPDIR}/lib")
AC_SUBST(QLA_CFLAGS, "-I${QLADIR}/include")
AC_SUBST(QLA_LDFLAGS, "-L${QLADIR}/lib")
if test "X$NC" = "X2" -o "X$NC" = "Xall"; then
qdplibs="$qdplibs -lqdp_df2 -lqdp_f2 -lqdp_d2"
qlalibs="$qlalibs -lqla_df2 -lqla_f2 -lqla_d2"
fi
if test "X$NC" = "X3" -o "X$NC" = "Xall"; then
qdplibs="$qdplibs -lqdp_df3 -lqdp_f3 -lqdp_d3"
qlalibs="$qlalibs -lqla_df3 -lqla_f3 -lqla_d3"
fi
if test "X$NC" = "XN" -o "X$NC" = "Xall"; then
qdplibs="$qdplibs -lqdp_dfn -lqdp_fn -lqdp_dn"
qlalibs="$qlalibs -lqla_dfn -lqla_fn -lqla_dn"
fi
qdplibs="$qdplibs -lqdp_df -lqdp_f -lqdp_d -lqdp_int -lqdp_common"
qlalibs="$qlalibs -lqla_df -lqla_f -lqla_d -lqla_int -lqla_random -lqla_cmath -lm"
AC_SUBST(QDP_LIBS, $qdplibs)
AC_SUBST(QLA_LIBS, $qlalibs)
AC_SUBST(QIO_CFLAGS, "-I${QIODIR}/include")
AC_SUBST(QIO_LDFLAGS, "-L${QIODIR}/lib")
AC_SUBST(QIO_LIBS, "-lqio -llime")
# get QMP configuration
if test "X${QMPDIR}X" = "XX" ; then
AC_PATH_PROG([QMP_CONFIG], [qmp-config], [], [${PATH}])
else
AC_PATH_PROG([QMP_CONFIG], [qmp-config], [], [${QMPDIR}/bin ${PATH}])
fi
if test "X${QMP_CONFIG}X" != "XX" ; then
AC_MSG_NOTICE([Found QMP configuration program ${QMP_CONFIG}])
# use the QMP CC unless it is explicitly set by the user
if ! set | grep -q '^CC=' ; then
AC_SUBST(CC, "`${QMP_CONFIG} --cc`")
AC_MSG_NOTICE([QMP compiler: ${CC}])
fi
AC_SUBST(QMP_CFLAGS, "`${QMP_CONFIG} --cflags`")
AC_MSG_NOTICE([QMP compile flags: ${QMP_CFLAGS}])
AC_SUBST(QMP_LDFLAGS, "`${QMP_CONFIG} --ldflags`")
AC_MSG_NOTICE([QMP linking flags: ${QMP_LDFLAGS}])
AC_SUBST(QMP_LIBS, "`${QMP_CONFIG} --libs`")
AC_MSG_NOTICE([QMP libraries flags: ${QMP_LIBS}])
else
AC_MSG_WARN([QMP configuration program qmp-config not found.])
AC_MSG_WARN([Set environment variables QMP_CFLAGS QMP_LDFAGS QMP_LIBS
before configure])
fi
if set | grep -q '^LD=' ; then
AC_SUBST(CCLD, "${LD}")
AC_MSG_NOTICE([Using linker: ${LD}])
else
AC_SUBST(CCLD, "${CC}")
fi
CFLAGS="$CFLAGS $QUDA_CFLAGS $QLL_CFLAGS $QDP_CFLAGS $QLA_CFLAGS $QIO_CFLAGS $QMP_CFLAGS"
LDFLAGS="$LDFLAGS $QDP_LDFLAGS $QLA_LDFLAGS $QIO_LDFLAGS $QMP_LDFLAGS"
LIBS="$QUDA_LIBS $QLL_LIBS $QDP_LIBS $QLA_LIBS $QIO_LIBS $QMP_LIBS $CUDA_LIBS $LIBS"
# Checks for programs.
AC_PROG_RANLIB
#AC_DISABLE_SHARED
#AC_PROG_LIBTOOL
AC_PROG_CC([c99 cc gcc])
AC_CHECK_TOOL(AR, ar, [ar])
AM_PROG_CC_C_O
#AC_PROG_CC_C99
# pass configuration to distcheck target
DISTCHECK_CONFIGURE_FLAGS="CC=\"$CC\" CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS\" LIBS=\"$LIBS\""
if test -n "$WITH_QMP"; then
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-qmp=$QMPDIR"
fi
if test -n "$WITH_QIO"; then
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-qio=$QIODIR"
fi
if test -n "$WITH_QLA"; then
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-qla=$QLADIR"
fi
if test -n "$WITH_QDP"; then
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-qdp=$QDPDIR"
fi
AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(include/Makefile)
AC_CONFIG_FILES(lib/Makefile)
AC_CONFIG_FILES(examples/Makefile)
AC_OUTPUT