]> git.donarmstrong.com Git - mrbayes.git/blob - src/configure.in
acdae5a4fbe58827c23165948f8bd912ea1b2748
[mrbayes.git] / src / configure.in
1 AC_INIT(mrbayes, 3.2, http://www.mrbayes.net)
2 AC_CONFIG_SRCDIR(bayes.c)
3 AC_CONFIG_HEADER(config.h)
4
5 AC_ARG_ENABLE(debug, 
6     [--enable-debug=[no/yes] compile with debug support [default="no"]]
7     ,,enable_debug="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]);
14 fi
15 if test "x$enable_debug" == "xyes"; then
16     : ${CFLAGS="-ggdb -Wall"}
17 else
18     : ${CFLAGS="-O3"}; CFLAGS=$CFLAGS" -DNDEBUG";
19 fi
20 AC_PROG_CC
21
22 AC_HEADER_STDC
23 AC_CHECK_LIB([m], [exp])
24 AC_PROG_INSTALL
25
26 NOMPICC="No compiler for mpi has been found. If this is incorrect, please adjust your 
27 path and rerun configure."
28 AC_ARG_ENABLE(mpi, 
29     [--enable-mpi=[no/yes] compile the parallel version of mrbayes [default="no"]]
30     ,,enable_mpi="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);
35     fi
36     AC_DEFINE(MPI_ENABLED)
37 fi
38
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)
44 # fi
45
46 AC_LANG_C
47
48 AC_ARG_ENABLE(sse, 
49     [--enable-sse=[no/yes] enable sse instructions [default="yes"]]
50     ,,enable_sse="yes")
51 if test "x$enable_sse" == "xyes"; then
52     AC_MSG_CHECKING(for SSE support)
53     AC_RUN_IFELSE(
54     [AC_LANG_SOURCE(
55     [
56     #include <xmmintrin.h>
57     int main(){
58     int res;
59     __m128          m1, m2;
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);
64     return 0;
65     }
66     ])],
67     AC_MSG_RESULT(yes)
68     AC_DEFINE(SSE_ENABLED)
69     , AC_MSG_RESULT(no)
70     )
71 fi
72
73 # ------------------------------------------------------------------------------
74 # Setup BEAGLE
75 # ------------------------------------------------------------------------------
76
77 AC_ARG_WITH([beagle],
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@:>@])],
81     [],
82     [with_beagle=yes])
83    
84 AC_ARG_ENABLE(threads, 
85     [--enable-threads=[no/yes] enable thread-support when using BEAGLE [default="no"]]
86     ,,enable_threads="no")  
87
88 if test "x$with_beagle" != "xno"
89 then
90     if test "x$with_beagle" == "xyes"
91     then
92         with_beagle=/usr/local
93     fi
94
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.)])
118
119     AC_DEFINE(BEAGLE_ENABLED)
120     CFLAGS="${CFLAGS} ${BEAGLE_CFLAGS}"
121     LDFLAGS="${LDFLAGS} ${BEAGLE_LIBS}"
122    
123     # ----- Check for pthreads compatibility -------
124    
125     if test "x$enable_threads" == "xyes"
126     then
127         AC_CHECK_LIB(pthread,pthread_create,[THREAD_LIB="-lpthread"],
128         [AC_MSG_ERROR([pthreads library not found])])
129         AC_DEFINE(THREADS_ENABLED)
130     fi
131 fi
132 # ------------------------------------------------------------------------------
133
134 dnl check OS 
135 dnl case $host in
136 dnl i386-*-gnu*) 
137 dnl     bla;;
138 dnl esac
139 AC_DEFINE(UNIX_VERSION)
140
141 dnl use c for custom tests
142 AC_LANG_C
143
144 dnl check readline
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)
149     AC_LINK_IFELSE(
150     [AC_LANG_SOURCE([
151     #include <stdio.h>
152     #include <readline/readline.h>
153     #include <readline/history.h>
154     char *f(const char *a, int f) { return "a"; }
155     int main() {
156       char *text="a";
157       extern char *f(const char *, int);
158       char **matches = rl_completion_matches (text, f);
159       return 0;
160     }
161     ])],
162     AC_MSG_RESULT(yes)
163     AC_DEFINE(COMPLETIONMATCHES), AC_MSG_RESULT(no))
164 fi
165
166 dnl check for 64 bit
167 AC_MSG_CHECKING(for 32 or 64 bits cpu)
168 AC_RUN_IFELSE(
169     [AC_LANG_SOURCE([
170     int main() { return sizeof(long)==4?1:0; }
171     ])],
172     AC_MSG_RESULT(64)
173     AC_DEFINE(_64BIT), AC_MSG_RESULT(32))
174
175 dnl finish
176 if test "x$enable_mpi" == "xyes"; then
177     CC=mpicc
178 fi
179
180 AC_CONFIG_FILES([Makefile])
181 AC_OUTPUT