mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-08-25 06:31:43 +02:00
Merge branch 'automake' of github.com:TREX-CoE/trexio into automake
This commit is contained in:
commit
5043d058bd
181
configure.ac
181
configure.ac
@ -20,145 +20,88 @@ AC_SUBST([VERSION_MAJOR])
|
||||
AC_SUBST([VERSION_MINOR])
|
||||
AC_SUBST([VERSION_PATCH])
|
||||
|
||||
# Checks for programs.
|
||||
|
||||
|
||||
## -------------------
|
||||
## Checks for programs
|
||||
## -------------------
|
||||
|
||||
AC_LANG(C)
|
||||
AC_PROG_CC
|
||||
# Make sure the c compiler supports C99
|
||||
|
||||
# C99 support
|
||||
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])])
|
||||
AS_IF([test "$ac_cv_prog_cc_c99" = "no"],
|
||||
[AC_MSG_ERROR([The compiler does not support C99])])
|
||||
AC_PROG_CC_C_O
|
||||
|
||||
# Fortran
|
||||
AC_PROG_FC
|
||||
AC_FC_FREEFORM
|
||||
AC_FC_SRCEXT([f90])
|
||||
|
||||
AC_PROG_FC_C_O
|
||||
AC_FC_LIBRARY_LDFLAGS
|
||||
|
||||
# pkg-config
|
||||
PKG_PROG_PKG_CONFIG()
|
||||
PKG_CFLAGS=""
|
||||
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LIBTOOL
|
||||
AC_PROG_LN_S
|
||||
PKG_PROG_PKG_CONFIG()
|
||||
PKG_LIBS=""
|
||||
PKG_CFLAGS=""
|
||||
|
||||
AC_FC_LIBRARY_LDFLAGS
|
||||
|
||||
|
||||
## ---------
|
||||
## Libraries
|
||||
## ---------
|
||||
|
||||
# Configure with HDF5 (default: --with-hdf5 using pkg-config) [optional]:
|
||||
# ./configure [--with-hdf5 or --with-hdf5=yes]
|
||||
# Configure with user-provided path to HDF5:
|
||||
# ./configure --with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial
|
||||
# Configure without HDF5:
|
||||
# ./configure --without-hdf5 [or --with-hdf5=no]
|
||||
|
||||
# when configure complains about missing install-sh or install.sh, execute:
|
||||
# automake --add-missing --copy
|
||||
|
||||
# Checks for basic libraries.
|
||||
AC_CHECK_LIB([m], [sqrt])
|
||||
# Checks for basic header files.
|
||||
AC_CHECK_HEADERS([fcntl.h inttypes.h stdint.h stdlib.h string.h unistd.h])
|
||||
|
||||
# Search for pthread
|
||||
have_pthreads=no
|
||||
AC_SEARCH_LIBS([pthread_create], [pthread], [have_pthreads=yes])
|
||||
|
||||
if test "x${have_pthreads}" = xyes; then
|
||||
AC_CHECK_HEADERS([pthread.h], [], [have_pthreads=no])
|
||||
PKG_LIBS="${PKG_LIBS} -lpthread"
|
||||
fi
|
||||
### HDF5
|
||||
### ----
|
||||
|
||||
if test "x${have_pthreads}" = xno; then
|
||||
AC_MSG_ERROR([
|
||||
------------------------------------------
|
||||
The pthread library and header file
|
||||
required to build TREXIO. Stopping...
|
||||
Check 'config.log' for more information.
|
||||
------------------------------------------])
|
||||
fi
|
||||
# Configure with HDF5 (default: --with-hdf5 using pkg-config) [optional]:
|
||||
# ./configure [--with-hdf5 or --with-hdf5=yes]
|
||||
|
||||
# Configure with user-provided path to HDF5:
|
||||
# ./configure --with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial
|
||||
|
||||
# Configure without HDF5:
|
||||
# ./configure --without-hdf5 [or --with-hdf5=no]
|
||||
|
||||
AC_ARG_WITH([hdf5],
|
||||
AS_HELP_STRING([--with-hdf5],
|
||||
[Include HDF5 functionality @<:@default: yes@:>@])],
|
||||
[hdf5=${withval}],
|
||||
[hdf5=yes])
|
||||
|
||||
PKG_HDF5=""
|
||||
if test "x${hdf5}" = xno; then
|
||||
AX_LIB_HDF5([serial])
|
||||
|
||||
if test "x${with_hdf5}" = xno; then
|
||||
AC_MSG_WARN([
|
||||
------------------------------------------
|
||||
Configuring with the HDF5 library is
|
||||
recommended to build efficient TREXIO.
|
||||
------------------------------------------])
|
||||
fi
|
||||
|
||||
elif test "x${hdf5}" = xyes; then
|
||||
CFLAGS="${HDF5_CFLAGS} ${CFLAGS}"
|
||||
CPPFLAGS="${HDF5_CPPFLAGS} ${CPPFLAGS}"
|
||||
LDFLAGS="${HDF5_LDFLAGS} ${LDFLAGS}"
|
||||
LIBS="${HDF5_LIBS} ${LIBS}"
|
||||
|
||||
# Check if HDF5 is already configured (e.g. after calling `module load hdf5-<version>`)
|
||||
AC_CHECK_HEADERS([hdf5_hl.h])
|
||||
AC_CHECK_LIB([hdf5_hl], [H5LTfind_dataset], [], [have_hdf5_hl=no])
|
||||
|
||||
AC_CHECK_HEADERS([hdf5.h])
|
||||
AC_CHECK_LIB([hdf5], [H5open], [], [have_hdf5=no])
|
||||
# Check if hdf5 if available with pkg-config
|
||||
|
||||
if test "x${have_hdf5}" = xno; then
|
||||
# If HDF5 is not configured, try using pkg-config
|
||||
PKG_CHECK_MODULES([HDF5], [hdf5 >= 1.8])
|
||||
CFLAGS="$(pkg-config --cflags hdf5) ${CFLAGS}"
|
||||
LDFLAGS="$(pkg-config --libs hdf5) -lhdf5_hl ${LDFLAGS}"
|
||||
PKG_CHECK_MODULES([HDF5], [hdf5 >= 1.8], [
|
||||
PKG_HDF5="hdf5"
|
||||
PKG_LIBS="${PKG_LIBS} -lhdf5_hl"
|
||||
else
|
||||
],[
|
||||
PKG_HDF5=""
|
||||
PKG_LIBS="${PKG_LIBS} ${HDF5_LIBS} -lhdf5_hl"
|
||||
PKG_CFLAGS="${PKG_CFLAGS} ${HDF5_CFLAGS}"
|
||||
CFLAGS="${HDF5_LIBS} ${CFLAGS}"
|
||||
LDFLAGS="${HDF5_CFLAGS} -lhdf5_hl ${LDFLAGS}"
|
||||
fi
|
||||
])
|
||||
PKG_CFLAGS="${PKG_CFLAGS}"
|
||||
|
||||
else
|
||||
|
||||
if test "x${hdf5}" = x; then
|
||||
AC_MSG_ERROR([
|
||||
------------------------------------------
|
||||
The path to HDF5 library is required.
|
||||
Maybe you forgot to pass --with-hdf5="/your/path/" to configure script.
|
||||
Stopping...
|
||||
------------------------------------------])
|
||||
fi
|
||||
|
||||
CPPFLAGS="-I${hdf5}/include ${CPPFLAGS}"
|
||||
LDFLAGS="-L${hdf5} ${LDFLAGS}"
|
||||
|
||||
AC_CHECK_HEADERS([hdf5_hl.h])
|
||||
AC_CHECK_LIB([hdf5_hl], [H5LTfind_dataset], [], [have_hdf5_hl=no])
|
||||
|
||||
AC_CHECK_HEADERS([hdf5.h])
|
||||
AC_CHECK_LIB([hdf5], [H5open], [], [have_hdf5=no])
|
||||
|
||||
PKG_HDF5=""
|
||||
PKG_LIBS="${PKG_LIBS} -L${hdf5} -lhdf5_hl"
|
||||
PKG_CFLAGS="${PKG_CFLAGS} -I${hdf5}/include"
|
||||
fi
|
||||
AC_SUBST([PKG_HDF5])
|
||||
AC_SUBST([PKG_LIBS])
|
||||
AC_SUBST([PKG_CFLAGS])
|
||||
|
||||
|
||||
# add -fPIC if not present in CFLAGS, necessary to compile TREXIO
|
||||
# TODO: replace with AM_CFLAGS for appropriate targer once Automake is introduced
|
||||
case "${CFLAGS}" in
|
||||
*-fPIC*)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_WARN([
|
||||
------------------------------------------
|
||||
Adding -fPIC option to CFLAGS.
|
||||
This is necessary to build TREXIO.
|
||||
------------------------------------------])
|
||||
CFLAGS="${CFLAGS} -fPIC"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_INT32_T
|
||||
AC_TYPE_INT64_T
|
||||
@ -194,6 +137,19 @@ if test "x${TREXIO_DEVEL}" != "x"; then
|
||||
|
||||
fi
|
||||
|
||||
## 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])
|
||||
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
pkgconfig/trexio.pc])
|
||||
AC_OUTPUT
|
||||
@ -203,23 +159,22 @@ echo \
|
||||
|
||||
${PACKAGE_NAME} Version ${PACKAGE_VERSION} ${TREXIO_DEVEL}
|
||||
|
||||
Prefix: '${prefix}'.
|
||||
|
||||
CC: ${CC}
|
||||
CPPFLAGS: ${CPPFLAGS}
|
||||
CFLAGS: ${CFLAGS}
|
||||
FC: ${FC}
|
||||
FCLAGS: ${FCFLAGS}
|
||||
LDFLAGS: ${LDFLAGS}
|
||||
LIBS: ${LIBS}
|
||||
Prefix ........: ${prefix}
|
||||
CC ............: ${CC}
|
||||
CPPFLAGS ......: ${CPPFLAGS}
|
||||
CFLAGS ........: ${CFLAGS}
|
||||
FC ............: ${FC}
|
||||
FCLAGS ........: ${FCFLAGS}
|
||||
LDFLAGS .......: ${LDFLAGS}
|
||||
LIBS ..........: ${LIBS}
|
||||
|
||||
Package features:
|
||||
Compilation with HDF5: ${hdf5}
|
||||
Compilation with HDF5: ${with_hdf5}
|
||||
|
||||
Now type 'make @<:@<target>@:>@'
|
||||
where the optional <target> is:
|
||||
all - build C and Fortran APIs
|
||||
check - check C and Fortran APIs
|
||||
clean - clean the produced files
|
||||
all - build C library and Fortran binding
|
||||
check - run unit tests
|
||||
install - install the library
|
||||
--------------------------------------------------"
|
||||
|
||||
|
323
m4/ax_lib_hdf5.m4
Normal file
323
m4/ax_lib_hdf5.m4
Normal file
@ -0,0 +1,323 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_lib_hdf5.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_LIB_HDF5([serial/parallel])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro provides tests of the availability of HDF5 library.
|
||||
#
|
||||
# The optional macro argument should be either 'serial' or 'parallel'. The
|
||||
# former only looks for serial HDF5 installations via h5cc. The latter
|
||||
# only looks for parallel HDF5 installations via h5pcc. If the optional
|
||||
# argument is omitted, serial installations will be preferred over
|
||||
# parallel ones.
|
||||
#
|
||||
# The macro adds a --with-hdf5 option accepting one of three values:
|
||||
#
|
||||
# no - do not check for the HDF5 library.
|
||||
# yes - do check for HDF5 library in standard locations.
|
||||
# path - complete path to the HDF5 helper script h5cc or h5pcc.
|
||||
#
|
||||
# If HDF5 is successfully found, this macro calls
|
||||
#
|
||||
# AC_SUBST(HDF5_VERSION)
|
||||
# AC_SUBST(HDF5_CC)
|
||||
# AC_SUBST(HDF5_CFLAGS)
|
||||
# AC_SUBST(HDF5_CPPFLAGS)
|
||||
# AC_SUBST(HDF5_LDFLAGS)
|
||||
# AC_SUBST(HDF5_LIBS)
|
||||
# AC_SUBST(HDF5_FC)
|
||||
# AC_SUBST(HDF5_FFLAGS)
|
||||
# AC_SUBST(HDF5_FLIBS)
|
||||
# AC_SUBST(HDF5_TYPE)
|
||||
# AC_DEFINE(HAVE_HDF5)
|
||||
#
|
||||
# and sets with_hdf5="yes". Additionally, the macro sets
|
||||
# with_hdf5_fortran="yes" if a matching Fortran wrapper script is found.
|
||||
# Note that Autoconf's Fortran support is not used to perform this check.
|
||||
# H5CC and H5FC will contain the appropriate serial or parallel HDF5
|
||||
# wrapper script locations.
|
||||
#
|
||||
# If HDF5 is disabled or not found, this macros sets with_hdf5="no" and
|
||||
# with_hdf5_fortran="no".
|
||||
#
|
||||
# Your configuration script can test $with_hdf to take any further
|
||||
# actions. HDF5_{C,CPP,LD}FLAGS may be used when building with C or C++.
|
||||
# HDF5_F{FLAGS,LIBS} should be used when building Fortran applications.
|
||||
#
|
||||
# To use the macro, one would code one of the following in "configure.ac"
|
||||
# before AC_OUTPUT:
|
||||
#
|
||||
# 1) dnl Check for HDF5 support
|
||||
# AX_LIB_HDF5()
|
||||
#
|
||||
# 2) dnl Check for serial HDF5 support
|
||||
# AX_LIB_HDF5([serial])
|
||||
#
|
||||
# 3) dnl Check for parallel HDF5 support
|
||||
# AX_LIB_HDF5([parallel])
|
||||
#
|
||||
# One could test $with_hdf5 for the outcome or display it as follows
|
||||
#
|
||||
# echo "HDF5 support: $with_hdf5"
|
||||
#
|
||||
# You could also for example, override the default CC in "configure.ac" to
|
||||
# enforce compilation with the compiler that HDF5 uses:
|
||||
#
|
||||
# AX_LIB_HDF5([parallel])
|
||||
# if test "$with_hdf5" = "yes"; then
|
||||
# CC="$HDF5_CC"
|
||||
# else
|
||||
# AC_MSG_ERROR([Unable to find HDF5, we need parallel HDF5.])
|
||||
# fi
|
||||
#
|
||||
# The HDF5_TYPE environment variable returns "parallel" or "serial",
|
||||
# depending on which type of library is found.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009 Timothy Brown <tbrown@freeshell.org>
|
||||
# Copyright (c) 2010 Rhys Ulerich <rhys.ulerich@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 20
|
||||
|
||||
AC_DEFUN([AX_LIB_HDF5], [
|
||||
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
AC_REQUIRE([AC_PROG_AWK])
|
||||
AC_REQUIRE([AC_PROG_GREP])
|
||||
|
||||
dnl Check first argument is one of the recognized values.
|
||||
dnl Fail eagerly if is incorrect as this simplifies case statements below.
|
||||
if test "m4_normalize(m4_default([$1],[]))" = "" ; then
|
||||
: # Recognized value
|
||||
elif test "m4_normalize(m4_default([$1],[]))" = "serial" ; then
|
||||
: # Recognized value
|
||||
elif test "m4_normalize(m4_default([$1],[]))" = "parallel"; then
|
||||
: # Recognized value
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
Unrecognized value for AX[]_LIB_HDF5 within configure.ac.
|
||||
If supplied, argument 1 must be either 'serial' or 'parallel'.
|
||||
])
|
||||
fi
|
||||
|
||||
dnl Add a default --with-hdf5 configuration option.
|
||||
AC_ARG_WITH([hdf5],
|
||||
AS_HELP_STRING(
|
||||
[--with-hdf5=[yes/no/PATH]],
|
||||
m4_case(m4_normalize([$1]),
|
||||
[serial], [location of h5cc for serial HDF5 configuration],
|
||||
[parallel], [location of h5pcc for parallel HDF5 configuration],
|
||||
[location of h5cc or h5pcc for HDF5 configuration])
|
||||
),
|
||||
[if test "$withval" = "no"; then
|
||||
with_hdf5="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
with_hdf5="yes"
|
||||
else
|
||||
with_hdf5="yes"
|
||||
H5CC="$withval"
|
||||
fi],
|
||||
[with_hdf5="yes"]
|
||||
)
|
||||
|
||||
dnl Set defaults to blank
|
||||
HDF5_CC=""
|
||||
HDF5_VERSION=""
|
||||
HDF5_CFLAGS=""
|
||||
HDF5_CPPFLAGS=""
|
||||
HDF5_LDFLAGS=""
|
||||
HDF5_LIBS=""
|
||||
HDF5_FC=""
|
||||
HDF5_FFLAGS=""
|
||||
HDF5_FLIBS=""
|
||||
HDF5_TYPE=""
|
||||
|
||||
dnl Try and find hdf5 compiler tools and options.
|
||||
if test "$with_hdf5" = "yes"; then
|
||||
if test -z "$H5CC"; then
|
||||
dnl Check to see if H5CC is in the path.
|
||||
AC_PATH_PROGS(
|
||||
[H5CC],
|
||||
m4_case(m4_normalize([$1]),
|
||||
[serial], [h5cc],
|
||||
[parallel], [h5pcc],
|
||||
[h5cc h5pcc]),
|
||||
[])
|
||||
else
|
||||
AC_MSG_CHECKING([Using provided HDF5 C wrapper])
|
||||
AC_MSG_RESULT([$H5CC])
|
||||
fi
|
||||
AC_MSG_CHECKING([for HDF5 type])
|
||||
AS_CASE([$H5CC],
|
||||
[*h5pcc], [HDF5_TYPE=parallel],
|
||||
[*h5cc], [HDF5_TYPE=serial],
|
||||
[HDF5_TYPE=neither])
|
||||
AC_MSG_RESULT([$HDF5_TYPE])
|
||||
AC_MSG_CHECKING([for HDF5 libraries])
|
||||
if test ! -f "$H5CC" || test ! -x "$H5CC"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_WARN(m4_case(m4_normalize([$1]),
|
||||
[serial], [
|
||||
Unable to locate serial HDF5 compilation helper script 'h5cc'.
|
||||
Please specify --with-hdf5=<LOCATION> as the full path to h5cc.
|
||||
HDF5 support is being disabled (equivalent to --with-hdf5=no).
|
||||
], [parallel],[
|
||||
Unable to locate parallel HDF5 compilation helper script 'h5pcc'.
|
||||
Please specify --with-hdf5=<LOCATION> as the full path to h5pcc.
|
||||
HDF5 support is being disabled (equivalent to --with-hdf5=no).
|
||||
], [
|
||||
Unable to locate HDF5 compilation helper scripts 'h5cc' or 'h5pcc'.
|
||||
Please specify --with-hdf5=<LOCATION> as the full path to h5cc or h5pcc.
|
||||
HDF5 support is being disabled (equivalent to --with-hdf5=no).
|
||||
]))
|
||||
with_hdf5="no"
|
||||
with_hdf5_fortran="no"
|
||||
else
|
||||
dnl Get the h5cc output
|
||||
HDF5_SHOW=$(eval $H5CC -show)
|
||||
|
||||
dnl Get the actual compiler used
|
||||
HDF5_CC=$(eval $H5CC -show | head -n 1 | $AWK '{print $[]1}')
|
||||
if test "$HDF5_CC" = "ccache"; then
|
||||
HDF5_CC=$(eval $H5CC -show | head -n 1 | $AWK '{print $[]2}')
|
||||
fi
|
||||
|
||||
dnl h5cc provides both AM_ and non-AM_ options
|
||||
dnl depending on how it was compiled either one of
|
||||
dnl these are empty. Lets roll them both into one.
|
||||
|
||||
dnl Look for "HDF5 Version: X.Y.Z"
|
||||
HDF5_VERSION=$(eval $H5CC -showconfig | $GREP 'HDF5 Version:' \
|
||||
| $AWK '{print $[]3}')
|
||||
|
||||
dnl A ideal situation would be where everything we needed was
|
||||
dnl in the AM_* variables. However most systems are not like this
|
||||
dnl and seem to have the values in the non-AM variables.
|
||||
dnl
|
||||
dnl We try the following to find the flags:
|
||||
dnl (1) Look for "NAME:" tags
|
||||
dnl (2) Look for "H5_NAME:" tags
|
||||
dnl (3) Look for "AM_NAME:" tags
|
||||
dnl
|
||||
HDF5_tmp_flags=$(eval $H5CC -showconfig \
|
||||
| $GREP 'FLAGS\|Extra libraries:' \
|
||||
| $AWK -F: '{printf("%s "), $[]2}' )
|
||||
|
||||
dnl Find the installation directory and append include/
|
||||
HDF5_tmp_inst=$(eval $H5CC -showconfig \
|
||||
| $GREP 'Installation point:' \
|
||||
| $AWK '{print $[]NF}' )
|
||||
|
||||
dnl Add this to the CPPFLAGS
|
||||
HDF5_CPPFLAGS="-I${HDF5_tmp_inst}/include"
|
||||
|
||||
dnl Now sort the flags out based upon their prefixes
|
||||
for arg in $HDF5_SHOW $HDF5_tmp_flags ; do
|
||||
case "$arg" in
|
||||
-I*) echo $HDF5_CPPFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \
|
||||
|| HDF5_CPPFLAGS="$HDF5_CPPFLAGS $arg"
|
||||
;;
|
||||
-L*) echo $HDF5_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \
|
||||
|| HDF5_LDFLAGS="$HDF5_LDFLAGS $arg"
|
||||
;;
|
||||
-l*) echo $HDF5_LIBS | $GREP -e "$arg" 2>&1 >/dev/null \
|
||||
|| HDF5_LIBS="$HDF5_LIBS $arg"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
HDF5_LIBS="-lhdf5 $HDF5_LIBS"
|
||||
AC_MSG_RESULT([yes (version $[HDF5_VERSION])])
|
||||
|
||||
dnl See if we can compile
|
||||
AC_LANG_PUSH([C])
|
||||
ax_lib_hdf5_save_CC=$CC
|
||||
ax_lib_hdf5_save_CPPFLAGS=$CPPFLAGS
|
||||
ax_lib_hdf5_save_LIBS=$LIBS
|
||||
ax_lib_hdf5_save_LDFLAGS=$LDFLAGS
|
||||
CC=$HDF5_CC
|
||||
CPPFLAGS=$HDF5_CPPFLAGS
|
||||
LIBS=$HDF5_LIBS
|
||||
LDFLAGS=$HDF5_LDFLAGS
|
||||
AC_CHECK_HEADER([hdf5.h], [ac_cv_hadf5_h=yes], [ac_cv_hadf5_h=no])
|
||||
AC_CHECK_LIB([hdf5], [H5Fcreate], [ac_cv_libhdf5=yes],
|
||||
[ac_cv_libhdf5=no])
|
||||
if test "$ac_cv_hadf5_h" = "no" && test "$ac_cv_libhdf5" = "no" ; then
|
||||
AC_MSG_WARN([Unable to compile HDF5 test program])
|
||||
fi
|
||||
dnl Look for HDF5's high level library
|
||||
AC_HAVE_LIBRARY([hdf5_hl], [HDF5_LIBS="-lhdf5_hl $HDF5_LIBS"], [], [])
|
||||
|
||||
CC=$ax_lib_hdf5_save_CC
|
||||
CPPFLAGS=$ax_lib_hdf5_save_CPPFLAGS
|
||||
LIBS=$ax_lib_hdf5_save_LIBS
|
||||
LDFLAGS=$ax_lib_hdf5_save_LDFLAGS
|
||||
AC_LANG_POP([C])
|
||||
|
||||
AC_MSG_CHECKING([for matching HDF5 Fortran wrapper])
|
||||
dnl Presume HDF5 Fortran wrapper is just a name variant from H5CC
|
||||
H5FC=$(eval echo -n $H5CC | $SED -n 's/cc$/fc/p')
|
||||
if test -x "$H5FC"; then
|
||||
AC_MSG_RESULT([$H5FC])
|
||||
with_hdf5_fortran="yes"
|
||||
AC_SUBST([H5FC])
|
||||
|
||||
dnl Again, pry any remaining -Idir/-Ldir from compiler wrapper
|
||||
for arg in `$H5FC -show`
|
||||
do
|
||||
case "$arg" in #(
|
||||
-I*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \
|
||||
|| HDF5_FFLAGS="$HDF5_FFLAGS $arg"
|
||||
;;#(
|
||||
-L*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \
|
||||
|| HDF5_FFLAGS="$HDF5_FFLAGS $arg"
|
||||
dnl HDF5 installs .mod files in with libraries,
|
||||
dnl but some compilers need to find them with -I
|
||||
echo $HDF5_FFLAGS | $GREP -e "-I${arg#-L}" >/dev/null \
|
||||
|| HDF5_FFLAGS="$HDF5_FFLAGS -I${arg#-L}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
dnl Make Fortran link line by inserting Fortran libraries
|
||||
for arg in $HDF5_LIBS
|
||||
do
|
||||
case "$arg" in #(
|
||||
-lhdf5_hl) HDF5_FLIBS="$HDF5_FLIBS -lhdf5hl_fortran $arg"
|
||||
;; #(
|
||||
-lhdf5) HDF5_FLIBS="$HDF5_FLIBS -lhdf5_fortran $arg"
|
||||
;; #(
|
||||
*) HDF5_FLIBS="$HDF5_FLIBS $arg"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
with_hdf5_fortran="no"
|
||||
fi
|
||||
|
||||
AC_SUBST([HDF5_VERSION])
|
||||
AC_SUBST([HDF5_CC])
|
||||
AC_SUBST([HDF5_CFLAGS])
|
||||
AC_SUBST([HDF5_CPPFLAGS])
|
||||
AC_SUBST([HDF5_LDFLAGS])
|
||||
AC_SUBST([HDF5_LIBS])
|
||||
AC_SUBST([HDF5_FC])
|
||||
AC_SUBST([HDF5_FFLAGS])
|
||||
AC_SUBST([HDF5_FLIBS])
|
||||
AC_SUBST([HDF5_TYPE])
|
||||
AC_DEFINE([HAVE_HDF5], [1], [Defined if you have HDF5 support])
|
||||
fi
|
||||
fi
|
||||
])
|
@ -7,8 +7,9 @@ Name: @PACKAGE_NAME@
|
||||
Description: TREX Input/Output library
|
||||
URL: https://github.com/trex-coe/trexio
|
||||
Version: @PACKAGE_VERSION@
|
||||
Cflags: -I${includedir} @PKG_CFLAGS@
|
||||
Libs: -L${libdir} -ltrexio -lm @PKG_LIBS@
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -ltrexio
|
||||
Libs.private: @LIBS@
|
||||
Requires: @PKG_HDF5@
|
||||
Requires.private: @PKG_HDF5@
|
||||
|
||||
|
@ -708,8 +708,7 @@ trexio_exit_code transform_str (char** dest, const char** src, uint64_t str_max_
|
||||
|
||||
* Templates for front end
|
||||
|
||||
Consider the following block of ~trex.json~:
|
||||
|
||||
Consider the following block of =trex.json=:
|
||||
|
||||
#+begin_src python
|
||||
{
|
||||
@ -724,7 +723,7 @@ trexio_exit_code transform_str (char** dest, const char** src, uint64_t str_max_
|
||||
|
||||
~TREXIO~ is generated automatically by the ~generator.py~ Python
|
||||
script based on the tree-like configuration provided in the
|
||||
~trex.json~ file. Because of that, generalized templates can be
|
||||
=trex.json= file. Because of that, generalized templates can be
|
||||
implemented and re-used. This approach minimizes the number of bugs
|
||||
as compared with manual copy-paste-modify scheme.
|
||||
|
||||
@ -760,14 +759,14 @@ trexio_exit_code transform_str (char** dest, const char** src, uint64_t str_max_
|
||||
construction of TREXIO (e.g. ~num~ of ~nucleus~ group becomes
|
||||
~nucleus_num~ and should be accessed accordingly within TREXIO).
|
||||
|
||||
TREXIO generator parses the ~trex.json~ file. TREXIO operates with
|
||||
TREXIO generator parses the =trex.json= file. TREXIO operates with
|
||||
names of variables based on the 1-st (parent group) and 2-nd (child
|
||||
object) levels of ~trex.json~ . The parsed data is divided in 2
|
||||
object) levels of =trex.json= . The parsed data is divided in 2
|
||||
parts:
|
||||
|
||||
1) Dimensioning variables (contain ~num~ in their names). These are always scalar integers.
|
||||
2) Datasets. These can be vectors, matrices or tensors. The types are indicated in ~trex.json~.
|
||||
Currently supported types: int, float. TODO: strings.
|
||||
2) Datasets. These can be vectors, matrices or tensors. The types are indicated in =trex.json=.
|
||||
Currently supported types: int, float and strings.
|
||||
|
||||
For each of the aforementioned objects, TREXIO provides *has*,
|
||||
*read* and *write* functionality. TREXIO supports I/O with single
|
||||
@ -1408,6 +1407,18 @@ interface
|
||||
end interface
|
||||
#+end_src
|
||||
|
||||
** Sparse data structures
|
||||
|
||||
Sparse data structures are used typically for large tensors such as
|
||||
two-electron integrals. For example, in the =trex.json= file sparse
|
||||
arrays appear as the ~eri~ array:
|
||||
|
||||
#+begin_src python
|
||||
"ao_2e_int" : {
|
||||
"eri_num" : [ "int", [ ] ]
|
||||
"eri" : [ "float sparse", [ "ao.num", "ao.num", "ao.num", "ao.num" ] ]
|
||||
}
|
||||
#+end_src
|
||||
* Fortran helper/wrapper functions
|
||||
|
||||
The function below adapts the original C-based ~trexio_open~ for Fortran.
|
||||
|
Loading…
Reference in New Issue
Block a user