[99462a]: configure.ac.in  Maximize  Restore  History

Download this file

419 lines (361 with data), 12.1 kB

# Process this file with autoconf to produce a configure script
#-------------------------------------------------------------------
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (C) 2006, 2007  Adam Piatyszek <ediap@users.sourceforge.net>])
AC_INIT([IT++],[@PACKAGE_VERSION@],[ediap@users.sourceforge.net],[itpp])
AC_CONFIG_HEADER([itpp/config.h])
AC_CONFIG_SRCDIR([itpp/base/vec.cpp])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE

# Shared library versioning
GENERIC_LIBRARY_VERSION="@LIBRARY_VERSION@"
#                        | | |
#                 +------+ | +---+
#                 |        |     |
#              current:revision:age
#                 |        |     |
#                 |        |     +- increment if interfaces have been added;
#                 |        |        set to zero if interfaces have been
#                 |        |        removed or changed
#                 |        +- increment if source code has changed;
#                 |           set to zero if current is incremented
#                 +- increment if interfaces have been added, removed
#                    or changed
AC_SUBST(GENERIC_LIBRARY_VERSION)

# Check for host and disable building a shared library in Windows
AC_CANONICAL_HOST
case $host in
  *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
    AC_DISABLE_SHARED
    AC_ENABLE_STATIC
    ;;
  *)
    AC_ENABLE_SHARED
    AC_DISABLE_STATIC
    ;;
esac

# Checks for programs
save_CXXFLAGS="$CXXFLAGS"
AC_PROG_CXX
AC_PROG_CXXCPP
CXXFLAGS="$save_CXXFLAGS"
AC_PROG_F77
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_LN_S
AC_PROG_MAKE_SET

# Set default language to C++
AC_LANG([C++])

# Check for debug switch
AC_ARG_ENABLE(debug,
              [AS_HELP_STRING([--enable-debug],
                              [build additional debugging library])])
test "x$enable_debug" != xyes && enable_debug=no
AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = xyes])

# Check for exceptions switch
AC_ARG_ENABLE(exceptions,
              [AS_HELP_STRING([--enable-exceptions],
                              [enable exceptions handling mechanizm])],
              [AC_DEFINE([ITPP_EXCEPTIONS], [1],
                         [Define if you want exceptions handling])])
test "x$enable_exceptions" != xyes && enable_exceptions=no

# Check for html-doc switch
AC_ARG_ENABLE(html-doc,
              [AS_HELP_STRING([--disable-html-doc],
                              [do not generate HTML documentation])])
test "x$enable_html_doc" != xno && enable_html_doc=yes


# Check for optional modules
AC_ARG_ENABLE(comm,
              [AS_HELP_STRING([--disable-comm],
                              [do not include communications module])])
AC_ARG_ENABLE(fixed,
              [AS_HELP_STRING([--disable-fixed],
                              [do not include fixed-point module])])
AC_ARG_ENABLE(optim,
              [AS_HELP_STRING([--disable-optim],
                              [do not include optimization module])])
AC_ARG_ENABLE(protocol,
              [AS_HELP_STRING([--disable-protocol],
                              [do not include protocol module])])
AC_ARG_ENABLE(signal,
              [AS_HELP_STRING([--disable-signal],
                              [do not include signal processing module])])
AC_ARG_ENABLE(srccode,
              [AS_HELP_STRING([--disable-srccode],
                              [do not include source coding module])])

test "x$enable_fixed" != xno && enable_fixed=yes
test "x$enable_optim" != xno && enable_optim=yes
test "x$enable_protocol" != xno && enable_protocol=yes
test "x$enable_signal" != xno && enable_signal=yes
if test "x$enable_comm" != xno; then
  enable_signal=yes
  enable_comm=yes
fi
if test "x$enable_srccode" != xno; then
  enable_signal=yes
  enable_srccode=yes
fi

