1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
# 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
|