2021-04-28 15:30:18 +02:00
|
|
|
# -*- Autoconf -*-
|
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
|
|
|
|
AC_PREREQ([2.69])
|
2022-06-03 11:37:02 +02:00
|
|
|
AC_INIT([trexio],[2.3.0],[https://github.com/TREX-CoE/trexio/issues])
|
2021-11-13 18:04:52 +01:00
|
|
|
|
|
|
|
AC_CONFIG_SRCDIR([Makefile.in])
|
|
|
|
AC_CONFIG_HEADERS([include/config.h])
|
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
|
|
|
AC_CONFIG_AUX_DIR([build-config])
|
|
|
|
|
2021-05-28 12:23:19 +02:00
|
|
|
AM_INIT_AUTOMAKE([subdir-objects color-tests parallel-tests silent-rules 1.11])
|
2021-11-01 10:16:02 +01:00
|
|
|
AM_MAINTAINER_MODE()
|
2021-11-18 13:59:05 +01:00
|
|
|
AM_PROG_AR
|
|
|
|
|
|
|
|
LT_PREREQ([2.2])
|
|
|
|
LT_INIT
|
2021-11-01 10:16:02 +01:00
|
|
|
|
2022-09-27 13:54:54 +02:00
|
|
|
# Activate developer mode if a dummy file is present (true when cloning the git repository).
|
2021-11-01 10:16:02 +01:00
|
|
|
# Otherwise, it is the source distribution and the developer mode should not be activated.
|
2022-09-26 17:06:04 +02:00
|
|
|
TEST_IFEXISTS=".devel"
|
|
|
|
AS_IF([test -f $TEST_IFEXISTS],
|
2022-09-06 17:19:38 +02:00
|
|
|
[enable_maintainer_mode="yes"]
|
2021-11-01 10:16:02 +01:00
|
|
|
)
|
|
|
|
|
2021-05-28 12:34:58 +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-11-01 11:55:34 +01:00
|
|
|
AC_DEFINE_UNQUOTED(VERSION_MAJOR, [$VERSION_MAJOR], [major version])
|
|
|
|
AC_DEFINE_UNQUOTED(VERSION_MINOR, [$VERSION_MINOR], [minor version])
|
|
|
|
AC_DEFINE_UNQUOTED(VERSION_PATCH, [$VERSION_PATCH], [patch version])
|
2021-05-28 12:34:58 +02:00
|
|
|
|
2021-11-17 14:16:55 +01:00
|
|
|
|
2021-07-23 15:48:45 +02:00
|
|
|
## Save system information, e.g. user name
|
|
|
|
|
|
|
|
UNAME=`echo ${USER}`
|
|
|
|
AC_DEFINE_UNQUOTED(TREXIO_USER_NAME, ["${UNAME}"], [user name])
|
|
|
|
AC_SUBST([UNAME])
|
2021-06-03 01:25:20 +02:00
|
|
|
|
|
|
|
## -------------------
|
2021-11-01 10:16:02 +01:00
|
|
|
## Checks for programs
|
2021-06-03 01:25:20 +02:00
|
|
|
## -------------------
|
|
|
|
|
2021-05-28 12:34:58 +02:00
|
|
|
AC_LANG(C)
|
2021-04-28 15:30:18 +02:00
|
|
|
AC_PROG_CC
|
2021-06-03 01:25:20 +02:00
|
|
|
|
|
|
|
# C99 support
|
2021-05-28 12:16:32 +02:00
|
|
|
m4_version_prereq([2.70],[], [AC_PROG_CC_C99])
|
2021-06-03 01:25:20 +02:00
|
|
|
AS_IF([test "$ac_cv_prog_cc_c99" = "no"],
|
|
|
|
[AC_MSG_ERROR([The compiler does not support C99])])
|
2021-05-08 00:35:53 +02:00
|
|
|
AC_PROG_CC_C_O
|
2022-12-13 17:09:10 +01:00
|
|
|
AM_PROG_CC_C_O
|
2021-05-08 00:35:53 +02:00
|
|
|
|
2022-09-06 11:52:36 +02:00
|
|
|
|
|
|
|
# Fortran API [default: --with-fortran], do not disable in the dev mode
|
|
|
|
AC_ARG_WITH(fortran, [AS_HELP_STRING([--without-fortran],[do not test and install the Fortran API])], ok=$withval, ok=yes)
|
|
|
|
if test "$ok" = "yes"; then
|
|
|
|
AC_PROG_FC
|
|
|
|
AC_FC_FREEFORM
|
|
|
|
AC_FC_SRCEXT([f90])
|
|
|
|
AC_PROG_FC_C_O
|
|
|
|
AC_FC_LIBRARY_LDFLAGS
|
|
|
|
fi
|
|
|
|
|
|
|
|
AM_CONDITIONAL([HAVE_FORTRAN],[test "$ok" = "yes"])
|
2021-06-03 01:25:20 +02:00
|
|
|
|
|
|
|
# pkg-config
|
|
|
|
PKG_PROG_PKG_CONFIG()
|
|
|
|
PKG_CFLAGS=""
|
2021-08-21 10:58:42 +02:00
|
|
|
PKG_LIBS=""
|
2021-06-03 01:25:20 +02:00
|
|
|
|
2021-04-28 15:30:18 +02:00
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_LN_S
|
2021-07-23 15:48:45 +02:00
|
|
|
AC_PROG_GREP
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2022-07-12 17:07:38 +02:00
|
|
|
# Specific options required with some compilers
|
|
|
|
case $FC in
|
|
|
|
*gfortran*)
|
|
|
|
FCFLAGS="$FCFLAGS -fPIC"
|
|
|
|
;;
|
|
|
|
*flang*)
|
|
|
|
FCFLAGS="$FCFLAGS -fPIC"
|
|
|
|
;;
|
|
|
|
*ifort*)
|
|
|
|
FCFLAGS="$FCFLAGS -fPIC"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case $CC in
|
|
|
|
*gcc*)
|
|
|
|
CFLAGS="$CFLAGS -fPIC"
|
|
|
|
;;
|
|
|
|
*clang*)
|
|
|
|
CFLAGS="$CFLAGS -fPIC"
|
|
|
|
;;
|
|
|
|
*icc*)
|
|
|
|
CFLAGS="$CFLAGS -fPIC"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2021-06-03 01:25:20 +02:00
|
|
|
## ---------
|
|
|
|
## Libraries
|
|
|
|
## ---------
|
|
|
|
|
|
|
|
# Checks for basic header files.
|
2023-01-03 18:29:21 +01:00
|
|
|
AC_CHECK_HEADERS([fcntl.h inttypes.h stdint.h stdbool.h stdlib.h string.h unistd.h sys/types.h sys/wait.h ])
|
2021-04-28 15:30:18 +02:00
|
|
|
|
2021-05-28 12:16:32 +02:00
|
|
|
|
2021-06-03 01:25:20 +02:00
|
|
|
### HDF5
|
|
|
|
### ----
|
|
|
|
|
2021-04-28 15:30:18 +02:00
|
|
|
# Configure with HDF5 (default: --with-hdf5 using pkg-config) [optional]:
|
|
|
|
# ./configure [--with-hdf5 or --with-hdf5=yes]
|
2021-06-03 01:25:20 +02:00
|
|
|
|
2021-04-28 15:30:18 +02:00
|
|
|
# Configure with user-provided path to HDF5:
|
|
|
|
# ./configure --with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial
|
2021-06-03 01:25:20 +02:00
|
|
|
|
2021-04-28 15:30:18 +02:00
|
|
|
# Configure without HDF5:
|
|
|
|
# ./configure --without-hdf5 [or --with-hdf5=no]
|
|
|
|
|
|
|
|
|
2021-05-05 13:55:00 +02:00
|
|
|
PKG_HDF5=""
|
2021-06-22 11:37:54 +02:00
|
|
|
AX_LIB_HDF5()
|
2021-06-03 01:25:20 +02:00
|
|
|
|
|
|
|
if test "x${with_hdf5}" = xno; then
|
2021-05-05 12:17:15 +02:00
|
|
|
AC_MSG_WARN([
|
|
|
|
------------------------------------------
|
|
|
|
Configuring with the HDF5 library is
|
|
|
|
recommended to build efficient TREXIO.
|
|
|
|
------------------------------------------])
|
2022-12-13 17:07:57 +01:00
|
|
|
else
|
2023-01-03 18:29:21 +01:00
|
|
|
AC_CHECK_LIB([hdf5_hl],[main],[],[AC_MSG_ERROR(
|
2022-12-13 17:07:57 +01:00
|
|
|
-----------------------------------
|
|
|
|
Error: hdf5_hl library is required
|
|
|
|
-----------------------------------
|
2023-01-03 18:29:21 +01:00
|
|
|
)],[])ac_cv_lib_hdf5_hl=ac_cv_lib_hdf5_hl_main
|
|
|
|
|
2021-06-03 01:25:20 +02:00
|
|
|
fi
|
2021-05-05 12:17:15 +02:00
|
|
|
|
2021-06-03 01:25:20 +02:00
|
|
|
CFLAGS="${HDF5_CFLAGS} ${CFLAGS}"
|
|
|
|
CPPFLAGS="${HDF5_CPPFLAGS} ${CPPFLAGS}"
|
|
|
|
LDFLAGS="${HDF5_LDFLAGS} ${LDFLAGS}"
|
|
|
|
LIBS="${HDF5_LIBS} ${LIBS}"
|
2021-04-28 15:30:18 +02:00
|
|
|
|
2021-08-20 15:30:05 +02:00
|
|
|
# Check if HDF5 is available with pkg-config.
|
2021-04-28 15:30:18 +02:00
|
|
|
|
2021-08-21 10:58:42 +02:00
|
|
|
PKG_CHECK_MODULES([HDF5], [hdf5 >= 1.8], [
|
2021-05-05 12:17:15 +02:00
|
|
|
PKG_HDF5="hdf5"
|
2021-06-03 01:25:20 +02:00
|
|
|
],[
|
2021-05-05 12:17:15 +02:00
|
|
|
PKG_HDF5=""
|
2021-06-03 01:25:20 +02:00
|
|
|
])
|
2021-08-21 10:58:42 +02:00
|
|
|
PKG_CFLAGS="${HDF5_CFLAGS}"
|
|
|
|
PKG_LIBS="${HDF5_LIBS}"
|
2021-04-28 15:30:18 +02:00
|
|
|
|
2021-05-05 12:17:15 +02:00
|
|
|
AC_SUBST([PKG_HDF5])
|
2021-05-05 13:55:00 +02:00
|
|
|
AC_SUBST([PKG_CFLAGS])
|
2021-08-20 15:30:05 +02:00
|
|
|
AC_SUBST([PKG_LIBS])
|
2021-05-05 12:17:15 +02:00
|
|
|
|
2021-11-02 10:32:51 +01:00
|
|
|
AM_CONDITIONAL([HAVE_HDF5],[test "$with_hdf5" = "yes"])
|
2021-11-01 11:55:34 +01:00
|
|
|
|
2021-08-20 15:30:05 +02:00
|
|
|
# The block below should only execute if the ax_lib_hdf5.m4 macro failed to find HDF5.
|
|
|
|
# It is only needed to manually build Python API because setup.py depends on HDF5.
|
|
|
|
|
|
|
|
if test "$HDF5_LDFLAGS" = "" || "$HDF5_CFLAGS" = ""; then
|
|
|
|
HDF5_LDFLAGS="${PKG_LIBS}"
|
|
|
|
HDF5_CFLAGS="${PKG_CFLAGS}"
|
|
|
|
AC_SUBST([HDF5_CFLAGS])
|
|
|
|
AC_SUBST([HDF5_LDFLAGS])
|
|
|
|
fi
|
2021-04-28 15:30:18 +02:00
|
|
|
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_TYPE_INT32_T
|
|
|
|
AC_TYPE_INT64_T
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
AC_TYPE_UINT32_T
|
|
|
|
AC_TYPE_UINT64_T
|
|
|
|
|
|
|
|
# Checks for library functions.
|
2022-07-08 18:12:50 +02:00
|
|
|
# AC_FUNC_MALLOC
|
2021-04-28 15:30:18 +02:00
|
|
|
AC_CHECK_FUNCS([memset mkdir strerror])
|
|
|
|
|
2021-11-01 10:01:35 +01:00
|
|
|
if test "x$enable_maintainer_mode" == "xyes"; then
|
|
|
|
TREXIO_DEVEL=" -- Developer mode"
|
|
|
|
else
|
|
|
|
TREXIO_DEVEL=""
|
|
|
|
fi
|
|
|
|
|
2022-05-06 11:07:26 +02:00
|
|
|
|
|
|
|
AC_ARG_WITH(efence, [AS_HELP_STRING([--with-efence],[use ElectricFence library])], ok=$withval, ok=no)
|
|
|
|
if test "$ok" = "yes"; then
|
|
|
|
AC_CHECK_LIB([efence], [malloc])
|
|
|
|
ARGS="${ARGS} efence"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(malloc-trace, [AS_HELP_STRING([--enable-malloc-trace],[use debug malloc/free])], ok=$enableval, ok=no)
|
|
|
|
if test "$ok" = "yes"; then
|
|
|
|
AC_DEFINE(MALLOC_TRACE,"malloc_trace.dat",[Define to use debugging malloc/free])
|
|
|
|
ARGS="${ARGS} malloc-trace"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(prof, [AS_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])
|
|
|
|
ARGS="${ARGS} prof"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2021-05-28 13:36:39 +02:00
|
|
|
AM_CONDITIONAL([TREXIO_DEVEL],[test "x$TREXIO_DEVEL" != x])
|
|
|
|
|
2021-05-28 12:34:58 +02:00
|
|
|
if test "x${TREXIO_DEVEL}" != "x"; then
|
|
|
|
|
|
|
|
AC_PROG_AWK
|
|
|
|
AM_PATH_PYTHON([3.0])
|
|
|
|
|
2021-08-20 14:20:09 +02:00
|
|
|
AX_PKG_SWIG(4.0.0, [], AC_MSG_WARN([SWIG is required to build Python API.]) )
|
|
|
|
# The macro below performs Python benchmarks, but overlapping with AM_PATH_PYTHON
|
|
|
|
#AX_SWIG_PYTHON
|
|
|
|
|
2021-05-28 12:34:58 +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-11-08 19:41:17 +01:00
|
|
|
GIT_HASH=`git log | head -1 | cut -d ' ' -f 2 | tee ${srcdir}/.git_hash`
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
GIT_HASH=`cat ${srcdir}/.git_hash`
|
|
|
|
|
2021-05-28 12:34:58 +02:00
|
|
|
fi
|
2021-11-08 19:41:17 +01:00
|
|
|
AC_DEFINE_UNQUOTED(GIT_HASH, ["${GIT_HASH}"], [Git SHA1 Hash])
|
2021-05-28 12:34:58 +02:00
|
|
|
|
2021-06-03 01:25:20 +02:00
|
|
|
## Libm
|
|
|
|
## ----
|
|
|
|
|
|
|
|
AC_SEARCH_LIBS([sqrt], [m], [], AC_MSG_ERROR([The libm library is required]))
|
|
|
|
AC_CHECK_HEADERS([math.h])
|
|
|
|
|
|
|
|
### pthread
|
|
|
|
### -------
|
|
|
|
|
|
|
|
AC_SEARCH_LIBS([pthread_create], [pthread], [], AC_MSG_ERROR([The pthread library is required]))
|
|
|
|
AC_CHECK_HEADERS([pthread.h])
|
|
|
|
|
|
|
|
|
2021-04-28 15:30:18 +02:00
|
|
|
AC_CONFIG_FILES([Makefile
|
2021-05-28 12:34:58 +02:00
|
|
|
pkgconfig/trexio.pc])
|
2021-04-28 15:30:18 +02:00
|
|
|
AC_OUTPUT
|
|
|
|
|
|
|
|
echo \
|
|
|
|
"-------------------------------------------------
|
|
|
|
|
2021-11-08 19:41:17 +01:00
|
|
|
${PACKAGE_NAME} Version ${PACKAGE_VERSION} ${GIT_HASH} ${TREXIO_DEVEL}
|
2021-04-28 15:30:18 +02:00
|
|
|
|
2021-06-03 01:25:20 +02:00
|
|
|
Prefix ........: ${prefix}
|
|
|
|
CC ............: ${CC}
|
|
|
|
CPPFLAGS ......: ${CPPFLAGS}
|
|
|
|
CFLAGS ........: ${CFLAGS}
|
|
|
|
FC ............: ${FC}
|
2021-11-01 11:55:34 +01:00
|
|
|
FCFLAGS .......: ${FCFLAGS}
|
2021-06-03 01:25:20 +02:00
|
|
|
LDFLAGS .......: ${LDFLAGS}
|
|
|
|
LIBS ..........: ${LIBS}
|
2021-04-28 15:30:18 +02:00
|
|
|
|
|
|
|
Package features:
|
2021-06-15 18:31:43 +02:00
|
|
|
Compilation with HDF5 ..: ${with_hdf5}
|
|
|
|
HDF5 version ...........: ${HDF5_VERSION}
|
2021-04-28 15:30:18 +02:00
|
|
|
|
|
|
|
Now type 'make @<:@<target>@:>@'
|
|
|
|
where the optional <target> is:
|
2021-06-03 01:25:20 +02:00
|
|
|
all - build C library and Fortran binding
|
2021-11-01 10:16:02 +01:00
|
|
|
check - run unit tests
|
|
|
|
install - install the library
|
2021-04-28 15:30:18 +02:00
|
|
|
--------------------------------------------------"
|