-
Notifications
You must be signed in to change notification settings - Fork 27
/
configure.ac
479 lines (395 loc) · 15.7 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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
AC_PREREQ([2.65])
# 5 argument version only available with aclocal >= 2.64
AC_INIT([IntaRNA], [3.4.1], [], [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.4.14
# minimal required version of python interpreter (to install intarnapvalue)
PYTHON_REQUIRED_VERSION=3.6
AC_CANONICAL_HOST
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_SRCDIR([src/easylogging++.h])
AC_CONFIG_HEADERS([src/config.h])
# AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/m4-ax_cxx_compile_stdcxx.m4])
m4_include([m4/m4-ax_openmp.m4])
m4_include([m4/m4-ax_boost_base.m4])
m4_include([m4/m4-ax_boost_system.m4])
m4_include([m4/m4-ax_boost_filesystem.m4])
m4_include([m4/m4-ax_boost_program_options.m4])
m4_include([m4/m4-ax_boost_regex.m4])
m4_include([m4/m4-ax_boost_iostreams.m4])
m4_include([m4/m4-ax_check_zlib.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_LN_S
AC_PROG_RANLIB
AC_PROG_MKDIR_P
# 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])
# check if python is available
AM_PATH_PYTHON([$PYTHON_REQUIRED_VERSION],, [:])
AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != ":"])
AM_COND_IF([HAVE_PYTHON], [HAVE_PYTHON_yesno=yes], [HAVE_PYTHON_yesno=no])
###############################################################################
###############################################################################
############ DEFAULT MACROS IF PKG-CONFIG MISSING ###############
m4_define_default([PKG_PROG_PKG_CONFIG],
[AC_MSG_CHECKING([pkg-config])
AC_MSG_RESULT([no])])
PKG_PROG_PKG_CONFIG
# If the pkg-config autoconf support isn't installed, define its
# autoconf macro to disable any packages depending on it.
#
m4_define_default([PKG_CHECK_MODULES],
[AC_MSG_CHECKING([$1])
AC_MSG_RESULT([no])
$4])
############ SILENT (MINIMAL) MAKEFILE OUTPUT ###################
# show full make output via `make V=1`
m4_ifdef(
[AM_SILENT_RULES],
[AM_SILENT_RULES([yes])]
)
############ 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 -DELPP_DEBUG_ERRORS" # -Wall"
], [
AC_DEFINE([NDEBUG], [1], [Run in normal mode with minimal assertions])
AM_CXXFLAGS="$AM_CXXFLAGS -O3 -fno-strict-aliasing -Wno-uninitialized -Wno-deprecated"
])
###############################################################################
# STATIC LINKING SUPPORT
###############################################################################
AC_MSG_CHECKING([whether to build statically linked binaries])
AC_ARG_ENABLE([static-linking],
[AS_HELP_STRING([--enable-static-linking],
[enables static linking of the executables (default=disabled)])],
[enable_static_linking=$enableval],
[enable_static_linking=no])
AC_MSG_RESULT([$enable_static_linking])
AS_IF([test x"$enable_static_linking" = x"yes"], [
AM_LDFLAGS="-static $AM_LDFLAGS"
])
###############################################################################
# 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"
])
###############################################################################
# MULTIPRECISION SUPPORT (via GNU quadmath library)
###############################################################################
AC_MSG_CHECKING([whether to use a multi-precision partition function data type (quadmath)])
enable_multiprecision=no
AC_ARG_ENABLE([multiprecision],
[AS_HELP_STRING([--enable-multiprecision],
[multi-precision partition function data type (default=disabled)])],
[enable_multiprecision=$enableval],
[enable_multiprecision=no])
AC_MSG_RESULT([$enable_multiprecision])
AS_IF([test x"$enable_multiprecision" = x"yes"], [
LIBS="$LIBS -lquadmath"
AC_DEFINE([INTARNA_MULTIPRECISION], [1], [Enabling multiprecision partition function (using quadmath)])
AC_SUBST([INTARNA_MULTIPRECISION],[1])
], [
AC_DEFINE([INTARNA_MULTIPRECISION], [0], [Disabling multiprecision partition function])
AC_SUBST([INTARNA_MULTIPRECISION],[0])
])
###############################################################################
# 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"], [
# loading m4 macro
m4_include([m4/doxygen.m4])
# 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])
])
###############################################################################
# EASYLOGGING++
###############################################################################
# enable easylogging++ performance tracking
AM_CXXFLAGS="$AM_CXXFLAGS -DELPP_FEATURE_PERFORMANCE_TRACKING"
# disable default log file creation
AM_CXXFLAGS="$AM_CXXFLAGS -DELPP_NO_DEFAULT_LOG_FILE"
#############################
# COLORING SETUP
#############################
AC_MSG_CHECKING([whether to enable coloring of console log output])
logColoring=yes
AC_ARG_ENABLE([log-coloring],
[AS_HELP_STRING([--disable-log-coloring],
[disable console log coloring (def=enabled)])],
[logColoring="$enableval"])
AC_MSG_RESULT([$logColoring])
AS_IF([test x"$logColoring" = x"yes"], [
AC_DEFINE([INTARNA_LOG_COLORING], [1], [Enabling console log coloring])
AC_SUBST([INTARNA_LOG_COLORING],[1])
], [
AC_DEFINE([INTARNA_LOG_COLORING], [0], [Disabling console log coloring])
AC_SUBST([INTARNA_LOG_COLORING],[0])
])
#############################
# P-VALUE SCRIPT
#############################
AC_MSG_CHECKING([whether to compile and install 'intarnapvalue' python module])
intarnapvalue=no
AC_ARG_ENABLE([intarnapvalue],
[AS_HELP_STRING([--enable-intarnapvalue],
[build and install the intarnapvalue python3 module])],
[AM_COND_IF([HAVE_PYTHON], [intarnapvalue="$enableval"], [intarnapvalue="no (python not available)"])])
AC_MSG_RESULT([$intarnapvalue])
AM_CONDITIONAL([INSTALL_INTARNAPVALUE],[test x"$intarnapvalue" = x"yes"])
###############################################################################
###############################################################################
# BOOST CHECK
###############################################################################
AX_BOOST_BASE([$BOOST_REQUIRED_VERSION], [FOUND_BOOST=1;], [FOUND_BOOST=0;])
AS_IF([test "x$want_boost" != "xno" && test "x$FOUND_BOOST" = "x1"], [
AX_BOOST_SYSTEM
AX_BOOST_FILESYSTEM
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_REGEX
AX_BOOST_IOSTREAMS
])
AX_CHECK_ZLIB([], [])
############ 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 -lboost_iostreams -lz"
])
###############################################################################
# BEGIN VIENNA CHECK
###############################################################################
# check for Vienna RNA headers
RNANOTFOUND=0
AS_IF([test x"$HAVE_PKG_CONFIG" = x"yes"], [
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'.])
])
##########################################################################
# get available personalities
AC_SUBST([PERSONALITIES],[`grep 'return.*"IntaRNA..*"' ./src/bin/CommandLineParsing.h | grep -o '".*"' | tr -d '"' | tr "\n" " "`])
##########################################################################
# 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([R/Makefile])
AC_CONFIG_FILES([python/Makefile])
AC_CONFIG_FILES([python/bin/Makefile])
AC_CONFIG_FILES([python/intarnapvalue/Makefile])
AC_CONFIG_FILES([python/copomus/Makefile])
AC_CONFIG_FILES([tests/Makefile])
AC_CONFIG_FILES([tests/data/Makefile])
AC_CONFIG_FILES([doc/Makefile])
AC_CONFIG_FILES([IntaRNA.pc])
# generate the final Makefile etc.
AC_OUTPUT
# get absolute directory paths
eval _prefixdir=$(eval printf "%s" $prefix)
eval _bindir=$(eval printf "%s" $bindir)
eval _libdir=$(eval printf "%s" $libdir)
eval _includedir=$(eval printf "%s" $includedir)
AC_MSG_NOTICE([
======================================
IntaRNA $PACKAGE_VERSION
======================================
Features
--------
* log coloring : $logColoring
* OpenMP multi-threading : $multithreadingEnabled
* intarnapvalue : $intarnapvalue
Install Directories for given 'prefix'
--------------------------------------
* Install prefix : $_prefixdir
* Executables : $_bindir
* Libraries : $_libdir
* Header files : $_includedir
* Python modules : $_pydir
You can run 'make', 'make tests' and 'make install' now!
Run 'make install prefix=XYZ' for installation in an alternative directory.
======================================
])