AM_CONDITIONAL([ENABLE_COMM], [test "x$enable_comm" = xyes])
AM_CONDITIONAL([ENABLE_FIXED], [test "x$enable_fixed" = xyes])
AM_CONDITIONAL([ENABLE_OPTIM], [test "x$enable_optim" = xyes])
AM_CONDITIONAL([ENABLE_PROTOCOL], [test "x$enable_protocol" = xyes])
AM_CONDITIONAL([ENABLE_SIGNAL], [test "x$enable_signal" = xyes])
AM_CONDITIONAL([ENABLE_SRCCODE], [test "x$enable_srccode" = xyes])


PACKAGE_DEBUG="$PACKAGE"
# Set debug flags
if test "x$enable_debug" = xyes; then
  PACKAGE_DEBUG="$PACKAGE"_debug
  if test "x$CXXFLAGS_DEBUG" = x; then
    CXXFLAGS_DEBUG="-g"
    # Only for GCC compiler
    if test "x$GXX" = xyes; then
      CXXFLAGS_DEBUG="-Wall -Werror $CXXFLAGS_DEBUG -pipe"
    fi
  fi
fi
# Remove unnecesary white spaces from LIBS
CXXFLAGS_DEBUG="`echo \"$CXXFLAGS_DEBUG\" | sed -e 's/  */ /g' -e 's/^ //' -e 's/ $//'`"
AC_SUBST(CXXFLAGS_DEBUG)
AC_SUBST(PACKAGE_DEBUG)

# Set optimised flags
if test "x$CXXFLAGS" = x; then
  CXXFLAGS_OPT="-DNDEBUG -O3"
  # Only for GCC compiler
  if test "x$GXX" = xyes; then
    CXXFLAGS_OPT="$CXXFLAGS_OPT -pipe"
  fi
else
  CXXFLAGS_OPT="$CXXFLAGS"
  CXXFLAGS=""
fi
CXXFLAGS_OPT="`echo \"$CXXFLAGS_OPT\" | sed -e 's/  */ /g' -e 's/^ //' -e 's/ $//'`"
AC_SUBST(CXXFLAGS_OPT)


# Checks for documentation build tools
AC_CHECK_PROG([doxygen_ok], [doxygen], [yes], [no])
AC_CHECK_PROG([latex_ok], [latex], [yes], [no])
AC_CHECK_PROG([dvips_ok], [dvips], [yes], [no])
AC_CHECK_PROG([gs_ok], [gs], [yes], [no])
if test "x$enable_html_doc" != xno; then
  test "x$doxygen_ok" != xyes && enable_html_doc=no
  test "x$latex_ok" != xyes && enable_html_doc=no
  test "x$dvips_ok" != xyes && enable_html_doc=no
  test "x$gs_ok" != xyes && enable_html_doc=no
  AC_PATH_PROG([PERL], [perl], [])
fi
AM_CONDITIONAL([HTML_DOC], [test "x$enable_html_doc" = xyes])


# Check for diff program used for tests
AC_CHECK_PROG([diff_ok], [diff], [yes], [no])
AC_CHECK_PROG([sed_ok], [sed], [yes], [no])
enable_tests=yes
test "x$diff_ok" != xyes && enable_tests=no
test "x$sed_ok" != xyes && enable_tests=no
AM_CONDITIONAL([RUN_TESTS], [test "x$enable_tests" = xyes])


# Checks for header files
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS([cmath \
  complex \
  ieeefp.h])


