Codebase list ghmm / c7e75de0-eb37-4cf8-b0b7-5ff960b28365/main configure.in
c7e75de0-eb37-4cf8-b0b7-5ff960b28365/main

Tree @c7e75de0-eb37-4cf8-b0b7-5ff960b28365/main (Download .tar.gz)

configure.in @c7e75de0-eb37-4cf8-b0b7-5ff960b28365/mainraw · history · blame

dnl  author       : Achim Gaedke, Peter Pipenbacher
dnl  filename     : /zpr/bspk/src/hmm/ghmm/configure.in
dnl  created      : DATE: 2001-04-04
dnl  $Id: configure.in 2322 2013-07-29 14:57:07Z ejb177 $
dnl Copyright (C) 1998-2005 Alexander Schliep
dnl Copyright (C) 1998-2001 ZAIK/ZPR, Universitaet zu Koeln
dnl Copyright (C) 2002-2005 Max-Planck-Institut fuer Molekulare Genetik, Berlin
dnl 
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl 
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl Library General Public License for more details.
dnl 
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
dnl 
dnl 
dnl 
dnl 
dnl *******************************************************************************
dnl Parts of the library are Copyright of Sun Microsystems, Inc.
dnl and re distributed under following license
dnl 
dnl  * ====================================================
dnl  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
dnl  *
dnl  * Developed at SunPro, a Sun Microsystems, Inc. business.
dnl  * Permission to use, copy, modify, and distribute this
dnl  * software is freely granted, provided that this notice
dnl  * is preserved.
dnl  * ====================================================
dnl 

m4_include([version.m4])

dnl Process this file with autoconf to produce a configure script.
AC_INIT(ghmm, GHMM_VERSION)

AC_CONFIG_SRCDIR(ghmm/smodel.c)

AM_CONFIG_HEADER(config.h)

AM_INIT_AUTOMAKE
dnl implicit in AM_INIT_AUTOMAKE...
dnl AC_PROG_MAKE_SET

dnl load CFLAGS from cache
if test -z "$CFLAGS"; then
  AC_CACHE_CHECK(for CFLAGS, ac_cv_cflags,[ac_cv_cflags="-O2"]);
  CFLAGS="$ac_cv_cflags"
else
  ac_cv_cflags="$CFLAGS"; 
fi

dnl Checks for programs.
AC_PROG_CC
AM_PROG_LIBTOOL
AC_PROG_AWK
AC_PATH_PROG(DOXYGEN,doxygen)
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(PKGCONFIG,pkg-config)

AC_PATH_PROG(EXPECT_FOR_DEJAGNU,expect)
AC_PATH_PROG(RUNTEST_FOR_DEJAGNU,runtest)

OBSOLETE_TOOLS='smo2xml'
dnl obsolete features can be switched on or off
AC_ARG_ENABLE(obsolete,
              AC_HELP_STRING([--disable-obsolete],
                             [disable default enabled obsolete features]),
              if test "x$enable_obsolete" != "xno" ; then
                  GHMM_OBSOLETE=1
                  AC_MSG_NOTICE(obsolete features enabled)
              else
                  GHMM_OBSOLETE=0
                  OBSOLETE_TOOLS=''
                  AC_MSG_NOTICE(obsolete features disabled)
              fi,
              GHMM_OBSOLETE=0
              OBSOLETE_TOOLS=''
              AC_MSG_NOTICE(obsolete features disabled)
)


dnl unsupported features can be switched on or off
AC_ARG_ENABLE(unsupported,
              AC_HELP_STRING([--enable-unsupported],
                             [enable unsupported features [[default=no]]]),
              if test "x$enable_unsupported" != "xno" ; then
                  GHMM_UNSUPPORTED=1
                  AC_MSG_NOTICE(unsupported features enabled)
              fi,
              GHMM_UNSUPPORTED=0
              AC_MSG_NOTICE(unsupported features disabled)
)

dnl following tests with C
AC_LANG_C
dnl aborts on failure

dnl Checks for libraries.
AC_CHECK_LIB(pthread, pthread_join)

dnl Checks for header files.
AC_HEADER_STDC

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T

AC_HEADER_TIME
AC_STRUCT_TM

dnl Checks for libm functions
AC_CHECK_LIB(m, sqrt)
AC_CHECK_LIB(m, exp)
AC_CHECK_LIB(m, pow)

dnl AC_CHECK_FUNCS(tmpnam mkstemp)
dnl AC_CHECK_FUNCS(gettimeofday)

dnl use internal Mersenne Twister as default RNG
GHMM_RNG_BSD=0
GHMM_RNG_GSL=0
GHMM_RNG_MERSENNE_TWISTER=0


dnl check GSL functions and use it instead of ghmm interpolation algorithms
AC_ARG_ENABLE(gsl,
  AC_HELP_STRING([--enable-gsl], [enable gsl library [[default=no]]]),
  [ if test "x$enable_gsl" != "xno" ; then
      AC_DEFINE(DO_WITH_GSL,1,[use GSL functions instead of ghmm equivalents])

      dnl these macros are from acinclude.m4! (modified gsl.m4)
      AM_PATH_GSL(0.7,,AC_MSG_ERROR("GSL Version 0.7 or higher required."))
      LIBS="$LIBS $GSL_LIBS"
      CFLAGS="$CFLAGS $GSL_CFLAGS"
      CXXFLAGS="$CXXFLAGS $GSL_CFLAGS"

      dnl checking for gsl_inteval
      AC_MSG_CHECKING([for gsl_inteval])
      AC_TRY_COMPILE([#include <gsl/gsl_roots.h>],
        [
          gsl_interval x;
        ],
        AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_GSL_INTERVAL,1,[struct gsl_interval exists]),
        AC_MSG_RESULT(no)
      )

      dnl checking which root solver alloc function is used
      AC_MSG_CHECKING([whether gsl_root_fsolver_alloc takes one argument])
      AC_TRY_COMPILE([#include <gsl/gsl_roots.h>],
        [
          gsl_root_fsolver* s;
          s = gsl_root_fsolver_alloc (gsl_root_fsolver_bisection);
        ],
        AC_MSG_RESULT(yes)
        AC_DEFINE(GSL_ROOT_FSLOVER_ALLOC_WITH_ONE_ARG,1,[root solver allocation takes only one argument]),
        AC_MSG_RESULT(no)
      )

      dnl checking for gsl_histogram_set_ranges_uniform
      AC_MSG_CHECKING([for gsl_histogram_set_ranges_uniform])
      AC_TRY_LINK([#include <gsl/gsl_histogram.h>],
        [
          gsl_histogram* h;
          (void)gsl_histogram_set_ranges_uniform(h,-10.0,10.0);
        ],
        AC_MSG_RESULT(yes)
        AC_DEFINE(GSL_HISTOGRAM_SET_RANGES_UNIFORM,1,[gsl_histogram_set_ranges_uniform is defined]),
        AC_MSG_RESULT(no)
      )

    GHMM_RNG_GSL=1
    AC_MSG_NOTICE(using GSL random number generator)
    fi
  ],
  [
    AC_MSG_NOTICE("not using gsl")
    AC_CHECK_LIB(m, cos)
  ]
)


dnl check GSL diagonal hack and use it instead of estimating full covariance matrix
AC_ARG_ENABLE(gsl_diagonal_hack,
  AC_HELP_STRING([--enable-gsl-diagonal-hack], [use hack to estimate only diagonal covariance matrix (must use --enable-gsl) [[default=no]]]),
  [ if test "x$enable_gsl_diagonal_hack" != "xno" ; then
      AC_DEFINE(DO_WITH_GSL_DIAGONAL_HACK,1,[use hack to estimate only diagonal covariance matrix])
    fi
  ],
  [
    AC_MSG_NOTICE("not using diagonal covariance matrix hack")
  ]
)


dnl check lapack functions from atlas
AC_ARG_ENABLE(atlas,
  AC_HELP_STRING([--enable-atlas], [use matrix operations from atlas lapack [[default=no]]]),
  [
    if test "x$enable_lapack" != "xno" ; then

        AC_DEFINE(DO_WITH_ATLAS,1,[use matrix operations from lapack])

        echo -n "checking for lapack with pkg-config... "
        if $PKGCONFIG --exists lapack; then
                AC_MSG_RESULT(yes)
                LAPACK_CFLAGS=`$PKGCONFIG --cflags lapack`
                LAPACK_LIBS=`$PKGCONFIG --libs lapack`
        else
                AC_MSG_RESULT(no)
                AC_MSG_NOTICE(lapack not found with pkg-config)
                AC_MSG_NOTICE(you have to add the necessary flags to CFLAGS)
        fi

        LIBS="$LIBS $LAPACK_LIBS"
        CFLAGS="$CFLAGS $LAPACK_CFLAGS"

        dnl checking for clapack_dgetrf
        AC_MSG_CHECKING([for clapack_dgetrf in -llapack])
        AC_TRY_COMPILE([#include <clapack.h>],
        [
                double a;
                int ipiv;
                int x = clapack_dgetrf(0, 0, 0, &a, 0, &ipiv);
        ],
        AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_CLAPACK_DGETRF,1,[clapack_dgetrf exists]),
        AC_MSG_RESULT(no)
        )

        dnl checking for clapack_dgetri
        AC_MSG_CHECKING([for clapack_dgetri in -llapack])
        AC_TRY_COMPILE([#include <clapack.h>],
        [
                double a;
                int ipiv;
                int x = clapack_dgetri(0, 0, &a, 0, &ipiv);
        ],
        AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_CLAPACK_DGETRI,1,[clapack_dgetri exists]),
        AC_MSG_RESULT(no)
        )

        dnl checking for clapack_dpotrf
        AC_MSG_CHECKING([for clapack_dpotrf in -llapack])
        AC_TRY_COMPILE([#include <clapack.h>],
        [
                double a;
                int x = clapack_dpotrf(0, 0, 0, &a, 0);
        ],
        AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_CLAPACK_DPOTRF,1,[clapack_dpotrf exists]),
        AC_MSG_RESULT(no)
        )
    fi
  ],
  [
    AC_MSG_NOTICE("not using lapack")
  ]
)


dnl select random number generator
AC_ARG_WITH(rng,
            [  --with-rng=XXX          selects random number generator ("mt" (default), "bsd" or "gsl")],
            [
              case "$with_rng" in
                "bsd")
                  if test $GHMM_RNG_GSL -ne 0; then
                    AC_MSG_ERROR(the random number generator not selectable with gsl enabled)
                  fi

                  GHMM_RNG_BSD=1
                  AC_MSG_NOTICE(using BSD random number generator)
                  AC_CHECK_LIB(bsd, random)
                ;;
                "mt")
                  if test $GHMM_RNG_GSL -ne 0; then
                    AC_MSG_ERROR(the random number generator not selectable with gsl enabled)
                  fi

                  GHMM_RNG_MERSENNE_TWISTER=1
                  AC_MSG_NOTICE(using internal Mersenne-Twister random number generator)
                ;;
                "gsl")
                  if test $GHMM_RNG_GSL -ne 1; then
                    AC_MSG_ERROR(gsl random number generator only useable with --enable-gsl)
                  fi
                ;;
                *)
                  AC_MSG_ERROR(not a valid random number generator)
                ;;

              esac],
            [
              if test $GHMM_RNG_GSL -eq 0; then
                GHMM_RNG_MERSENNE_TWISTER=1
                AC_MSG_NOTICE(using internal Mersenne-Twister random number generator)
              fi
            ]
)


dnl libxml2 checks
echo -n "checking libxml2 version... "
if $PKGCONFIG --atleast-version=2.6 libxml-2.0; then
        echo "... ok"
else
        echo `$PKGCONFIG --modversion libxml-2.0`
        AC_MSG_ERROR(Failed: please install at least libxml-2.6.0)
fi

LIBXML2_CFLAGS=`$PKGCONFIG --cflags libxml-2.0`
LIBXML2_LIBS=`$PKGCONFIG --libs libxml-2.0`

LIBS="$LIBS $LIBXML2_LIBS"
CFLAGS="$CFLAGS $LIBXML2_CFLAGS"

dnl final configuration
SUBDIRS="ghmm tools tests"

dnl python wrapper can be switched on or off
AC_ARG_WITH(python,
            [
              AC_HELP_STRING([--without-python],
                             [disable build and installation of the python bindings])
            ],
            [
              if test "x$with_python" != "xno" ; then
                 AC_PATH_PROG(PYTHON, $with_python) 
                 PYTHONVER=$($PYTHON -V 2>&1 | cut -c 8-10)
                 SUBDIRS="$SUBDIRS ghmmwrapper HMMEd"
              fi
            ],
            [
              dnl default enabled
              AC_PATH_PROG(PYTHON, python)
              PYTHONVER=$($PYTHON -V 2>&1 | cut -c 8-10)
              SUBDIRS="$SUBDIRS ghmmwrapper HMMEd"
            ]
)

dnl finished
AC_SUBST(SUBDIRS)
AC_SUBST(GHMM_OBSOLETE)
AC_SUBST(OBSOLETE_TOOLS)
AC_SUBST(GHMM_UNSUPPORTED)
AC_SUBST(GHMM_RNG_BSD)
AC_SUBST(GHMM_RNG_GSL)
AC_SUBST(GHMM_RNG_MERSENNE_TWISTER)
AC_SUBST(PYTHON)
AC_SUBST(PYTHONVER)

AC_OUTPUT(Makefile \
          ghmm/Makefile \
          ghmm/ghmmconfig.h \
          tools/Makefile \
          tests/Makefile \
          tests/data/Makefile \
          tools/ghmm-config \
          ghmmwrapper/Makefile \
          HMMEd/Makefile)