1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2025-01-05 11:00:36 +01:00

Improve configure

This commit is contained in:
Anthony Scemama 2022-09-22 13:56:52 +02:00
parent eba2873316
commit 8c388a93b7

View File

@ -178,58 +178,60 @@ fi
# TREXIO # TREXIO
LIBTREXIO=
AC_ARG_WITH([trexio], AC_ARG_WITH([trexio],
[AS_HELP_STRING([--without-trexio], [AS_HELP_STRING([--without-trexio],
[disable support for TREXIO])], [disable support for TREXIO])],
[with_trexio=$withval], [with_trexio=$withval],
[with_trexio=yes]) [with_trexio=yes])
case "$with_trexio" in AS_CASE([$with_trexio],
no) [no], [],
: ;; [yes],
yes) [AC_CHECK_LIB([trexio], [trexio_open], [],
AC_CHECK_LIB([trexio], [trexio_open], [], [PKG_CHECK_MODULES([TREXIO], [trexio]) ])
[PKG_CHECK_MODULES([TREXIO], [trexio]) ]) AC_CHECK_HEADERS([trexio.h], [],
AC_CHECK_HEADERS([trexio.h], [], [AC_MSG_ERROR("trexio.h not found")])
[AC_MSG_ERROR("trexio.h not found")]) AC_DEFINE([HAVE_TREXIO], [1], [Define if TREXIO support is available])
AC_DEFINE([HAVE_TREXIO], [1], [Define if TREXIO support is available]) ARGS="${ARGS} trexio"],
ARGS="${ARGS} trexio" [AS_IF([test ! -d "$withval"],
;; [AC_MSG_ERROR([--with-trexio=$withval: argument is not a directory])])
*) TREXIO_LIBS="-L$with_trexio/lib -ltrexio"
if test ! -d "$withval" ; then TREXIO_CFLAGS="-I$with_trexio/include"
AC_MSG_ERROR([--with-trexio=$withval: argument is not a directory]) AC_CHECK_HEADERS([trexio.h], [],
fi [AC_MSG_ERROR("trexio.h not found")])
TREXIO_LIBS="-L$with_trexio/lib -ltrexio" AC_DEFINE([HAVE_TREXIO], [1], [Define if TREXIO support is available])
TREXIO_CFLAGS="-I$with_trexio/include" ARGS="${ARGS} trexio"
AC_CHECK_HEADERS([trexio.h], [], ])
[AC_MSG_ERROR("trexio.h not found")])
AC_DEFINE([HAVE_TREXIO], [1], [Define if TREXIO support is available])
ARGS="${ARGS} trexio"
;;
esac
PKG_CFLAGS="$PKG_CFLAGS $TREXIO_CFLAGS" PKG_CFLAGS="$PKG_CFLAGS $TREXIO_CFLAGS"
PKG_LIBS="$PKG_LIBS $TREXIO_LIBS" PKG_LIBS="$PKG_LIBS $TREXIO_LIBS"
# QMCKL_DGEMM # QMCKLDGEMM
AC_ARG_WITH([qmckldgemm], AC_ARG_WITH([qmckldgemm],
[AS_HELP_STRING([--with-qmckldgemm], [AS_HELP_STRING([--with-qmckldgemm],
[enable support for the QMCKLDGEMM library])], [enable support for QMCKL DGEMM])],
with_qmckldgemm=$withval, [with_qmckldgemm=$withval],
with_qmckldgemm=no) [with_qmckldgemm=no])
#AS_IF([test "x$with_qmckldgemm" != xno], [ AS_CASE([$with_qmckldgemm],
# [ARGS="${ARGS} qmckldgemm" [no], [],
# AC_CHECK_LIB([qmckldgemm], [qmckl_packed_matrix_create], [], [yes],
# [AS_IF([test "x$with_qmckldgemm" != xcheck], [AC_CHECK_LIB([qmckldgemm], [qmckl_packed_matrix_create], [],
# [PKG_CHECK_MODULES([QMCKLDGEMM], [qmckldgemm]) ])])], [PKG_CHECK_MODULES([QMCKLDGEMM], [qmckldgemm]) ])
# [AC_DEFINE([HAVE_QMCKLDGEMM], [1], [Define if QMCKLDGEMM is used])] # AC_CHECK_HEADERS([qmckldgemm.h], [],
#) # [AC_MSG_ERROR("qmckldgemm.h not found")])
AC_DEFINE([HAVE_QMCKLDGEMM], [1], [Define if QMCKL DGEMM support is available])
ARGS="${ARGS} qmckldgemm"],
[AS_IF([test ! -d "$withval"],
[AC_MSG_ERROR([--with-qmckldgemm=$withval: argument is not a directory])])
QMCKLDGEMM_LIBS="-L$with_qmckldgemm/lib -lqmckldgemm"
QMCKLDGEMM_CFLAGS="-I$with_qmckldgemm/include"
# AC_CHECK_HEADERS([qmckldgemm.h], [],
# [AC_MSG_ERROR("qmckldgemm.h not found")])
AC_DEFINE([HAVE_QMCKLDGEMM], [1], [Define if QMCKL DGEMM support is available])
ARGS="${ARGS} qmckldgemm"
])
#PKG_CFLAGS="$PKG_CFLAGS $QMCKLDGEMM_CFLAGS"
#PKG_LIBS="$PKG_LIBS $QMCKLDGEMM_LIBS"
## BLAS ## BLAS
AX_BLAS([], [AC_MSG_ERROR([BLAS was not found.])]) AX_BLAS([], [AC_MSG_ERROR([BLAS was not found.])])
@ -240,27 +242,15 @@ AS_IF([test "$BLAS_LIBS" = "$LAPACK_LIBS"], [BLAS_LIBS=""])
# Specific options required with some compilers # Specific options required with some compilers
case $FC in AS_CASE([$FC],
[*ifort*], [FCFLAGS="$FCFLAGS -nofor-main"],
[*nvfortran*], [FCFLAGS="$FCFLAGS -fPIC -Mnomain"],
[])
*ifort*) AS_CASE([$CC],
FCFLAGS="$FCFLAGS -nofor-main" [*gcc*], [CFLAGS="$CFLAGS -fPIC"],
;; [*nvc*], [CFLAGS="$CFLAGS -fPIC"],
[])
*nvfortran*)
FCFLAGS="$FCFLAGS -fPIC -Mnomain"
;;
esac
case $CC in
*gcc*)
CFLAGS="$CFLAGS -fPIC"
;;
*nvc*)
CFLAGS="$CFLAGS -fPIC"
;;
esac
# Options # Options
@ -306,25 +296,15 @@ HAVE_OPENMP_OFFLOAD="no"
AS_IF([test "$enable_gpu" = "openmp"], [ AS_IF([test "$enable_gpu" = "openmp"], [
AC_DEFINE([HAVE_OPENMP_OFFLOAD], [1], [If defined, activate OpenMP-offloaded routines]) AC_DEFINE([HAVE_OPENMP_OFFLOAD], [1], [If defined, activate OpenMP-offloaded routines])
HAVE_OPENMP_OFFLOAD="yes" HAVE_OPENMP_OFFLOAD="yes"
case $CC in AS_CASE([$CC],
[*gcc*], [CFLAGS="$CFLAGS -fopenmp"],
*gcc*) [*nvc*], [CFLAGS="$CFLAGS -mp=gpu"],
CFLAGS="$CFLAGS -fopenmp" [])
;; AS_CASE([$FC],
*nvc*) [*gfortran*], [FCFLAGS="$FCFLAGS -fopenmp"],
CFLAGS="$CFLAGS -mp=gpu" [*nvfortran*], [FCFLAGS="$FCFLAGS -mp=gpu"],
;; [])
esac ]
case $FC in
*gfortran*)
FCFLAGS="$FCFLAGS -fopenmp"
;;
*nvfortran*)
FCFLAGS="$FCFLAGS -mp=gpu"
;;
esac]
) )
# OpenMP offloading # OpenMP offloading
@ -332,25 +312,15 @@ HAVE_OPENACC_OFFLOAD="no"
AS_IF([test "$enable_gpu" = "openacc"], [ AS_IF([test "$enable_gpu" = "openacc"], [
AC_DEFINE([HAVE_OPENACC_OFFLOAD], [1], [If defined, activate OpenACC-offloaded routines]) AC_DEFINE([HAVE_OPENACC_OFFLOAD], [1], [If defined, activate OpenACC-offloaded routines])
HAVE_OPENACC_OFFLOAD="yes" HAVE_OPENACC_OFFLOAD="yes"
case $CC in AS_CASE([$CC],
[*gcc*], [CFLAGS="$CFLAGS -fopenacc"],
*gcc*) [*nvc*], [CFLAGS="$CFLAGS -acc=gpu"],
CFLAGS="$CFLAGS -fopenacc" [])
;; AS_CASE([$FC],
*nvc*) [*gfortran*], [FCFLAGS="$FCFLAGS -fopenacc"],
CFLAGS="$CFLAGS -acc=gpu" [*nvfortran*], [FCFLAGS="$FCFLAGS -acc=gpu"],
;; [])
esac ]
case $FC in
*gfortran*)
FCFLAGS="$FCFLAGS -fopenacc"
;;
*nvfortran*)
FCFLAGS="$FCFLAGS -acc=gpu"
;;
esac
]) ])
@ -359,75 +329,65 @@ AC_ARG_WITH(cublas, [AS_HELP_STRING([--with-cublas],[Use cuBLAS-offloaded functi
AS_IF([test "$HAVE_CUBLAS_OFFLOAD" = "yes"], [ AS_IF([test "$HAVE_CUBLAS_OFFLOAD" = "yes"], [
AC_DEFINE([HAVE_CUBLAS_OFFLOAD], [1], [If defined, activate cuBLAS-offloaded routines]) AC_DEFINE([HAVE_CUBLAS_OFFLOAD], [1], [If defined, activate cuBLAS-offloaded routines])
HAVE_OPENACC_OFFLOAD="yes" HAVE_OPENACC_OFFLOAD="yes"
case $CC in AS_CASE([$CC],
[*gcc*], [CFLAGS="$CFLAGS -fopenmp"
*gcc*) LDFLAGS="-lcublas"],
CFLAGS="$CFLAGS -fopenmp" [*nvc*], [CFLAGS="$CFLAGS -mp=gpu -cudalib=cublas"],
LDFLAGS="-lcublas" [])
;; AS_CASE([$FC],
*nvc*) [*gfortran*], [FCFLAGS="$FCFLAGS -fopenmp"],
CFLAGS="$CFLAGS -mp=gpu -cudalib=cublas" [*nvfortran*], [FCFLAGS="$FCFLAGS -mp=gpu -cudalib=cublas"],
;; [])
esac ]
case $FC in
*gfortran*)
FCFLAGS="$FCFLAGS -fopenmp"
;;
*nvfortran*)
FCFLAGS="$FCFLAGS -mp=gpu -cudalib=cublas"
;;
esac
]) ])
AC_ARG_ENABLE(malloc-trace, [AS_HELP_STRING([--enable-malloc-trace],[use debug malloc/free])], ok=$enableval, ok=no) AC_ARG_ENABLE(malloc-trace, [AS_HELP_STRING([--enable-malloc-trace],[use debug malloc/free])], ok=$enableval, ok=no)
if test "$ok" = "yes"; then AS_IF([test "$ok" = "yes"], [
AC_DEFINE(MALLOC_TRACE,"malloc_trace.dat",[Define to use debugging malloc/free]) AC_DEFINE(MALLOC_TRACE,"malloc_trace.dat",[Define to use debugging malloc/free])
ARGS="${ARGS} malloc-trace" ARGS="${ARGS} malloc-trace"
fi ])
AC_ARG_ENABLE(prof, [AS_HELP_STRING([--enable-prof],[compile for profiling])], ok=$enableval, ok=no) AC_ARG_ENABLE(prof, [AS_HELP_STRING([--enable-prof],[compile for profiling])], ok=$enableval, ok=no)
if test "$ok" = "yes"; then AS_IF([test "$ok" = "yes"], [
CFLAGS="${CFLAGS} -pg" CFLAGS="${CFLAGS} -pg"
AC_DEFINE(ENABLE_PROF,1,[Define when using the profiler tool]) AC_DEFINE(ENABLE_PROF,1,[Define when using the profiler tool])
ARGS="${ARGS} prof" ARGS="${ARGS} prof"
fi ])
AC_ARG_WITH(efence, [AS_HELP_STRING([--with-efence],[use ElectricFence library])], ok=$withval, ok=no) AC_ARG_WITH(efence, [AS_HELP_STRING([--with-efence],[use ElectricFence library])], ok=$withval, ok=no)
if test "$ok" = "yes"; then AS_IF([test "$ok" = "yes"], [
AC_CHECK_LIB([efence], [malloc]) AC_CHECK_LIB([efence], [malloc])
ARGS="${ARGS} efence" ARGS="${ARGS} efence"
fi ])
## ##
AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[compile for debugging])], ok=$enableval, ok=no) AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[compile for debugging])], ok=$enableval, ok=no)
if test "$ok" = "yes"; then AS_IF([test "$ok" = "yes"], [
if test "$GCC" = "yes"; then AS_IF([test "$GCC" = "yes"], [
CFLAGS="$CFLAGS \ CFLAGS="$CFLAGS \
-g -Wall -W -Wbad-function-cast -Wcast-qual -Warray-bounds -Wdisabled-optimization \ -g -Wall -W -Wbad-function-cast -Wcast-qual -Warray-bounds -Wdisabled-optimization \
-fsanitize=address -fno-omit-frame-pointer \ -fsanitize=address -fno-omit-frame-pointer \
-Wpointer-arith -Wcast-align -Wpedantic -Wextra -Walloc-zero -Werror \ -Wpointer-arith -Wcast-align -Wpedantic -Wextra -Walloc-zero -Werror \
" "
LDFLAGS="$LDFLAGS -fsanitize=address" LDFLAGS="$LDFLAGS -fsanitize=address"
fi ])
if test "$GFC" = "yes"; then AS_IF([test "$GFC" = "yes"], [
FCFLAGS="$FCFLAGS \ FCFLAGS="$FCFLAGS \
-g -fcheck=all -Waliasing -Wampersand -Wconversion \ -g -fcheck=all -Waliasing -Wampersand -Wconversion \
-Wsurprising -ffpe-trap=zero,overflow,underflow \ -Wsurprising -ffpe-trap=zero,overflow,underflow \
-Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation \ -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation \
-Wreal-q-constant -Wuninitialized -fbacktrace -finit-real=nan" -Wreal-q-constant -Wuninitialized -fbacktrace -finit-real=nan"
fi ])
if test "$FC" = "ifort"; then AS_IF([test "$FC" = "ifort"], [
FCFLAGS="$FCFLAGS \ FCFLAGS="$FCFLAGS \
-traceback -check all -debug all -fpe-all=0 -implicitnone" -traceback -check all -debug all -fpe-all=0 -implicitnone"
fi ])
AC_DEFINE(DEBUG,1,[Define to turn on debugging checks]) AC_DEFINE(DEBUG,1,[Define to turn on debugging checks])
ARGS="${ARGS} debug" ARGS="${ARGS} debug"
fi ])
# Checks for header files. # Checks for header files.
@ -452,16 +412,13 @@ AC_TYPE_UINT64_T
AC_CHECK_FUNCS([memset strerror]) AC_CHECK_FUNCS([memset strerror])
# Development mode # Development mode
if test "x$enable_maintainer_mode" = "xyes" ; then QMCKL_DEVEL=
QMCKL_DEVEL=" -- Developer mode" AS_IF([test "x$enable_maintainer_mode" = "xyes"],
else [QMCKL_DEVEL=" -- Developer mode"])
QMCKL_DEVEL=""
fi
AM_CONDITIONAL([QMCKL_DEVEL],[test "x$QMCKL_DEVEL" != x]) AM_CONDITIONAL([QMCKL_DEVEL],[test "x$QMCKL_DEVEL" != x])
if test "x${QMCKL_DEVEL}" != "x"; then AS_IF([test "x${QMCKL_DEVEL}" != "x"], [
AC_PROG_AWK AC_PROG_AWK
AM_PATH_PYTHON AM_PATH_PYTHON
@ -477,8 +434,7 @@ if test "x${QMCKL_DEVEL}" != "x"; then
AS_IF([test "x${HAS_CPPCHECK}" != "xno"], [HAS_CPPCHECK=1]) AS_IF([test "x${HAS_CPPCHECK}" != "xno"], [HAS_CPPCHECK=1])
AX_PKG_SWIG(4.0.0, [], AC_MSG_WARN([SWIG is required to build Python API.]) ) AX_PKG_SWIG(4.0.0, [], AC_MSG_WARN([SWIG is required to build Python API.]) )
])
fi
#PKG-CONFIG #PKG-CONFIG