mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-08-25 06:31:43 +02:00
Merge branch 'master' into add-strings
This commit is contained in:
commit
d57f2004ba
33
.gitignore
vendored
33
.gitignore
vendored
@ -1,14 +1,29 @@
|
||||
*/*.o
|
||||
*/.deps/
|
||||
*/.dirstamp
|
||||
*/.libs/
|
||||
*/*.la
|
||||
*/*.lo
|
||||
aclocal.m4
|
||||
Makefile
|
||||
src/Makefile
|
||||
auto-bugs
|
||||
autogen.sh
|
||||
autom4te.cache/
|
||||
clean.sh
|
||||
config.*
|
||||
compile
|
||||
config.guess
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
depcomp
|
||||
include/config.h.in
|
||||
include/stamp-h1
|
||||
install-sh
|
||||
trexio.pc
|
||||
|
||||
libtool
|
||||
ltmain.sh
|
||||
ltximg/
|
||||
Makefile
|
||||
missing
|
||||
pkgconfig/trexio.pc
|
||||
test_write.h5
|
||||
trexio-*.tar.gz
|
||||
trexio-*/
|
||||
|
||||
|
||||
|
||||
|
9
ChangeLog
Normal file
9
ChangeLog
Normal file
@ -0,0 +1,9 @@
|
||||
CHANGES
|
||||
=======
|
||||
|
||||
0.3
|
||||
---
|
||||
|
||||
* Using libtool/automake
|
||||
* Rewrote generator
|
||||
|
368
INSTALL
Normal file
368
INSTALL
Normal file
@ -0,0 +1,368 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
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 warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell command './configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the 'README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
'INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The 'configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a 'Makefile' in each directory of the package.
|
||||
It may also create one or more '.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script 'config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file 'config.log' containing compiler output (useful mainly for
|
||||
debugging 'configure').
|
||||
|
||||
It can also use an optional file (typically called 'config.cache' and
|
||||
enabled with '--cache-file=config.cache' or simply '-C') that saves the
|
||||
results of its tests to speed up reconfiguring. Caching is disabled by
|
||||
default to prevent problems with accidental use of stale cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how 'configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the 'README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point 'config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file 'configure.ac' (or 'configure.in') is used to create
|
||||
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||
you want to change it or regenerate 'configure' using a newer version of
|
||||
'autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. 'cd' to the directory containing the package's source code and type
|
||||
'./configure' to configure the package for your system.
|
||||
|
||||
Running 'configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type 'make' to compile the package.
|
||||
|
||||
3. Optionally, type 'make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type 'make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the 'make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior 'make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing 'make clean'. To also remove the
|
||||
files that 'configure' created (so you can compile the package for
|
||||
a different kind of computer), type 'make distclean'. There is
|
||||
also a 'make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type 'make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide 'make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like 'make install' and 'make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the 'configure' script does not know about. Run './configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give 'configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here is
|
||||
an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the 'configure' script. 'configure' automatically checks for the source
|
||||
code in the directory that 'configure' is in and in '..'. This is known
|
||||
as a "VPATH" build.
|
||||
|
||||
With a non-GNU 'make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use 'make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple '-arch' options to the
|
||||
compiler but only a single '-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the 'lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, 'make install' installs the package's commands under
|
||||
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||
can specify an installation prefix other than '/usr/local' by giving
|
||||
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like '--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run 'configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the default
|
||||
for these options is expressed in terms of '${prefix}', so that
|
||||
specifying just '--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to 'configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
'make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, 'make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
'${prefix}'. Any directories that were specified during 'configure',
|
||||
but not in terms of '${prefix}', must each be overridden at install time
|
||||
for the entire installation to be relocated. The approach of makefile
|
||||
variable overrides for each directory variable is required by the GNU
|
||||
Coding Standards, and ideally causes no recompilation. However, some
|
||||
platforms have known limitations with the semantics of shared libraries
|
||||
that end up requiring recompilation when using this method, particularly
|
||||
noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the 'DESTDIR' variable. For
|
||||
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||
'/alternate/directory' before all installation names. The approach of
|
||||
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of '${prefix}'
|
||||
at 'configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving 'configure' the
|
||||
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to '--enable-FEATURE' options to
|
||||
'configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||
'README' should mention any '--enable-' and '--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, 'configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the 'configure' options '--x-includes=DIR' and
|
||||
'--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of 'make' will be. For these packages, running './configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with 'make V=1'; while running './configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with 'make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
|
||||
is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX 'make' updates targets which have the same time stamps as their
|
||||
prerequisites, which makes it generally unusable when shipped generated
|
||||
files such as 'configure' are involved. Use GNU 'make' instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
|
||||
workaround. If GNU CC is not installed, it is therefore recommended to
|
||||
try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in '/boot/common',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features 'configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as 'sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file 'config.sub' for the possible values of each field. If
|
||||
'config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option '--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with '--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for 'configure' scripts to share,
|
||||
you can create a site shell script called 'config.site' that gives
|
||||
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
'CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all 'configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to 'configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
|
||||
Autoconf limitation. Until the limitation is lifted, you can use this
|
||||
workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
'configure' Invocation
|
||||
======================
|
||||
|
||||
'configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
'--help'
|
||||
'-h'
|
||||
Print a summary of all of the options to 'configure', and exit.
|
||||
|
||||
'--help=short'
|
||||
'--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
'configure', and exit. The 'short' variant lists options used only
|
||||
in the top level, while the 'recursive' variant lists options also
|
||||
present in any nested packages.
|
||||
|
||||
'--version'
|
||||
'-V'
|
||||
Print the version of Autoconf used to generate the 'configure'
|
||||
script, and exit.
|
||||
|
||||
'--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||
disable caching.
|
||||
|
||||
'--config-cache'
|
||||
'-C'
|
||||
Alias for '--cache-file=config.cache'.
|
||||
|
||||
'--quiet'
|
||||
'--silent'
|
||||
'-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to '/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
'--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
'configure' can determine that directory automatically.
|
||||
|
||||
'--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names:: for
|
||||
more details, including other options available for fine-tuning the
|
||||
installation locations.
|
||||
|
||||
'--no-create'
|
||||
'-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
'configure' also accepts some other, not widely useful, options. Run
|
||||
'configure --help' for more details.
|
120
Makefile.am
Normal file
120
Makefile.am
Normal file
@ -0,0 +1,120 @@
|
||||
# TREXIO - TREX Input/Output library
|
||||
#
|
||||
# BSD 3-Clause License
|
||||
#
|
||||
# Copyright (c) 2020, TREX Center of Excellence
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
CLEANFILES = trexio.mod
|
||||
|
||||
VERSION_MAJOR = @VERSION_MAJOR@
|
||||
VERSION_MINOR = @VERSION_MINOR@
|
||||
VERSION_PATCH = @VERSION_PATCH@
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = pkgconfig/trexio.pc
|
||||
|
||||
|
||||
trexio_h = $(srcdir)/include/trexio.h
|
||||
trexio_f = $(srcdir)/include/trexio_f.f90
|
||||
|
||||
include_HEADERS = $(trexio_h) $(trexio_f)
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include
|
||||
|
||||
lib_LTLIBRARIES = src/libtrexio.la
|
||||
|
||||
|
||||
SOURCES = \
|
||||
$(trexio_h) \
|
||||
$(srcdir)/src/trexio.c \
|
||||
$(srcdir)/src/trexio_private.h \
|
||||
$(srcdir)/src/trexio_s.h \
|
||||
$(srcdir)/src/trexio_hdf5.c \
|
||||
$(srcdir)/src/trexio_hdf5.h \
|
||||
$(srcdir)/src/trexio_text.c \
|
||||
$(srcdir)/src/trexio_text.h
|
||||
|
||||
ORG_FILES = \
|
||||
src/templates_front/templator_front.org \
|
||||
src/templates_text/templator_text.org \
|
||||
src/templates_hdf5/templator_hdf5.org \
|
||||
trex.org
|
||||
|
||||
|
||||
src_libtrexio_la_SOURCES = $(SOURCES)
|
||||
|
||||
TESTS = tests/test_c tests/test_f
|
||||
check_PROGRAMS = $(TESTS)
|
||||
|
||||
tests_test_c_DEPENDENCIES = $(trexio_h)
|
||||
tests_test_c_SOURCES = tests/test.c $(trexio_h)
|
||||
tests_test_c_LDADD = src/libtrexio.la
|
||||
tests_test_c_LDFLAGS = -no-install
|
||||
|
||||
test_trexio_f = $(srcdir)/tests/trexio_f.f90
|
||||
|
||||
tests_test_f_DEPENDENCIES = $(test_trexio_f)
|
||||
tests_test_f_SOURCES = $(test_trexio_f) tests/test_f.f90
|
||||
tests_test_f_LDADD = src/libtrexio.la
|
||||
tests_test_f_LDFLAGS = -no-install
|
||||
|
||||
$(test_trexio_f):
|
||||
cp $(trexio_f) $(test_trexio_f)
|
||||
|
||||
clean-local:
|
||||
-rm -rf -- test_write.dir/ test_write_f.dir/ test_write.h5
|
||||
|
||||
if TREXIO_DEVEL
|
||||
|
||||
CLEANFILES += $(SOURCES) $(trexio_f) $(trexio_h)
|
||||
|
||||
BUILT_SOURCES = $(SOURCES) $(trexio_f) $(test_trexio_f)
|
||||
|
||||
$(SOURCES): $(trexio_f)
|
||||
src/trexio.c: $(trexio_h)
|
||||
|
||||
$(trexio_f): $(ORG_FILES)
|
||||
cd $(srcdir)/tools && ./build_trexio.sh
|
||||
|
||||
cppcheck: cppcheck.out
|
||||
cat cppcheck.out
|
||||
|
||||
cppcheck.out: $(trexio_h)
|
||||
cd src/ && \
|
||||
cppcheck --addon=cert -q --error-exitcode=0 \
|
||||
--enable=all \
|
||||
--language=c --std=c99 -rp --platform=unix64 \
|
||||
-I../include *.c *.h 2>../$@
|
||||
|
||||
.PHONY: cppcheck
|
||||
|
||||
endif
|
106
Makefile.in
106
Makefile.in
@ -1,106 +0,0 @@
|
||||
# @configure_input@
|
||||
|
||||
# Package-specific substitution variables
|
||||
package = @PACKAGE_NAME@
|
||||
version = @PACKAGE_VERSION@
|
||||
tarname = @PACKAGE_TARNAME@
|
||||
distdir = $(tarname)-$(version)
|
||||
|
||||
# Prefix-specific substitution variables
|
||||
datarootdir = @datarootdir@
|
||||
prefix = @prefix@
|
||||
includedir = @includedir@
|
||||
docdir = @docdir@
|
||||
htmldir = @htmldir@
|
||||
libdir = @libdir@
|
||||
# Supplementary
|
||||
exec_prefix = @exec_prefix@
|
||||
libexecdir = @libexecdir@
|
||||
lispdir = @lispdir@
|
||||
# VPATH-specific substitution variables
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
# Tool-specific substitution variables
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
FC = @FC@
|
||||
FCFLAGS = @FCFLAGS@
|
||||
LIBS = @LIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
.PHONY: FORCE all install uninstall clean maintainer-clean check dist distcheck
|
||||
.POSIX:
|
||||
.SUFFIXES:
|
||||
|
||||
all install uninstall:
|
||||
cd src && $(MAKE) $@
|
||||
|
||||
|
||||
check:
|
||||
cd tests && $(MAKE) $@
|
||||
|
||||
|
||||
clean maintainer-clean:
|
||||
cd src && $(MAKE) $@
|
||||
cd tests && $(MAKE) $@
|
||||
|
||||
|
||||
dist: $(distdir).tar.gz
|
||||
|
||||
|
||||
$(distdir).tar.gz: $(distdir)
|
||||
tar chof - $(distdir) | gzip -9 -c > $@
|
||||
$(RM) -r -- $(distdir)
|
||||
|
||||
# for now copy entire src/ directory into $(distdir) in order for distcheck rule to work
|
||||
# later on can be changed to ship only files like *.c *.h *.f90 *.so *.mod
|
||||
$(distdir): FORCE
|
||||
mkdir -p $(distdir)
|
||||
cp $(srcdir)/configure.ac $(distdir)
|
||||
cp $(srcdir)/configure $(distdir)
|
||||
cp $(srcdir)/config.h.in $(distdir)
|
||||
cp $(srcdir)/install-sh $(distdir)
|
||||
mkdir -p $(distdir)/src
|
||||
mkdir -p $(distdir)/tests
|
||||
mkdir -p $(distdir)/include
|
||||
mkdir -p $(distdir)/lib
|
||||
cp $(srcdir)/include/trexio.h $(distdir)/include
|
||||
cp $(srcdir)/include/trexio_f.f90 $(distdir)/include
|
||||
cp $(srcdir)/src/trexio*.c $(distdir)/src
|
||||
cp $(srcdir)/src/trexio*.h $(distdir)/src
|
||||
cp $(srcdir)/src/Makefile.in $(distdir)/src
|
||||
cp $(srcdir)/tests/test.c $(distdir)/tests
|
||||
cp $(srcdir)/tests/test.f90 $(distdir)/tests
|
||||
cp $(srcdir)/tests/Makefile.in $(distdir)/tests
|
||||
cp $(srcdir)/Makefile.in $(distdir)
|
||||
cp $(srcdir)/trexio.pc.in $(distdir)
|
||||
cp $(srcdir)/LICENSE $(distdir)
|
||||
|
||||
|
||||
FORCE:
|
||||
-$(RM) -- $(distdir).tar.gz >/dev/null 2>&1
|
||||
-$(RM) -r -- $(distdir) >/dev/null 2>&1
|
||||
|
||||
|
||||
distcheck: $(distdir).tar.gz
|
||||
gzip -cd $(distdir).tar.gz | tar xvf -
|
||||
cd $(distdir) && \
|
||||
./configure CC="$(CC)" CFLAGS="$(CFLAGS)" && \
|
||||
$(MAKE) && \
|
||||
$(MAKE) DESTDIR=$${PWD}/_inst install && \
|
||||
$(MAKE) DESTDIR=$${PWD}/_inst check && \
|
||||
$(MAKE) DESTDIR=$${PWD}/_inst uninstall && \
|
||||
$(MAKE) clean
|
||||
$(RM) -r -- $(distdir)
|
||||
@echo "*** Package $(distdir).tar.gz is ready for distribution."
|
||||
|
||||
|
||||
Makefile: Makefile.in config.status
|
||||
./config.status $@
|
||||
|
||||
|
||||
config.status: configure
|
||||
./config.status --recheck
|
||||
|
16
README.md
16
README.md
@ -21,27 +21,25 @@ TREX library fo efficient I/O.
|
||||
7. `sudo make install`
|
||||
|
||||
|
||||
**Note: on systems with no `sudo` rights access, one can replace `./configure` with `./configure prefix=${PWD}` in order to execite `make install/uninstall` commands without `sudo`. This will enable the installation in the root directory of the library.**
|
||||
**Note: on systems with no `sudo` rights access, one can replace `./configure` with `./configure prefix=${PWD}` in order to execute `make install/uninstall` commands without `sudo`. This will enable the installation in the root directory of the library.**
|
||||
|
||||
|
||||
## Additional requirements (for developers):
|
||||
|
||||
- Automake
|
||||
- python3 (>=3.6)
|
||||
- emacs (>=26.0)
|
||||
- Emacs (>=26.0)
|
||||
|
||||
|
||||
## Installation procedure from the GitHub repo clone (for developers):
|
||||
|
||||
1. `git clone https://github.com/TREX-CoE/trexio.git`
|
||||
2. `cd trexio`
|
||||
3. `cd tools && ./build_trexio.sh && cd ..`
|
||||
4. `autoreconf`
|
||||
5. `automake --add-missing --copy`
|
||||
6. `./configure`
|
||||
7. `make`
|
||||
8. `make check`
|
||||
9. `sudo make install`
|
||||
3. `./autogen.sh`
|
||||
4. `./configure`
|
||||
5. `make`
|
||||
6. `make check`
|
||||
7. `sudo make install`
|
||||
|
||||
|
||||
## Tutorial
|
||||
|
111
Sparse.org
111
Sparse.org
@ -1,113 +1,4 @@
|
||||
|
||||
* JSON
|
||||
"ao_2e_int" : {
|
||||
"eri_num" : [ "int", [ ] ]
|
||||
"eri" : [ "float sparse", [ "ao.num", "ao.num", "ao.num", "ao.num" ] ]
|
||||
},
|
||||
|
||||
* Front end
|
||||
|
||||
For example, the integral $\langle ij | kl \rangle = x$ can be
|
||||
represented represented as
|
||||
- a quartet of integers $(i,j,k,l)$
|
||||
- a floating point value $x$
|
||||
|
||||
To store $N$ integrals in the file, we can store
|
||||
- An array of quartets of integers
|
||||
- An array of values (floats)
|
||||
|
||||
These two arrays have the same size, $N$.
|
||||
|
||||
As the number of integrals to store can be prohibitively large, it
|
||||
is important to be able to read/write the integrals in chunks. So we
|
||||
need to give two extra parameters to the functions:
|
||||
- ~offset~ : the index of the 1st integral we want to read. An
|
||||
offset of zero implies to read the first integral
|
||||
- ~num~ : the number of integrals to read
|
||||
|
||||
We need to provide one function to read a chunk of indices, and one
|
||||
function to read a chunk of values, because some users might want to
|
||||
read only the values of the integrals, or only the indices.
|
||||
|
||||
Here is an example for the indices:
|
||||
|
||||
#+BEGIN_SRC c
|
||||
trexio_exit_code
|
||||
trexio_read_chunk_ao_2e_int_eri_index_32(trexio_t* const file,
|
||||
const int64_t offset,
|
||||
const int64_t num,
|
||||
int32_t* buffer)
|
||||
{
|
||||
if (file == NULL) return TREXIO_INVALID_ARG_1;
|
||||
if (offset < 0L) return TREXIO_INVALID_ARG_2;
|
||||
if (num < 0L) return TREXIO_INVALID_ARG_3;
|
||||
|
||||
const uint32_t rank = 4; // To be set by generator : number of indices
|
||||
|
||||
int64_t nmax; // Max number of integrals
|
||||
trexio_exit_code rc;
|
||||
|
||||
rc = trexio_read_ao_2e_int_eri_num(const file, &nmax);
|
||||
if (rc != TREXIO_SUCCESS) return rc;
|
||||
|
||||
switch (file->back_end) {
|
||||
|
||||
case TREXIO_TEXT:
|
||||
return trexio_text_read_chunk_ao_2e_int_eri_index(file, buffer, offset, num, rank, nmax);
|
||||
break;
|
||||
|
||||
case TREXIO_HDF5:
|
||||
return trexio_hdf5_read_chunk_ao_2e_int_eri_index(file, buffer, offset, num, rank, nmax);
|
||||
break;
|
||||
/*
|
||||
case TREXIO_JSON:
|
||||
return trexio_json_read_chunk_ao_2e_int_eri_index(file, buffer, offset, num, rank, nmax);
|
||||
break;
|
||||
,*/
|
||||
default:
|
||||
return TREXIO_FAILURE; /* Impossible case */
|
||||
}
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
For the values,
|
||||
|
||||
#+BEGIN_SRC c
|
||||
trexio_exit_code
|
||||
trexio_read_chunk_ao_2e_int_eri_value_64(trexio_t* const file,
|
||||
const int64_t offset,
|
||||
const int64_t num,
|
||||
double* buffer)
|
||||
{
|
||||
if (file == NULL) return TREXIO_INVALID_ARG_1;
|
||||
if (offset < 0L) return TREXIO_INVALID_ARG_2;
|
||||
if (num < 0L) return TREXIO_INVALID_ARG_3;
|
||||
|
||||
int64_t nmax; // Max number of integrals
|
||||
trexio_exit_code rc;
|
||||
|
||||
rc = trexio_read_ao_2e_int_eri_num(const file, &nmax);
|
||||
if (rc != TREXIO_SUCCESS) return rc;
|
||||
|
||||
switch (file->back_end) {
|
||||
|
||||
case TREXIO_TEXT:
|
||||
return trexio_text_read_chunk_ao_2e_int_eri_value(file, buffer, offset, num, nmax);
|
||||
break;
|
||||
|
||||
case TREXIO_HDF5:
|
||||
return trexio_hdf5_read_chunk_ao_2e_int_eri_index(file, buffer, offset, num, nmax);
|
||||
break;
|
||||
/*
|
||||
case TREXIO_JSON:
|
||||
return trexio_json_read_chunk_ao_2e_int_eri_index(file, buffer, offset, num, nmax);
|
||||
break;
|
||||
,*/
|
||||
default:
|
||||
return TREXIO_FAILURE; /* Impossible case */
|
||||
}
|
||||
}
|
||||
#+END_SRC
|
||||
See templator_front.org
|
||||
|
||||
* Text back end
|
||||
As the size of the dataset should be extensible, the simplest
|
||||
|
5
autogen.sh
Executable file
5
autogen.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
autoreconf -i
|
||||
|
||||
|
247
configure.ac
247
configure.ac
@ -2,151 +2,106 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([TREXIO], [0.2], [https://github.com/TREX-CoE/trexio/issues])
|
||||
AC_INIT([trexio], [0.3.0], [https://github.com/TREX-CoE/trexio/issues])
|
||||
AM_INIT_AUTOMAKE([subdir-objects color-tests parallel-tests silent-rules 1.11])
|
||||
AM_MAINTAINER_MODE()
|
||||
LT_INIT
|
||||
AC_CONFIG_SRCDIR([Makefile.in])
|
||||
AC_CONFIG_HEADERS([include/config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AC_CHECK_FILE(src/trexio_text.h, [have_src=yes], [have_src=no])
|
||||
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`
|
||||
AC_DEFINE_UNQUOTED(TREXIO_VERSION_MAJOR, [$VERSION_MAJOR], [major version])
|
||||
AC_DEFINE_UNQUOTED(TREXIO_VERSION_MINOR, [$VERSION_MINOR], [minor version])
|
||||
AC_DEFINE_UNQUOTED(TREXIO_VERSION_PATCH, [$VERSION_PATCH], [patch version])
|
||||
AC_SUBST([VERSION_MAJOR])
|
||||
AC_SUBST([VERSION_MINOR])
|
||||
AC_SUBST([VERSION_PATCH])
|
||||
|
||||
if test "x${have_src}" = xno; then
|
||||
AC_MSG_ERROR([
|
||||
------------------------------------------
|
||||
Please run:
|
||||
cd tools && ./build_trexio.sh && cd ..
|
||||
before running ./configure
|
||||
------------------------------------------])
|
||||
fi
|
||||
|
||||
AC_CONFIG_SRCDIR([src/Makefile.in])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
PKG_PROG_PKG_CONFIG()
|
||||
PKG_LIBS=""
|
||||
PKG_CFLAGS=""
|
||||
# Checks for programs.
|
||||
|
||||
## -------------------
|
||||
## Checks for programs
|
||||
## -------------------
|
||||
|
||||
AC_LANG(C)
|
||||
AC_PROG_CC
|
||||
|
||||
# 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])])
|
||||
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
|
||||
AC_PROG_CC_C99
|
||||
|
||||
# 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
|
||||
## ---------
|
||||
## Libraries
|
||||
## ---------
|
||||
|
||||
# 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.
|
||||
------------------------------------------])
|
||||
|
||||
elif test "x${hdf5}" = xyes; then
|
||||
|
||||
# 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])
|
||||
|
||||
# If HDF5 is not configured, try using pkg-config
|
||||
if test "x${have_hdf5}" = xno; then
|
||||
PKG_CHECK_MODULES([HDF5], [hdf5 >= 1.8])
|
||||
CFLAGS="${HDF5_CFLAGS} ${CFLAGS}"
|
||||
FCFLAGS="${HDF5_CFLAGS} ${FCFLAGS}"
|
||||
LIBS="${HDF5_LIBS} -lhdf5_hl ${LIBS}"
|
||||
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}"
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
CFLAGS="${HDF5_CFLAGS} ${CFLAGS}"
|
||||
CPPFLAGS="${HDF5_CPPFLAGS} ${CPPFLAGS}"
|
||||
LDFLAGS="${HDF5_LDFLAGS} ${LDFLAGS}"
|
||||
LIBS="${HDF5_LIBS} ${LIBS}"
|
||||
|
||||
|
||||
# Check if hdf5 if available with pkg-config
|
||||
|
||||
PKG_CHECK_MODULES([HDF5], [hdf5 >= 1.8], [
|
||||
PKG_HDF5="hdf5"
|
||||
],[
|
||||
PKG_HDF5=""
|
||||
])
|
||||
PKG_CFLAGS="${PKG_CFLAGS}"
|
||||
|
||||
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
|
||||
@ -158,34 +113,68 @@ AC_TYPE_UINT64_T
|
||||
AC_FUNC_MALLOC
|
||||
AC_CHECK_FUNCS([memset mkdir strerror])
|
||||
|
||||
AM_CONDITIONAL([TREXIO_DEVEL],[test "x$TREXIO_DEVEL" != x])
|
||||
|
||||
if test "x${TREXIO_DEVEL}" != "x"; then
|
||||
|
||||
TREXIO_DEVEL=" -- Developer mode"
|
||||
AC_PROG_AWK
|
||||
AM_PATH_PYTHON([3.0])
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
src/Makefile
|
||||
tests/Makefile
|
||||
trexio.pc])
|
||||
pkgconfig/trexio.pc])
|
||||
AC_OUTPUT
|
||||
|
||||
echo \
|
||||
"-------------------------------------------------
|
||||
|
||||
${PACKAGE_NAME} Version ${PACKAGE_VERSION}
|
||||
${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
|
||||
])
|
8394
m4/libtool.m4
vendored
Normal file
8394
m4/libtool.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
437
m4/ltoptions.m4
vendored
Normal file
437
m4/ltoptions.m4
vendored
Normal file
@ -0,0 +1,437 @@
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
||||
|
||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ------------------------------------------
|
||||
m4_define([_LT_MANGLE_OPTION],
|
||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ---------------------------------------
|
||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
|
||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
|
||||
# saved as a flag.
|
||||
m4_define([_LT_SET_OPTION],
|
||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
[m4_warning([Unknown $1 option '$2'])])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
|
||||
# ------------------------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
m4_define([_LT_IF_OPTION],
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
|
||||
|
||||
|
||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
|
||||
# -------------------------------------------------------
|
||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
|
||||
# are set.
|
||||
m4_define([_LT_UNLESS_OPTIONS],
|
||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
|
||||
[m4_define([$0_found])])])[]dnl
|
||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
|
||||
])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
|
||||
# ----------------------------------------
|
||||
# OPTION-LIST is a space-separated list of Libtool options associated
|
||||
# with MACRO-NAME. If any OPTION has a matching handler declared with
|
||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
|
||||
# the unknown option and exit.
|
||||
m4_defun([_LT_SET_OPTIONS],
|
||||
[# Set options
|
||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[_LT_SET_OPTION([$1], _LT_Option)])
|
||||
|
||||
m4_if([$1],[LT_INIT],[
|
||||
dnl
|
||||
dnl Simply set some default values (i.e off) if boolean options were not
|
||||
dnl specified:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
|
||||
])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
|
||||
])
|
||||
dnl
|
||||
dnl If no reference was made to various pairs of opposing options, then
|
||||
dnl we run the default mode handler for the pair. For example, if neither
|
||||
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
|
||||
dnl archives by default:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
|
||||
[_LT_WITH_AIX_SONAME([aix])])
|
||||
])
|
||||
])# _LT_SET_OPTIONS
|
||||
|
||||
|
||||
## --------------------------------- ##
|
||||
## Macros to handle LT_INIT options. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
|
||||
# -----------------------------------------
|
||||
m4_define([_LT_MANGLE_DEFUN],
|
||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
|
||||
# -----------------------------------------------
|
||||
m4_define([LT_OPTION_DEFINE],
|
||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
|
||||
])# LT_OPTION_DEFINE
|
||||
|
||||
|
||||
# dlopen
|
||||
# ------
|
||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
||||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'dlopen' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
|
||||
|
||||
|
||||
# win32-dll
|
||||
# ---------
|
||||
# Declare package support for building win32 dll's.
|
||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -z "$AS" && AS=as
|
||||
_LT_DECL([], [AS], [1], [Assembler program])dnl
|
||||
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
|
||||
|
||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
||||
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
|
||||
])# win32-dll
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'win32-dll' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
||||
|
||||
|
||||
# _LT_ENABLE_SHARED([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-shared flag, and supports the 'shared' and
|
||||
# 'disable-shared' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_SHARED],
|
||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
|
||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
||||
|
||||
_LT_DECL([build_libtool_libs], [enable_shared], [0],
|
||||
[Whether or not to build shared libraries])
|
||||
])# _LT_ENABLE_SHARED
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-shared])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_STATIC([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-static flag, and support the 'static' and
|
||||
# 'disable-static' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_STATIC],
|
||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
|
||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
||||
|
||||
_LT_DECL([build_old_libs], [enable_static], [0],
|
||||
[Whether or not to build static libraries])
|
||||
])# _LT_ENABLE_STATIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-static])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --enable-fast-install flag, and support the 'fast-install'
|
||||
# and 'disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([fast-install],
|
||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
|
||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
||||
|
||||
_LT_DECL([fast_install], [enable_fast_install], [0],
|
||||
[Whether or not to optimize for fast installation])dnl
|
||||
])# _LT_ENABLE_FAST_INSTALL
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
|
||||
|
||||
# Old names:
|
||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the 'fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the 'disable-fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
||||
|
||||
|
||||
# _LT_WITH_AIX_SONAME([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
|
||||
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
|
||||
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
|
||||
m4_define([_LT_WITH_AIX_SONAME],
|
||||
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
|
||||
shared_archive_member_spec=
|
||||
case $host,$enable_shared in
|
||||
power*-*-aix[[5-9]]*,yes)
|
||||
AC_MSG_CHECKING([which variant of shared library versioning to provide])
|
||||
AC_ARG_WITH([aix-soname],
|
||||
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
|
||||
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
|
||||
[case $withval in
|
||||
aix|svr4|both)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
|
||||
;;
|
||||
esac
|
||||
lt_cv_with_aix_soname=$with_aix_soname],
|
||||
[AC_CACHE_VAL([lt_cv_with_aix_soname],
|
||||
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
|
||||
with_aix_soname=$lt_cv_with_aix_soname])
|
||||
AC_MSG_RESULT([$with_aix_soname])
|
||||
if test aix != "$with_aix_soname"; then
|
||||
# For the AIX way of multilib, we name the shared archive member
|
||||
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
|
||||
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
|
||||
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
|
||||
# the AIX toolchain works better with OBJECT_MODE set (default 32).
|
||||
if test 64 = "${OBJECT_MODE-32}"; then
|
||||
shared_archive_member_spec=shr_64
|
||||
else
|
||||
shared_archive_member_spec=shr
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
with_aix_soname=aix
|
||||
;;
|
||||
esac
|
||||
|
||||
_LT_DECL([], [shared_archive_member_spec], [0],
|
||||
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
|
||||
])# _LT_WITH_AIX_SONAME
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
|
||||
|
||||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
|
||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
||||
[lt_p=${PACKAGE-default}
|
||||
case $withval in
|
||||
yes|no) pic_mode=$withval ;;
|
||||
*)
|
||||
pic_mode=default
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for lt_pkg in $withval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$lt_pkg" = "X$lt_p"; then
|
||||
pic_mode=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[pic_mode=m4_default([$1], [default])])
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
|
||||
|
||||
# Old name:
|
||||
AU_DEFUN([AC_LIBTOOL_PICMODE],
|
||||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'pic-only' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
|
||||
|
||||
## ----------------- ##
|
||||
## LTDL_INIT Options ##
|
||||
## ----------------- ##
|
||||
|
||||
m4_define([_LTDL_MODE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
|
||||
[m4_define([_LTDL_MODE], [nonrecursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
|
||||
[m4_define([_LTDL_MODE], [recursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
|
||||
[m4_define([_LTDL_MODE], [subproject])])
|
||||
|
||||
m4_define([_LTDL_TYPE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [installable],
|
||||
[m4_define([_LTDL_TYPE], [installable])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
|
||||
[m4_define([_LTDL_TYPE], [convenience])])
|
124
m4/ltsugar.m4
vendored
Normal file
124
m4/ltsugar.m4
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6 ltsugar.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
||||
|
||||
|
||||
# lt_join(SEP, ARG1, [ARG2...])
|
||||
# -----------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
|
||||
# associated separator.
|
||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
|
||||
# versions in m4sugar had bugs.
|
||||
m4_define([lt_join],
|
||||
[m4_if([$#], [1], [],
|
||||
[$#], [2], [[$2]],
|
||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
m4_define([_lt_join],
|
||||
[m4_if([$#$2], [2], [],
|
||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
|
||||
|
||||
# lt_car(LIST)
|
||||
# lt_cdr(LIST)
|
||||
# ------------
|
||||
# Manipulate m4 lists.
|
||||
# These macros are necessary as long as will still need to support
|
||||
# Autoconf-2.59, which quotes differently.
|
||||
m4_define([lt_car], [[$1]])
|
||||
m4_define([lt_cdr],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
||||
[$#], 1, [],
|
||||
[m4_dquote(m4_shift($@))])])
|
||||
m4_define([lt_unquote], $1)
|
||||
|
||||
|
||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# ------------------------------------------
|
||||
# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
|
||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
||||
# than defined and empty).
|
||||
#
|
||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier
|
||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
|
||||
m4_define([lt_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
||||
|
||||
|
||||
|
||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
|
||||
# ----------------------------------------------------------
|
||||
# Produce a SEP delimited list of all paired combinations of elements of
|
||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
||||
# has the form PREFIXmINFIXSUFFIXn.
|
||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
||||
m4_define([lt_combine],
|
||||
[m4_if(m4_eval([$# > 3]), [1],
|
||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
||||
[[m4_foreach([_Lt_prefix], [$2],
|
||||
[m4_foreach([_Lt_suffix],
|
||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
||||
|
||||
|
||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
||||
# -----------------------------------------------------------------------
|
||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
|
||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
|
||||
m4_define([lt_if_append_uniq],
|
||||
[m4_ifdef([$1],
|
||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
|
||||
[lt_append([$1], [$2], [$3])$4],
|
||||
[$5])],
|
||||
[lt_append([$1], [$2], [$3])$4])])
|
||||
|
||||
|
||||
# lt_dict_add(DICT, KEY, VALUE)
|
||||
# -----------------------------
|
||||
m4_define([lt_dict_add],
|
||||
[m4_define([$1($2)], [$3])])
|
||||
|
||||
|
||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
|
||||
# --------------------------------------------
|
||||
m4_define([lt_dict_add_subkey],
|
||||
[m4_define([$1($2:$3)], [$4])])
|
||||
|
||||
|
||||
# lt_dict_fetch(DICT, KEY, [SUBKEY])
|
||||
# ----------------------------------
|
||||
m4_define([lt_dict_fetch],
|
||||
[m4_ifval([$3],
|
||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
|
||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
|
||||
|
||||
|
||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
|
||||
# -----------------------------------------------------------------
|
||||
m4_define([lt_if_dict_fetch],
|
||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
|
||||
[$5],
|
||||
[$6])])
|
||||
|
||||
|
||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
|
||||
# --------------------------------------------------------------
|
||||
m4_define([lt_dict_filter],
|
||||
[m4_if([$5], [], [],
|
||||
[lt_join(m4_quote(m4_default([$4], [[, ]])),
|
||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
|
||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
|
||||
])
|
23
m4/ltversion.m4
vendored
Normal file
23
m4/ltversion.m4
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# @configure_input@
|
||||
|
||||
# serial 4179 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.4.6])
|
||||
m4_define([LT_PACKAGE_REVISION], [2.4.6])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.4.6'
|
||||
macro_revision='2.4.6'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
99
m4/lt~obsolete.m4
vendored
Normal file
99
m4/lt~obsolete.m4
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5 lt~obsolete.m4
|
||||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
||||
# and doesn't know about Autoconf macros at all.)
|
||||
#
|
||||
# So we provide this file, which has a silly filename so it's always
|
||||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
# we give up compatibility with versions before 1.7, at which point
|
||||
# we need to keep only those names which we still refer to.
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
||||
|
||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
||||
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
|
||||
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
|
||||
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
|
||||
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
|
||||
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
|
||||
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
|
@ -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@
|
||||
|
143
src/Makefile.in
143
src/Makefile.in
@ -1,143 +0,0 @@
|
||||
# @configure_input@
|
||||
|
||||
# Package-specific substitution variables
|
||||
package = @PACKAGE_NAME@
|
||||
version = @PACKAGE_VERSION@
|
||||
tarname = @PACKAGE_TARNAME@
|
||||
distdir = $(tarname)-$(version)
|
||||
|
||||
# Prefix-specific substitution variables
|
||||
datarootdir = @datarootdir@
|
||||
prefix = @prefix@
|
||||
includedir = @includedir@
|
||||
docdir = @docdir@
|
||||
htmldir = @htmldir@
|
||||
libdir = @libdir@
|
||||
pkgconfigdir= $(libdir)/pkgconfig
|
||||
|
||||
# Supplementary
|
||||
exec_prefix = @exec_prefix@
|
||||
libexecdir = @libexecdir@
|
||||
lispdir = @lispdir@
|
||||
# VPATH-specific substitution variables
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
libtrexio_so=libtrexio.so
|
||||
libtrexio=$(srcdir)/../lib/$(libtrexio_so)
|
||||
|
||||
trexio_f_file=trexio_f.f90
|
||||
trexio_f=$(srcdir)/../include/$(trexio_f_file)
|
||||
|
||||
trexio_h_file=trexio.h
|
||||
trexio_h=$(srcdir)/../include/$(trexio_h_file)
|
||||
|
||||
# Tool-specific substitution variables
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
FC = @FC@
|
||||
FCFLAGS = @FCFLAGS@
|
||||
LIBS = @LIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
|
||||
ifeq ($(CC),gcc)
|
||||
#CFLAGS = -g -fPIC -O2 -fexceptions -Wall -Werror -Wpedantic -Wextra
|
||||
endif
|
||||
ifeq ($(FC),gfortran)
|
||||
#FCFLAGS = -g -fPIC -O2 -fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -Wreal-q-constant -Wuninitialized -fbacktrace -ffpe-trap=zero,overflow,underflow -finit-real=nan
|
||||
endif
|
||||
|
||||
ifeq ($(CC),icc)
|
||||
#CFLAGS = -xHost -fPIC -g -O2 -fexceptions -Wall -Werror -Wpedantic -Wextra
|
||||
endif
|
||||
ifeq ($(FC),ifort)
|
||||
#FCFLAGS = -xHost -fPIC -g -O2
|
||||
endif
|
||||
|
||||
ifeq ($(CC),clang)
|
||||
#CFLAGS = -fPIC -g -O2
|
||||
endif
|
||||
ifeq ($(FC),flang)
|
||||
#FCFLAGS = -fPIC -g -O2
|
||||
endif
|
||||
|
||||
OBJECT_FILES= trexio.o trexio_text.o trexio_hdf5.o
|
||||
SOURCE_FILES= trexio.c trexio_hdf5.c trexio_text.c
|
||||
HEADER_FILES= $(trexio_h) trexio_text.h trexio_hdf5.h trexio_s.h
|
||||
|
||||
|
||||
.PHONY: all fortran clean maintainer-clean install sources FORCE
|
||||
.POSIX:
|
||||
.SUFFIXES:
|
||||
|
||||
|
||||
all: $(libtrexio) fortran
|
||||
|
||||
|
||||
$(libtrexio): $(OBJECT_FILES) $(HEADER_FILES)
|
||||
$(CC) -shared $(OBJECT_FILES) -o $(libtrexio)
|
||||
|
||||
|
||||
fortran: trexio_f.o
|
||||
|
||||
|
||||
trexio_f.o: $(libtrexio) $(trexio_f)
|
||||
$(FC) $(FCFLAGS) -c $(trexio_f) -o trexio_f.o
|
||||
|
||||
|
||||
cppcheck: cppcheck.out
|
||||
cat cppcheck.out
|
||||
|
||||
|
||||
cppcheck.out: $(HEADER_FILES) $(SOURCE_FILES)
|
||||
cppcheck --addon=cert -q --error-exitcode=0 \
|
||||
--enable=warning,performance,portability,missingInclude,information \
|
||||
--language=c --std=c99 -rp --platform=unix64 \
|
||||
$(CPPFLAGS) $(SOURCE_FILES) 2>$@
|
||||
|
||||
|
||||
# $(DESTDIR) is needed for future support of package managers
|
||||
# install should avoid build target due to possible conflict when prefix overriden
|
||||
install:
|
||||
$(INSTALL) -d $(DESTDIR)$(libdir)
|
||||
$(INSTALL) -d $(DESTDIR)$(includedir)
|
||||
$(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
|
||||
cp $(libtrexio) $(DESTDIR)$(libdir)
|
||||
cp $(trexio_h) $(DESTDIR)$(includedir)
|
||||
cp $(trexio_f) $(DESTDIR)$(includedir)
|
||||
cp ../trexio.pc $(DESTDIR)$(pkgconfigdir)
|
||||
|
||||
|
||||
uninstall:
|
||||
-$(RM) -- $(DESTDIR)$(libdir)/$(libtrexio_so)
|
||||
-$(RM) -- $(DESTDIR)$(includedir)/$(trexio_h_file)
|
||||
-$(RM) -- $(DESTDIR)$(includedir)/$(trexio_f_file)
|
||||
-$(RM) -- $(DESTDIR)$(pkgconfigdir)/trexio.pc
|
||||
|
||||
|
||||
clean:
|
||||
$(RM) -- *.o $(libtrexio) trexio.mod
|
||||
|
||||
|
||||
maintainer-clean:
|
||||
$(RM) -- *.c *.h *.o $(libtrexio) $(trexio_f) trexio.mod
|
||||
|
||||
|
||||
%.o: %.c $(HEADER_FILES)
|
||||
$(CC) -I$(srcdir)/../include $(CPPFLAGS) $(CFLAGS) -c $*.c -o $*.o
|
||||
|
||||
|
||||
Makefile: Makefile.in ../config.status
|
||||
cd .. && ./config.status src/$@
|
||||
|
||||
|
||||
../config.status: ../configure
|
||||
cd .. && ./config.status --recheck
|
||||
|
||||
sources: FORCE
|
||||
cd ../tools && ./build_trexio.sh
|
||||
|
||||
FORCE:
|
@ -133,14 +133,14 @@ typedef int32_t trexio_exit_code;
|
||||
| ~TREXIO_ALLOCATION_FAILED~ | 10 | 'Allocation failed' |
|
||||
| ~TREXIO_HAS_NOT~ | 11 | 'Element absent' |
|
||||
| ~TREXIO_INVALID_NUM~ | 12 | 'Invalid dimensions' |
|
||||
| ~TREXIO_NUM_ALREADY_EXISTS~ | 13 | 'Variable already exists' |
|
||||
| ~TREXIO_OPEN_ERROR~ | 14 | 'Error opening file' |
|
||||
| ~TREXIO_LOCK_ERROR~ | 15 | 'Error locking file' |
|
||||
| ~TREXIO_UNLOCK_ERROR~ | 16 | 'Error unlocking file' |
|
||||
| ~TREXIO_FILE_ERROR~ | 17 | 'Invalid file handle' |
|
||||
| ~TREXIO_GROUP_READ_ERROR~ | 18 | 'Error reading group' |
|
||||
| ~TREXIO_GROUP_WRITE_ERROR~ | 19 | 'Error writing group' |
|
||||
| ~TREXIO_ELEM_READ_ERROR~ | 20 | 'Error reading element' |
|
||||
| ~TREXIO_NUM_ALREADY_EXISTS~ | 13 | 'Dimensioning variable already exists' |
|
||||
| ~TREXIO_DSET_ALREADY_EXISTS~ | 14 | 'Dataset already exists' |
|
||||
| ~TREXIO_OPEN_ERROR~ | 15 | 'Error opening file' |
|
||||
| ~TREXIO_LOCK_ERROR~ | 16 | 'Error locking file' |
|
||||
| ~TREXIO_UNLOCK_ERROR~ | 17 | 'Error unlocking file' |
|
||||
| ~TREXIO_FILE_ERROR~ | 18 | 'Invalid file handle' |
|
||||
| ~TREXIO_GROUP_READ_ERROR~ | 19 | 'Error reading group' |
|
||||
| ~TREXIO_GROUP_WRITE_ERROR~ | 20 | 'Error writing group' |
|
||||
| ~TREXIO_ELEM_WRITE_ERROR~ | 21 | 'Error writing element' |
|
||||
| ~TREXIO_INVALID_STR_LEN~ | 30 | 'Invalid max_str_len' |
|
||||
|
||||
@ -189,14 +189,15 @@ return '\n'.join(result)
|
||||
#define TREXIO_HAS_NOT ((trexio_exit_code) 11)
|
||||
#define TREXIO_INVALID_NUM ((trexio_exit_code) 12)
|
||||
#define TREXIO_NUM_ALREADY_EXISTS ((trexio_exit_code) 13)
|
||||
#define TREXIO_OPEN_ERROR ((trexio_exit_code) 14)
|
||||
#define TREXIO_LOCK_ERROR ((trexio_exit_code) 15)
|
||||
#define TREXIO_UNLOCK_ERROR ((trexio_exit_code) 16)
|
||||
#define TREXIO_FILE_ERROR ((trexio_exit_code) 17)
|
||||
#define TREXIO_GROUP_READ_ERROR ((trexio_exit_code) 18)
|
||||
#define TREXIO_GROUP_WRITE_ERROR ((trexio_exit_code) 19)
|
||||
#define TREXIO_ELEM_READ_ERROR ((trexio_exit_code) 20)
|
||||
#define TREXIO_ELEM_WRITE_ERROR ((trexio_exit_code) 21)
|
||||
#define TREXIO_DSET_ALREADY_EXISTS ((trexio_exit_code) 14)
|
||||
#define TREXIO_OPEN_ERROR ((trexio_exit_code) 15)
|
||||
#define TREXIO_LOCK_ERROR ((trexio_exit_code) 16)
|
||||
#define TREXIO_UNLOCK_ERROR ((trexio_exit_code) 17)
|
||||
#define TREXIO_FILE_ERROR ((trexio_exit_code) 18)
|
||||
#define TREXIO_GROUP_READ_ERROR ((trexio_exit_code) 19)
|
||||
#define TREXIO_GROUP_WRITE_ERROR ((trexio_exit_code) 20)
|
||||
#define TREXIO_ELEM_READ_ERROR ((trexio_exit_code) 21)
|
||||
#define TREXIO_ELEM_WRITE_ERROR ((trexio_exit_code) 22)
|
||||
#define TREXIO_INVALID_STR_LEN ((trexio_exit_code) 30)
|
||||
#+end_src
|
||||
|
||||
@ -216,14 +217,15 @@ return '\n'.join(result)
|
||||
integer(trexio_exit_code), parameter :: TREXIO_HAS_NOT = 11
|
||||
integer(trexio_exit_code), parameter :: TREXIO_INVALID_NUM = 12
|
||||
integer(trexio_exit_code), parameter :: TREXIO_NUM_ALREADY_EXISTS = 13
|
||||
integer(trexio_exit_code), parameter :: TREXIO_OPEN_ERROR = 14
|
||||
integer(trexio_exit_code), parameter :: TREXIO_LOCK_ERROR = 15
|
||||
integer(trexio_exit_code), parameter :: TREXIO_UNLOCK_ERROR = 16
|
||||
integer(trexio_exit_code), parameter :: TREXIO_FILE_ERROR = 17
|
||||
integer(trexio_exit_code), parameter :: TREXIO_GROUP_READ_ERROR = 18
|
||||
integer(trexio_exit_code), parameter :: TREXIO_GROUP_WRITE_ERROR = 19
|
||||
integer(trexio_exit_code), parameter :: TREXIO_ELEM_READ_ERROR = 20
|
||||
integer(trexio_exit_code), parameter :: TREXIO_ELEM_WRITE_ERROR = 21
|
||||
integer(trexio_exit_code), parameter :: TREXIO_DSET_ALREADY_EXISTS = 14
|
||||
integer(trexio_exit_code), parameter :: TREXIO_OPEN_ERROR = 15
|
||||
integer(trexio_exit_code), parameter :: TREXIO_LOCK_ERROR = 16
|
||||
integer(trexio_exit_code), parameter :: TREXIO_UNLOCK_ERROR = 17
|
||||
integer(trexio_exit_code), parameter :: TREXIO_FILE_ERROR = 18
|
||||
integer(trexio_exit_code), parameter :: TREXIO_GROUP_READ_ERROR = 19
|
||||
integer(trexio_exit_code), parameter :: TREXIO_GROUP_WRITE_ERROR = 20
|
||||
integer(trexio_exit_code), parameter :: TREXIO_ELEM_READ_ERROR = 21
|
||||
integer(trexio_exit_code), parameter :: TREXIO_ELEM_WRITE_ERROR = 22
|
||||
integer(trexio_exit_code), parameter :: TREXIO_INVALID_STR_LEN = 30
|
||||
#+end_src
|
||||
:end:
|
||||
@ -455,7 +457,6 @@ struct trexio_back_end_s {
|
||||
2) ~mode~ - character containing open mode (see below)
|
||||
- ~'w'~ - (write) creates a new file as READWRITE (overwrite existing file)
|
||||
- ~'r'~ - (read) opens existing file as READONLY
|
||||
- ~'a'~ - (append) either opens file in READWRITE mode if it already exists or creates a new one
|
||||
3) ~back_end~ - integer number (or the corresponding global parameter) specifying the back end
|
||||
- ~TREXIO_HDF5~ - for HDF5 back end (integer alternative: 0)
|
||||
- ~TREXIO_TEXT~ - for TEXT back end (integer alternative: 1)
|
||||
@ -486,7 +487,7 @@ trexio_open(const char* file_name, const char mode,
|
||||
if (back_end < 0) return NULL;
|
||||
if (back_end >= TREXIO_INVALID_BACK_END) return NULL;
|
||||
|
||||
if (mode != 'r' && mode != 'w' && mode != 'a') return NULL;
|
||||
if (mode != 'r' && mode != 'w') return NULL;
|
||||
|
||||
trexio_t* result = NULL;
|
||||
void* result_tmp = NULL;
|
||||
@ -691,8 +692,7 @@ end interface
|
||||
* Templates for front end
|
||||
** Description
|
||||
|
||||
Consider the following block of ~trex.json~:
|
||||
|
||||
Consider the following block of =trex.json=:
|
||||
|
||||
#+begin_src python
|
||||
{
|
||||
@ -700,14 +700,14 @@ end interface
|
||||
"num" : [ "int" , [ ] ]
|
||||
, "charge" : [ "float", [ "nucleus.num" ] ]
|
||||
, "coord" : [ "float", [ "nucleus.num", "3" ] ]
|
||||
, "label" : [ "char" , [ "nucleus.num", "32" ] ]
|
||||
, "label" : [ "str" , [ "nucleus.num" ] ]
|
||||
}
|
||||
}
|
||||
#+end_src
|
||||
|
||||
~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.
|
||||
|
||||
@ -743,14 +743,14 @@ end interface
|
||||
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
|
||||
@ -830,6 +830,7 @@ trexio_write_$group_num$_64 (trexio_t* const file, const int64_t num)
|
||||
{
|
||||
if (file == NULL) return TREXIO_INVALID_ARG_1;
|
||||
if (num < 0 ) return TREXIO_INVALID_ARG_2;
|
||||
if (trexio_has_$group_num$(file) == TREXIO_SUCCESS) return TREXIO_NUM_ALREADY_EXISTS;
|
||||
|
||||
switch (file->back_end) {
|
||||
|
||||
@ -890,6 +891,7 @@ trexio_write_$group_num$_32 (trexio_t* const file, const int32_t num)
|
||||
|
||||
if (file == NULL) return TREXIO_INVALID_ARG_1;
|
||||
if (num < 0 ) return TREXIO_INVALID_ARG_2;
|
||||
if (trexio_has_$group_num$(file) == TREXIO_SUCCESS) return TREXIO_NUM_ALREADY_EXISTS;
|
||||
|
||||
switch (file->back_end) {
|
||||
|
||||
@ -1110,6 +1112,7 @@ trexio_write_$group_dset$_64 (trexio_t* const file, const $group_dset_dtype_doub
|
||||
|
||||
if (file == NULL) return TREXIO_INVALID_ARG_1;
|
||||
if ($group_dset$ == NULL) return TREXIO_INVALID_ARG_2;
|
||||
if (trexio_has_$group_dset$(file) == TREXIO_SUCCESS) return TREXIO_DSET_ALREADY_EXISTS;
|
||||
|
||||
trexio_exit_code rc;
|
||||
int64_t $group_dset_dim$ = 0;
|
||||
@ -1211,6 +1214,7 @@ trexio_write_$group_dset$_32 (trexio_t* const file, const $group_dset_dtype_sing
|
||||
|
||||
if (file == NULL) return TREXIO_INVALID_ARG_1;
|
||||
if ($group_dset$ == NULL) return TREXIO_INVALID_ARG_2;
|
||||
if (trexio_has_$group_dset$(file) == TREXIO_SUCCESS) return TREXIO_DSET_ALREADY_EXISTS;
|
||||
|
||||
trexio_exit_code rc;
|
||||
int64_t $group_dset_dim$ = 0;
|
||||
@ -1381,6 +1385,121 @@ 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 for the ~eri~ :
|
||||
|
||||
#+begin_src python
|
||||
"ao_2e_int" : {
|
||||
"eri_num" : [ "int", [ ] ]
|
||||
"eri" : [ "float sparse", [ "ao.num", "ao.num", "ao.num", "ao.num" ] ]
|
||||
}
|
||||
#+end_src
|
||||
|
||||
The electron repulsion integral $\langle ij | kl \rangle$ is
|
||||
represented as a quartet of integers $(i,j,k,l)$ and a floating
|
||||
point value.
|
||||
|
||||
To store $N$ integrals in the file, we store
|
||||
|
||||
- An array of quartets of integers
|
||||
- An array of values (floats)
|
||||
|
||||
Both arrays have the same size, $N$, the number of non-zero integrals.
|
||||
Knowing the maximum dimensions allows to check that the integers are
|
||||
in a valid range, and also lets the library choose the smallest
|
||||
integer representation to compress the storage.
|
||||
|
||||
Fortran uses 1-based array indexing, while C uses 0-based indexing.
|
||||
Internally, we use a 0-based representation but the Fortran binding
|
||||
does the appropriate conversion when reading or writing.
|
||||
|
||||
As the number of integrals to store can be prohibitively large, we
|
||||
provide the possibility to read/write the integrals in chunks. So the
|
||||
functions take two extra parameters:
|
||||
- ~offset~ : the index of the 1st integral we want to read. An
|
||||
offset of zero implies to read the first integral.
|
||||
- ~num~ : the number of integrals to read.
|
||||
|
||||
We provide a function to read a chunk of indices, and a function to
|
||||
read a chunk of values, because some users might want to read only
|
||||
the values of the integrals, or only the indices.
|
||||
|
||||
Here is an example for the indices:
|
||||
|
||||
#+BEGIN_SRC c
|
||||
trexio_exit_code
|
||||
trexio_read_chunk_ao_2e_int_eri_index_32(trexio_t* const file,
|
||||
const int64_t offset,
|
||||
const int64_t num,
|
||||
int32_t* buffer)
|
||||
{
|
||||
if (file == NULL) return TREXIO_INVALID_ARG_1;
|
||||
if (offset < 0L) return TREXIO_INVALID_ARG_2;
|
||||
if (num < 0L) return TREXIO_INVALID_ARG_3;
|
||||
|
||||
const uint32_t rank = 4; // To be set by generator : number of indices
|
||||
|
||||
int64_t nmax; // Max number of integrals
|
||||
trexio_exit_code rc;
|
||||
|
||||
rc = trexio_read_ao_2e_int_eri_num(const file, &nmax);
|
||||
if (rc != TREXIO_SUCCESS) return rc;
|
||||
|
||||
switch (file->back_end) {
|
||||
|
||||
case TREXIO_TEXT:
|
||||
return trexio_text_read_chunk_ao_2e_int_eri_index(file, buffer, offset, num, rank, nmax);
|
||||
break;
|
||||
|
||||
case TREXIO_HDF5:
|
||||
return trexio_hdf5_read_chunk_ao_2e_int_eri_index(file, buffer, offset, num, rank, nmax);
|
||||
break;
|
||||
|
||||
default:
|
||||
return TREXIO_FAILURE; /* Impossible case */
|
||||
}
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
For the values,
|
||||
|
||||
#+BEGIN_SRC c
|
||||
trexio_exit_code
|
||||
trexio_read_chunk_ao_2e_int_eri_value_64(trexio_t* const file,
|
||||
const int64_t offset,
|
||||
const int64_t num,
|
||||
double* buffer)
|
||||
{
|
||||
if (file == NULL) return TREXIO_INVALID_ARG_1;
|
||||
if (offset < 0L) return TREXIO_INVALID_ARG_2;
|
||||
if (num < 0L) return TREXIO_INVALID_ARG_3;
|
||||
|
||||
int64_t nmax; // Max number of integrals
|
||||
trexio_exit_code rc;
|
||||
|
||||
rc = trexio_read_ao_2e_int_eri_num(const file, &nmax);
|
||||
if (rc != TREXIO_SUCCESS) return rc;
|
||||
|
||||
switch (file->back_end) {
|
||||
|
||||
case TREXIO_TEXT:
|
||||
return trexio_text_read_chunk_ao_2e_int_eri_value(file, buffer, offset, num, nmax);
|
||||
break;
|
||||
|
||||
case TREXIO_HDF5:
|
||||
return trexio_hdf5_read_chunk_ao_2e_int_eri_index(file, buffer, offset, num, nmax);
|
||||
break;
|
||||
|
||||
default:
|
||||
return TREXIO_FAILURE; /* Impossible case */
|
||||
}
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
|
||||
** Templates for front end has/read/write a dataset of strings
|
||||
*** Introduction
|
||||
This section concerns API calls related to datasets of strings.
|
||||
@ -1396,35 +1515,20 @@ end interface
|
||||
First parameter is the ~TREXIO~ file handle. Second parameter is the variable to be written/read
|
||||
to/from the ~TREXIO~ file (except for ~trexio_has_~ functions).
|
||||
|
||||
|
||||
#+begin_src c :tangle hrw_dset_str_front.h :exports none
|
||||
trexio_exit_code trexio_has_$group_dset$(trexio_t* const file);
|
||||
trexio_exit_code trexio_read_$group_dset$(trexio_t* const file, char* const dset, const uint32_t max_str_len);
|
||||
trexio_exit_code trexio_write_$group_dset$(trexio_t* const file, const char* dset, const uint32_t max_str_len);
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle read_dset_str_front.c
|
||||
|
||||
trexio_exit_code
|
||||
trexio_read_$group_dset$ (trexio_t* const file, char* const dset, const uint32_t max_str_len)
|
||||
{
|
||||
|
||||
if (file == NULL) return TREXIO_INVALID_ARG_1;
|
||||
if (dset == NULL) return TREXIO_INVALID_ARG_2;
|
||||
if (max_str_len <= 0) return TREXIO_INVALID_ARG_3;
|
||||
|
||||
trexio_exit_code rc;
|
||||
int64_t $group_dset_dim$ = 0;
|
||||
|
||||
/* Error handling for this call is added by the generator */
|
||||
rc = trexio_read_$group_dset_dim$_64(file, &($group_dset_dim$));
|
||||
|
||||
if ($group_dset_dim$ == 0L) return TREXIO_INVALID_NUM;
|
||||
|
||||
uint32_t rank = $group_dset_rank$;
|
||||
uint64_t dims[$group_dset_rank$] = {$group_dset_dim_list$};
|
||||
|
||||
assert(file->back_end < TREXIO_INVALID_BACK_END);
|
||||
|
||||
rc = TREXIO_FAILURE;
|
||||
switch (file->back_end) {
|
||||
|
||||
@ -1439,36 +1543,24 @@ trexio_read_$group_dset$ (trexio_t* const file, char* const dset, const uint32_t
|
||||
case TREXIO_JSON:
|
||||
rc = trexio_json_read_$group_dset$(file, dset, rank, dims);
|
||||
break;
|
||||
,*/
|
||||
|
||||
default:
|
||||
return TREXIO_FAILURE; /* Impossible case */
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
}
|
||||
#+end_src
|
||||
#+END_SRC
|
||||
|
||||
|
||||
#+begin_src c :tangle write_dset_str_front.c
|
||||
trexio_exit_code
|
||||
trexio_write_$group_dset$ (trexio_t* const file, const char* dset, const uint32_t max_str_len)
|
||||
{
|
||||
|
||||
if (file == NULL) return TREXIO_INVALID_ARG_1;
|
||||
if (dset == NULL) return TREXIO_INVALID_ARG_2;
|
||||
if (max_str_len <= 0) return TREXIO_INVALID_ARG_3;
|
||||
|
||||
trexio_exit_code rc;
|
||||
int64_t $group_dset_dim$ = 0;
|
||||
|
||||
/* Error handling for this call is added by the generator */
|
||||
rc = trexio_read_$group_dset_dim$_64(file, &($group_dset_dim$));
|
||||
|
||||
if ($group_dset_dim$ == 0L) return TREXIO_INVALID_NUM;
|
||||
|
||||
uint32_t rank = $group_dset_rank$;
|
||||
uint64_t dims[$group_dset_rank$] = {$group_dset_dim_list$};
|
||||
|
||||
assert(file->back_end < TREXIO_INVALID_BACK_END);
|
||||
|
||||
char* tmp_str = CALLOC(dims[0]*(max_str_len+1), char);
|
||||
if (tmp_str == NULL) return TREXIO_ALLOCATION_FAILED;
|
||||
char** dset_str = CALLOC(dims[0], char*);
|
||||
@ -1553,7 +1645,6 @@ trexio_has_$group_dset$ (trexio_t* const file)
|
||||
break;
|
||||
,*/
|
||||
}
|
||||
return TREXIO_FAILURE;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
@ -98,13 +98,9 @@ trexio_hdf5_init (trexio_t* const file)
|
||||
// reading the existing file -> open as RDONLY
|
||||
f->file_id = H5Fopen(file->file_name, H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
break;
|
||||
case 'a':
|
||||
// appending the existing file -> open as RDWR
|
||||
f->file_id = H5Fopen(file->file_name, H5F_ACC_RDWR, H5P_DEFAULT);
|
||||
break;
|
||||
case 'w':
|
||||
// writing the existing file -> overwrite it (_TRUNC) [_EXCL | H5F_ACC_DEBUG as an alternative]
|
||||
f->file_id = H5Fcreate(file->file_name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
// writing the existing file -> open as RDWRITE
|
||||
f->file_id = H5Fopen(file->file_name, H5F_ACC_RDWR, H5P_DEFAULT);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -112,8 +108,7 @@ trexio_hdf5_init (trexio_t* const file)
|
||||
|
||||
switch (file->mode) {
|
||||
case 'r':
|
||||
case 'a':
|
||||
// reading or appending non-existing file -> error
|
||||
// reading non-existing file -> error
|
||||
return TREXIO_FAILURE;
|
||||
case 'w':
|
||||
// writing non-existing file -> create it
|
||||
@ -125,13 +120,15 @@ trexio_hdf5_init (trexio_t* const file)
|
||||
|
||||
/* Create or open groups in the hdf5 file assuming that they exist if file exists */
|
||||
switch (file->mode) {
|
||||
// the switch for 'r'/'a' is reached only if file exists
|
||||
case 'r':
|
||||
case 'a':
|
||||
f->$group$_group = H5Gopen(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT);
|
||||
break;
|
||||
case 'w':
|
||||
if (f_exists == 1) {
|
||||
f->$group$_group = H5Gopen(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT);
|
||||
} else {
|
||||
f->$group$_group = H5Gcreate(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (f->$group$_group <= 0L) return TREXIO_INVALID_ID;
|
||||
|
@ -1,62 +0,0 @@
|
||||
# @configure_input@
|
||||
|
||||
# Package-specific substitution variables
|
||||
package = @PACKAGE_NAME@
|
||||
version = @PACKAGE_VERSION@
|
||||
tarname = @PACKAGE_TARNAME@
|
||||
distdir = $(tarname)-$(version)
|
||||
|
||||
# Prefix-specific substitution variables
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
# Tool-specific substitution variables
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
FC = @FC@
|
||||
FCFLAGS = @FCFLAGS@
|
||||
LIBS = @LIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
|
||||
.PHONY: clean maintainer-clean check
|
||||
.POSIX:
|
||||
|
||||
|
||||
check: test_c test_f
|
||||
$(RM) -r -- trexio_test
|
||||
$(RM) -r -- trexio_test_fort
|
||||
./test_c
|
||||
./test_f
|
||||
|
||||
|
||||
test_c: test.c
|
||||
$(CC) $(CPPFLAGS) -I$(srcdir)/../include $(CFLAGS) -Wl,-rpath,$(srcdir)/../lib -L$(srcdir)/../lib test.c $(LDFLAGS) -ltrexio $(LIBS) -o test_c
|
||||
|
||||
|
||||
test_f: trexio_f.f90 test.f90
|
||||
$(FC) $(CPPFLAGS) $(FCFLAGS) -Wl,-rpath,$(srcdir)/../lib -L$(srcdir)/../lib trexio_f.f90 test.f90 $(LDFLAGS) -ltrexio $(LIBS) -o test_f
|
||||
|
||||
|
||||
trexio_f.f90:
|
||||
cp $(srcdir)/../include/trexio_f.f90 .
|
||||
|
||||
|
||||
clean:
|
||||
$(RM) -- trexio.mod test_f test_c *.h5
|
||||
$(RM) -r -- trexio_test/ trexio_test_fort/
|
||||
|
||||
|
||||
maintainer-clean: clean
|
||||
$(RM) -- trexio_f.o
|
||||
|
||||
|
||||
Makefile: Makefile.in ../config.status
|
||||
cd .. && ./config.status tests/$@
|
||||
|
||||
|
||||
../config.status: ../configure
|
||||
cd .. && ./config.status --recheck
|
||||
|
195
tests/test.c
195
tests/test.c
@ -4,30 +4,31 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int test_read();
|
||||
int test_write();
|
||||
int test_h5read();
|
||||
int test_h5write();
|
||||
int test_write(const char* file_name, const back_end_t backend);
|
||||
int test_read(const char* file_name, const back_end_t backend);
|
||||
|
||||
int main() {
|
||||
|
||||
/*============== Main test launcher ================*/
|
||||
|
||||
test_h5write();
|
||||
test_h5read();
|
||||
int rc;
|
||||
rc = system("rm -rf test_write.h5");
|
||||
assert (rc == 0);
|
||||
test_write("test_write.h5", TREXIO_HDF5);
|
||||
test_read ("test_write.h5", TREXIO_HDF5);
|
||||
|
||||
test_write();
|
||||
test_read();
|
||||
rc = system("rm -rf test_write.dir");
|
||||
assert (rc == 0);
|
||||
test_write("test_write.dir", TREXIO_TEXT);
|
||||
test_read ("test_write.dir", TREXIO_TEXT);
|
||||
|
||||
printf("Test error message: %s\n", trexio_string_of_error(TREXIO_INVALID_ARG_2));
|
||||
return 0 ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_h5write() {
|
||||
int test_write(const char* file_name, const back_end_t backend) {
|
||||
|
||||
/*======== Test write using HDF5 backend ===========*/
|
||||
/*======== Test write ===========*/
|
||||
|
||||
const char* file_name = "test_write.h5";
|
||||
trexio_t* file = NULL;
|
||||
trexio_exit_code rc;
|
||||
|
||||
@ -74,7 +75,7 @@ int test_h5write() {
|
||||
/*================= START OF TEST ==================*/
|
||||
|
||||
// open file in 'write' mode
|
||||
file = trexio_open(file_name, 'w', TREXIO_HDF5);
|
||||
file = trexio_open(file_name, 'w', backend);
|
||||
assert (file != NULL);
|
||||
|
||||
// check that certain data does not exist in the file
|
||||
@ -88,44 +89,41 @@ int test_h5write() {
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
rc = trexio_write_nucleus_coord(file,coord);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
rc = trexio_write_nucleus_charge(file,charge);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
//rc = trexio_write_nucleus_label(file,label);
|
||||
rc = trexio_write_nucleus_label(file,labelxxx, 4);
|
||||
if (backend == TREXIO_HDF5) rc = trexio_write_nucleus_label(file,labelxxx, 4);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
rc = trexio_write_nucleus_symmetry(file, sym);
|
||||
if (backend == TREXIO_HDF5) rc = trexio_write_nucleus_symmetry(file, sym);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
// check if the written data exists in the file
|
||||
rc = trexio_has_nucleus_num(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
rc = trexio_has_nucleus_coord(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
rc = trexio_has_nucleus_label(file);
|
||||
if (backend == TREXIO_HDF5) rc = trexio_has_nucleus_label(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
rc = trexio_has_nucleus_symmetry(file);
|
||||
if (backend == TREXIO_HDF5) rc = trexio_has_nucleus_symmetry(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
// should not work: try to overwrite the nucleus_num
|
||||
// should not work: try to overwrite the num variable
|
||||
rc = trexio_write_nucleus_num(file,25);
|
||||
printf("Test error message: %s\n", trexio_string_of_error(rc));
|
||||
assert (rc == TREXIO_NUM_ALREADY_EXISTS);
|
||||
|
||||
// should not work: try to overwrite the dset
|
||||
coord[0] = 666.666;
|
||||
rc = trexio_write_nucleus_coord(file,coord);
|
||||
assert (rc == TREXIO_DSET_ALREADY_EXISTS);
|
||||
|
||||
// close current session
|
||||
rc = trexio_close(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
// open file again in 'append' mode
|
||||
file = trexio_open(file_name, 'a', TREXIO_HDF5);
|
||||
// open file again in 'write' mode
|
||||
file = trexio_open(file_name, 'w', backend);
|
||||
assert (file != NULL);
|
||||
|
||||
// read the nucleus_num from existing file
|
||||
rc = trexio_read_nucleus_num(file,&num);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
assert (num == 12);
|
||||
|
||||
// overwrite the nucleus_coord
|
||||
coord[0] = 666.666;
|
||||
rc = trexio_write_nucleus_coord(file,coord);
|
||||
// write some missing blocks (e.g. if forgot last time)
|
||||
rc = trexio_write_nucleus_charge(file,charge);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
// close current session
|
||||
@ -137,11 +135,10 @@ int test_h5write() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_h5read() {
|
||||
int test_read(const char* file_name, const back_end_t backend) {
|
||||
|
||||
/*========= Test read using HDF5 backend ===========*/
|
||||
/*========= Test read ===========*/
|
||||
|
||||
const char* file_name = "test_write.h5";
|
||||
trexio_t* file = NULL;
|
||||
trexio_exit_code rc;
|
||||
|
||||
@ -153,8 +150,8 @@ int test_h5read() {
|
||||
|
||||
/*================= START OF TEST ==================*/
|
||||
|
||||
// open existing file on 'read' mode [created by test_h5write()]
|
||||
file = trexio_open(file_name, 'r', TREXIO_HDF5);
|
||||
// open existing file on 'read' mode [created by test_write]
|
||||
file = trexio_open(file_name, 'r', backend);
|
||||
assert (file != NULL);
|
||||
|
||||
// read nucleus_num
|
||||
@ -170,6 +167,7 @@ int test_h5read() {
|
||||
double x = coord[30] - 2.14171677;
|
||||
assert( x*x < 1.e-14);
|
||||
|
||||
if (backend == TREXIO_HDF5) {
|
||||
// read nucleus_label
|
||||
size_t max_str_len = 16;
|
||||
label = (char**) malloc(num*sizeof(char*));
|
||||
@ -199,27 +197,6 @@ int test_h5read() {
|
||||
assert( strcmp(symmetry, "B3U") == 0 );
|
||||
free(symmetry);
|
||||
|
||||
// close current session
|
||||
rc = trexio_close(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
// read non-existing file, should fail and return NULL
|
||||
const char* file_name2 = "test_nonexisting.h5";
|
||||
trexio_t* file2 = NULL;
|
||||
|
||||
file2 = trexio_open(file_name2, 'r', TREXIO_HDF5);
|
||||
assert (file2 == NULL);
|
||||
|
||||
// append non-existing file, should fail and return NULL
|
||||
trexio_t* file3 = NULL;
|
||||
|
||||
file3 = trexio_open(file_name2, 'a', TREXIO_HDF5);
|
||||
assert (file3 == NULL);
|
||||
|
||||
/*================= END OF TEST =====================*/
|
||||
|
||||
free(coord);
|
||||
|
||||
for (int i=0; i<num; i++){
|
||||
free(label[i]);
|
||||
}
|
||||
@ -227,108 +204,24 @@ int test_h5read() {
|
||||
|
||||
free(labelxxx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int test_write() {
|
||||
|
||||
/*========= Test write using TEXT backend ===========*/
|
||||
|
||||
const char* file_name = "trexio_test";
|
||||
trexio_t* file = NULL;
|
||||
trexio_exit_code rc;
|
||||
|
||||
// parameters to be written
|
||||
int num = 12;
|
||||
float charge[12] = {6., 6., 6., 6., 6., 6., 1., 1., 1., 1., 1., 1.};
|
||||
double coord[36] = {
|
||||
0.00000000 , 1.39250319 , 0.00000000 ,
|
||||
-1.20594314 , 0.69625160 , 0.00000000 ,
|
||||
-1.20594314 , -0.69625160 , 0.00000000 ,
|
||||
0.00000000 , -1.39250319 , 0.00000000 ,
|
||||
1.20594314 , -0.69625160 , 0.00000000 ,
|
||||
1.20594314 , 0.69625160 , 0.00000000 ,
|
||||
-2.14171677 , 1.23652075 , 0.00000000 ,
|
||||
-2.14171677 , -1.23652075 , 0.00000000 ,
|
||||
0.00000000 , -2.47304151 , 0.00000000 ,
|
||||
2.14171677 , -1.23652075 , 0.00000000 ,
|
||||
2.14171677 , 1.23652075 , 0.00000000 ,
|
||||
0.00000000 , 2.47304151 , 0.00000000 ,
|
||||
};
|
||||
|
||||
/*================= START OF TEST ==================*/
|
||||
|
||||
file = trexio_open(file_name, 'w', TREXIO_TEXT);
|
||||
assert (file != NULL);
|
||||
|
||||
rc = trexio_has_nucleus_num(file);
|
||||
assert (rc == TREXIO_HAS_NOT);
|
||||
rc = trexio_has_nucleus_coord(file);
|
||||
assert (rc == TREXIO_HAS_NOT);
|
||||
|
||||
rc = trexio_write_nucleus_num(file,num);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
rc = trexio_write_nucleus_charge_32(file,charge);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
rc = trexio_write_nucleus_coord(file,coord);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
rc = trexio_has_nucleus_num(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
rc = trexio_has_nucleus_coord(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
}
|
||||
|
||||
// close current session
|
||||
rc = trexio_close(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
/*================= END OF TEST =====================*/
|
||||
// read non-existing file, should fail and return NULL
|
||||
const char* file_name2 = "test_nonexisting";
|
||||
trexio_t* file2 = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_read() {
|
||||
|
||||
/*========= Test read using TEXT backend ===========*/
|
||||
|
||||
const char* file_name = "trexio_test";
|
||||
trexio_t* file = NULL;
|
||||
trexio_exit_code rc;
|
||||
|
||||
int num;
|
||||
float* charge;
|
||||
double* coord;
|
||||
|
||||
/*================= START OF TEST ==================*/
|
||||
|
||||
file = trexio_open(file_name, 'r', TREXIO_TEXT);
|
||||
assert (file != NULL);
|
||||
|
||||
rc = trexio_read_nucleus_num(file,&num);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
assert (num == 12);
|
||||
|
||||
charge = (float*) calloc(num, sizeof(float));
|
||||
rc = trexio_read_nucleus_charge_32(file,charge);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
assert(charge[10] == 1.);
|
||||
|
||||
coord = (double*) calloc(3*num, sizeof(double));
|
||||
rc = trexio_read_nucleus_coord(file,coord);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
|
||||
double x = coord[30] - 2.14171677;
|
||||
assert(x*x < 1.e-14);
|
||||
|
||||
rc = trexio_close(file);
|
||||
assert (rc == TREXIO_SUCCESS);
|
||||
file2 = trexio_open(file_name2, 'r', backend);
|
||||
assert (file2 == NULL);
|
||||
|
||||
/*================= END OF TEST =====================*/
|
||||
|
||||
free(charge);
|
||||
free(coord);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
, "prim_num" : [ "int" , [] ]
|
||||
, "exponent" : [ "float", [ "basis.prim_num" ] ]
|
||||
, "coefficient" : [ "float", [ "basis.prim_num" ] ]
|
||||
, "prim_factor" : [ "float", [ "basis.prim_num" ] ]
|
||||
} ,
|
||||
|
||||
"ao": {
|
||||
|
2
trex.org
2
trex.org
@ -1,4 +1,5 @@
|
||||
#+TITLE: TREX Configuration file
|
||||
#+STARTUP: latexpreview
|
||||
|
||||
All the quantities are saved in atomic units.
|
||||
The dimensions of the arrays in the tables below are given in
|
||||
@ -10,7 +11,6 @@ written in C.
|
||||
{
|
||||
#+end_src
|
||||
|
||||
|
||||
* Metadata
|
||||
|
||||
As we expect our files to be archived in open-data repositories, we
|
||||
|
Loading…
Reference in New Issue
Block a user