forked from GenABEL-Project/OmicABELnoMM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
185 lines (150 loc) · 5.67 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
AC_INIT([OmicABELnoMM], [0.1.0], [[email protected]])
AM_INIT_AUTOMAKE([])
AM_INIT_AUTOMAKE([silent-rules subdir-objects])
AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR([src/Utility.h])
AC_CONFIG_HEADERS([src/config.h])
# Add the --disable-maintainer-mode option used by e.g. Debian and
# Gentoo to disable rebuilding the autotools-generated files after
# e.g. a patch has been applied to them. The default is 'disabled', we
# change it here to keep the old behaviour by default.
AM_MAINTAINER_MODE([enable])
# Set some default compile flags
if test -z "$CXXFLAGS"; then
# User did not set CXXFLAGS, so we can put in our own defaults
CXXFLAGS=" -O3 -std=c++11 -march=native -mfpmath=sse -flto -funroll-loops"
#CXXFLAGS="-g -ggdb -std=c++11"
fi
if test -z "$CPPFLAGS"; then
# User did not set CPPFLAGS, so we can put in our own defaults
CPPFLAGS="-Wall -pedantic -Wunused-result -Wmaybe-uninitialized -Wformat"
#CPPFLAGS="-O0"
fi
# If CXXFLAGS/CPPFLAGS are already set AC_PROG_CXX will not overwrite them
# with its own defaults
# If --with-mpi=auto is used, try to find MPI, but use standard C
# compiler if it is not found.
# If --with-mpi=yes is used, try to find MPI and fail if it isn't found.
# If --with-mpi=no is used, use a standard C compiler instead.
AC_ARG_WITH(mpi,
[AS_HELP_STRING([--with-mpi],
[compile with MPI (distributed memory parallelization) support. If\
none is found, MPI is not used. Default: auto])
]
,
,
[with_mpi=auto])
# AC_PROG_CXX_MPI will run AC_PROG_CXX if no MPI compiler can be found.
AX_PROG_CXX_MPI([test "x$with_mpi" != "xno"],
[use_mpi=yes],
[use_mpi=no
if test "x$with_mpi" = "xyes"; then
AC_MSG_FAILURE([MPI compiler requested, but couldn't find MPI.])
elif test "x$with_mpi" = "xauto"; then
AC_MSG_NOTICE([No MPI compiler found, continuing without MPI.])
else
AC_MSG_NOTICE([Use of MPI disabled by user.])
fi]
)
AM_CONDITIONAL([USE_MPI], test "x$use_mpi" = "xyes")
# Check for openMP. If found the OPENMP_CXXFLAGS is set automatically
AC_OPENMP
AC_SUBST(AM_CXXFLAGS, "$OPENMP_CFLAGS")
#AM_CXXFLAGS="-static -g -ggdb -I../libs/include -I./libs/include $AM_CXXFLAGS"
# Checks for libraries.
# pthread library
AC_SEARCH_LIBS([pthread_mutex_init], [pthread], [],
[AC_MSG_ERROR([Make sure pthread is available on the system])]
)
found_blas=0
AC_SEARCH_LIBS([__iso_c_binding_c_f_pointer_l4],[gfortran])
# ACML
AC_SEARCH_LIBS(dgemm, acml_mp,
[found_blas=1 AM_CXXFLAGS="-D_acml_ $AM_CXXFLAGS"],
[AC_MSG_NOTICE([NOT using AMD the ACML library])],
[-lgfortran]
)
if test "$found_blas" -eq 0; then
# Openblas
AC_SEARCH_LIBS([cblas_sgemm], [openblas],
[AM_CXXFLAGS="$AM_CXXFLAGS -D_openblas_"],
[AC_MSG_ERROR([OpenBLAS library NOT found])]
)
#Lapack
AC_SEARCH_LIBS([LAPACKE_sgeqrf], [lapack, lapacke],
[],
[AC_MSG_ERROR([Unable to find a Lapack library])]
)
AC_MSG_NOTICE([Using OpenBLAS library])
fi
# Checks for header files.
AC_CHECK_HEADERS([limits.h stdlib.h string.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
#AC_CHECK_HEADER_STDBOOL # USE THIS WITH AUTOCONF 2.69
AC_HEADER_STDBOOL
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([clock_gettime gettimeofday memset])
# Add an option to ./configure that allows the user to specify a path
# to the Boost headers, also include the default Boost path to the
# compiler flags.
AC_ARG_WITH([boost-include-path],
[AS_HELP_STRING([--with-boost-include-path],
[location of the Boost math headers, defaults to /usr/include/boost/]
)
],
[AC_SUBST(CPPFLAGS, "$CPPFLAGS -I${withval}")],
[AC_SUBST(CPPFLAGS, "$CPPFLAGS -I/usr/include/boost/")]
)
# Check for the Boost Math header files; this uses a compile check, so
# make sure C++ is selected first.
AC_LANG_PUSH([C++])
AC_CHECK_HEADER([math/distributions.hpp],
[],
[AC_MSG_ERROR([Could not find the Boost Math header files, did you \
specify the --with-boost-include-path option correctly?])]
)
AC_LANG_POP([C++])
# The user can disable building of the PDF of the manual, for example
# if the required LaTeX packages are not installed
AC_ARG_ENABLE([latex-doc],
[AS_HELP_STRING([--disable-latex-doc], [disable building the PDF
documentation from LaTeX source (default: enabled)])],
[latexdoc=no],
[latexdoc=yes])
if test "x$latexdoc" = "xyes"; then
AC_MSG_NOTICE([building of the PDF of the user manual from LaTeX source is enabled])
# Check for presence of pdfLaTeX
AC_CHECK_PROGS(PDFLATEX, pdflatex)
if test -z "$PDFLATEX"; then
AC_MSG_NOTICE([pdflatex not found - Unable to create PDF version of the user manual])
fi
fi
AM_CONDITIONAL([HAVE_PDFLATEX], test -n "$PDFLATEX")
AM_CONDITIONAL([BUILD_latexdoc], test "x$latexdoc" = "xyes")
# By default building the example data is disabled because it takes
# relatively long. The user can enable building of the
AC_ARG_ENABLE([examples],
[AS_HELP_STRING([--enable-examples], [enable building the example
data data files from R source code (default: disabled)])],
[examples=yes],
[examples=no])
if test "x$examples" = "xyes"; then
AC_MSG_NOTICE([building of the example data files is enabled])
# Check for presence of R
AC_CHECK_PROGS(R, R)
if test -z "$R"; then
AC_MSG_NOTICE([R not found - Unable to create example data files])
fi
fi
AM_CONDITIONAL([HAVE_R], test -n "$R")
AM_CONDITIONAL([BUILD_examples], test "x$examples" = "xyes")
# Files to be generated by autotools
AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT