1 AC_INIT(mrbayes, 3.2, http://www.mrbayes.net)
2 AC_CONFIG_SRCDIR(bayes.c)
3 AC_CONFIG_HEADER(config.h)
6 [--enable-debug=[no/yes] compile with debug support [default="no"]]
8 CFLAGS_DEFINED="NOTICE: Because the variable \$CFLAGS is defined in your shell, the
9 default MrBayes flags will be overridden. To ensure optimal performance, please check
10 that your \$CFLAGS variable is set correctly. Alternatively, unset the \$CFLAGS
11 variable in your shell in order to use the default MrBayes compiler options."
12 if test -n "${CFLAGS+x}"; then
13 AC_MSG_NOTICE([$CFLAGS_DEFINED]);
15 if test "x$enable_debug" == "xyes"; then
16 : ${CFLAGS="-ggdb -Wall"}
18 : ${CFLAGS="-O3"}; CFLAGS=$CFLAGS" -DNDEBUG";
23 AC_CHECK_LIB([m], [exp])
26 NOMPICC="No compiler for mpi has been found. If this is incorrect, please adjust your
27 path and rerun configure."
29 [--enable-mpi=[no/yes] compile the parallel version of mrbayes [default="no"]]
31 if test "x$enable_mpi" == "xyes"; then
32 AC_CHECK_PROG(mpicc,mpicc,yes,no)
33 if test "x$mpicc" == "xno"; then
34 AC_MSG_ERROR($NOMPICC);
36 AC_DEFINE(MPI_ENABLED)
39 # AC_ARG_ENABLE(fastlog,
40 # [--enable-fastlog=[no/yes] enable fast log operations [default="no"]]
41 # ,,enable_fastlog="no")
42 # if test "x$enable_fastlog" == "xyes"; then
43 # AC_DEFINE(FAST_VERSION)
49 [--enable-sse=[no/yes] enable sse instructions [default="yes"]]
51 if test "x$enable_sse" == "xyes"; then
52 AC_MSG_CHECKING(for SSE support)
56 #include <xmmintrin.h>
60 void *ptr = (void *) NULL;
61 const size_t align = 32;
62 res = posix_memalign(&ptr, align, align);
63 m1 = _mm_add_ps (m2, m1);
68 AC_DEFINE(SSE_ENABLED)
73 # ------------------------------------------------------------------------------
75 # ------------------------------------------------------------------------------
78 [AS_HELP_STRING([--with-beagle[[=PATH]]],
79 [enable beagle and optionally set prefix where beagle is installed if not
80 /usr/local @<:@default=yes@:>@])],
84 AC_ARG_ENABLE(threads,
85 [--enable-threads=[no/yes] enable thread-support when using BEAGLE [default="no"]]
86 ,,enable_threads="no")
88 if test "x$with_beagle" != "xno"
90 if test "x$with_beagle" == "xyes"
92 with_beagle=/usr/local
95 AC_CHECK_FILE($with_beagle/include/libhmsbeagle/libhmsbeagle/beagle.h,
96 [BEAGLE_CFLAGS="-I$with_beagle/include/libhmsbeagle"],
97 [AC_CHECK_FILE($with_beagle/include/libhmsbeagle-1/libhmsbeagle/beagle.h,
98 [BEAGLE_CFLAGS="-I$with_beagle/include/libhmsbeagle-1"],
99 [AC_MSG_ERROR([beagle's library include file beagle.h is not found neither in
100 ${with_beagle}/include/libhmsbeagle/libhmsbeagle/ nor in
101 ${with_beagle}/include/libhmsbeagle-1/libhmsbeagle/]. You should either install
102 beagle library from http://code.google.com/p/beagle-lib/ or disable use of
103 beagle library by invoking configure script with option --with-beagle=no.
104 Note: without beagle library MrBayes may run slower.)])])
105 AC_CHECK_FILE($with_beagle/include/libhmsbeagle/libhmsbeagle/platform.h,,
106 [AC_CHECK_FILE($with_beagle/include/libhmsbeagle-1/libhmsbeagle/platform.h,,
107 [AC_MSG_ERROR([beagle's library include file platform.h is not found neither in
108 ${with_beagle}/include/libhmsbeagle/libhmsbeagle/ nor in
109 ${with_beagle}/include/libhmsbeagle-1/libhmsbeagle/]. You should either install
110 beagle library from http://code.google.com/p/beagle-lib/ or disable use of
111 beagle library by invoking configure script with option --with-beagle=no.
112 Note: without beagle library MrBayes may run slower.)])])
113 AC_CHECK_FILE($with_beagle/lib,[BEAGLE_LIBS="-L$with_beagle/lib -lhmsbeagle"],
114 [AC_MSG_ERROR([beagle library is not found in ${with_beagle}]. You should either
115 install beagle library from http://code.google.com/p/beagle-lib/ or disable use
116 of beagle library by invoking configure script with option --with-beagle=no.
117 Note: without beagle library MrBayes may run slower.)])
119 AC_DEFINE(BEAGLE_ENABLED)
120 CFLAGS="${CFLAGS} ${BEAGLE_CFLAGS}"
121 LDFLAGS="${LDFLAGS} ${BEAGLE_LIBS}"
123 # ----- Check for pthreads compatibility -------
125 if test "x$enable_threads" == "xyes"
127 AC_CHECK_LIB(pthread,pthread_create,[THREAD_LIB="-lpthread"],
128 [AC_MSG_ERROR([pthreads library not found])])
129 AC_DEFINE(THREADS_ENABLED)
132 # ------------------------------------------------------------------------------
139 AC_DEFINE(UNIX_VERSION)
141 dnl use c for custom tests
145 AC_CHECK_LIB([readline], [readline])
146 if test $ac_cv_lib_readline_readline = yes; then
147 LDFLAGS=${LDFLAGS}" -lreadline"
148 AC_MSG_CHECKING(for rl_completion_matches function)
152 #include <readline/readline.h>
153 #include <readline/history.h>
154 char *f(const char *a, int f) { return "a"; }
157 extern char *f(const char *, int);
158 char **matches = rl_completion_matches (text, f);
163 AC_DEFINE(COMPLETIONMATCHES), AC_MSG_RESULT(no))
167 AC_MSG_CHECKING(for 32 or 64 bits cpu)
170 int main() { return sizeof(long)==4?1:0; }
173 AC_DEFINE(_64BIT), AC_MSG_RESULT(32))
176 if test "x$enable_mpi" == "xyes"; then
180 AC_CONFIG_FILES([Makefile])