Files
libquantum/configure.in
2016-10-27 04:32:19 +09:00

150 lines
4.2 KiB
Plaintext

# configure.in: Process this file with autoconf to produce a configure
# script.
#
# Copyright 2003-2013 Bjoern Butscher, Hendrik Weimer
#
# This file is part of libquantum
#
# libquantum is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# libquantum is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with libquantum; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA
AC_INIT([libquantum], [1.1.1], [libquantum@libquantum.de])
AC_CONFIG_SRCDIR([classic.c])
AC_CONFIG_HEADER([config.h])
# The language of our choice
AC_LANG([C])
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
# Checks for libraries.
AC_CHECK_LIB([m], [sqrt])
AC_ARG_WITH(lapack,
[ --with-lapack LAPACK support [[default=yes]]],
[if test $withval = "yes"
then
AC_CHECK_LIB([lapack], [cheev_])
fi] , [AC_CHECK_LIB([lapack], [cheev_])])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
# Check for 64-bit integer
AC_ARG_WITH([max-unsigned-type],
[ --with-max-unsigned-type=ARG
integer type for quantum registers],
[MU_TYPE=$withval], [MU_TYPE="none"
AC_CHECK_TYPE([uint_64t], [AC_DEFINE([MAX_UNSIGNED], [uint_64t])
MU_TYPE="uint_64t"])])
if test "$MU_TYPE" = "none"
then
AC_CHECK_TYPE([u_int_64t], [AC_DEFINE([MAX_UNSIGNED], [u_int_64t])
MU_TYPE="u_int_64t"])
fi
if test "$MU_TYPE" = "none"
then
AC_CHECK_TYPE([unsigned long long], [AC_DEFINE(MAX_UNSIGNED,
[unsigned long long], [Integer type for quantum registers])
MU_TYPE="unsigned long long"])
fi
if test "$MU_TYPE" = "none"
then
AC_MSG_ERROR([No 64-bit integer type!])
fi
# Check for complex number type
AC_ARG_WITH([complex-type],
[ --with-complex-type=ARG type for complex numbers],
[CF_TYPE=$withval], [CF_TYPE="none"
AC_CHECK_TYPE([float complex], [AC_DEFINE([COMPLEX_FLOAT],
[float complex])
CF_TYPE="float complex"])])
if test "$CF_TYPE" = "none"
then
AC_CHECK_TYPE([float _Complex], [AC_DEFINE([COMPLEX_FLOAT],
[float _Complex])
CF_TYPE="float _Complex"])
fi
if test "$CF_TYPE" = "none"
then
AC_CHECK_TYPE([__complex__ float], [AC_DEFINE([COMPLEX_FLOAT],
[__complex__ float], [Complex data type])
CF_TYPE="__complex__ float"])
fi
if test "$CF_TYPE" = "none"
then
AC_MSG_ERROR([No complex number type!])
fi
AC_MSG_CHECKING([for corresponding real data type])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([], [return sizeof($CF_TYPE) == 2*sizeof(double)])],
[RF_TYPE="float"],
[RF_TYPE="double"; AC_DEFINE(USE_DOUBLE)], [float])
AC_MSG_RESULT($RF_TYPE)
# Check for the imaginary unit
AC_MSG_CHECKING([for the imaginary unit])
AC_ARG_WITH([imaginary],
[ --with-imaginary=ARG name of the imaginary unit],
[I=$withval], [I="none"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$CF_TYPE z;], [z=I;])],
[AC_DEFINE([IMAGINARY], [I], [Imaginary unit]) I="I"])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$CF_TYPE z;], [z=_Complex_I;])],
[AC_DEFINE([IMAGINARY], [_Complex_I]) I="_Complex_I"])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$CF_TYPE z;], [z=1i;])],
[AC_DEFINE([IMAGINARY], [1i]) I="1i"])])
if test $I = "none"
then
AC_MSG_ERROR([No imaginary unit!])
fi
AC_MSG_RESULT($I)
# Check for OpenMP support
AC_OPENMP
# Substitute fields in quantum.h.in and types.h
AC_SUBST(MU_TYPE)
AC_SUBST(CF_TYPE)
AC_SUBST(RF_TYPE)
AC_SUBST(I)
# Profiling check
AC_ARG_ENABLE(profiling,
[ --enable-profiling compile with profiling support],
[if test $enableval = "yes"
then CFLAGS="$CFLAGS -pg -fprofile-arcs -ftest-coverage"
fi], [])
# Enable -Wall for gcc
if test $CC = "gcc"
then
AC_DEFINE(HAVE_GCC)
CFLAGS="$CFLAGS -Wall"
fi
# Write the output files
AC_CONFIG_FILES([Makefile quantum.h types.h])
AC_OUTPUT