# Checks for global declarations
AC_CHECK_DECLS(signgam, , , [#include <cmath>])


# Checks for functions
AC_CHECK_FUNCS([asinh \
  acosh \
  atanh \
  cbrt \
  erf \
  erfc \
  finite \
  fpclass \
  isfinite \
  isinf \
  isnan \
  lgamma \
  log1p \
  log2 \
  rint \
  tgamma])


# Check for finite and fpclass on Solaris
AC_CHECK_FUNC(finite, ,
  [AC_CHECK_FUNC(isfinite, ,
    [AC_TRY_LINK([[#include <ieeefp.h>]], [[float f = 0.0; isfinite(f);]],
      [AC_DEFINE(HAVE_ISFINITE)])])])
AC_CHECK_FUNC(fpclass, ,
  [AC_TRY_LINK([[#include <ieeefp.h>]], [[float f = 0.0; fpclass(f);]],
    [AC_DEFINE(HAVE_FPCLASS)])])


# Check for types
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(unsigned short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(unsigned long long)


# Check if C++ compiler supports "extern template"
AC_CXX_EXTERN_TEMPLATE


# Check if we have Fortran compiler
if test "x$F77" != x; then
  # Checks for BLAS (ACML, MKL, ATLAS or NETLIB)
  ACX_BLAS
  # Checks for LAPACK (ACML, MKL, ATLAS or NETLIB)
  ACX_LAPACK
else
  acx_blas_ok=nofortran;
  blas_mkl_ok=no;
  blas_acml_ok=no;
  blas_atlas_ok=no;
  acx_lapack_ok=noblas;
fi

# Checks for FFT (ACML, MKL or FFTW3)
ACX_FFT

# Set LIBS
if test $acx_blas_ok = yes; then
  LIBS="$BLAS_LIBS $LIBS"
  if test "x$LAPACK_LIBS" != x; then
    LIBS="$LAPACK_LIBS $LIBS"
  fi
fi
if test "x$FFT_LIBS" != x; then
  LIBS="$FFT_LIBS $LIBS"
fi

# Remove unnecesary white spaces from CPPFLAGS, LDFLAGS and LIBS
CPPFLAGS="`echo \"$CPPFLAGS\" | sed -e 's/  */ /g' -e 's/^ //' -e 's/ $//'`"
LDFLAGS="`echo \"$LDFLAGS\" | sed -e 's/  */ /g' -e 's/^ //' -e 's/ $//'`"
LIBS="`echo \"$LIBS\" | sed -e 's/  */ /g' -e 's/^ //' -e 's/ $//'`"
LDLIBS="`echo \"$LDFLAGS $LIBS\" | sed -e 's/^ //' -e 's/ $//'`"
AC_SUBST(LDLIBS)

# Set conditional BUILD_ZDOTUSUB flag for ZDOTU Fortran wrapper
AM_CONDITIONAL([BUILD_ZDOTUSUB],
  [test "x$acx_blas_ok" = xyes && test "x$blas_mkl_ok" = xno])

# Set conditionals for runing test programs
AM_CONDITIONAL([RUN_LAPACK_TESTS], [test "x$acx_lapack_ok" = xyes])
AM_CONDITIONAL([RUN_FFT_TESTS], [test "x$acx_fft_ok" = xyes])

# config.h top and bottom
AH_TOP([
#ifndef CONFIG_H
#define CONFIG_H
])

AH_BOTTOM([
#if defined(HAVE_CMATH)
#  include <cmath>
#endif

/* Solaris uses <ieeefp.h> for declaring isnan() and finite() functions */
#if defined(HAVE_IEEEFP_H)
#  include <ieeefp.h>
#endif

/* Microsoft Visual C++ .NET underscore prefixed functions */
#if defined(_MSC_VER)
#  include <cfloat>
#  define HAVE_FINITE 1
#  define finite(x) _finite(x)
#  define HAVE_ISNAN 1
#  define isnan(x) _isnan(x)
#  define HAVE_FPCLASS 1
#  define fpclass(x) _fpclass(x)
#  define HAVE_JN 1
#  define jn(a, b) _jn(a, b)
#  define HAVE_YN 1
#  define yn(a, b) _yn(a, b)
#  define HAVE_J0 1
#  define j0(a) _j0(a)
#  define HAVE_J1 1
#  define j1(a) _j1(a)
#endif /* defined(_MSC_VER) */

#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
#  define HAVE_ISINF 1
#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
#endif

#if (! defined (HAVE_FINITE) && defined (HAVE_ISFINITE))
#  define HAVE_FINITE 1
#  define finite(a) isfinite(a)
#endif

#if (! defined(HAVE_FINITE) && defined(HAVE_ISNAN) && defined(HAVE_ISINF))
#  define HAVE_FINITE 1
#  define finite(a) (! isnan(a) && ! isinf(a))
#endif

#endif /* #ifndef CONFIG_H */
])


# Define configured files
AC_CONFIG_FILES([Makefile \
  itpp/Makefile \
  itpp/base/Makefile \
  itpp/base/algebra/Makefile \
  itpp/base/bessel/Makefile \
  itpp/base/math/Makefile \
  itpp/comm/Makefile \
  itpp/fixed/Makefile \
  itpp/optim/Makefile \
  itpp/protocol/Makefile \
  itpp/signal/Makefile \
  itpp/srccode/Makefile \
  itpp/stat/Makefile \
  doc/Makefile \
  doc/images/Makefile \
  doc/tutorial/Makefile \
  doc/tutorial/src/Makefile \
  doc/local/Makefile \
  doc/local/index.doc \
  doc/doxygen_html.cfg \
  extras/Makefile \
  tests/Makefile \
  win32/Makefile \
  win32/itpp_acml_tests/Makefile \
  win32/itpp_mkl_tests/Makefile \
  itpp.pc \
  itpp-config])

AC_OUTPUT

echo "
------------------------------------------------------------------------------
$PACKAGE-$VERSION library configuration:
------------------------------------------------------------------------------

Directories:
  - prefix ......... : ${prefix}
  - exec_prefix .... : ${exec_prefix}
  - includedir ..... : ${includedir}
  - libdir ......... : ${libdir}
  - datarootdir .... : ${datarootdir}
  - docdir ......... : ${docdir}

Switches:
  - debug .......... : ${enable_debug}
  - exceptions ..... : ${enable_exceptions}
  - html-doc ....... : ${enable_html_doc}
  - shared ......... : ${enable_shared}
  - static ......... : ${enable_static}

Documentation tools:
  - doxygen ........ : ${doxygen_ok}
  - latex .......... : ${latex_ok}
  - dvips .......... : ${dvips_ok}
  - ghostscript .... : ${gs_ok}

Testing tools:
  - diff ........... : ${diff_ok}
  - sed ............ : ${sed_ok}

Optional modules:
  - comm ........... : ${enable_comm}
  - fixed .......... : ${enable_fixed}
  - optim .......... : ${enable_optim}
  - protocol ....... : ${enable_protocol}
  - signal ......... : ${enable_signal}
  - srccode ........ : ${enable_srccode}

External libs:
  - BLAS ........... : ${acx_blas_ok}
    * MKL .......... : ${blas_mkl_ok}
    * ACML ......... : ${blas_acml_ok}
    * ATLAS ........ : ${blas_atlas_ok}
  - LAPACK ......... : ${acx_lapack_ok}
  - FFT ............ : ${acx_fft_ok}
    * MKL .......... : ${fft_mkl_ok}
    * ACML ......... : ${fft_acml_ok}
    * FFTW ......... : ${fftw3_ok}

Compiler/linker flags/libs/defs:
  - CXX ............ : ${CXX}
  - F77 ............ : ${F77}
  - CXXFLAGS ....... : ${CXXFLAGS_OPT}
  - CXXFLAGS_DEBUG . : ${CXXFLAGS_DEBUG}
  - CPPFLAGS ....... : ${CPPFLAGS}
  - LDFLAGS ........ : ${LDFLAGS}
  - LIBS ........... : ${LIBS}

------------------------------------------------------------------------------
Now type 'make && make install' to build and install $PACKAGE-$VERSION library
------------------------------------------------------------------------------
"