-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
executable file
·197 lines (158 loc) · 6.38 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
m4_define([pourRNA_version_major], [1])
m4_define([pourRNA_version_minor], [2])
m4_define([pourRNA_version_patch], [0])
AC_PREREQ([2.59])
# 5 argument version only available with aclocal >= 2.64
AC_INIT( [pourRNA], pourRNA_version_major.pourRNA_version_minor.pourRNA_version_patch, [], [pourRNA], [http://www.bioinf.uni-freiburg.de] )
AC_CANONICAL_HOST
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_SRCDIR([src/pourRNA.cpp])
AC_CONFIG_HEADERS([src/config.h])
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], [http://www.bioinf.uni-freiburg.de/])
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++])
# include openMP for multithreading.
dnl Check for OpenMP and prepare flags
#AX_OPENMP([],[]) # not used
#AC_SUBST(OPENMP_CXXFLAGS)
AC_SUBST(AM_CXXFLAGS,"$OPENMP_CXXFLAGS")
###############################################################################
###############################################################################
############ 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 -pg -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 -pthread"
fi
###############################################################################
# Vienna RNA package library path support, if not installed in usual directories
###############################################################################
AC_ARG_WITH([RNA],
[AC_HELP_STRING(
[--with-RNA=PREFIX],
[alternative prefix path to Vienna RNA library]
)],
[RNAPATHSET=1],
[RNAPATHSET=0]
)
if test $RNAPATHSET = 1 ; then
# set compiler and linker flags if needed
AM_CXXFLAGS="-I$with_RNA/include $AM_CXXFLAGS"
AM_LDFLAGS="-L$with_RNA/lib $AM_LDFLAGS"
fi
###############################################################################
###############################################################################
############ CHECKS ############################################
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
# Checks for header files.
AC_HEADER_STDC
###############################################################################
# BEGIN VIENNA CHECK
###############################################################################
# check for Vienna RNA headers
AC_MSG_CHECKING([for the Vienna RNA package >=2.4.11 headers])
OLD_CXXFLAGS=$CXXFLAGS
OLD_LDFLAGS=$LDFLAGS
CXXFLAGS="$CXXFLAGS $AM_CXXFLAGS"
LDFLAGS="$LDFLAGS $AM_LDFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([[#include <ViennaRNA/neighbor.h>]])],
[
AC_MSG_RESULT([yes])
AC_CHECK_LIB([RNA], [vrna_neighbors], [RNANOTFOUND=0], [ RNANOTFOUND=1])
],
[
AC_MSG_RESULT([no])
RNANOTFOUND=1;
]
)
CXXFLAGS=$OLD_CXXFLAGS
LDFLAGS=$OLD_LDFLAGS
# error output if ViennaRNA not found
if test "$RNANOTFOUND" = "1"; then
AC_MSG_NOTICE()
AC_MSG_NOTICE([The Vienna RNA C library >= 2.4.11 is required.])
AC_MSG_NOTICE([ -> It can be obtained from http://www.tbi.univie.ac.at/.])
AC_MSG_NOTICE()
if test "$RNAPATHSET" = "1"; then
AC_MSG_NOTICE([ -> Can't find the Vienna RNA library in given path '$with_RNA'.])
else
AC_MSG_NOTICE([ -> If installed in a non-standard path, please use '--with-RNA=PREFIX'.])
fi
DEPENDENCYNOTFOUND=1;
else
# register Vienna RNA lib for linking
LIBS="$LIBS -lRNA"
fi
###############################################################################
# END VIENNA CHECK
###############################################################################
###############################################################################
# help2man check
###############################################################################
AX_PROG_HELP2MAN([src/pourRNA])
###############################################################################
# FINAL DEPENDENCY CHECK AND EXIT IF NEEDED
###############################################################################
# error ABORT if on of the libraries was not found
if test "$DEPENDENCYNOTFOUND" = "1"; then
AC_MSG_NOTICE()
AC_MSG_ERROR([Some dependency was not met! See above for errors and relate to './configure --help'.])
fi
##########################################################################
# 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([misc/Makefile])
AC_CONFIG_FILES([doc/Makefile])
# generate the final Makefile etc.
AC_OUTPUT([packaging/pourRNA.spec packaging/PKGBUILD])