-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathconfigure.ac
144 lines (116 loc) · 4.97 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(sga, 0.10.15, [email protected])
AM_INIT_AUTOMAKE(foreign)
AC_CONFIG_SRCDIR([SGA/sga.cpp])
AC_CONFIG_HEADER([config.h])
m4_include([m4/m4_ax_openmp.m4])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_RANLIB
# Check for headers
AC_LANG([C++])
AC_CHECK_HEADER([zlib.h])
# Check for libraries
AC_SEARCH_LIBS([gzopen],[z],,[AC_MSG_ERROR([libz not found, please install zlib (http://www.zlib.net/)])])
AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [clock_getttime found])], )
# Check for openmp
AX_OPENMP([openmp_cppflags="-fopenmp" AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])])
# Check for the bamtools library path
# Bamtools has two different path formats
# If it is built in place the files will be in {path}/lib/ and {path}/include/
# If it is installed (with make install) it will be in {path}/include/bamtools
# and {path}/lib/bamtools. Both variants are handled here
AC_ARG_WITH(bamtools, AS_HELP_STRING([--with-bamtools=PATH],
[specify directory containing the bamtools library (http://github.com/pezmaster31/bamtools)]))
if test "$with_bamtools" -a -d "$with_bamtools"; then
bamtools_ldflags="-Wl,-rpath,$with_bamtools/lib -L$with_bamtools/lib -Wl,-rpath,$with_bamtools/lib/bamtools -L$with_bamtools/lib/bamtools"
bamtools_include="-I$with_bamtools/include -I$with_bamtools/include/bamtools"
fi
# Support for tcmalloc/jemalloc/hoard
# Check for the jemalloc memory allocator
AC_ARG_WITH(jemalloc, AS_HELP_STRING([--with-jemalloc=PATH],
[specify directory containing the jemalloc library]))
# Check for the tcmalloc
AC_ARG_WITH(tcmalloc, AS_HELP_STRING([--with-tcmalloc=PATH],
[specify directory containing the tcmalloc library]))
# Check for the hoard memory allocator
AC_ARG_WITH(hoard, AS_HELP_STRING([--with-hoard=PATH],
[specify directory containing the hoard memory allocator library]))
# Set library path to user-selected allocator
if test "$with_hoard" -a -d "$with_hoard"; then
external_malloc_ldflags="-Wl,-rpath,$with_hoard -L$with_hoard"
enable_hoard=1
fi
if test "$with_tcmalloc" -a -d "$with_tcmalloc"; then
external_malloc_ldflags="-Wl,-rpath,$with_tcmalloc -L$with_tcmalloc"
enable_tcmalloc=1
fi
if test "$with_jemalloc" -a -d "$with_jemalloc"; then
external_malloc_ldflags="-Wl,-rpath,$with_jemalloc -L$with_jemalloc"
enable_jemalloc=1
fi
# Check for the google sparse hash
AC_ARG_WITH(sparsehash, AS_HELP_STRING([--with-sparsehash=PATH],
[specify directory containing the google sparsehash headers http://code.google.com/p/google-sparsehash/)]))
if test "$with_sparsehash" -a -d "$with_sparsehash"; then
sparsehash_include="-I$with_sparsehash/include"
fi
# Warn that multithreading is not available on macosx, since it does not implement unnamed semaphores
AC_MSG_CHECKING(for host type)
host="`uname -a | awk '{print $1}'`";
if test "$host" = Darwin;then
AC_MSG_RESULT(warning: multi-threading is not available since OSX does not support un-named pthread semaphores.)
else
AC_MSG_RESULT(you are not using osx so multi-threading should work.);
fi
# Only fail on warnings when the --enable-development flag is passed into configure
AC_ARG_ENABLE(development, AS_HELP_STRING([--enable-development],
[Turn on development options, like failing compilation on warnings]))
if test "$enable_development"; then
fail_on_warning="-Werror"
fi
# Set compiler flags.
AC_SUBST(AM_CXXFLAGS, "-Wall -Wextra $fail_on_warning -Wno-unknown-pragmas")
AC_SUBST(CXXFLAGS, "-std=c++98 -O3")
AC_SUBST(CFLAGS, "-std=gnu99 -O3")
AC_SUBST(CPPFLAGS, "$CPPFLAGS $openmp_cppflags $sparsehash_include $bamtools_include")
AC_SUBST(LDFLAGS, "$openmp_cppflags $external_malloc_ldflags $bamtools_ldflags $LDFLAGS")
# We always need to specify to link in bamtools
AC_SUBST(LIBS, "$LIBS -lbamtools")
#
if test "$enable_hoard"; then
AC_CHECK_LIB([hoard], [malloc])
fi
if test "$enable_tcmalloc"; then
AC_CHECK_LIB([tcmalloc], [malloc])
fi
if test "$enable_jemalloc"; then
AC_CHECK_LIB([jemalloc], [malloc])
fi
# Ensure the sparse hash is available
AC_CHECK_HEADERS([google/sparse_hash_set],,[AC_MSG_ERROR([google sparse hash library is required: http://code.google.com/p/google-sparsehash/])])
# Check for hash table headers
AC_CHECK_HEADERS([ \
google/sparse_hash_set google/sparse_hash_map \
unordered_map tr1/unordered_map ext/hash_map \
unordered_set tr1/unordered_set ext/hash_set \
])
# Make sure the bamtools headers can be found
AC_CHECK_HEADERS([api/BamReader.h],,[AC_MSG_ERROR([The bamtools library must be installed (http://github.com/pezmaster31/bamtools). You can specify its path with the --with-bamtools=PATH option])])
AC_CONFIG_FILES([Makefile
bin/Makefile
Thirdparty/Makefile
Util/Makefile
SQG/Makefile
Bigraph/Makefile
Algorithm/Makefile
StringGraph/Makefile
Concurrency/Makefile
SuffixTools/Makefile
GraphDiff/Makefile
Scaffold/Makefile
SGA/Makefile])
AC_OUTPUT