-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
224 lines (182 loc) · 8.49 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
m4_define([idemuxCPP_version_major], [0])
m4_define([idemuxCPP_version_minor], [3])
m4_define([idemuxCPP_version_patch], [0])
m4_define([my_url], [https://github.com/Lexogen-Tools/idemuxcpp])
AC_PREREQ([2.59])
# 5 argument version only available with aclocal >= 2.64
AC_INIT([idemuxcpp],[idemuxCPP_version_major.idemuxCPP_version_minor.idemuxCPP_version_patch],[],[idemuxcpp],[my_url ])
AC_CANONICAL_HOST
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_SRCDIR([src/idemuxCPP.cpp])
AC_CONFIG_MACRO_DIR([m4])
# backwards compatibility for autoconf >= 2.64
# PACKAGE_URL should be the fifth argument of AC_INIT
m4_ifndef([AC_PACKAGE_URL],
[m4_define([AC_PACKAGE_URL], [my_url])
AC_DEFINE(PACKAGE_URL, "AC_PACKAGE_URL", [Package URL])
AC_SUBST(PACKAGE_URL, AC_PACKAGE_URL)])
lt_enable_auto_import=""
case "$host_os" in
cygwin* | mingw* | cegcc*)
AM_LDFLAGS="-Wl,--enable-auto-import $AM_LDFLAGS"
esac
# Checks for programs
# check for C++ compiler
# store current compiler flags to avoid default setup via AC_PROG_CXX and *_CC
OLD_CXXFLAGS=$CXXFLAGS
OLD_CFLAGS=$CFLAGS
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_CHECK_PROG([HAVE_PKG_CONFIG], [pkg-config], [yes],[no])
# reset compiler flags to initial flags
CXXFLAGS=$OLD_CXXFLAGS
CFLAGS=$OLD_CFLAGS
# automake initialisation (mandatory) and check for minimal automake API version
AM_INIT_AUTOMAKE([1.9])
# use the C++ compiler for the following checks
AC_LANG([C++])
###############################################################################
###############################################################################
############ PARAMETERS ########################################
###############################################################################
# SETUP FOR COMPILATION WITH 2011 ISO C++ STANDARD
###############################################################################
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
###############################################################################
# DEBUG SUPPORT SETUP
###############################################################################
AC_MSG_CHECKING([whether to build with debug information])
debuger=no
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[enable debug data generation (def=no)])],
[debuger="$enableval"])
AC_MSG_RESULT([$debuger])
if test x"$debuger" = x"yes"; then
AC_DEFINE([DEBUG], [], [Run in DEBUG mode with additional assertions and debug output])
AM_CXXFLAGS="$AM_CXXFLAGS -g -Wno-uninitialized -O0 -pthread"
AM_LDFLAGS="$AM_LDFLAGS -g -Wno-uninitialized -O0"
#AM_CXXFLAGS="$AM_CXXFLAGS -g -O0 -Wall -Werror -Wno-uninitialized -Wno-deprecated"
else
AC_DEFINE([NDEBUG], [], [Run in normal mode with minimal assertions])
AM_CXXFLAGS="$AM_CXXFLAGS -O3 -fno-strict-aliasing -Wno-uninitialized -Wno-deprecated"
fi
AX_PTHREAD([], [
AC_MSG_FAILURE([ERROR: please install the pthread library!])
])
LIBS="$PTHREAD_LIBS $LIBS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
m4_define([AMINCLUDE_STATIC], [aminclude_static.am])
# m4_define([CODE_COVERAGE_DIRECTORY], [src])
# m4_define([CODE_COVERAGE_BRANCH_COVERAGE], [0])
# m4_define([CODE_COVERAGE_LCOV_SHOPTS_DEFAULT], [--no-recursion])
# AC_SUBST([CODE_COVERAGE_LCOV_SHOPTS_DEFAULT], [--no-recursion])
# CODE_COVERAGE_LCOV_SHOPTS_DEFAULT="--no-recursion"
AX_CODE_COVERAGE()
############ CHECKS ############################################
# check for gzlib, dl, boost etc.
AC_LIB_HAVE_LINKFLAGS([z], [], [#include <zlib.h>], [], [zlib is missing!])
if test "$HAVE_LIBZ" != "yes"; then
AC_MSG_FAILURE([ERROR: please install the zlib library!])
fi
AC_LIB_LINKFLAGS([dl])
# check for bamtools-dev
AC_ARG_ENABLE(bamtools,
AS_HELP_STRING([--disable-bamtools], [Disable bamtools]))
AM_CONDITIONAL(DISABLE_BAMTOOLS, test x$enable_bamtools = xno)
HAVE_LIBBAMTOOLS=no
if test x$enable_bamtools != xno; then
AS_IF([test "$HAVE_PKG_CONFIG" = "yes"],[
PKG_CHECK_MODULES([BAMTOOLS], [bamtools-1 >= 2.5.1], [
AC_DEFINE([HAVE_LIBBAMTOOLS],[1])
HAVE_LIBBAMTOOLS=yes
], [
HAVE_LIBBAMTOOLS=no
AC_DEFINE([HAVE_LIBBAMTOOLS],[0])
])
],[])
# add makefile vars
#AC_SUBST([HAVE_LIBBAMTOOLS],[1])
if test "$HAVE_LIBBAMTOOLS" = "yes"; then
# Warning: the file I need is bamtools/api/BamReader.h, however in the pkg_config it says that it is in ../include/
# the header references <api/BamReader.h> similar to headers referenced within BamReader.h which cannot be found!
# Also pkg_config is not correct for some bamtools versions, I set it explicitly to /usr/include/bamtools/
CXXFLAGS="${CXXFLAGS} -I /usr/include/bamtools/"
fi
# check with updated linker flags
AC_LIB_HAVE_LINKFLAGS([bamtools], [z], [#include <api/BamReader.h>], [], [Linking against bamtools library has failed!])
AS_IF([test "$HAVE_PKG_CONFIG" != "yes" -o "$HAVE_LIBBAMTOOLS" != "yes"],[
AC_CHECK_FILE("/usr/include/bamtools/api/BamReader.h",
[ AC_MSG_NOTICE([Found file in path /usr/include/bamtools/api. Test linking with updated CXXFLAGS...])
CXXFLAGS="$CXXFLAGS -I/usr/include/bamtools/"
],
[ AC_MSG_NOTICE([Bamtools library not found in /usr/include/bamtools/api/BamReader.h! Let us hope it is in the include path])
])
AC_LIB_HAVE_LINKFLAGS([bamtools], [z], [#include <bamtools/api/BamReader.h>], [], [Linking against bamtools library has failed!])
if test "$HAVE_LIBBAMTOOLS" != "yes"; then
AC_MSG_WARN([
********************************************************************************
Please install the bamtools library!
(https://github.com/pezmaster31/bamtools)
If libbamtools-dev is already installed, you have to specify the path prefix
with --with-libbamtools-prefix or install it into a standard location!
If you don't need bam files as input (fastq and fastq.gz should work),
then you can ignore this message.
********************************************************************************])
fi
],[])
fi
AM_CONDITIONAL([HAVE_LIBBAMTOOLS], [test "$HAVE_LIBBAMTOOLS" != "no"])
###############################################################################
# Boost unit tests check
###############################################################################
AX_BOOST_BASE([1.55], [], AC_MSG_ERROR([Could not find a useful version of boost]))
AC_LIB_HAVE_LINKFLAGS([boost_system], [], [] , [], [Could not link the boost_system library!])
if test "$HAVE_LIBBOOST_SYSTEM" != "yes"; then
AC_MSG_FAILURE([ERROR: please install the boost_system library!])
fi
AC_LIB_HAVE_LINKFLAGS([boost_filesystem], [boost_system], [#include <boost/filesystem/path.hpp>] , [], [Could not link the boost_filesystem library!])
if test "$HAVE_LIBBOOST_FILESYSTEM" != "yes"; then
AC_MSG_FAILURE([ERROR: please install the boost_filesystem library!])
fi
AC_LIB_HAVE_LINKFLAGS([boost_iostreams], [], [] , [], [Could not link the boost_iostreams library!])
if test "$HAVE_LIBBOOST_IOSTREAMS" != "yes"; then
AC_MSG_FAILURE([ERROR: please install the boost_iostreams library!])
fi
AC_ARG_ENABLE([tests],
[AS_HELP_STRING([--enable-tests],
[enable boost unit tests (def=no)])],
[tests="$enableval"])
AC_MSG_RESULT([$tests])
if test x"$tests" = x"yes"; then
AC_LIB_HAVE_LINKFLAGS([boost_unit_test_framework], [], [#include <boost/test/unit_test.hpp>] , [using boost::unit_test::test_suite;
test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" ); if (test == NULL) { return 1; } else { return 0; }], [Could not link the boost_test library!])
if test "$HAVE_LIBBOOST_UNIT_TEST_FRAMEWORK" != "yes"; then
AC_MSG_FAILURE([ERROR: please install the boost_test library!])
else
# lrt is requred by boost_unit_tests for clock_* in glibc < 2.1.7
AC_LIB_HAVE_LINKFLAGS([rt], [], [] , [], [Could not link the rt library!])
fi
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
###############################################################################
# help2man check
###############################################################################
AX_PROG_HELP2MAN([src/idemuxCPP])
# distribute additional compiler and linker flags
# --> set these variables instead of CXXFLAGS or LDFLAGS
AC_SUBST([AM_CXXFLAGS])
AC_SUBST([AM_LDFLAGS])
AC_SUBST([LIBS])
# files to generate via autotools (.am or .in source files)
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([doc/Makefile])
AC_CONFIG_FILES([misc/Makefile])
AC_CONFIG_FILES([tests/Makefile])
# generate the final Makefile etc.
AC_CONFIG_FILES([packaging/idemuxcpp.spec packaging/PKGBUILD])
AC_OUTPUT