forked from BackofenLab/IntaRNA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
304 lines (250 loc) · 10.1 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# this is example-file: configure.ac
AC_PREREQ([2.65])
# 5 argument version only available with aclocal >= 2.64
AC_INIT( [IntaRNA], [2.0.2], [], [intaRNA], [http://www.bioinf.uni-freiburg.de] )
# minimal required version of the boost library
BOOST_REQUIRED_VERSION=1.50.0
# minimal required version of the Vienna RNA library
VRNA_REQUIRED_VERSION=2.3.0
AC_CANONICAL_HOST
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_SRCDIR([src/easylogging++.h])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
lt_enable_auto_import=""
case "$host_os" in
cygwin* | mingw* | cegcc*)
AM_LDFLAGS="-Wl,--enable-auto-import $AM_LDFLAGS"
esac
# 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_PROG_RANLIB
# 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.11])
# use the C++ compiler for the following checks
AC_LANG([C++])
# ensure we are using c11 C++ standard
AX_CXX_COMPILE_STDCXX( [11], [noext], [mandatory])
###############################################################################
###############################################################################
############ PARAMETERS ########################################
###############################################################################
# PKG-CONFIG SETUP
###############################################################################
AC_MSG_CHECKING([whether to use and provide pkg-config information])
pkgconfigEnabled=yes
AC_ARG_ENABLE([pkg-config],
[AS_HELP_STRING([--disable-pkg-config],
[disable pkg-config support (def=enabled)])],
[pkgconfigEnabled="$enableval"],
[pkgconfigEnabled=yes])
AC_MSG_RESULT([$pkgconfigEnabled])
AS_IF([test x"$pkgconfigEnabled" = x"yes"], [
# Checks for pkg-config
AC_CHECK_PROG([HAVE_PKG_CONFIG],[pkg-config],[yes],[no])
], [
HAVE_PKG_CONFIG=no
])
###############################################################################
# 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=disabled)])],
[debuger="$enableval"])
AC_MSG_RESULT([$debuger])
AS_IF([test x"$debuger" = x"yes"], [
AC_DEFINE([_DEBUG], [1], [Run in DEBUG mode with additional assertions and debug output])
AM_CXXFLAGS="$AM_CXXFLAGS -g -O0 -Wno-uninitialized -Wno-deprecated" # -Wall"
], [
AC_DEFINE([NDEBUG], [1], [Run in normal mode with minimal assertions])
AM_CXXFLAGS="$AM_CXXFLAGS -O3 -fno-strict-aliasing -Wno-uninitialized -Wno-deprecated"
])
###############################################################################
# MULTI-THREADING SUPPORT SETUP
###############################################################################
AC_MSG_CHECKING([whether to enable multi-threading support])
multithreadingEnabled=yes
AC_ARG_ENABLE([multithreading],
[AS_HELP_STRING([--disable-multithreading],
[disable multi-threading support (def=enabled)])],
[multithreadingEnabled="$enableval"],
[multithreadingEnabled=yes])
AC_MSG_RESULT([$multithreadingEnabled])
AS_IF([test x"$multithreadingEnabled" = x"yes"], [
AC_DEFINE([INTARNA_MULITHREADING], [1], [Enabling multi-threading support])
AC_SUBST([INTARNA_MULITHREADING],[1])
# ensure OPENMP can be used
AX_OPENMP([],[AC_MSG_ERROR([OPENMP support is mandatory for multi-threading compilation])])
AM_CXXFLAGS="$AM_CXXFLAGS $OPENMP_CXXFLAGS"
], [
AC_DEFINE([INTARNA_MULITHREADING], [0], [Disabling multi-threading support])
AC_SUBST([INTARNA_MULITHREADING],[0])
AM_CXXFLAGS="$AM_CXXFLAGS -pthread"
])
###############################################################################
# Vienna RNA package library path support, if not installed in usual directories
###############################################################################
AC_ARG_WITH([vrna],
[AC_HELP_STRING(
[--with-vrna=PREFIX],
[alternative prefix path to Vienna RNA library]
)],
[RNAPATHSET=1],
[RNAPATHSET=0]
)
# handle user-defined path
AS_IF([test $RNAPATHSET = 1 ], [
AS_IF([test "x$HAVE_PKG_CONFIG" = "xyes"], [
# use pkg-config data if available
export PKG_CONFIG_PATH="$with_vrna/lib/pkgconfig/:$PKG_CONFIG_PATH"
], [
# guess compiler and linker flags if needed
AM_CXXFLAGS="-I$with_vrna/include $AM_CXXFLAGS"
AM_LDFLAGS="-L$with_vrna/lib $AM_LDFLAGS"
])
])
###############################################################################
dnl generate doxygen documentation in Doxy
###############################################################################
AC_CHECK_PROG([HAVE_DOXYGEN],[doxygen],[yes],[no])
AS_IF([test "x$HAVE_DOXYGEN" = "xyes"], [
# setup doxygen documentation to build
DX_HTML_FEATURE(ON)
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
DX_MAN_FEATURE(OFF)
DX_RTF_FEATURE(OFF)
DX_XML_FEATURE(OFF)
DX_PDF_FEATURE(ON)
DX_PS_FEATURE(OFF)
# generate according options etc.
DX_INIT_DOXYGEN($PACKAGE_NAME, ["doc/doxygen.cfg"], ["doxygen-doc"])
])
###############################################################################
###############################################################################
###############################################################################
# BOOST CHECK
###############################################################################
AX_BOOST_BASE([$BOOST_REQUIRED_VERSION], [FOUND_BOOST=1;], [FOUND_BOOST=0;])
############ CHECKS ############################################
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
# Checks for header files.
AC_HEADER_STDC
##########################################################################
# check boost test results
##########################################################################
# FOUND_BOOST is only defined if want_boost is "yes"
AS_IF([test $want_boost = "no" || test $FOUND_BOOST != 1], [
AC_MSG_NOTICE([])
AC_MSG_NOTICE([The Boost Library was not found!])
AC_MSG_NOTICE([ -> If installed in a non-standard path, please use '--with-boost=PREFIX'.])
AC_MSG_NOTICE([])
DEPENDENCYNOTFOUND=1;
], [
AM_CXXFLAGS="$BOOST_CPPFLAGS $AM_CXXFLAGS"
AM_LDFLAGS="$BOOST_LDFLAGS $AM_LDFLAGS"
LIBS="$LIBS -lboost_regex -lboost_program_options -lboost_filesystem -lboost_system"
])
###############################################################################
# BEGIN VIENNA CHECK
###############################################################################
# check for Vienna RNA headers
RNANOTFOUND=0
AS_IF([test "x$HAVE_PKG_CONFIG" = "xyes"], [
AC_MSG_NOTICE([check if VRNA version >= $VRNA_REQUIRED_VERSION])
PKG_CHECK_MODULES( [VRNA], [RNAlib2 >= $VRNA_REQUIRED_VERSION], [RNANOTFOUND=0], [RNANOTFOUND=1])
])
AS_IF([test "$RNANOTFOUND" = "0"], [
AC_MSG_CHECKING([for compilation with Vienna RNA package headers])
OLD_CPPFLAGS=$CPPFLAGS
OLD_CXXFLAGS=$CXXFLAGS
OLD_LDFLAGS=$LDFLAGS
AC_LANG_PUSH([C])
CPPFLAGS="$CPPFLAGS $AM_CXXFLAGS"
LDFLAGS="$LDFLAGS $AM_LDFLAGS"
AS_IF([test "x$HAVE_PKG_CONFIG" = "xyes"], [
CPPFLAGS="$CPPFLAGS $VRNA_CFLAGS"
LDFLAGS="$LDFLAGS $VRNA_LIBS"
])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <ViennaRNA/model.h>]],[[vrna_md_t tmp; vrna_md_copy(&tmp,&tmp);]])],
[
AC_MSG_RESULT([yes])
RNANOTFOUND=0;
],
[
AC_MSG_RESULT([no])
AC_MSG_NOTICE([DEBUG : used CPPFLAGS = $CPPFLAGS])
AC_MSG_NOTICE([DEBUG : used LDFLAGS = $LDFLAGS])
RNANOTFOUND=1;
]
)
AC_LANG_POP([C])
CPPFLAGS=$OLD_CPPFLAGS
LDFLAGS=$OLD_LDFLAGS
])
# error output if ViennaRNA not found
AS_IF([test "$RNANOTFOUND" = "1"], [
AC_MSG_NOTICE()
AC_MSG_NOTICE([The Vienna RNA C library version >= $VRNA_REQUIRED_VERSION is required.])
AC_MSG_NOTICE([ -> It can be obtained from http://www.tbi.univie.ac.at/.])
AC_MSG_NOTICE()
AS_IF([test "$RNAPATHSET" = "1"], [
AC_MSG_NOTICE([ -> Can't find the Vienna RNA library in given path '$with_vrna'.])
], [ # else
AC_MSG_NOTICE([ -> If installed in a non-standard path, please use '--with-vrna=PREFIX'.])
])
DEPENDENCYNOTFOUND=1;
],[ # else
# register Vienna RNA lib for linking
AS_IF([test "x$HAVE_PKG_CONFIG" = "xyes"], [
# apply pkg-config options for VRNA package for further build
AM_CXXFLAGS="$AM_CXXFLAGS $VRNA_CFLAGS"
LIBS="$LIBS $VRNA_LIBS"
], [ # else
# guess that only lib information missing
LIBS="$LIBS -lRNA"
])
])
###############################################################################
# END VIENNA CHECK
###############################################################################
###############################################################################
# FINAL DEPENDENCY CHECK AND EXIT IF NEEDED
###############################################################################
# error ABORT if on of the libraries was not found
AS_IF([test "$DEPENDENCYNOTFOUND" = "1"], [
AC_MSG_NOTICE()
AC_MSG_ERROR([Some dependency was not met! See above for errors and relate to './configure --help'.])
])
##########################################################################
# 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])
AM_CONDITIONAL(enable_pkg_config, [test "x$HAVE_PKG_CONFIG" = "xyes"])
AM_CONDITIONAL(enable_doxygen, [test "x$HAVE_DOXYGEN" = "xyes"])
# files to generate via autotools (.am or .in source files)
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/IntaRNA/Makefile])
AC_CONFIG_FILES([src/IntaRNA/intarna_config.h])
AC_CONFIG_FILES([src/bin/Makefile])
AC_CONFIG_FILES([perl/Makefile])
AC_CONFIG_FILES([tests/Makefile])
AC_CONFIG_FILES([IntaRNA.pc])
# generate the final Makefile etc.
AC_OUTPUT