forked from smarco/gem3-mapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
187 lines (172 loc) · 5.4 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
###############################################################################
# GEM-Mapper v3 (GEM3)
# Copyright (c) 2011-2018 by Santiago Marco-Sola <[email protected]>
# Copyright (c) 2011-2018 by Alejandro Chacon <[email protected]>
#
# This file is part of GEM-Mapper v3 (GEM3).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# PROJECT: GEM-Mapper v3 (GEM3)
# AUTHOR(S): Santiago Marco-Sola <[email protected]>
# Alejandro Chacon <[email protected]>
###############################################################################
AC_INIT([GEMMapper],[3.0])
AC_PROG_CC
AC_CHECK_LIB([z], [gzopen], [HAVE_ZLIB=1])
AC_SUBST([HAVE_ZLIB])
AC_CHECK_LIB([bz2], [BZ2_bzReadOpen], [HAVE_BZLIB=1])
AC_CHECK_HEADERS([bzlib.h],[HAVE_BZLIB=1],AC_MSG_WARN([Compiling GEM without bzlib support]))
AC_SUBST([HAVE_BZLIB])
# LTO configure parameters
AC_ARG_ENABLE([lto],
AC_HELP_STRING([--enable-lto],[Enables or Disables Linktime Code Optimization (default=yes)]),
[
enable_lto="$enableval"
case $enableval in
"no");;
"yes");;
*) AC_MSG_ERROR([[invalid argument --enable-lto=$disableval... stopping]]);;
esac
],
[enable_lto="yes"]
)
# LTO & GOLD plugins test
if test "$enable_lto" != "no" ; then
# Checking for the Link time optimization (LTO)
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -flto"
AC_MSG_CHECKING([whether $CC supports -flto])
AC_RUN_IFELSE(
[AC_LANG_SOURCE([
int main(int argc, char **argv){
return 0;
}
])],
[
AC_MSG_RESULT([yes])
AC_SUBST([HAVE_LTO], [1])
],
[
AC_MSG_RESULT([no])
AC_SUBST([HAVE_LTO], [0])
AC_MSG_WARN([Compiler without link time optimization (LTO) support])
]
)
CFLAGS="$OLD_CFLAGS"
# Checking for the LD.GOLD plugins
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fuse-linker-plugin"
AC_MSG_CHECKING([whether $CC supports -fuse-linker-plugin])
AC_RUN_IFELSE(
[AC_LANG_SOURCE([
int main(int argc, char **argv){
return 0;
}
])],
[
AC_MSG_RESULT([yes])
AC_SUBST([HAVE_GOLD], [1])
],
[
AC_MSG_RESULT([no])
AC_MSG_WARN([Linker without plugins support for LTO])
AC_SUBST([HAVE_GOLD], [0])
]
)
CFLAGS="$OLD_CFLAGS"
else
AC_SUBST([HAVE_LTO], [0])
AC_SUBST([HAVE_GOLD], [0])
fi
# CUDA configure parameters
AC_ARG_ENABLE([cuda],
AC_HELP_STRING([--enable-cuda],[Enables or Disables CUDA support (default=yes)]),
[
enable_lto="$enableval"
case $enableval in
"no");;
"yes");;
*) AC_MSG_ERROR([[invalid argument --enable-cuda=$disableval... stopping]]);;
esac
],
[enable_cuda="yes"]
)
# CUDA test
if test "$enable_cuda" != "no" ; then
# Provide custom CUDA path or set to default
AC_ARG_WITH([cuda], [ --with-cuda=PREFIX Prefix of your CUDA installation path (default=/usr/local/cuda)],
[cuda_sdk_prefix=$withval],
[cuda_sdk_prefix="/usr/local/cuda"])
# Checking for nvcc
VALID_CUDA=yes
AC_MSG_CHECKING([nvcc in $cuda_sdk_prefix/bin])
if test -x "$cuda_sdk_prefix/bin/nvcc"; then
AC_MSG_RESULT([yes])
cuda_bin_path="$cuda_sdk_prefix/bin"
cuda_lib_path="$cuda_sdk_prefix/lib64"
cuda_include_path="$cuda_sdk_prefix/include"
else
AC_MSG_RESULT([not found])
cuda_repo_prefix="/usr"
AC_MSG_CHECKING([for alternative nvcc location in $cuda_repo_prefix/bin])
if test -x "$cuda_repo_prefix/bin/nvcc"; then
AC_MSG_RESULT([yes])
cuda_bin_path="$cuda_repo_prefix/bin"
cuda_lib_path="$cuda_repo_prefix/lib/x86_64-linux-gnu"
cuda_include_path="$cuda_repo_prefix/include"
else
AC_MSG_WARN([Couldn't find cuda nvcc compiler])
VALID_CUDA=no
fi
fi
# Saving the current flags
ax_save_CFLAGS="${CPPFLAGS}"
ax_save_LDFLAGS="${LDFLAGS}"
AC_CHECK_FILE([$cuda_lib_path],
[
LDFLAGS+=" -L$cuda_lib_path -L$cuda_lib_path/stubs"
AC_CHECK_LIB([cuda], [main], , [VALID_CUDA=no])
AC_CHECK_LIB([cudart], [main], , [VALID_CUDA=no])
],
[
AC_MSG_WARN([Couldn't find cuda lib directory])
VALID_CUDA=no
])
AC_CHECK_FILE([$cuda_include_path],
[
CPPFLAGS+=" -I$cuda_include_path"
AC_CHECK_HEADERS([cuda.h cuda_runtime.h], , [VALID_CUDA=no])
],
[
AC_MSG_WARN([Couldn't find cuda include directory])
VALID_CUDA=no
])
if test "x$VALID_CUDA" = xyes ; then
AC_SUBST([HAVE_CUDA], [1])
AC_SUBST([CUDA_BIN_PATH], [$cuda_bin_path])
AC_SUBST([CUDA_LIB_PATH], [$cuda_lib_path])
AC_SUBST([CUDA_INCLUDE_PATH], [$cuda_include_path])
else
AC_SUBST([HAVE_CUDA], [0])
AC_MSG_WARN([Building the binaries without CUDA support])
fi
else
AC_SUBST([HAVE_CUDA], [0])
fi
# Returning to the original flags
CFLAGS=${ax_save_CPPFLAGS}
LDFLAGS=${ax_save_LDFLAGS}
AC_CONFIG_FILES([Makefile.mk])
AC_OUTPUT