]> git.donarmstrong.com Git - mrbayes.git/blob - src/configure.in
fix path to libhmsbeagle
[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_CHECK_FILE($with_beagle/libhmsbeagle/beagle.h,
100             [BEAGLE_CFLAGS="-I$with_beagle"],   
101         [AC_MSG_ERROR([beagle's library include file beagle.h is not found neither in 
102          ${with_beagle}/include/libhmsbeagle/libhmsbeagle/ nor in 
103          ${with_beagle}/include/libhmsbeagle-1/libhmsbeagle/]. You should either install 
104          beagle library from http://code.google.com/p/beagle-lib/ or disable use of 
105          beagle library by invoking configure script with option --with-beagle=no. 
106          Note: without beagle library MrBayes may run slower.)])])
107          ])
108     AC_CHECK_FILE($with_beagle/include/libhmsbeagle/libhmsbeagle/platform.h,,
109        [AC_CHECK_FILE($with_beagle/include/libhmsbeagle-1/libhmsbeagle/platform.h,,   
110          [AC_CHECK_FILE($with_beagle/libhmsbeagle/platform.h,,
111         [AC_MSG_ERROR([beagle's library include file platform.h is not found neither in 
112          ${with_beagle}/include/libhmsbeagle/libhmsbeagle/ nor in 
113          ${with_beagle}/include/libhmsbeagle-1/libhmsbeagle/]. You should either install 
114          beagle library from http://code.google.com/p/beagle-lib/ or disable use of 
115          beagle library by invoking configure script with option --with-beagle=no. 
116          Note: without beagle library MrBayes may run slower.)])])
117          ])
118     AC_CHECK_FILE($with_beagle/lib,[BEAGLE_LIBS="-L$with_beagle/lib -lhmsbeagle"],
119         [AC_CHECK_FILE($with_beagle/libhmsbeagle/libs,
120         [BEAGLE_LIBS="-L$with_beagle/libhmsbeagle/libs -lhmsbeagle"],
121        [AC_MSG_ERROR([beagle library is not found in ${with_beagle}]. You should either 
122         install beagle library from http://code.google.com/p/beagle-lib/ or disable use 
123         of beagle library by invoking configure script with option --with-beagle=no. 
124         Note: without beagle library MrBayes may run slower.)])
125         ])
126
127     AC_DEFINE(BEAGLE_ENABLED)
128     CFLAGS="${CFLAGS} ${BEAGLE_CFLAGS}"
129     LDFLAGS="${LDFLAGS} ${BEAGLE_LIBS}"
130    
131     # ----- Check for pthreads compatibility -------
132    
133     if test "x$enable_threads" == "xyes"
134     then
135         AC_CHECK_LIB(pthread,pthread_create,[THREAD_LIB="-lpthread"],
136         [AC_MSG_ERROR([pthreads library not found])])
137         AC_DEFINE(THREADS_ENABLED)
138     fi
139 fi
140 # ------------------------------------------------------------------------------
141
142 dnl check OS 
143 dnl case $host in
144 dnl i386-*-gnu*) 
145 dnl     bla;;
146 dnl esac
147 AC_DEFINE(UNIX_VERSION)
148
149 dnl use c for custom tests
150 AC_LANG_C
151
152 dnl check readline
153 AC_CHECK_LIB([readline], [readline])
154 if test $ac_cv_lib_readline_readline = yes; then
155     LDFLAGS=${LDFLAGS}" -lreadline"
156     AC_MSG_CHECKING(for rl_completion_matches function)
157     AC_LINK_IFELSE(
158     [AC_LANG_SOURCE([
159     #include <stdio.h>
160     #include <readline/readline.h>
161     #include <readline/history.h>
162     char *f(const char *a, int f) { return "a"; }
163     int main() {
164       char *text="a";
165       extern char *f(const char *, int);
166       char **matches = rl_completion_matches (text, f);
167       return 0;
168     }
169     ])],
170     AC_MSG_RESULT(yes)
171     AC_DEFINE(COMPLETIONMATCHES), AC_MSG_RESULT(no))
172 fi
173
174 dnl check for 64 bit
175 AC_MSG_CHECKING(for 32 or 64 bits cpu)
176 AC_RUN_IFELSE(
177     [AC_LANG_SOURCE([
178     int main() { return sizeof(long)==4?1:0; }
179     ])],
180     AC_MSG_RESULT(64)
181     AC_DEFINE(_64BIT), AC_MSG_RESULT(32))
182
183 dnl finish
184 if test "x$enable_mpi" == "xyes"; then
185     CC=mpicc
186 fi
187
188 AC_CONFIG_FILES([Makefile])
189 AC_OUTPUT