-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
181 lines (161 loc) · 5.94 KB
/
configure.in
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(mrbayes, 3.2, http://www.mrbayes.net)
AC_CONFIG_SRCDIR(bayes.c)
AC_CONFIG_HEADER(config.h)
AC_ARG_ENABLE(debug,
[--enable-debug=[no/yes] compile with debug support [default="no"]]
,,enable_debug="no")
CFLAGS_DEFINED="NOTICE: Because the variable \$CFLAGS is defined in your shell, the
default MrBayes flags will be overridden. To ensure optimal performance, please check
that your \$CFLAGS variable is set correctly. Alternatively, unset the \$CFLAGS
variable in your shell in order to use the default MrBayes compiler options."
if test -n "${CFLAGS+x}"; then
AC_MSG_NOTICE([$CFLAGS_DEFINED]);
fi
if test "x$enable_debug" == "xyes"; then
: ${CFLAGS="-ggdb -Wall"}
else
: ${CFLAGS="-O3"}; CFLAGS=$CFLAGS" -DNDEBUG";
fi
AC_PROG_CC
AC_HEADER_STDC
AC_CHECK_LIB([m], [exp])
AC_PROG_INSTALL
NOMPICC="No compiler for mpi has been found. If this is incorrect, please adjust your
path and rerun configure."
AC_ARG_ENABLE(mpi,
[--enable-mpi=[no/yes] compile the parallel version of mrbayes [default="no"]]
,,enable_mpi="no")
if test "x$enable_mpi" == "xyes"; then
AC_CHECK_PROG(mpicc,mpicc,yes,no)
if test "x$mpicc" == "xno"; then
AC_MSG_ERROR($NOMPICC);
fi
AC_DEFINE(MPI_ENABLED)
fi
# AC_ARG_ENABLE(fastlog,
# [--enable-fastlog=[no/yes] enable fast log operations [default="no"]]
# ,,enable_fastlog="no")
# if test "x$enable_fastlog" == "xyes"; then
# AC_DEFINE(FAST_VERSION)
# fi
AC_LANG_C
AC_ARG_ENABLE(sse,
[--enable-sse=[no/yes] enable sse instructions [default="yes"]]
,,enable_sse="yes")
if test "x$enable_sse" == "xyes"; then
AC_MSG_CHECKING(for SSE support)
AC_RUN_IFELSE(
[AC_LANG_SOURCE(
[
#include <xmmintrin.h>
int main(){
int res;
__m128 m1, m2;
void *ptr = (void *) NULL;
const size_t align = 32;
res = posix_memalign(&ptr, align, align);
m1 = _mm_add_ps (m2, m1);
return 0;
}
])],
AC_MSG_RESULT(yes)
AC_DEFINE(SSE_ENABLED)
, AC_MSG_RESULT(no)
)
fi
# ------------------------------------------------------------------------------
# Setup BEAGLE
# ------------------------------------------------------------------------------
AC_ARG_WITH([beagle],
[AS_HELP_STRING([--with-beagle[[=PATH]]],
[enable beagle and optionally set prefix where beagle is installed if not
/usr/local @<:@default=yes@:>@])],
[],
[with_beagle=yes])
AC_ARG_ENABLE(threads,
[--enable-threads=[no/yes] enable thread-support when using BEAGLE [default="no"]]
,,enable_threads="no")
if test "x$with_beagle" != "xno"
then
if test "x$with_beagle" == "xyes"
then
with_beagle=/usr/local
fi
AC_CHECK_FILE($with_beagle/include/libhmsbeagle/libhmsbeagle/beagle.h,
[BEAGLE_CFLAGS="-I$with_beagle/include/libhmsbeagle"],
[AC_CHECK_FILE($with_beagle/include/libhmsbeagle-1/libhmsbeagle/beagle.h,
[BEAGLE_CFLAGS="-I$with_beagle/include/libhmsbeagle-1"],
[AC_MSG_ERROR([beagle's library include file beagle.h is not found neither in
${with_beagle}/include/libhmsbeagle/libhmsbeagle/ nor in
${with_beagle}/include/libhmsbeagle-1/libhmsbeagle/]. You should either install
beagle library from http://code.google.com/p/beagle-lib/ or disable use of
beagle library by invoking configure script with option --with-beagle=no.
Note: without beagle library MrBayes may run slower.)])])
AC_CHECK_FILE($with_beagle/include/libhmsbeagle/libhmsbeagle/platform.h,,
[AC_CHECK_FILE($with_beagle/include/libhmsbeagle-1/libhmsbeagle/platform.h,,
[AC_MSG_ERROR([beagle's library include file platform.h is not found neither in
${with_beagle}/include/libhmsbeagle/libhmsbeagle/ nor in
${with_beagle}/include/libhmsbeagle-1/libhmsbeagle/]. You should either install
beagle library from http://code.google.com/p/beagle-lib/ or disable use of
beagle library by invoking configure script with option --with-beagle=no.
Note: without beagle library MrBayes may run slower.)])])
AC_CHECK_FILE($with_beagle/lib,[BEAGLE_LIBS="-L$with_beagle/lib -lhmsbeagle"],
[AC_MSG_ERROR([beagle library is not found in ${with_beagle}]. You should either
install beagle library from http://code.google.com/p/beagle-lib/ or disable use
of beagle library by invoking configure script with option --with-beagle=no.
Note: without beagle library MrBayes may run slower.)])
AC_DEFINE(BEAGLE_ENABLED)
CFLAGS="${CFLAGS} ${BEAGLE_CFLAGS}"
LDFLAGS="${LDFLAGS} ${BEAGLE_LIBS}"
# ----- Check for pthreads compatibility -------
if test "x$enable_threads" == "xyes"
then
AC_CHECK_LIB(pthread,pthread_create,[THREAD_LIB="-lpthread"],
[AC_MSG_ERROR([pthreads library not found])])
AC_DEFINE(THREADS_ENABLED)
fi
fi
# ------------------------------------------------------------------------------
dnl check OS
dnl case $host in
dnl i386-*-gnu*)
dnl bla;;
dnl esac
AC_DEFINE(UNIX_VERSION)
dnl use c for custom tests
AC_LANG_C
dnl check readline
AC_CHECK_LIB([readline], [readline])
if test $ac_cv_lib_readline_readline = yes; then
LDFLAGS=${LDFLAGS}" -lreadline"
AC_MSG_CHECKING(for rl_completion_matches function)
AC_LINK_IFELSE(
[AC_LANG_SOURCE([
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
char *f(const char *a, int f) { return "a"; }
int main() {
char *text="a";
extern char *f(const char *, int);
char **matches = rl_completion_matches (text, f);
return 0;
}
])],
AC_MSG_RESULT(yes)
AC_DEFINE(COMPLETIONMATCHES), AC_MSG_RESULT(no))
fi
dnl check for 64 bit
AC_MSG_CHECKING(for 32 or 64 bits cpu)
AC_RUN_IFELSE(
[AC_LANG_SOURCE([
int main() { return sizeof(long)==4?1:0; }
])],
AC_MSG_RESULT(64)
AC_DEFINE(_64BIT), AC_MSG_RESULT(32))
dnl finish
if test "x$enable_mpi" == "xyes"; then
CC=mpicc
fi
AC_CONFIG_FILES([Makefile])
AC_OUTPUT