-
Notifications
You must be signed in to change notification settings - Fork 35
/
configure.ac
181 lines (158 loc) · 7.85 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
AC_INIT([global], [1], [alekseyz@jhu.edu])
AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([subdir-objects foreign parallel-tests color-tests])
AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR([.])
AC_CONFIG_HEADERS([config.h])
AC_PROG_LIBTOOL
# Change default compilation flags
AS_IF([test -z "$CXXFLAGS"], [cxxflags_given=no], [cxxflags_given=yes])
AC_LANG(C++)
AC_PROG_CC
AC_PROG_CXX
# Checks for libraries.
CXXFLAGS="-std=c++0x $CXXFLAGS"
AS_IF([test x$cxxflags_given = xno], [CXXFLAGS="-DNDEBUG $CXXFLAGS"])
EXTRA_CXXFLAGS="-std=c++0x"
AC_SUBST([EXTRA_CXXFLAGS])
ALL_CXXFLAGS="$EXTRA_CXXFLAG"
AC_SUBST([ALL_CXXFLAGS])
AC_CHECK_LIB([pthread], [pthread_create])
AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define to 1 if you have the 'clock_gettime' function])])
# Flags for Jellyfish
AC_SUBST([JELLYFISH2_0_CFLAGS], ['-I$(includedir)/jellyfish-1'])
AC_SUBST([JELLYFISH2_0_LIBS], ['-L$(libdir) -ljellyfish-2.0'])
AC_SUBST([JELLYFISH], ['$(bindir)/jellyfish'])
AC_CHECK_TYPE([__int128],
[AC_DEFINE([HAVE_INT128], [1], [Define if type __int128 is supported])])
AC_MSG_CHECKING([for std::numeric_limits<__int128>])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <limits>
template<bool> struct StaticAssert; template<> struct StaticAssert<true> { static void assert() { } };]],
[[StaticAssert<std::numeric_limits<__int128>::is_specialized>::assert();]])],
[AC_MSG_RESULT([yes])]
[AC_DEFINE([HAVE_NUMERIC_LIMITS128], [1], [Define if numeric limits specialization exists for __int128])],
[AC_MSG_RESULT([no])])
# Check for openmp
AC_ARG_ENABLE([openmp], [AS_HELP_STRING([--disable-openmp], [Disable OpenMP, even if available])])
AS_IF([test "x$enable_openmp" != "xno"],
# OpenMP enabled. Check if available
[AX_OPENMP([AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])])]
[EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $OPENMP_CXXFLAGS"],
# OpenMP disabled. Ignore pragma warnings
[EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -Wno-unknown-pragmas"])
# Check for Boost, and install if asked to
AS_IF([test x$BOOST_ROOT = xinstall],
AS_IF([test ! -f include/boost/version.hpp],
[AS_BOX([Installing Boost 1.59.0 from the Internet into include/boost])]
[AS_MKDIR_P([include])]
[curl -L http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.bz2 | tar -jx -C include --strip-components=1 boost_1_59_0/boost]
[AS_IF([test x$? != x0], [AC_MSG_FAILURE([failed to install Boost from the Internet])])])
[BOOST_ROOT=`pwd -P`/include])
BOOST_REQUIRE([1.46.0],
[AS_BOX([Could not find a working installation of Boost. Set BOOST_ROOT to the path where the Boost headers are installed or set BOOST_ROOT=install to have it downloaded from the Internet and installed locally. For example: BOOST_ROOT=install ./install.sh])]
[AC_MSG_FAILURE([cannot find Boost])])
BOOST_FIND_HEADER([boost/icl/interval_set.hpp])
# For ufasta, disable regex unconditionally
AM_CONDITIONAL([HAVE_BOOST_REGEX], [false])
# Flags for samtools
AC_SUBST([SAMTOOLS_CFLAGS], ['-I$(includedir)/samtools'])
AC_SUBST([SAMTOOLS_LIBS], ['-L$(libdir) -lbam'])
# On MacOS X, use _NSGetExecutablePath to find path to own executable
AC_MSG_CHECKING([for _NSGetExecutablePath])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mach-o/dyld.h>]],
[[_NSGetExecutablePath(0, 0);]])],
[AC_MSG_RESULT([yes])]
[AC_DEFINE([HAVE_NSGETEXECUTABLEPATH], [1], [Used to find executable path on MacOS X])],
[AC_MSG_RESULT([no])])
# For MUMmer, check for std::thread::sleep_for
AC_SUBST([EXTRA_CXXFLAGS])
AC_MSG_CHECKING([if std::thread::sleep_for is supported])
try_nano_sleep=
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <thread>]],
[[std::this_thread::sleep_for(std::chrono::seconds(1))]])],
[AC_MSG_RESULT([yes])], [try_nano_sleep=yes])
AS_IF([test x$try_nano_sleep = xyes],
[save_cxxflags="$CXXFLAGS"]
[CXXFLAGS="-D_GLIBCXX_USE_NANOSLEEP $CXXFLAGS"]
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <thread>]],
[[std::this_thread::sleep_for(std::chrono::seconds(1))]])],
[AC_MSG_RESULT([yes])]
[EXTRA_CXXFLAGS="-D_GLIBCXX_USE_NANOSLEEP $EXTRA_CXXFLAGS"],
[AC_MSG_RESULT([no])]
[AC_MSG_FAILURE([Compiler does not support std::this_thread::sleep_for])])]
[CXXFLAGS="$save_cxxflags"])
# Checks for library functions.
AC_FUNC_MMAP
AC_CHECK_FUNCS([mremap])
# Check for zlib
AC_CHECK_HEADER([zlib.h], [], [AC_MSG_FAILURE([Cannot find zlib.h header. Install zlib development files (e.g. zlib1g-dev)])])
AC_CHECK_LIB([z], [zlibVersion], [], [AC_MSG_FAILURE([Cannot find zlib library. Install zlib libray])])
# Check bzip2 library
AC_CHECK_HEADER([bzlib.h], [], [AC_MSG_FAILURE([Cannot find bzilb.h header. Install bzip2 development files (e.g. bzip2-devel)])])
AC_CHECK_LIB([bz2], [BZ2_bzlibVersion], [], [AC_MSG_FAILURE([Cannot find bzip2 library. Install bzip2 library])])
# Use valgrind to check memory allocation with mmap
#AC_ARG_ENABLE([valgrind],
# [AS_HELP_STRING([--enable-valgrind], [Instrument mmap memory allocation with valgrind])])
#AS_IF([test "x$enable_valgrind" = xyes],
# [AC_DEFINE([HAVE_VALGRIND], [1], [Define is using Valgrind])]
# [PKG_CHECK_MODULES([VALGRIND], [valgrind >= 1.8.0])])
# Check for builtin functions
AC_MSG_CHECKING([for __builtin_prefetch])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[int x = 0;]],
[[__builtin_prefetch(&x);]])],
[AC_MSG_RESULT([yes])]
[AC_DEFINE([HAVE_BUILTIN_PREFETCH], [1], [Defined if __builtin_prefetch is supported])],
[AC_MSG_RESULT([no])])
# For Quorum
AM_CONDITIONAL([RELATIVE_PATHS], [true])
AM_CONDITIONAL([HAVE_RELATIVE_JF_PATH], [false])
# For Samtools, don't compile ncurses stuff
AC_SUBST([CURSES_LIB], [0])
# For CA
AC_MSG_CHECKING([for architecture])
OSTYPE=`uname`
OSVERSION=`uname -r`
MACHINETYPE=`uname -m`
AS_CASE([$MACHINETYPE],
["x86_64"], [MACHINETYPE=amd64],
["Power Macintosh"], [MACHINETYPE=ppc])
AS_IF([test x$OSTYPE = xSunOS],
[MACHINETYPE=`uname -p`]
[AS_IF([text x$MACHINETYPE = xsparc],
[MACHINETYPE=sparc`/usr/bin/isainfo -b`])])
AC_SUBST([OSTYPE])
AC_SUBST([OSVERSION])
AC_SUBST([MACHINETYPE])
AC_SUBST([LOCAL_NAME], [$OSTYPE-$MACHINETYPE])
AC_MSG_RESULT([$LOCAL_NAME])
AM_CONDITIONAL([SITE_LOCAL], [true])
AM_CONDITIONAL([SITE_JCVI], [false])
AM_CONDITIONAL([SITE_BRI], [false])
# Check for yaggo
AC_ARG_VAR([YAGGO], [Yaggo switch parser generator])
AS_IF([test "x$YAGGO" = "x"], [AC_PATH_PROG([YAGGO], [yaggo], [false])])
# Check for swig and enable Perl bindings
# --enable-swig
AC_ARG_ENABLE([swig],
[AC_HELP_STRING([--enable-swig], [enable development of swig binding])])
AS_IF([test x$enable_swig = xyes],
[AX_PKG_SWIG([3.0.0], [], [AC_MSG_FAILURE([SWIG version 3 is required])])])
AS_IF([test -n "$SWIG"],
[SWIG_ENABLE_CXX])
AM_CONDITIONAL([HAVE_SWIG], [test -n "$SWIG"])
AC_SUBST([MAYBE_SWIG], [swig])
# Conf Perl
PERL_EXT_LIB='$(libdir)/perl'
AX_PERL_EXT
AM_CONDITIONAL([PERL_BINDING], [true])
# Disable others
AM_CONDITIONAL([PYTHON_BINDING], [false])
AM_CONDITIONAL([RUBY_BINDING], [false])
# Output configuration files
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([jellyfish/jellyfish-2.0.pc])
AC_CONFIG_FILES([MUMmer/mummer.pc])
m4_map_args_w([samtools prepare ufasta quorum SuperReads SOAPdenovo2 PacBio CA8 jellyfish MUMmer],
[AC_CONFIG_FILES(], [/Makefile)])
AC_OUTPUT