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 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_CHECK_FILE($with_beagle/libhmsbeagle/beagle.h, [BEAGLE_CFLAGS="-I$with_beagle"], [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_CHECK_FILE($with_beagle/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_CHECK_FILE($with_beagle/libhmsbeagle/libs, [BEAGLE_LIBS="-L$with_beagle/libhmsbeagle/libs -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 #include #include 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