Newer
Older
[M4_HDF5_LIB],
[
cat > nptm_test_hdf5.cpp <<EOF
#include <hdf5.h>
int main(int argc, char **argv) {
hid_t file_id = 0;
herr_t status = H5Iis_valid(file_id);
return (int)status;
}
EOF
$CXX -o nptm_test_hdf5 nptm_test_hdf5.cpp -I$HDF5_INCLUDE -L$HDF5_LIB -lhdf5 > /dev/null 2>>error.log
export TEST_HDF5_LIB=$?
rm nptm_test_hdf5.cpp
if test "x$TEST_HDF5_LIB" = "x0"; then
rm nptm_test_hdf5
fi
]
)
m4_define(
[M4_DETECT_LAPACK],
[
LAPACK_ROOT=$MKLROOT
if test "x$LAPACK_ROOT" != "x"; then
export LAPACK_INCLUDE=$(MKLROOT)/include
export LAPACK_LIB=$(MKLROOT)/lib
export LAPACK_LIBRARY="-Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl"
else
export LAPACK_INCLUDE=/usr/include
export LAPACK_LIB=/lib/x86_64-linux-gnu
export LAPACK_LIBRARY="-llapacke64"
fi
]
# END CAPABILITY TESTING MACROS
# autoconf setup initialization
AC_INIT([np_tmcode], [8.04], [giovanni.lamura@inaf.it])
# Folder structure safety check
AC_CONFIG_SRCDIR([../src/libnptm/TransitionMatrix.cpp])
AC_CONFIG_AUX_DIR([build_aux])
# automake initialization
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
# Compiler detection
AM_PROG_AR
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
[mpi],
[AS_HELP_STRING([--enable-mpi], [use MPI if available [default=yes]])],
[
if test "x$enableval" = "xno"; then
if test "x$F77" = "xmpif90"; then
gfortran --version > /dev/null
if test "x$?" = "x0"; then
AC_SUBST([F77], [gfortran])
fi
fi
if test "x$F77" = "xmpif90"; then
f77 --version > /dev/null
if test "x$?" = "x0"; then
#export F77=f77
AC_SUBST([F77], [f77])
fi
fi
if test "x$CXX" = "xmpicxx"; then
g++ --version > /dev/null
if test "x$?" = "x0"; then
#export CXX=g++
AC_SUBST([CXX], [g++])
fi
fi
if test "x$CXX" = "xmpicxx"; then
clang --version > /dev/null
if test "x$?" = "x0"; then
#export CXX=clang
AC_SUBST([CXX], [clang])
fi
fi
if test "x$F77" = "x"; then
gfortran --version > /dev/null
if test "x$?" = "x0"; then
#export F77=gfortran
AC_SUBST([F77], [gfortran])
fi
fi
if test "x$F77" = "x"; then
f77 --version > /dev/null
if test "x$?" = "x0"; then
#export F77=f77
AC_SUBST([F77], [f77])
fi
fi
if test "x$CXX" = "x"; then
g++ --version > /dev/null
if test "x$?" = "x0"; then
#export CXX=g++
AC_SUBST([CXX], [g++])
fi
fi
if test "x$CXX" = "x"; then
clang --version > /dev/null
if test "x$?" = "x0"; then
#export CXX=clang
AC_SUBST([CXX], [clang])
fi
fi
else
mpicxx --version > /dev/null
if test "x$?" = "x0"; then
#export CXX=mpicxx
#export F77=mpif90
AC_SUBST([CXX], [mpicxx])
AC_SUBST([F77], [mpif90])
else
AC_MSG_ERROR(["MPI was enabled, but no MPI compiler was found!"])
fi
fi
],
[
if test "x$CXX" = "x"; then
mpicxx --version > /dev/null
if test "x$?" = "x0"; then
#export CXX=mpicxx
#export F77=mpif90
AC_SUBST([CXX], [mpicxx])
AC_SUBST([F77], [mpif90])
fi
fi
if test "x$CXX" = "x"; then
g++ --version > /dev/null
if test "x$?" = "x0"; then
#export CXX=g++
AC_SUBST([CXX], [g++])
fi
fi
if test "x$CXX" = "x"; then
clang --version > /dev/null
if test "x$?" = "x0"; then
#export CXX=clang
AC_SUBST([CXX], [clang])
fi
fi
]
AC_PROG_CXX([$CXX])
AC_PROG_F77([$F77])
# Libtool initialization
LT_INIT
# Environment setup
AS_IF(
[test "x$HDF5_INCLUDE" = "x"],
[AC_SUBST([HDF5_INCLUDE], ["/usr/include/hdf5/serial"])],
[AC_MSG_NOTICE([HDF5_INCLUDE=$(HDF5_INCLUDE)])]
[test "x$HDF5_LIB" = "x"],
[AC_SUBST([HDF5_LIB], ["/usr/lib/x86_64-linux-gnu/hdf5/serial"])],
[AC_MSG_NOTICE([HDF5_LIB=$(HDF5_LIB)])]
# Check for required headers
AC_CHECK_HEADER(
[$HDF5_INCLUDE/hdf5.h],
,
AC_MSG_ERROR(["Could not find HDF5 headers!]),
)
# Check for required libraries
M4_HDF5_LIB
AS_IF(
[test "x$TEST_HDF5_LIB" = "x0"],
[AC_SUBST([HDF5_LDFLAGS], ["-L${HDF5_LIB} -lhdf5"])],
[AC_MSG_ERROR(["HDF5 library not found!"])]
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
M4_DETECT_LAPACK
AS_IF(
[test "x$LAPACK_LIBRARY" != "x"],
[AC_MSG_NOTICE([LAPACK detected])],
[AC_MSG_NOTICE([No LAPACK found])]
)
AC_ARG_ENABLE(
[openmp],
[AS_HELP_STRING([--enable-openmp], [enable OpneMP multi-threading [default=yes]])],
[
if test "x$enableval" != "xno"; then
AC_SUBST([OMPFLAGS], ["-fopenmp"])
fi
],
[
AC_SUBST([OMPFLAGS], ["-fopenmp"])
]
)
AC_ARG_WITH(
[lapack],
[AS_HELP_STRING([--with-lapack], [use LAPACK @<:@default=check@:>@])],
[
if test "x$withval" = "xno"; then
AC_SUBST([LAPACK_FLAGS], [""])
AC_SUBST([LAPACK_LDFLAGS], [""])
fi
],
[
if test "x$LAPACK_INCLUDE" != "x"; then
AC_SUBST([LAPACK_FLAGS], ["-DUSE_LAPACK -DLAPACK_ILP64 -DUSE_ILP64 -I${LAPACK_INCLUDE}"])
AC_SUBST([LAPACK_LDFLAGS], ["-L${LAPACK_LIB} ${LAPACK_LIBRARY}"])
fi
]
)
AC_ARG_WITH(
[magma],
[AS_HELP_STRING([--with-magma], [use MAGMA @<:@default=check@:>@])],
[],
[]
)
AC_ARG_ENABLE(
[ilp64],
[AS_HELP_STRING([--enable-ilp64], [use MAGMA @<:@default=check@:>@])],
[],
[]
)
FFLAGS="-std=legacy -O3"
CXXFLAGS="-O3 -ggdb -Wno-format-contains-nul -I$HDF5_INCLUDE $OMPFLAGS $LAPACK_FLAGS"
SUBDIRS="cluster libnptm sphere testing trapping"
# Send output to Makefiles
AC_CONFIG_FILES([Makefile])
# Generate the output
AC_OUTPUT