1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-06-01 10:55:36 +02:00
qmckl/configure.ac

287 lines
8.4 KiB
Plaintext
Raw Normal View History

2021-05-07 12:47:56 +02:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
2021-05-10 23:56:26 +02:00
# QMCkl - Quantum Monte Carlo kernel library
#
# BSD 3-Clause License
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# Copyright (c) 2020, TREX Center of Excellence
# All rights reserved.
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2021-05-04 17:10:20 +02:00
2021-05-07 12:47:56 +02:00
AC_PREREQ([2.69])
2021-05-12 01:51:26 +02:00
AC_INIT([qmckl],[0.1.1],
2021-05-04 17:10:20 +02:00
[https://github.com/TREX-CoE/qmckl/issues], [],
[https://trex-coe.github.io/qmckl/index.html])
2021-06-03 01:32:50 +02:00
AC_CONFIG_AUX_DIR(tools)
2021-05-11 12:56:41 +02:00
AM_INIT_AUTOMAKE([subdir-objects color-tests parallel-tests silent-rules 1.11])
2021-05-10 23:56:26 +02:00
AM_MAINTAINER_MODE()
LT_INIT
2021-10-28 17:52:03 +02:00
AC_CONFIG_SRCDIR([configure.ac])
2021-05-09 02:12:38 +02:00
AC_CONFIG_HEADERS([include/config.h])
2021-05-07 12:47:56 +02:00
AC_CONFIG_MACRO_DIR([m4])
2021-05-04 17:10:20 +02:00
2021-05-07 12:47:56 +02:00
VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d. -f1`
VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d. -f2`
VERSION_PATCH=`echo ${PACKAGE_VERSION} | cut -d. -f3 | cut -d- -f1`
2021-10-14 10:50:51 +02:00
AC_DEFINE_UNQUOTED([QMCKL_VERSION_MAJOR], [$VERSION_MAJOR], [major version])
AC_DEFINE_UNQUOTED([QMCKL_VERSION_MINOR], [$VERSION_MINOR], [minor version])
AC_DEFINE_UNQUOTED([QMCKL_VERSION_PATCH], [$VERSION_PATCH], [patch version])
2021-05-10 23:56:26 +02:00
AC_SUBST([VERSION_MAJOR])
AC_SUBST([VERSION_MINOR])
AC_SUBST([VERSION_PATCH])
2021-05-04 17:10:20 +02:00
2021-05-07 12:47:56 +02:00
#AM_SILENT_RULES(yes)
#AC_SUBST(SHARED_VERSION_INFO)
#AM_ENABLE_SHARED(no) dnl shared libs cause too many headaches to be default
2021-05-04 17:10:20 +02:00
2021-05-07 12:47:56 +02:00
AC_LANG(C)
# Checks for programs.
AC_PROG_CC
2021-06-03 01:32:50 +02:00
# Make sure the c compiler supports C99
m4_version_prereq([2.70],[], [AC_PROG_CC_C99])
AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not support C99])])
2021-05-07 12:47:56 +02:00
AC_PROG_CC_C_O
AC_PROG_FC
2021-05-04 17:10:20 +02:00
AC_PROG_FC_C_O
AC_FC_SRCEXT([f90])
AC_FC_FREEFORM
2021-05-10 23:56:26 +02:00
AC_PROG_LIBTOOL
2021-05-07 12:47:56 +02:00
AC_PROG_INSTALL
AC_PROG_LN_S
2021-05-10 23:56:26 +02:00
PKG_PROG_PKG_CONFIG([])
2021-05-07 12:47:56 +02:00
PKG_LIBS=""
PKG_CFLAGS=""
# Checks for libraries.
2021-05-04 17:10:20 +02:00
2021-05-07 12:47:56 +02:00
AC_FC_LIBRARY_LDFLAGS
2021-05-04 17:10:20 +02:00
2021-05-07 12:47:56 +02:00
AC_CHECK_LIB([m], [sqrt])
2021-05-12 23:51:59 +02:00
AC_CHECK_HEADERS([assert.h errno.h math.h pthread.h stdbool.h stdint.h stdio.h stdlib.h string.h])
2021-05-07 12:47:56 +02:00
## pthread
2021-05-04 17:10:20 +02:00
AC_CHECK_LIB([pthread], [pthread_create])
2021-05-07 12:47:56 +02:00
# OpenMP
2021-05-09 01:07:17 +02:00
#AC_ARG_WITH(openmp, [AC_HELP_STRING([--with-openmp],[enable OpenMP])], with_omp=$withval, with_omp=no)
#if test "x$with_omp" = xyes; then
2021-10-06 13:01:11 +02:00
# AC_DEFINE([HAVE_OPENMP], [1], [Define to use OpenMP threading.])
2021-05-09 01:07:17 +02:00
# AX_OPENMP([],
# [AC_MSG_ERROR([Could not find OpenMP flags; configure with --without-openmp])])
# CFLAGS="${CFLAGS} ${OPENMP_CFLAGS}"
#fi
2021-05-07 12:47:56 +02:00
2021-10-06 13:01:11 +02:00
# TREXIO
AC_ARG_WITH(trexio, [AC_HELP_STRING([--without-trexio],[disable support for TREXIO])],
with_trexio=$withval, with_trexio=yes)
AS_IF([test "x$with_trexio" != xno], [
AC_DEFINE([HAVE_TREXIO], [1], [Define if your have libtrexio])
ARGS="${ARGS} trexio"
AC_CHECK_LIB([trexio], [trexio_open],
[],
[AS_IF([test "x$with_trexio" != xcheck],
[PKG_CHECK_MODULES([TREXIO], [trexio]) ])
])
])
PKG_CFLAGS="$PKG_CFLAGS $TREXIO_CFLAGS"
PKG_LIBS="$PKG_LIBS $TREXIO_LIBS"
2021-05-07 12:47:56 +02:00
## BLAS
#AX_BLAS([], [AC_MSG_ERROR([BLAS was not found.])])
## LAPACK
#AX_LAPACK([], [AC_MSG_ERROR([LAPACK was not found.])])
2021-05-07 13:16:46 +02:00
# Options.
2021-05-07 12:47:56 +02:00
2021-05-07 13:16:46 +02:00
AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[compile for debugging])], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS \
-Wall -W -Wbad-function-cast -Wcast-qual \
-Wpointer-arith -Wcast-align -Wpedantic -Wextra -fmax-errors=3"
fi
if test "$GFC" = "yes"; then
FCFLAGS="$FCFLAGS \
-fcheck=all -Waliasing -Wampersand -Wconversion \
-Wsurprising -ffpe-trap=zero,overflow,underflow \
-Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation \
-Wreal-q-constant -Wuninitialized -fbacktrace -finit-real=nan"
fi
if test "$FC" = "ifort"; then
FCFLAGS="$FCFLAGS \
-traceback -check all -debug all -fpe-all=0 -implicitnone"
fi
AC_DEFINE(DEBUG,1,[Define to turn on debugging checks])
2021-05-09 02:12:38 +02:00
ARGS="${ARGS} debug"
2021-05-07 13:16:46 +02:00
fi
2021-05-07 12:47:56 +02:00
2021-05-09 02:12:38 +02:00
AC_ARG_ENABLE(malloc-trace, [AC_HELP_STRING([--enable-malloc-trace],[use debug malloc/free])], ok=$enableval, ok=no)
2021-05-07 13:16:46 +02:00
if test "$ok" = "yes"; then
2021-05-09 02:12:38 +02:00
AC_DEFINE(MALLOC_TRACE,"malloc_trace.dat",[Define to use debugging malloc/free])
ARGS="${ARGS} malloc-trace"
2021-05-07 13:16:46 +02:00
fi
AC_ARG_ENABLE(prof, [AC_HELP_STRING([--enable-prof],[compile for profiling])], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
CFLAGS="${CFLAGS} -pg"
AC_DEFINE(ENABLE_PROF,1,[Define when using the profiler tool])
2021-05-09 02:12:38 +02:00
ARGS="${ARGS} prof"
2021-05-07 13:16:46 +02:00
fi
AC_ARG_WITH(efence, [AC_HELP_STRING([--with-efence],[use ElectricFence library])], ok=$withval, ok=no)
if test "$ok" = "yes"; then
AC_CHECK_LIB(efence, malloc)
2021-05-09 02:12:38 +02:00
ARGS="${ARGS} efence"
2021-05-07 13:16:46 +02:00
fi
# Checks for header files.
## qmckl
AC_CHECK_HEADERS([inttypes.h malloc.h stdint.h stdlib.h string.h strings.h unistd.h])
2021-05-07 12:47:56 +02:00
# Checks for typedefs, structures, and compiler characteristics.
## qmckl
AC_CHECK_HEADER_STDBOOL
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
# Checks for library functions.
## qmckl
Integration of Verificarlo CI tests (#1) * comment * Update distance test code The distance test has been updated to the latest version, with a first attempt at using vfc_probes inside it * Functional implementation of vfc_probes in the distance tests This commit has the first functional vfc_ci tests. Verificarlo tests should be written over the existing tests, and they can be enabled with the following configure command: QMCKL_DEVEL=1 ./configure --prefix=$PWD/_install --enable-maintainer-mode --enable-vfc_ci CC="verificarlo-f -Mpreprocess -D VFC_CI" FC="verificarlo-f -Mpreprocess -D VFC_CI" --host=x86_64 The --enable-vfc_ci flag will trigger the linking of the vfc_ci library. Moreover, as of now, the "-Mpreprocess" and "-D VFC_CI" flags have to be specified directly here. There is probably an appropriate macro to place those flags into but I couldn't find it yet, and could only manage to build the tests this way. When the VFC_CI preprocessor is defined, somme additional code to register and export the test probes can be executed (see qmckl_distance.org). As of now, the tests are built as normal, even though they are expected to fail : make all make check From there, the test_qmckl_distance (and potentially the others) executable can be called at will. This will typically be done automatically by vfc_ci, but one could manually execute the executable by defining the following env variables : VFC_PROBES_OUTPUT="test.csv" VFC_BACKENDS="libinterflop_ieee.so" depending on the export file and the Verificarlo backend to be used. The next steps will be to define more tests such as this one, and to integrate them into a Verificarlo CI workflow (by writing a vfc_tests_config.json file and using the automatic CI setup command). * Error in FOrtran interface fixed * Added missing Fortran interfaces * Modify distance test and install process integration All probes are now ignored using only the preprocessor (instead of checking for a facultative argument) in the distance test. Moreover,preprocessing can now be enabled correctly using FCFLAGS (the issue seemed to come from the order of the arguments passed to gfortran/verificarlo-f with the preprocessor arg having to come first). * Add vfc_probes to AO tests vfc_probes have been added to qmckl_ao.org in the same way as qmckl_distance.org, which means that it can be enabled or disabled at compile time using the --enable-vfc_ci option. qmckl_distance.org has been slightly modified with a better indentation, and configure.ac now adds the "-D VFC_CI" flag to CFLAGS when vfc_ci is enabled. Co-authored-by: Anthony Scemama <scemama@irsamc.ups-tlse.fr>
2021-07-07 13:42:42 +02:00
# AC_FUNC_MALLOC
2021-05-07 12:47:56 +02:00
AC_CHECK_FUNCS([memset strerror])
2021-05-11 11:45:49 +02:00
# Development mode
2021-11-01 09:55:51 +01:00
if test "x$enable_maintainer_mode" == "xyes" ; then
QMCKL_DEVEL=" -- Developer mode"
else
QMCKL_DEVEL=""
fi
2021-05-11 11:45:49 +02:00
AM_CONDITIONAL([QMCKL_DEVEL],[test "x$QMCKL_DEVEL" != x])
2021-05-07 12:47:56 +02:00
2021-05-11 11:45:49 +02:00
if test "x${QMCKL_DEVEL}" != "x"; then
2021-05-10 23:56:26 +02:00
AC_PROG_AWK
2021-06-03 01:32:50 +02:00
AM_PATH_PYTHON
${PYTHON} ${srcdir}/tools/build_makefile.py
2021-05-10 23:56:26 +02:00
AC_CHECK_PROGS([EMACS],[emacs26 emacs],[no])
if test x${EMACS} == xno ; then
AC_MSG_ERROR([
--------------------------------------
Error: Emacs is required for org-mode.
--------------------------------------
])
fi
AC_CHECK_PROGS([HAS_CPPCHECK],[cppcheck],[no])
if test x${HAS_CPPCHECK} != xno ; then
HAS_CPPCHECK=1
fi
2021-05-07 12:47:56 +02:00
2021-05-11 11:45:49 +02:00
fi
2021-05-04 17:10:20 +02:00
Integration of Verificarlo CI tests (#1) * comment * Update distance test code The distance test has been updated to the latest version, with a first attempt at using vfc_probes inside it * Functional implementation of vfc_probes in the distance tests This commit has the first functional vfc_ci tests. Verificarlo tests should be written over the existing tests, and they can be enabled with the following configure command: QMCKL_DEVEL=1 ./configure --prefix=$PWD/_install --enable-maintainer-mode --enable-vfc_ci CC="verificarlo-f -Mpreprocess -D VFC_CI" FC="verificarlo-f -Mpreprocess -D VFC_CI" --host=x86_64 The --enable-vfc_ci flag will trigger the linking of the vfc_ci library. Moreover, as of now, the "-Mpreprocess" and "-D VFC_CI" flags have to be specified directly here. There is probably an appropriate macro to place those flags into but I couldn't find it yet, and could only manage to build the tests this way. When the VFC_CI preprocessor is defined, somme additional code to register and export the test probes can be executed (see qmckl_distance.org). As of now, the tests are built as normal, even though they are expected to fail : make all make check From there, the test_qmckl_distance (and potentially the others) executable can be called at will. This will typically be done automatically by vfc_ci, but one could manually execute the executable by defining the following env variables : VFC_PROBES_OUTPUT="test.csv" VFC_BACKENDS="libinterflop_ieee.so" depending on the export file and the Verificarlo backend to be used. The next steps will be to define more tests such as this one, and to integrate them into a Verificarlo CI workflow (by writing a vfc_tests_config.json file and using the automatic CI setup command). * Error in FOrtran interface fixed * Added missing Fortran interfaces * Modify distance test and install process integration All probes are now ignored using only the preprocessor (instead of checking for a facultative argument) in the distance test. Moreover,preprocessing can now be enabled correctly using FCFLAGS (the issue seemed to come from the order of the arguments passed to gfortran/verificarlo-f with the preprocessor arg having to come first). * Add vfc_probes to AO tests vfc_probes have been added to qmckl_ao.org in the same way as qmckl_distance.org, which means that it can be enabled or disabled at compile time using the --enable-vfc_ci option. qmckl_distance.org has been slightly modified with a better indentation, and configure.ac now adds the "-D VFC_CI" flag to CFLAGS when vfc_ci is enabled. Co-authored-by: Anthony Scemama <scemama@irsamc.ups-tlse.fr>
2021-07-07 13:42:42 +02:00
# Enable Verificarlo tests
AC_ARG_ENABLE([vfc_ci],
[ --enable-vfc_ci Build the library with vfc_ci support],
[case "${enableval}" in
yes) vfc_ci=true && FCFLAGS="-D VFC_CI $FCFLAGS" && CFLAGS="-D VFC_CI $CFLAGS";;
no) vfc_ci=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable_vfc_ci]) ;;
esac],[vfc_ci=false])
AM_CONDITIONAL([VFC_CI], [test x$vfc_ci = xtrue])
# Enable Fortran preprocessor
if test "$FC" = "gfortran"; then
AC_MSG_NOTICE(gfortran detected)
# Arguments order is important here
FCFLAGS="-cpp $FCFLAGS"
fi
if test "$FC" = "verificarlo-f"; then
AC_MSG_NOTICE(verificarlo-f detected)
# Arguments order is important here
FCFLAGS="-Mpreprocess $FCFLAGS"
fi
2021-05-07 12:47:56 +02:00
#PKG-CONFIG
#mkl-dynamic-lp64-seq
2021-05-04 17:10:20 +02:00
2021-10-06 13:01:11 +02:00
PKG_LIBS="$PKG_LIBS $LIBS"
LIBS="$LAPACK_LIBS $BLAS_LIBS $PKG_LIBS"
CFLAGS="$CFLAGS $PKG_CFLAGS"
2021-05-07 12:47:56 +02:00
AC_SUBST([PKG_LIBS])
AC_SUBST([PKG_CFLAGS])
2021-06-03 01:32:50 +02:00
AC_SUBST([HAS_CPPCHECK])
2021-05-04 17:10:20 +02:00
2021-05-07 12:47:56 +02:00
AC_CONFIG_FILES([Makefile
2021-05-12 00:22:51 +02:00
pkgconfig/qmckl.pc
2021-05-11 11:45:49 +02:00
])
2021-05-04 17:10:20 +02:00
AC_OUTPUT
2021-05-09 01:07:17 +02:00
echo \
"-------------------------------------------------
2021-05-12 23:18:22 +02:00
${PACKAGE_NAME} Version ${PACKAGE_VERSION} ${QMCKL_DEVEL}
2021-05-09 01:07:17 +02:00
Prefix: '${prefix}'.
CC..............: ${CC}
CPPFLAGS........: ${CPPFLAGS}
CFLAGS..........: ${CFLAGS}
FC..............: ${FC}
FCLAGS..........: ${FCFLAGS}
LDFLAGS:........: ${LDFLAGS}
LIBS............: ${LIBS}
2021-05-09 01:07:17 +02:00
Package features:
2021-05-09 02:12:38 +02:00
${ARGS}
2021-05-09 01:07:17 +02:00
Now type 'make @<:@<target>@:>@'
where the optional <target> is:
all - build the library
check - run tests
install - install ${PACKAGE_NAME}
--------------------------------------------------"