From 293b9a07de0d7f6ae399e5a4d087ecb23362f3ea Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 9 Feb 2026 13:31:04 +0100 Subject: [PATCH 001/132] creating tsunami directory with amusifier --- src/amuse_tsunami/Makefile | 131 ++ src/amuse_tsunami/__init__.py | 1 + src/amuse_tsunami/interface.cc | 9 + src/amuse_tsunami/interface.py | 134 ++ .../packages/amuse-tsunami-PACKAGE.amuse_deps | 1 + .../amuse-tsunami-PACKAGE/pyproject.toml | 40 + .../packages/amuse-tsunami-PACKAGE/tsunami | 1 + .../packages/amuse-tsunami.amuse_deps | 1 + .../packages/amuse-tsunami/pyproject.toml | 47 + .../packages/amuse-tsunami/tsunami | 1 + src/amuse_tsunami/src/Makefile | 24 + src/amuse_tsunami/src/tsunami.cc | 7 + src/amuse_tsunami/support/config.mk.in | 90 + src/amuse_tsunami/support/configure.ac | 89 + src/amuse_tsunami/support/shared/config.guess | 1812 +++++++++++++++ src/amuse_tsunami/support/shared/config.sub | 1971 +++++++++++++++++ src/amuse_tsunami/support/shared/install-sh | 541 +++++ .../support/shared/m4/amuse_conda.m4 | 36 + .../support/shared/m4/amuse_cuda.m4 | 232 ++ .../support/shared/m4/amuse_detect_os.m4 | 19 + .../support/shared/m4/amuse_download.m4 | 38 + .../support/shared/m4/amuse_lib.m4 | 138 ++ .../support/shared/m4/amuse_lib_healpix.m4 | 48 + .../support/shared/m4/amuse_lib_qhull.m4 | 30 + .../support/shared/m4/amuse_opencl.m4 | 63 + .../support/shared/m4/amuse_venv.m4 | 31 + .../support/shared/m4/ax_blas.m4 | 241 ++ .../support/shared/m4/ax_check_classpath.m4 | 61 + .../support/shared/m4/ax_check_gnu_make.m4 | 96 + .../support/shared/m4/ax_count_cpus.m4 | 101 + .../support/shared/m4/ax_lapack.m4 | 134 ++ .../support/shared/m4/ax_lib_hdf5.m4 | 323 +++ .../support/shared/m4/ax_lib_netcdf4.m4 | 277 +++ src/amuse_tsunami/support/shared/m4/ax_mpi.m4 | 235 ++ .../support/shared/m4/ax_openmp.m4 | 123 + .../support/shared/m4/ax_prog_jar.m4 | 50 + .../support/shared/m4/ax_prog_java.m4 | 116 + .../support/shared/m4/ax_prog_java_works.m4 | 92 + .../support/shared/m4/ax_prog_javac.m4 | 80 + .../support/shared/m4/ax_prog_javac_works.m4 | 73 + src/amuse_tsunami/support/shared/m4/fftw.m4 | 122 + .../support/shared/m4/fortran.m4 | 43 + src/amuse_tsunami/support/shared/m4/gmp.m4 | 103 + src/amuse_tsunami/support/shared/m4/gsl.m4 | 122 + src/amuse_tsunami/support/shared/m4/mpfr.m4 | 109 + src/amuse_tsunami/support/shared/m4/pkg.m4 | 343 +++ src/amuse_tsunami/support/shared/uninstall.sh | 51 + src/amuse_tsunami/tests/test_tsunami.py | 12 + 48 files changed, 8442 insertions(+) create mode 100644 src/amuse_tsunami/Makefile create mode 100644 src/amuse_tsunami/__init__.py create mode 100644 src/amuse_tsunami/interface.cc create mode 100644 src/amuse_tsunami/interface.py create mode 100644 src/amuse_tsunami/packages/amuse-tsunami-PACKAGE.amuse_deps create mode 100644 src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/pyproject.toml create mode 120000 src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/tsunami create mode 100644 src/amuse_tsunami/packages/amuse-tsunami.amuse_deps create mode 100644 src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml create mode 120000 src/amuse_tsunami/packages/amuse-tsunami/tsunami create mode 100644 src/amuse_tsunami/src/Makefile create mode 100644 src/amuse_tsunami/src/tsunami.cc create mode 100644 src/amuse_tsunami/support/config.mk.in create mode 100644 src/amuse_tsunami/support/configure.ac create mode 100755 src/amuse_tsunami/support/shared/config.guess create mode 100755 src/amuse_tsunami/support/shared/config.sub create mode 100755 src/amuse_tsunami/support/shared/install-sh create mode 100644 src/amuse_tsunami/support/shared/m4/amuse_conda.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/amuse_cuda.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/amuse_detect_os.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/amuse_download.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/amuse_lib.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/amuse_lib_healpix.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/amuse_lib_qhull.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/amuse_opencl.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/amuse_venv.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_blas.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_check_classpath.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_check_gnu_make.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_count_cpus.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_lapack.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_lib_hdf5.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_lib_netcdf4.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_mpi.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_openmp.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_prog_jar.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_prog_java.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_prog_java_works.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_prog_javac.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/ax_prog_javac_works.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/fftw.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/fortran.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/gmp.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/gsl.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/mpfr.m4 create mode 100644 src/amuse_tsunami/support/shared/m4/pkg.m4 create mode 100755 src/amuse_tsunami/support/shared/uninstall.sh create mode 100644 src/amuse_tsunami/tests/test_tsunami.py diff --git a/src/amuse_tsunami/Makefile b/src/amuse_tsunami/Makefile new file mode 100644 index 0000000000..4ef8d97a3a --- /dev/null +++ b/src/amuse_tsunami/Makefile @@ -0,0 +1,131 @@ +ifneq (,$(filter-out clean distclean, $(MAKECMDGOALS))) +include support/config.mk +endif + + +# Detecting dependencies +support/config.mk: + cd support && ./configure + + +# Downloading the code +##### Remove if not needed ##### +VERSION = VERSION + +tsunami.tar.gz: + ##### Modify URL as needed ##### + $(DOWNLOAD) https://github.com/tsunami/tsunami/archive/$(VERSION).tar.gz >$@ + +PATCHES := $(shell cat patches/series) + +src/tsunami-$(VERSION): tsunami.tar.gz + ##### Modify as needed ##### + tar xf $< + mv tsunami-$(VERSION) src + ##### Apply patches here, if needed ##### + patch + # ) + pass + + def define_particle_sets(self, handler): + """Define any particle sets inside the model.""" + # handler.define_set('particles', 'index_of_the_particle') + # handler.set_new('particles', 'new_particle') + # handler.set_delete('particles', 'delete_particle') + # handler.add_setter('particles', 'set_state') + # handler.add_getter('particles', 'get_state') + # handler.add_setter('particles', 'set_mass') + # handler.add_getter('particles', 'get_mass', names=('mass',)) + pass + + def define_grids(self, handler): + """Define any grids inside the model.""" + # handler.define_grid('grid',axes_names = ["x", "y"], grid_class=StructuredGrid) + # handler.set_grid_range('grid', '_grid_range') + # handler.add_getter('grid', 'get_grid_position', names=["x", "y"]) + # handler.add_getter('grid', 'get_rho', names=["density"]) + # handler.add_setter('grid', 'set_rho', names=["density"]) + pass + + # def define_converter(self, handler): + # """Handle unit conversion if an (optional) unit converter is specified.""" + # if self.unit_converter is not None: + # handler.set_converter( + # self.unit_converter.as_converter_from_si_to_generic() + # ) diff --git a/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE.amuse_deps b/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE.amuse_deps new file mode 100644 index 0000000000..e5ab274ccd --- /dev/null +++ b/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE.amuse_deps @@ -0,0 +1 @@ +c c++ fortran java python cmake install download mpi openmp cuda opencl x11 opengl blas lapack gsl gmp mpfr fftw hdf5 netcdf4 diff --git a/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/pyproject.toml b/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/pyproject.toml new file mode 100644 index 0000000000..c278b6a492 --- /dev/null +++ b/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/pyproject.toml @@ -0,0 +1,40 @@ +[project] +name = "amuse-tsunami-PACKAGE" +dynamic = ["version"] +requires-python = ">=3.7" +dependencies = [ + "amuse-framework==2025.9.1.dev23+g38aae9f45.d20251209", + "amuse-tsunami" +] + +[build-system] +requires = ["hatchling", "versioningit"] +build-backend = "hatchling.build" + +[tool.hatch.version] +source = "versioningit" + +[tool.versioningit.next-version] +method = "smallest" + +[tool.versioningit.format] +distance = "{next_version}.dev{distance}+{vcs}{rev}" +dirty = "{base_version}+d{build_date:%Y%m%d}" +distance-dirty = "{next_version}.dev{distance}+{vcs}{rev}.d{build_date:%Y%m%d}" + +[tool.versioningit.vcs] +method = { module = "version_helper", value = "get_amuse_version", module-dir = "amuse_tsunami/support/shared" } + +[tool.hatch.build] +skip-excluded-dirs = true + +[tool.hatch.build.targets.wheel] +include = ["amuse_tsunami"] +exclude = ["amuse_tsunami/*"] +artifacts = ["amuse_tsunami/tsunami_PACKAGE_worker"] + +[tool.pytest.ini_options] +pythonpath = ["amuse_tsunami/tests/", "../../../../../tests"] + +testpaths = ["amuse_tsunami/tests"] + diff --git a/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/tsunami b/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/tsunami new file mode 120000 index 0000000000..c25bddb6dd --- /dev/null +++ b/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/tsunami @@ -0,0 +1 @@ +../.. \ No newline at end of file diff --git a/src/amuse_tsunami/packages/amuse-tsunami.amuse_deps b/src/amuse_tsunami/packages/amuse-tsunami.amuse_deps new file mode 100644 index 0000000000..e5ab274ccd --- /dev/null +++ b/src/amuse_tsunami/packages/amuse-tsunami.amuse_deps @@ -0,0 +1 @@ +c c++ fortran java python cmake install download mpi openmp cuda opencl x11 opengl blas lapack gsl gmp mpfr fftw hdf5 netcdf4 diff --git a/src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml b/src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml new file mode 100644 index 0000000000..77349f188d --- /dev/null +++ b/src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml @@ -0,0 +1,47 @@ +[project] +name = "amuse-tsunami" +version = "0.0.1" +# use the line below instead of the version above if this code is inside the AMUSE +# repository +# dynamic = ["version"] +requires-python = ">=3.7" +dependencies = [ + "amuse-framework==2025.9.1.dev23+g38aae9f45.d20251209" +] + +[build-system] +requires = ["hatchling", "versioningit"] +build-backend = "hatchling.build" + +[tool.hatch.version] +source = "versioningit" + +[tool.versioningit.next-version] +method = "smallest" + +[tool.versioningit.format] +distance = "{next_version}.dev{distance}+{vcs}{rev}" +dirty = "{base_version}+d{build_date:%Y%m%d}" +distance-dirty = "{next_version}.dev{distance}+{vcs}{rev}.d{build_date:%Y%m%d}" + +[tool.versioningit.vcs] +method = { module = "version_helper", value = "get_amuse_version", module-dir = "amuse_tsunami/support/shared" } + +[tool.hatch.build] +skip-excluded-dirs = true + +[tool.hatch.build.targets.wheel] +include = ["amuse_tsunami/**/*.py"] +exclude = [ + "amuse_tsunami/packages", + "amuse_tsunami/support", + "amuse_tsunami/src", + "amuse_tsunami/tests" + ] +artifacts = ["amuse_tsunami/tsunami_worker"] + +[tool.pytest.ini_options] +pythonpath = ["amuse_tsunami/tests/"] + +testpaths = ["amuse_tsunami/tests"] + diff --git a/src/amuse_tsunami/packages/amuse-tsunami/tsunami b/src/amuse_tsunami/packages/amuse-tsunami/tsunami new file mode 120000 index 0000000000..c25bddb6dd --- /dev/null +++ b/src/amuse_tsunami/packages/amuse-tsunami/tsunami @@ -0,0 +1 @@ +../.. \ No newline at end of file diff --git a/src/amuse_tsunami/src/Makefile b/src/amuse_tsunami/src/Makefile new file mode 100644 index 0000000000..48c090e22c --- /dev/null +++ b/src/amuse_tsunami/src/Makefile @@ -0,0 +1,24 @@ +CFLAGS += -Wall -g +CXXFLAGS += $(CFLAGS) + +CODELIB = libtsunami.a + +CODEOBJS = tsunami.o + + +all: $(CODELIB) + + +clean: + rm -f *.o *.a + +distclean: clean + +$(CODELIB): $(CODEOBJS) + rm -f $@ + $(AR) -ruv $@ $(CODEOBJS) + $(RANLIB) $@ + +.cc.o: $< + $(CXX) $(CXXFLAGS) -c -o $@ $< + diff --git a/src/amuse_tsunami/src/tsunami.cc b/src/amuse_tsunami/src/tsunami.cc new file mode 100644 index 0000000000..0deb6d1f90 --- /dev/null +++ b/src/amuse_tsunami/src/tsunami.cc @@ -0,0 +1,7 @@ +/* + * Example function for a code + */ +int echo(int input) { + return input; +} + diff --git a/src/amuse_tsunami/support/config.mk.in b/src/amuse_tsunami/support/config.mk.in new file mode 100644 index 0000000000..435d9ce0d4 --- /dev/null +++ b/src/amuse_tsunami/support/config.mk.in @@ -0,0 +1,90 @@ +# Compilers +##### Remove CC if the code is not in C, uncomment if it is +# CC = @CC@ +CXX = @CXX@ + +##### Remove MPICC if the code is not in C, uncomment if it is +# MPICC = @MPICC@ +MPICXX = @MPICXX@ + +CPU_COUNT = @CPU_COUNT@ + +# Tools +AR = @AR@ +RANLIB = @RANLIB@ +##### Uncomment what you need to download and unpack the code, remove the rest +# DOWNLOAD = @DOWNLOAD@ +# TAR = @TAR@ +# UNZIP = @UNZIP@ +# GUNZIP = @GUNZIP@ +# BUNZIP2 = @BUNZIP2@ +# UNXZ = @UNXZ@ +# PERL = @PERL@ + + +# AMUSE framework libraries +##### Uncomment what you need, remove the rest +# STOPCOND_CFLAGS = @STOPCOND_CFLAGS@ +# STOPCOND_LIBS = @STOPCOND_LIBS@ + +# STOPCONDMPI_CFLAGS = @STOPCONDMPI_CFLAGS@ +# STOPCONDMPI_LIBS = @STOPCONDMPI_LIBS@ + +# AMUSE_MPI_CFLAGS = @AMUSE_MPI_CFLAGS@ +# AMUSE_MPI_LIBS = @AMUSE_MPI_LIBS@ + +# SIMPLE_HASH_CFLAGS = @SIMPLE_HASH_CFLAGS@ +# SIMPLE_HASH_LIBS = @SIMPLE_HASH_LIBS@ + +# G6LIB_CFLAGS = @G6LIB_CFLAGS@ +# G6LIB_LIBS = @G6LIB_LIBS@ + + +# External dependencies +##### Uncomment what you need, remove the rest +# OPENMP_CFLAGS = @OPENMP_CFLAGS@ +# OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ + +# CUDA_TK = @CUDA_TK@ +# NVCC = @NVCC@ +# CUDA_FLAGS = @CUDA_FLAGS@ +# CUDA_LDFLAGS = @CUDA_LDFLAGS@ + +# FOUND_CL = @FOUND_CL@ +# CL_CFLAGS = @CL_CFLAGS@ +# CL_LIBS = @CL_LIBS@ +# HAVE_CL_CL_H = @HAVE_CL_CL_H@ +# HAVE_OPENCL_CL_H = @HAVE_OPENCL_CL_H@ + +# BLAS_LIBS = @BLAS_LIBS@ +# LAPACK_LIBS = @LAPACK_LIBS@ + +# GSL_FLAGS = @GSL_FLAGS@ +# GSL_LIBS = @GSL_LIBS@ + +# FOUND_GMP= @FOUND_GMP@ +# GMP_FLAGS = @GMP_FLAGS@ +# GMP_LIBS = @GMP_LIBS@ + +# FOUND_MPFR = @FOUND_MPFR@ +# MPFR_FLAGS = @MPFR_FLAGS@ +# MPFR_LIBS = @MPFR_LIBS@ + +# FOUND_FFTW = @FOUND_FFTW@ +# FFTW_FLAGS = @FFTW_FLAGS@ +# FFTW_LIBS = @FFTW_LIBS@ + +# HDF5_VERSION = @HDF5_VERSION@ +# HDF5_CFLAGS = @HDF5_CFLAGS@ +# HDF5_CPPFLAGS = @HDF5_CPPFLAGS@ +# HDF5_LDFLAGS = @HDF5_LDFLAGS@ +# HDF5_LIBS = @HDF5_LIBS@ + +# NETCDF4_VERSION = @NETCDF4_VERSION@ +# NETCDF4_CFLAGS = @NETCDF4_CFLAGS@ +# NETCDF4_LDFLAGS = @NETCDF4_LDFLAGS@ +# NETCDF4_LIBS = @NETCDF4_LIBS@ + +# SAPPORO_LIGHT_CFLAGS = @SAPPORO_LIGHT_CFLAGS@ +# SAPPORO_LIGHT_LIBS = @SAPPORO_LIGHT_LIBS@ + diff --git a/src/amuse_tsunami/support/configure.ac b/src/amuse_tsunami/support/configure.ac new file mode 100644 index 0000000000..74bfbdce5e --- /dev/null +++ b/src/amuse_tsunami/support/configure.ac @@ -0,0 +1,89 @@ +AC_CONFIG_AUX_DIR([shared]) +AC_CONFIG_MACRO_DIRS([shared/m4]) + +AC_INIT([amuse-tsunami], [1.0]) + +# Pick up Conda env or virtualenv +AMUSE_VENV() + +# Set CPU_COUNT +AX_COUNT_CPUS() +AC_SUBST(CPU_COUNT) + +# Find the compiler(s) +##### Remove this if the code is C++-only +# AC_PROG_CC() + +##### This is always needed, also for codes written in C +AC_PROG_CXX() + + +# Find tools for creating static libraries +AC_CHECK_TARGET_TOOL([AR], [ar], [:]) +AS_IF([test $AR = ":"], [AC_MSG_ERROR([ar command not found.])]) + +AC_PROG_RANLIB() +AS_IF([test $RANLIB = ":"], [AC_MSG_ERROR([ranlib command not found.])]) + + +# Find tools to download and unpack with +# AMUSE_DOWNLOAD() +# AC_CHECK_TOOL(TAR, tar) +# AC_CHECK_TOOL(UNZIP, unzip) +# AC_CHECK_TOOL(GUNZIP, gunzip) +# AC_CHECK_TOOL(BUNZIP2, bunzip2) +# AC_CHECK_TOOL(UNXZ, unxz) +# AC_CHECK_TOOL(PERL, perl) + + +# Find AMUSE libraries +# AMUSE_LIB_STOPCOND() +# AMUSE_LIB_STOPCONDMPI() +# AMUSE_LIB_AMUSE_MPI() +# AMUSE_LIB_SIMPLE_HASH() +# AMUSE_LIB_G6LIB() +# AMUSE_LIB_SAPPORO_LIGHT() + + +# Find MPI for the worker +AC_LANG_PUSH([C++]) +AX_MPI() +AC_LANG_POP([C++]) + + +# Find external dependencies +##### Pick one of these depending on which language the code is in ##### +# AC_LANG_PUSH([C]) +# AC_LANG_PUSH([C++]) + +##### Remove anything not needed by the code, and uncomment what is needed ##### + +# AX_MPI() + +# AC_OPENMP() +##### Pick one of these depending on which language the code is in ##### +# AC_SUBST(OPENMP_CFLAGS) +# AC_SUBST(OPENMP_CXXFLAGS) + +# AMUSE_CUDA() +# AMUSE_OPENCL() + +# AX_LAPACK() # calls AX_BLAS automatically +# AX_PATH_GSL(1.0, [FOUND_GSL=yes]) +# AX_GMP() +# AX_MPFR() +# AX_FFTW() +# AX_LIB_HDF5() +# AX_LIB_NETCDF4() + +##### End remove anything not needed by the code ##### + +##### Pick one of these depending on which language the code is in ##### +# AC_LANG_POP([C++]) +# AC_LANG_POP([C]) + + +# Generate output +AC_CONFIG_FILES([config.mk]) +AC_OUTPUT + diff --git a/src/amuse_tsunami/support/shared/config.guess b/src/amuse_tsunami/support/shared/config.guess new file mode 100755 index 0000000000..f6d217a49f --- /dev/null +++ b/src/amuse_tsunami/support/shared/config.guess @@ -0,0 +1,1812 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2024 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2024-01-01' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to . + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system '$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2024 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try '$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +# Just in case it came from the environment. +GUESS= + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still +# use 'HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if test -f /.attbin/uname ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case $UNAME_SYSTEM in +Linux|GNU|GNU/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #if defined(__ANDROID__) + LIBC=android + #else + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #elif defined(__LLVM_LIBC__) + LIBC=llvm + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + #endif + EOF + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case $UNAME_VERSION in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + GUESS=$machine-${os}${release}${abi-} + ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; + *:ekkoBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; + *:SolidBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; + macppc:MirBSD:*:*) + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; + *:MirBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; + alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case $ALPHA_CPU_TYPE in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; + Amiga*:UNIX_System_V:4.0:*) + GUESS=m68k-unknown-sysv4 + ;; + *:[Aa]miga[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; + *:[Mm]orph[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-morphos + ;; + *:OS/390:*:*) + GUESS=i370-ibm-openedition + ;; + *:z/VM:*:*) + GUESS=s390-ibm-zvmoe + ;; + *:OS400:*:*) + GUESS=powerpc-ibm-os400 + ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + GUESS=arm-unknown-riscos + ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + GUESS=hppa1.1-hitachi-hiuxmpp + ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; + NILE*:*:*:dcosx) + GUESS=pyramid-pyramid-svr4 + ;; + DRS?6000:unix:4.0:6*) + GUESS=sparc-icl-nx6 + ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; + s390x:SunOS:*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; + sun4H:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; + sun4*:SunOS:*:*) + case `/usr/bin/arch -k` in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like '4.1.3-JL'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; + sun3*:SunOS:*:*) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case `/bin/arch` in + sun3) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun4) + GUESS=sparc-sun-sunos$UNAME_RELEASE + ;; + esac + ;; + aushp:SunOS:*:*) + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; + m68k:machten:*:*) + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; + powerpc:machten:*:*) + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; + RISC*:Mach:*:*) + GUESS=mips-dec-mach_bsd4.3 + ;; + RISC*:ULTRIX:*:*) + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; + VAX*:ULTRIX*:*:*) + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; + Motorola:PowerMAX_OS:*:*) + GUESS=powerpc-motorola-powermax + ;; + Motorola:*:4.3:PL8-*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:Power_UNIX:*:*) + GUESS=powerpc-harris-powerunix + ;; + m88k:CX/UX:7*:*) + GUESS=m88k-harris-cxux7 + ;; + m88k:*:4*:R4*) + GUESS=m88k-motorola-sysv4 + ;; + m88k:*:3*:R3*) + GUESS=m88k-motorola-sysv3 + ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x + then + GUESS=m88k-dg-dgux$UNAME_RELEASE + else + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE + fi + else + GUESS=i586-dg-dgux$UNAME_RELEASE + fi + ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + GUESS=m88k-dolphin-sysv3 + ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + GUESS=m88k-motorola-sysv3 + ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + GUESS=m88k-tektronix-sysv3 + ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + GUESS=m68k-tektronix-bsd + ;; + *:IRIX*:*:*) + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + GUESS=i386-ibm-aix + ;; + ia64:AIX:*:*) + if test -x /usr/bin/oslevel ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + GUESS=$SYSTEM_NAME + else + GUESS=rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + GUESS=rs6000-ibm-aix3.2.4 + else + GUESS=rs6000-ibm-aix3.2 + fi + ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; + *:AIX:*:*) + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + GUESS=rs6000-bull-bosx + ;; + DPX/2?00:B.O.S.:*:*) + GUESS=m68k-bull-sysv3 + ;; + 9000/[34]??:4.3bsd:1.*:*) + GUESS=m68k-hp-bsd + ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + GUESS=m68k-hp-bsd4.4 + ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if test -x /usr/bin/getconf; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case $sc_cpu_version in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case $sc_kernel_bits in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if test "$HP_ARCH" = hppa2.0w + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; + 3050*:HI-UX:*:*) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; + 9000/8??:4.3bsd:*:*) + GUESS=hppa1.0-hp-bsd + ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; + hp8??:OSF1:*:*) + GUESS=hppa1.0-hp-osf + ;; + i*86:OSF1:*:*) + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk + else + GUESS=$UNAME_MACHINE-unknown-osf1 + fi + ;; + parisc*:Lites*:*:*) + GUESS=hppa1.1-hp-lites + ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + GUESS=c1-convex-bsd + ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + GUESS=c34-convex-bsd + ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + GUESS=c38-convex-bsd + ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + GUESS=c4-convex-bsd + ;; + CRAY*Y-MP:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; + CRAY*[A-Z]90:*:*:*) + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; + CRAY*T3E:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; + CRAY*SV1:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; + *:UNICOS/mp:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; + sparc*:BSD/OS:*:*) + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; + *:BSD/OS:*:*) + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; + i*:CYGWIN*:*) + GUESS=$UNAME_MACHINE-pc-cygwin + ;; + *:MINGW64*:*) + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; + *:MINGW*:*) + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; + i*:PW*:*) + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; + *:Interix*:*) + case $UNAME_MACHINE in + x86) + GUESS=i586-pc-interix$UNAME_RELEASE + ;; + authenticamd | genuineintel | EM64T) + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; + IA64) + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; + esac ;; + i*:UWIN*:*) + GUESS=$UNAME_MACHINE-pc-uwin + ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + GUESS=x86_64-pc-cygwin + ;; + prep*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; + *:GNU:*:*) + # the GNU system + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; + aarch64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __ARM_EABI__ + #ifdef __ARM_PCS_VFP + ABI=eabihf + #else + ABI=eabi + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; + esac + fi + GUESS=$CPU-unknown-linux-$LIBCABI + ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi + else + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf + fi + fi + ;; + avr32*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + cris:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + crisv32:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + frv:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + hexagon:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:Linux:*:*) + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; + ia64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:cos:*:*) + GUESS=$UNAME_MACHINE-unknown-cos + ;; + kvx:mbr:*:*) + GUESS=$UNAME_MACHINE-unknown-mbr + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m32r*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m68*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + padre:Linux:*:*) + GUESS=sparc-unknown-linux-$LIBC + ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + GUESS=hppa64-unknown-linux-$LIBC + ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; + esac + ;; + ppc64:Linux:*:*) + GUESS=powerpc64-unknown-linux-$LIBC + ;; + ppc:Linux:*:*) + GUESS=powerpc-unknown-linux-$LIBC + ;; + ppc64le:Linux:*:*) + GUESS=powerpc64le-unknown-linux-$LIBC + ;; + ppcle:Linux:*:*) + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + s390:Linux:*:* | s390x:Linux:*:*) + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; + sh64*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sh*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + vax:Linux:*:*) + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; + x86_64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac + fi + GUESS=$CPU-pc-linux-$LIBCABI + ;; + xtensa*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + GUESS=i386-sequent-sysv4 + ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; + i*86:OS/2:*:*) + # If we were able to find 'uname', then EMX Unix compatibility + # is probably installed. + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; + i*86:XTS-300:*:STOP) + GUESS=$UNAME_MACHINE-unknown-stop + ;; + i*86:atheos:*:*) + GUESS=$UNAME_MACHINE-unknown-atheos + ;; + i*86:syllable:*:*) + GUESS=$UNAME_MACHINE-pc-syllable + ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; + i*86:*DOS:*:*) + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL + fi + ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv32 + fi + ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + GUESS=i586-pc-msdosdjgpp + ;; + Intel:Mach:3*:*) + GUESS=i386-pc-mach3 + ;; + paragon:*:*:*) + GUESS=i860-intel-osf1 + ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 + fi + ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + GUESS=m68010-convergent-sysv + ;; + mc68k:UNIX:SYSTEM5:3.51m) + GUESS=m68k-convergent-sysv + ;; + M680?0:D-NIX:5.3:*) + GUESS=m68k-diab-dnix + ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; + mc68030:UNIX_System_V:4.*:*) + GUESS=m68k-atari-sysv4 + ;; + TSUNAMI:LynxOS:2.*:*) + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; + rs6000:LynxOS:2.*:*) + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; + SM[BE]S:UNIX_SV:*:*) + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; + RM*:ReliantUNIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + RM*:SINIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + GUESS=$UNAME_MACHINE-sni-sysv4 + else + GUESS=ns32k-sni-sysv + fi + ;; + PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort + # says + GUESS=i586-unisys-sysv4 + ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + GUESS=hppa1.1-stratus-sysv4 + ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + GUESS=i860-stratus-sysv4 + ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=$UNAME_MACHINE-stratus-vos + ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=hppa1.1-stratus-vos + ;; + mc68*:A/UX:*:*) + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; + news*:NEWS-OS:6*:*) + GUESS=mips-sony-newsos6 + ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE + else + GUESS=mips-unknown-sysv$UNAME_RELEASE + fi + ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + GUESS=powerpc-be-beos + ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + GUESS=powerpc-apple-beos + ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + GUESS=i586-pc-beos + ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; + SX-4:SUPER-UX:*:*) + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; + SX-5:SUPER-UX:*:*) + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; + SX-6:SUPER-UX:*:*) + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; + SX-7:SUPER-UX:*:*) + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; + SX-8:SUPER-UX:*:*) + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; + SX-8R:SUPER-UX:*:*) + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; + Power*:Rhapsody:*:*) + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; + *:Rhapsody:*:*) + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; + *:QNX:*:4*) + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; + NSE-*:NONSTOP_KERNEL:*:*) + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; + *:NonStop-UX:*:*) + GUESS=mips-compaq-nonstopux + ;; + BS2000:POSIX*:*:*) + GUESS=bs2000-siemens-sysv + ;; + DS/*:UNIX_System_V:*:*) + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "${cputype-}" = 386; then + UNAME_MACHINE=i386 + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype + fi + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; + *:TOPS-10:*:*) + GUESS=pdp10-unknown-tops10 + ;; + *:TENEX:*:*) + GUESS=pdp10-unknown-tenex + ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + GUESS=pdp10-dec-tops20 + ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + GUESS=pdp10-xkl-tops20 + ;; + *:TOPS-20:*:*) + GUESS=pdp10-unknown-tops20 + ;; + *:ITS:*:*) + GUESS=pdp10-unknown-its + ;; + SEI:*:*:SEIUX) + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; + *:DragonFly:*:*) + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; + esac ;; + *:XENIX:*:SysV) + GUESS=i386-pc-xenix + ;; + i*86:skyos:*:*) + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; + i*86:rdos:*:*) + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; + x86_64:VMkernel:*:*) + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; + *:Ironclad:*:*) + GUESS=$UNAME_MACHINE-unknown-ironclad + ;; +esac + +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + +echo "$0: unable to guess system type" >&2 + +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 <&2 </dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" +EOF +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/amuse_tsunami/support/shared/config.sub b/src/amuse_tsunami/support/shared/config.sub new file mode 100755 index 0000000000..2c6a07ab3c --- /dev/null +++ b/src/amuse_tsunami/support/shared/config.sub @@ -0,0 +1,1971 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2024 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2024-01-01' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2024 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try '$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ + | windows-* ) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x"$basic_os" != x +then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +obj= +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <&2 + fi + ;; + *) + echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 + exit 1 + ;; +esac + +case $obj in + aout* | coff* | elf* | pe*) + ;; + '') + # empty is fine + ;; + *) + echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 + exit 1 + ;; +esac + +# Here we handle the constraint that a (synthetic) cpu and os are +# valid only in combination with each other and nowhere else. +case $cpu-$os in + # The "javascript-unknown-ghcjs" triple is used by GHC; we + # accept it here in order to tolerate that, but reject any + # variations. + javascript-ghcjs) + ;; + javascript-* | *-ghcjs) + echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os-$obj in + linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ + | linux-mlibc*- | linux-musl*- | linux-newlib*- \ + | linux-relibc*- | linux-uclibc*- ) + ;; + uclinux-uclibc*- ) + ;; + managarm-mlibc*- | managarm-kernel*- ) + ;; + windows*-msvc*-) + ;; + -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ + | -uclibc*- ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 + exit 1 + ;; + -kernel*- ) + echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 + exit 1 + ;; + *-kernel*- ) + echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 + exit 1 + ;; + *-msvc*- ) + echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 + exit 1 + ;; + kfreebsd*-gnu*- | kopensolaris*-gnu*-) + ;; + vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) + ;; + nto-qnx*-) + ;; + os2-emx-) + ;; + *-eabi*- | *-gnueabi*-) + ;; + none--*) + # None (no kernel, i.e. freestanding / bare metal), + # can be paired with an machine code file format + ;; + -*-) + # Blank kernel with real OS is always fine. + ;; + --*) + # Blank kernel and OS with real machine code file format is always fine. + ;; + *-*-*) + echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-aix*) + vendor=ibm + ;; + *-beos*) + vendor=be + ;; + *-hpux*) + vendor=hp + ;; + *-mpeix*) + vendor=hp + ;; + *-hiux*) + vendor=hitachi + ;; + *-unos*) + vendor=crds + ;; + *-dgux*) + vendor=dg + ;; + *-luna*) + vendor=omron + ;; + *-genix*) + vendor=ns + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-vxsim* | *-vxworks* | *-windiss*) + vendor=wrs + ;; + *-aux*) + vendor=apple + ;; + *-hms*) + vendor=hitachi + ;; + *-mpw* | *-macos*) + vendor=apple + ;; + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + vendor=atari + ;; + *-vos*) + vendor=stratus + ;; + esac + ;; +esac + +echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/amuse_tsunami/support/shared/install-sh b/src/amuse_tsunami/support/shared/install-sh new file mode 100755 index 0000000000..ec298b5374 --- /dev/null +++ b/src/amuse_tsunami/support/shared/install-sh @@ -0,0 +1,541 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2020-11-14.01; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. + -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -p) cpprog="$cpprog -p";; + + -s) stripcmd=$stripprog;; + + -S) backupsuffix="$2" + shift;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/src/amuse_tsunami/support/shared/m4/amuse_conda.m4 b/src/amuse_tsunami/support/shared/m4/amuse_conda.m4 new file mode 100644 index 0000000000..f015fa7dab --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/amuse_conda.m4 @@ -0,0 +1,36 @@ +# AMUSE_CONDA_LIST() +# +# Runs conda list and saves the result in amuse_conda_list. +# The conda list command is rather slow, so we can avoid an annoying wait by running +# it once and saving the output for use with AMUSE_CONDA_PACKAGE below. +# +# Note that we can't save newlines in a shell variable, so we're replacing them with +# circumflexes instead. We change them back below before grepping. +AC_DEFUN([AMUSE_CONDA_LIST],[ + amuse_conda_list="$(conda list | tr '\n' '^')" +]) + + +# AMUSE_CONDA_PACKAGE(VARIABLE, NAME, VALUE) +# +# Checks that the given package is installed in the active conda environment. +# +# You must run AMUSE_CONDA_LIST() before calling this macro. +# +# Sets $VARIABLE to VALUE if the package was found, or "yes" if VALUE is not passed. +AC_DEFUN([AMUSE_CONDA_PACKAGE],[ + AC_MSG_CHECKING([for conda package $2]) + ax_conda_package_line="$(echo $amuse_conda_list | tr '^' '\n' | grep '^$2 ')" + AS_IF([test "$?" = "0"], [ + # $1="$(AS_ECHO("$ax_conda_package_line") | tr -s ' ' | cut -f 2 -d ' ')" + m4_if([$3],[], [ + $1="yes" + ], [ + $1="$3" + ]) + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + diff --git a/src/amuse_tsunami/support/shared/m4/amuse_cuda.m4 b/src/amuse_tsunami/support/shared/m4/amuse_cuda.m4 new file mode 100644 index 0000000000..1da58a131e --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/amuse_cuda.m4 @@ -0,0 +1,232 @@ +# AMUSE_CUDA_VERIFY_HEADERS(PATH) +# +# Checks that the given path contains a CUDA installation with include/cuda.h. +# +# Sets amuse_cuda_verify_FLAGS to -I/path/to/cuda/include if successful. +AC_DEFUN([AMUSE_CUDA_VERIFY_HEADERS], [ + AS_IF([test "x$1" = x], [ + amuse_cuda_verify_msg="for cuda.h" + amuse_cuda_flags= + ], [ + amuse_cuda_verify_msg="for cuda.h in $1/include" + amuse_cuda_flags="-I$1/include" + ]) + + AC_MSG_CHECKING([$amuse_cuda_verify_msg]) + amuse_cuda_verify_FLAGS= + + ax_save_CFLAGS="$CFLAGS" + + CFLAGS="$amuse_cuda_flags" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ])], [ + amuse_cuda_verify_FLAGS="$CFLAGS" + amuse_cuda_verify_headers_found="yes" + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + + CFLAGS="$ax_save_CFLAGS" +]) + +# AMUSE_CUDA_VERIFY_LIBS(PATH) +# +# Checks that the given path contains a CUDA installation with lib/libcudart.so or +# lib64/libcudart.so. +# +# Sets amuse_cuda_verify_LDFLAGS to -L/path/to/cuda/lib{64} if successful. +AC_DEFUN([AMUSE_CUDA_VERIFY_LIBS], [ + AS_IF([test "x$1" = x], [ + amuse_cuda_verify_msg="for libcudart" + amuse_cuda_ldflags= + ], [ + amuse_cuda_verify_msg="for libcudart in $1/lib" + amuse_cuda_verify_msg64="for libcudart in $1/lib64" + amuse_cuda_ldflags="-L$1/lib" + amuse_cuda_ldflags64="-L$1/lib64" + ]) + + AC_MSG_CHECKING([$amuse_cuda_verify_msg]) + amuse_cuda_verify_LDFLAGS= + + ax_save_LDFLAGS="$LDFLAGS" + ax_save_LIBS="$LIBS" + + LDFLAGS="$amuse_cuda_ldflags" + LIBS="-lcudart" + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [cudaFree(0);])], [ + amuse_cuda_verify_LDFLAGS="$LDFLAGS" + amuse_cuda_verify_libs_found="yes" + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + + AS_IF([test "x$amuse_cuda_verify_libs_found" = x], [ + AC_MSG_CHECKING([$amuse_cuda_verify_msg64]) + LDFLAGS="$amuse_cuda_ldflags64" + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [cudaFree(0);])], [ + amuse_cuda_verify_LDFLAGS="$LDFLAGS" + amuse_cuda_verify_libs_found="yes" + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + ]) + + LIBS="$ax_save_LIBS" + LDFLAGS="$ax_save_LDFLAGS" +]) + +# AMUSE_CUDA_VERIFY_SET_VARS(CUDA_TK) +# +# Sets CUDA_TK, NVCC, CUDA_FLAGS and CUDA_LDFLAGS from the internal values, if all +# of them have been found. +AC_DEFUN([AMUSE_CUDA_VERIFY_SET_VARS], [ + AS_IF( + [test \(x"$amuse_cuda_verify_NVCC" != x\) -a \(x"$amuse_cuda_verify_headers_found" != x\) -a \(x"$amuse_cuda_verify_libs_found" != x\)], + [ + CUDA_TK="$1" + NVCC="$amuse_cuda_verify_NVCC" + CUDA_FLAGS="$amuse_cuda_verify_FLAGS" + CUDA_LDFLAGS="$amuse_cuda_verify_LDFLAGS" + ] + ) +]) + +# AMUSE_CUDA_VERIFY(PATH) +# +# Checks that the given path contains a CUDA installation with bin/nvcc, +# lib/libcudart.so, and include/cuda.h. +# +# Sets CUDA_TK= if successful, and if successful also sets NVCC to the location +# of nvcc, CUDA_LDFLAGS to -L/path/to/cuda/libs, and CUDA_FLAGS to +# -I/path/to/cuda/include. +AC_DEFUN([AMUSE_CUDA_VERIFY], [ + amuse_cuda_verify_headers_found= + amuse_cuda_verify_libs_found= + + AS_IF([test -d $1], [ + AC_PATH_PROG([amuse_cuda_verify_NVCC], [nvcc], [], [$1/bin]) + + AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ + AMUSE_CUDA_VERIFY_HEADERS([$1]) + ]) + + AS_IF([test x"$amuse_cuda_verify_headers_found" != x], [ + AMUSE_CUDA_VERIFY_LIBS([$1]) + ]) + + AMUSE_CUDA_VERIFY_SET_VARS([$1]) + ], [ + AC_MSG_NOTICE([$1 does not exist or is not a directory, CUDA not found there]) + ]) +]) + +# AMUSE_CUDA_VERIFY_DEFAULT() +# +# Checks for NVCC on the PATH, then finds the CUDA directory from there. +# +# Sets CUDA_TK= if successful, and if successful also sets NVCC to the location +# of nvcc, CUDA_LDFLAGS to -L/path/to/cuda/libs, and CUDA_FLAGS to +# -I/path/to/cuda/include. +AC_DEFUN([AMUSE_CUDA_VERIFY_DEFAULT], [ + AC_PATH_PROG([amuse_cuda_verify_NVCC], [nvcc]) + + AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ + # Got nvcc, verify that we have the rest too + amuse_cuda_verify_ctk_rel=$(dirname -- "$amuse_cuda_verify_NVCC")/.. + # Canonicalise path portably so that it looks nicer + amuse_cuda_verify_CUDA_TK=$(test -d "$amuse_cuda_verify_ctk_rel" && CDPATH= cd -P -- "$amuse_cuda_verify_ctk_rel" && pwd -P) + + AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ + AMUSE_CUDA_VERIFY_HEADERS() + ]) + + AS_IF([test x"$amuse_cuda_verify_headers_found" != x], [ + AMUSE_CUDA_VERIFY_LIBS() + ]) + + AMUSE_CUDA_VERIFY_SET_VARS([$amuse_cuda_verify_CUDA_TK]) + ], [ + AC_MSG_NOTICE([Could not find CUDA via PATH]) + ]) +]) + +# AMUSE_CUDA +# ---------------------------------------------------------- +# set up for CUDA +# +# will set: +# +# CUDA_TK +# NVCC +# +# CUDA_LDFLAGS (with -L/path/to/cuda/lib) +# CUDA_FLAGS (with -I/path/to/cuda/include) +# +# and call AC_SUBST on them. +# +AC_DEFUN([AMUSE_CUDA], [ + AC_LANG_PUSH([C]) + AS_IF([test x"$CUDA_TK" != x], [ + # User set CUDA_TK, verify and use it if it works + AMUSE_CUDA_VERIFY($CUDA_TK) + + AS_IF([test x"$NVCC" = x], [ + AC_MSG_ERROR([CUDA_TK is set, but there is no nvcc in $CUDA_TK/bin. Please set CUDA_TK to the CUDA installation directory, or unset it to autodetect.]) + ]) + ], [ + # CUDA_TK not set, try to discover CUDA via PATH + AMUSE_CUDA_VERIFY_DEFAULT() + + # Not in PATH, try default directory + AS_IF([test x"$CUDA_TK" = x], [ + AMUSE_CUDA_VERIFY([/usr/local/cuda]) + ]) + + # Try /usr/local/cuda-#.#, but only if there's exactly one match + AS_IF([test x"$CUDA_TK" = x], [ + # List CUDA installations + amuse_cuda_installs=$(ls -1 -d /usr/local/cuda-*.* 2>/dev/null) + # If there's more than one, the above will have newlines, and change when we do this + amuse_cuda_installs2=$(echo "x${amuse_cuda_installs}" | tr -d '[:space:]') + AS_IF([test "x${amuse_cuda_installs}" != x], [ + AS_IF([test "x${amuse_cuda_installs}" = "${amuse_cuda_installs2}"], [ + # Here, there's exactly one match + AMUSE_CUDA_VERIFY([$amuse_cuda_installs]) + ], [ + AC_MSG_NOTICE([Multiple CUDA installations found in /usr/local, without a /usr/local/cuda symlink. Please set CUDA_TK to specify which one you want to use.]) + ]) + ], [ + AC_MSG_NOTICE([No CUDA installations found in /usr/local]) + ]) + ]) + + # Try some other locations + for dir in /opt/cuda /usr/local/cuda/cuda /opt/cuda/cuda ; do + AS_IF([test x"$CUDA_TK" = x], [ + AMUSE_CUDA_VERIFY([$dir]) + ]) + done + + # These directories were checked by the old macro, but they're highly obsolete + # so we're not trying them anymore: + # /usr/lib/nvidia, /usr/include/nvidia, /usr/lib/nvidia-current, /usr/include/nvidia-current + + AS_IF([test x"$CUDA_TK" = x], [ + AC_MSG_NOTICE([CUDA not found. Set CUDA_TK if you have it in an odd location.]) + ]) + ]) + + AS_IF([test x"$CUDA_TK" != x], [ + AC_MSG_NOTICE([CUDA found at $CUDA_TK]) + AC_SUBST(CUDA_TK) + AC_SUBST(NVCC) + AC_SUBST(CUDA_FLAGS) + AC_SUBST(CUDA_LDFLAGS) + ]) + + AC_LANG_POP([C]) +]) + diff --git a/src/amuse_tsunami/support/shared/m4/amuse_detect_os.m4 b/src/amuse_tsunami/support/shared/m4/amuse_detect_os.m4 new file mode 100644 index 0000000000..ad5375e7b2 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/amuse_detect_os.m4 @@ -0,0 +1,19 @@ +# Macro for detecting the platform we're on +# +# Sets AMUSE_ON_MACOS if we're on macOS, or AMUSE_ON_LINUX if we're on GNU/Linux. +AC_DEFUN([AMUSE_DETECT_OS], [ + AC_CANONICAL_TARGET + if test "x$target_os" == "xlinux-gnu" + then + AMUSE_ON_LINUX=1 + fi + + if test "x$target_vendor" == "xapple" + then + AMUSE_ON_MACOS=1 + fi + + AC_SUBST([AMUSE_ON_LINUX]) + AC_SUBST([AMUSE_ON_MACOS]) +]) + diff --git a/src/amuse_tsunami/support/shared/m4/amuse_download.m4 b/src/amuse_tsunami/support/shared/m4/amuse_download.m4 new file mode 100644 index 0000000000..6cd03aee6f --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/amuse_download.m4 @@ -0,0 +1,38 @@ +# Helper macros for detecting download tools +# +# Some of the community codes aren't included with AMUSE, but are downloaded at build +# time. We need a tool for that, and here is where we find one. +# +# AMUSE_DOWNLOAD() +# +# Searches for a download tool. Two popular and commonly available command line +# download tools are curl and wget. This macro tries to find either one of them +# and sets DOWNLOAD to a command that will take a URL and download its contents to +# standard output. This makes it easier to write that output to a file with a known +# name, which you usually want in a Makefile. +# +# To download a file, use $(DOWNLOAD) https://example.com >example.html +# +AC_DEFUN([AMUSE_DOWNLOAD], [ + AC_CHECK_TOOL(WGET, wget) + AC_CHECK_TOOL(CURL, curl) + + AC_MSG_CHECKING([for a wget or curl to download files with]) + if test "x$WGET" != "x" + then + # The MESA SDK server rejects wget, this is the official work-around + DOWNLOAD="$WGET --progress=bar:force:noscroll --user-agent='' -O -" + AC_MSG_RESULT([yes]) + else + if test "x$CURL" != "x" + then + DOWNLOAD="$CURL -L" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + + AC_SUBST([DOWNLOAD]) +]) + diff --git a/src/amuse_tsunami/support/shared/m4/amuse_lib.m4 b/src/amuse_tsunami/support/shared/m4/amuse_lib.m4 new file mode 100644 index 0000000000..a378d8de44 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/amuse_lib.m4 @@ -0,0 +1,138 @@ +# Helper macros for detecting AMUSE libraries. +# +# See https://stackoverflow.com/questions/10220946/pkg-check-modules-considered-harmful +# for some background on why we're not using PKG_CHECK_MODULES directly. Do note that +# PKG_CHECK_MODULES checks for pkg-config and gives a useful error these days, so that +# that page is partially outdated. + +# AMUSE_LIB(prefix, module, library, function) +# +# Searches for an AMUSE library and sets ${prefix}_CFLAGS, ${prefix}_LIBS to the +# appropriate values if it is found. +# +# prefix: prefix for the variables to be set +# module: name of the pkg-config module to search for if needed +# library: name of the library to be searched for +# function: name of a function in the library to use for the link check +AC_DEFUN([AMUSE_LIB], [ + amuse_save_LIBS="$LIBS" + amuse_save_LIB_CFLAGS="$[$1][_CFLAGS]" + amuse_save_LIB_LIBS="$[$1][_LIBS]" + amuse_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" + + # If we have an active virtualenv, make sure pkg-config searches it + if test "a${VIRTUAL_ENV}" != "a" + then + PKG_CONFIG_PATH="${VIRTUAL_ENV}/lib/pkgconfig:${PKG_CONFIG_PATH}" + fi + + # All AMUSE libs export C symbols + AC_LANG_PUSH([C]) + + # Search for the library, first directly then fall back to pkg-config + AC_SEARCH_LIBS([$4], [$3], [ + FOUND_$1="yes" + $1_LIBS="$LIBS" + $1_CFLAGS="" + ], [ + PKG_CHECK_MODULES([$1], [$2], [ + FOUND_$1="yes" + ], [ + FOUND_$1="no" + ]) + ]) + + AC_LANG_POP([C]) + + PKG_CONFIG_PATH="$amuse_save_PKG_CONFIG_PATH" + LIBS="$amuse_save_LIBS" + + # If we have an active CONDA environment, assume that the lib is coming from + # there and add an additional flag so that .mod files can be found. Only really + # needed for stopcond and forsockets, and hopefully conda-forge will give us a + # better solution soon. + if test "${FOUND_$1}" == "yes" -a "x$CONDA_PREFIX" != "x" + then + $1_CFLAGS="${$1_CFLAGS} -I${CONDA_PREFIX}/include" + fi + + # If the user overrode the variables, go with what they set instead of + # what we just detected. + AS_IF([test "x$amuse_save_LIB_CFLAGS" != "x"], [ + $1_CFLAGS="$amuse_save_LIB_CFLAGS" + ]) + AS_IF([test "x$amuse_save_LIB_LIBS" != "x"], [ + $1_LIBS="$amuse_save_LIB_LIBS" + ]) + + AC_SUBST([FOUND_][$1]) + AC_SUBST([$1][_CFLAGS]) + AC_SUBST([$1][_LIBS]) +]) + + +# AMUSE_LIB_STOPCOND() +# +# Searches for the AMUSE stopping conditions library and sets STOPCOND_CFLAGS +# and STOPCOND_LIBS to the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_STOPCOND], [ + AMUSE_LIB([STOPCOND], [stopcond], [stopcond], [is_condition_enabled]) +]) + + +# AMUSE_LIB_STOPCONDMPI() +# +# Searches for the AMUSE stopping conditions library and sets STOPCONDMPI_CFLAGS +# and STOPCONDMPI_LIBS to the appropriate values if it is found. +# +# We use a different function here, to avoid getting a cached value from +# AMUSE_LIB_STOPCOND if both are used. Seems like it indexes by function name. +AC_DEFUN([AMUSE_LIB_STOPCONDMPI], [ + AMUSE_LIB([STOPCONDMPI], [stopcondmpi], [stopcondmpi], [get_set_conditions_]) +]) + + +# AMUSE_LIB_AMUSE_MPI() +# +# Searches for the AMUSE MPI helper library and sets AMUSE_MPI_CFLAGS and +# AMUSE_MPI_LIBS to the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_AMUSE_MPI], [ + AMUSE_LIB([AMUSE_MPI], [amuse_mpi], [amuse_mpi], [get_comm_world]) +]) + + +# AMUSE_LIB_FORSOCKETS() +# +# Searches for the AMUSE forsockets library and sets FORSOCKETS_CFLAGS and +# FORSOCKETS_LIBS to the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_FORSOCKETS], [ + AMUSE_LIB([FORSOCKETS], [forsockets], [forsockets], [forsockets_close]) +]) + + +# AMUSE_LIB_SIMPLE_HASH() +# +# Searches for the AMUSE simple hash library and sets SIMPLE_HASH_CFLAGS and +# SIMPLE_HASH_LIBS to the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_SIMPLE_HASH], [ + AMUSE_LIB([SIMPLE_HASH], [simple_hash], [simple_hash], [init_hash]) +]) + + +# AMUSE_LIB_G6LIB() +# +# Searches for the g6 library and sets G6LIB_CFLAGS and G6LIB_LIBS to +# the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_G6LIB], [ + AMUSE_LIB([G6LIB], [g6lib], [g6], [g6_npipes]) +]) + + +# AMUSE_LIB_SAPPORO_LIGHT() +# +# Searches for the Sapporo light library and sets SAPPORO_LIGHT_CFLAGS and +# SAPPORO_LIGHT_LIBS to the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_SAPPORO_LIGHT], [ + AMUSE_LIB([SAPPORO_LIGHT], [sapporo_light], [sapporo], [get_device_count]) +]) + diff --git a/src/amuse_tsunami/support/shared/m4/amuse_lib_healpix.m4 b/src/amuse_tsunami/support/shared/m4/amuse_lib_healpix.m4 new file mode 100644 index 0000000000..07b6ef6c5e --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/amuse_lib_healpix.m4 @@ -0,0 +1,48 @@ +# Helper macro for detecting libhealpix_cxx +# +# AMUSE_LIB_HEALPIX_CXX() +# +# Searches for libhealpix_cxx and sets FOUND_HEALPIX_CXX to "yes" if found. +# +# Also sets HEALPIX_CXX_LIBS to any needed link commands, and HEALPIX_CXX_CFLAGS to any +# needed compiler flags. +# +AC_DEFUN([AMUSE_LIB_HEALPIX_CXX], [ + amuse_lib_healpix_cxx_save_libs="$LIBS" + + AC_MSG_CHECKING([for HEALPix]) + + AC_LANG_PUSH([C++]) + + LIBS="-lhealpix_cxx" + + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ + #include + ], [ + Healpix_Base hb; + ]) + ], [ + FOUND_HEALPIX_CXX="yes" + HEALPIX_CXX_CFLAGS="" + HEALPIX_CXX_LIBS="$LIBS" + + AC_MSG_RESULT([yes]) + ], + [ + # Not found, try pkg-config instead + PKG_CHECK_MODULES([HEALPIX_CXX], [healpix_cxx], [ + FOUND_HEALPIX_CXX="yes" + AC_MSG_RESULT([yes]) + ], [ + FOUND_HEALPIX_CXX="no" + AC_MSG_RESULT([no]) + ]) + ]) + + AC_LANG_POP([C++]) + + AC_SUBST([HEALPIX_CXX_CFLAGS]) + AC_SUBST([HEALPIX_CXX_LIBS]) +]) + diff --git a/src/amuse_tsunami/support/shared/m4/amuse_lib_qhull.m4 b/src/amuse_tsunami/support/shared/m4/amuse_lib_qhull.m4 new file mode 100644 index 0000000000..8761694163 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/amuse_lib_qhull.m4 @@ -0,0 +1,30 @@ +# Helper macro for detecting libqhull +# +# AMUSE_LIB_QHULL() +# +# Searches for libqhull and sets FOUND_QHULL to "yes" if found. +# +# Also sets QHULL_LIBS to any needed link commands, and QHULL_FLAGS to any needed +# compiler flags. +# +# Recent versions of libqhull have a reentrant libqhull_r and also a libqhull_p, but we +# test only for libqhull. +# +AC_DEFUN([AMUSE_LIB_QHULL], [ + amuse_lib_qhull_save_libs="$LIBS" + + LIBS="" + AC_SEARCH_LIBS([qh_freeqhull], [qhull_r], [ + FOUND_QHULL="yes" + ], []) + QHULL_LIBS="$LIBS" + QHULL_FLAGS="" + + LIBS="$amuse_lib_qhull_save_libs" + + AC_CHECK_HEADERS([libqhull_r/libqhull_r.h], [], [FOUND_QHULL="no"]) + + AC_SUBST([QHULL_LIBS]) + AC_SUBST([QHULL_FLAGS]) +]) + diff --git a/src/amuse_tsunami/support/shared/m4/amuse_opencl.m4 b/src/amuse_tsunami/support/shared/m4/amuse_opencl.m4 new file mode 100644 index 0000000000..28b1efcd8e --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/amuse_opencl.m4 @@ -0,0 +1,63 @@ +# Helper macro for detecting OpenCL for C. + +# AMUSE_OPENCL() +# +# Sets FOUND_OPENCL to "yes" if OpenCL is found, to "no" if it is not. +# Sets OPENCL_CFLAGS and OPENCL_LIBS as needed. +# Calls AC_SUBST on all of the above. +# +AC_DEFUN([AMUSE_OPENCL], [ + amuse_save_CFLAGS="$CFLAGS" + amuse_save_LIBS="$LIBS" + + AC_MSG_CHECKING([for OpenCL]) + + # If the user overrode the variables, then we'll use what they set and verify that + # it works. + AS_IF([test "x$OPENCL_CFLAGS" != "x"], [ + amuse_user_OPENCL_CFLAGS="$OPENCL_CFLAGS" + CFLAGS="$OPENCL_CFLAGS $CFLAGS" + ]) + AS_IF([test "x$OPENCL_LIBS" != "x"], [ + amuse_user_OPENCL_LIBS="$OPENCL_LIBS" + LIBS="$OPENCL_LIBS $LIBS" + ]) + + # We only use OpenCL from C, in huayno + AC_LANG_PUSH([C]) + + # Search for the headers + m4_define([amuse_opencl_test_program], [AC_LANG_PROGRAM([ + #if defined(__APPLE__) || defined(__MACOSX) + #include + #else + #include + #endif + ], [clFinish(0)])]) + + AC_COMPILE_IFELSE([amuse_opencl_test_program], [ + # Search for the library as well + LIBS="-lOpenCL $LIBS" + AC_LINK_IFELSE([amuse_opencl_test_program], [ + FOUND_OPENCL="yes" + OPENCL_LIBS="-lOpenCL" + OPENCL_CFLAGS="" + ], [ + FOUND_OPENCL="no" + ]) + ], [ + FOUND_OPENCL="no" + ]) + + AC_LANG_POP([C]) + + LIBS="$amuse_save_LIBS" + CFLAGS="$amuse_save_CFLAGS" + + AC_MSG_RESULT([$FOUND_OPENCL]) + + AC_SUBST([FOUND_OPENCL]) + AC_SUBST([OPENCL_CFLAGS]) + AC_SUBST([OPENCL_LIBS]) +]) + diff --git a/src/amuse_tsunami/support/shared/m4/amuse_venv.m4 b/src/amuse_tsunami/support/shared/m4/amuse_venv.m4 new file mode 100644 index 0000000000..155d88d9d6 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/amuse_venv.m4 @@ -0,0 +1,31 @@ +# Helper macro for installing into Conda envs and virtualenvs. + +# AMUSE_VENV() +# +# Detect the active Conda env or virtualenv and extend LDFLAGS and +# PKG_CONFIG_PATH to point to it. This then makes it possible to detect the AMUSE +# libraries as installed in the environment and link to them. +# +AC_DEFUN([AMUSE_VENV], [ + AS_IF([test "x$VIRTUAL_ENV" != x], [ + CFLAGS="$CFLAGS -I${VIRTUAL_ENV}/include" + CXXFLAGS="$CXXFLAGS -I${VIRTUAL_ENV}/include" + FFLAGS="$FFLAGS -I${VIRTUAL_ENV}/include" + FCFLAGS="$FCFLAGS -I${VIRTUAL_ENV}/include" + LDFLAGS="$LDFLAGS -L${VIRTUAL_ENV}/lib -Wl,-rpath,${VIRTUAL_ENV}/lib" + PKG_CONFIG_PATH="$VIRTUAL_ENV/lib/pkgconfig:$PKG_CONFIG_PATH" + ]) + + AS_IF([test "x$CONDA_PREFIX" != x], [ + # Conda does not set FCFLAGS, so we copy from FFLAGS here + FCFLAGS="$FFLAGS" + LDFLAGS="$LDFLAGS -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib" + # Conda pkg-config includes this already, but in case we have one from + # the system... + PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${CONDA_PREFIX}/lib/pkgconfig" + ]) + # Needs to be exported or the PKG_CHECK_MODULES macro won't see it + export PKG_CONFIG_PATH + AC_SUBST([FFLAGS]) +]) + diff --git a/src/amuse_tsunami/support/shared/m4/ax_blas.m4 b/src/amuse_tsunami/support/shared/m4/ax_blas.m4 new file mode 100644 index 0000000000..95719050a9 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_blas.m4 @@ -0,0 +1,241 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_blas.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro looks for a library that implements the BLAS linear-algebra +# interface (see http://www.netlib.org/blas/). On success, it sets the +# BLAS_LIBS output variable to hold the requisite library linkages. +# +# To link with BLAS, you should link with: +# +# $BLAS_LIBS $LIBS $FLIBS +# +# in that order. FLIBS is the output variable of the +# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is +# sometimes necessary in order to link with F77 libraries. Users will also +# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same +# reason. +# +# Many libraries are searched for, from ATLAS to CXML to ESSL. The user +# may also use --with-blas= in order to use some specific BLAS +# library . In order to link successfully, however, be aware that you +# will probably need to use the same Fortran compiler (which can be set +# via the F77 env. var.) as was used to compile the BLAS library. +# +# ACTION-IF-FOUND is a list of shell commands to run if a BLAS library is +# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is +# not found. If ACTION-IF-FOUND is not specified, the default action will +# define HAVE_BLAS. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2019 Geoffrey M. Oxberry +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 17 + +AU_ALIAS([ACX_BLAS], [AX_BLAS]) +AC_DEFUN([AX_BLAS], [ +AC_PREREQ([2.55]) +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_REQUIRE([AC_CANONICAL_HOST]) +ax_blas_ok=no + +AC_ARG_WITH(blas, + [AS_HELP_STRING([--with-blas=], [use BLAS library ])]) +case $with_blas in + yes | "") ;; + no) ax_blas_ok=disable ;; + -* | */* | *.a | *.so | *.so.* | *.dylib | *.dylib.* | *.o) + BLAS_LIBS="$with_blas" + ;; + *) BLAS_LIBS="-l$with_blas" ;; +esac + +# Get fortran linker names of BLAS functions to check for. +AC_F77_FUNC(sgemm) +AC_F77_FUNC(dgemm) + +ax_blas_save_LIBS="$LIBS" +LIBS="$LIBS $FLIBS" + +# First, check BLAS_LIBS environment variable +if test $ax_blas_ok = no; then +if test "x$BLAS_LIBS" != x; then + save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" + AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes], [BLAS_LIBS=""]) + AC_MSG_RESULT($ax_blas_ok) + LIBS="$save_LIBS" +fi +fi + +# BLAS linked to by default? (happens on some supercomputers) +if test $ax_blas_ok = no; then + save_LIBS="$LIBS"; LIBS="$LIBS" + AC_MSG_CHECKING([if $sgemm is being linked in already]) + AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes]) + AC_MSG_RESULT($ax_blas_ok) + LIBS="$save_LIBS" +fi + +# BLAS in OpenBLAS library? (http://xianyi.github.com/OpenBLAS/) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(openblas, $sgemm, [ax_blas_ok=yes + BLAS_LIBS="-lopenblas"]) +fi + +# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(atlas, ATL_xerbla, + [AC_CHECK_LIB(f77blas, $sgemm, + [AC_CHECK_LIB(cblas, cblas_dgemm, + [ax_blas_ok=yes + BLAS_LIBS="-lcblas -lf77blas -latlas"], + [], [-lf77blas -latlas])], + [], [-latlas])]) +fi + +# BLAS in PhiPACK libraries? (requires generic BLAS lib, too) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(blas, $sgemm, + [AC_CHECK_LIB(dgemm, $dgemm, + [AC_CHECK_LIB(sgemm, $sgemm, + [ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"], + [], [-lblas])], + [], [-lblas])]) +fi + +# BLAS in Intel MKL library? +if test $ax_blas_ok = no; then + # MKL for gfortran + if test x"$ac_cv_fc_compiler_gnu" = xyes; then + # 64 bit + if test $host_cpu = x86_64; then + AC_CHECK_LIB(mkl_gf_lp64, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread]) + # 32 bit + elif test $host_cpu = i686; then + AC_CHECK_LIB(mkl_gf, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_gf -lmkl_sequential -lmkl_core -lpthread]) + fi + # MKL for other compilers (Intel, PGI, ...?) + else + # 64-bit + if test $host_cpu = x86_64; then + AC_CHECK_LIB(mkl_intel_lp64, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread]) + # 32-bit + elif test $host_cpu = i686; then + AC_CHECK_LIB(mkl_intel, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_intel -lmkl_sequential -lmkl_core -lpthread]) + fi + fi +fi +# Old versions of MKL +if test $ax_blas_ok = no; then + AC_CHECK_LIB(mkl, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lmkl -lguide -lpthread"],,[-lguide -lpthread]) +fi + +# BLAS in Apple vecLib library? +if test $ax_blas_ok = no; then + save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS" + AC_MSG_CHECKING([for $sgemm in -framework vecLib]) + AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"]) + AC_MSG_RESULT($ax_blas_ok) + LIBS="$save_LIBS" +fi + +# BLAS in Alpha CXML library? +if test $ax_blas_ok = no; then + AC_CHECK_LIB(cxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lcxml"]) +fi + +# BLAS in Alpha DXML library? (now called CXML, see above) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(dxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-ldxml"]) +fi + +# BLAS in Sun Performance library? +if test $ax_blas_ok = no; then + if test "x$GCC" != xyes; then # only works with Sun CC + AC_CHECK_LIB(sunmath, acosp, + [AC_CHECK_LIB(sunperf, $sgemm, + [BLAS_LIBS="-xlic_lib=sunperf -lsunmath" + ax_blas_ok=yes],[],[-lsunmath])]) + fi +fi + +# BLAS in SCSL library? (SGI/Cray Scientific Library) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(scs, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lscs"]) +fi + +# BLAS in SGIMATH library? +if test $ax_blas_ok = no; then + AC_CHECK_LIB(complib.sgimath, $sgemm, + [ax_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"]) +fi + +# BLAS in IBM ESSL library? (requires generic BLAS lib, too) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(blas, $sgemm, + [AC_CHECK_LIB(essl, $sgemm, + [ax_blas_ok=yes; BLAS_LIBS="-lessl -lblas"], + [], [-lblas $FLIBS])]) +fi + +# Generic BLAS library? +if test $ax_blas_ok = no; then + AC_CHECK_LIB(blas, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lblas"]) +fi + +AC_SUBST(BLAS_LIBS) + +LIBS="$ax_blas_save_LIBS" + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$ax_blas_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1]) + : +else + ax_blas_ok=no + $2 +fi +])dnl AX_BLAS diff --git a/src/amuse_tsunami/support/shared/m4/ax_check_classpath.m4 b/src/amuse_tsunami/support/shared/m4/ax_check_classpath.m4 new file mode 100644 index 0000000000..55b43d93e3 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_check_classpath.m4 @@ -0,0 +1,61 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_classpath.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_CLASSPATH +# +# DESCRIPTION +# +# AX_CHECK_CLASSPATH just displays the CLASSPATH, for the edification of +# the user. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 6 + +AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH]) +AC_DEFUN([AX_CHECK_CLASSPATH],[ +if test "x$CLASSPATH" = x; then + echo "You have no CLASSPATH, I hope it is good" +else + echo "You have CLASSPATH $CLASSPATH, hope it is correct" +fi +]) + diff --git a/src/amuse_tsunami/support/shared/m4/ax_check_gnu_make.m4 b/src/amuse_tsunami/support/shared/m4/ax_check_gnu_make.m4 new file mode 100644 index 0000000000..71ffe34817 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_check_gnu_make.m4 @@ -0,0 +1,96 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_GNU_MAKE([run-if-true],[run-if-false]) +# +# DESCRIPTION +# +# This macro searches for a GNU version of make. If a match is found: +# +# * The makefile variable `ifGNUmake' is set to the empty string, otherwise +# it is set to "#". This is useful for including a special features in a +# Makefile, which cannot be handled by other versions of make. +# * The makefile variable `ifnGNUmake' is set to #, otherwise +# it is set to the empty string. This is useful for including a special +# features in a Makefile, which can be handled +# by other versions of make or to specify else like clause. +# * The variable `_cv_gnu_make_command` is set to the command to invoke +# GNU make if it exists, the empty string otherwise. +# * The variable `ax_cv_gnu_make_command` is set to the command to invoke +# GNU make by copying `_cv_gnu_make_command`, otherwise it is unset. +# * If GNU Make is found, its version is extracted from the output of +# `make --version` as the last field of a record of space-separated +# columns and saved into the variable `ax_check_gnu_make_version`. +# * Additionally if GNU Make is found, run shell code run-if-true +# else run shell code run-if-false. +# +# Here is an example of its use: +# +# Makefile.in might contain: +# +# # A failsafe way of putting a dependency rule into a makefile +# $(DEPEND): +# $(CC) -MM $(srcdir)/*.c > $(DEPEND) +# +# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) +# @ifGNUmake@ include $(DEPEND) +# @ifGNUmake@ else +# fallback code +# @ifGNUmake@ endif +# +# Then configure.in would normally contain: +# +# AX_CHECK_GNU_MAKE() +# AC_OUTPUT(Makefile) +# +# Then perhaps to cause gnu make to override any other make, we could do +# something like this (note that GNU make always looks for GNUmakefile +# first): +# +# if ! test x$_cv_gnu_make_command = x ; then +# mv Makefile GNUmakefile +# echo .DEFAULT: > Makefile ; +# echo \ $_cv_gnu_make_command \$@ >> Makefile; +# fi +# +# Then, if any (well almost any) other make is called, and GNU make also +# exists, then the other make wraps the GNU make. +# +# LICENSE +# +# Copyright (c) 2008 John Darrington +# Copyright (c) 2015 Enrico M. Crisostomo +# +# 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 12 + +AC_DEFUN([AX_CHECK_GNU_MAKE],dnl + [AC_PROG_AWK + AC_CACHE_CHECK([for GNU make],[_cv_gnu_make_command],[dnl + _cv_gnu_make_command="" ; +dnl Search all the common names for GNU make + for a in "$MAKE" make gmake gnumake ; do + if test -z "$a" ; then continue ; fi ; + if "$a" --version 2> /dev/null | grep GNU 2>&1 > /dev/null ; then + _cv_gnu_make_command=$a ; + AX_CHECK_GNU_MAKE_HEADLINE=$("$a" --version 2> /dev/null | grep "GNU Make") + ax_check_gnu_make_version=$(echo ${AX_CHECK_GNU_MAKE_HEADLINE} | ${AWK} -F " " '{ print $(NF); }') + break ; + fi + done ;]) +dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise + AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifGNUmake], ["#"])], [AS_VAR_SET([ifGNUmake], [""])]) + AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifnGNUmake], [""])], [AS_VAR_SET([ifnGNUmake], ["#"])]) + AS_VAR_IF([_cv_gnu_make_command], [""], [AS_UNSET(ax_cv_gnu_make_command)], [AS_VAR_SET([ax_cv_gnu_make_command], [${_cv_gnu_make_command}])]) + AS_VAR_IF([_cv_gnu_make_command], [""],[$2],[$1]) + AC_SUBST([ifGNUmake]) + AC_SUBST([ifnGNUmake]) +]) + diff --git a/src/amuse_tsunami/support/shared/m4/ax_count_cpus.m4 b/src/amuse_tsunami/support/shared/m4/ax_count_cpus.m4 new file mode 100644 index 0000000000..5db8925534 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_count_cpus.m4 @@ -0,0 +1,101 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_count_cpus.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COUNT_CPUS([ACTION-IF-DETECTED],[ACTION-IF-NOT-DETECTED]) +# +# DESCRIPTION +# +# Attempt to count the number of logical processor cores (including +# virtual and HT cores) currently available to use on the machine and +# place detected value in CPU_COUNT variable. +# +# On successful detection, ACTION-IF-DETECTED is executed if present. If +# the detection fails, then ACTION-IF-NOT-DETECTED is triggered. The +# default ACTION-IF-NOT-DETECTED is to set CPU_COUNT to 1. +# +# LICENSE +# +# Copyright (c) 2014,2016 Karlson2k (Evgeny Grin) +# Copyright (c) 2012 Brian Aker +# Copyright (c) 2008 Michael Paul Bailey +# Copyright (c) 2008 Christophe Tournayre +# +# 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 22 + + AC_DEFUN([AX_COUNT_CPUS],[dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_EGREP])dnl + AC_MSG_CHECKING([the number of available CPUs]) + CPU_COUNT="0" + + # Try generic methods + + # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and + # 'NPROCESSORS_ONLN' are platform-specific + command -v getconf >/dev/null 2>&1 && \ + CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1]],[[: # empty]],[dnl + # 'nproc' is part of GNU Coreutils and is widely available + CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl + # Try platform-specific preferred methods + AS_CASE([[$host_os]],dnl + [[*linux*]],[[CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+,' -c` || CPU_COUNT="0"]],dnl + [[*darwin*]],[[CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0"]],dnl + [[freebsd*]],[[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0"]],dnl + [[netbsd*]], [[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0"]],dnl + [[solaris*]],[[command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^@<:@0-9@:>@.*on-line' -c 2>/dev/null` || CPU_COUNT="0"]],dnl + [[mingw*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl + [[msys*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl + [[cygwin*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]]dnl + )dnl + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1]],[[: # empty]],[dnl + # Try less preferred generic method + # 'hw.ncpu' exist on many platforms, but not on GNU/Linux + CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl + # Try platform-specific fallback methods + # They can be less accurate and slower then preferred methods + AS_CASE([[$host_os]],dnl + [[*linux*]],[[CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0"]],dnl + [[*darwin*]],[[CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0"]],dnl + [[freebsd*]],[[CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl + [[netbsd*]], [[CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^@<:@0-9@:>@+ .* online ' -c` || \ + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl + [[solaris*]],[[command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ + CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0"]],dnl + [[mingw*]],[AS_IF([[CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\@<:@0-9@:>@+$' -c`]],dnl + [[: # empty]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]])],dnl + [[msys*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]],dnl + [[cygwin*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]]dnl + )dnl + ])dnl + + AS_IF([[test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null]],[dnl + AC_MSG_RESULT([[$CPU_COUNT]]) + m4_ifvaln([$1],[$1],)dnl + ],[dnl + m4_ifval([$2],[dnl + AS_UNSET([[CPU_COUNT]]) + AC_MSG_RESULT([[unable to detect]]) + $2 + ], [dnl + CPU_COUNT="1" + AC_MSG_RESULT([[unable to detect (assuming 1)]]) + ])dnl + ])dnl + ])dnl diff --git a/src/amuse_tsunami/support/shared/m4/ax_lapack.m4 b/src/amuse_tsunami/support/shared/m4/ax_lapack.m4 new file mode 100644 index 0000000000..abaff9d171 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_lapack.m4 @@ -0,0 +1,134 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_lapack.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro looks for a library that implements the LAPACK linear-algebra +# interface (see http://www.netlib.org/lapack/). On success, it sets the +# LAPACK_LIBS output variable to hold the requisite library linkages. +# +# To link with LAPACK, you should link with: +# +# $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS +# +# in that order. BLAS_LIBS is the output variable of the AX_BLAS macro, +# called automatically. FLIBS is the output variable of the +# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is +# sometimes necessary in order to link with F77 libraries. Users will also +# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same +# reason. +# +# The user may also use --with-lapack= in order to use some specific +# LAPACK library . In order to link successfully, however, be aware +# that you will probably need to use the same Fortran compiler (which can +# be set via the F77 env. var.) as was used to compile the LAPACK and BLAS +# libraries. +# +# ACTION-IF-FOUND is a list of shell commands to run if a LAPACK library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_LAPACK. +# +# LICENSE +# +# Copyright (c) 2009 Steven G. Johnson +# Copyright (c) 2019 Geoffrey M. Oxberry +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 10 + +AU_ALIAS([ACX_LAPACK], [AX_LAPACK]) +AC_DEFUN([AX_LAPACK], [ +AC_REQUIRE([AX_BLAS]) +ax_lapack_ok=no + +AC_ARG_WITH(lapack, + [AS_HELP_STRING([--with-lapack=], [use LAPACK library ])]) +case $with_lapack in + yes | "") ;; + no) ax_lapack_ok=disable ;; + -* | */* | *.a | *.so | *.so.* | *.dylib | *.dylib.* | *.o) + LAPACK_LIBS="$with_lapack" + ;; + *) LAPACK_LIBS="-l$with_lapack" ;; +esac + +# Get fortran linker name of LAPACK function to check for. +AC_F77_FUNC(cheev) + +# We cannot use LAPACK if BLAS is not found +if test "x$ax_blas_ok" != xyes; then + ax_lapack_ok=noblas + LAPACK_LIBS="" +fi + +# First, check LAPACK_LIBS environment variable +if test "x$LAPACK_LIBS" != x; then + save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS" + AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [$cheev])], [ax_lapack_ok=yes], [LAPACK_LIBS=""]) + AC_MSG_RESULT($ax_lapack_ok) + LIBS="$save_LIBS" + if test $ax_lapack_ok = no; then + LAPACK_LIBS="" + fi +fi + +# LAPACK linked to by default? (is sometimes included in BLAS lib) +if test $ax_lapack_ok = no; then + save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS" + AC_CHECK_FUNC($cheev, [ax_lapack_ok=yes]) + LIBS="$save_LIBS" +fi + +# Generic LAPACK library? +for lapack in lapack lapack_rs6k; do + if test $ax_lapack_ok = no; then + save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" + AC_CHECK_LIB($lapack, $cheev, + [ax_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS]) + LIBS="$save_LIBS" + fi +done + +AC_SUBST(LAPACK_LIBS) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$ax_lapack_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1]) + : +else + ax_lapack_ok=no + $2 +fi +])dnl AX_LAPACK diff --git a/src/amuse_tsunami/support/shared/m4/ax_lib_hdf5.m4 b/src/amuse_tsunami/support/shared/m4/ax_lib_hdf5.m4 new file mode 100644 index 0000000000..074c2a820a --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_lib_hdf5.m4 @@ -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 +# Copyright (c) 2010 Rhys Ulerich +# +# 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= 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= 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= 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 +]) diff --git a/src/amuse_tsunami/support/shared/m4/ax_lib_netcdf4.m4 b/src/amuse_tsunami/support/shared/m4/ax_lib_netcdf4.m4 new file mode 100644 index 0000000000..e9dd487a02 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_lib_netcdf4.m4 @@ -0,0 +1,277 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_lib_netcdf4.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_LIB_NETCDF4([serial/parallel]) +# +# DESCRIPTION +# +# This macro provides tests of the availability of the NetCDF v4 library. +# +# The optional macro argument should be either 'serial' or 'parallel'. The +# macro will call nc-config to check the output of the '--has-pnetcdf' +# option and error out if the requested parallel isn't supported. +# +# If the optional argument is omitted, no check is made to see if NetCDF +# has parallel support. +# +# The macro adds a --with-netcdf4 option accepting one of three values: +# +# no - do not check for the NetCDF4 library. +# yes - do check for NetCDF4 library in standard locations. +# path - installation prefix for NetCDF version 4. +# +# If NetCDF4 is successfully found, this macro calls +# +# AC_SUBST(NETCDF4_VERSION) +# AC_SUBST(NETCDF4_CC) +# AC_SUBST(NETCDF4_CFLAGS) +# AC_SUBST(NETCDF4_CPPFLAGS) +# AC_SUBST(NETCDF4_LDFLAGS) +# AC_SUBST(NETCDF4_LIBS) +# AC_SUBST(NETCDF4_FC) +# AC_SUBST(NETCDF4_FFLAGS) +# AC_SUBST(NETCDF4_FLIBS) +# AC_DEFINE(HAVE_NETCDF4) +# +# It also sets +# +# with_netcdf4="yes" +# with_netcdf4_fortran="yes" (if NetCDF has Fortran support) +# with_netcdf4_parallel="yes" (if NetCDF has MPI support) +# +# If NetCDF4 is disabled or not found, this macros sets +# +# with_netcdf4="no" +# with_netcdf4_fortran="no" +# +# Note it does not set with_netcdf4_parallel in this case. +# +# Your configuration script can test $with_netcdf4 to take any further +# actions. NETCDF4_{C,CPP,LD}FLAGS may be used when building with C or +# C++. NETCDF4_F{FLAGS,LIBS} and NETCDF4_LDFLAGS 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 NetCDF4 support +# AX_LIB_NETCDF4() +# +# 2) dnl Check for serial NetCDF4 support +# AX_LIB_NETCDF4([serial]) +# +# 3) dnl Check for parallel NetCDF4 support +# AX_LIB_NETCDF4([parallel]) +# +# One could test $with_netcdf4 for the outcome or display it as follows +# +# echo "NetCDF v4 support: $with_netcdf4" +# +# One could also for example, override the default CC in "configure.ac" to +# enforce compilation with the compiler that NetCDF v4 was built with: +# +# AX_LIB_NETCDF4([parallel]) +# if test "$with_netcdf4" = "yes"; then +# CC="$NETCDF4_CC" +# else +# AC_MSG_ERROR([Unable to find NetCDF4, we need parallel NetCDF4.]) +# fi +# +# LICENSE +# +# Copyright (c) 2016 Timothy Brown +# +# 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 2 + +AC_DEFUN([AX_LIB_NETCDF4], [ + +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 + netcdf4_requested_mode="serial" +elif test "m4_normalize(m4_default([$1],[]))" = "serial" ; then + netcdf4_requested_mode="serial" +elif test "m4_normalize(m4_default([$1],[]))" = "parallel"; then + netcdf4_requested_mode="parallel" +else + AC_MSG_ERROR([ +Unrecognized value for AX[]_LIB_NETCDF4 within configure.ac. +If supplied, argument 1 must be either 'serial' or 'parallel'. +]) +fi + +dnl Add a default --with-netcdf4 configuration option. +AC_ARG_WITH([netcdf4], + AS_HELP_STRING( + [--with-netcdf4=[yes/no/PATH]], + m4_case(m4_normalize([$1]), + [serial], [base directory of serial NetCDF4 installation], + [parallel], [base directory of parallel NetCDF4 installation], + [base directory of NetCDF4 installation]) + ), + [if test "$withval" = "no"; then + with_netcdf4="no" + elif test "$withval" = "yes"; then + with_netcdf4="yes" + else + with_netcdf4="yes" + NETCDF4_PREFIX="${withval}" + NC_CONFIG="${withval}/bin/nc-config" + fi], + [with_netcdf4="yes"] +) + +dnl Set defaults to blank +NETCDF4_CC="" +NETCDF4_VERSION="" +NETCDF4_CFLAGS="" +NETCDF4_CPPFLAGS="" +NETCDF4_LDFLAGS="" +NETCDF4_LIBS="" +NETCDF4_FC="" +NETCDF4_FFLAGS="" +NETCDF4_FLIBS="" + +dnl Try and find NetCDF4 tools and options. +if test "$with_netcdf4" = "yes"; then + if test -z "$NC_CONFIG"; then + dnl Check to see if NC_CONFIG is in the path. + AC_PATH_PROGS([NC_CONFIG], [nc-config], []) + NETCDF4_PREFIX=$(AS_DIRNAME([$(AS_DIRNAME(["$NC_CONFIG"]))])) + else + AC_MSG_CHECKING([Using provided NetCDF4 prefix]) + AC_MSG_RESULT([$NC_CONFIG]) + fi + + AC_MSG_CHECKING([for NetCDF4 libraries]) + + if test ! -f "$NC_CONFIG" || test ! -x "$NC_CONFIG"; then + AC_MSG_RESULT([no]) + AC_MSG_WARN([ + +Unable to locate NetCDF4 compilation helper script 'nc-config'. +Please specify --with-netcdf4= as the full path prefix +where NetCDF4 has been installed. +NetCDF4 support is being disabled (equivalent to --with-netcdf4=no). +]) + with_netcdf4="no" + with_netcdf4_fortran="no" + else + dnl Get the actual compiler used + NETCDF4_CC=$(eval $NC_CONFIG --cc | $AWK '{print $[]1}') + if test "$NETCDF4_CC" = "ccache"; then + NETCDF4_CC=$(eval $NC_CONFIG --cc | $AWK '{print $[]2}') + fi + + dnl Look for version + NETCDF4_VERSION=$(eval $NC_CONFIG --version | $AWK '{print $[]2}') + + dnl Look for the CFLAGS + NETCDF4_CFLAGS=$(eval $NC_CONFIG --cflags) + + dnl Look for the LIBS and LDFLAGS + NETCDF4_tmp_clibs=$(eval $NC_CONFIG --libs) + + dnl Sort out the tmp libs based on their prefixes + for arg in $NETCDF4_tmp_clibs ; do + case "$arg" in + -L*) echo $NETCDF4_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ + || NETCDF4_LDFLAGS="$arg $NETCDF4_LDFLAGS" + ;; + -l*) echo $NETCDF4_LIBS | $GREP -e "$arg" 2>&1 >/dev/null \ + || NETCDF4_LIBS="$arg $NETCDF4_LIBS" + ;; + esac + done + + AC_MSG_RESULT([yes (version $[NETCDF4_VERSION])]) + + dnl See if we need (and have) parallel support + if test "$netcdf4_requested_mode" = "parallel" ; then + with_netcdf4_parallel=$(eval $NC_CONFIG --has-pnetcdf) + if test "$with_netcdf4_parallel" = "no" ; then + AC_MSG_ERROR([ +parallel NetCDF4 is not supported (while it was requested) +]) + fi + fi + + dnl See if we can compile + ax_lib_netcdf4_save_CC=$CC + ax_lib_netcdf4_save_CPPFLAGS=$CPPFLAGS + ax_lib_netcdf4_save_LIBS=$LIBS + ax_lib_netcdf4_save_LDFLAGS=$LDFLAGS + CC=$NETCDF4_CC + CFLAGS=$NETCDF4_CFLAGS + LIBS=$NETCDF4_LIBS + LDFLAGS=$NETCDF4_LDFLAGS + AC_CHECK_HEADER([netcdf.h], [ac_cv_netcdf4_h=yes], [ac_cv_netcdf4_h=no]) + AC_CHECK_LIB([netcdf], [nc_create], [ac_cv_libnetcdf4=yes], + [ac_cv_libnetcdf4=no]) + if test "$ac_cv_netcdf4_h" = "no" && \ + test "$ac_cv_libnetcdf4" = "no" ; then + AC_MSG_WARN([Unable to compile NetCDF4 test program]) + fi + + CC=$ax_lib_netcdf4_save_CC + CFLAGS=$ax_lib_netcdf4_save_CFLAGS + LIBS=$ax_lib_netcdf4_save_LIBS + LDFLAGS=$ax_lib_hdf5_save_LDFLAGS + + + AC_MSG_CHECKING([for matching NetCDF4 Fortran libraries]) + NF_CONFIG="${NETCDF4_PREFIX}/bin/nf-config" + if test ! -f "$NF_CONFIG" || test ! -x "$NF_CONFIG"; then + AC_MSG_RESULT([no]) + with_netcdf4_fortran="no" + else + NETCDF_FVERSION=$(eval $NF_CONFIG --version | $AWK '{print $[]2}') + AC_MSG_RESULT([yes (version $[NETCDF_FVERSION])]) + NETCDF4_FC=$(eval $NF_CONFIG --fc | $AWK '{print $[]1}') + if test "$NETCDF4_FC" = "ccache"; then + NETCDF4_FC=$(eval $NF_CONFIG --fc | $AWK '{print $[]2}') + fi + dnl Look for the FFLAGS + NETCDF4_FFLAGS=$(eval $NC_CONFIG --fflags) + + dnl Look for the FLIBS and LDFLAGS + NETCDF4_tmp_flibs=$(eval $NC_CONFIG --flibs) + + dnl Sort out the tmp libs based on their prefixes + for arg in $NETCDF4_tmp_flibs ; do + case "$arg" in + -L*) echo $NETCDF4_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ + || NETCDF4_LDFLAGS="$arg $NETCDF4_LDFLAGS" + ;; + -l*) echo $NETCDF4_FLIBS | $GREP -e "$arg" 2>&1 >/dev/null \ + || NETCDF4_FLIBS="$arg $NETCDF4_FLIBS" + ;; + esac + done + with_netcdf4_fortran="yes" + fi + + AC_SUBST([NETCDF4_VERSION]) + AC_SUBST([NETCDF4_CC]) + AC_SUBST([NETCDF4_CFLAGS]) + AC_SUBST([NETCDF4_LDFLAGS]) + AC_SUBST([NETCDF4_LIBS]) + AC_SUBST([NETCDF4_FC]) + AC_SUBST([NETCDF4_FFLAGS]) + AC_SUBST([NETCDF4_FLIBS]) + AC_DEFINE([HAVE_NETCDF4], [1], [Defined if you have NETCDF4 support]) + fi +fi +]) diff --git a/src/amuse_tsunami/support/shared/m4/ax_mpi.m4 b/src/amuse_tsunami/support/shared/m4/ax_mpi.m4 new file mode 100644 index 0000000000..dbde02a9c4 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_mpi.m4 @@ -0,0 +1,235 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_mpi.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_MPI([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro tries to find out how to compile programs that use MPI +# (Message Passing Interface), a standard API for parallel process +# communication (see http://www-unix.mcs.anl.gov/mpi/) +# +# On success, it sets the MPICC, MPICXX, MPIF77, or MPIFC output variable +# to the name of the MPI compiler, depending upon the current language. +# (This may just be $CC/$CXX/$F77/$FC, but is more often something like +# mpicc/mpiCC/mpif77/mpif90.) It also sets MPILIBS to any libraries that +# are needed for linking MPI (e.g. -lmpi or -lfmpi, if a special +# MPICC/MPICXX/MPIF77/MPIFC was not found). +# +# If you want to compile everything with MPI, you should use something +# like this for C: +# +# if test -z "$CC" && test -n "$MPICC"; then +# CC="$MPICC" +# fi +# AC_PROG_CC +# AX_MPI +# CC="$MPICC" +# LIBS="$MPILIBS $LIBS" +# +# and similar for C++ (change all instances of CC to CXX), Fortran 77 +# (with F77 instead of CC) or Fortran (with FC instead of CC). +# +# NOTE: The above assumes that you will use $CC (or whatever) for linking +# as well as for compiling. (This is the default for automake and most +# Makefiles.) +# +# The user can force a particular library/compiler by setting the +# MPICC/MPICXX/MPIF77/MPIFC and/or MPILIBS environment variables. +# +# ACTION-IF-FOUND is a list of shell commands to run if an MPI library is +# found, and ACTION-IF-NOT-FOUND is a list of commands to run if it is not +# found. If ACTION-IF-FOUND is not specified, the default action will +# define HAVE_MPI. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Julian C. Cummings +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AU_ALIAS([ACX_MPI], [AX_MPI]) +AC_DEFUN([AX_MPI], [ +AC_PREREQ([2.71]) dnl for AC_LANG_CASE + +AC_LANG_CASE([C], [ + AC_REQUIRE([AC_PROG_CC]) + AC_ARG_VAR(MPICC,[MPI C compiler command]) + AC_CHECK_PROGS(MPICC, mpicc hcc mpxlc_r mpxlc mpcc cmpicc, $CC) + ax_mpi_save_CC="$CC" + CC="$MPICC" + AC_SUBST(MPICC) + AC_MSG_CHECKING([checking MPI C flags]) + ax_mpi_c_flags="`$MPICC -showme:compile 2>/dev/null| cut -d\ -f2-`" + ax_mpi_c_libs="`$MPICC -showme:link 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_c_flags" = "x"],[ + ax_mpi_c_flags="`$MPICC -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" + ax_mpi_c_libs="`$MPICC -show 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_c_flags" = "x"],[AC_MSG_RESULT([could not determine c flags from show functions])],[AC_MSG_RESULT([flags found])]) + + ], [ + AC_MSG_RESULT([flags found])]) + MPI_CFLAGS="$ax_mpi_c_flags" + MPI_CLIBS="$ax_mpi_c_libs" + AC_SUBST(MPI_CFLAGS) + AC_SUBST(MPI_CLIBS) + +], +[C++], [ + AC_REQUIRE([AC_PROG_CXX]) + AC_ARG_VAR(MPICXX,[MPI C++ compiler command]) + AC_CHECK_PROGS(MPICXX, mpicxx mpiCC mpic++ hcp mpxlC_r mpxlC mpCC cmpic++, $CXX) + ax_mpi_save_CXX="$CXX" + CXX="$MPICXX" + AC_SUBST(MPICXX) + + AC_MSG_CHECKING([checking MPI C++ flags]) + ax_mpi_cc_flags="`$MPICXX -showme:compile 2>/dev/null| cut -d\ -f2-`" + ax_mpi_cc_libs="`$MPICXX -showme:link 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_cc_flags" = "x"],[ + ax_mpi_cc_flags="`$MPICXX -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" + ax_mpi_cc_libs="`$MPICXX -show 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_cc_flags" = "x"],[AC_MSG_RESULT([could not determine C++ flags from show functions])],[AC_MSG_RESULT([flags found])]) + + ], [ + AC_MSG_RESULT([flags found])]) + MPI_CXXFLAGS="$ax_mpi_cc_flags" + MPI_CXXLIBS="$ax_mpi_cc_libs" + AC_SUBST(MPI_CXXFLAGS) + AC_SUBST(MPI_CXXLIBS) + +], +[Fortran 77], [ + AC_REQUIRE([AC_PROG_F77]) + AC_ARG_VAR(MPIF77,[MPI Fortran 77 compiler command]) + AC_CHECK_PROGS(MPIF77, mpif77 hf77 mpxlf_r mpxlf mpf77 cmpifc, $F77) + ax_mpi_save_F77="$F77" + F77="$MPIF77" + AC_SUBST(MPIF77) +], +[Fortran], [ + AC_REQUIRE([AC_PROG_FC]) + AC_ARG_VAR(MPIFC,[MPI Fortran compiler command]) + AC_CHECK_PROGS(MPIFC, mpif90 mpxlf95_r mpxlf90_r mpxlf95 mpxlf90 mpf90 cmpif90c, $FC) + ax_mpi_save_FC="$FC" + FC="$MPIFC" + AC_SUBST(MPIFC) + AC_MSG_CHECKING([checking MPI Fortran flags]) + ax_mpi_fc_flags="`$MPIFC -showme:compile 2>/dev/null| cut -d\ -f2-`" + ax_mpi_fc_libs="`$MPIFC -showme:link 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_fc_flags" = "x"],[ + ax_mpi_fc_flags="`$MPIFC -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" + ax_mpi_fc_libs="`$MPIFC -show 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_fc_flags" = "x"],[AC_MSG_RESULT([could not determine c flags from show functions])],[AC_MSG_RESULT([flags found])]) + + ], [ + AC_MSG_RESULT([flags found])]) + MPI_FCFLAGS="$ax_mpi_fc_flags" + MPI_FCLIBS="$ax_mpi_fc_libs" + AC_SUBST(MPI_FCFLAGS) + AC_SUBST(MPI_FCLIBS) +]) + +if test x = x"$MPILIBS"; then + AC_LANG_CASE([C], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], + [C++], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], + [Fortran 77], [AC_MSG_CHECKING([for MPI_Init]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" " + AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])], + [Fortran], [AC_MSG_CHECKING([for MPI_Init]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" " + AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) +fi +AC_LANG_CASE([Fortran 77], [ + if test x = x"$MPILIBS"; then + AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"]) + fi + if test x = x"$MPILIBS"; then + AC_CHECK_LIB(fmpich, MPI_Init, [MPILIBS="-lfmpich"]) + fi +], +[Fortran], [ + if test x = x"$MPILIBS"; then + AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"]) + fi + if test x = x"$MPILIBS"; then + AC_CHECK_LIB(mpichf90, MPI_Init, [MPILIBS="-lmpichf90"]) + fi + +]) +if test x = x"$MPILIBS"; then + AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"]) +fi +if test x = x"$MPILIBS"; then + AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"]) +fi + +dnl We have to use AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) and not AC_CHECK_HEADER because the +dnl latter uses $CPP, not $CC (which may be mpicc). +AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then + AC_MSG_CHECKING([for mpi.h]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" + AC_MSG_RESULT(no)]) +fi], +[C++], [if test x != x"$MPILIBS"; then + AC_MSG_CHECKING([for mpi.h]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" + AC_MSG_RESULT(no)]) +fi], +[Fortran 77], [if test x != x"$MPILIBS"; then + AC_MSG_CHECKING([for mpif.h]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS="" + AC_MSG_RESULT(no)]) +fi], +[Fortran], [if test x != x"$MPILIBS"; then + AC_MSG_CHECKING([for mpif.h]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS="" + AC_MSG_RESULT(no)]) +fi]) + +AC_LANG_CASE([C], [CC="$ax_mpi_save_CC"], + [C++], [CXX="$ax_mpi_save_CXX"], + [Fortran 77], [F77="$ax_mpi_save_F77"], + [Fortran], [FC="$ax_mpi_save_FC"]) + +AC_SUBST(MPILIBS) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x = x"$MPILIBS"; then + $2 + : +else + ifelse([$1],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$1]) + : +fi +])dnl AX_MPI diff --git a/src/amuse_tsunami/support/shared/m4/ax_openmp.m4 b/src/amuse_tsunami/support/shared/m4/ax_openmp.m4 new file mode 100644 index 0000000000..866e1d6645 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_openmp.m4 @@ -0,0 +1,123 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_openmp.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_OPENMP([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro tries to find out how to compile programs that use OpenMP a +# standard API and set of compiler directives for parallel programming +# (see http://www-unix.mcs/) +# +# On success, it sets the OPENMP_CFLAGS/OPENMP_CXXFLAGS/OPENMP_F77FLAGS +# output variable to the flag (e.g. -omp) used both to compile *and* link +# OpenMP programs in the current language. +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also link it with them as well. +# +# If you want to compile everything with OpenMP, you should set: +# +# CFLAGS="$CFLAGS $OPENMP_CFLAGS" +# #OR# CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS" +# #OR# FFLAGS="$FFLAGS $OPENMP_FFLAGS" +# +# (depending on the selected language). +# +# The user can override the default choice by setting the corresponding +# environment variable (e.g. OPENMP_CFLAGS). +# +# ACTION-IF-FOUND is a list of shell commands to run if an OpenMP flag is +# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is +# not found. If ACTION-IF-FOUND is not specified, the default action will +# define HAVE_OPENMP. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2015 John W. Peterson +# Copyright (c) 2016 Nick R. Papior +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 13 + +AC_DEFUN([AX_OPENMP], [ +AC_PREREQ([2.69]) dnl for _AC_LANG_PREFIX + +AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS +ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown +# Flags to try: -fopenmp (gcc), -mp (SGI & PGI), +# -qopenmp (icc>=15), -openmp (icc), +# -xopenmp (Sun), -omp (Tru64), +# -qsmp=omp (AIX), +# none +ax_openmp_flags="-fopenmp -openmp -qopenmp -mp -xopenmp -omp -qsmp=omp none" +if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then + ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags" +fi +for ax_openmp_flag in $ax_openmp_flags; do + case $ax_openmp_flag in + none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;; + *) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;; + esac + AC_LINK_IFELSE([AC_LANG_SOURCE([[ +@%:@include + +static void +parallel_fill(int * data, int n) +{ + int i; +@%:@pragma omp parallel for + for (i = 0; i < n; ++i) + data[i] = i; +} + +int +main() +{ + int arr[100000]; + omp_set_num_threads(2); + parallel_fill(arr, 100000); + return 0; +} +]])],[ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break],[]) +done +[]_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS +]) +if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" = "xunknown"; then + m4_default([$2],:) +else + if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" != "xnone"; then + OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ax_cv_[]_AC_LANG_ABBREV[]_openmp + fi + m4_default([$1], [AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])]) +fi +])dnl AX_OPENMP diff --git a/src/amuse_tsunami/support/shared/m4/ax_prog_jar.m4 b/src/amuse_tsunami/support/shared/m4/ax_prog_jar.m4 new file mode 100644 index 0000000000..76ed8147c6 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_prog_jar.m4 @@ -0,0 +1,50 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_jar.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAR +# +# DESCRIPTION +# +# AX_PROG_JAR tests for an existing jar program. It uses the environment +# variable JAR then tests in sequence various common jar programs. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAR=yourcompiler before calling +# AX_PROG_JAR +# +# - at the configure level, setenv JAR +# +# You can use the JAR variable in your Makefile.in, with @JAR@. +# +# Note: This macro depends on the autoconf M4 macros for Java programs. It +# is VERY IMPORTANT that you download that whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. +# +# The general documentation of those macros, as well as the sample +# configure.in, is included in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Egon Willighagen +# +# 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 8 + +AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR]) +AC_DEFUN([AX_PROG_JAR],[ +AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar])], + [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar], [], [$JAVAPREFIX/bin])]) +test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) +AC_PROVIDE([$0])dnl +]) + diff --git a/src/amuse_tsunami/support/shared/m4/ax_prog_java.m4 b/src/amuse_tsunami/support/shared/m4/ax_prog_java.m4 new file mode 100644 index 0000000000..c4312ee8e7 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_prog_java.m4 @@ -0,0 +1,116 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_java.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVA +# +# DESCRIPTION +# +# Here is a summary of the main macros: +# +# AX_PROG_JAVAC: finds a Java compiler. +# +# AX_PROG_JAVA: finds a Java virtual machine. +# +# AX_CHECK_CLASS: finds if we have the given class (beware of CLASSPATH!). +# +# AX_CHECK_RQRD_CLASS: finds if we have the given class and stops +# otherwise. +# +# AX_TRY_COMPILE_JAVA: attempt to compile user given source. +# +# AX_TRY_RUN_JAVA: attempt to compile and run user given source. +# +# AX_JAVA_OPTIONS: adds Java configure options. +# +# AX_PROG_JAVA tests an existing Java virtual machine. It uses the +# environment variable JAVA then tests in sequence various common Java +# virtual machines. For political reasons, it starts with the free ones. +# You *must* call [AX_PROG_JAVAC] before. +# +# If you want to force a specific VM: +# +# - at the configure.in level, set JAVA=yourvm before calling AX_PROG_JAVA +# +# (but after AC_INIT) +# +# - at the configure level, setenv JAVA +# +# You can use the JAVA variable in your Makefile.in, with @JAVA@. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# TODO: allow to exclude virtual machines (rationale: most Java programs +# cannot run with some VM like kaffe). +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. +# +# A Web page, with a link to the latest CVS snapshot is at +# . +# +# This is a sample configure.in Process this file with autoconf to produce +# a configure script. +# +# AC_INIT(UnTag.java) +# +# dnl Checks for programs. +# AC_CHECK_CLASSPATH +# AX_PROG_JAVAC +# AX_PROG_JAVA +# +# dnl Checks for classes +# AX_CHECK_RQRD_CLASS(org.xml.sax.Parser) +# AX_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver) +# +# AC_OUTPUT(Makefile) +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 10 + +AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA]) +AC_DEFUN([AX_PROG_JAVA],[ +m4_define([m4_ax_prog_java_list], [kaffe java])dnl +AS_IF([test "x$JAVAPREFIX" = x], + [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list])], + [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list], [], [$JAVAPREFIX/bin])]) +test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) +m4_undefine([m4_ax_prog_java_list])dnl +AX_PROG_JAVA_WORKS +AC_PROVIDE([$0])dnl +]) + diff --git a/src/amuse_tsunami/support/shared/m4/ax_prog_java_works.m4 b/src/amuse_tsunami/support/shared/m4/ax_prog_java_works.m4 new file mode 100644 index 0000000000..d92b7b8ddc --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_prog_java_works.m4 @@ -0,0 +1,92 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVA_WORKS +# +# DESCRIPTION +# +# Internal use ONLY. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 11 + +AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS]) +AC_DEFUN([AX_PROG_JAVA_WORKS], [ + if test x$ac_cv_prog_javac_works = xno; then + AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) + fi + if test x$ac_cv_prog_javac_works = x; then + AX_PROG_JAVAC + fi +AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +TEST=Test +changequote(, )dnl +cat << \EOF > $JAVA_TEST +/* [#]line __oline__ "configure" */ +public class Test { +public static void main (String args[]) { + System.exit (0); +} } +EOF +changequote([, ])dnl + if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then + : + else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD + AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) + fi +if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then + ac_cv_prog_java_works=yes +else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD + AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) +fi +rm -f $JAVA_TEST $CLASS_TEST +]) +AC_PROVIDE([$0])dnl +] +) + diff --git a/src/amuse_tsunami/support/shared/m4/ax_prog_javac.m4 b/src/amuse_tsunami/support/shared/m4/ax_prog_javac.m4 new file mode 100644 index 0000000000..9dae89b1bb --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_prog_javac.m4 @@ -0,0 +1,80 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVAC +# +# DESCRIPTION +# +# AX_PROG_JAVAC tests an existing Java compiler. It uses the environment +# variable JAVAC then tests in sequence various common Java compilers. For +# political reasons, it starts with the free ones. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAVAC=yourcompiler before calling +# AX_PROG_JAVAC +# +# - at the configure level, setenv JAVAC +# +# You can use the JAVAC variable in your Makefile.in, with @JAVAC@. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# TODO: allow to exclude compilers (rationale: most Java programs cannot +# compile with some compilers like guavac). +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 8 + +AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC]) +AC_DEFUN([AX_PROG_JAVAC],[ +m4_define([m4_ax_prog_javac_list],["gcj -C" guavac jikes javac])dnl +AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list])], + [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list], [], [$JAVAPREFIX/bin])]) +m4_undefine([m4_ax_prog_javac_list])dnl +test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) +AX_PROG_JAVAC_WORKS +AC_PROVIDE([$0])dnl +]) + diff --git a/src/amuse_tsunami/support/shared/m4/ax_prog_javac_works.m4 b/src/amuse_tsunami/support/shared/m4/ax_prog_javac_works.m4 new file mode 100644 index 0000000000..f0efe85342 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/ax_prog_javac_works.m4 @@ -0,0 +1,73 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVAC_WORKS +# +# DESCRIPTION +# +# Internal use ONLY. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS]) +AC_DEFUN([AX_PROG_JAVAC_WORKS],[ +AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +cat << \EOF > $JAVA_TEST +/* [#]line __oline__ "configure" */ +public class Test { +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then + ac_cv_prog_javac_works=yes +else + AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD +fi +rm -f $JAVA_TEST $CLASS_TEST +]) +AC_PROVIDE([$0])dnl +]) + diff --git a/src/amuse_tsunami/support/shared/m4/fftw.m4 b/src/amuse_tsunami/support/shared/m4/fftw.m4 new file mode 100644 index 0000000000..45a55f06fc --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/fftw.m4 @@ -0,0 +1,122 @@ +# AX_FFTW +# ---------------------------------------------------------- +# set up for FFTW +# +AC_DEFUN([AX_FFTW],[ + AC_ARG_WITH(fftw, + AS_HELP_STRING([--with-fftw=PFX],[Prefix where FFTW has been installed ]), + [ + test "$withval" = no && AC_MSG_WARN([fftw is a required package for some modules]) + test "$withval" = yes || fftw_prefix="$withval" + with_fftw=yes ], + [ with_fftw=yes ] + ) + + AS_IF([test "x$with_fftw" != xno ], + [ + #user override + AS_IF([test "x$FFTW_LIBS" != x && test "x$FFTW_FLAGS" != x ], + [ + have_fftw=yes + FOUND_FFTW="yes" + ], + [ + saved_LIBS="$LIBS" + saved_CXXFLAGS="$CXXFLAGS" + FFTW_LIBS="" + FFTW_FLAGS="" + FOUND_FFTW="no" + if test x$fftw_prefix == x; then + if test x$PREFIX != x; then + fftw_prefix=$PREFIX + fi + fi + if test x$fftw_prefix != x; then + ac_FFTW_CFLAGS="-I$fftw_prefix/include" + ac_FFTW_LDOPTS="-L$fftw_prefix/lib" + + + save_CFLAGS="$CFLAGS" + save_CPPFLAGS="$CPPFLAGS" + CFLAGS="$ac_FFTW_CFLAGS $save_CFLAGS" + CPPFLAGS="$ac_FFTW_CFLAGS $save_CPPFLAGS" + AC_CHECK_HEADER( + [fftw3.h], + [FFTW_FLAGS="$ac_FFTW_CFLAGS" + FOUND_FFTW="yes"], + [AC_MSG_WARN([Cannot find headers (fftw3.h) of the library FFTW in $fftw_prefix/include.])] + ) + CFLAGS="$save_CFLAGS" + CPPFLAGS="$save_CPPFLAGS" + + save_LIBS="$LIBS" + LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads $save_LIBS" + + cache_var=AS_TR_SH([ac_cv_lib_fftw3_fftw_plan_dft_r2c]) + AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], + [FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads"], + [FOUND_FFTW="no"] + ) + $as_unset $cache_var + if test x$FOUND_FFTW != xyes; then + LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm $save_LIBS" + AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], + [FOUND_FFTW="yes" + FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm"], + [AC_MSG_WARN([libfftw3 : library missing. (Cannot find symbol fftw_plan_dft_r2c) in $fftw_prefix. Check if libfftw3 is installed and if the version is correct])] + ) + $as_unset $cache_var + fi + LIBS="$save_LIBS" + fi + + if test x$FOUND_FFTW != xyes; then + PKG_CHECK_MODULES([FFTW],[fftw3 >= 3.2], + [ + FFTW_FLAGS="$FFTW_CFLAGS" + FFTW_LIBS="$FFTW_LIBS -lfftw3_threads" + FOUND_FFTW=yes + ], + [] + ) + fi + + if test x$FOUND_FFTW != xyes; then + AC_CHECK_HEADER( + [fftw3.h], + [FFTW_FLAGS="" + FOUND_FFTW="yes"], + [AC_MSG_WARN([Cannot find headers (fftw3.h) of the library FFTW in $fftw_prefix/include.])] + ) + cache_var=AS_TR_SH([ac_cv_lib_fftw3_fftw_plan_dft_r2c]) + AC_CHECK_LIB( + [fftw3], + [fftw_plan_dft_r2c], + [FFTW_LIBS="-lfftw3 -lfftw3_threads"], + [FOUND_FFTW="no"] + ) + $as_unset $cache_var + + if test x$FOUND_FFTW != xyes; then + + save_LIBS="$LIBS" + LIBS="-lfftw3_threads -lm $save_LIBS" + AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], + [FOUND_FFTW="yes" + FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm"], + [FOUND_FFTW="no" + AC_MSG_WARN([libfftw3 : library missing. (Cannot find symbol fftw_plan_dft_r2c) in $fftw_prefix. Check if libfftw3 is installed and if the version is correct])] + ) + LIBS="$save_LIBS" + fi + fi + + + ]) + ]) + + AC_SUBST(FOUND_FFTW) + AC_SUBST(FFTW_FLAGS) + AC_SUBST(FFTW_LIBS) + ] +) diff --git a/src/amuse_tsunami/support/shared/m4/fortran.m4 b/src/amuse_tsunami/support/shared/m4/fortran.m4 new file mode 100644 index 0000000000..8b042cd390 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/fortran.m4 @@ -0,0 +1,43 @@ +AC_DEFUN([AX_FC_WORKS],[ +AC_LANG_PUSH(Fortran) +AC_MSG_CHECKING([whether the Fortran 90 compiler ($FC $FCFLAGS $LDFLAGS) works]) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program conftest + integer, dimension(10) :: n + end + ]) +],[ + ax_cv_prog_fc_works="yes" + AC_MSG_RESULT([$ax_cv_prog_fc_works]) +],[ + ax_cv_prog_fc_works="no" + AC_MSG_WARN([installation or configuration problem: Fortran 90 compiler cannot create executables.]) +]) +# The intel compiler sometimes generates these work.pc and .pcl files +rm -f work.pc work.pcl +AC_LANG_POP(Fortran) +]) + + +AC_DEFUN([AX_FC_ISO_C_BINDING],[ +AC_LANG_PUSH(Fortran) +AC_MSG_CHECKING([if the fortran compiler supports iso c binding]) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program conftest + use ISO_C_BINDING + integer, dimension(10) :: n + end + ]) +],[ + FC_ISO_C_BINDINGS="yes" + AC_MSG_RESULT([$ax_cv_fc_iso_c_bindings]) +],[ + FC_ISO_C_BINDINGS="no" + AC_MSG_RESULT([no, fortran codes and sockets or embedding will not work.]) +]) +# The intel compiler sometimes generates these work.pc and .pcl files +rm -f work.pc work.pcl +AC_LANG_POP(Fortran) +]) diff --git a/src/amuse_tsunami/support/shared/m4/gmp.m4 b/src/amuse_tsunami/support/shared/m4/gmp.m4 new file mode 100644 index 0000000000..584168bd12 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/gmp.m4 @@ -0,0 +1,103 @@ +# AX_GMP +# ---------------------------------------------------------- +# set up for GMP +# +AC_DEFUN([AX_GMP],[ + AC_ARG_WITH(gmp, + AS_HELP_STRING([--with-gmp=PFX],[Prefix where GMP has been installed ]), + [ + test "$withval" = no && AC_MSG_WARN([gmp is a required package for some modules]) + test "$withval" = yes || gmp_prefix="$withval" + with_gmp=yes ], + [ with_gmp=yes ] + ) + + AS_IF([test "x$with_gmp" != xno ], + [ + #user override + AS_IF([test "x$GMP_LIBS" != x ], + [ + have_gmp=yes + FOUND_GMP="yes" + ], + [ + + + + saved_LIBS="$LIBS" + saved_CXXFLAGS="$CXXFLAGS" + GMP_LIBS="" + GMP_FLAGS="" + FOUND_GMP="no" + if test x$gmp_prefix == x; then + if test x$PREFIX != x; then + gmp_prefix=$PREFIX + fi + fi + if test x$gmp_prefix != x; then + ac_gmp_CFLAGS="-I$gmp_prefix/include" + ac_gmp_LDOPTS="-L$gmp_prefix/lib" + + + save_CFLAGS="$CFLAGS" + save_CPPFLAGS="$CPPFLAGS" + CFLAGS="$ac_gmp_CFLAGS $save_CFLAGS" + CPPFLAGS="$ac_gmp_CFLAGS $save_CPPFLAGS" + AC_CHECK_HEADER( + [gmp.h], + [GMP_FLAGS="$ac_gmp_CFLAGS" + FOUND_GMP="yes"], + [AC_MSG_WARN([Cannot find headers (gmp.h) of the library GMP in $gmp_prefix/include.])] + ) + CFLAGS="$save_CFLAGS" + CPPFLAGS="$save_CPPFLAGS" + + if test x$FOUND_GMP == xyes; then + save_LIBS="$LIBS" + LIBS="$ac_gmp_LDOPTS -lgmp $save_LIBS" + AC_CHECK_LIB([gmp], [__gmpz_init], + [GMP_LIBS="$ac_gmp_LDOPTS -lgmp"], + [FOUND_GMP="no" + AC_MSG_WARN([libgmp : library missing. (Cannot find symbol gmpz_init) in $gmp_prefix. Check if libgmp is installed and if the version is correct])] + ) + LIBS="$save_LIBS" + fi + fi + if test x$FOUND_GMP != xyes; then + PKG_CHECK_MODULES([GMP],[gmp >= 3], + [ + GMP_FLAGS="$GMP_FLAGS" + GMP_LIBS="$GMP_LIBS" + FOUND_GMP=yes + ], + [] + ) + + fi + + if test x$FOUND_GMP != xyes; then + AC_CHECK_HEADER( + [gmp.h], + [GMP_FLAGS="" + FOUND_GMP="yes"], + [AC_MSG_WARN([Cannot find headers (gmp.h) of the library GMP.])] + ) + AC_CHECK_LIB( + [gmp], + [__gmpz_init], + [GMP_LIBS="-lgmp"], + [ + FOUND_GMP="no" + AC_MSG_WARN([libgmp : library missing. (Cannot find symbol gmpz_init). Check if libgmp is installed and if the version is correct])] + ) + fi + + + ]) + ]) + + AC_SUBST(FOUND_GMP) + AC_SUBST(GMP_FLAGS) + AC_SUBST(GMP_LIBS) + ] +) diff --git a/src/amuse_tsunami/support/shared/m4/gsl.m4 b/src/amuse_tsunami/support/shared/m4/gsl.m4 new file mode 100644 index 0000000000..96c3189801 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/gsl.m4 @@ -0,0 +1,122 @@ +# Configure path for the GNU Scientific Library +# Christopher R. Gabriel , April 2000 + + +AC_DEFUN([AX_PATH_GSL], +[ +AC_ARG_WITH(gsl-prefix,[ --with-gsl-prefix=PFX Prefix where GSL is installed (optional)], + gsl_prefix="$withval", gsl_prefix="") +AC_ARG_WITH(gsl-exec-prefix,[ --with-gsl-exec-prefix=PFX Exec prefix where GSL is installed (optional)], + gsl_exec_prefix="$withval", gsl_exec_prefix="") +AC_ARG_ENABLE(gsltest, [ --disable-gsltest Do not try to compile and run a test GSL program], + , enable_gsltest=yes) + + if test "x${GSL_CONFIG+set}" != xset ; then + if test "x$gsl_prefix" != x ; then + GSL_CONFIG="$gsl_prefix/bin/gsl-config" + fi + if test "x$gsl_exec_prefix" != x ; then + GSL_CONFIG="$gsl_exec_prefix/bin/gsl-config" + fi + fi + + + if test "x${GSL_CONFIG+set}" == xset ; then + if test -x "${GSL_CONFIG}" ; then + gsl_config_exists=yes + else + gsl_config_exists=no + fi + fi + FOUND_GSL=no + if test "x$GSL_CFLAGS" != x ; then + if test "x$GSL_LIBS" != x ; then + GSL_FLAGS="$GSL_CFLAGS" + GSL_LIBS="$GSL_LIBS" + FOUND_GSL=yes + AC_SUBST(GSL_FLAGS) + fi + fi + if test "$FOUND_GSL" = "no"; then + if test "x$gsl_config_exists" != xyes ; then + PKG_CHECK_MODULES([GSL],[gsl >= 1.0], + [ + GSL_FLAGS="$GSL_CFLAGS" + GSL_LIBS="$GSL_LIBS" + FOUND_GSL=yes + AC_SUBST(GSL_FLAGS) + + ifelse([$2], , :, [$2]) + ], + [ + ] + ) + fi + fi + if test "$FOUND_GSL" = "no"; then + AC_PATH_PROG(GSL_CONFIG, gsl-config, no) + min_gsl_version=ifelse([$1], ,0.2.5,$1) + AC_MSG_CHECKING(for GSL - version >= $min_gsl_version) + no_gsl="" + if test "$GSL_CONFIG" = "no" ; then + no_gsl=yes + else + GSL_FLAGS=`$GSL_CONFIG --cflags` + GSL_LIBS=`$GSL_CONFIG --libs` + + gsl_version=`$GSL_CONFIG --version` + AS_VERSION_COMPARE( + [$gsl_version], + [$min_gsl_version], + [no_gsl=yes], + + ) + fi + if test "x$no_gsl" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GSL_CONFIG" = "no" ; then + echo "*** The gsl-config script installed by GSL could not be found" + echo "*** If GSL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GSL_CONFIG environment variable to the" + echo "*** full path to gsl-config." + else + if test -f conf.gsltest ; then + : + else + echo "*** Could not run GSL test program, checking why..." + CFLAGS="$CFLAGS $GSL_FLAGS" + LIBS="$LIBS $GSL_LIBS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include + ]], [[ return 0; ]])],[ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GSL or finding the wrong" + echo "*** version of GSL. If it is not finding GSL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],[ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GSL was incorrectly installed" + echo "*** or that you have moved GSL since it was installed. In the latter case, you" + echo "*** may want to edit the gsl-config script: $GSL_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + # GSL_FLAGS="" + # GSL_LIBS="" + ifelse([$3], , :, [$3]) + fi + + fi + AC_SUBST(GSL_FLAGS) + AC_SUBST(GSL_LIBS) + rm -f conf.gsltest + +]) + +AU_ALIAS([AM_PATH_GSL], [AX_PATH_GSL]) diff --git a/src/amuse_tsunami/support/shared/m4/mpfr.m4 b/src/amuse_tsunami/support/shared/m4/mpfr.m4 new file mode 100644 index 0000000000..eba25c6dc9 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/mpfr.m4 @@ -0,0 +1,109 @@ +# AX_MPFR +# ---------------------------------------------------------- +# set up for MPFR +# +AC_DEFUN([AX_MPFR],[ + AC_ARG_WITH(mpfr, + AS_HELP_STRING([--with-mpfr=PFX],[Prefix where MPFR has been installed ]), + [ + test "$withval" = no && AC_MSG_WARN([mpfr is a required package for some modules]) + test "$withval" = yes || mpfr_prefix="$withval" + with_mpfr=yes ], + [ with_mpfr=yes ] + ) + + AS_IF([test "x$with_mpfr" != xno ], + [ + #user override + AS_IF([test "x$MPFR_LIBS" != x ], + [ + have_mpfr=yes + FOUND_MPFR="yes" + ], + [ + + + + saved_LIBS="$LIBS" + saved_CXXFLAGS="$CXXFLAGS" + MPFR_LIBS="" + MPFR_FLAGS="" + FOUND_MPFR="no" + if test x$mpfr_prefix == x; then + if test x$PREFIX != x; then + mpfr_prefix=$PREFIX + fi + fi + if test x$mpfr_prefix != x; then + ac_mpfr_CFLAGS="-I$mpfr_prefix/include" + ac_mpfr_LDOPTS="-L$mpfr_prefix/lib" + + + save_CFLAGS="$CFLAGS" + save_CPPFLAGS="$CPPFLAGS" + CFLAGS="$ac_mpfr_CFLAGS $save_CFLAGS" + CPPFLAGS="$ac_mpfr_CFLAGS $save_CPPFLAGS" + + cache_var=AS_TR_SH([ac_cv_header_mpfr.h]) + AC_CHECK_HEADER( + [mpfr.h], + [MPFR_FLAGS="$ac_mpfr_CFLAGS" + FOUND_MPFR="yes"], + [AC_MSG_WARN([Cannot find headers (mpfr.h) of the library MPFR in $mpfr_prefix/include.])] + ) + $as_unset $cache_var + CFLAGS="$save_CFLAGS" + CPPFLAGS="$save_CPPFLAGS" + + if test x$FOUND_MPFR == xyes; then + save_LIBS="$LIBS" + LIBS="$ac_mpfr_LDOPTS -lmpfr $save_LIBS" + + cache_var=AS_TR_SH([ac_cv_lib_mpfr_mpfr_init]) + AC_CHECK_LIB([mpfr], [mpfr_init], + [MPFR_LIBS="$ac_mpfr_LDOPTS -lmpfr"], + [FOUND_MPFR="no" + AC_MSG_WARN([libmpfr : library missing. (Cannot find symbol mpfr_init) in $mpfr_prefix. Check if libmpfr is installed and if the version is correct])] + ) + LIBS="$save_LIBS" + $as_unset $cache_var + fi + fi + if test x$FOUND_MPFR != xyes; then + PKG_CHECK_MODULES([MPFR],[mpfr >= 3], + [ + MPFR_FLAGS="$MPFR_FLAGS" + MPFR_LIBS="$MPFR_LIBS" + FOUND_MPFR=yes + ], + [] + ) + + fi + + if test x$FOUND_MPFR != xyes; then + AC_CHECK_HEADER( + [mpfr.h], + [MPFR_FLAGS="" + FOUND_MPFR="yes"], + [AC_MSG_WARN([Cannot find headers (mpfr.h) of the library MPFR.])] + ) + AC_CHECK_LIB( + [mpfr], + [mpfr_init], + [MPFR_LIBS="-lmpfr"], + [ + FOUND_MPFR="no" + AC_MSG_WARN([libmpfr : library missing. (Cannot find symbol mpfr_init). Check if libmpfr is installed and if the version is correct])] + ) + fi + + + ]) + ]) + + AC_SUBST(FOUND_MPFR) + AC_SUBST(MPFR_FLAGS) + AC_SUBST(MPFR_LIBS) + ] +) diff --git a/src/amuse_tsunami/support/shared/m4/pkg.m4 b/src/amuse_tsunami/support/shared/m4/pkg.m4 new file mode 100644 index 0000000000..d8549a4789 --- /dev/null +++ b/src/amuse_tsunami/support/shared/m4/pkg.m4 @@ -0,0 +1,343 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 11 (pkg-config-0.29.1) + +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.1]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR + +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES diff --git a/src/amuse_tsunami/support/shared/uninstall.sh b/src/amuse_tsunami/support/shared/uninstall.sh new file mode 100755 index 0000000000..e08122700e --- /dev/null +++ b/src/amuse_tsunami/support/shared/uninstall.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +PACKAGE="$1" + +if test -z "${PACKAGE}" ; then + echo " Incorrect usage, please specify a package name as the first argument." + exit 1 +fi + +if test -n "${VIRTUAL_ENV}${CONDA_DEFAULT_ENV}" ; then + pip_package_line=$(pip list | grep "${PACKAGE} ") + if [ "a${pip_package_line}" = "a" ] ; then + printf '%s\n' " Package ${PACKAGE} was not installed, not uninstalling." + exit 0 + fi +fi + +if test -n "${VIRTUAL_ENV}" ; then + # grep -q stops reading when a match is found, which then crashes pip list, so we + # redirect instead. With conda list we can use -q as usual. + if [ "a${pip_package_line}" != "a" ] ; then + pip uninstall -y ${PACKAGE} + fi +fi + +if test -n "${CONDA_DEFAULT_ENV}" ; then + conda_package_line=$(conda list | grep "^${PACKAGE} ") + if printf '%s' "${conda_package_line}" | grep "" >/dev/null 2>&1 ; then + # Conda is showing a pip-installed develop package. However, there may be a + # conda package hidden underneath, so we're going to try to conda uninstall + # anyway to fix that if needed. This will fail if everything is as it should + # be, so we make sure to inhibit the error message to reduce confusion. + EXPECTING_FAIL=true + fi + + if printf '%s' "${conda_package_line}" | grep -v "pypi$" >/dev/null 2>&1 ; then + TMPOUT=$(mktemp) + conda remove -y ${PACKAGE} >${TMPOUT} 2>&1 + err="$?" + # If it failed and we were not expecting it to, print the output + if test "$err" != 0 -a -z "${EXPECTING_FAIL}" ; then + cat ${TMPOUT} + fi + rm ${TMPOUT} + fi + + if [ "a${pip_package_line}" != "a" ] ; then + pip uninstall -y ${PACKAGE} + fi +fi + diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py new file mode 100644 index 0000000000..58ebe545d9 --- /dev/null +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -0,0 +1,12 @@ +from amuse.support.testing.amusetest import TestWithMPI + +from amuse.community.tsunami.interface import tsunamiInterface, tsunami + +class tsunamiInterfaceTests(TestWithMPI): + + def test_echo_int(self): + instance = tsunamiInterface() + result,error = instance.echo_int(12) + self.assertEquals(error, 0) + self.assertEquals(result, 12) + instance.stop() From 3000cae66e56fe8c9af41541e7f698e46cd52390 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 9 Feb 2026 14:33:34 +0100 Subject: [PATCH 002/132] defined Tsunami new_particle in interface.py --- src/amuse_tsunami/interface.py | 204 ++++++++++++++++++++++++++++++++- 1 file changed, 202 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 22299fc9cf..d26829a086 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1,5 +1,6 @@ +from enum import IntEnum +import numpy as np from amuse.support.interface import InCodeComponentImplementation - from amuse.community.interface.gd import GravitationalDynamics from amuse.community.interface.gd import GravitationalDynamicsInterface from amuse.community.interface.gd import GravityFieldInterface @@ -11,6 +12,28 @@ from amuse.units import generic_unit_system, nbody_system +class TsunamiPtype(IntEnum): + LOW_MASS_MS = 0 + HIGH_MASS_MS = 1 + HGAP = 2 + GIANT_BRANCH = 3 + CORE_HE_BURN = 4 + EARLY_AGBe = 5 + TP_AGB = 6 + NAKED_HE = 7 + NAKED_HE_HGAP = 8 + NAKED_HE_GIANT = 9 + HE_WD = 10 + CO_WD = 11 + ONE_WD = 12 + NS = 13 + BH = 14 + # planets + ROCKY = 100 + GAS_GIANT = 101 + # null + UNCLASSIFIED = -1 + class TsunamiInterface( CodeInterface, LiteratureReferencesMixIn, @@ -36,7 +59,184 @@ def __init__(self, **keyword_arguments): ) LiteratureReferencesMixIn.__init__(self) - # here you must specify the prototypes of the interface functions: + @legacy_function + def new_particle(): + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.OUT, + description=( + 'An index assigned to the newly created particle. ' + 'This index is supposed to be a local index for the code ' + '(and not valid in other instances of the code or in other codes)' + ), + ) + function.addParameter( + 'mass', + dtype='float64', + direction=function.IN, + description='The mass of the particle', + ) + function.addParameter( + 'x', + dtype='float64', + direction=function.IN, + description='The initial position vector of the particle', + ) + function.addParameter( + 'y', + dtype='float64', + direction=function.IN, + description='The initial position vector of the particle', + ) + function.addParameter( + 'z', + dtype='float64', + direction=function.IN, + description='The initial position vector of the particle', + ) + function.addParameter( + 'vx', + dtype='float64', + direction=function.IN, + description='The initial velocity vector of the particle', + ) + function.addParameter( + 'vy', + dtype='float64', + direction=function.IN, + description='The initial velocity vector of the particle', + ) + function.addParameter( + 'vz', + dtype='float64', + direction=function.IN, + description='The initial velocity vector of the particle', + ) + function.addParameter( + 'radius', + dtype='float64', + direction=function.IN, + description='The radius of the particle', + default=0, + ) + function.addParameter( + 'stype', + dtype='int32', + direction=function.IN, + description='The physical type of the particle', + default=TsunamiPtype.UNCLASSIFIED, + ) + function.addParameter( + 'wx', + dtype='float64', + direction=function.IN, + description='The initial spin vector of the particle', + default=0 + ) + function.addParameter( + 'wy', + dtype='float64', + direction=function.IN, + description='The initial spin vector of the particle', + default=0 + ) + function.addParameter( + 'wz', + dtype='float64', + direction=function.IN, + description='The initial spin vector of the particle', + default=0 + ) + function.addParameter( + 'polyt', + dtype='float64', + direction=function.IN, + description='The particle polytropic index', + default=0 + ) + function.addParameter( + 'kaps', + dtype='float64', + direction=function.IN, + description='The particle 2nd degree love number (apsidal constant)', + default=0 + ) + function.addParameter( + 'inert', + dtype='float64', + direction=function.IN, + description='The particle intertia', + default=0 + ) + function.addParameter( + 'taulag', + dtype='float64', + direction=function.IN, + description='The particle time lag', + default=0, + ) + function.addParameter( + 'taumigx', + dtype='float64', + direction=function.IN, + description='The particle migration timescale', + default=np.inf, + ) + function.addParameter( + 'taumigy', + dtype='float64', + direction=function.IN, + description='The particle migration timescale', + default=np.inf, + ) + function.addParameter( + 'taumigz', + dtype='float64', + direction=function.IN, + description='The particle migration timescale', + default=np.inf, + ) + function.addParameter( + 'eloss', + dtype='float64', + direction=function.IN, + description='The particle energy loss', + default=0, + ) + function.addParameter( + 'haspn', + dtype='bool', + direction=function.IN, + description='Enable post-Newtonian corrections for this particle', + default=False, + ) + function.addParameter( + 'hastide', + dtype='bool', + direction=function.IN, + description='Enable tidal interactions for this particle', + default=False, + ) + function.addParameter( + 'sigmadiss', + dtype='float64', + direction=function.IN, + description='', # FIXME + default=0, + ) + function.addParameter( + 'Atide', + dtype='float64', + direction=function.IN, + description='', # FIXME + default=0, + ) + function.result_type = 'int32' + function.can_handle_array = True + return function @legacy_function def echo_int(): From 3f326ec7e37e2b58644ecb2ca9f64e339930458b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 9 Feb 2026 14:33:56 +0100 Subject: [PATCH 003/132] defining new_particle in Tsunami interface.cc --- src/amuse_tsunami/interface.cc | 62 +++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index d4d71296b2..1813aa95ad 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -1,9 +1,63 @@ #include "tsunami_worker.h" +#include -extern int echo(int input); +// AMUSE STOPPING CONDITIONS SUPPORT +#include +#include -int echo_int(int input, int * output) { - *output = echo(input); +#include "tsunami.hpp" + +static TsunamiCode Tsunami; + + +/** + * Define a new particle in the stellar dynamics code. The particle is + * initialized with the provided mass, radius, position and velocity. + * This function returns an index that can be used to refer to this particle. + */ +int new_particle( + int* index_of_the_particle, + double mass, + double x, + double y, + double z, + double vx, + double vy, + double vz, + double radius, + int stype, + double wx, + double wy, + double wz, + double polyt, + double kaps, + double inert, + double taulag, + double taumigx, + double taumigy, + double taumigz, + double eloss, + bool haspn, + bool hastide, + double sigmadiss, + double Atide +) { + if (!index_of_the_particle) return -1; + + std::vector<> + + std::vector& bodies = tidymess.bodies; + + Body newbody( + mass, radius, xi, kf, tau, a_mb, + wx, wy, wz, x, y, z, vx, vy, vz + ); + + newbody.set_id(particle_id_counter); + + *index_of_the_particle = particle_id_counter; + particle_id_counter++; + + bodies.push_back(newbody); return 0; } - From 9f36e143d8f79049096ee45521e1844c17f0dd6d Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 10 Feb 2026 14:37:19 +0100 Subject: [PATCH 004/132] tsunami interface.cc cleanup --- src/amuse_tsunami/interface.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index 1813aa95ad..86ab97674f 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -9,6 +9,8 @@ static TsunamiCode Tsunami; +int particle_id_counter = 0; + /** * Define a new particle in the stellar dynamics code. The particle is @@ -44,8 +46,6 @@ int new_particle( ) { if (!index_of_the_particle) return -1; - std::vector<> - std::vector& bodies = tidymess.bodies; Body newbody( From 30fa3b2172215ef6729d58edb3eda827605ca242 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 12 Feb 2026 13:48:02 +0100 Subject: [PATCH 005/132] rm unused params in Tsunami interface.py --- src/amuse_tsunami/interface.cc | 18 ++----- src/amuse_tsunami/interface.py | 92 ++-------------------------------- 2 files changed, 9 insertions(+), 101 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index 86ab97674f..264d9e67cc 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -27,25 +27,17 @@ int new_particle( double vy, double vz, double radius, - int stype, double wx, double wy, double wz, - double polyt, - double kaps, - double inert, - double taulag, - double taumigx, - double taumigy, - double taumigz, - double eloss, - bool haspn, - bool hastide, - double sigmadiss, - double Atide + int stype, ) { if (!index_of_the_particle) return -1; + int Npar = Tsunami.System.pos.size() + + + std::vector& bodies = tidymess.bodies; Body newbody( diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index d26829a086..e51763d035 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -122,13 +122,6 @@ def new_particle(): description='The radius of the particle', default=0, ) - function.addParameter( - 'stype', - dtype='int32', - direction=function.IN, - description='The physical type of the particle', - default=TsunamiPtype.UNCLASSIFIED, - ) function.addParameter( 'wx', dtype='float64', @@ -151,88 +144,11 @@ def new_particle(): default=0 ) function.addParameter( - 'polyt', - dtype='float64', - direction=function.IN, - description='The particle polytropic index', - default=0 - ) - function.addParameter( - 'kaps', - dtype='float64', - direction=function.IN, - description='The particle 2nd degree love number (apsidal constant)', - default=0 - ) - function.addParameter( - 'inert', - dtype='float64', - direction=function.IN, - description='The particle intertia', - default=0 - ) - function.addParameter( - 'taulag', - dtype='float64', - direction=function.IN, - description='The particle time lag', - default=0, - ) - function.addParameter( - 'taumigx', - dtype='float64', - direction=function.IN, - description='The particle migration timescale', - default=np.inf, - ) - function.addParameter( - 'taumigy', - dtype='float64', - direction=function.IN, - description='The particle migration timescale', - default=np.inf, - ) - function.addParameter( - 'taumigz', - dtype='float64', - direction=function.IN, - description='The particle migration timescale', - default=np.inf, - ) - function.addParameter( - 'eloss', - dtype='float64', - direction=function.IN, - description='The particle energy loss', - default=0, - ) - function.addParameter( - 'haspn', - dtype='bool', - direction=function.IN, - description='Enable post-Newtonian corrections for this particle', - default=False, - ) - function.addParameter( - 'hastide', - dtype='bool', - direction=function.IN, - description='Enable tidal interactions for this particle', - default=False, - ) - function.addParameter( - 'sigmadiss', - dtype='float64', - direction=function.IN, - description='', # FIXME - default=0, - ) - function.addParameter( - 'Atide', - dtype='float64', + 'stype', + dtype='int32', direction=function.IN, - description='', # FIXME - default=0, + description='The physical type of the particle', + default=TsunamiPtype.UNCLASSIFIED, ) function.result_type = 'int32' function.can_handle_array = True From 0ca63f1b6a04ec5d618ec845c1c0581c1619e0d1 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 13 Feb 2026 15:54:45 +0100 Subject: [PATCH 006/132] defined a tsunami.new_particle and .commit_particles in interface.cc using a buffer --- src/amuse_tsunami/interface.cc | 87 +++++++++++++++++++++++++++++----- src/amuse_tsunami/interface.py | 4 +- 2 files changed, 77 insertions(+), 14 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index 264d9e67cc..69e6e02c83 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -1,16 +1,32 @@ -#include "tsunami_worker.h" +#include #include +#include "tsunami_worker.h" + // AMUSE STOPPING CONDITIONS SUPPORT #include #include +#include +#include "chain.hpp" +#include "custom_types.hpp" #include "tsunami.hpp" static TsunamiCode Tsunami; int particle_id_counter = 0; +struct ParticleData { + double mass; + double pos[3]; + double vel[3]; + double radius; + double spin[3]; + long stype; +}; +std::vector particle_buffer; +std::vector particle_storage; + /** * Define a new particle in the stellar dynamics code. The particle is @@ -30,26 +46,73 @@ int new_particle( double wx, double wy, double wz, - int stype, + long stype, ) { if (!index_of_the_particle) return -1; - int Npar = Tsunami.System.pos.size() + ParticleData p; + p.mass = mass; + p.pos[0] = x; + p.pos[1] = y; + p.pos[2] = z; + p.vel[0] = vx; + p.vel[1] = vy; + p.vel[2] = vz; + p.radius = radius; + p.spin[0] = wx; + p.spin[1] = wy; + p.spin[2] = wz; + p.stype = static_cast(stype); + particle_buffer.push_back(p); + *index_of_the_particle = particle_id_counter; + particle_id_counter++; + return 0; +} +/** + * Insert the particles from the buffer into the + */ +int buffer_to_particle_storage() { + particle_storage.insert( + particle_storage.end(), + particle_buffer.begin(), + particle_buffer.end() + ); + particle_buffer.clear(); +} - std::vector& bodies = tidymess.bodies; +int commit_particles() { - Body newbody( - mass, radius, xi, kf, tau, a_mb, - wx, wy, wz, x, y, z, vx, vy, vz - ); + size_t N = particle_storage.size(); - newbody.set_id(particle_id_counter); + std::vector pos(3*N); + std::vector vel(3*N); + std::vector mass(N); + std::vector radius(N); + std::vector stype(N); - *index_of_the_particle = particle_id_counter; - particle_id_counter++; + for (size_t n = 0; n < N; n++) { + pos[3*n] = particle_storage[n].pos[0]; + pos[3*n+1] = particle_storage[n].pos[1]; + pos[3*n+2] = particle_storage[n].pos[2]; + + vel[3*n] = particle_storage[n].vel[0]; + vel[3*n+1] = particle_storage[n].vel[1]; + vel[3*n+2] = particle_storage[n].vel[2]; + + mass[n] = particle_storage[n].mass; + radius[n] = particle_storage[n].radius; + stype[n] = particle_storage[n].stype; + } + + Tsunami.add_particle_set( + pos.data(), N, 3, + vel.data(), N, 3, + mass.data(), N, + radius.data(), N, + stype.data(), N + ); - bodies.push_back(newbody); return 0; } diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index e51763d035..958971008b 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -145,10 +145,10 @@ def new_particle(): ) function.addParameter( 'stype', - dtype='int32', + dtype='float64', direction=function.IN, description='The physical type of the particle', - default=TsunamiPtype.UNCLASSIFIED, + default=0 ) function.result_type = 'int32' function.can_handle_array = True From c0786fdd4ccfb27d6ae288ef39aac0d252c7088a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 16 Feb 2026 15:45:47 +0100 Subject: [PATCH 007/132] cleaned up Tsunami new_particle in interface.cc --- src/amuse_tsunami/interface.cc | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index 69e6e02c83..d6d35cb5fd 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -25,12 +25,13 @@ struct ParticleData { long stype; }; std::vector particle_buffer; -std::vector particle_storage; - /** - * Define a new particle in the stellar dynamics code. The particle is - * initialized with the provided mass, radius, position and velocity. + * Define a new particle within Tsunami, initialized with the + * provided mass, radius, position, velocity, spin, and particle type. + * The particle type at the moment does nothing and is just 0 of type double. + * In the future, it seems stype could be used to specify a particle as a + * specific astronomical object, however this has not been implemented yet. * This function returns an index that can be used to refer to this particle. */ int new_particle( @@ -46,23 +47,18 @@ int new_particle( double wx, double wy, double wz, - long stype, + long stype ) { if (!index_of_the_particle) return -1; - ParticleData p; - p.mass = mass; - p.pos[0] = x; - p.pos[1] = y; - p.pos[2] = z; - p.vel[0] = vx; - p.vel[1] = vy; - p.vel[2] = vz; - p.radius = radius; - p.spin[0] = wx; - p.spin[1] = wy; - p.spin[2] = wz; - p.stype = static_cast(stype); + ParticleData p = { + mass, + {x, y, z}, + {vx, vy, vz}, + radius, + {wx, wy, wz}, + stype + }; particle_buffer.push_back(p); *index_of_the_particle = particle_id_counter; From 68383e2d196f314d2c1af8bfddbbe3d852c6e7e8 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 16 Feb 2026 15:59:01 +0100 Subject: [PATCH 008/132] def commit_particles Tsunami interface.cc, which copies particles from new_particle buffer into Tsunami, while taking into account previously commited particles --- src/amuse_tsunami/interface.cc | 100 +++++++++++++++++++++++---------- 1 file changed, 69 insertions(+), 31 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index d6d35cb5fd..3da3790f5e 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -66,49 +66,87 @@ int new_particle( return 0; } + /** - * Insert the particles from the buffer into the + * Commits all new particles into Tsunami + * + * Pre-existing particles along any new particles added to + * the buffer are copied into a set of arrays and passed to + * Tsunami.add_particle_set which reallocates all the arrays + * within Tsunami and copies the particles over. */ -int buffer_to_particle_storage() { - particle_storage.insert( - particle_storage.end(), - particle_buffer.begin(), - particle_buffer.end() - ); - particle_buffer.clear(); -} - int commit_particles() { - size_t N = particle_storage.size(); + size_t N_existing = Tsunami.System.Nparts; + size_t N_new = particle_buffer.size(); + size_t N_total = N_existing + N_new; + + // no new particles + if (N_new == 0) { + return 0; + } + // not enough particles to commit + if (N_total < 2) { + return -1; + } + + // preallocate vectors + std::vector pos(3 * N_total); + std::vector vel(3 * N_total); + std::vector spin(3 * N_total); + std::vector mass(N_total); + std::vector radius(N_total); + std::vector stype(N_total); + + for (size_t i = 0; i < N_existing; i++) { + pos[3*i] = Tsunami.System.pos[i].x; + pos[3*i + 1] = Tsunami.System.pos[i].y; + pos[3*i + 2] = Tsunami.System.pos[i].z; + + vel[3*i] = Tsunami.System.vel[i].x; + vel[3*i + 1] = Tsunami.System.vel[i].y; + vel[3*i + 2] = Tsunami.System.vel[i].z; + + spin[3*i] = Tsunami.System.spin[i][0]; + spin[3*i + 1] = Tsunami.System.spin[i][1]; + spin[3*i + 2] = Tsunami.System.spin[i][2]; - std::vector pos(3*N); - std::vector vel(3*N); - std::vector mass(N); - std::vector radius(N); - std::vector stype(N); + mass[i] = Tsunami.System.mass[i]; + radius[i] = Tsunami.System.radius[i]; + stype[i] = static_cast(Tsunami.System.xdata[i].stype); - for (size_t n = 0; n < N; n++) { - pos[3*n] = particle_storage[n].pos[0]; - pos[3*n+1] = particle_storage[n].pos[1]; - pos[3*n+2] = particle_storage[n].pos[2]; + } + for (size_t i = 0; i < N_new; i++) { + size_t idx = N_existing + i; + const ParticleData& p = particle_buffer[i]; + + pos[3*idx] = p.pos[0]; + pos[3*idx + 1] = p.pos[1]; + pos[3*idx + 2] = p.pos[2]; - vel[3*n] = particle_storage[n].vel[0]; - vel[3*n+1] = particle_storage[n].vel[1]; - vel[3*n+2] = particle_storage[n].vel[2]; + vel[3*idx] = p.vel[0]; + vel[3*idx + 1] = p.vel[1]; + vel[3*idx + 2] = p.vel[2]; - mass[n] = particle_storage[n].mass; - radius[n] = particle_storage[n].radius; - stype[n] = particle_storage[n].stype; + spin[3*idx] = p.spin[0]; + spin[3*idx + 1] = p.spin[1]; + spin[3*idx + 2] = p.spin[2]; + + mass[idx] = p.mass; + radius[idx] = p.radius; + stype[idx] = p.stype; } Tsunami.add_particle_set( - pos.data(), N, 3, - vel.data(), N, 3, - mass.data(), N, - radius.data(), N, - stype.data(), N + pos.data(), N_total, 3, + vel.data(), N_total, 3, + mass.data(), N_total, + radius.data(), N_total, + stype.data(), N_total, + spin.data(), N_total, 3 ); + // clear particle buffer + particle_buffer.clear(); return 0; } From 44a43e83661551f3607562384dbe3f9965d401ef Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 16 Feb 2026 16:01:41 +0100 Subject: [PATCH 009/132] defined new_particle in Tsunami interface.py --- src/amuse_tsunami/interface.py | 57 +++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 958971008b..0b31d64647 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -154,32 +154,26 @@ def new_particle(): function.can_handle_array = True return function - @legacy_function - def echo_int(): - function = LegacyFunctionSpecification() - function.addParameter('int_in', dtype='int32', direction=function.IN, unit=None) - function.addParameter('int_out', dtype='int32', direction=function.OUT, unit=None) - function.result_type = 'int32' - function.can_handle_array = True - return function - # optionally, this can be shortened to: - - # @remote_function(can_handle_array=True) - # def echo_int(int_in='i'): - # returns (int_out='i') - - -class Tsunami(InCodeComponentImplementation): +class Tsunami(GravitationalDynamics, GravityFieldCode): """One line description of this code Some more details about what it does, any special features it has beyond the standard interfaces, and anything else the user needs to know. """ - def __init__(self, **options): - """Create a tsunami instance to run simulations with.""" + def __init__(self, convert_nbody=None, **options): + """Create a Tsunami instance to run simulations with.""" super().__init__(self, TsunamiInterface(**options), **options) + legacy_interface = TsunamiInterface(**options) + + GravitationalDynamics.__init__( + self, + legacy_interface, + convert_nbody, + **options + ) + # the following alternative __init__ is appropiate for codes that use an unspecified # unit system (i.e. the quantities have dimension but no definite scale) # @@ -206,6 +200,33 @@ def define_properties(self, handler): # handler.add_property('name_of_the_getter', public_name="name_of_the_property") pass + def define_methods(self, handler): + """ + Map legacy functions in TsunamiInterface into + Tsunami user methods. + """ + + GravitationalDynamics.define_methods(self, handler) + + handler.add_method( + 'new_particle', + ( + generic_unit_system.mass, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.length, # radius + 1 / generic_unit_system.time, # wx + 1 / generic_unit_system.time, # wy + 1 / generic_unit_system.time, # wz + handler.NO_UNIT, # stype + ), + (handler.INDEX, handler.ERROR_CODE) + ) + def define_parameters(self, handler): """Define model parameters. From 8ef1287c5246b3501c0ec05074c59f54eea9d9ad Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 17 Feb 2026 15:15:54 +0100 Subject: [PATCH 010/132] Tsunami interface.cc get/set_state --- src/amuse_tsunami/interface.cc | 88 ++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index 3da3790f5e..8ed049a35a 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -150,3 +150,91 @@ int commit_particles() { return 0; } + +/** + * Get state of a particle + */ +int get_state( + int index_of_the_particle, + double* mass, + double* x, + double* y, + double* z, + double* vx, + double* vy, + double* vz, + double* radius, + double* wx, + double* wy, + double* wz, + long* stype +) { + if (!mass || !x || !y || !z || !vx || !vy || !vz || + !radius || !wx || !wy || !wz || !stype) return -1; + + ChainSys& system = Tsunami.System; + + if (index_of_the_particle < 0 || + index_of_the_particle >= static_cast(system.Npart)) + return -1; + + *x = system.pos[index_of_the_particle].x; + *y = system.pos[index_of_the_particle].y; + *z = system.pos[index_of_the_particle].z; + + *vx = system.vel[index_of_the_particle].x; + *vy = system.vel[index_of_the_particle].y; + *vz = system.vel[index_of_the_particle].z; + + *wx = system.spin[index_of_the_particle][0]; + *wy = system.spin[index_of_the_particle][1]; + *wz = system.spin[index_of_the_particle][2]; + + *mass = system.mass[index_of_the_particle]; + *radius = system.radius[index_of_the_particle]; + *stype = static_cast(system.xdata[index_of_the_particle].stype); + + return 0; +} +/** + * Set state of a particle + */ +int set_state( + int index_of_the_particle, + double mass, + double x, + double y, + double z, + double vx, + double vy, + double vz, + double radius, + double wx, + double wy, + double wz, + long stype +) { + ChainSys& system = Tsunami.System; + + if (index_of_the_particle < 0 || + index_of_the_particle >= static_cast(system.Npart)) + return -1; + + system.pos[index_of_the_particle].x = x; + system.pos[index_of_the_particle].y = y; + system.pos[index_of_the_particle].z = z; + + system.vel[index_of_the_particle].x = x; + system.vel[index_of_the_particle].y = y; + system.vel[index_of_the_particle].z = z; + + system.spin[index_of_the_particle][0] = wx; + system.spin[index_of_the_particle][1] = wy; + system.spin[index_of_the_particle][2] = wz; + + system.mass[index_of_the_particle] = mass; + system.radius[index_of_the_particle] = radius; + system.xdata[index_of_the_particle].stype = static_cast(stype); + + return 0; +} From 7f652e78b3d902a0c23e2b0c2a1ded29c513a3aa Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 17 Feb 2026 15:44:05 +0100 Subject: [PATCH 011/132] Tsunami interface.cc def index_within_bounds to check that an index_of_the_particle exists inside Tsunami --- src/amuse_tsunami/interface.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index 8ed049a35a..3d9ebfcb0b 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -26,6 +26,20 @@ struct ParticleData { }; std::vector particle_buffer; + +/** + * Check that the index_of_the_particle points to + * an actual particle inside of Tsunami + */ +inline bool index_in_bounds(int index_of_the_particle) +{ + const ChainSys& system = Tsunami.System; + + return index_of_the_particle >= 0 && + index_of_the_particle < static_cast(system.Npart); +} + + /** * Define a new particle within Tsunami, initialized with the * provided mass, radius, position, velocity, spin, and particle type. From ae8694fd28984313d9ebf8ea333ff07e035ba273 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 17 Feb 2026 15:44:53 +0100 Subject: [PATCH 012/132] refactored Tsunami interface.cc fns to use index_in_bounds --- src/amuse_tsunami/interface.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index 3d9ebfcb0b..b16dc66efc 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -96,13 +96,11 @@ int commit_particles() { size_t N_total = N_existing + N_new; // no new particles - if (N_new == 0) { + if (N_new == 0) return 0; - } // not enough particles to commit - if (N_total < 2) { + if (N_total < 2) return -1; - } // preallocate vectors std::vector pos(3 * N_total); @@ -188,8 +186,7 @@ int get_state( ChainSys& system = Tsunami.System; - if (index_of_the_particle < 0 || - index_of_the_particle >= static_cast(system.Npart)) + if (!index_in_bounds(index_of_the_particle)) return -1; *x = system.pos[index_of_the_particle].x; @@ -230,8 +227,7 @@ int set_state( ) { ChainSys& system = Tsunami.System; - if (index_of_the_particle < 0 || - index_of_the_particle >= static_cast(system.Npart)) + if (!index_in_bounds(index_of_the_particle)) return -1; system.pos[index_of_the_particle].x = x; From 71a36975b7e8cd01eba35ba1b0dd42516da353c7 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 17 Feb 2026 15:45:21 +0100 Subject: [PATCH 013/132] def get/set_mass and get/set_radius Tsunami interface.cc --- src/amuse_tsunami/interface.cc | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index b16dc66efc..f273d2cca6 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -248,3 +248,63 @@ int set_state( return 0; } + +/** + * Get mass of a particle + */ +int get_mass(int index_of_the_particle, double* mass) { + if (!mass) return -1; + + ChainSys& system = Tsunami.System; + + if (!index_in_bounds(index_of_the_particle)) + return -1; + + *mass = system.mass[index_of_the_particle]; + + return 0; +} +/** + * Set mass of a particle + */ +int set_mass(int index_of_the_particle, double mass) { + + ChainSys& system = Tsunami.System; + + if (!index_in_bounds(index_of_the_particle)) + return -1; + + system.mass[index_of_the_particle] = mass; + + return 0; +} + +/** + * Get radius of a particle + */ +int get_radius(int index_of_the_particle, double* radius) { + if (!radius) return -1; + + ChainSys& system = Tsunami.System; + + if (!index_in_bounds(index_of_the_particle)) + return -1; + + *radius = system.radius[index_of_the_particle]; + + return 0; +} +/** + * Set radius of a particle + */ +int set_radius(int index_of_the_particle, double radius) { + + ChainSys& system = Tsunami.System; + + if (!index_in_bounds(index_of_the_particle)) + return -1; + + system.radius[index_of_the_particle] = radius; + + return 0; +} From ed7495b9f4cd69a8bc50fb6de4ea5247ce133770 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 17 Feb 2026 15:49:42 +0100 Subject: [PATCH 014/132] Tsunami interface.cc def get/set_position --- src/amuse_tsunami/interface.cc | 35 ++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index f273d2cca6..a49c166a1a 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -268,7 +268,6 @@ int get_mass(int index_of_the_particle, double* mass) { * Set mass of a particle */ int set_mass(int index_of_the_particle, double mass) { - ChainSys& system = Tsunami.System; if (!index_in_bounds(index_of_the_particle)) @@ -298,7 +297,6 @@ int get_radius(int index_of_the_particle, double* radius) { * Set radius of a particle */ int set_radius(int index_of_the_particle, double radius) { - ChainSys& system = Tsunami.System; if (!index_in_bounds(index_of_the_particle)) @@ -308,3 +306,36 @@ int set_radius(int index_of_the_particle, double radius) { return 0; } + +/** + * Get position of a particle + */ +int get_position(int index_of_the_particle, double* x, double* y, double* z) { + if (!x || !y || !z) return -1; + + ChainSys& system = Tsunami.System; + + if (!index_in_bounds(index_of_the_particle)) + return -1; + + *x = system.pos[index_of_the_particle].x; + *y = system.pos[index_of_the_particle].y; + *z = system.pos[index_of_the_particle].z; + + return 0; +} +/** + * Set position of a particle + */ + int set_position(int index_of_the_particle, double x, double y, double z) { + ChainSys& system = Tsunami.System; + + if (!index_in_bounds(index_of_the_particle)) + return -1; + + system.pos[index_of_the_particle].x = x; + system.pos[index_of_the_particle].y = y; + system.pos[index_of_the_particle].z = z; + + return 0; + } From 30ecf29f1701961599966bc5829a945129b050da Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 17 Feb 2026 15:54:13 +0100 Subject: [PATCH 015/132] Tsunami interface.cc def get/set_velocity and def evolve_model --- src/amuse_tsunami/interface.cc | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index a49c166a1a..035e9edee8 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -339,3 +339,44 @@ int get_position(int index_of_the_particle, double* x, double* y, double* z) { return 0; } + + /** + * Get velocity of a particle + */ + int get_velocity(int index_of_the_particle, double* vx, double* vy, double* vz) { + if (!vx || !vy || !vz) return -1; + + ChainSys& system = Tsunami.System; + + if (!index_in_bounds(index_of_the_particle)) + return -1; + + *vx = system.vel[index_of_the_particle].x; + *vy = system.vel[index_of_the_particle].y; + *vz = system.vel[index_of_the_particle].z; + + return 0; + } + /** + * Set velocity of a particle + */ + int set_velocity(int index_of_the_particle, double vx, double vy, double vz) { + ChainSys& system = Tsunami.System; + + if (!index_in_bounds(index_of_the_particle)) + return -1; + + system.vel[index_of_the_particle].x = vx; + system.vel[index_of_the_particle].y = vy; + system.vel[index_of_the_particle].z = vz; + + return 0; + } + +/** + * Evolve Tsunami system + */ + int evolve_model(double time) { + Tsunami.evolve_system(time); + return 0; + } From 77e56a8710ff69e092568471e0651ff1b381ae9b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 17 Feb 2026 16:41:17 +0100 Subject: [PATCH 016/132] added try catch to Tsunami evolve_system interface.cc --- src/amuse_tsunami/interface.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index 035e9edee8..4c031c0c30 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -10,6 +10,7 @@ #include "chain.hpp" #include "custom_types.hpp" +#include "errhand.hpp" #include "tsunami.hpp" static TsunamiCode Tsunami; @@ -377,6 +378,11 @@ int get_position(int index_of_the_particle, double* x, double* y, double* z) { * Evolve Tsunami system */ int evolve_model(double time) { - Tsunami.evolve_system(time); - return 0; - } + try { + Tsunami.evolve_system(time); + return 0; + } catch (const TsuError& e) { //FIXME + std::cerr << "evolve_model error: " << e.what() << std::endl; + return -1; + } +} From 5df88318ffc8de1a7cd4c4938ab3edb665f2905c Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 20 Feb 2026 12:57:07 +0100 Subject: [PATCH 017/132] def get/set_state, mass, and radius Tsunami interface.py --- src/amuse_tsunami/interface.py | 302 +++++++++++++++++++++++++++++++++ 1 file changed, 302 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 0b31d64647..c85f48743a 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -152,6 +152,308 @@ def new_particle(): ) function.result_type = 'int32' function.can_handle_array = True + function.result_doc = """ + 0 - OK + particle was added to Tsunami + -1 - ERROR + particle could not be added + """ + return function + + @legacy_function + def get_state(): + """ + Retrieve the current state of a particle. The *minimal* information of + a stellar dynamics particle (mass, radius, position and velocity) is + returned. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + "Index of the particle to get the state from. This index must " + "have been returned by an earlier call to :meth:`new_particle`" + ), + ) + function.addParameter( + 'mass', + dtype='float64', + direction=function.OUT, + description='The current mass of the particle', + ) + function.addParameter( + 'x', + dtype='float64', + direction=function.OUT, + description='The current position vector of the particle', + ) + function.addParameter( + 'y', + dtype='float64', + direction=function.OUT, + description='The current position vector of the particle', + ) + function.addParameter( + 'z', + dtype='float64', + direction=function.OUT, + description='The current position vector of the particle', + ) + function.addParameter( + 'vx', + dtype='float64', + direction=function.OUT, + description='The current velocity vector of the particle', + ) + function.addParameter( + 'vy', + dtype='float64', + direction=function.OUT, + description='The current velocity vector of the particle', + ) + function.addParameter( + 'vz', + dtype='float64', + direction=function.OUT, + description='The current velocity vector of the particle', + ) + function.addParameter( + 'radius', + dtype='float64', + direction=function.OUT, + description='The current radius of the particle', + ) + function.addParameter( + 'wx', + dtype='float64', + direction=function.OUT, + description='The current spin of the particle', + ) + function.addParameter( + 'wy', + dtype='float64', + direction=function.OUT, + description='The current spin of the particle', + ) + function.addParameter( + 'wz', + dtype='float64', + direction=function.OUT, + description='The current spin of the particle', + ) + function.addParameter( + 'stype', + dtype='float64', + direction=function.OUT, + description='The particle type', + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + particle was removed from the model + -1 - ERROR + particle could not be found + """ + return function + + @legacy_function + def set_state(): + """ + Update the current state of a particle. The *minimal* information of a + stellar dynamics particle (mass, radius, position and velocity) is + updated. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + "Index of the particle for which the state is to be updated. " + "This index must have been returned by an earlier call to " + ":meth:`new_particle`" + ), + ) + function.addParameter( + 'mass', + dtype='float64', + direction=function.IN, + description='The new mass of the particle', + ) + function.addParameter( + 'x', + dtype='float64', + direction=function.IN, + description='The new position vector of the particle', + ) + function.addParameter( + 'y', + dtype='float64', + direction=function.IN, + description='The new position vector of the particle', + ) + function.addParameter( + 'z', + dtype='float64', + direction=function.IN, + description='The new position vector of the particle', + ) + function.addParameter( + 'vx', + dtype='float64', + direction=function.IN, + description='The new velocity vector of the particle', + ) + function.addParameter( + 'vy', + dtype='float64', + direction=function.IN, + description='The new velocity vector of the particle', + ) + function.addParameter( + 'vz', + dtype='float64', + direction=function.IN, + description='The new velocity vector of the particle', + ) + function.addParameter( + 'radius', + dtype='float64', + direction=function.IN, + description='The new radius of the particle', + default=0, + ) + function.addParameter( + 'wx', + dtype='float64', + direction=function.IN, + description='The current spin of the particle', + ) + function.addParameter( + 'wy', + dtype='float64', + direction=function.IN, + description='The current spin of the particle', + ) + function.addParameter( + 'wz', + dtype='float64', + direction=function.IN, + description='The current spin of the particle', + ) + function.addParameter( + 'stype', + dtype='float64', + direction=function.IN, + description='The particle type', + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + particle was found in the model and the information was set + -1 - ERROR + particle could not be found + """ + return function + + @legacy_function + def get_mass(): + """ + Retrieve the mass of a particle. Mass is a scalar property of a + particle, this function has one OUT argument. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + "Index of the particle to get the state from. This index must " + "have been returned by an earlier call to :meth:`new_particle`" + ), + ) + function.addParameter( + 'mass', + dtype='float64', + direction=function.OUT, + description='The current mass of the particle', + ) + function.result_type = 'int32' + function.can_handle_array = True + function.result_doc = """ + 0 - OK + particle was found and the mass was retrieved + -1 - ERROR + particle could not be found + """ + return function + + @legacy_function + def set_mass(): + """ + Update the mass of a particle. Mass is a scalar property of a particle. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + "Index of the particle for which the state is to be updated. " + "This index must have been returned by an earlier call to " + ":meth:`new_particle`" + ), + ) + function.addParameter( + 'mass', + dtype='float64', + direction=function.IN, + description='The new mass of the particle', + ) + function.result_type = 'int32' + function.can_handle_array = True + function.result_doc = """ + 0 - OK + particle was found in the model and the information was set + -1 - ERROR + particle could not be found + """ + return function + + @legacy_function + def get_radius(): + """ + Retrieve the radius of a particle. Radius is a scalar property of a + particle, this function has one OUT argument. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + "Index of the particle to get the radius of. This index must " + "have been returned by an earlier call to :meth:`new_particle`" + ), + ) + function.addParameter( + 'radius', + dtype='float64', + direction=function.OUT, + description='The current radius of the particle', + ) + function.result_type = 'int32' + function.can_handle_array = True + function.result_doc = """ + 0 - OK + particle was found in the model and the information was retreived + -1 - ERROR + particle could not be found + """ return function From d546309e0e804ce786a2b0c3befcf1c2c634ed3e Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 20 Feb 2026 13:00:46 +0100 Subject: [PATCH 018/132] rm get/set mass, radius Tsunami interface.py since they are inherited with GravitationalDynamicsInterface --- src/amuse_tsunami/interface.py | 96 ---------------------------------- 1 file changed, 96 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index c85f48743a..ecb1c9627f 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -360,102 +360,6 @@ def set_state(): """ return function - @legacy_function - def get_mass(): - """ - Retrieve the mass of a particle. Mass is a scalar property of a - particle, this function has one OUT argument. - """ - function = LegacyFunctionSpecification() - function.addParameter( - 'index_of_the_particle', - dtype='int32', - direction=function.IN, - description=( - "Index of the particle to get the state from. This index must " - "have been returned by an earlier call to :meth:`new_particle`" - ), - ) - function.addParameter( - 'mass', - dtype='float64', - direction=function.OUT, - description='The current mass of the particle', - ) - function.result_type = 'int32' - function.can_handle_array = True - function.result_doc = """ - 0 - OK - particle was found and the mass was retrieved - -1 - ERROR - particle could not be found - """ - return function - - @legacy_function - def set_mass(): - """ - Update the mass of a particle. Mass is a scalar property of a particle. - """ - function = LegacyFunctionSpecification() - function.addParameter( - 'index_of_the_particle', - dtype='int32', - direction=function.IN, - description=( - "Index of the particle for which the state is to be updated. " - "This index must have been returned by an earlier call to " - ":meth:`new_particle`" - ), - ) - function.addParameter( - 'mass', - dtype='float64', - direction=function.IN, - description='The new mass of the particle', - ) - function.result_type = 'int32' - function.can_handle_array = True - function.result_doc = """ - 0 - OK - particle was found in the model and the information was set - -1 - ERROR - particle could not be found - """ - return function - - @legacy_function - def get_radius(): - """ - Retrieve the radius of a particle. Radius is a scalar property of a - particle, this function has one OUT argument. - """ - function = LegacyFunctionSpecification() - function.addParameter( - 'index_of_the_particle', - dtype='int32', - direction=function.IN, - description=( - "Index of the particle to get the radius of. This index must " - "have been returned by an earlier call to :meth:`new_particle`" - ), - ) - function.addParameter( - 'radius', - dtype='float64', - direction=function.OUT, - description='The current radius of the particle', - ) - function.result_type = 'int32' - function.can_handle_array = True - function.result_doc = """ - 0 - OK - particle was found in the model and the information was retreived - -1 - ERROR - particle could not be found - """ - return function - class Tsunami(GravitationalDynamics, GravityFieldCode): """One line description of this code From a9e132d2e6035bfb07412e7d798f806e61d00cf7 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 20 Feb 2026 13:51:44 +0100 Subject: [PATCH 019/132] Tsunami interface.cc def get_total_mass, get_center_of_mass_position, get_center_of_mass_velocity, get_total_radius, get_number_of_particles --- src/amuse_tsunami/interface.cc | 138 +++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index 4c031c0c30..687e74c0dc 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -386,3 +386,141 @@ int get_position(int index_of_the_particle, double* x, double* y, double* z) { return -1; } } + +/** + * Get total mass of all particles in Tsunami + */ +int get_total_mass(double *mass) { + if (!mass) return -1; + + ChainSys& system = Tsunami.System; + double m_total = 0.0; + + for (size_t i = 0; i < system.Nparts; i++) { + m_total += system.mass[i]; + } + *mass = m_total; + + return 0; +} + +/** + * Get position center of mass of all particles + */ +int get_center_of_mass_position(double *x, double *y, double *z) { + if (!x || !y || !z) return -1; + + ChainSys& system = Tsunami.System; + size_t Nparts = system.Nparts; + + if (Nparts == 0) { // FIXME + *x = 0.0; + *y = 0.0; + *z = 0.0; + return 0; + } + + double m_total = 0.0; + double xcom = 0.0; + double ycom = 0.0; + double zcom = 0.0; + + for (size_t i = 0; i < Nparts; i++) { + m_total += system.mass[i]; + xcom += system.mass[i] * system.pos[i].x; + ycom += system.mass[i] * system.pos[i].y; + zcom += system.mass[i] * system.pos[i].z; + } + + if (m_total == 0) + return -1; + + *x = xcom / m_total; + *y = ycom / m_total; + *z = zcom / m_total; + + return 0; +} + +/** + * Get velocity center of mass of all particles + */ +int get_center_of_mass_velocity(double *vx, double *vy, double *vz) { + if (!vx || !vy || !vz) return -1; + + ChainSys& system = Tsunami.System; + size_t Nparts = system.Nparts; + + if (Nparts == 0) { // FIXME + *vx = 0.0; + *vy = 0.0; + *vz = 0.0; + return 0; + } + + double m_total = 0.0; + double vxcom = 0.0; + double vycom = 0.0; + double vzcom = 0.0; + + for (size_t i = 0; i < Nparts; i++) { + m_total += system.mass[i]; + vxcom += system.mass[i] * system.vel[i].x; + vycom += system.mass[i] * system.vel[i].y; + vzcom += system.mass[i] * system.vel[i].z; + } + + if (m_total == 0) + return -1; + + *vx = vxcom / m_total; + *vy = vycom / m_total; + *vz = vzcom / m_total; + + return 0; +} + +/** + * Get the minimum radius of a sphere centered around + * the center of mass of all particles that contains + * every particle within Tsunami + */ +int get_total_radius(double *radius) { + if (!radius) return -1; + + ChainSys& system = Tsunami.System; + double xcom, ycom, zcom; + double rsq_max = 0.0; + + // compute the COM + if (get_center_of_mass_position(&xcom, &ycom, &zcom) != 0) + return -1; + + for (size_t i = 0; i < system.Nparts; i++) { + // compute distance between particle and COM + double dx = system.pos[i].x - xcom; + double dy = system.pos[i].y - ycom; + double dz = system.pos[i].z - zcom; + + double r_sq = dx*dx + dy*dy + dz*dz; + if (rsq_max < r_sq) + rsq_max = r_sq; + } + + *radius = std::sqrt(rsq_max); + return 0; +} + +/** + * Get number of particles in Tsunami + */ +int get_number_of_particles(int* number_of_particles) { + if (!number_of_particles) return -1; + + ChainSys& system = Tsunami.System; + + std::vector pos(3 * N_total) = Tsunami.System.pos; + + *number_of_particles = static_cast(Tsunami.System.Nparts); + return 0; +} From 5f19a00e9f99c3c547e01e6c76e3736e87c17803 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 20 Feb 2026 14:16:45 +0100 Subject: [PATCH 020/132] def get_index_of_particle and _of_next_particle tsunami interface.cc --- src/amuse_tsunami/interface.cc | 43 +++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index 687e74c0dc..2352c09f10 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -399,8 +399,8 @@ int get_total_mass(double *mass) { for (size_t i = 0; i < system.Nparts; i++) { m_total += system.mass[i]; } - *mass = m_total; + *mass = m_total; return 0; } @@ -524,3 +524,44 @@ int get_number_of_particles(int* number_of_particles) { *number_of_particles = static_cast(Tsunami.System.Nparts); return 0; } + +/** + * Get the index of the first particle + */ +int get_index_of_first_particle(int *index_of_the_particle) +{ + if (!index_of_the_particle) + return -1; + + ChainSys& system = Tsunami.System; + + if (system.Nparts == 0) + return -1; + + *index_of_the_particle = 0; + + return 0; +} + +/** + * Get the index of the next particle + * given a particle index + */ +int get_index_of_next_particle( + int index_of_the_particle, + int *index_of_the_next_particle +) { + if (!index_of_the_next_particle) + return -1; + + ChainSys& system = Tsunami.System; + + int next = index_of_the_particle + 1; + + if (next >= (int)system.Nparts) + return -1; + + *index_of_the_next_particle = next; + + return 0; +} From 7f9b95656f6cf024a4ec16a054573fc837b3b8c2 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 20 Feb 2026 14:36:27 +0100 Subject: [PATCH 021/132] fixed tsunami interface.cc bug where Npart was icorrectly labeled as Nparts, and def get_time --- src/amuse_tsunami/interface.cc | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index 2352c09f10..a95d76347d 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -92,7 +92,7 @@ int new_particle( */ int commit_particles() { - size_t N_existing = Tsunami.System.Nparts; + size_t N_existing = Tsunami.System.Npart; size_t N_new = particle_buffer.size(); size_t N_total = N_existing + N_new; @@ -387,6 +387,14 @@ int get_position(int index_of_the_particle, double* x, double* y, double* z) { } } +/** + * Get current simulation timescale in years + */ +int get_time(double *time) { + *time = Tsunami.Tscale; + return 0; +} + /** * Get total mass of all particles in Tsunami */ @@ -396,7 +404,7 @@ int get_total_mass(double *mass) { ChainSys& system = Tsunami.System; double m_total = 0.0; - for (size_t i = 0; i < system.Nparts; i++) { + for (size_t i = 0; i < system.Npart; i++) { m_total += system.mass[i]; } @@ -411,9 +419,9 @@ int get_center_of_mass_position(double *x, double *y, double *z) { if (!x || !y || !z) return -1; ChainSys& system = Tsunami.System; - size_t Nparts = system.Nparts; + size_t Npart = system.Npart; - if (Nparts == 0) { // FIXME + if (Npart == 0) { // FIXME *x = 0.0; *y = 0.0; *z = 0.0; @@ -425,7 +433,7 @@ int get_center_of_mass_position(double *x, double *y, double *z) { double ycom = 0.0; double zcom = 0.0; - for (size_t i = 0; i < Nparts; i++) { + for (size_t i = 0; i < Npart; i++) { m_total += system.mass[i]; xcom += system.mass[i] * system.pos[i].x; ycom += system.mass[i] * system.pos[i].y; @@ -449,9 +457,9 @@ int get_center_of_mass_velocity(double *vx, double *vy, double *vz) { if (!vx || !vy || !vz) return -1; ChainSys& system = Tsunami.System; - size_t Nparts = system.Nparts; + size_t Npart = system.Npart; - if (Nparts == 0) { // FIXME + if (Npart == 0) { // FIXME *vx = 0.0; *vy = 0.0; *vz = 0.0; @@ -463,7 +471,7 @@ int get_center_of_mass_velocity(double *vx, double *vy, double *vz) { double vycom = 0.0; double vzcom = 0.0; - for (size_t i = 0; i < Nparts; i++) { + for (size_t i = 0; i < Npart; i++) { m_total += system.mass[i]; vxcom += system.mass[i] * system.vel[i].x; vycom += system.mass[i] * system.vel[i].y; @@ -496,7 +504,7 @@ int get_total_radius(double *radius) { if (get_center_of_mass_position(&xcom, &ycom, &zcom) != 0) return -1; - for (size_t i = 0; i < system.Nparts; i++) { + for (size_t i = 0; i < system.Npart; i++) { // compute distance between particle and COM double dx = system.pos[i].x - xcom; double dy = system.pos[i].y - ycom; @@ -521,7 +529,7 @@ int get_number_of_particles(int* number_of_particles) { std::vector pos(3 * N_total) = Tsunami.System.pos; - *number_of_particles = static_cast(Tsunami.System.Nparts); + *number_of_particles = static_cast(Tsunami.System.Npart); return 0; } @@ -535,7 +543,7 @@ int get_index_of_first_particle(int *index_of_the_particle) ChainSys& system = Tsunami.System; - if (system.Nparts == 0) + if (system.Npart == 0) return -1; *index_of_the_particle = 0; @@ -558,7 +566,7 @@ int get_index_of_next_particle( int next = index_of_the_particle + 1; - if (next >= (int)system.Nparts) + if (next >= (int)system.Npart) return -1; *index_of_the_next_particle = next; From 38bc8193127aaa4750830092bde1103a7885f166 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 24 Feb 2026 15:21:04 +0100 Subject: [PATCH 022/132] def get_acceleration, def Tsunami configuration params, Tsunami interface.cc --- src/amuse_tsunami/interface.cc | 222 +++++++++++++++++++++++++++------ 1 file changed, 186 insertions(+), 36 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index a95d76347d..e0b9cc0d28 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -1,5 +1,7 @@ +#include #include #include +#include #include "tsunami_worker.h" @@ -328,57 +330,173 @@ int get_position(int index_of_the_particle, double* x, double* y, double* z) { /** * Set position of a particle */ - int set_position(int index_of_the_particle, double x, double y, double z) { - ChainSys& system = Tsunami.System; +int set_position(int index_of_the_particle, double x, double y, double z) { + ChainSys& system = Tsunami.System; + + if (!index_in_bounds(index_of_the_particle)) + return -1; + + system.pos[index_of_the_particle].x = x; + system.pos[index_of_the_particle].y = y; + system.pos[index_of_the_particle].z = z; + + return 0; +} + +/** + * Get velocity of a particle + */ +int get_velocity(int index_of_the_particle, double* vx, double* vy, double* vz) { + if (!vx || !vy || !vz) return -1; + + ChainSys& system = Tsunami.System; + + if (!index_in_bounds(index_of_the_particle)) + return -1; + + *vx = system.vel[index_of_the_particle].x; + *vy = system.vel[index_of_the_particle].y; + *vz = system.vel[index_of_the_particle].z; + + return 0; +} +/** + * Set velocity of a particle + */ +int set_velocity(int index_of_the_particle, double vx, double vy, double vz) { + ChainSys& system = Tsunami.System; + + if (!index_in_bounds(index_of_the_particle)) + return -1; + + system.vel[index_of_the_particle].x = vx; + system.vel[index_of_the_particle].y = vy; + system.vel[index_of_the_particle].z = vz; + + return 0; +} + +/** + * Compute the acceleration onto a particle due to the + * gravitational influence from all other particles + */ +int get_acceleration( + int index_of_the_particle, + double *ax, + double *ay, + double *az +) { + ChainSys& system = Tsunami.System; + int i = index_of_the_particle; + + double ax_i = 0.0; + double ay_i = 0.0; + double az_i = 0.0; + + for (size_t j = i; j < system.Npart; j++) { + if (i == j) continue; + std::tuple, std::array> accel_pair = + Tsunami.get_accelerations_of_particles(i, j); + + const std::array& acc_i = std::get<0>(accel_pair); + + ax_1 += acc_i[0]; + ay_1 += acc_i[1]; + az_1 += acc_i[2]; + } + + *ax = ax_i; + *ay = ay_i; + *az = az_i; + + return 0; +} - if (!index_in_bounds(index_of_the_particle)) - return -1; +/** + * Set Tsunami code units + */ +int set_units(double Mscale, double Lscale) { - system.pos[index_of_the_particle].x = x; - system.pos[index_of_the_particle].y = y; - system.pos[index_of_the_particle].z = z; + Tsunami.set_units(Mscale, Lscale); + return 0; +} + +/** + * Get post-Newtonian correction flag value + * True enables post-Newtonian corrections + */ +int get_wPNs(bool *wPNs) { + if (!wPNs) return -1; - return 0; - } + *wPNs = Tsunami.Conf.wPNs; + return 0; +} +/** + * Set post-Newtonian correction flag value + * True enables post-Newtonian corrections + */ +int set_wPNs(bool wPNs) { + + Tsunami.Conf.wPNs = wPNs; + return 0; +} - /** - * Get velocity of a particle - */ - int get_velocity(int index_of_the_particle, double* vx, double* vy, double* vz) { - if (!vx || !vy || !vz) return -1; +/** + * Get equilibrium tides flag value + * True enables equilibrium tides + */ +int get_wEqTides(bool *wEqTides) { + if (!wEqTides) return -1; - ChainSys& system = Tsunami.System; + *wEqTides = Tsunami.Conf.wEqTides; + return 0; +} +/** + * Set equilibrium tides flag value + * True enables equilibrium tides + */ +int set_wEqTides(bool wEqTides) { - if (!index_in_bounds(index_of_the_particle)) - return -1; + Tsunami.Conf.wEqTides = wEqTides; + return 0; +} - *vx = system.vel[index_of_the_particle].x; - *vy = system.vel[index_of_the_particle].y; - *vz = system.vel[index_of_the_particle].z; +/** + * Get external potential flag value + * True enables external potentials + */ +int get_wExt(bool *wExt) { + if (!wExt) return -1; - return 0; - } - /** - * Set velocity of a particle - */ - int set_velocity(int index_of_the_particle, double vx, double vy, double vz) { - ChainSys& system = Tsunami.System; + *wExt = Tsunami.Conf.wExt; + return 0; +} +/** + * Set external potential flag value + * True enables external potentials + */ +int set_wExt(bool wExt) { - if (!index_in_bounds(index_of_the_particle)) - return -1; + Tsunami.Conf.wExt = wExt; + return 0; +} - system.vel[index_of_the_particle].x = vx; - system.vel[index_of_the_particle].y = vy; - system.vel[index_of_the_particle].z = vz; +/** +* get external potential flag value +* True enables external potentials +*/ +int get_wExt_vdep(bool *wExt_vdep) { + if (!wExt_vdep) return -1; - return 0; - } + *wExt_vdep = Tsunami.Conf.wExt_vdep; + return 0; +} /** * Evolve Tsunami system */ - int evolve_model(double time) { - try { +int evolve_model(double time) { + try { Tsunami.evolve_system(time); return 0; } catch (const TsuError& e) { //FIXME @@ -387,10 +505,42 @@ int get_position(int index_of_the_particle, double* x, double* y, double* z) { } } +/** + * Get total kinetic energy of the system + */ +int get_kinetic_energy(double *kinetic_energy) { + if (!kinetic_energy) return -1; + + *kinetic_energy = Tsunami.kin; + return 0; +} + +/** + * Get total potential energy of the system + */ +int get_potential_energy(double *potential_energy) { + if (!potential_energy) return -1; + + *potential_energy = Tsunami.pot; + return 0; +} + +/** + * Get total energy of the system + */ +int get_total_energy(double *total_energy) { + if (!total_energy) return -1; + + *total_energy = Tsunami.energy; + return 0; +} + /** * Get current simulation timescale in years */ int get_time(double *time) { + if (!time) return -1; + *time = Tsunami.Tscale; return 0; } From b4cd297d21dcc9411b15d98df9766f9a9a659945 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 24 Feb 2026 15:31:20 +0100 Subject: [PATCH 023/132] Tsunami setters and getters for Tsunami.Conf --- src/amuse_tsunami/interface.cc | 193 ++++++++++++++++++++++++++++++++- 1 file changed, 190 insertions(+), 3 deletions(-) diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc index e0b9cc0d28..f52d48b69f 100644 --- a/src/amuse_tsunami/interface.cc +++ b/src/amuse_tsunami/interface.cc @@ -482,15 +482,202 @@ int set_wExt(bool wExt) { } /** -* get external potential flag value -* True enables external potentials -*/ + * get external potential flag value + * True enables external potentials + */ int get_wExt_vdep(bool *wExt_vdep) { if (!wExt_vdep) return -1; *wExt_vdep = Tsunami.Conf.wExt_vdep; return 0; } +/** + * set external potential flag value + * True enables external potentials + */ +int set_wExt_vdep(bool wExt_vdep) { + + Tsunami.Conf.wExt_vdep = wExt_vdep; + return 0; +} + +/** + * get alpha regularization parameter + */ +int get_alpha(double *alpha) { + if (!alpha) return -1; + + *alpha = Tsunami.Config.alpha; + return 0; +} +/** + * set alpha regularization parameter + */ +int set_alpha(double alpha) { + + Tsunami.Config.alpha = alpha; + return 0; +} + +/** + * get beta regularization parameter + */ +int get_beta(double *beta) { + if (!beta) return -1; + + *beta = Tsunami.Config.beta + return 0; +} +/** + * set beta regularization parameter + */ +int set_beta(double beta) { + + Tsunami.Config.beta = beta; + return 0; +} + +/** + * get gamma regularization parameter + */ +int get_gamma(double *gamma) { + if (!gamma) return -1; + + *gamma = Tsunami.Config.gamma + return 0; +} +/** + * set gamma regularization parameter + */ +int set_gamma(double gamma) { + + Tsunami.Config.gamma = gamma; + return 0; +} + +/** + * get multiplying factor for particle radii that is + * used when checking for collisions. A collision + * between two particles is registered whenever: + * d < d_coll * (R1 + R2) + */ +int get_dcoll(double *dcoll) { + if (!dcoll) return -1; + + *dcoll = Tsunami.Config.dcoll + return 0; +} +/** + * set multiplying factor for particle radii that is + * used when checking for collisions. A collision + * between two particles is registered whenever: + * d < d_coll * (R1 + R2) + */ +int set_dcoll(double dcoll) { + + Tsunami.Config.dcoll = dcoll; + return 0; +} + +/** + * get pn1 flag value + * True enables first order post-Newtonian corrections + */ +int get_pn1(double *pn1) { + if (!pn1) return -1; + + *pn1 = Tsunami.Config.pn1 + return 0; +} +/** + * set pn1 flag value + * True enables first order post-Newtonian corrections + */ +int set_pn1(double pn1) { + + Tsunami.Config.pn1 = pn1; + return 0; +} + +/** + * get pn2 flag value + * True enables second order post-Newtonian corrections + */ +int get_pn2(double *pn2) { + if (!pn2) return -1; + + *pn2 = Tsunami.Config.pn2; + return 0; +} +/** + * set pn2 flag value + * True enables second order post-Newtonian corrections + */ +int set_pn2(double pn2) { + + Tsunami.Config.pn2 = pn2; + return 0; +} + +/** + * get pn2 flag value + * True enables 2.5 order post-Newtonian corrections + */ +int get_pn25(double *pn25) { + if (!pn25) return -1; + + *pn25 = Tsunami.Config.pn25; + return 0; +} +/** + * set pn25 flag value + * True enables 2.5 order post-Newtonian corrections + */ +int set_pn25(double pn25) { + + Tsunami.Config.pn25 = pn25; + return 0; +} + +/** + * get pn3 flag value + * True enables third order post-Newtonian corrections + */ +int get_pn3(double *pn3) { + if (!pn3) return -1; + + *pn3 = Tsunami.Config.pn3; + return 0; +} +/** + * set pn3 flag value + * True enables third order post-Newtonian corrections + */ +int set_pn3(double pn3) { + + Tsunami.Config.pn3 = pn3; + return 0; +} + +/** + * get pn35 flag value + * True enables 3.5 order post-Newtonian corrections + */ +int get_pn35(double *pn35) { + if (!pn35) return -1; + + *pn35 = Tsunami.Config.pn35; + return 0; +} +/** + * set pn35 flag value + * True enables 3.5 order post-Newtonian corrections + */ +int set_pn35(double pn35) { + + Tsunami.Config.pn35 = pn35; + return 0; +} /** * Evolve Tsunami system From 5a258ec5dec28277758e0083dfbae1408d6a1687 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 1 Apr 2026 13:09:32 +0200 Subject: [PATCH 024/132] Tsunami config.mk.in --- src/amuse_tsunami/support/config.mk.in | 81 +------------------------- 1 file changed, 1 insertion(+), 80 deletions(-) diff --git a/src/amuse_tsunami/support/config.mk.in b/src/amuse_tsunami/support/config.mk.in index 435d9ce0d4..bf9f3cf40b 100644 --- a/src/amuse_tsunami/support/config.mk.in +++ b/src/amuse_tsunami/support/config.mk.in @@ -1,10 +1,6 @@ # Compilers -##### Remove CC if the code is not in C, uncomment if it is -# CC = @CC@ CXX = @CXX@ -##### Remove MPICC if the code is not in C, uncomment if it is -# MPICC = @MPICC@ MPICXX = @MPICXX@ CPU_COUNT = @CPU_COUNT@ @@ -12,79 +8,4 @@ CPU_COUNT = @CPU_COUNT@ # Tools AR = @AR@ RANLIB = @RANLIB@ -##### Uncomment what you need to download and unpack the code, remove the rest -# DOWNLOAD = @DOWNLOAD@ -# TAR = @TAR@ -# UNZIP = @UNZIP@ -# GUNZIP = @GUNZIP@ -# BUNZIP2 = @BUNZIP2@ -# UNXZ = @UNXZ@ -# PERL = @PERL@ - - -# AMUSE framework libraries -##### Uncomment what you need, remove the rest -# STOPCOND_CFLAGS = @STOPCOND_CFLAGS@ -# STOPCOND_LIBS = @STOPCOND_LIBS@ - -# STOPCONDMPI_CFLAGS = @STOPCONDMPI_CFLAGS@ -# STOPCONDMPI_LIBS = @STOPCONDMPI_LIBS@ - -# AMUSE_MPI_CFLAGS = @AMUSE_MPI_CFLAGS@ -# AMUSE_MPI_LIBS = @AMUSE_MPI_LIBS@ - -# SIMPLE_HASH_CFLAGS = @SIMPLE_HASH_CFLAGS@ -# SIMPLE_HASH_LIBS = @SIMPLE_HASH_LIBS@ - -# G6LIB_CFLAGS = @G6LIB_CFLAGS@ -# G6LIB_LIBS = @G6LIB_LIBS@ - - -# External dependencies -##### Uncomment what you need, remove the rest -# OPENMP_CFLAGS = @OPENMP_CFLAGS@ -# OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ - -# CUDA_TK = @CUDA_TK@ -# NVCC = @NVCC@ -# CUDA_FLAGS = @CUDA_FLAGS@ -# CUDA_LDFLAGS = @CUDA_LDFLAGS@ - -# FOUND_CL = @FOUND_CL@ -# CL_CFLAGS = @CL_CFLAGS@ -# CL_LIBS = @CL_LIBS@ -# HAVE_CL_CL_H = @HAVE_CL_CL_H@ -# HAVE_OPENCL_CL_H = @HAVE_OPENCL_CL_H@ - -# BLAS_LIBS = @BLAS_LIBS@ -# LAPACK_LIBS = @LAPACK_LIBS@ - -# GSL_FLAGS = @GSL_FLAGS@ -# GSL_LIBS = @GSL_LIBS@ - -# FOUND_GMP= @FOUND_GMP@ -# GMP_FLAGS = @GMP_FLAGS@ -# GMP_LIBS = @GMP_LIBS@ - -# FOUND_MPFR = @FOUND_MPFR@ -# MPFR_FLAGS = @MPFR_FLAGS@ -# MPFR_LIBS = @MPFR_LIBS@ - -# FOUND_FFTW = @FOUND_FFTW@ -# FFTW_FLAGS = @FFTW_FLAGS@ -# FFTW_LIBS = @FFTW_LIBS@ - -# HDF5_VERSION = @HDF5_VERSION@ -# HDF5_CFLAGS = @HDF5_CFLAGS@ -# HDF5_CPPFLAGS = @HDF5_CPPFLAGS@ -# HDF5_LDFLAGS = @HDF5_LDFLAGS@ -# HDF5_LIBS = @HDF5_LIBS@ - -# NETCDF4_VERSION = @NETCDF4_VERSION@ -# NETCDF4_CFLAGS = @NETCDF4_CFLAGS@ -# NETCDF4_LDFLAGS = @NETCDF4_LDFLAGS@ -# NETCDF4_LIBS = @NETCDF4_LIBS@ - -# SAPPORO_LIGHT_CFLAGS = @SAPPORO_LIGHT_CFLAGS@ -# SAPPORO_LIGHT_LIBS = @SAPPORO_LIGHT_LIBS@ - +TAR = @TAR@ \ No newline at end of file From 7b480034313fb6ee9dccae620366f5fc899782d4 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 1 Apr 2026 13:09:53 +0200 Subject: [PATCH 025/132] Tsunami configure.ac --- src/amuse_tsunami/support/configure.ac | 56 +------------------------- 1 file changed, 2 insertions(+), 54 deletions(-) diff --git a/src/amuse_tsunami/support/configure.ac b/src/amuse_tsunami/support/configure.ac index 74bfbdce5e..de1e5d8047 100644 --- a/src/amuse_tsunami/support/configure.ac +++ b/src/amuse_tsunami/support/configure.ac @@ -11,13 +11,8 @@ AX_COUNT_CPUS() AC_SUBST(CPU_COUNT) # Find the compiler(s) -##### Remove this if the code is C++-only -# AC_PROG_CC() - -##### This is always needed, also for codes written in C AC_PROG_CXX() - # Find tools for creating static libraries AC_CHECK_TARGET_TOOL([AR], [ar], [:]) AS_IF([test $AR = ":"], [AC_MSG_ERROR([ar command not found.])]) @@ -25,64 +20,17 @@ AS_IF([test $AR = ":"], [AC_MSG_ERROR([ar command not found.])]) AC_PROG_RANLIB() AS_IF([test $RANLIB = ":"], [AC_MSG_ERROR([ranlib command not found.])]) - # Find tools to download and unpack with -# AMUSE_DOWNLOAD() -# AC_CHECK_TOOL(TAR, tar) -# AC_CHECK_TOOL(UNZIP, unzip) -# AC_CHECK_TOOL(GUNZIP, gunzip) -# AC_CHECK_TOOL(BUNZIP2, bunzip2) -# AC_CHECK_TOOL(UNXZ, unxz) -# AC_CHECK_TOOL(PERL, perl) - +AC_CHECK_TOOL(TAR, tar) # Find AMUSE libraries -# AMUSE_LIB_STOPCOND() -# AMUSE_LIB_STOPCONDMPI() -# AMUSE_LIB_AMUSE_MPI() -# AMUSE_LIB_SIMPLE_HASH() -# AMUSE_LIB_G6LIB() -# AMUSE_LIB_SAPPORO_LIGHT() - +AMUSE_LIB_STOPCOND() # Find MPI for the worker AC_LANG_PUSH([C++]) AX_MPI() AC_LANG_POP([C++]) - -# Find external dependencies -##### Pick one of these depending on which language the code is in ##### -# AC_LANG_PUSH([C]) -# AC_LANG_PUSH([C++]) - -##### Remove anything not needed by the code, and uncomment what is needed ##### - -# AX_MPI() - -# AC_OPENMP() -##### Pick one of these depending on which language the code is in ##### -# AC_SUBST(OPENMP_CFLAGS) -# AC_SUBST(OPENMP_CXXFLAGS) - -# AMUSE_CUDA() -# AMUSE_OPENCL() - -# AX_LAPACK() # calls AX_BLAS automatically -# AX_PATH_GSL(1.0, [FOUND_GSL=yes]) -# AX_GMP() -# AX_MPFR() -# AX_FFTW() -# AX_LIB_HDF5() -# AX_LIB_NETCDF4() - -##### End remove anything not needed by the code ##### - -##### Pick one of these depending on which language the code is in ##### -# AC_LANG_POP([C++]) -# AC_LANG_POP([C]) - - # Generate output AC_CONFIG_FILES([config.mk]) AC_OUTPUT From 87aa0d6f1231ced3a2bc9dd95ce29dcbeb3b48f8 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 1 Apr 2026 13:10:32 +0200 Subject: [PATCH 026/132] Tsunami amuse_deps file --- src/amuse_tsunami/packages/amuse-tsunami.amuse_deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse_tsunami/packages/amuse-tsunami.amuse_deps b/src/amuse_tsunami/packages/amuse-tsunami.amuse_deps index e5ab274ccd..35646e5605 100644 --- a/src/amuse_tsunami/packages/amuse-tsunami.amuse_deps +++ b/src/amuse_tsunami/packages/amuse-tsunami.amuse_deps @@ -1 +1 @@ -c c++ fortran java python cmake install download mpi openmp cuda opencl x11 opengl blas lapack gsl gmp mpfr fftw hdf5 netcdf4 +c c++ cmake \ No newline at end of file From 1c0f08d65f9325046b2cef9b8a92112e91ec26cb Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 1 Apr 2026 13:18:03 +0200 Subject: [PATCH 027/132] cleanup amuse tsunami packages folder --- .../packages/amuse-tsunami-PACKAGE.amuse_deps | 1 - .../amuse-tsunami-PACKAGE/pyproject.toml | 40 ------------------- .../packages/amuse-tsunami-PACKAGE/tsunami | 1 - 3 files changed, 42 deletions(-) delete mode 100644 src/amuse_tsunami/packages/amuse-tsunami-PACKAGE.amuse_deps delete mode 100644 src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/pyproject.toml delete mode 120000 src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/tsunami diff --git a/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE.amuse_deps b/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE.amuse_deps deleted file mode 100644 index e5ab274ccd..0000000000 --- a/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE.amuse_deps +++ /dev/null @@ -1 +0,0 @@ -c c++ fortran java python cmake install download mpi openmp cuda opencl x11 opengl blas lapack gsl gmp mpfr fftw hdf5 netcdf4 diff --git a/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/pyproject.toml b/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/pyproject.toml deleted file mode 100644 index c278b6a492..0000000000 --- a/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/pyproject.toml +++ /dev/null @@ -1,40 +0,0 @@ -[project] -name = "amuse-tsunami-PACKAGE" -dynamic = ["version"] -requires-python = ">=3.7" -dependencies = [ - "amuse-framework==2025.9.1.dev23+g38aae9f45.d20251209", - "amuse-tsunami" -] - -[build-system] -requires = ["hatchling", "versioningit"] -build-backend = "hatchling.build" - -[tool.hatch.version] -source = "versioningit" - -[tool.versioningit.next-version] -method = "smallest" - -[tool.versioningit.format] -distance = "{next_version}.dev{distance}+{vcs}{rev}" -dirty = "{base_version}+d{build_date:%Y%m%d}" -distance-dirty = "{next_version}.dev{distance}+{vcs}{rev}.d{build_date:%Y%m%d}" - -[tool.versioningit.vcs] -method = { module = "version_helper", value = "get_amuse_version", module-dir = "amuse_tsunami/support/shared" } - -[tool.hatch.build] -skip-excluded-dirs = true - -[tool.hatch.build.targets.wheel] -include = ["amuse_tsunami"] -exclude = ["amuse_tsunami/*"] -artifacts = ["amuse_tsunami/tsunami_PACKAGE_worker"] - -[tool.pytest.ini_options] -pythonpath = ["amuse_tsunami/tests/", "../../../../../tests"] - -testpaths = ["amuse_tsunami/tests"] - diff --git a/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/tsunami b/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/tsunami deleted file mode 120000 index c25bddb6dd..0000000000 --- a/src/amuse_tsunami/packages/amuse-tsunami-PACKAGE/tsunami +++ /dev/null @@ -1 +0,0 @@ -../.. \ No newline at end of file From 8b82ca44190244f808b3655b49df5529beadb923 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 1 Apr 2026 16:36:16 +0200 Subject: [PATCH 028/132] cleaned up tsunami interface.py --- src/amuse_tsunami/interface.py | 22 ++++++++++++++++------ src/amuse_tsunami/src/tsunami.cc | 7 ------- 2 files changed, 16 insertions(+), 13 deletions(-) delete mode 100644 src/amuse_tsunami/src/tsunami.cc diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index ecb1c9627f..63d824b596 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1,18 +1,28 @@ from enum import IntEnum import numpy as np from amuse.support.interface import InCodeComponentImplementation -from amuse.community.interface.gd import GravitationalDynamics -from amuse.community.interface.gd import GravitationalDynamicsInterface -from amuse.community.interface.gd import GravityFieldInterface -from amuse.community.interface.gd import GravityFieldCode -from amuse.community.interface.stopping_conditions import StoppingConditions, StoppingConditionInterface -from amuse.rfi.core import CodeInterface, legacy_function, LegacyFunctionSpecification +from amuse.community.interface.gd import ( + GravitationalDynamics, + GravitationalDynamicsInterface, + GravityFieldCode, + GravityFieldInterface +) +from amuse.community.interface.stopping_conditions import ( + StoppingConditions, + StoppingConditionInterface +) +from amuse.rfi.core import ( + CodeInterface, + LegacyFunctionSpecification, + legacy_function +) from amuse.support.interface import MethodWithUnitsDefinition from amuse.support.literature import LiteratureReferencesMixIn from amuse.units import generic_unit_system, nbody_system class TsunamiPtype(IntEnum): + """This feature seems to be still in active development""" LOW_MASS_MS = 0 HIGH_MASS_MS = 1 HGAP = 2 diff --git a/src/amuse_tsunami/src/tsunami.cc b/src/amuse_tsunami/src/tsunami.cc deleted file mode 100644 index 0deb6d1f90..0000000000 --- a/src/amuse_tsunami/src/tsunami.cc +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Example function for a code - */ -int echo(int input) { - return input; -} - From 5e1ca02cc7710f2b4b54010623345887cdb8e14e Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 1 Apr 2026 16:37:04 +0200 Subject: [PATCH 029/132] def __init__.py and interface.py for tsunami in amuse/community --- src/amuse/community/tsunami/__init__.py | 1 + src/amuse/community/tsunami/interface.py | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 src/amuse/community/tsunami/__init__.py create mode 100644 src/amuse/community/tsunami/interface.py diff --git a/src/amuse/community/tsunami/__init__.py b/src/amuse/community/tsunami/__init__.py new file mode 100644 index 0000000000..c6e1df9a04 --- /dev/null +++ b/src/amuse/community/tsunami/__init__.py @@ -0,0 +1 @@ +from .interface import Tsunami diff --git a/src/amuse/community/tsunami/interface.py b/src/amuse/community/tsunami/interface.py new file mode 100644 index 0000000000..e3c5f07df4 --- /dev/null +++ b/src/amuse/community/tsunami/interface.py @@ -0,0 +1,4 @@ +from amuse.support.import_helper import load_code + +TsunamiInterface = load_code('tsunami', 'TsunamiInterface') +Tsunami = load_code('tsunami', 'Tsunami') From e281a814db975490aa870944fc7234ae548ce732 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 1 Apr 2026 16:50:58 +0200 Subject: [PATCH 030/132] fixed makefile and interface.py typo amuse_tsunami --- src/amuse_tsunami/Makefile | 4 ++-- src/amuse_tsunami/interface.py | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/amuse_tsunami/Makefile b/src/amuse_tsunami/Makefile index 4ef8d97a3a..cecd288a52 100644 --- a/src/amuse_tsunami/Makefile +++ b/src/amuse_tsunami/Makefile @@ -80,10 +80,10 @@ $(CODELIB): | src # Building the workers tsunami_worker.h: interface.py - amusifier --type=h interface.py tsunamiInterface -o $@ + amusifier --type=h interface.py TsunamiInterface -o $@ tsunami_worker.cc: interface.py - amusifier --type=c interface.py tsunamiInterface -o $@ + amusifier --type=c interface.py TsunamiInterface -o $@ tsunami_worker.o: tsunami_worker.cc tsunami_worker.h $(MPICXX) -c -o $@ $(CFLAGS) $< diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 63d824b596..6e0acb8a35 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -335,7 +335,6 @@ def set_state(): dtype='float64', direction=function.IN, description='The new radius of the particle', - default=0, ) function.addParameter( 'wx', From 4786aac117b0230b820ec83d54af48ef14fca722 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 7 Apr 2026 11:08:29 +0200 Subject: [PATCH 031/132] tsunami cleanup --- src/amuse_tsunami/interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 6e0acb8a35..57fbd30249 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -63,9 +63,9 @@ class TsunamiInterface( include_headers = ['tsunami_worker.h', 'stopcond.h'] - def __init__(self, **keyword_arguments): + def __init__(self, **kwargs): CodeInterface.__init__( - self, name_of_the_worker='tsunami_worker', **keyword_arguments + self, name_of_the_worker='tsunami_worker', **kwargs ) LiteratureReferencesMixIn.__init__(self) From 4653812d18ad555ff16ba679a5e46215e817b780 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 9 Apr 2026 11:19:26 +0200 Subject: [PATCH 032/132] fixed amuse_tsunami Makefile --- src/amuse_tsunami/Makefile | 107 +++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 59 deletions(-) diff --git a/src/amuse_tsunami/Makefile b/src/amuse_tsunami/Makefile index cecd288a52..417fc7acde 100644 --- a/src/amuse_tsunami/Makefile +++ b/src/amuse_tsunami/Makefile @@ -2,81 +2,69 @@ ifneq (,$(filter-out clean distclean, $(MAKECMDGOALS))) include support/config.mk endif - # Detecting dependencies support/config.mk: cd support && ./configure - -# Downloading the code -##### Remove if not needed ##### -VERSION = VERSION - tsunami.tar.gz: - ##### Modify URL as needed ##### - $(DOWNLOAD) https://github.com/tsunami/tsunami/archive/$(VERSION).tar.gz >$@ + @echo "Add message here" -PATCHES := $(shell cat patches/series) +# PATCHES := $(shell cat patches/series) -src/tsunami-$(VERSION): tsunami.tar.gz +src/tsunami-master: | tsunami.tar.gz ##### Modify as needed ##### tar xf $< - mv tsunami-$(VERSION) src - ##### Apply patches here, if needed ##### - patch Date: Mon, 20 Apr 2026 10:58:00 +0200 Subject: [PATCH 033/132] fixed Tsunami interface to compile the python api instead --- src/amuse_tsunami/Makefile | 92 +++++++++----------------------------- 1 file changed, 22 insertions(+), 70 deletions(-) diff --git a/src/amuse_tsunami/Makefile b/src/amuse_tsunami/Makefile index 417fc7acde..7d5c44f1d9 100644 --- a/src/amuse_tsunami/Makefile +++ b/src/amuse_tsunami/Makefile @@ -9,95 +9,48 @@ support/config.mk: tsunami.tar.gz: @echo "Add message here" -# PATCHES := $(shell cat patches/series) src/tsunami-master: | tsunami.tar.gz - ##### Modify as needed ##### - tar xf $< + # tar xf $< + tar xf tsunami.tar.gz # FIXME mv tsunami-master src/ - # ##### Apply patches here, if needed ##### - # patch Date: Mon, 20 Apr 2026 10:59:26 +0200 Subject: [PATCH 034/132] class TsunamiImplementation to replace interface.cc --- src/amuse_tsunami/interface.py | 103 ++++++++++++++++++++++++++------- 1 file changed, 81 insertions(+), 22 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 57fbd30249..74af072e0b 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -21,28 +21,87 @@ from amuse.units import generic_unit_system, nbody_system -class TsunamiPtype(IntEnum): - """This feature seems to be still in active development""" - LOW_MASS_MS = 0 - HIGH_MASS_MS = 1 - HGAP = 2 - GIANT_BRANCH = 3 - CORE_HE_BURN = 4 - EARLY_AGBe = 5 - TP_AGB = 6 - NAKED_HE = 7 - NAKED_HE_HGAP = 8 - NAKED_HE_GIANT = 9 - HE_WD = 10 - CO_WD = 11 - ONE_WD = 12 - NS = 13 - BH = 14 - # planets - ROCKY = 100 - GAS_GIANT = 101 - # null - UNCLASSIFIED = -1 +class TsunamiImplementation(object): + + def __init__(self): + import tsunami + self.tsunami = tsunami + self._pos: list[list[float]] = [] + self._vel: list[list[float]] = [] + self._spin: list[list[float]] = [] + self._mass: list[float] = [] + self._radius: list[float] = [] + self._stype: list[int] = [] + + def _clear_buffers(self) -> None: + self._pos.clear() + self._vel.clear() + self._spin.clear() + self._mass.clear() + self._radius.clear() + self._stype.clear() + + def initialize_code(self) -> int: + return 0 + + def cleanup_code(self) -> int: + return 0 + + def commit_particles(self) -> int: + """ + Add all particles stored in the particle buffers + into the Tsunami code. Tsunami does not support + adding individual particles and instead requires + preallocated np.ndarrays of particles. + + This method formats all the particles stored in + the buffer and adds them as a particle set to Tsunami + before clearing all the buffers. + """ + if len(self._pos) == 0: + return 0 + + pos = np.asarray(self._pos, dtype=np.float64).reshape(-1, 3) + vel = np.asarray(self._vel, dtype=np.float64).reshape(-1, 3) + spin = np.asarray(self._spin, dtype=np.float64).reshape(-1, 3) + mass = np.asarray(self._mass, dtype=np.float64) + radius = np.asarray(self._radius, dtype=np.float64) + stype = np.asarray(self._radius, dtype=np.int64) + + self.tsunami.add_particle_set( + pos=pos, vel=vel, mass=mass, rad=radius, stype=stype, spin=spin + ) + + self._clear_buffers() + + return 0 + + + def new_particle( + self, + index_of_the_particle: int, + mass: float, + x: float, + y: float, + z: float, + vx: float, + vy: float, + vz: float, + radius: float, + wx: float, + wy: float, + wz: float, + stype: int + ) -> int: + self._pos.append([x, y, z]) + self._vel.append([vx, vy, vz]) + self._mass.append(mass) + self._radius.append(radius) + self._spin.append([wx, wy, wz]) + self._stype.append(stype) + index_of_the_particle = len(self._pos) + + return 0 class TsunamiInterface( CodeInterface, From 8a0ffaf02df0d403f072fbd29a5cfdd859387062 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 20 Apr 2026 11:00:44 +0200 Subject: [PATCH 035/132] fixed incorrect framework version pin in tsunami toml --- src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml b/src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml index 77349f188d..a16d97b159 100644 --- a/src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml +++ b/src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml @@ -5,8 +5,10 @@ version = "0.0.1" # repository # dynamic = ["version"] requires-python = ">=3.7" +# "amuse-framework==2025.9.1.dev23+g38aae9f45.d20251209" FIXME dependencies = [ - "amuse-framework==2025.9.1.dev23+g38aae9f45.d20251209" + "amuse-framework", + "amuse_tsunami" ] [build-system] @@ -44,4 +46,3 @@ artifacts = ["amuse_tsunami/tsunami_worker"] pythonpath = ["amuse_tsunami/tests/"] testpaths = ["amuse_tsunami/tests"] - From 9e46aa90cee26aa21acac406bcadb31017e20b56 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 20 Apr 2026 15:50:29 +0200 Subject: [PATCH 036/132] refactored TsunamiImplementation to have a copy of the internal particles as well as a buffer for staging new particles --- src/amuse_tsunami/interface.py | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 74af072e0b..0875f829ee 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1,5 +1,6 @@ -from enum import IntEnum import numpy as np +from numpy.typing import NDArray + from amuse.support.interface import InCodeComponentImplementation from amuse.community.interface.gd import ( GravitationalDynamics, @@ -25,21 +26,23 @@ class TsunamiImplementation(object): def __init__(self): import tsunami - self.tsunami = tsunami - self._pos: list[list[float]] = [] - self._vel: list[list[float]] = [] - self._spin: list[list[float]] = [] - self._mass: list[float] = [] - self._radius: list[float] = [] - self._stype: list[int] = [] - - def _clear_buffers(self) -> None: - self._pos.clear() - self._vel.clear() - self._spin.clear() - self._mass.clear() - self._radius.clear() - self._stype.clear() + self.tsunami = tsunami.Tsunami() + + # temporary buffers for staging particles + self._pos_list: list[list[float]] = [] + self._vel_list: list[list[float]] = [] + self._spin_list: list[list[float]] = [] + self._mass_list: list[float] = [] + self._radius_list: list[float] = [] + self._stype_list: list[int] = [] + + # commited particles + self._pos: NDArray = np.empty((0, 3), dtype=np.float64) + self._vel: NDArray = np.empty((0, 3), dtype=np.float64) + self._spin: NDArray = np.empty((0, 3), dtype=np.float64) + self._mass: NDArray = np.empty(0, dtype=np.float64) + self._radius: NDArray = np.empty(0, dtype=np.float64) + self._stype: NDArray = np.empty(0, dtype=np.int64) def initialize_code(self) -> int: return 0 From 1bd66e269574039670d5ae08c1be33138e16fd3d Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 20 Apr 2026 15:50:57 +0200 Subject: [PATCH 037/132] tsunamiImplementation def commit_parameters --- src/amuse_tsunami/interface.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 0875f829ee..146aa4e869 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -50,6 +50,11 @@ def initialize_code(self) -> int: def cleanup_code(self) -> int: return 0 + def commit_parameters(self) -> int: + self.tsunami.commit_parameters() + + return 0 + def commit_particles(self) -> int: """ Add all particles stored in the particle buffers From cf0d86982e05468bc068dddcc2d4935009276783 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 20 Apr 2026 16:16:23 +0200 Subject: [PATCH 038/132] def commit_particles, recommit_paramters and recommit_particles in TsunamiImplementation --- src/amuse_tsunami/interface.py | 83 ++++++++++++++++++++++++++++------ 1 file changed, 69 insertions(+), 14 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 146aa4e869..6eba93b898 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -62,28 +62,83 @@ def commit_particles(self) -> int: adding individual particles and instead requires preallocated np.ndarrays of particles. - This method formats all the particles stored in - the buffer and adds them as a particle set to Tsunami - before clearing all the buffers. + This method grabs all pre-existing particles in Tsunami + as well as any particles inside the temporary buffers + and formats them as a particle set to be read by Tsunami. + + Returns + ------- + 0 : If particles were added to Tsunami succesfully or if no + new particles are available to be added + -1 : If less than 2 particles between the pre-existing particles + and the particles in the buffer, or if the shapes of the + particleset arrays dont match. """ - if len(self._pos) == 0: + N_existing: int = self._pos.shape[0] + N_new: int = len(self._pos_list) + N_total: int = N_existing + N_new + + if N_new == 0: return 0 - pos = np.asarray(self._pos, dtype=np.float64).reshape(-1, 3) - vel = np.asarray(self._vel, dtype=np.float64).reshape(-1, 3) - spin = np.asarray(self._spin, dtype=np.float64).reshape(-1, 3) - mass = np.asarray(self._mass, dtype=np.float64) - radius = np.asarray(self._radius, dtype=np.float64) - stype = np.asarray(self._radius, dtype=np.int64) + if N_total < 2: + return -1 + + if not ( + len(self._vel_list) == N_new and + len(self._spin_list) == N_new and + len(self._mass_list) == N_new and + len(self._radius_list) == N_new and + len(self._stype_list) == N_new + ): + return -1 + + # preallocate particleset for Tsunami + pos = np.empty((N_total, 3), dtype=np.float64) + vel = np.empty((N_total, 3), dtype=np.float64) + spin = np.empty((N_total, 3), dtype=np.float64) + mass = np.empty(N_total, dtype=np.float64) + radius = np.empty(N_total, dtype=np.float64) + stype = np.empty(N_total, dtype=np.int64) + + # add any existing Tsunami particles + if N_existing != 0: + pos[:N_existing, :] = self._pos + vel[:N_existing, :] = self._vel + spin[:N_existing, :] = self._spin + mass[:N_existing] = self._mass + radius[:N_existing] = self._radius + stype[:N_existing] = self._stype + + # add new particles + pos[N_existing:, :] = np.asarray(self._pos_list, dtype=np.float64).reshape(-1, 3) + vel[N_existing:, :] = np.asarray(self._vel_list, dtype=np.float64).reshape(-1, 3) + spin[N_existing:, :] = np.asarray(self._spin_list, dtype=np.float64).reshape(-1, 3) + mass[N_existing:] = np.asarray(self._mass_list, dtype=np.float64) + radius[N_existing:] = np.asarray(self._radius_list, dtype=np.float64) + stype[N_existing:] = np.asarray(self._stype_list, dtype=np.int64) + + self.tsunami.add_particle_set(pos, vel, mass, radius, stype, spin) + + self._pos = pos + self._vel = vel + self._spin = spin + self._mass = mass + self._radius = radius + self._stype = stype + self._clear_temporary_particle_buffers() - self.tsunami.add_particle_set( - pos=pos, vel=vel, mass=mass, rad=radius, stype=stype, spin=spin - ) + return 0 - self._clear_buffers() + def recommit_parameters(self) -> int: + self.tsunami.commit_parameters() return 0 + def recommit_particles(self) -> int: + self.commit_particles() + + return 0 def new_particle( self, From 2ccd395332899f444f80e3ab80cc445c8120bf57 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 20 Apr 2026 16:17:14 +0200 Subject: [PATCH 039/132] refactored TsunamiImplementation new_particle --- src/amuse_tsunami/interface.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 6eba93b898..7a8a288833 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -156,16 +156,17 @@ def new_particle( wz: float, stype: int ) -> int: - self._pos.append([x, y, z]) - self._vel.append([vx, vy, vz]) - self._mass.append(mass) - self._radius.append(radius) - self._spin.append([wx, wy, wz]) - self._stype.append(stype) - index_of_the_particle = len(self._pos) + self._pos_list.append([x, y, z]) + self._vel_list.append([vx, vy, vz]) + self._mass_list.append(mass) + self._radius_list.append(radius) + self._spin_list.append([wx, wy, wz]) + self._stype_list.append(stype) + index_of_the_particle = len(self._pos_list) - 1 return 0 + class TsunamiInterface( CodeInterface, LiteratureReferencesMixIn, From 18d9471665766be2aab08fe44c4c2082b103b347 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 20 Apr 2026 16:17:54 +0200 Subject: [PATCH 040/132] def get/set_position TsunamiImplementation --- src/amuse_tsunami/interface.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 7a8a288833..9467281bdd 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -166,6 +166,31 @@ def new_particle( return 0 + def get_position(self, index_of_the_particle, x, y, z) -> int: + if self._pos.shape[0] == 0: + return -1 + + self.tsunami.sync_internal_state(self._pos, self._vel, self._spin) + + x = self._pos[index_of_the_particle, 0] + y = self._pos[index_of_the_particle, 1] + z = self._pos[index_of_the_particle, 2] + + return 0 + + def set_position(self, index_of_the_particle, x, y, z) -> int: + + self.tsunami.sync_internal_state(self._pos, self._vel, self._spin) + + self._pos[index_of_the_particle, 0] = x + self._pos[index_of_the_particle, 1] = y + self._pos[index_of_the_particle, 2] = z + + self.tsunami.override_position_and_velocities(self._pos, self._vel) + + return 0 + + class TsunamiInterface( CodeInterface, From 539a2f193033acff1cc385b5cf762e464e240033 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 20 Apr 2026 16:19:21 +0200 Subject: [PATCH 041/132] def set_units, get/set_mscale, get/set_lscale, get_tscale, get_vscale TsunamiImplementation --- src/amuse_tsunami/interface.py | 73 ++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 9467281bdd..f0c0518c32 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -190,6 +190,79 @@ def set_position(self, index_of_the_particle, x, y, z) -> int: return 0 + def set_units(self, Mscale, Lscale) -> int: + """ + Set the mass and length units for Tsunami. + + Used for changing the unit system of + Tsunami after initialization. + """ + self.tsunami.set_units(Mscale, Lscale) + + return 0 + + def get_mscale(self, Mscale) -> int: + """ + Get mass unit of Tsunami in MSun. + """ + Mscale = self.tsunami.Mscale + + return 0 + + def set_mscale(self, Mscale) -> int: + """ + Set mass unit of Tsunami in MSun. + + Used for changing the length unit of + Tsunami after initialization. + """ + self.tsunami.set_units(Mscale, self.tsunami.Lscale) + + return 0 + + def get_lscale(self, Lscale) -> int: + """ + Get length unit of Tsunami in AU. + """ + Lscale = self.tsunami.Lscale + + return 0 + + def set_lscale(self, Lscale) -> int: + """ + Set length unit of Tsunami in AU. + + Used for changing the length unit of + Tsunami after initialization. + """ + self.tsunami.set_units(self.tsunami.Mscale, Lscale) + + return 0 + + def get_tscale(self, Tscale) -> int: + """ + Get time unit of Tsunami in years. + Derived from Mscale, Lscale, and G=1. + + This value is read only; to set it change + Mscale and Lscale. + """ + Tscale = self.tsunami.Tscale + + return 0 + + def get_vscale(self, Vscale) -> int: + """ + Get velocity unit of Tsunami in km/s. + Derived from Mscale, Lscale, and G=1. + + This value is read only; to set it change + Mscale and Lscale. + """ + Vscale = self.tsunami.Vscale + + return 0 + class TsunamiInterface( From 73b2d618a92b0feae64ba0afff75939c51567f3a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 20 Apr 2026 16:20:04 +0200 Subject: [PATCH 042/132] get_time, get_potential_energy, get_kinetic_energy, get_total_energy TsunamiImplementation --- src/amuse_tsunami/interface.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index f0c0518c32..395cbb8827 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -263,6 +263,30 @@ def get_vscale(self, Vscale) -> int: return 0 + def get_time(self, time) -> int: + """ + Get current model time. + + tsunami.time returns time in N-body units. + """ + time = self.tsunami.time + + return 0 + + def get_potential_energy(self, potential_energy) -> int: + potential_energy = self.tsunami.pot + + return 0 + + def get_kinetic_energy(self, kinetic_energy) -> int: + kinetic_energy = self.tsunami.kin + + return 0 + + def get_total_energy(self, total_energy) -> int: + total_energy = self.tsunami.energy + + return 0 class TsunamiInterface( From 681572f6752db65f6b81236741d61a4fa62268ae Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 20 Apr 2026 16:20:36 +0200 Subject: [PATCH 043/132] def _clear_temporary_particle_buffers TsunamiImplementation --- src/amuse_tsunami/interface.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 395cbb8827..1b538d8efe 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -288,6 +288,14 @@ def get_total_energy(self, total_energy) -> int: return 0 + def _clear_temporary_particle_buffers(self) -> None: + """Clear temporary particle buffers after commiting particles""" + self._pos_list.clear() + self._vel_list.clear() + self._spin_list.clear() + self._mass_list.clear() + self._radius_list.clear() + self._stype_list.clear() class TsunamiInterface( CodeInterface, From ef873e3c6f31873ddf98ba06f48a1b4a9d42a3f1 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 22 Apr 2026 11:41:43 +0200 Subject: [PATCH 044/132] made installing tsunami python api a build dependency in makefile --- src/amuse_tsunami/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/amuse_tsunami/Makefile b/src/amuse_tsunami/Makefile index 7d5c44f1d9..bb5266cacd 100644 --- a/src/amuse_tsunami/Makefile +++ b/src/amuse_tsunami/Makefile @@ -38,7 +38,7 @@ endif # tsunami_worker: interface.o tsunami_worker.o $(CODELIB) # $(MPICXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) -tsunami_worker: interface.py +tsunami_worker: interface.py install_tsunami PYTHONPATH=. amusifier --type=py --mode=mpi -x interface TsunamiInterface TsunamiImplementation -o $@ # Which packages contain which workers? @@ -46,11 +46,11 @@ amuse-tsunami_contains: tsunami_worker # Building and installing packages -develop-%: %_contains install_tsunami # FIXME +develop-%: %_contains support/shared/uninstall.sh $* python -m pip install -e packages/$* -install-%: %_contains install_tsunami +install-%: %_contains support/shared/uninstall.sh $* python -m pip install packages/$* From 5ae376d2c97387d95040dcc8256ce6916549c37a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 22 Apr 2026 11:42:08 +0200 Subject: [PATCH 045/132] mv tsunami import in interface.py --- src/amuse_tsunami/interface.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 1b538d8efe..072cd0c4a5 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -21,11 +21,20 @@ from amuse.support.literature import LiteratureReferencesMixIn from amuse.units import generic_unit_system, nbody_system +import tsunami + class TsunamiImplementation(object): + """ + Notes: + what to do with spin? can be compiled with or without + what to do with import tsunami + what to do with setters + + """ def __init__(self): - import tsunami + self.tsunami = tsunami.Tsunami() # temporary buffers for staging particles From 4eebeee029d7cae404bbe789df531e6e09fc47de Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 22 Apr 2026 11:42:32 +0200 Subject: [PATCH 046/132] tsunami tests cleanup --- src/amuse_tsunami/tests/test_tsunami.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 58ebe545d9..cbd8f87ef9 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -1,12 +1,13 @@ from amuse.support.testing.amusetest import TestWithMPI -from amuse.community.tsunami.interface import tsunamiInterface, tsunami +from amuse_tsunami.interface import TsunamiInterface, Tsunami -class tsunamiInterfaceTests(TestWithMPI): +class TestTsunamiInterface(TestWithMPI): def test_echo_int(self): - instance = tsunamiInterface() - result,error = instance.echo_int(12) - self.assertEquals(error, 0) - self.assertEquals(result, 12) + instance = TsunamiInterface() + instance.stop() + + +class TestTsunami(TestWithMPI): From 726d273d53df3c7828d10d2d7b8217e29a8ae4d5 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 22 Apr 2026 11:45:42 +0200 Subject: [PATCH 047/132] fixed tsunami pyproject.toml --- src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml b/src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml index a16d97b159..af1cc419f9 100644 --- a/src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml +++ b/src/amuse_tsunami/packages/amuse-tsunami/pyproject.toml @@ -5,10 +5,8 @@ version = "0.0.1" # repository # dynamic = ["version"] requires-python = ">=3.7" -# "amuse-framework==2025.9.1.dev23+g38aae9f45.d20251209" FIXME dependencies = [ - "amuse-framework", - "amuse_tsunami" + "amuse-framework" ] [build-system] From 866c8b5bfdf35f859b4a0d4594c22144d46a965d Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 22 Apr 2026 11:46:59 +0200 Subject: [PATCH 048/132] tupan tests --- src/amuse_tupan/interface.py | 2 ++ src/amuse_tupan/packages/amuse-tupan/pyproject.toml | 4 +--- src/amuse_tupan/tests/test_tupan.py | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/amuse_tupan/interface.py b/src/amuse_tupan/interface.py index 2fc65c5c13..fe73fbf926 100644 --- a/src/amuse_tupan/interface.py +++ b/src/amuse_tupan/interface.py @@ -96,7 +96,9 @@ def new_particle(self, index_of_the_particle, ps.vy[0] = vy ps.vz[0] = vz self.particles.append(ps) + print('index', index_of_the_particle, index_of_the_particle.value, type(index_of_the_particle)) index_of_the_particle.value = len(self.particles)-1 + print(index_of_the_particle, index_of_the_particle.value) return 0 def set_state(self, index_of_the_particle, diff --git a/src/amuse_tupan/packages/amuse-tupan/pyproject.toml b/src/amuse_tupan/packages/amuse-tupan/pyproject.toml index 55893152f3..c1daff5126 100644 --- a/src/amuse_tupan/packages/amuse-tupan/pyproject.toml +++ b/src/amuse_tupan/packages/amuse-tupan/pyproject.toml @@ -3,8 +3,7 @@ name = "amuse-tupan" dynamic = ["version"] requires-python = ">=3.7" dependencies = [ - "amuse-framework", - "amuse_tupan" + "amuse-framework" ] [build-system] @@ -44,4 +43,3 @@ pythonpath = ["amuse_tupan/tests/"] testpaths = ["amuse_tupan/tests"] addopts = "--import-mode=append" # test the installed package - diff --git a/src/amuse_tupan/tests/test_tupan.py b/src/amuse_tupan/tests/test_tupan.py index bc488f1f2d..0f9cbdd089 100644 --- a/src/amuse_tupan/tests/test_tupan.py +++ b/src/amuse_tupan/tests/test_tupan.py @@ -10,7 +10,7 @@ from amuse_tupan.interface import TupanInterface, Tupan, MODULES_MISSING except ImportError: MODULES_MISSING = True - +print(MODULES_MISSING) class TestTupanInterface(TestWithMPI): @@ -174,11 +174,12 @@ def test01(self): instance.cleanup_code() instance.stop() - def xtest02(self): + def test02(self): if MODULES_MISSING: self.skip("Failed to import a module required for Tupan") print("Testing Tupan parameters") - instance = self.new_instance_of_an_optional_code(Tupan, self.default_converter) + instance = Tupan(converter=self.default_converter) + # instance = self.new_instance_of_an_optional_code(Tupan, self.default_converter) instance.initialize_code() self.assertEqual(instance.parameters.epsilon_squared, From 9d1358b8a53344482a70ecdf85dbe3fb4b2498bd Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 22 Apr 2026 12:04:31 +0200 Subject: [PATCH 049/132] rm tsunami shared folder bc missing simlink --- src/amuse_tsunami/support/shared/config.guess | 1812 --------------- src/amuse_tsunami/support/shared/config.sub | 1971 ----------------- src/amuse_tsunami/support/shared/install-sh | 541 ----- .../support/shared/m4/amuse_conda.m4 | 36 - .../support/shared/m4/amuse_cuda.m4 | 232 -- .../support/shared/m4/amuse_detect_os.m4 | 19 - .../support/shared/m4/amuse_download.m4 | 38 - .../support/shared/m4/amuse_lib.m4 | 138 -- .../support/shared/m4/amuse_lib_healpix.m4 | 48 - .../support/shared/m4/amuse_lib_qhull.m4 | 30 - .../support/shared/m4/amuse_opencl.m4 | 63 - .../support/shared/m4/amuse_venv.m4 | 31 - .../support/shared/m4/ax_blas.m4 | 241 -- .../support/shared/m4/ax_check_classpath.m4 | 61 - .../support/shared/m4/ax_check_gnu_make.m4 | 96 - .../support/shared/m4/ax_count_cpus.m4 | 101 - .../support/shared/m4/ax_lapack.m4 | 134 -- .../support/shared/m4/ax_lib_hdf5.m4 | 323 --- .../support/shared/m4/ax_lib_netcdf4.m4 | 277 --- src/amuse_tsunami/support/shared/m4/ax_mpi.m4 | 235 -- .../support/shared/m4/ax_openmp.m4 | 123 - .../support/shared/m4/ax_prog_jar.m4 | 50 - .../support/shared/m4/ax_prog_java.m4 | 116 - .../support/shared/m4/ax_prog_java_works.m4 | 92 - .../support/shared/m4/ax_prog_javac.m4 | 80 - .../support/shared/m4/ax_prog_javac_works.m4 | 73 - src/amuse_tsunami/support/shared/m4/fftw.m4 | 122 - .../support/shared/m4/fortran.m4 | 43 - src/amuse_tsunami/support/shared/m4/gmp.m4 | 103 - src/amuse_tsunami/support/shared/m4/gsl.m4 | 122 - src/amuse_tsunami/support/shared/m4/mpfr.m4 | 109 - src/amuse_tsunami/support/shared/m4/pkg.m4 | 343 --- src/amuse_tsunami/support/shared/uninstall.sh | 51 - 33 files changed, 7854 deletions(-) delete mode 100755 src/amuse_tsunami/support/shared/config.guess delete mode 100755 src/amuse_tsunami/support/shared/config.sub delete mode 100755 src/amuse_tsunami/support/shared/install-sh delete mode 100644 src/amuse_tsunami/support/shared/m4/amuse_conda.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/amuse_cuda.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/amuse_detect_os.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/amuse_download.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/amuse_lib.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/amuse_lib_healpix.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/amuse_lib_qhull.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/amuse_opencl.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/amuse_venv.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_blas.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_check_classpath.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_check_gnu_make.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_count_cpus.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_lapack.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_lib_hdf5.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_lib_netcdf4.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_mpi.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_openmp.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_prog_jar.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_prog_java.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_prog_java_works.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_prog_javac.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/ax_prog_javac_works.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/fftw.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/fortran.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/gmp.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/gsl.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/mpfr.m4 delete mode 100644 src/amuse_tsunami/support/shared/m4/pkg.m4 delete mode 100755 src/amuse_tsunami/support/shared/uninstall.sh diff --git a/src/amuse_tsunami/support/shared/config.guess b/src/amuse_tsunami/support/shared/config.guess deleted file mode 100755 index f6d217a49f..0000000000 --- a/src/amuse_tsunami/support/shared/config.guess +++ /dev/null @@ -1,1812 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2024 Free Software Foundation, Inc. - -# shellcheck disable=SC2006,SC2268 # see below for rationale - -timestamp='2024-01-01' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. -# -# You can get the latest version of this script from: -# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess -# -# Please send patches to . - - -# The "shellcheck disable" line above the timestamp inhibits complaints -# about features and limitations of the classic Bourne shell that were -# superseded or lifted in POSIX. However, this script identifies a wide -# variety of pre-POSIX systems that do not have POSIX shells at all, and -# even some reasonably current systems (Solaris 10 as case-in-point) still -# have a pre-POSIX /bin/sh. - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system '$me' is run on. - -Options: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2024 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try '$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -# Just in case it came from the environment. -GUESS= - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still -# use 'HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -tmp= -# shellcheck disable=SC2172 -trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 - -set_cc_for_build() { - # prevent multiple calls if $tmp is already set - test "$tmp" && return 0 - : "${TMPDIR=/tmp}" - # shellcheck disable=SC2039,SC3028 - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } - dummy=$tmp/dummy - case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in - ,,) echo "int x;" > "$dummy.c" - for driver in cc gcc c89 c99 ; do - if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD=$driver - break - fi - done - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; - esac -} - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if test -f /.attbin/uname ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case $UNAME_SYSTEM in -Linux|GNU|GNU/*) - LIBC=unknown - - set_cc_for_build - cat <<-EOF > "$dummy.c" - #if defined(__ANDROID__) - LIBC=android - #else - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #elif defined(__GLIBC__) - LIBC=gnu - #elif defined(__LLVM_LIBC__) - LIBC=llvm - #else - #include - /* First heuristic to detect musl libc. */ - #ifdef __DEFINED_va_list - LIBC=musl - #endif - #endif - #endif - EOF - cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - eval "$cc_set_libc" - - # Second heuristic to detect musl libc. - if [ "$LIBC" = unknown ] && - command -v ldd >/dev/null && - ldd --version 2>&1 | grep -q ^musl; then - LIBC=musl - fi - - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - if [ "$LIBC" = unknown ]; then - LIBC=gnu - fi - ;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ - /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ - echo unknown)` - case $UNAME_MACHINE_ARCH in - aarch64eb) machine=aarch64_be-unknown ;; - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown - ;; - *) machine=$UNAME_MACHINE_ARCH-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently (or will in the future) and ABI. - case $UNAME_MACHINE_ARCH in - earm*) - os=netbsdelf - ;; - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # Determine ABI tags. - case $UNAME_MACHINE_ARCH in - earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case $UNAME_VERSION in - Debian*) - release='-gnu' - ;; - *) - release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - GUESS=$machine-${os}${release}${abi-} - ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE - ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE - ;; - *:SecBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE - ;; - *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE - ;; - *:MidnightBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE - ;; - *:ekkoBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE - ;; - *:SolidBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE - ;; - *:OS108:*:*) - GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE - ;; - macppc:MirBSD:*:*) - GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE - ;; - *:MirBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE - ;; - *:Sortix:*:*) - GUESS=$UNAME_MACHINE-unknown-sortix - ;; - *:Twizzler:*:*) - GUESS=$UNAME_MACHINE-unknown-twizzler - ;; - *:Redox:*:*) - GUESS=$UNAME_MACHINE-unknown-redox - ;; - mips:OSF1:*.*) - GUESS=mips-dec-osf1 - ;; - alpha:OSF1:*:*) - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - trap '' 0 - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case $ALPHA_CPU_TYPE in - "EV4 (21064)") - UNAME_MACHINE=alpha ;; - "EV4.5 (21064)") - UNAME_MACHINE=alpha ;; - "LCA4 (21066/21068)") - UNAME_MACHINE=alpha ;; - "EV5 (21164)") - UNAME_MACHINE=alphaev5 ;; - "EV5.6 (21164A)") - UNAME_MACHINE=alphaev56 ;; - "EV5.6 (21164PC)") - UNAME_MACHINE=alphapca56 ;; - "EV5.7 (21164PC)") - UNAME_MACHINE=alphapca57 ;; - "EV6 (21264)") - UNAME_MACHINE=alphaev6 ;; - "EV6.7 (21264A)") - UNAME_MACHINE=alphaev67 ;; - "EV6.8CB (21264C)") - UNAME_MACHINE=alphaev68 ;; - "EV6.8AL (21264B)") - UNAME_MACHINE=alphaev68 ;; - "EV6.8CX (21264D)") - UNAME_MACHINE=alphaev68 ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE=alphaev69 ;; - "EV7 (21364)") - UNAME_MACHINE=alphaev7 ;; - "EV7.9 (21364A)") - UNAME_MACHINE=alphaev79 ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - GUESS=$UNAME_MACHINE-dec-osf$OSF_REL - ;; - Amiga*:UNIX_System_V:4.0:*) - GUESS=m68k-unknown-sysv4 - ;; - *:[Aa]miga[Oo][Ss]:*:*) - GUESS=$UNAME_MACHINE-unknown-amigaos - ;; - *:[Mm]orph[Oo][Ss]:*:*) - GUESS=$UNAME_MACHINE-unknown-morphos - ;; - *:OS/390:*:*) - GUESS=i370-ibm-openedition - ;; - *:z/VM:*:*) - GUESS=s390-ibm-zvmoe - ;; - *:OS400:*:*) - GUESS=powerpc-ibm-os400 - ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - GUESS=arm-acorn-riscix$UNAME_RELEASE - ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) - GUESS=arm-unknown-riscos - ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - GUESS=hppa1.1-hitachi-hiuxmpp - ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - case `(/bin/universe) 2>/dev/null` in - att) GUESS=pyramid-pyramid-sysv3 ;; - *) GUESS=pyramid-pyramid-bsd ;; - esac - ;; - NILE*:*:*:dcosx) - GUESS=pyramid-pyramid-svr4 - ;; - DRS?6000:unix:4.0:6*) - GUESS=sparc-icl-nx6 - ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) GUESS=sparc-icl-nx7 ;; - esac - ;; - s390x:SunOS:*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL - ;; - sun4H:SunOS:5.*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=sparc-hal-solaris2$SUN_REL - ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=sparc-sun-solaris2$SUN_REL - ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - GUESS=i386-pc-auroraux$UNAME_RELEASE - ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - set_cc_for_build - SUN_ARCH=i386 - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH=x86_64 - fi - fi - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=$SUN_ARCH-pc-solaris2$SUN_REL - ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=sparc-sun-solaris3$SUN_REL - ;; - sun4*:SunOS:*:*) - case `/usr/bin/arch -k` in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like '4.1.3-JL'. - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` - GUESS=sparc-sun-sunos$SUN_REL - ;; - sun3*:SunOS:*:*) - GUESS=m68k-sun-sunos$UNAME_RELEASE - ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case `/bin/arch` in - sun3) - GUESS=m68k-sun-sunos$UNAME_RELEASE - ;; - sun4) - GUESS=sparc-sun-sunos$UNAME_RELEASE - ;; - esac - ;; - aushp:SunOS:*:*) - GUESS=sparc-auspex-sunos$UNAME_RELEASE - ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - GUESS=m68k-atari-mint$UNAME_RELEASE - ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - GUESS=m68k-atari-mint$UNAME_RELEASE - ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - GUESS=m68k-atari-mint$UNAME_RELEASE - ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - GUESS=m68k-milan-mint$UNAME_RELEASE - ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - GUESS=m68k-hades-mint$UNAME_RELEASE - ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - GUESS=m68k-unknown-mint$UNAME_RELEASE - ;; - m68k:machten:*:*) - GUESS=m68k-apple-machten$UNAME_RELEASE - ;; - powerpc:machten:*:*) - GUESS=powerpc-apple-machten$UNAME_RELEASE - ;; - RISC*:Mach:*:*) - GUESS=mips-dec-mach_bsd4.3 - ;; - RISC*:ULTRIX:*:*) - GUESS=mips-dec-ultrix$UNAME_RELEASE - ;; - VAX*:ULTRIX*:*:*) - GUESS=vax-dec-ultrix$UNAME_RELEASE - ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - GUESS=clipper-intergraph-clix$UNAME_RELEASE - ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && - dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`"$dummy" "$dummyarg"` && - { echo "$SYSTEM_NAME"; exit; } - GUESS=mips-mips-riscos$UNAME_RELEASE - ;; - Motorola:PowerMAX_OS:*:*) - GUESS=powerpc-motorola-powermax - ;; - Motorola:*:4.3:PL8-*) - GUESS=powerpc-harris-powermax - ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - GUESS=powerpc-harris-powermax - ;; - Night_Hawk:Power_UNIX:*:*) - GUESS=powerpc-harris-powerunix - ;; - m88k:CX/UX:7*:*) - GUESS=m88k-harris-cxux7 - ;; - m88k:*:4*:R4*) - GUESS=m88k-motorola-sysv4 - ;; - m88k:*:3*:R3*) - GUESS=m88k-motorola-sysv3 - ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 - then - if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ - test "$TARGET_BINARY_INTERFACE"x = x - then - GUESS=m88k-dg-dgux$UNAME_RELEASE - else - GUESS=m88k-dg-dguxbcs$UNAME_RELEASE - fi - else - GUESS=i586-dg-dgux$UNAME_RELEASE - fi - ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - GUESS=m88k-dolphin-sysv3 - ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - GUESS=m88k-motorola-sysv3 - ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - GUESS=m88k-tektronix-sysv3 - ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - GUESS=m68k-tektronix-bsd - ;; - *:IRIX*:*:*) - IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` - GUESS=mips-sgi-irix$IRIX_REL - ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id - ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - GUESS=i386-ibm-aix - ;; - ia64:AIX:*:*) - if test -x /usr/bin/oslevel ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=$UNAME_VERSION.$UNAME_RELEASE - fi - GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV - ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` - then - GUESS=$SYSTEM_NAME - else - GUESS=rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - GUESS=rs6000-ibm-aix3.2.4 - else - GUESS=rs6000-ibm-aix3.2 - fi - ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if test -x /usr/bin/lslpp ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` - else - IBM_REV=$UNAME_VERSION.$UNAME_RELEASE - fi - GUESS=$IBM_ARCH-ibm-aix$IBM_REV - ;; - *:AIX:*:*) - GUESS=rs6000-ibm-aix - ;; - ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) - GUESS=romp-ibm-bsd4.4 - ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to - ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - GUESS=rs6000-bull-bosx - ;; - DPX/2?00:B.O.S.:*:*) - GUESS=m68k-bull-sysv3 - ;; - 9000/[34]??:4.3bsd:1.*:*) - GUESS=m68k-hp-bsd - ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - GUESS=m68k-hp-bsd4.4 - ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` - case $UNAME_MACHINE in - 9000/31?) HP_ARCH=m68000 ;; - 9000/[34]??) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if test -x /usr/bin/getconf; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case $sc_cpu_version in - 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 - 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case $sc_kernel_bits in - 32) HP_ARCH=hppa2.0n ;; - 64) HP_ARCH=hppa2.0w ;; - '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 - esac ;; - esac - fi - if test "$HP_ARCH" = ""; then - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if test "$HP_ARCH" = hppa2.0w - then - set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH=hppa2.0w - else - HP_ARCH=hppa64 - fi - fi - GUESS=$HP_ARCH-hp-hpux$HPUX_REV - ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` - GUESS=ia64-hp-hpux$HPUX_REV - ;; - 3050*:HI-UX:*:*) - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && - { echo "$SYSTEM_NAME"; exit; } - GUESS=unknown-hitachi-hiuxwe2 - ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) - GUESS=hppa1.1-hp-bsd - ;; - 9000/8??:4.3bsd:*:*) - GUESS=hppa1.0-hp-bsd - ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - GUESS=hppa1.0-hp-mpeix - ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) - GUESS=hppa1.1-hp-osf - ;; - hp8??:OSF1:*:*) - GUESS=hppa1.0-hp-osf - ;; - i*86:OSF1:*:*) - if test -x /usr/sbin/sysversion ; then - GUESS=$UNAME_MACHINE-unknown-osf1mk - else - GUESS=$UNAME_MACHINE-unknown-osf1 - fi - ;; - parisc*:Lites*:*:*) - GUESS=hppa1.1-hp-lites - ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - GUESS=c1-convex-bsd - ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - GUESS=c34-convex-bsd - ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - GUESS=c38-convex-bsd - ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - GUESS=c4-convex-bsd - ;; - CRAY*Y-MP:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=ymp-cray-unicos$CRAY_REL - ;; - CRAY*[A-Z]90:*:*:*) - echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=t90-cray-unicos$CRAY_REL - ;; - CRAY*T3E:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=alphaev5-cray-unicosmk$CRAY_REL - ;; - CRAY*SV1:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=sv1-cray-unicos$CRAY_REL - ;; - *:UNICOS/mp:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=craynv-cray-unicosmp$CRAY_REL - ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` - GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} - ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` - GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} - ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE - ;; - sparc*:BSD/OS:*:*) - GUESS=sparc-unknown-bsdi$UNAME_RELEASE - ;; - *:BSD/OS:*:*) - GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE - ;; - arm:FreeBSD:*:*) - UNAME_PROCESSOR=`uname -p` - set_cc_for_build - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi - else - FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf - fi - ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`uname -p` - case $UNAME_PROCESSOR in - amd64) - UNAME_PROCESSOR=x86_64 ;; - i386) - UNAME_PROCESSOR=i586 ;; - esac - FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL - ;; - i*:CYGWIN*:*) - GUESS=$UNAME_MACHINE-pc-cygwin - ;; - *:MINGW64*:*) - GUESS=$UNAME_MACHINE-pc-mingw64 - ;; - *:MINGW*:*) - GUESS=$UNAME_MACHINE-pc-mingw32 - ;; - *:MSYS*:*) - GUESS=$UNAME_MACHINE-pc-msys - ;; - i*:PW*:*) - GUESS=$UNAME_MACHINE-pc-pw32 - ;; - *:SerenityOS:*:*) - GUESS=$UNAME_MACHINE-pc-serenity - ;; - *:Interix*:*) - case $UNAME_MACHINE in - x86) - GUESS=i586-pc-interix$UNAME_RELEASE - ;; - authenticamd | genuineintel | EM64T) - GUESS=x86_64-unknown-interix$UNAME_RELEASE - ;; - IA64) - GUESS=ia64-unknown-interix$UNAME_RELEASE - ;; - esac ;; - i*:UWIN*:*) - GUESS=$UNAME_MACHINE-pc-uwin - ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - GUESS=x86_64-pc-cygwin - ;; - prep*:SunOS:5.*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=powerpcle-unknown-solaris2$SUN_REL - ;; - *:GNU:*:*) - # the GNU system - GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` - GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` - GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL - ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` - GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC - ;; - x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) - GUESS="$UNAME_MACHINE-pc-managarm-mlibc" - ;; - *:[Mm]anagarm:*:*) - GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" - ;; - *:Minix:*:*) - GUESS=$UNAME_MACHINE-unknown-minix - ;; - aarch64:Linux:*:*) - set_cc_for_build - CPU=$UNAME_MACHINE - LIBCABI=$LIBC - if test "$CC_FOR_BUILD" != no_compiler_found; then - ABI=64 - sed 's/^ //' << EOF > "$dummy.c" - #ifdef __ARM_EABI__ - #ifdef __ARM_PCS_VFP - ABI=eabihf - #else - ABI=eabi - #endif - #endif -EOF - cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` - eval "$cc_set_abi" - case $ABI in - eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; - esac - fi - GUESS=$CPU-unknown-linux-$LIBCABI - ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - arm*:Linux:*:*) - set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi - else - GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf - fi - fi - ;; - avr32*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - cris:Linux:*:*) - GUESS=$UNAME_MACHINE-axis-linux-$LIBC - ;; - crisv32:Linux:*:*) - GUESS=$UNAME_MACHINE-axis-linux-$LIBC - ;; - e2k:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - frv:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - hexagon:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - i*86:Linux:*:*) - GUESS=$UNAME_MACHINE-pc-linux-$LIBC - ;; - ia64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - k1om:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - kvx:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - kvx:cos:*:*) - GUESS=$UNAME_MACHINE-unknown-cos - ;; - kvx:mbr:*:*) - GUESS=$UNAME_MACHINE-unknown-mbr - ;; - loongarch32:Linux:*:* | loongarch64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - m32r*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - m68*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - mips:Linux:*:* | mips64:Linux:*:*) - set_cc_for_build - IS_GLIBC=0 - test x"${LIBC}" = xgnu && IS_GLIBC=1 - sed 's/^ //' << EOF > "$dummy.c" - #undef CPU - #undef mips - #undef mipsel - #undef mips64 - #undef mips64el - #if ${IS_GLIBC} && defined(_ABI64) - LIBCABI=gnuabi64 - #else - #if ${IS_GLIBC} && defined(_ABIN32) - LIBCABI=gnuabin32 - #else - LIBCABI=${LIBC} - #endif - #endif - - #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 - CPU=mipsisa64r6 - #else - #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 - CPU=mipsisa32r6 - #else - #if defined(__mips64) - CPU=mips64 - #else - CPU=mips - #endif - #endif - #endif - - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - MIPS_ENDIAN=el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - MIPS_ENDIAN= - #else - MIPS_ENDIAN= - #endif - #endif -EOF - cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` - eval "$cc_set_vars" - test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } - ;; - mips64el:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - openrisc*:Linux:*:*) - GUESS=or1k-unknown-linux-$LIBC - ;; - or32:Linux:*:* | or1k*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - padre:Linux:*:*) - GUESS=sparc-unknown-linux-$LIBC - ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - GUESS=hppa64-unknown-linux-$LIBC - ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; - PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; - *) GUESS=hppa-unknown-linux-$LIBC ;; - esac - ;; - ppc64:Linux:*:*) - GUESS=powerpc64-unknown-linux-$LIBC - ;; - ppc:Linux:*:*) - GUESS=powerpc-unknown-linux-$LIBC - ;; - ppc64le:Linux:*:*) - GUESS=powerpc64le-unknown-linux-$LIBC - ;; - ppcle:Linux:*:*) - GUESS=powerpcle-unknown-linux-$LIBC - ;; - riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - s390:Linux:*:* | s390x:Linux:*:*) - GUESS=$UNAME_MACHINE-ibm-linux-$LIBC - ;; - sh64*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - sh*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - tile*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - vax:Linux:*:*) - GUESS=$UNAME_MACHINE-dec-linux-$LIBC - ;; - x86_64:Linux:*:*) - set_cc_for_build - CPU=$UNAME_MACHINE - LIBCABI=$LIBC - if test "$CC_FOR_BUILD" != no_compiler_found; then - ABI=64 - sed 's/^ //' << EOF > "$dummy.c" - #ifdef __i386__ - ABI=x86 - #else - #ifdef __ILP32__ - ABI=x32 - #endif - #endif -EOF - cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` - eval "$cc_set_abi" - case $ABI in - x86) CPU=i686 ;; - x32) LIBCABI=${LIBC}x32 ;; - esac - fi - GUESS=$CPU-pc-linux-$LIBCABI - ;; - xtensa*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - GUESS=i386-sequent-sysv4 - ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION - ;; - i*86:OS/2:*:*) - # If we were able to find 'uname', then EMX Unix compatibility - # is probably installed. - GUESS=$UNAME_MACHINE-pc-os2-emx - ;; - i*86:XTS-300:*:STOP) - GUESS=$UNAME_MACHINE-unknown-stop - ;; - i*86:atheos:*:*) - GUESS=$UNAME_MACHINE-unknown-atheos - ;; - i*86:syllable:*:*) - GUESS=$UNAME_MACHINE-pc-syllable - ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - GUESS=i386-unknown-lynxos$UNAME_RELEASE - ;; - i*86:*DOS:*:*) - GUESS=$UNAME_MACHINE-pc-msdosdjgpp - ;; - i*86:*:4.*:*) - UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL - else - GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL - fi - ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL - else - GUESS=$UNAME_MACHINE-pc-sysv32 - fi - ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configure will decide that - # this is a cross-build. - GUESS=i586-pc-msdosdjgpp - ;; - Intel:Mach:3*:*) - GUESS=i386-pc-mach3 - ;; - paragon:*:*:*) - GUESS=i860-intel-osf1 - ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 - fi - ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - GUESS=m68010-convergent-sysv - ;; - mc68k:UNIX:SYSTEM5:3.51m) - GUESS=m68k-convergent-sysv - ;; - M680?0:D-NIX:5.3:*) - GUESS=m68k-diab-dnix - ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - GUESS=m68k-unknown-lynxos$UNAME_RELEASE - ;; - mc68030:UNIX_System_V:4.*:*) - GUESS=m68k-atari-sysv4 - ;; - TSUNAMI:LynxOS:2.*:*) - GUESS=sparc-unknown-lynxos$UNAME_RELEASE - ;; - rs6000:LynxOS:2.*:*) - GUESS=rs6000-unknown-lynxos$UNAME_RELEASE - ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - GUESS=powerpc-unknown-lynxos$UNAME_RELEASE - ;; - SM[BE]S:UNIX_SV:*:*) - GUESS=mips-dde-sysv$UNAME_RELEASE - ;; - RM*:ReliantUNIX-*:*:*) - GUESS=mips-sni-sysv4 - ;; - RM*:SINIX-*:*:*) - GUESS=mips-sni-sysv4 - ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - GUESS=$UNAME_MACHINE-sni-sysv4 - else - GUESS=ns32k-sni-sysv - fi - ;; - PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort - # says - GUESS=i586-unisys-sysv4 - ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - GUESS=hppa1.1-stratus-sysv4 - ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - GUESS=i860-stratus-sysv4 - ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - GUESS=$UNAME_MACHINE-stratus-vos - ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - GUESS=hppa1.1-stratus-vos - ;; - mc68*:A/UX:*:*) - GUESS=m68k-apple-aux$UNAME_RELEASE - ;; - news*:NEWS-OS:6*:*) - GUESS=mips-sony-newsos6 - ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if test -d /usr/nec; then - GUESS=mips-nec-sysv$UNAME_RELEASE - else - GUESS=mips-unknown-sysv$UNAME_RELEASE - fi - ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - GUESS=powerpc-be-beos - ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - GUESS=powerpc-apple-beos - ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - GUESS=i586-pc-beos - ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - GUESS=i586-pc-haiku - ;; - ppc:Haiku:*:*) # Haiku running on Apple PowerPC - GUESS=powerpc-apple-haiku - ;; - *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) - GUESS=$UNAME_MACHINE-unknown-haiku - ;; - SX-4:SUPER-UX:*:*) - GUESS=sx4-nec-superux$UNAME_RELEASE - ;; - SX-5:SUPER-UX:*:*) - GUESS=sx5-nec-superux$UNAME_RELEASE - ;; - SX-6:SUPER-UX:*:*) - GUESS=sx6-nec-superux$UNAME_RELEASE - ;; - SX-7:SUPER-UX:*:*) - GUESS=sx7-nec-superux$UNAME_RELEASE - ;; - SX-8:SUPER-UX:*:*) - GUESS=sx8-nec-superux$UNAME_RELEASE - ;; - SX-8R:SUPER-UX:*:*) - GUESS=sx8r-nec-superux$UNAME_RELEASE - ;; - SX-ACE:SUPER-UX:*:*) - GUESS=sxace-nec-superux$UNAME_RELEASE - ;; - Power*:Rhapsody:*:*) - GUESS=powerpc-apple-rhapsody$UNAME_RELEASE - ;; - *:Rhapsody:*:*) - GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE - ;; - arm64:Darwin:*:*) - GUESS=aarch64-apple-darwin$UNAME_RELEASE - ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - if command -v xcode-select > /dev/null 2> /dev/null && \ - ! xcode-select --print-path > /dev/null 2> /dev/null ; then - # Avoid executing cc if there is no toolchain installed as - # cc will be a stub that puts up a graphical alert - # prompting the user to install developer tools. - CC_FOR_BUILD=no_compiler_found - else - set_cc_for_build - fi - if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc - if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_PPC >/dev/null - then - UNAME_PROCESSOR=powerpc - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # uname -m returns i386 or x86_64 - UNAME_PROCESSOR=$UNAME_MACHINE - fi - GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE - ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = x86; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE - ;; - *:QNX:*:4*) - GUESS=i386-pc-qnx - ;; - NEO-*:NONSTOP_KERNEL:*:*) - GUESS=neo-tandem-nsk$UNAME_RELEASE - ;; - NSE-*:NONSTOP_KERNEL:*:*) - GUESS=nse-tandem-nsk$UNAME_RELEASE - ;; - NSR-*:NONSTOP_KERNEL:*:*) - GUESS=nsr-tandem-nsk$UNAME_RELEASE - ;; - NSV-*:NONSTOP_KERNEL:*:*) - GUESS=nsv-tandem-nsk$UNAME_RELEASE - ;; - NSX-*:NONSTOP_KERNEL:*:*) - GUESS=nsx-tandem-nsk$UNAME_RELEASE - ;; - *:NonStop-UX:*:*) - GUESS=mips-compaq-nonstopux - ;; - BS2000:POSIX*:*:*) - GUESS=bs2000-siemens-sysv - ;; - DS/*:UNIX_System_V:*:*) - GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE - ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "${cputype-}" = 386; then - UNAME_MACHINE=i386 - elif test "x${cputype-}" != x; then - UNAME_MACHINE=$cputype - fi - GUESS=$UNAME_MACHINE-unknown-plan9 - ;; - *:TOPS-10:*:*) - GUESS=pdp10-unknown-tops10 - ;; - *:TENEX:*:*) - GUESS=pdp10-unknown-tenex - ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - GUESS=pdp10-dec-tops20 - ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - GUESS=pdp10-xkl-tops20 - ;; - *:TOPS-20:*:*) - GUESS=pdp10-unknown-tops20 - ;; - *:ITS:*:*) - GUESS=pdp10-unknown-its - ;; - SEI:*:*:SEIUX) - GUESS=mips-sei-seiux$UNAME_RELEASE - ;; - *:DragonFly:*:*) - DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL - ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case $UNAME_MACHINE in - A*) GUESS=alpha-dec-vms ;; - I*) GUESS=ia64-dec-vms ;; - V*) GUESS=vax-dec-vms ;; - esac ;; - *:XENIX:*:SysV) - GUESS=i386-pc-xenix - ;; - i*86:skyos:*:*) - SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` - GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL - ;; - i*86:rdos:*:*) - GUESS=$UNAME_MACHINE-pc-rdos - ;; - i*86:Fiwix:*:*) - GUESS=$UNAME_MACHINE-pc-fiwix - ;; - *:AROS:*:*) - GUESS=$UNAME_MACHINE-unknown-aros - ;; - x86_64:VMkernel:*:*) - GUESS=$UNAME_MACHINE-unknown-esx - ;; - amd64:Isilon\ OneFS:*:*) - GUESS=x86_64-unknown-onefs - ;; - *:Unleashed:*:*) - GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE - ;; - *:Ironclad:*:*) - GUESS=$UNAME_MACHINE-unknown-ironclad - ;; -esac - -# Do we have a guess based on uname results? -if test "x$GUESS" != x; then - echo "$GUESS" - exit -fi - -# No uname command or uname output not recognized. -set_cc_for_build -cat > "$dummy.c" < -#include -#endif -#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) -#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) -#include -#if defined(_SIZE_T_) || defined(SIGLOST) -#include -#endif -#endif -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); -#endif - -#if defined (vax) -#if !defined (ultrix) -#include -#if defined (BSD) -#if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -#else -#if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -#else - printf ("vax-dec-bsd\n"); exit (0); -#endif -#endif -#else - printf ("vax-dec-bsd\n"); exit (0); -#endif -#else -#if defined(_SIZE_T_) || defined(SIGLOST) - struct utsname un; - uname (&un); - printf ("vax-dec-ultrix%s\n", un.release); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif -#endif -#endif -#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) -#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) -#if defined(_SIZE_T_) || defined(SIGLOST) - struct utsname *un; - uname (&un); - printf ("mips-dec-ultrix%s\n", un.release); exit (0); -#else - printf ("mips-dec-ultrix\n"); exit (0); -#endif -#endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. -test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } - -echo "$0: unable to guess system type" >&2 - -case $UNAME_MACHINE:$UNAME_SYSTEM in - mips:Linux | mips64:Linux) - # If we got here on MIPS GNU/Linux, output extra information. - cat >&2 <&2 <&2 </dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = "$UNAME_MACHINE" -UNAME_RELEASE = "$UNAME_RELEASE" -UNAME_SYSTEM = "$UNAME_SYSTEM" -UNAME_VERSION = "$UNAME_VERSION" -EOF -fi - -exit 1 - -# Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/amuse_tsunami/support/shared/config.sub b/src/amuse_tsunami/support/shared/config.sub deleted file mode 100755 index 2c6a07ab3c..0000000000 --- a/src/amuse_tsunami/support/shared/config.sub +++ /dev/null @@ -1,1971 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2024 Free Software Foundation, Inc. - -# shellcheck disable=SC2006,SC2268 # see below for rationale - -timestamp='2024-01-01' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches to . -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -# The "shellcheck disable" line above the timestamp inhibits complaints -# about features and limitations of the classic Bourne shell that were -# superseded or lifted in POSIX. However, this script identifies a wide -# variety of pre-POSIX systems that do not have POSIX shells at all, and -# even some reasonably current systems (Solaris 10 as case-in-point) still -# have a pre-POSIX /bin/sh. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS - -Canonicalize a configuration name. - -Options: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2024 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try '$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo "$1" - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Split fields of configuration type -# shellcheck disable=SC2162 -saved_IFS=$IFS -IFS="-" read field1 field2 field3 field4 <&2 - exit 1 - ;; - *-*-*-*) - basic_machine=$field1-$field2 - basic_os=$field3-$field4 - ;; - *-*-*) - # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two - # parts - maybe_os=$field2-$field3 - case $maybe_os in - nto-qnx* | linux-* | uclinux-uclibc* \ - | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ - | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ - | windows-* ) - basic_machine=$field1 - basic_os=$maybe_os - ;; - android-linux) - basic_machine=$field1-unknown - basic_os=linux-android - ;; - *) - basic_machine=$field1-$field2 - basic_os=$field3 - ;; - esac - ;; - *-*) - # A lone config we happen to match not fitting any pattern - case $field1-$field2 in - decstation-3100) - basic_machine=mips-dec - basic_os= - ;; - *-*) - # Second component is usually, but not always the OS - case $field2 in - # Prevent following clause from handling this valid os - sun*os*) - basic_machine=$field1 - basic_os=$field2 - ;; - zephyr*) - basic_machine=$field1-unknown - basic_os=$field2 - ;; - # Manufacturers - dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ - | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ - | unicom* | ibm* | next | hp | isi* | apollo | altos* \ - | convergent* | ncr* | news | 32* | 3600* | 3100* \ - | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ - | ultra | tti* | harris | dolphin | highlevel | gould \ - | cbm | ns | masscomp | apple | axis | knuth | cray \ - | microblaze* | sim | cisco \ - | oki | wec | wrs | winbond) - basic_machine=$field1-$field2 - basic_os= - ;; - *) - basic_machine=$field1 - basic_os=$field2 - ;; - esac - ;; - esac - ;; - *) - # Convert single-component short-hands not valid as part of - # multi-component configurations. - case $field1 in - 386bsd) - basic_machine=i386-pc - basic_os=bsd - ;; - a29khif) - basic_machine=a29k-amd - basic_os=udi - ;; - adobe68k) - basic_machine=m68010-adobe - basic_os=scout - ;; - alliant) - basic_machine=fx80-alliant - basic_os= - ;; - altos | altos3068) - basic_machine=m68k-altos - basic_os= - ;; - am29k) - basic_machine=a29k-none - basic_os=bsd - ;; - amdahl) - basic_machine=580-amdahl - basic_os=sysv - ;; - amiga) - basic_machine=m68k-unknown - basic_os= - ;; - amigaos | amigados) - basic_machine=m68k-unknown - basic_os=amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - basic_os=sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - basic_os=sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - basic_os=bsd - ;; - aros) - basic_machine=i386-pc - basic_os=aros - ;; - aux) - basic_machine=m68k-apple - basic_os=aux - ;; - balance) - basic_machine=ns32k-sequent - basic_os=dynix - ;; - blackfin) - basic_machine=bfin-unknown - basic_os=linux - ;; - cegcc) - basic_machine=arm-unknown - basic_os=cegcc - ;; - convex-c1) - basic_machine=c1-convex - basic_os=bsd - ;; - convex-c2) - basic_machine=c2-convex - basic_os=bsd - ;; - convex-c32) - basic_machine=c32-convex - basic_os=bsd - ;; - convex-c34) - basic_machine=c34-convex - basic_os=bsd - ;; - convex-c38) - basic_machine=c38-convex - basic_os=bsd - ;; - cray) - basic_machine=j90-cray - basic_os=unicos - ;; - crds | unos) - basic_machine=m68k-crds - basic_os= - ;; - da30) - basic_machine=m68k-da30 - basic_os= - ;; - decstation | pmax | pmin | dec3100 | decstatn) - basic_machine=mips-dec - basic_os= - ;; - delta88) - basic_machine=m88k-motorola - basic_os=sysv3 - ;; - dicos) - basic_machine=i686-pc - basic_os=dicos - ;; - djgpp) - basic_machine=i586-pc - basic_os=msdosdjgpp - ;; - ebmon29k) - basic_machine=a29k-amd - basic_os=ebmon - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - basic_os=ose - ;; - gmicro) - basic_machine=tron-gmicro - basic_os=sysv - ;; - go32) - basic_machine=i386-pc - basic_os=go32 - ;; - h8300hms) - basic_machine=h8300-hitachi - basic_os=hms - ;; - h8300xray) - basic_machine=h8300-hitachi - basic_os=xray - ;; - h8500hms) - basic_machine=h8500-hitachi - basic_os=hms - ;; - harris) - basic_machine=m88k-harris - basic_os=sysv3 - ;; - hp300 | hp300hpux) - basic_machine=m68k-hp - basic_os=hpux - ;; - hp300bsd) - basic_machine=m68k-hp - basic_os=bsd - ;; - hppaosf) - basic_machine=hppa1.1-hp - basic_os=osf - ;; - hppro) - basic_machine=hppa1.1-hp - basic_os=proelf - ;; - i386mach) - basic_machine=i386-mach - basic_os=mach - ;; - isi68 | isi) - basic_machine=m68k-isi - basic_os=sysv - ;; - m68knommu) - basic_machine=m68k-unknown - basic_os=linux - ;; - magnum | m3230) - basic_machine=mips-mips - basic_os=sysv - ;; - merlin) - basic_machine=ns32k-utek - basic_os=sysv - ;; - mingw64) - basic_machine=x86_64-pc - basic_os=mingw64 - ;; - mingw32) - basic_machine=i686-pc - basic_os=mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - basic_os=mingw32ce - ;; - monitor) - basic_machine=m68k-rom68k - basic_os=coff - ;; - morphos) - basic_machine=powerpc-unknown - basic_os=morphos - ;; - moxiebox) - basic_machine=moxie-unknown - basic_os=moxiebox - ;; - msdos) - basic_machine=i386-pc - basic_os=msdos - ;; - msys) - basic_machine=i686-pc - basic_os=msys - ;; - mvs) - basic_machine=i370-ibm - basic_os=mvs - ;; - nacl) - basic_machine=le32-unknown - basic_os=nacl - ;; - ncr3000) - basic_machine=i486-ncr - basic_os=sysv4 - ;; - netbsd386) - basic_machine=i386-pc - basic_os=netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - basic_os=linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - basic_os=newsos - ;; - news1000) - basic_machine=m68030-sony - basic_os=newsos - ;; - necv70) - basic_machine=v70-nec - basic_os=sysv - ;; - nh3000) - basic_machine=m68k-harris - basic_os=cxux - ;; - nh[45]000) - basic_machine=m88k-harris - basic_os=cxux - ;; - nindy960) - basic_machine=i960-intel - basic_os=nindy - ;; - mon960) - basic_machine=i960-intel - basic_os=mon960 - ;; - nonstopux) - basic_machine=mips-compaq - basic_os=nonstopux - ;; - os400) - basic_machine=powerpc-ibm - basic_os=os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - basic_os=ose - ;; - os68k) - basic_machine=m68k-none - basic_os=os68k - ;; - paragon) - basic_machine=i860-intel - basic_os=osf - ;; - parisc) - basic_machine=hppa-unknown - basic_os=linux - ;; - psp) - basic_machine=mipsallegrexel-sony - basic_os=psp - ;; - pw32) - basic_machine=i586-unknown - basic_os=pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - basic_os=rdos - ;; - rdos32) - basic_machine=i386-pc - basic_os=rdos - ;; - rom68k) - basic_machine=m68k-rom68k - basic_os=coff - ;; - sa29200) - basic_machine=a29k-amd - basic_os=udi - ;; - sei) - basic_machine=mips-sei - basic_os=seiux - ;; - sequent) - basic_machine=i386-sequent - basic_os= - ;; - sps7) - basic_machine=m68k-bull - basic_os=sysv2 - ;; - st2000) - basic_machine=m68k-tandem - basic_os= - ;; - stratus) - basic_machine=i860-stratus - basic_os=sysv4 - ;; - sun2) - basic_machine=m68000-sun - basic_os= - ;; - sun2os3) - basic_machine=m68000-sun - basic_os=sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - basic_os=sunos4 - ;; - sun3) - basic_machine=m68k-sun - basic_os= - ;; - sun3os3) - basic_machine=m68k-sun - basic_os=sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - basic_os=sunos4 - ;; - sun4) - basic_machine=sparc-sun - basic_os= - ;; - sun4os3) - basic_machine=sparc-sun - basic_os=sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - basic_os=sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - basic_os=solaris2 - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - basic_os= - ;; - sv1) - basic_machine=sv1-cray - basic_os=unicos - ;; - symmetry) - basic_machine=i386-sequent - basic_os=dynix - ;; - t3e) - basic_machine=alphaev5-cray - basic_os=unicos - ;; - t90) - basic_machine=t90-cray - basic_os=unicos - ;; - toad1) - basic_machine=pdp10-xkl - basic_os=tops20 - ;; - tpf) - basic_machine=s390x-ibm - basic_os=tpf - ;; - udi29k) - basic_machine=a29k-amd - basic_os=udi - ;; - ultra3) - basic_machine=a29k-nyu - basic_os=sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - basic_os=none - ;; - vaxv) - basic_machine=vax-dec - basic_os=sysv - ;; - vms) - basic_machine=vax-dec - basic_os=vms - ;; - vsta) - basic_machine=i386-pc - basic_os=vsta - ;; - vxworks960) - basic_machine=i960-wrs - basic_os=vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - basic_os=vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - basic_os=vxworks - ;; - xbox) - basic_machine=i686-pc - basic_os=mingw32 - ;; - ymp) - basic_machine=ymp-cray - basic_os=unicos - ;; - *) - basic_machine=$1 - basic_os= - ;; - esac - ;; -esac - -# Decode 1-component or ad-hoc basic machines -case $basic_machine in - # Here we handle the default manufacturer of certain CPU types. It is in - # some cases the only manufacturer, in others, it is the most popular. - w89k) - cpu=hppa1.1 - vendor=winbond - ;; - op50n) - cpu=hppa1.1 - vendor=oki - ;; - op60c) - cpu=hppa1.1 - vendor=oki - ;; - ibm*) - cpu=i370 - vendor=ibm - ;; - orion105) - cpu=clipper - vendor=highlevel - ;; - mac | mpw | mac-mpw) - cpu=m68k - vendor=apple - ;; - pmac | pmac-mpw) - cpu=powerpc - vendor=apple - ;; - - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - cpu=m68000 - vendor=att - ;; - 3b*) - cpu=we32k - vendor=att - ;; - bluegene*) - cpu=powerpc - vendor=ibm - basic_os=cnk - ;; - decsystem10* | dec10*) - cpu=pdp10 - vendor=dec - basic_os=tops10 - ;; - decsystem20* | dec20*) - cpu=pdp10 - vendor=dec - basic_os=tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - cpu=m68k - vendor=motorola - ;; - dpx2*) - cpu=m68k - vendor=bull - basic_os=sysv3 - ;; - encore | umax | mmax) - cpu=ns32k - vendor=encore - ;; - elxsi) - cpu=elxsi - vendor=elxsi - basic_os=${basic_os:-bsd} - ;; - fx2800) - cpu=i860 - vendor=alliant - ;; - genix) - cpu=ns32k - vendor=ns - ;; - h3050r* | hiux*) - cpu=hppa1.1 - vendor=hitachi - basic_os=hiuxwe2 - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - cpu=m68000 - vendor=hp - ;; - hp9k3[2-9][0-9]) - cpu=m68k - vendor=hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - cpu=hppa1.1 - vendor=hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - i*86v32) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=sysv32 - ;; - i*86v4*) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=sysv4 - ;; - i*86v) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=sysv - ;; - i*86sol2) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=solaris2 - ;; - j90 | j90-cray) - cpu=j90 - vendor=cray - basic_os=${basic_os:-unicos} - ;; - iris | iris4d) - cpu=mips - vendor=sgi - case $basic_os in - irix*) - ;; - *) - basic_os=irix4 - ;; - esac - ;; - miniframe) - cpu=m68000 - vendor=convergent - ;; - *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) - cpu=m68k - vendor=atari - basic_os=mint - ;; - news-3600 | risc-news) - cpu=mips - vendor=sony - basic_os=newsos - ;; - next | m*-next) - cpu=m68k - vendor=next - case $basic_os in - openstep*) - ;; - nextstep*) - ;; - ns2*) - basic_os=nextstep2 - ;; - *) - basic_os=nextstep3 - ;; - esac - ;; - np1) - cpu=np1 - vendor=gould - ;; - op50n-* | op60c-*) - cpu=hppa1.1 - vendor=oki - basic_os=proelf - ;; - pa-hitachi) - cpu=hppa1.1 - vendor=hitachi - basic_os=hiuxwe2 - ;; - pbd) - cpu=sparc - vendor=tti - ;; - pbb) - cpu=m68k - vendor=tti - ;; - pc532) - cpu=ns32k - vendor=pc532 - ;; - pn) - cpu=pn - vendor=gould - ;; - power) - cpu=power - vendor=ibm - ;; - ps2) - cpu=i386 - vendor=ibm - ;; - rm[46]00) - cpu=mips - vendor=siemens - ;; - rtpc | rtpc-*) - cpu=romp - vendor=ibm - ;; - sde) - cpu=mipsisa32 - vendor=sde - basic_os=${basic_os:-elf} - ;; - simso-wrs) - cpu=sparclite - vendor=wrs - basic_os=vxworks - ;; - tower | tower-32) - cpu=m68k - vendor=ncr - ;; - vpp*|vx|vx-*) - cpu=f301 - vendor=fujitsu - ;; - w65) - cpu=w65 - vendor=wdc - ;; - w89k-*) - cpu=hppa1.1 - vendor=winbond - basic_os=proelf - ;; - none) - cpu=none - vendor=none - ;; - leon|leon[3-9]) - cpu=sparc - vendor=$basic_machine - ;; - leon-*|leon[3-9]-*) - cpu=sparc - vendor=`echo "$basic_machine" | sed 's/-.*//'` - ;; - - *-*) - # shellcheck disable=SC2162 - saved_IFS=$IFS - IFS="-" read cpu vendor <&2 - exit 1 - ;; - esac - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $vendor in - digital*) - vendor=dec - ;; - commodore*) - vendor=cbm - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if test x"$basic_os" != x -then - -# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just -# set os. -obj= -case $basic_os in - gnu/linux*) - kernel=linux - os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` - ;; - os2-emx) - kernel=os2 - os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` - ;; - nto-qnx*) - kernel=nto - os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` - ;; - *-*) - # shellcheck disable=SC2162 - saved_IFS=$IFS - IFS="-" read kernel os <&2 - fi - ;; - *) - echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 - exit 1 - ;; -esac - -case $obj in - aout* | coff* | elf* | pe*) - ;; - '') - # empty is fine - ;; - *) - echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 - exit 1 - ;; -esac - -# Here we handle the constraint that a (synthetic) cpu and os are -# valid only in combination with each other and nowhere else. -case $cpu-$os in - # The "javascript-unknown-ghcjs" triple is used by GHC; we - # accept it here in order to tolerate that, but reject any - # variations. - javascript-ghcjs) - ;; - javascript-* | *-ghcjs) - echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 - exit 1 - ;; -esac - -# As a final step for OS-related things, validate the OS-kernel combination -# (given a valid OS), if there is a kernel. -case $kernel-$os-$obj in - linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ - | linux-mlibc*- | linux-musl*- | linux-newlib*- \ - | linux-relibc*- | linux-uclibc*- ) - ;; - uclinux-uclibc*- ) - ;; - managarm-mlibc*- | managarm-kernel*- ) - ;; - windows*-msvc*-) - ;; - -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ - | -uclibc*- ) - # These are just libc implementations, not actual OSes, and thus - # require a kernel. - echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 - exit 1 - ;; - -kernel*- ) - echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 - exit 1 - ;; - *-kernel*- ) - echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 - exit 1 - ;; - *-msvc*- ) - echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 - exit 1 - ;; - kfreebsd*-gnu*- | kopensolaris*-gnu*-) - ;; - vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) - ;; - nto-qnx*-) - ;; - os2-emx-) - ;; - *-eabi*- | *-gnueabi*-) - ;; - none--*) - # None (no kernel, i.e. freestanding / bare metal), - # can be paired with an machine code file format - ;; - -*-) - # Blank kernel with real OS is always fine. - ;; - --*) - # Blank kernel and OS with real machine code file format is always fine. - ;; - *-*-*) - echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 - exit 1 - ;; -esac - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -case $vendor in - unknown) - case $cpu-$os in - *-riscix*) - vendor=acorn - ;; - *-sunos*) - vendor=sun - ;; - *-cnk* | *-aix*) - vendor=ibm - ;; - *-beos*) - vendor=be - ;; - *-hpux*) - vendor=hp - ;; - *-mpeix*) - vendor=hp - ;; - *-hiux*) - vendor=hitachi - ;; - *-unos*) - vendor=crds - ;; - *-dgux*) - vendor=dg - ;; - *-luna*) - vendor=omron - ;; - *-genix*) - vendor=ns - ;; - *-clix*) - vendor=intergraph - ;; - *-mvs* | *-opened*) - vendor=ibm - ;; - *-os400*) - vendor=ibm - ;; - s390-* | s390x-*) - vendor=ibm - ;; - *-ptx*) - vendor=sequent - ;; - *-tpf*) - vendor=ibm - ;; - *-vxsim* | *-vxworks* | *-windiss*) - vendor=wrs - ;; - *-aux*) - vendor=apple - ;; - *-hms*) - vendor=hitachi - ;; - *-mpw* | *-macos*) - vendor=apple - ;; - *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) - vendor=atari - ;; - *-vos*) - vendor=stratus - ;; - esac - ;; -esac - -echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" -exit - -# Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/amuse_tsunami/support/shared/install-sh b/src/amuse_tsunami/support/shared/install-sh deleted file mode 100755 index ec298b5374..0000000000 --- a/src/amuse_tsunami/support/shared/install-sh +++ /dev/null @@ -1,541 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2020-11-14.01; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -tab=' ' -nl=' -' -IFS=" $tab$nl" - -# Set DOITPROG to "echo" to test this script. - -doit=${DOITPROG-} -doit_exec=${doit:-exec} - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -# Create dirs (including intermediate dirs) using mode 755. -# This is like GNU 'install' as of coreutils 8.32 (2020). -mkdir_umask=22 - -backupsuffix= -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -is_target_a_directory=possibly - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -p pass -p to $cpprog. - -s $stripprog installed files. - -S SUFFIX attempt to back up existing files, with suffix SUFFIX. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG - -By default, rm is invoked with -f; when overridden with RMPROG, -it's up to you to specify -f if you want it. - -If -S is not specified, no backups are attempted. - -Email bug reports to bug-automake@gnu.org. -Automake home page: https://www.gnu.org/software/automake/ -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -p) cpprog="$cpprog -p";; - - -s) stripcmd=$stripprog;; - - -S) backupsuffix="$2" - shift;; - - -t) - is_target_a_directory=always - dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) is_target_a_directory=never;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -# We allow the use of options -d and -T together, by making -d -# take the precedence; this is for compatibility with GNU install. - -if test -n "$dir_arg"; then - if test -n "$dst_arg"; then - echo "$0: target directory not allowed when installing a directory." >&2 - exit 1 - fi -fi - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call 'install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - if test $# -gt 1 || test "$is_target_a_directory" = always; then - if test ! -d "$dst_arg"; then - echo "$0: $dst_arg: Is not a directory." >&2 - exit 1 - fi - fi -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for 'test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - # Don't chown directories that already exist. - if test $dstdir_status = 0; then - chowncmd="" - fi - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename. - if test -d "$dst"; then - if test "$is_target_a_directory" = never; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dstbase=`basename "$src"` - case $dst in - */) dst=$dst$dstbase;; - *) dst=$dst/$dstbase;; - esac - dstdir_status=0 - else - dstdir=`dirname "$dst"` - test -d "$dstdir" - dstdir_status=$? - fi - fi - - case $dstdir in - */) dstdirslash=$dstdir;; - *) dstdirslash=$dstdir/;; - esac - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - # The $RANDOM variable is not portable (e.g., dash). Use it - # here however when possible just to lower collision chance. - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - - trap ' - ret=$? - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null - exit $ret - ' 0 - - # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' - # directory is successfully created first before we actually test - # 'mkdir -p'. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - oIFS=$IFS - IFS=/ - set -f - set fnord $dstdir - shift - set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=${dstdirslash}_inst.$$_ - rmtmp=${dstdirslash}_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && - { test -z "$stripcmd" || { - # Create $dsttmp read-write so that cp doesn't create it read-only, - # which would cause strip to fail. - if test -z "$doit"; then - : >"$dsttmp" # No need to fork-exec 'touch'. - else - $doit touch "$dsttmp" - fi - } - } && - $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - set +f && - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # If $backupsuffix is set, and the file being installed - # already exists, attempt a backup. Don't worry if it fails, - # e.g., if mv doesn't support -f. - if test -n "$backupsuffix" && test -f "$dst"; then - $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null - fi - - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" -# time-stamp-end: "; # UTC" -# End: diff --git a/src/amuse_tsunami/support/shared/m4/amuse_conda.m4 b/src/amuse_tsunami/support/shared/m4/amuse_conda.m4 deleted file mode 100644 index f015fa7dab..0000000000 --- a/src/amuse_tsunami/support/shared/m4/amuse_conda.m4 +++ /dev/null @@ -1,36 +0,0 @@ -# AMUSE_CONDA_LIST() -# -# Runs conda list and saves the result in amuse_conda_list. -# The conda list command is rather slow, so we can avoid an annoying wait by running -# it once and saving the output for use with AMUSE_CONDA_PACKAGE below. -# -# Note that we can't save newlines in a shell variable, so we're replacing them with -# circumflexes instead. We change them back below before grepping. -AC_DEFUN([AMUSE_CONDA_LIST],[ - amuse_conda_list="$(conda list | tr '\n' '^')" -]) - - -# AMUSE_CONDA_PACKAGE(VARIABLE, NAME, VALUE) -# -# Checks that the given package is installed in the active conda environment. -# -# You must run AMUSE_CONDA_LIST() before calling this macro. -# -# Sets $VARIABLE to VALUE if the package was found, or "yes" if VALUE is not passed. -AC_DEFUN([AMUSE_CONDA_PACKAGE],[ - AC_MSG_CHECKING([for conda package $2]) - ax_conda_package_line="$(echo $amuse_conda_list | tr '^' '\n' | grep '^$2 ')" - AS_IF([test "$?" = "0"], [ - # $1="$(AS_ECHO("$ax_conda_package_line") | tr -s ' ' | cut -f 2 -d ' ')" - m4_if([$3],[], [ - $1="yes" - ], [ - $1="$3" - ]) - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) -]) - diff --git a/src/amuse_tsunami/support/shared/m4/amuse_cuda.m4 b/src/amuse_tsunami/support/shared/m4/amuse_cuda.m4 deleted file mode 100644 index 1da58a131e..0000000000 --- a/src/amuse_tsunami/support/shared/m4/amuse_cuda.m4 +++ /dev/null @@ -1,232 +0,0 @@ -# AMUSE_CUDA_VERIFY_HEADERS(PATH) -# -# Checks that the given path contains a CUDA installation with include/cuda.h. -# -# Sets amuse_cuda_verify_FLAGS to -I/path/to/cuda/include if successful. -AC_DEFUN([AMUSE_CUDA_VERIFY_HEADERS], [ - AS_IF([test "x$1" = x], [ - amuse_cuda_verify_msg="for cuda.h" - amuse_cuda_flags= - ], [ - amuse_cuda_verify_msg="for cuda.h in $1/include" - amuse_cuda_flags="-I$1/include" - ]) - - AC_MSG_CHECKING([$amuse_cuda_verify_msg]) - amuse_cuda_verify_FLAGS= - - ax_save_CFLAGS="$CFLAGS" - - CFLAGS="$amuse_cuda_flags" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ])], [ - amuse_cuda_verify_FLAGS="$CFLAGS" - amuse_cuda_verify_headers_found="yes" - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - - CFLAGS="$ax_save_CFLAGS" -]) - -# AMUSE_CUDA_VERIFY_LIBS(PATH) -# -# Checks that the given path contains a CUDA installation with lib/libcudart.so or -# lib64/libcudart.so. -# -# Sets amuse_cuda_verify_LDFLAGS to -L/path/to/cuda/lib{64} if successful. -AC_DEFUN([AMUSE_CUDA_VERIFY_LIBS], [ - AS_IF([test "x$1" = x], [ - amuse_cuda_verify_msg="for libcudart" - amuse_cuda_ldflags= - ], [ - amuse_cuda_verify_msg="for libcudart in $1/lib" - amuse_cuda_verify_msg64="for libcudart in $1/lib64" - amuse_cuda_ldflags="-L$1/lib" - amuse_cuda_ldflags64="-L$1/lib64" - ]) - - AC_MSG_CHECKING([$amuse_cuda_verify_msg]) - amuse_cuda_verify_LDFLAGS= - - ax_save_LDFLAGS="$LDFLAGS" - ax_save_LIBS="$LIBS" - - LDFLAGS="$amuse_cuda_ldflags" - LIBS="-lcudart" - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [cudaFree(0);])], [ - amuse_cuda_verify_LDFLAGS="$LDFLAGS" - amuse_cuda_verify_libs_found="yes" - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - - AS_IF([test "x$amuse_cuda_verify_libs_found" = x], [ - AC_MSG_CHECKING([$amuse_cuda_verify_msg64]) - LDFLAGS="$amuse_cuda_ldflags64" - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [cudaFree(0);])], [ - amuse_cuda_verify_LDFLAGS="$LDFLAGS" - amuse_cuda_verify_libs_found="yes" - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - ]) - - LIBS="$ax_save_LIBS" - LDFLAGS="$ax_save_LDFLAGS" -]) - -# AMUSE_CUDA_VERIFY_SET_VARS(CUDA_TK) -# -# Sets CUDA_TK, NVCC, CUDA_FLAGS and CUDA_LDFLAGS from the internal values, if all -# of them have been found. -AC_DEFUN([AMUSE_CUDA_VERIFY_SET_VARS], [ - AS_IF( - [test \(x"$amuse_cuda_verify_NVCC" != x\) -a \(x"$amuse_cuda_verify_headers_found" != x\) -a \(x"$amuse_cuda_verify_libs_found" != x\)], - [ - CUDA_TK="$1" - NVCC="$amuse_cuda_verify_NVCC" - CUDA_FLAGS="$amuse_cuda_verify_FLAGS" - CUDA_LDFLAGS="$amuse_cuda_verify_LDFLAGS" - ] - ) -]) - -# AMUSE_CUDA_VERIFY(PATH) -# -# Checks that the given path contains a CUDA installation with bin/nvcc, -# lib/libcudart.so, and include/cuda.h. -# -# Sets CUDA_TK= if successful, and if successful also sets NVCC to the location -# of nvcc, CUDA_LDFLAGS to -L/path/to/cuda/libs, and CUDA_FLAGS to -# -I/path/to/cuda/include. -AC_DEFUN([AMUSE_CUDA_VERIFY], [ - amuse_cuda_verify_headers_found= - amuse_cuda_verify_libs_found= - - AS_IF([test -d $1], [ - AC_PATH_PROG([amuse_cuda_verify_NVCC], [nvcc], [], [$1/bin]) - - AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ - AMUSE_CUDA_VERIFY_HEADERS([$1]) - ]) - - AS_IF([test x"$amuse_cuda_verify_headers_found" != x], [ - AMUSE_CUDA_VERIFY_LIBS([$1]) - ]) - - AMUSE_CUDA_VERIFY_SET_VARS([$1]) - ], [ - AC_MSG_NOTICE([$1 does not exist or is not a directory, CUDA not found there]) - ]) -]) - -# AMUSE_CUDA_VERIFY_DEFAULT() -# -# Checks for NVCC on the PATH, then finds the CUDA directory from there. -# -# Sets CUDA_TK= if successful, and if successful also sets NVCC to the location -# of nvcc, CUDA_LDFLAGS to -L/path/to/cuda/libs, and CUDA_FLAGS to -# -I/path/to/cuda/include. -AC_DEFUN([AMUSE_CUDA_VERIFY_DEFAULT], [ - AC_PATH_PROG([amuse_cuda_verify_NVCC], [nvcc]) - - AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ - # Got nvcc, verify that we have the rest too - amuse_cuda_verify_ctk_rel=$(dirname -- "$amuse_cuda_verify_NVCC")/.. - # Canonicalise path portably so that it looks nicer - amuse_cuda_verify_CUDA_TK=$(test -d "$amuse_cuda_verify_ctk_rel" && CDPATH= cd -P -- "$amuse_cuda_verify_ctk_rel" && pwd -P) - - AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ - AMUSE_CUDA_VERIFY_HEADERS() - ]) - - AS_IF([test x"$amuse_cuda_verify_headers_found" != x], [ - AMUSE_CUDA_VERIFY_LIBS() - ]) - - AMUSE_CUDA_VERIFY_SET_VARS([$amuse_cuda_verify_CUDA_TK]) - ], [ - AC_MSG_NOTICE([Could not find CUDA via PATH]) - ]) -]) - -# AMUSE_CUDA -# ---------------------------------------------------------- -# set up for CUDA -# -# will set: -# -# CUDA_TK -# NVCC -# -# CUDA_LDFLAGS (with -L/path/to/cuda/lib) -# CUDA_FLAGS (with -I/path/to/cuda/include) -# -# and call AC_SUBST on them. -# -AC_DEFUN([AMUSE_CUDA], [ - AC_LANG_PUSH([C]) - AS_IF([test x"$CUDA_TK" != x], [ - # User set CUDA_TK, verify and use it if it works - AMUSE_CUDA_VERIFY($CUDA_TK) - - AS_IF([test x"$NVCC" = x], [ - AC_MSG_ERROR([CUDA_TK is set, but there is no nvcc in $CUDA_TK/bin. Please set CUDA_TK to the CUDA installation directory, or unset it to autodetect.]) - ]) - ], [ - # CUDA_TK not set, try to discover CUDA via PATH - AMUSE_CUDA_VERIFY_DEFAULT() - - # Not in PATH, try default directory - AS_IF([test x"$CUDA_TK" = x], [ - AMUSE_CUDA_VERIFY([/usr/local/cuda]) - ]) - - # Try /usr/local/cuda-#.#, but only if there's exactly one match - AS_IF([test x"$CUDA_TK" = x], [ - # List CUDA installations - amuse_cuda_installs=$(ls -1 -d /usr/local/cuda-*.* 2>/dev/null) - # If there's more than one, the above will have newlines, and change when we do this - amuse_cuda_installs2=$(echo "x${amuse_cuda_installs}" | tr -d '[:space:]') - AS_IF([test "x${amuse_cuda_installs}" != x], [ - AS_IF([test "x${amuse_cuda_installs}" = "${amuse_cuda_installs2}"], [ - # Here, there's exactly one match - AMUSE_CUDA_VERIFY([$amuse_cuda_installs]) - ], [ - AC_MSG_NOTICE([Multiple CUDA installations found in /usr/local, without a /usr/local/cuda symlink. Please set CUDA_TK to specify which one you want to use.]) - ]) - ], [ - AC_MSG_NOTICE([No CUDA installations found in /usr/local]) - ]) - ]) - - # Try some other locations - for dir in /opt/cuda /usr/local/cuda/cuda /opt/cuda/cuda ; do - AS_IF([test x"$CUDA_TK" = x], [ - AMUSE_CUDA_VERIFY([$dir]) - ]) - done - - # These directories were checked by the old macro, but they're highly obsolete - # so we're not trying them anymore: - # /usr/lib/nvidia, /usr/include/nvidia, /usr/lib/nvidia-current, /usr/include/nvidia-current - - AS_IF([test x"$CUDA_TK" = x], [ - AC_MSG_NOTICE([CUDA not found. Set CUDA_TK if you have it in an odd location.]) - ]) - ]) - - AS_IF([test x"$CUDA_TK" != x], [ - AC_MSG_NOTICE([CUDA found at $CUDA_TK]) - AC_SUBST(CUDA_TK) - AC_SUBST(NVCC) - AC_SUBST(CUDA_FLAGS) - AC_SUBST(CUDA_LDFLAGS) - ]) - - AC_LANG_POP([C]) -]) - diff --git a/src/amuse_tsunami/support/shared/m4/amuse_detect_os.m4 b/src/amuse_tsunami/support/shared/m4/amuse_detect_os.m4 deleted file mode 100644 index ad5375e7b2..0000000000 --- a/src/amuse_tsunami/support/shared/m4/amuse_detect_os.m4 +++ /dev/null @@ -1,19 +0,0 @@ -# Macro for detecting the platform we're on -# -# Sets AMUSE_ON_MACOS if we're on macOS, or AMUSE_ON_LINUX if we're on GNU/Linux. -AC_DEFUN([AMUSE_DETECT_OS], [ - AC_CANONICAL_TARGET - if test "x$target_os" == "xlinux-gnu" - then - AMUSE_ON_LINUX=1 - fi - - if test "x$target_vendor" == "xapple" - then - AMUSE_ON_MACOS=1 - fi - - AC_SUBST([AMUSE_ON_LINUX]) - AC_SUBST([AMUSE_ON_MACOS]) -]) - diff --git a/src/amuse_tsunami/support/shared/m4/amuse_download.m4 b/src/amuse_tsunami/support/shared/m4/amuse_download.m4 deleted file mode 100644 index 6cd03aee6f..0000000000 --- a/src/amuse_tsunami/support/shared/m4/amuse_download.m4 +++ /dev/null @@ -1,38 +0,0 @@ -# Helper macros for detecting download tools -# -# Some of the community codes aren't included with AMUSE, but are downloaded at build -# time. We need a tool for that, and here is where we find one. -# -# AMUSE_DOWNLOAD() -# -# Searches for a download tool. Two popular and commonly available command line -# download tools are curl and wget. This macro tries to find either one of them -# and sets DOWNLOAD to a command that will take a URL and download its contents to -# standard output. This makes it easier to write that output to a file with a known -# name, which you usually want in a Makefile. -# -# To download a file, use $(DOWNLOAD) https://example.com >example.html -# -AC_DEFUN([AMUSE_DOWNLOAD], [ - AC_CHECK_TOOL(WGET, wget) - AC_CHECK_TOOL(CURL, curl) - - AC_MSG_CHECKING([for a wget or curl to download files with]) - if test "x$WGET" != "x" - then - # The MESA SDK server rejects wget, this is the official work-around - DOWNLOAD="$WGET --progress=bar:force:noscroll --user-agent='' -O -" - AC_MSG_RESULT([yes]) - else - if test "x$CURL" != "x" - then - DOWNLOAD="$CURL -L" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - fi - - AC_SUBST([DOWNLOAD]) -]) - diff --git a/src/amuse_tsunami/support/shared/m4/amuse_lib.m4 b/src/amuse_tsunami/support/shared/m4/amuse_lib.m4 deleted file mode 100644 index a378d8de44..0000000000 --- a/src/amuse_tsunami/support/shared/m4/amuse_lib.m4 +++ /dev/null @@ -1,138 +0,0 @@ -# Helper macros for detecting AMUSE libraries. -# -# See https://stackoverflow.com/questions/10220946/pkg-check-modules-considered-harmful -# for some background on why we're not using PKG_CHECK_MODULES directly. Do note that -# PKG_CHECK_MODULES checks for pkg-config and gives a useful error these days, so that -# that page is partially outdated. - -# AMUSE_LIB(prefix, module, library, function) -# -# Searches for an AMUSE library and sets ${prefix}_CFLAGS, ${prefix}_LIBS to the -# appropriate values if it is found. -# -# prefix: prefix for the variables to be set -# module: name of the pkg-config module to search for if needed -# library: name of the library to be searched for -# function: name of a function in the library to use for the link check -AC_DEFUN([AMUSE_LIB], [ - amuse_save_LIBS="$LIBS" - amuse_save_LIB_CFLAGS="$[$1][_CFLAGS]" - amuse_save_LIB_LIBS="$[$1][_LIBS]" - amuse_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" - - # If we have an active virtualenv, make sure pkg-config searches it - if test "a${VIRTUAL_ENV}" != "a" - then - PKG_CONFIG_PATH="${VIRTUAL_ENV}/lib/pkgconfig:${PKG_CONFIG_PATH}" - fi - - # All AMUSE libs export C symbols - AC_LANG_PUSH([C]) - - # Search for the library, first directly then fall back to pkg-config - AC_SEARCH_LIBS([$4], [$3], [ - FOUND_$1="yes" - $1_LIBS="$LIBS" - $1_CFLAGS="" - ], [ - PKG_CHECK_MODULES([$1], [$2], [ - FOUND_$1="yes" - ], [ - FOUND_$1="no" - ]) - ]) - - AC_LANG_POP([C]) - - PKG_CONFIG_PATH="$amuse_save_PKG_CONFIG_PATH" - LIBS="$amuse_save_LIBS" - - # If we have an active CONDA environment, assume that the lib is coming from - # there and add an additional flag so that .mod files can be found. Only really - # needed for stopcond and forsockets, and hopefully conda-forge will give us a - # better solution soon. - if test "${FOUND_$1}" == "yes" -a "x$CONDA_PREFIX" != "x" - then - $1_CFLAGS="${$1_CFLAGS} -I${CONDA_PREFIX}/include" - fi - - # If the user overrode the variables, go with what they set instead of - # what we just detected. - AS_IF([test "x$amuse_save_LIB_CFLAGS" != "x"], [ - $1_CFLAGS="$amuse_save_LIB_CFLAGS" - ]) - AS_IF([test "x$amuse_save_LIB_LIBS" != "x"], [ - $1_LIBS="$amuse_save_LIB_LIBS" - ]) - - AC_SUBST([FOUND_][$1]) - AC_SUBST([$1][_CFLAGS]) - AC_SUBST([$1][_LIBS]) -]) - - -# AMUSE_LIB_STOPCOND() -# -# Searches for the AMUSE stopping conditions library and sets STOPCOND_CFLAGS -# and STOPCOND_LIBS to the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_STOPCOND], [ - AMUSE_LIB([STOPCOND], [stopcond], [stopcond], [is_condition_enabled]) -]) - - -# AMUSE_LIB_STOPCONDMPI() -# -# Searches for the AMUSE stopping conditions library and sets STOPCONDMPI_CFLAGS -# and STOPCONDMPI_LIBS to the appropriate values if it is found. -# -# We use a different function here, to avoid getting a cached value from -# AMUSE_LIB_STOPCOND if both are used. Seems like it indexes by function name. -AC_DEFUN([AMUSE_LIB_STOPCONDMPI], [ - AMUSE_LIB([STOPCONDMPI], [stopcondmpi], [stopcondmpi], [get_set_conditions_]) -]) - - -# AMUSE_LIB_AMUSE_MPI() -# -# Searches for the AMUSE MPI helper library and sets AMUSE_MPI_CFLAGS and -# AMUSE_MPI_LIBS to the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_AMUSE_MPI], [ - AMUSE_LIB([AMUSE_MPI], [amuse_mpi], [amuse_mpi], [get_comm_world]) -]) - - -# AMUSE_LIB_FORSOCKETS() -# -# Searches for the AMUSE forsockets library and sets FORSOCKETS_CFLAGS and -# FORSOCKETS_LIBS to the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_FORSOCKETS], [ - AMUSE_LIB([FORSOCKETS], [forsockets], [forsockets], [forsockets_close]) -]) - - -# AMUSE_LIB_SIMPLE_HASH() -# -# Searches for the AMUSE simple hash library and sets SIMPLE_HASH_CFLAGS and -# SIMPLE_HASH_LIBS to the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_SIMPLE_HASH], [ - AMUSE_LIB([SIMPLE_HASH], [simple_hash], [simple_hash], [init_hash]) -]) - - -# AMUSE_LIB_G6LIB() -# -# Searches for the g6 library and sets G6LIB_CFLAGS and G6LIB_LIBS to -# the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_G6LIB], [ - AMUSE_LIB([G6LIB], [g6lib], [g6], [g6_npipes]) -]) - - -# AMUSE_LIB_SAPPORO_LIGHT() -# -# Searches for the Sapporo light library and sets SAPPORO_LIGHT_CFLAGS and -# SAPPORO_LIGHT_LIBS to the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_SAPPORO_LIGHT], [ - AMUSE_LIB([SAPPORO_LIGHT], [sapporo_light], [sapporo], [get_device_count]) -]) - diff --git a/src/amuse_tsunami/support/shared/m4/amuse_lib_healpix.m4 b/src/amuse_tsunami/support/shared/m4/amuse_lib_healpix.m4 deleted file mode 100644 index 07b6ef6c5e..0000000000 --- a/src/amuse_tsunami/support/shared/m4/amuse_lib_healpix.m4 +++ /dev/null @@ -1,48 +0,0 @@ -# Helper macro for detecting libhealpix_cxx -# -# AMUSE_LIB_HEALPIX_CXX() -# -# Searches for libhealpix_cxx and sets FOUND_HEALPIX_CXX to "yes" if found. -# -# Also sets HEALPIX_CXX_LIBS to any needed link commands, and HEALPIX_CXX_CFLAGS to any -# needed compiler flags. -# -AC_DEFUN([AMUSE_LIB_HEALPIX_CXX], [ - amuse_lib_healpix_cxx_save_libs="$LIBS" - - AC_MSG_CHECKING([for HEALPix]) - - AC_LANG_PUSH([C++]) - - LIBS="-lhealpix_cxx" - - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([ - #include - ], [ - Healpix_Base hb; - ]) - ], [ - FOUND_HEALPIX_CXX="yes" - HEALPIX_CXX_CFLAGS="" - HEALPIX_CXX_LIBS="$LIBS" - - AC_MSG_RESULT([yes]) - ], - [ - # Not found, try pkg-config instead - PKG_CHECK_MODULES([HEALPIX_CXX], [healpix_cxx], [ - FOUND_HEALPIX_CXX="yes" - AC_MSG_RESULT([yes]) - ], [ - FOUND_HEALPIX_CXX="no" - AC_MSG_RESULT([no]) - ]) - ]) - - AC_LANG_POP([C++]) - - AC_SUBST([HEALPIX_CXX_CFLAGS]) - AC_SUBST([HEALPIX_CXX_LIBS]) -]) - diff --git a/src/amuse_tsunami/support/shared/m4/amuse_lib_qhull.m4 b/src/amuse_tsunami/support/shared/m4/amuse_lib_qhull.m4 deleted file mode 100644 index 8761694163..0000000000 --- a/src/amuse_tsunami/support/shared/m4/amuse_lib_qhull.m4 +++ /dev/null @@ -1,30 +0,0 @@ -# Helper macro for detecting libqhull -# -# AMUSE_LIB_QHULL() -# -# Searches for libqhull and sets FOUND_QHULL to "yes" if found. -# -# Also sets QHULL_LIBS to any needed link commands, and QHULL_FLAGS to any needed -# compiler flags. -# -# Recent versions of libqhull have a reentrant libqhull_r and also a libqhull_p, but we -# test only for libqhull. -# -AC_DEFUN([AMUSE_LIB_QHULL], [ - amuse_lib_qhull_save_libs="$LIBS" - - LIBS="" - AC_SEARCH_LIBS([qh_freeqhull], [qhull_r], [ - FOUND_QHULL="yes" - ], []) - QHULL_LIBS="$LIBS" - QHULL_FLAGS="" - - LIBS="$amuse_lib_qhull_save_libs" - - AC_CHECK_HEADERS([libqhull_r/libqhull_r.h], [], [FOUND_QHULL="no"]) - - AC_SUBST([QHULL_LIBS]) - AC_SUBST([QHULL_FLAGS]) -]) - diff --git a/src/amuse_tsunami/support/shared/m4/amuse_opencl.m4 b/src/amuse_tsunami/support/shared/m4/amuse_opencl.m4 deleted file mode 100644 index 28b1efcd8e..0000000000 --- a/src/amuse_tsunami/support/shared/m4/amuse_opencl.m4 +++ /dev/null @@ -1,63 +0,0 @@ -# Helper macro for detecting OpenCL for C. - -# AMUSE_OPENCL() -# -# Sets FOUND_OPENCL to "yes" if OpenCL is found, to "no" if it is not. -# Sets OPENCL_CFLAGS and OPENCL_LIBS as needed. -# Calls AC_SUBST on all of the above. -# -AC_DEFUN([AMUSE_OPENCL], [ - amuse_save_CFLAGS="$CFLAGS" - amuse_save_LIBS="$LIBS" - - AC_MSG_CHECKING([for OpenCL]) - - # If the user overrode the variables, then we'll use what they set and verify that - # it works. - AS_IF([test "x$OPENCL_CFLAGS" != "x"], [ - amuse_user_OPENCL_CFLAGS="$OPENCL_CFLAGS" - CFLAGS="$OPENCL_CFLAGS $CFLAGS" - ]) - AS_IF([test "x$OPENCL_LIBS" != "x"], [ - amuse_user_OPENCL_LIBS="$OPENCL_LIBS" - LIBS="$OPENCL_LIBS $LIBS" - ]) - - # We only use OpenCL from C, in huayno - AC_LANG_PUSH([C]) - - # Search for the headers - m4_define([amuse_opencl_test_program], [AC_LANG_PROGRAM([ - #if defined(__APPLE__) || defined(__MACOSX) - #include - #else - #include - #endif - ], [clFinish(0)])]) - - AC_COMPILE_IFELSE([amuse_opencl_test_program], [ - # Search for the library as well - LIBS="-lOpenCL $LIBS" - AC_LINK_IFELSE([amuse_opencl_test_program], [ - FOUND_OPENCL="yes" - OPENCL_LIBS="-lOpenCL" - OPENCL_CFLAGS="" - ], [ - FOUND_OPENCL="no" - ]) - ], [ - FOUND_OPENCL="no" - ]) - - AC_LANG_POP([C]) - - LIBS="$amuse_save_LIBS" - CFLAGS="$amuse_save_CFLAGS" - - AC_MSG_RESULT([$FOUND_OPENCL]) - - AC_SUBST([FOUND_OPENCL]) - AC_SUBST([OPENCL_CFLAGS]) - AC_SUBST([OPENCL_LIBS]) -]) - diff --git a/src/amuse_tsunami/support/shared/m4/amuse_venv.m4 b/src/amuse_tsunami/support/shared/m4/amuse_venv.m4 deleted file mode 100644 index 155d88d9d6..0000000000 --- a/src/amuse_tsunami/support/shared/m4/amuse_venv.m4 +++ /dev/null @@ -1,31 +0,0 @@ -# Helper macro for installing into Conda envs and virtualenvs. - -# AMUSE_VENV() -# -# Detect the active Conda env or virtualenv and extend LDFLAGS and -# PKG_CONFIG_PATH to point to it. This then makes it possible to detect the AMUSE -# libraries as installed in the environment and link to them. -# -AC_DEFUN([AMUSE_VENV], [ - AS_IF([test "x$VIRTUAL_ENV" != x], [ - CFLAGS="$CFLAGS -I${VIRTUAL_ENV}/include" - CXXFLAGS="$CXXFLAGS -I${VIRTUAL_ENV}/include" - FFLAGS="$FFLAGS -I${VIRTUAL_ENV}/include" - FCFLAGS="$FCFLAGS -I${VIRTUAL_ENV}/include" - LDFLAGS="$LDFLAGS -L${VIRTUAL_ENV}/lib -Wl,-rpath,${VIRTUAL_ENV}/lib" - PKG_CONFIG_PATH="$VIRTUAL_ENV/lib/pkgconfig:$PKG_CONFIG_PATH" - ]) - - AS_IF([test "x$CONDA_PREFIX" != x], [ - # Conda does not set FCFLAGS, so we copy from FFLAGS here - FCFLAGS="$FFLAGS" - LDFLAGS="$LDFLAGS -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib" - # Conda pkg-config includes this already, but in case we have one from - # the system... - PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${CONDA_PREFIX}/lib/pkgconfig" - ]) - # Needs to be exported or the PKG_CHECK_MODULES macro won't see it - export PKG_CONFIG_PATH - AC_SUBST([FFLAGS]) -]) - diff --git a/src/amuse_tsunami/support/shared/m4/ax_blas.m4 b/src/amuse_tsunami/support/shared/m4/ax_blas.m4 deleted file mode 100644 index 95719050a9..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_blas.m4 +++ /dev/null @@ -1,241 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_blas.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro looks for a library that implements the BLAS linear-algebra -# interface (see http://www.netlib.org/blas/). On success, it sets the -# BLAS_LIBS output variable to hold the requisite library linkages. -# -# To link with BLAS, you should link with: -# -# $BLAS_LIBS $LIBS $FLIBS -# -# in that order. FLIBS is the output variable of the -# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is -# sometimes necessary in order to link with F77 libraries. Users will also -# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same -# reason. -# -# Many libraries are searched for, from ATLAS to CXML to ESSL. The user -# may also use --with-blas= in order to use some specific BLAS -# library . In order to link successfully, however, be aware that you -# will probably need to use the same Fortran compiler (which can be set -# via the F77 env. var.) as was used to compile the BLAS library. -# -# ACTION-IF-FOUND is a list of shell commands to run if a BLAS library is -# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is -# not found. If ACTION-IF-FOUND is not specified, the default action will -# define HAVE_BLAS. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# Copyright (c) 2019 Geoffrey M. Oxberry -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 17 - -AU_ALIAS([ACX_BLAS], [AX_BLAS]) -AC_DEFUN([AX_BLAS], [ -AC_PREREQ([2.55]) -AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) -AC_REQUIRE([AC_CANONICAL_HOST]) -ax_blas_ok=no - -AC_ARG_WITH(blas, - [AS_HELP_STRING([--with-blas=], [use BLAS library ])]) -case $with_blas in - yes | "") ;; - no) ax_blas_ok=disable ;; - -* | */* | *.a | *.so | *.so.* | *.dylib | *.dylib.* | *.o) - BLAS_LIBS="$with_blas" - ;; - *) BLAS_LIBS="-l$with_blas" ;; -esac - -# Get fortran linker names of BLAS functions to check for. -AC_F77_FUNC(sgemm) -AC_F77_FUNC(dgemm) - -ax_blas_save_LIBS="$LIBS" -LIBS="$LIBS $FLIBS" - -# First, check BLAS_LIBS environment variable -if test $ax_blas_ok = no; then -if test "x$BLAS_LIBS" != x; then - save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" - AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS]) - AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes], [BLAS_LIBS=""]) - AC_MSG_RESULT($ax_blas_ok) - LIBS="$save_LIBS" -fi -fi - -# BLAS linked to by default? (happens on some supercomputers) -if test $ax_blas_ok = no; then - save_LIBS="$LIBS"; LIBS="$LIBS" - AC_MSG_CHECKING([if $sgemm is being linked in already]) - AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes]) - AC_MSG_RESULT($ax_blas_ok) - LIBS="$save_LIBS" -fi - -# BLAS in OpenBLAS library? (http://xianyi.github.com/OpenBLAS/) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(openblas, $sgemm, [ax_blas_ok=yes - BLAS_LIBS="-lopenblas"]) -fi - -# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(atlas, ATL_xerbla, - [AC_CHECK_LIB(f77blas, $sgemm, - [AC_CHECK_LIB(cblas, cblas_dgemm, - [ax_blas_ok=yes - BLAS_LIBS="-lcblas -lf77blas -latlas"], - [], [-lf77blas -latlas])], - [], [-latlas])]) -fi - -# BLAS in PhiPACK libraries? (requires generic BLAS lib, too) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(blas, $sgemm, - [AC_CHECK_LIB(dgemm, $dgemm, - [AC_CHECK_LIB(sgemm, $sgemm, - [ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"], - [], [-lblas])], - [], [-lblas])]) -fi - -# BLAS in Intel MKL library? -if test $ax_blas_ok = no; then - # MKL for gfortran - if test x"$ac_cv_fc_compiler_gnu" = xyes; then - # 64 bit - if test $host_cpu = x86_64; then - AC_CHECK_LIB(mkl_gf_lp64, $sgemm, - [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread"],, - [-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread]) - # 32 bit - elif test $host_cpu = i686; then - AC_CHECK_LIB(mkl_gf, $sgemm, - [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf -lmkl_sequential -lmkl_core -lpthread"],, - [-lmkl_gf -lmkl_sequential -lmkl_core -lpthread]) - fi - # MKL for other compilers (Intel, PGI, ...?) - else - # 64-bit - if test $host_cpu = x86_64; then - AC_CHECK_LIB(mkl_intel_lp64, $sgemm, - [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread"],, - [-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread]) - # 32-bit - elif test $host_cpu = i686; then - AC_CHECK_LIB(mkl_intel, $sgemm, - [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel -lmkl_sequential -lmkl_core -lpthread"],, - [-lmkl_intel -lmkl_sequential -lmkl_core -lpthread]) - fi - fi -fi -# Old versions of MKL -if test $ax_blas_ok = no; then - AC_CHECK_LIB(mkl, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lmkl -lguide -lpthread"],,[-lguide -lpthread]) -fi - -# BLAS in Apple vecLib library? -if test $ax_blas_ok = no; then - save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS" - AC_MSG_CHECKING([for $sgemm in -framework vecLib]) - AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"]) - AC_MSG_RESULT($ax_blas_ok) - LIBS="$save_LIBS" -fi - -# BLAS in Alpha CXML library? -if test $ax_blas_ok = no; then - AC_CHECK_LIB(cxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lcxml"]) -fi - -# BLAS in Alpha DXML library? (now called CXML, see above) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(dxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-ldxml"]) -fi - -# BLAS in Sun Performance library? -if test $ax_blas_ok = no; then - if test "x$GCC" != xyes; then # only works with Sun CC - AC_CHECK_LIB(sunmath, acosp, - [AC_CHECK_LIB(sunperf, $sgemm, - [BLAS_LIBS="-xlic_lib=sunperf -lsunmath" - ax_blas_ok=yes],[],[-lsunmath])]) - fi -fi - -# BLAS in SCSL library? (SGI/Cray Scientific Library) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(scs, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lscs"]) -fi - -# BLAS in SGIMATH library? -if test $ax_blas_ok = no; then - AC_CHECK_LIB(complib.sgimath, $sgemm, - [ax_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"]) -fi - -# BLAS in IBM ESSL library? (requires generic BLAS lib, too) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(blas, $sgemm, - [AC_CHECK_LIB(essl, $sgemm, - [ax_blas_ok=yes; BLAS_LIBS="-lessl -lblas"], - [], [-lblas $FLIBS])]) -fi - -# Generic BLAS library? -if test $ax_blas_ok = no; then - AC_CHECK_LIB(blas, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lblas"]) -fi - -AC_SUBST(BLAS_LIBS) - -LIBS="$ax_blas_save_LIBS" - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_blas_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1]) - : -else - ax_blas_ok=no - $2 -fi -])dnl AX_BLAS diff --git a/src/amuse_tsunami/support/shared/m4/ax_check_classpath.m4 b/src/amuse_tsunami/support/shared/m4/ax_check_classpath.m4 deleted file mode 100644 index 55b43d93e3..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_check_classpath.m4 +++ /dev/null @@ -1,61 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_classpath.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_CLASSPATH -# -# DESCRIPTION -# -# AX_CHECK_CLASSPATH just displays the CLASSPATH, for the edification of -# the user. -# -# Note: This is part of the set of autoconf M4 macros for Java programs. -# It is VERY IMPORTANT that you download the whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. The -# general documentation, as well as the sample configure.in, is included -# in the AX_PROG_JAVA macro. -# -# LICENSE -# -# Copyright (c) 2008 Stephane Bortzmeyer -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 6 - -AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH]) -AC_DEFUN([AX_CHECK_CLASSPATH],[ -if test "x$CLASSPATH" = x; then - echo "You have no CLASSPATH, I hope it is good" -else - echo "You have CLASSPATH $CLASSPATH, hope it is correct" -fi -]) - diff --git a/src/amuse_tsunami/support/shared/m4/ax_check_gnu_make.m4 b/src/amuse_tsunami/support/shared/m4/ax_check_gnu_make.m4 deleted file mode 100644 index 71ffe34817..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_check_gnu_make.m4 +++ /dev/null @@ -1,96 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_GNU_MAKE([run-if-true],[run-if-false]) -# -# DESCRIPTION -# -# This macro searches for a GNU version of make. If a match is found: -# -# * The makefile variable `ifGNUmake' is set to the empty string, otherwise -# it is set to "#". This is useful for including a special features in a -# Makefile, which cannot be handled by other versions of make. -# * The makefile variable `ifnGNUmake' is set to #, otherwise -# it is set to the empty string. This is useful for including a special -# features in a Makefile, which can be handled -# by other versions of make or to specify else like clause. -# * The variable `_cv_gnu_make_command` is set to the command to invoke -# GNU make if it exists, the empty string otherwise. -# * The variable `ax_cv_gnu_make_command` is set to the command to invoke -# GNU make by copying `_cv_gnu_make_command`, otherwise it is unset. -# * If GNU Make is found, its version is extracted from the output of -# `make --version` as the last field of a record of space-separated -# columns and saved into the variable `ax_check_gnu_make_version`. -# * Additionally if GNU Make is found, run shell code run-if-true -# else run shell code run-if-false. -# -# Here is an example of its use: -# -# Makefile.in might contain: -# -# # A failsafe way of putting a dependency rule into a makefile -# $(DEPEND): -# $(CC) -MM $(srcdir)/*.c > $(DEPEND) -# -# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) -# @ifGNUmake@ include $(DEPEND) -# @ifGNUmake@ else -# fallback code -# @ifGNUmake@ endif -# -# Then configure.in would normally contain: -# -# AX_CHECK_GNU_MAKE() -# AC_OUTPUT(Makefile) -# -# Then perhaps to cause gnu make to override any other make, we could do -# something like this (note that GNU make always looks for GNUmakefile -# first): -# -# if ! test x$_cv_gnu_make_command = x ; then -# mv Makefile GNUmakefile -# echo .DEFAULT: > Makefile ; -# echo \ $_cv_gnu_make_command \$@ >> Makefile; -# fi -# -# Then, if any (well almost any) other make is called, and GNU make also -# exists, then the other make wraps the GNU make. -# -# LICENSE -# -# Copyright (c) 2008 John Darrington -# Copyright (c) 2015 Enrico M. Crisostomo -# -# 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 12 - -AC_DEFUN([AX_CHECK_GNU_MAKE],dnl - [AC_PROG_AWK - AC_CACHE_CHECK([for GNU make],[_cv_gnu_make_command],[dnl - _cv_gnu_make_command="" ; -dnl Search all the common names for GNU make - for a in "$MAKE" make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if "$a" --version 2> /dev/null | grep GNU 2>&1 > /dev/null ; then - _cv_gnu_make_command=$a ; - AX_CHECK_GNU_MAKE_HEADLINE=$("$a" --version 2> /dev/null | grep "GNU Make") - ax_check_gnu_make_version=$(echo ${AX_CHECK_GNU_MAKE_HEADLINE} | ${AWK} -F " " '{ print $(NF); }') - break ; - fi - done ;]) -dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise - AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifGNUmake], ["#"])], [AS_VAR_SET([ifGNUmake], [""])]) - AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifnGNUmake], [""])], [AS_VAR_SET([ifnGNUmake], ["#"])]) - AS_VAR_IF([_cv_gnu_make_command], [""], [AS_UNSET(ax_cv_gnu_make_command)], [AS_VAR_SET([ax_cv_gnu_make_command], [${_cv_gnu_make_command}])]) - AS_VAR_IF([_cv_gnu_make_command], [""],[$2],[$1]) - AC_SUBST([ifGNUmake]) - AC_SUBST([ifnGNUmake]) -]) - diff --git a/src/amuse_tsunami/support/shared/m4/ax_count_cpus.m4 b/src/amuse_tsunami/support/shared/m4/ax_count_cpus.m4 deleted file mode 100644 index 5db8925534..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_count_cpus.m4 +++ /dev/null @@ -1,101 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_count_cpus.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_COUNT_CPUS([ACTION-IF-DETECTED],[ACTION-IF-NOT-DETECTED]) -# -# DESCRIPTION -# -# Attempt to count the number of logical processor cores (including -# virtual and HT cores) currently available to use on the machine and -# place detected value in CPU_COUNT variable. -# -# On successful detection, ACTION-IF-DETECTED is executed if present. If -# the detection fails, then ACTION-IF-NOT-DETECTED is triggered. The -# default ACTION-IF-NOT-DETECTED is to set CPU_COUNT to 1. -# -# LICENSE -# -# Copyright (c) 2014,2016 Karlson2k (Evgeny Grin) -# Copyright (c) 2012 Brian Aker -# Copyright (c) 2008 Michael Paul Bailey -# Copyright (c) 2008 Christophe Tournayre -# -# 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 22 - - AC_DEFUN([AX_COUNT_CPUS],[dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_REQUIRE([AC_PROG_EGREP])dnl - AC_MSG_CHECKING([the number of available CPUs]) - CPU_COUNT="0" - - # Try generic methods - - # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and - # 'NPROCESSORS_ONLN' are platform-specific - command -v getconf >/dev/null 2>&1 && \ - CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" - AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1]],[[: # empty]],[dnl - # 'nproc' is part of GNU Coreutils and is widely available - CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" - ])dnl - - AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl - # Try platform-specific preferred methods - AS_CASE([[$host_os]],dnl - [[*linux*]],[[CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+,' -c` || CPU_COUNT="0"]],dnl - [[*darwin*]],[[CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0"]],dnl - [[freebsd*]],[[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0"]],dnl - [[netbsd*]], [[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0"]],dnl - [[solaris*]],[[command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^@<:@0-9@:>@.*on-line' -c 2>/dev/null` || CPU_COUNT="0"]],dnl - [[mingw*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl - [[msys*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl - [[cygwin*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]]dnl - )dnl - ])dnl - - AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1]],[[: # empty]],[dnl - # Try less preferred generic method - # 'hw.ncpu' exist on many platforms, but not on GNU/Linux - CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" - ])dnl - - AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl - # Try platform-specific fallback methods - # They can be less accurate and slower then preferred methods - AS_CASE([[$host_os]],dnl - [[*linux*]],[[CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0"]],dnl - [[*darwin*]],[[CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0"]],dnl - [[freebsd*]],[[CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl - [[netbsd*]], [[CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^@<:@0-9@:>@+ .* online ' -c` || \ - CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl - [[solaris*]],[[command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ - CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0"]],dnl - [[mingw*]],[AS_IF([[CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\@<:@0-9@:>@+$' -c`]],dnl - [[: # empty]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]])],dnl - [[msys*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]],dnl - [[cygwin*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]]dnl - )dnl - ])dnl - - AS_IF([[test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null]],[dnl - AC_MSG_RESULT([[$CPU_COUNT]]) - m4_ifvaln([$1],[$1],)dnl - ],[dnl - m4_ifval([$2],[dnl - AS_UNSET([[CPU_COUNT]]) - AC_MSG_RESULT([[unable to detect]]) - $2 - ], [dnl - CPU_COUNT="1" - AC_MSG_RESULT([[unable to detect (assuming 1)]]) - ])dnl - ])dnl - ])dnl diff --git a/src/amuse_tsunami/support/shared/m4/ax_lapack.m4 b/src/amuse_tsunami/support/shared/m4/ax_lapack.m4 deleted file mode 100644 index abaff9d171..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_lapack.m4 +++ /dev/null @@ -1,134 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_lapack.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro looks for a library that implements the LAPACK linear-algebra -# interface (see http://www.netlib.org/lapack/). On success, it sets the -# LAPACK_LIBS output variable to hold the requisite library linkages. -# -# To link with LAPACK, you should link with: -# -# $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS -# -# in that order. BLAS_LIBS is the output variable of the AX_BLAS macro, -# called automatically. FLIBS is the output variable of the -# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is -# sometimes necessary in order to link with F77 libraries. Users will also -# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same -# reason. -# -# The user may also use --with-lapack= in order to use some specific -# LAPACK library . In order to link successfully, however, be aware -# that you will probably need to use the same Fortran compiler (which can -# be set via the F77 env. var.) as was used to compile the LAPACK and BLAS -# libraries. -# -# ACTION-IF-FOUND is a list of shell commands to run if a LAPACK library -# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it -# is not found. If ACTION-IF-FOUND is not specified, the default action -# will define HAVE_LAPACK. -# -# LICENSE -# -# Copyright (c) 2009 Steven G. Johnson -# Copyright (c) 2019 Geoffrey M. Oxberry -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 10 - -AU_ALIAS([ACX_LAPACK], [AX_LAPACK]) -AC_DEFUN([AX_LAPACK], [ -AC_REQUIRE([AX_BLAS]) -ax_lapack_ok=no - -AC_ARG_WITH(lapack, - [AS_HELP_STRING([--with-lapack=], [use LAPACK library ])]) -case $with_lapack in - yes | "") ;; - no) ax_lapack_ok=disable ;; - -* | */* | *.a | *.so | *.so.* | *.dylib | *.dylib.* | *.o) - LAPACK_LIBS="$with_lapack" - ;; - *) LAPACK_LIBS="-l$with_lapack" ;; -esac - -# Get fortran linker name of LAPACK function to check for. -AC_F77_FUNC(cheev) - -# We cannot use LAPACK if BLAS is not found -if test "x$ax_blas_ok" != xyes; then - ax_lapack_ok=noblas - LAPACK_LIBS="" -fi - -# First, check LAPACK_LIBS environment variable -if test "x$LAPACK_LIBS" != x; then - save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS" - AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS]) - AC_LINK_IFELSE([AC_LANG_CALL([], [$cheev])], [ax_lapack_ok=yes], [LAPACK_LIBS=""]) - AC_MSG_RESULT($ax_lapack_ok) - LIBS="$save_LIBS" - if test $ax_lapack_ok = no; then - LAPACK_LIBS="" - fi -fi - -# LAPACK linked to by default? (is sometimes included in BLAS lib) -if test $ax_lapack_ok = no; then - save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS" - AC_CHECK_FUNC($cheev, [ax_lapack_ok=yes]) - LIBS="$save_LIBS" -fi - -# Generic LAPACK library? -for lapack in lapack lapack_rs6k; do - if test $ax_lapack_ok = no; then - save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" - AC_CHECK_LIB($lapack, $cheev, - [ax_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS]) - LIBS="$save_LIBS" - fi -done - -AC_SUBST(LAPACK_LIBS) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_lapack_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1]) - : -else - ax_lapack_ok=no - $2 -fi -])dnl AX_LAPACK diff --git a/src/amuse_tsunami/support/shared/m4/ax_lib_hdf5.m4 b/src/amuse_tsunami/support/shared/m4/ax_lib_hdf5.m4 deleted file mode 100644 index 074c2a820a..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_lib_hdf5.m4 +++ /dev/null @@ -1,323 +0,0 @@ -# =========================================================================== -# 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 -# Copyright (c) 2010 Rhys Ulerich -# -# 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= 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= 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= 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 -]) diff --git a/src/amuse_tsunami/support/shared/m4/ax_lib_netcdf4.m4 b/src/amuse_tsunami/support/shared/m4/ax_lib_netcdf4.m4 deleted file mode 100644 index e9dd487a02..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_lib_netcdf4.m4 +++ /dev/null @@ -1,277 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_lib_netcdf4.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_LIB_NETCDF4([serial/parallel]) -# -# DESCRIPTION -# -# This macro provides tests of the availability of the NetCDF v4 library. -# -# The optional macro argument should be either 'serial' or 'parallel'. The -# macro will call nc-config to check the output of the '--has-pnetcdf' -# option and error out if the requested parallel isn't supported. -# -# If the optional argument is omitted, no check is made to see if NetCDF -# has parallel support. -# -# The macro adds a --with-netcdf4 option accepting one of three values: -# -# no - do not check for the NetCDF4 library. -# yes - do check for NetCDF4 library in standard locations. -# path - installation prefix for NetCDF version 4. -# -# If NetCDF4 is successfully found, this macro calls -# -# AC_SUBST(NETCDF4_VERSION) -# AC_SUBST(NETCDF4_CC) -# AC_SUBST(NETCDF4_CFLAGS) -# AC_SUBST(NETCDF4_CPPFLAGS) -# AC_SUBST(NETCDF4_LDFLAGS) -# AC_SUBST(NETCDF4_LIBS) -# AC_SUBST(NETCDF4_FC) -# AC_SUBST(NETCDF4_FFLAGS) -# AC_SUBST(NETCDF4_FLIBS) -# AC_DEFINE(HAVE_NETCDF4) -# -# It also sets -# -# with_netcdf4="yes" -# with_netcdf4_fortran="yes" (if NetCDF has Fortran support) -# with_netcdf4_parallel="yes" (if NetCDF has MPI support) -# -# If NetCDF4 is disabled or not found, this macros sets -# -# with_netcdf4="no" -# with_netcdf4_fortran="no" -# -# Note it does not set with_netcdf4_parallel in this case. -# -# Your configuration script can test $with_netcdf4 to take any further -# actions. NETCDF4_{C,CPP,LD}FLAGS may be used when building with C or -# C++. NETCDF4_F{FLAGS,LIBS} and NETCDF4_LDFLAGS 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 NetCDF4 support -# AX_LIB_NETCDF4() -# -# 2) dnl Check for serial NetCDF4 support -# AX_LIB_NETCDF4([serial]) -# -# 3) dnl Check for parallel NetCDF4 support -# AX_LIB_NETCDF4([parallel]) -# -# One could test $with_netcdf4 for the outcome or display it as follows -# -# echo "NetCDF v4 support: $with_netcdf4" -# -# One could also for example, override the default CC in "configure.ac" to -# enforce compilation with the compiler that NetCDF v4 was built with: -# -# AX_LIB_NETCDF4([parallel]) -# if test "$with_netcdf4" = "yes"; then -# CC="$NETCDF4_CC" -# else -# AC_MSG_ERROR([Unable to find NetCDF4, we need parallel NetCDF4.]) -# fi -# -# LICENSE -# -# Copyright (c) 2016 Timothy Brown -# -# 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 2 - -AC_DEFUN([AX_LIB_NETCDF4], [ - -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 - netcdf4_requested_mode="serial" -elif test "m4_normalize(m4_default([$1],[]))" = "serial" ; then - netcdf4_requested_mode="serial" -elif test "m4_normalize(m4_default([$1],[]))" = "parallel"; then - netcdf4_requested_mode="parallel" -else - AC_MSG_ERROR([ -Unrecognized value for AX[]_LIB_NETCDF4 within configure.ac. -If supplied, argument 1 must be either 'serial' or 'parallel'. -]) -fi - -dnl Add a default --with-netcdf4 configuration option. -AC_ARG_WITH([netcdf4], - AS_HELP_STRING( - [--with-netcdf4=[yes/no/PATH]], - m4_case(m4_normalize([$1]), - [serial], [base directory of serial NetCDF4 installation], - [parallel], [base directory of parallel NetCDF4 installation], - [base directory of NetCDF4 installation]) - ), - [if test "$withval" = "no"; then - with_netcdf4="no" - elif test "$withval" = "yes"; then - with_netcdf4="yes" - else - with_netcdf4="yes" - NETCDF4_PREFIX="${withval}" - NC_CONFIG="${withval}/bin/nc-config" - fi], - [with_netcdf4="yes"] -) - -dnl Set defaults to blank -NETCDF4_CC="" -NETCDF4_VERSION="" -NETCDF4_CFLAGS="" -NETCDF4_CPPFLAGS="" -NETCDF4_LDFLAGS="" -NETCDF4_LIBS="" -NETCDF4_FC="" -NETCDF4_FFLAGS="" -NETCDF4_FLIBS="" - -dnl Try and find NetCDF4 tools and options. -if test "$with_netcdf4" = "yes"; then - if test -z "$NC_CONFIG"; then - dnl Check to see if NC_CONFIG is in the path. - AC_PATH_PROGS([NC_CONFIG], [nc-config], []) - NETCDF4_PREFIX=$(AS_DIRNAME([$(AS_DIRNAME(["$NC_CONFIG"]))])) - else - AC_MSG_CHECKING([Using provided NetCDF4 prefix]) - AC_MSG_RESULT([$NC_CONFIG]) - fi - - AC_MSG_CHECKING([for NetCDF4 libraries]) - - if test ! -f "$NC_CONFIG" || test ! -x "$NC_CONFIG"; then - AC_MSG_RESULT([no]) - AC_MSG_WARN([ - -Unable to locate NetCDF4 compilation helper script 'nc-config'. -Please specify --with-netcdf4= as the full path prefix -where NetCDF4 has been installed. -NetCDF4 support is being disabled (equivalent to --with-netcdf4=no). -]) - with_netcdf4="no" - with_netcdf4_fortran="no" - else - dnl Get the actual compiler used - NETCDF4_CC=$(eval $NC_CONFIG --cc | $AWK '{print $[]1}') - if test "$NETCDF4_CC" = "ccache"; then - NETCDF4_CC=$(eval $NC_CONFIG --cc | $AWK '{print $[]2}') - fi - - dnl Look for version - NETCDF4_VERSION=$(eval $NC_CONFIG --version | $AWK '{print $[]2}') - - dnl Look for the CFLAGS - NETCDF4_CFLAGS=$(eval $NC_CONFIG --cflags) - - dnl Look for the LIBS and LDFLAGS - NETCDF4_tmp_clibs=$(eval $NC_CONFIG --libs) - - dnl Sort out the tmp libs based on their prefixes - for arg in $NETCDF4_tmp_clibs ; do - case "$arg" in - -L*) echo $NETCDF4_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ - || NETCDF4_LDFLAGS="$arg $NETCDF4_LDFLAGS" - ;; - -l*) echo $NETCDF4_LIBS | $GREP -e "$arg" 2>&1 >/dev/null \ - || NETCDF4_LIBS="$arg $NETCDF4_LIBS" - ;; - esac - done - - AC_MSG_RESULT([yes (version $[NETCDF4_VERSION])]) - - dnl See if we need (and have) parallel support - if test "$netcdf4_requested_mode" = "parallel" ; then - with_netcdf4_parallel=$(eval $NC_CONFIG --has-pnetcdf) - if test "$with_netcdf4_parallel" = "no" ; then - AC_MSG_ERROR([ -parallel NetCDF4 is not supported (while it was requested) -]) - fi - fi - - dnl See if we can compile - ax_lib_netcdf4_save_CC=$CC - ax_lib_netcdf4_save_CPPFLAGS=$CPPFLAGS - ax_lib_netcdf4_save_LIBS=$LIBS - ax_lib_netcdf4_save_LDFLAGS=$LDFLAGS - CC=$NETCDF4_CC - CFLAGS=$NETCDF4_CFLAGS - LIBS=$NETCDF4_LIBS - LDFLAGS=$NETCDF4_LDFLAGS - AC_CHECK_HEADER([netcdf.h], [ac_cv_netcdf4_h=yes], [ac_cv_netcdf4_h=no]) - AC_CHECK_LIB([netcdf], [nc_create], [ac_cv_libnetcdf4=yes], - [ac_cv_libnetcdf4=no]) - if test "$ac_cv_netcdf4_h" = "no" && \ - test "$ac_cv_libnetcdf4" = "no" ; then - AC_MSG_WARN([Unable to compile NetCDF4 test program]) - fi - - CC=$ax_lib_netcdf4_save_CC - CFLAGS=$ax_lib_netcdf4_save_CFLAGS - LIBS=$ax_lib_netcdf4_save_LIBS - LDFLAGS=$ax_lib_hdf5_save_LDFLAGS - - - AC_MSG_CHECKING([for matching NetCDF4 Fortran libraries]) - NF_CONFIG="${NETCDF4_PREFIX}/bin/nf-config" - if test ! -f "$NF_CONFIG" || test ! -x "$NF_CONFIG"; then - AC_MSG_RESULT([no]) - with_netcdf4_fortran="no" - else - NETCDF_FVERSION=$(eval $NF_CONFIG --version | $AWK '{print $[]2}') - AC_MSG_RESULT([yes (version $[NETCDF_FVERSION])]) - NETCDF4_FC=$(eval $NF_CONFIG --fc | $AWK '{print $[]1}') - if test "$NETCDF4_FC" = "ccache"; then - NETCDF4_FC=$(eval $NF_CONFIG --fc | $AWK '{print $[]2}') - fi - dnl Look for the FFLAGS - NETCDF4_FFLAGS=$(eval $NC_CONFIG --fflags) - - dnl Look for the FLIBS and LDFLAGS - NETCDF4_tmp_flibs=$(eval $NC_CONFIG --flibs) - - dnl Sort out the tmp libs based on their prefixes - for arg in $NETCDF4_tmp_flibs ; do - case "$arg" in - -L*) echo $NETCDF4_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ - || NETCDF4_LDFLAGS="$arg $NETCDF4_LDFLAGS" - ;; - -l*) echo $NETCDF4_FLIBS | $GREP -e "$arg" 2>&1 >/dev/null \ - || NETCDF4_FLIBS="$arg $NETCDF4_FLIBS" - ;; - esac - done - with_netcdf4_fortran="yes" - fi - - AC_SUBST([NETCDF4_VERSION]) - AC_SUBST([NETCDF4_CC]) - AC_SUBST([NETCDF4_CFLAGS]) - AC_SUBST([NETCDF4_LDFLAGS]) - AC_SUBST([NETCDF4_LIBS]) - AC_SUBST([NETCDF4_FC]) - AC_SUBST([NETCDF4_FFLAGS]) - AC_SUBST([NETCDF4_FLIBS]) - AC_DEFINE([HAVE_NETCDF4], [1], [Defined if you have NETCDF4 support]) - fi -fi -]) diff --git a/src/amuse_tsunami/support/shared/m4/ax_mpi.m4 b/src/amuse_tsunami/support/shared/m4/ax_mpi.m4 deleted file mode 100644 index dbde02a9c4..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_mpi.m4 +++ /dev/null @@ -1,235 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_mpi.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_MPI([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro tries to find out how to compile programs that use MPI -# (Message Passing Interface), a standard API for parallel process -# communication (see http://www-unix.mcs.anl.gov/mpi/) -# -# On success, it sets the MPICC, MPICXX, MPIF77, or MPIFC output variable -# to the name of the MPI compiler, depending upon the current language. -# (This may just be $CC/$CXX/$F77/$FC, but is more often something like -# mpicc/mpiCC/mpif77/mpif90.) It also sets MPILIBS to any libraries that -# are needed for linking MPI (e.g. -lmpi or -lfmpi, if a special -# MPICC/MPICXX/MPIF77/MPIFC was not found). -# -# If you want to compile everything with MPI, you should use something -# like this for C: -# -# if test -z "$CC" && test -n "$MPICC"; then -# CC="$MPICC" -# fi -# AC_PROG_CC -# AX_MPI -# CC="$MPICC" -# LIBS="$MPILIBS $LIBS" -# -# and similar for C++ (change all instances of CC to CXX), Fortran 77 -# (with F77 instead of CC) or Fortran (with FC instead of CC). -# -# NOTE: The above assumes that you will use $CC (or whatever) for linking -# as well as for compiling. (This is the default for automake and most -# Makefiles.) -# -# The user can force a particular library/compiler by setting the -# MPICC/MPICXX/MPIF77/MPIFC and/or MPILIBS environment variables. -# -# ACTION-IF-FOUND is a list of shell commands to run if an MPI library is -# found, and ACTION-IF-NOT-FOUND is a list of commands to run if it is not -# found. If ACTION-IF-FOUND is not specified, the default action will -# define HAVE_MPI. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# Copyright (c) 2008 Julian C. Cummings -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 7 - -AU_ALIAS([ACX_MPI], [AX_MPI]) -AC_DEFUN([AX_MPI], [ -AC_PREREQ([2.71]) dnl for AC_LANG_CASE - -AC_LANG_CASE([C], [ - AC_REQUIRE([AC_PROG_CC]) - AC_ARG_VAR(MPICC,[MPI C compiler command]) - AC_CHECK_PROGS(MPICC, mpicc hcc mpxlc_r mpxlc mpcc cmpicc, $CC) - ax_mpi_save_CC="$CC" - CC="$MPICC" - AC_SUBST(MPICC) - AC_MSG_CHECKING([checking MPI C flags]) - ax_mpi_c_flags="`$MPICC -showme:compile 2>/dev/null| cut -d\ -f2-`" - ax_mpi_c_libs="`$MPICC -showme:link 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_c_flags" = "x"],[ - ax_mpi_c_flags="`$MPICC -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" - ax_mpi_c_libs="`$MPICC -show 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_c_flags" = "x"],[AC_MSG_RESULT([could not determine c flags from show functions])],[AC_MSG_RESULT([flags found])]) - - ], [ - AC_MSG_RESULT([flags found])]) - MPI_CFLAGS="$ax_mpi_c_flags" - MPI_CLIBS="$ax_mpi_c_libs" - AC_SUBST(MPI_CFLAGS) - AC_SUBST(MPI_CLIBS) - -], -[C++], [ - AC_REQUIRE([AC_PROG_CXX]) - AC_ARG_VAR(MPICXX,[MPI C++ compiler command]) - AC_CHECK_PROGS(MPICXX, mpicxx mpiCC mpic++ hcp mpxlC_r mpxlC mpCC cmpic++, $CXX) - ax_mpi_save_CXX="$CXX" - CXX="$MPICXX" - AC_SUBST(MPICXX) - - AC_MSG_CHECKING([checking MPI C++ flags]) - ax_mpi_cc_flags="`$MPICXX -showme:compile 2>/dev/null| cut -d\ -f2-`" - ax_mpi_cc_libs="`$MPICXX -showme:link 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_cc_flags" = "x"],[ - ax_mpi_cc_flags="`$MPICXX -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" - ax_mpi_cc_libs="`$MPICXX -show 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_cc_flags" = "x"],[AC_MSG_RESULT([could not determine C++ flags from show functions])],[AC_MSG_RESULT([flags found])]) - - ], [ - AC_MSG_RESULT([flags found])]) - MPI_CXXFLAGS="$ax_mpi_cc_flags" - MPI_CXXLIBS="$ax_mpi_cc_libs" - AC_SUBST(MPI_CXXFLAGS) - AC_SUBST(MPI_CXXLIBS) - -], -[Fortran 77], [ - AC_REQUIRE([AC_PROG_F77]) - AC_ARG_VAR(MPIF77,[MPI Fortran 77 compiler command]) - AC_CHECK_PROGS(MPIF77, mpif77 hf77 mpxlf_r mpxlf mpf77 cmpifc, $F77) - ax_mpi_save_F77="$F77" - F77="$MPIF77" - AC_SUBST(MPIF77) -], -[Fortran], [ - AC_REQUIRE([AC_PROG_FC]) - AC_ARG_VAR(MPIFC,[MPI Fortran compiler command]) - AC_CHECK_PROGS(MPIFC, mpif90 mpxlf95_r mpxlf90_r mpxlf95 mpxlf90 mpf90 cmpif90c, $FC) - ax_mpi_save_FC="$FC" - FC="$MPIFC" - AC_SUBST(MPIFC) - AC_MSG_CHECKING([checking MPI Fortran flags]) - ax_mpi_fc_flags="`$MPIFC -showme:compile 2>/dev/null| cut -d\ -f2-`" - ax_mpi_fc_libs="`$MPIFC -showme:link 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_fc_flags" = "x"],[ - ax_mpi_fc_flags="`$MPIFC -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" - ax_mpi_fc_libs="`$MPIFC -show 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_fc_flags" = "x"],[AC_MSG_RESULT([could not determine c flags from show functions])],[AC_MSG_RESULT([flags found])]) - - ], [ - AC_MSG_RESULT([flags found])]) - MPI_FCFLAGS="$ax_mpi_fc_flags" - MPI_FCLIBS="$ax_mpi_fc_libs" - AC_SUBST(MPI_FCFLAGS) - AC_SUBST(MPI_FCLIBS) -]) - -if test x = x"$MPILIBS"; then - AC_LANG_CASE([C], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], - [C++], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], - [Fortran 77], [AC_MSG_CHECKING([for MPI_Init]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" " - AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])], - [Fortran], [AC_MSG_CHECKING([for MPI_Init]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" " - AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) -fi -AC_LANG_CASE([Fortran 77], [ - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"]) - fi - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(fmpich, MPI_Init, [MPILIBS="-lfmpich"]) - fi -], -[Fortran], [ - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"]) - fi - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(mpichf90, MPI_Init, [MPILIBS="-lmpichf90"]) - fi - -]) -if test x = x"$MPILIBS"; then - AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"]) -fi -if test x = x"$MPILIBS"; then - AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"]) -fi - -dnl We have to use AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) and not AC_CHECK_HEADER because the -dnl latter uses $CPP, not $CC (which may be mpicc). -AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpi.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" - AC_MSG_RESULT(no)]) -fi], -[C++], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpi.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" - AC_MSG_RESULT(no)]) -fi], -[Fortran 77], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpif.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS="" - AC_MSG_RESULT(no)]) -fi], -[Fortran], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpif.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS="" - AC_MSG_RESULT(no)]) -fi]) - -AC_LANG_CASE([C], [CC="$ax_mpi_save_CC"], - [C++], [CXX="$ax_mpi_save_CXX"], - [Fortran 77], [F77="$ax_mpi_save_F77"], - [Fortran], [FC="$ax_mpi_save_FC"]) - -AC_SUBST(MPILIBS) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x = x"$MPILIBS"; then - $2 - : -else - ifelse([$1],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$1]) - : -fi -])dnl AX_MPI diff --git a/src/amuse_tsunami/support/shared/m4/ax_openmp.m4 b/src/amuse_tsunami/support/shared/m4/ax_openmp.m4 deleted file mode 100644 index 866e1d6645..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_openmp.m4 +++ /dev/null @@ -1,123 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_openmp.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_OPENMP([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro tries to find out how to compile programs that use OpenMP a -# standard API and set of compiler directives for parallel programming -# (see http://www-unix.mcs/) -# -# On success, it sets the OPENMP_CFLAGS/OPENMP_CXXFLAGS/OPENMP_F77FLAGS -# output variable to the flag (e.g. -omp) used both to compile *and* link -# OpenMP programs in the current language. -# -# NOTE: You are assumed to not only compile your program with these flags, -# but also link it with them as well. -# -# If you want to compile everything with OpenMP, you should set: -# -# CFLAGS="$CFLAGS $OPENMP_CFLAGS" -# #OR# CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS" -# #OR# FFLAGS="$FFLAGS $OPENMP_FFLAGS" -# -# (depending on the selected language). -# -# The user can override the default choice by setting the corresponding -# environment variable (e.g. OPENMP_CFLAGS). -# -# ACTION-IF-FOUND is a list of shell commands to run if an OpenMP flag is -# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is -# not found. If ACTION-IF-FOUND is not specified, the default action will -# define HAVE_OPENMP. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# Copyright (c) 2015 John W. Peterson -# Copyright (c) 2016 Nick R. Papior -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 13 - -AC_DEFUN([AX_OPENMP], [ -AC_PREREQ([2.69]) dnl for _AC_LANG_PREFIX - -AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS -ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown -# Flags to try: -fopenmp (gcc), -mp (SGI & PGI), -# -qopenmp (icc>=15), -openmp (icc), -# -xopenmp (Sun), -omp (Tru64), -# -qsmp=omp (AIX), -# none -ax_openmp_flags="-fopenmp -openmp -qopenmp -mp -xopenmp -omp -qsmp=omp none" -if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then - ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags" -fi -for ax_openmp_flag in $ax_openmp_flags; do - case $ax_openmp_flag in - none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;; - *) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;; - esac - AC_LINK_IFELSE([AC_LANG_SOURCE([[ -@%:@include - -static void -parallel_fill(int * data, int n) -{ - int i; -@%:@pragma omp parallel for - for (i = 0; i < n; ++i) - data[i] = i; -} - -int -main() -{ - int arr[100000]; - omp_set_num_threads(2); - parallel_fill(arr, 100000); - return 0; -} -]])],[ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break],[]) -done -[]_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS -]) -if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" = "xunknown"; then - m4_default([$2],:) -else - if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" != "xnone"; then - OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ax_cv_[]_AC_LANG_ABBREV[]_openmp - fi - m4_default([$1], [AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])]) -fi -])dnl AX_OPENMP diff --git a/src/amuse_tsunami/support/shared/m4/ax_prog_jar.m4 b/src/amuse_tsunami/support/shared/m4/ax_prog_jar.m4 deleted file mode 100644 index 76ed8147c6..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_prog_jar.m4 +++ /dev/null @@ -1,50 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_jar.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_JAR -# -# DESCRIPTION -# -# AX_PROG_JAR tests for an existing jar program. It uses the environment -# variable JAR then tests in sequence various common jar programs. -# -# If you want to force a specific compiler: -# -# - at the configure.in level, set JAR=yourcompiler before calling -# AX_PROG_JAR -# -# - at the configure level, setenv JAR -# -# You can use the JAR variable in your Makefile.in, with @JAR@. -# -# Note: This macro depends on the autoconf M4 macros for Java programs. It -# is VERY IMPORTANT that you download that whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. -# -# The general documentation of those macros, as well as the sample -# configure.in, is included in the AX_PROG_JAVA macro. -# -# LICENSE -# -# Copyright (c) 2008 Egon Willighagen -# -# 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 8 - -AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR]) -AC_DEFUN([AX_PROG_JAR],[ -AS_IF([test "x$JAVAPREFIX" = x], - [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar])], - [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar], [], [$JAVAPREFIX/bin])]) -test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) -AC_PROVIDE([$0])dnl -]) - diff --git a/src/amuse_tsunami/support/shared/m4/ax_prog_java.m4 b/src/amuse_tsunami/support/shared/m4/ax_prog_java.m4 deleted file mode 100644 index c4312ee8e7..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_prog_java.m4 +++ /dev/null @@ -1,116 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_java.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_JAVA -# -# DESCRIPTION -# -# Here is a summary of the main macros: -# -# AX_PROG_JAVAC: finds a Java compiler. -# -# AX_PROG_JAVA: finds a Java virtual machine. -# -# AX_CHECK_CLASS: finds if we have the given class (beware of CLASSPATH!). -# -# AX_CHECK_RQRD_CLASS: finds if we have the given class and stops -# otherwise. -# -# AX_TRY_COMPILE_JAVA: attempt to compile user given source. -# -# AX_TRY_RUN_JAVA: attempt to compile and run user given source. -# -# AX_JAVA_OPTIONS: adds Java configure options. -# -# AX_PROG_JAVA tests an existing Java virtual machine. It uses the -# environment variable JAVA then tests in sequence various common Java -# virtual machines. For political reasons, it starts with the free ones. -# You *must* call [AX_PROG_JAVAC] before. -# -# If you want to force a specific VM: -# -# - at the configure.in level, set JAVA=yourvm before calling AX_PROG_JAVA -# -# (but after AC_INIT) -# -# - at the configure level, setenv JAVA -# -# You can use the JAVA variable in your Makefile.in, with @JAVA@. -# -# *Warning*: its success or failure can depend on a proper setting of the -# CLASSPATH env. variable. -# -# TODO: allow to exclude virtual machines (rationale: most Java programs -# cannot run with some VM like kaffe). -# -# Note: This is part of the set of autoconf M4 macros for Java programs. -# It is VERY IMPORTANT that you download the whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. -# -# A Web page, with a link to the latest CVS snapshot is at -# . -# -# This is a sample configure.in Process this file with autoconf to produce -# a configure script. -# -# AC_INIT(UnTag.java) -# -# dnl Checks for programs. -# AC_CHECK_CLASSPATH -# AX_PROG_JAVAC -# AX_PROG_JAVA -# -# dnl Checks for classes -# AX_CHECK_RQRD_CLASS(org.xml.sax.Parser) -# AX_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver) -# -# AC_OUTPUT(Makefile) -# -# LICENSE -# -# Copyright (c) 2008 Stephane Bortzmeyer -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 10 - -AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA]) -AC_DEFUN([AX_PROG_JAVA],[ -m4_define([m4_ax_prog_java_list], [kaffe java])dnl -AS_IF([test "x$JAVAPREFIX" = x], - [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list])], - [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list], [], [$JAVAPREFIX/bin])]) -test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) -m4_undefine([m4_ax_prog_java_list])dnl -AX_PROG_JAVA_WORKS -AC_PROVIDE([$0])dnl -]) - diff --git a/src/amuse_tsunami/support/shared/m4/ax_prog_java_works.m4 b/src/amuse_tsunami/support/shared/m4/ax_prog_java_works.m4 deleted file mode 100644 index d92b7b8ddc..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_prog_java_works.m4 +++ /dev/null @@ -1,92 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_JAVA_WORKS -# -# DESCRIPTION -# -# Internal use ONLY. -# -# Note: This is part of the set of autoconf M4 macros for Java programs. -# It is VERY IMPORTANT that you download the whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. The -# general documentation, as well as the sample configure.in, is included -# in the AX_PROG_JAVA macro. -# -# LICENSE -# -# Copyright (c) 2008 Stephane Bortzmeyer -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 11 - -AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS]) -AC_DEFUN([AX_PROG_JAVA_WORKS], [ - if test x$ac_cv_prog_javac_works = xno; then - AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) - fi - if test x$ac_cv_prog_javac_works = x; then - AX_PROG_JAVAC - fi -AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ -JAVA_TEST=Test.java -CLASS_TEST=Test.class -TEST=Test -changequote(, )dnl -cat << \EOF > $JAVA_TEST -/* [#]line __oline__ "configure" */ -public class Test { -public static void main (String args[]) { - System.exit (0); -} } -EOF -changequote([, ])dnl - if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then - : - else - echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD - cat $JAVA_TEST >&AS_MESSAGE_LOG_FD - AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) - fi -if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then - ac_cv_prog_java_works=yes -else - echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD - cat $JAVA_TEST >&AS_MESSAGE_LOG_FD - AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) -fi -rm -f $JAVA_TEST $CLASS_TEST -]) -AC_PROVIDE([$0])dnl -] -) - diff --git a/src/amuse_tsunami/support/shared/m4/ax_prog_javac.m4 b/src/amuse_tsunami/support/shared/m4/ax_prog_javac.m4 deleted file mode 100644 index 9dae89b1bb..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_prog_javac.m4 +++ /dev/null @@ -1,80 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_javac.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_JAVAC -# -# DESCRIPTION -# -# AX_PROG_JAVAC tests an existing Java compiler. It uses the environment -# variable JAVAC then tests in sequence various common Java compilers. For -# political reasons, it starts with the free ones. -# -# If you want to force a specific compiler: -# -# - at the configure.in level, set JAVAC=yourcompiler before calling -# AX_PROG_JAVAC -# -# - at the configure level, setenv JAVAC -# -# You can use the JAVAC variable in your Makefile.in, with @JAVAC@. -# -# *Warning*: its success or failure can depend on a proper setting of the -# CLASSPATH env. variable. -# -# TODO: allow to exclude compilers (rationale: most Java programs cannot -# compile with some compilers like guavac). -# -# Note: This is part of the set of autoconf M4 macros for Java programs. -# It is VERY IMPORTANT that you download the whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. The -# general documentation, as well as the sample configure.in, is included -# in the AX_PROG_JAVA macro. -# -# LICENSE -# -# Copyright (c) 2008 Stephane Bortzmeyer -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 8 - -AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC]) -AC_DEFUN([AX_PROG_JAVAC],[ -m4_define([m4_ax_prog_javac_list],["gcj -C" guavac jikes javac])dnl -AS_IF([test "x$JAVAPREFIX" = x], - [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list])], - [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list], [], [$JAVAPREFIX/bin])]) -m4_undefine([m4_ax_prog_javac_list])dnl -test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) -AX_PROG_JAVAC_WORKS -AC_PROVIDE([$0])dnl -]) - diff --git a/src/amuse_tsunami/support/shared/m4/ax_prog_javac_works.m4 b/src/amuse_tsunami/support/shared/m4/ax_prog_javac_works.m4 deleted file mode 100644 index f0efe85342..0000000000 --- a/src/amuse_tsunami/support/shared/m4/ax_prog_javac_works.m4 +++ /dev/null @@ -1,73 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_JAVAC_WORKS -# -# DESCRIPTION -# -# Internal use ONLY. -# -# Note: This is part of the set of autoconf M4 macros for Java programs. -# It is VERY IMPORTANT that you download the whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. The -# general documentation, as well as the sample configure.in, is included -# in the AX_PROG_JAVA macro. -# -# LICENSE -# -# Copyright (c) 2008 Stephane Bortzmeyer -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 7 - -AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS]) -AC_DEFUN([AX_PROG_JAVAC_WORKS],[ -AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ -JAVA_TEST=Test.java -CLASS_TEST=Test.class -cat << \EOF > $JAVA_TEST -/* [#]line __oline__ "configure" */ -public class Test { -} -EOF -if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then - ac_cv_prog_javac_works=yes -else - AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) - echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD - cat $JAVA_TEST >&AS_MESSAGE_LOG_FD -fi -rm -f $JAVA_TEST $CLASS_TEST -]) -AC_PROVIDE([$0])dnl -]) - diff --git a/src/amuse_tsunami/support/shared/m4/fftw.m4 b/src/amuse_tsunami/support/shared/m4/fftw.m4 deleted file mode 100644 index 45a55f06fc..0000000000 --- a/src/amuse_tsunami/support/shared/m4/fftw.m4 +++ /dev/null @@ -1,122 +0,0 @@ -# AX_FFTW -# ---------------------------------------------------------- -# set up for FFTW -# -AC_DEFUN([AX_FFTW],[ - AC_ARG_WITH(fftw, - AS_HELP_STRING([--with-fftw=PFX],[Prefix where FFTW has been installed ]), - [ - test "$withval" = no && AC_MSG_WARN([fftw is a required package for some modules]) - test "$withval" = yes || fftw_prefix="$withval" - with_fftw=yes ], - [ with_fftw=yes ] - ) - - AS_IF([test "x$with_fftw" != xno ], - [ - #user override - AS_IF([test "x$FFTW_LIBS" != x && test "x$FFTW_FLAGS" != x ], - [ - have_fftw=yes - FOUND_FFTW="yes" - ], - [ - saved_LIBS="$LIBS" - saved_CXXFLAGS="$CXXFLAGS" - FFTW_LIBS="" - FFTW_FLAGS="" - FOUND_FFTW="no" - if test x$fftw_prefix == x; then - if test x$PREFIX != x; then - fftw_prefix=$PREFIX - fi - fi - if test x$fftw_prefix != x; then - ac_FFTW_CFLAGS="-I$fftw_prefix/include" - ac_FFTW_LDOPTS="-L$fftw_prefix/lib" - - - save_CFLAGS="$CFLAGS" - save_CPPFLAGS="$CPPFLAGS" - CFLAGS="$ac_FFTW_CFLAGS $save_CFLAGS" - CPPFLAGS="$ac_FFTW_CFLAGS $save_CPPFLAGS" - AC_CHECK_HEADER( - [fftw3.h], - [FFTW_FLAGS="$ac_FFTW_CFLAGS" - FOUND_FFTW="yes"], - [AC_MSG_WARN([Cannot find headers (fftw3.h) of the library FFTW in $fftw_prefix/include.])] - ) - CFLAGS="$save_CFLAGS" - CPPFLAGS="$save_CPPFLAGS" - - save_LIBS="$LIBS" - LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads $save_LIBS" - - cache_var=AS_TR_SH([ac_cv_lib_fftw3_fftw_plan_dft_r2c]) - AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], - [FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads"], - [FOUND_FFTW="no"] - ) - $as_unset $cache_var - if test x$FOUND_FFTW != xyes; then - LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm $save_LIBS" - AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], - [FOUND_FFTW="yes" - FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm"], - [AC_MSG_WARN([libfftw3 : library missing. (Cannot find symbol fftw_plan_dft_r2c) in $fftw_prefix. Check if libfftw3 is installed and if the version is correct])] - ) - $as_unset $cache_var - fi - LIBS="$save_LIBS" - fi - - if test x$FOUND_FFTW != xyes; then - PKG_CHECK_MODULES([FFTW],[fftw3 >= 3.2], - [ - FFTW_FLAGS="$FFTW_CFLAGS" - FFTW_LIBS="$FFTW_LIBS -lfftw3_threads" - FOUND_FFTW=yes - ], - [] - ) - fi - - if test x$FOUND_FFTW != xyes; then - AC_CHECK_HEADER( - [fftw3.h], - [FFTW_FLAGS="" - FOUND_FFTW="yes"], - [AC_MSG_WARN([Cannot find headers (fftw3.h) of the library FFTW in $fftw_prefix/include.])] - ) - cache_var=AS_TR_SH([ac_cv_lib_fftw3_fftw_plan_dft_r2c]) - AC_CHECK_LIB( - [fftw3], - [fftw_plan_dft_r2c], - [FFTW_LIBS="-lfftw3 -lfftw3_threads"], - [FOUND_FFTW="no"] - ) - $as_unset $cache_var - - if test x$FOUND_FFTW != xyes; then - - save_LIBS="$LIBS" - LIBS="-lfftw3_threads -lm $save_LIBS" - AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], - [FOUND_FFTW="yes" - FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm"], - [FOUND_FFTW="no" - AC_MSG_WARN([libfftw3 : library missing. (Cannot find symbol fftw_plan_dft_r2c) in $fftw_prefix. Check if libfftw3 is installed and if the version is correct])] - ) - LIBS="$save_LIBS" - fi - fi - - - ]) - ]) - - AC_SUBST(FOUND_FFTW) - AC_SUBST(FFTW_FLAGS) - AC_SUBST(FFTW_LIBS) - ] -) diff --git a/src/amuse_tsunami/support/shared/m4/fortran.m4 b/src/amuse_tsunami/support/shared/m4/fortran.m4 deleted file mode 100644 index 8b042cd390..0000000000 --- a/src/amuse_tsunami/support/shared/m4/fortran.m4 +++ /dev/null @@ -1,43 +0,0 @@ -AC_DEFUN([AX_FC_WORKS],[ -AC_LANG_PUSH(Fortran) -AC_MSG_CHECKING([whether the Fortran 90 compiler ($FC $FCFLAGS $LDFLAGS) works]) -AC_LINK_IFELSE([ - AC_LANG_SOURCE([ - program conftest - integer, dimension(10) :: n - end - ]) -],[ - ax_cv_prog_fc_works="yes" - AC_MSG_RESULT([$ax_cv_prog_fc_works]) -],[ - ax_cv_prog_fc_works="no" - AC_MSG_WARN([installation or configuration problem: Fortran 90 compiler cannot create executables.]) -]) -# The intel compiler sometimes generates these work.pc and .pcl files -rm -f work.pc work.pcl -AC_LANG_POP(Fortran) -]) - - -AC_DEFUN([AX_FC_ISO_C_BINDING],[ -AC_LANG_PUSH(Fortran) -AC_MSG_CHECKING([if the fortran compiler supports iso c binding]) -AC_LINK_IFELSE([ - AC_LANG_SOURCE([ - program conftest - use ISO_C_BINDING - integer, dimension(10) :: n - end - ]) -],[ - FC_ISO_C_BINDINGS="yes" - AC_MSG_RESULT([$ax_cv_fc_iso_c_bindings]) -],[ - FC_ISO_C_BINDINGS="no" - AC_MSG_RESULT([no, fortran codes and sockets or embedding will not work.]) -]) -# The intel compiler sometimes generates these work.pc and .pcl files -rm -f work.pc work.pcl -AC_LANG_POP(Fortran) -]) diff --git a/src/amuse_tsunami/support/shared/m4/gmp.m4 b/src/amuse_tsunami/support/shared/m4/gmp.m4 deleted file mode 100644 index 584168bd12..0000000000 --- a/src/amuse_tsunami/support/shared/m4/gmp.m4 +++ /dev/null @@ -1,103 +0,0 @@ -# AX_GMP -# ---------------------------------------------------------- -# set up for GMP -# -AC_DEFUN([AX_GMP],[ - AC_ARG_WITH(gmp, - AS_HELP_STRING([--with-gmp=PFX],[Prefix where GMP has been installed ]), - [ - test "$withval" = no && AC_MSG_WARN([gmp is a required package for some modules]) - test "$withval" = yes || gmp_prefix="$withval" - with_gmp=yes ], - [ with_gmp=yes ] - ) - - AS_IF([test "x$with_gmp" != xno ], - [ - #user override - AS_IF([test "x$GMP_LIBS" != x ], - [ - have_gmp=yes - FOUND_GMP="yes" - ], - [ - - - - saved_LIBS="$LIBS" - saved_CXXFLAGS="$CXXFLAGS" - GMP_LIBS="" - GMP_FLAGS="" - FOUND_GMP="no" - if test x$gmp_prefix == x; then - if test x$PREFIX != x; then - gmp_prefix=$PREFIX - fi - fi - if test x$gmp_prefix != x; then - ac_gmp_CFLAGS="-I$gmp_prefix/include" - ac_gmp_LDOPTS="-L$gmp_prefix/lib" - - - save_CFLAGS="$CFLAGS" - save_CPPFLAGS="$CPPFLAGS" - CFLAGS="$ac_gmp_CFLAGS $save_CFLAGS" - CPPFLAGS="$ac_gmp_CFLAGS $save_CPPFLAGS" - AC_CHECK_HEADER( - [gmp.h], - [GMP_FLAGS="$ac_gmp_CFLAGS" - FOUND_GMP="yes"], - [AC_MSG_WARN([Cannot find headers (gmp.h) of the library GMP in $gmp_prefix/include.])] - ) - CFLAGS="$save_CFLAGS" - CPPFLAGS="$save_CPPFLAGS" - - if test x$FOUND_GMP == xyes; then - save_LIBS="$LIBS" - LIBS="$ac_gmp_LDOPTS -lgmp $save_LIBS" - AC_CHECK_LIB([gmp], [__gmpz_init], - [GMP_LIBS="$ac_gmp_LDOPTS -lgmp"], - [FOUND_GMP="no" - AC_MSG_WARN([libgmp : library missing. (Cannot find symbol gmpz_init) in $gmp_prefix. Check if libgmp is installed and if the version is correct])] - ) - LIBS="$save_LIBS" - fi - fi - if test x$FOUND_GMP != xyes; then - PKG_CHECK_MODULES([GMP],[gmp >= 3], - [ - GMP_FLAGS="$GMP_FLAGS" - GMP_LIBS="$GMP_LIBS" - FOUND_GMP=yes - ], - [] - ) - - fi - - if test x$FOUND_GMP != xyes; then - AC_CHECK_HEADER( - [gmp.h], - [GMP_FLAGS="" - FOUND_GMP="yes"], - [AC_MSG_WARN([Cannot find headers (gmp.h) of the library GMP.])] - ) - AC_CHECK_LIB( - [gmp], - [__gmpz_init], - [GMP_LIBS="-lgmp"], - [ - FOUND_GMP="no" - AC_MSG_WARN([libgmp : library missing. (Cannot find symbol gmpz_init). Check if libgmp is installed and if the version is correct])] - ) - fi - - - ]) - ]) - - AC_SUBST(FOUND_GMP) - AC_SUBST(GMP_FLAGS) - AC_SUBST(GMP_LIBS) - ] -) diff --git a/src/amuse_tsunami/support/shared/m4/gsl.m4 b/src/amuse_tsunami/support/shared/m4/gsl.m4 deleted file mode 100644 index 96c3189801..0000000000 --- a/src/amuse_tsunami/support/shared/m4/gsl.m4 +++ /dev/null @@ -1,122 +0,0 @@ -# Configure path for the GNU Scientific Library -# Christopher R. Gabriel , April 2000 - - -AC_DEFUN([AX_PATH_GSL], -[ -AC_ARG_WITH(gsl-prefix,[ --with-gsl-prefix=PFX Prefix where GSL is installed (optional)], - gsl_prefix="$withval", gsl_prefix="") -AC_ARG_WITH(gsl-exec-prefix,[ --with-gsl-exec-prefix=PFX Exec prefix where GSL is installed (optional)], - gsl_exec_prefix="$withval", gsl_exec_prefix="") -AC_ARG_ENABLE(gsltest, [ --disable-gsltest Do not try to compile and run a test GSL program], - , enable_gsltest=yes) - - if test "x${GSL_CONFIG+set}" != xset ; then - if test "x$gsl_prefix" != x ; then - GSL_CONFIG="$gsl_prefix/bin/gsl-config" - fi - if test "x$gsl_exec_prefix" != x ; then - GSL_CONFIG="$gsl_exec_prefix/bin/gsl-config" - fi - fi - - - if test "x${GSL_CONFIG+set}" == xset ; then - if test -x "${GSL_CONFIG}" ; then - gsl_config_exists=yes - else - gsl_config_exists=no - fi - fi - FOUND_GSL=no - if test "x$GSL_CFLAGS" != x ; then - if test "x$GSL_LIBS" != x ; then - GSL_FLAGS="$GSL_CFLAGS" - GSL_LIBS="$GSL_LIBS" - FOUND_GSL=yes - AC_SUBST(GSL_FLAGS) - fi - fi - if test "$FOUND_GSL" = "no"; then - if test "x$gsl_config_exists" != xyes ; then - PKG_CHECK_MODULES([GSL],[gsl >= 1.0], - [ - GSL_FLAGS="$GSL_CFLAGS" - GSL_LIBS="$GSL_LIBS" - FOUND_GSL=yes - AC_SUBST(GSL_FLAGS) - - ifelse([$2], , :, [$2]) - ], - [ - ] - ) - fi - fi - if test "$FOUND_GSL" = "no"; then - AC_PATH_PROG(GSL_CONFIG, gsl-config, no) - min_gsl_version=ifelse([$1], ,0.2.5,$1) - AC_MSG_CHECKING(for GSL - version >= $min_gsl_version) - no_gsl="" - if test "$GSL_CONFIG" = "no" ; then - no_gsl=yes - else - GSL_FLAGS=`$GSL_CONFIG --cflags` - GSL_LIBS=`$GSL_CONFIG --libs` - - gsl_version=`$GSL_CONFIG --version` - AS_VERSION_COMPARE( - [$gsl_version], - [$min_gsl_version], - [no_gsl=yes], - - ) - fi - if test "x$no_gsl" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$GSL_CONFIG" = "no" ; then - echo "*** The gsl-config script installed by GSL could not be found" - echo "*** If GSL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the GSL_CONFIG environment variable to the" - echo "*** full path to gsl-config." - else - if test -f conf.gsltest ; then - : - else - echo "*** Could not run GSL test program, checking why..." - CFLAGS="$CFLAGS $GSL_FLAGS" - LIBS="$LIBS $GSL_LIBS" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - #include - ]], [[ return 0; ]])],[ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GSL or finding the wrong" - echo "*** version of GSL. If it is not finding GSL, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],[ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GSL was incorrectly installed" - echo "*** or that you have moved GSL since it was installed. In the latter case, you" - echo "*** may want to edit the gsl-config script: $GSL_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - # GSL_FLAGS="" - # GSL_LIBS="" - ifelse([$3], , :, [$3]) - fi - - fi - AC_SUBST(GSL_FLAGS) - AC_SUBST(GSL_LIBS) - rm -f conf.gsltest - -]) - -AU_ALIAS([AM_PATH_GSL], [AX_PATH_GSL]) diff --git a/src/amuse_tsunami/support/shared/m4/mpfr.m4 b/src/amuse_tsunami/support/shared/m4/mpfr.m4 deleted file mode 100644 index eba25c6dc9..0000000000 --- a/src/amuse_tsunami/support/shared/m4/mpfr.m4 +++ /dev/null @@ -1,109 +0,0 @@ -# AX_MPFR -# ---------------------------------------------------------- -# set up for MPFR -# -AC_DEFUN([AX_MPFR],[ - AC_ARG_WITH(mpfr, - AS_HELP_STRING([--with-mpfr=PFX],[Prefix where MPFR has been installed ]), - [ - test "$withval" = no && AC_MSG_WARN([mpfr is a required package for some modules]) - test "$withval" = yes || mpfr_prefix="$withval" - with_mpfr=yes ], - [ with_mpfr=yes ] - ) - - AS_IF([test "x$with_mpfr" != xno ], - [ - #user override - AS_IF([test "x$MPFR_LIBS" != x ], - [ - have_mpfr=yes - FOUND_MPFR="yes" - ], - [ - - - - saved_LIBS="$LIBS" - saved_CXXFLAGS="$CXXFLAGS" - MPFR_LIBS="" - MPFR_FLAGS="" - FOUND_MPFR="no" - if test x$mpfr_prefix == x; then - if test x$PREFIX != x; then - mpfr_prefix=$PREFIX - fi - fi - if test x$mpfr_prefix != x; then - ac_mpfr_CFLAGS="-I$mpfr_prefix/include" - ac_mpfr_LDOPTS="-L$mpfr_prefix/lib" - - - save_CFLAGS="$CFLAGS" - save_CPPFLAGS="$CPPFLAGS" - CFLAGS="$ac_mpfr_CFLAGS $save_CFLAGS" - CPPFLAGS="$ac_mpfr_CFLAGS $save_CPPFLAGS" - - cache_var=AS_TR_SH([ac_cv_header_mpfr.h]) - AC_CHECK_HEADER( - [mpfr.h], - [MPFR_FLAGS="$ac_mpfr_CFLAGS" - FOUND_MPFR="yes"], - [AC_MSG_WARN([Cannot find headers (mpfr.h) of the library MPFR in $mpfr_prefix/include.])] - ) - $as_unset $cache_var - CFLAGS="$save_CFLAGS" - CPPFLAGS="$save_CPPFLAGS" - - if test x$FOUND_MPFR == xyes; then - save_LIBS="$LIBS" - LIBS="$ac_mpfr_LDOPTS -lmpfr $save_LIBS" - - cache_var=AS_TR_SH([ac_cv_lib_mpfr_mpfr_init]) - AC_CHECK_LIB([mpfr], [mpfr_init], - [MPFR_LIBS="$ac_mpfr_LDOPTS -lmpfr"], - [FOUND_MPFR="no" - AC_MSG_WARN([libmpfr : library missing. (Cannot find symbol mpfr_init) in $mpfr_prefix. Check if libmpfr is installed and if the version is correct])] - ) - LIBS="$save_LIBS" - $as_unset $cache_var - fi - fi - if test x$FOUND_MPFR != xyes; then - PKG_CHECK_MODULES([MPFR],[mpfr >= 3], - [ - MPFR_FLAGS="$MPFR_FLAGS" - MPFR_LIBS="$MPFR_LIBS" - FOUND_MPFR=yes - ], - [] - ) - - fi - - if test x$FOUND_MPFR != xyes; then - AC_CHECK_HEADER( - [mpfr.h], - [MPFR_FLAGS="" - FOUND_MPFR="yes"], - [AC_MSG_WARN([Cannot find headers (mpfr.h) of the library MPFR.])] - ) - AC_CHECK_LIB( - [mpfr], - [mpfr_init], - [MPFR_LIBS="-lmpfr"], - [ - FOUND_MPFR="no" - AC_MSG_WARN([libmpfr : library missing. (Cannot find symbol mpfr_init). Check if libmpfr is installed and if the version is correct])] - ) - fi - - - ]) - ]) - - AC_SUBST(FOUND_MPFR) - AC_SUBST(MPFR_FLAGS) - AC_SUBST(MPFR_LIBS) - ] -) diff --git a/src/amuse_tsunami/support/shared/m4/pkg.m4 b/src/amuse_tsunami/support/shared/m4/pkg.m4 deleted file mode 100644 index d8549a4789..0000000000 --- a/src/amuse_tsunami/support/shared/m4/pkg.m4 +++ /dev/null @@ -1,343 +0,0 @@ -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 11 (pkg-config-0.29.1) - -dnl Copyright © 2004 Scott James Remnant . -dnl Copyright © 2012-2015 Dan Nicholson -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 2 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, but -dnl WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -dnl 02111-1307, USA. -dnl -dnl As a special exception to the GNU General Public License, if you -dnl distribute this file as part of a program that contains a -dnl configuration script generated by Autoconf, you may include it under -dnl the same distribution terms that you use for the rest of that -dnl program. - -dnl PKG_PREREQ(MIN-VERSION) -dnl ----------------------- -dnl Since: 0.29 -dnl -dnl Verify that the version of the pkg-config macros are at least -dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's -dnl installed version of pkg-config, this checks the developer's version -dnl of pkg.m4 when generating configure. -dnl -dnl To ensure that this macro is defined, also add: -dnl m4_ifndef([PKG_PREREQ], -dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) -dnl -dnl See the "Since" comment for each macro you use to see what version -dnl of the macros you require. -m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29.1]) -m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, - [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) -])dnl PKG_PREREQ - -dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) -dnl ---------------------------------- -dnl Since: 0.16 -dnl -dnl Search for the pkg-config tool and set the PKG_CONFIG variable to -dnl first found in the path. Checks that the version of pkg-config found -dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is -dnl used since that's the first version where most current features of -dnl pkg-config existed. -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) -m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) -AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) -AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_default([$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi -fi[]dnl -])dnl PKG_PROG_PKG_CONFIG - -dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -dnl ------------------------------------------------------------------- -dnl Since: 0.18 -dnl -dnl Check to see whether a particular set of modules exists. Similar to -dnl PKG_CHECK_MODULES(), but does not set variables or print errors. -dnl -dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -dnl only at the first occurence in configure.ac, so if the first place -dnl it's called might be skipped (such as if it is within an "if", you -dnl have to call PKG_CHECK_EXISTS manually -AC_DEFUN([PKG_CHECK_EXISTS], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -if test -n "$PKG_CONFIG" && \ - AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_default([$2], [:]) -m4_ifvaln([$3], [else - $3])dnl -fi]) - -dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -dnl --------------------------------------------- -dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting -dnl pkg_failed based on the result. -m4_define([_PKG_CONFIG], -[if test -n "$$1"; then - pkg_cv_[]$1="$$1" - elif test -n "$PKG_CONFIG"; then - PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes ], - [pkg_failed=yes]) - else - pkg_failed=untried -fi[]dnl -])dnl _PKG_CONFIG - -dnl _PKG_SHORT_ERRORS_SUPPORTED -dnl --------------------------- -dnl Internal check to see if pkg-config supports short errors. -AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi[]dnl -])dnl _PKG_SHORT_ERRORS_SUPPORTED - - -dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -dnl [ACTION-IF-NOT-FOUND]) -dnl -------------------------------------------------------------- -dnl Since: 0.4.0 -dnl -dnl Note that if there is a possibility the first call to -dnl PKG_CHECK_MODULES might not happen, you should be sure to include an -dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - -pkg_failed=no -AC_MSG_CHECKING([for $1]) - -_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) -_PKG_CONFIG([$1][_LIBS], [libs], [$2]) - -m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS -and $1[]_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details.]) - -if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) - _PKG_SHORT_ERRORS_SUPPORTED - if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - - m4_default([$4], [AC_MSG_ERROR( -[Package requirements ($2) were not met: - -$$1_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -_PKG_TEXT])[]dnl - ]) -elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) - m4_default([$4], [AC_MSG_FAILURE( -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -_PKG_TEXT - -To get pkg-config, see .])[]dnl - ]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - AC_MSG_RESULT([yes]) - $3 -fi[]dnl -])dnl PKG_CHECK_MODULES - - -dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -dnl [ACTION-IF-NOT-FOUND]) -dnl --------------------------------------------------------------------- -dnl Since: 0.29 -dnl -dnl Checks for existence of MODULES and gathers its build flags with -dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags -dnl and VARIABLE-PREFIX_LIBS from --libs. -dnl -dnl Note that if there is a possibility the first call to -dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to -dnl include an explicit call to PKG_PROG_PKG_CONFIG in your -dnl configure.ac. -AC_DEFUN([PKG_CHECK_MODULES_STATIC], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -_save_PKG_CONFIG=$PKG_CONFIG -PKG_CONFIG="$PKG_CONFIG --static" -PKG_CHECK_MODULES($@) -PKG_CONFIG=$_save_PKG_CONFIG[]dnl -])dnl PKG_CHECK_MODULES_STATIC - - -dnl PKG_INSTALLDIR([DIRECTORY]) -dnl ------------------------- -dnl Since: 0.27 -dnl -dnl Substitutes the variable pkgconfigdir as the location where a module -dnl should install pkg-config .pc files. By default the directory is -dnl $libdir/pkgconfig, but the default can be changed by passing -dnl DIRECTORY. The user can override through the --with-pkgconfigdir -dnl parameter. -AC_DEFUN([PKG_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([pkgconfigdir], - [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, - [with_pkgconfigdir=]pkg_default) -AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -])dnl PKG_INSTALLDIR - - -dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) -dnl -------------------------------- -dnl Since: 0.27 -dnl -dnl Substitutes the variable noarch_pkgconfigdir as the location where a -dnl module should install arch-independent pkg-config .pc files. By -dnl default the directory is $datadir/pkgconfig, but the default can be -dnl changed by passing DIRECTORY. The user can override through the -dnl --with-noarch-pkgconfigdir parameter. -AC_DEFUN([PKG_NOARCH_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([noarch-pkgconfigdir], - [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, - [with_noarch_pkgconfigdir=]pkg_default) -AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -])dnl PKG_NOARCH_INSTALLDIR - - -dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, -dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -dnl ------------------------------------------- -dnl Since: 0.28 -dnl -dnl Retrieves the value of the pkg-config variable for the given module. -AC_DEFUN([PKG_CHECK_VAR], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl - -_PKG_CONFIG([$1], [variable="][$3]["], [$2]) -AS_VAR_COPY([$1], [pkg_cv_][$1]) - -AS_VAR_IF([$1], [""], [$5], [$4])dnl -])dnl PKG_CHECK_VAR - -dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], -dnl [DESCRIPTION], [DEFAULT]) -dnl ------------------------------------------ -dnl -dnl Prepare a "--with-" configure option using the lowercase -dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and -dnl PKG_CHECK_MODULES in a single macro. -AC_DEFUN([PKG_WITH_MODULES], -[ -m4_pushdef([with_arg], m4_tolower([$1])) - -m4_pushdef([description], - [m4_default([$5], [build with ]with_arg[ support])]) - -m4_pushdef([def_arg], [m4_default([$6], [auto])]) -m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) -m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) - -m4_case(def_arg, - [yes],[m4_pushdef([with_without], [--without-]with_arg)], - [m4_pushdef([with_without],[--with-]with_arg)]) - -AC_ARG_WITH(with_arg, - AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, - [AS_TR_SH([with_]with_arg)=def_arg]) - -AS_CASE([$AS_TR_SH([with_]with_arg)], - [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], - [auto],[PKG_CHECK_MODULES([$1],[$2], - [m4_n([def_action_if_found]) $3], - [m4_n([def_action_if_not_found]) $4])]) - -m4_popdef([with_arg]) -m4_popdef([description]) -m4_popdef([def_arg]) - -])dnl PKG_WITH_MODULES - -dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [DESCRIPTION], [DEFAULT]) -dnl ----------------------------------------------- -dnl -dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES -dnl check._[VARIABLE-PREFIX] is exported as make variable. -AC_DEFUN([PKG_HAVE_WITH_MODULES], -[ -PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) - -AM_CONDITIONAL([HAVE_][$1], - [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) -])dnl PKG_HAVE_WITH_MODULES - -dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [DESCRIPTION], [DEFAULT]) -dnl ------------------------------------------------------ -dnl -dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after -dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make -dnl and preprocessor variable. -AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], -[ -PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) - -AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], - [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) -])dnl PKG_HAVE_DEFINE_WITH_MODULES diff --git a/src/amuse_tsunami/support/shared/uninstall.sh b/src/amuse_tsunami/support/shared/uninstall.sh deleted file mode 100755 index e08122700e..0000000000 --- a/src/amuse_tsunami/support/shared/uninstall.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -PACKAGE="$1" - -if test -z "${PACKAGE}" ; then - echo " Incorrect usage, please specify a package name as the first argument." - exit 1 -fi - -if test -n "${VIRTUAL_ENV}${CONDA_DEFAULT_ENV}" ; then - pip_package_line=$(pip list | grep "${PACKAGE} ") - if [ "a${pip_package_line}" = "a" ] ; then - printf '%s\n' " Package ${PACKAGE} was not installed, not uninstalling." - exit 0 - fi -fi - -if test -n "${VIRTUAL_ENV}" ; then - # grep -q stops reading when a match is found, which then crashes pip list, so we - # redirect instead. With conda list we can use -q as usual. - if [ "a${pip_package_line}" != "a" ] ; then - pip uninstall -y ${PACKAGE} - fi -fi - -if test -n "${CONDA_DEFAULT_ENV}" ; then - conda_package_line=$(conda list | grep "^${PACKAGE} ") - if printf '%s' "${conda_package_line}" | grep "" >/dev/null 2>&1 ; then - # Conda is showing a pip-installed develop package. However, there may be a - # conda package hidden underneath, so we're going to try to conda uninstall - # anyway to fix that if needed. This will fail if everything is as it should - # be, so we make sure to inhibit the error message to reduce confusion. - EXPECTING_FAIL=true - fi - - if printf '%s' "${conda_package_line}" | grep -v "pypi$" >/dev/null 2>&1 ; then - TMPOUT=$(mktemp) - conda remove -y ${PACKAGE} >${TMPOUT} 2>&1 - err="$?" - # If it failed and we were not expecting it to, print the output - if test "$err" != 0 -a -z "${EXPECTING_FAIL}" ; then - cat ${TMPOUT} - fi - rm ${TMPOUT} - fi - - if [ "a${pip_package_line}" != "a" ] ; then - pip uninstall -y ${PACKAGE} - fi -fi - From ce89ca15971d1407b65cd9a2b09e63deb0fdf282 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 22 Apr 2026 12:10:57 +0200 Subject: [PATCH 050/132] fixed amuse_tsunami/support/shared not symlinking to amuse/support/shared --- src/amuse_tsunami/support/shared | 1 + 1 file changed, 1 insertion(+) create mode 120000 src/amuse_tsunami/support/shared diff --git a/src/amuse_tsunami/support/shared b/src/amuse_tsunami/support/shared new file mode 120000 index 0000000000..00817b0193 --- /dev/null +++ b/src/amuse_tsunami/support/shared @@ -0,0 +1 @@ +../../../support/shared \ No newline at end of file From 482045c800121823bf2747cb59049f9f817bc737 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Jun 2026 13:43:23 +0200 Subject: [PATCH 051/132] cleaned up Tsunami Makefile --- src/amuse_tsunami/Makefile | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/amuse_tsunami/Makefile b/src/amuse_tsunami/Makefile index bb5266cacd..989301f5fc 100644 --- a/src/amuse_tsunami/Makefile +++ b/src/amuse_tsunami/Makefile @@ -6,13 +6,8 @@ endif support/config.mk: cd support && ./configure -tsunami.tar.gz: - @echo "Add message here" - - src/tsunami-master: | tsunami.tar.gz - # tar xf $< - tar xf tsunami.tar.gz # FIXME + tar xf $< mv tsunami-master src/ # NOTE: how do stopconds work when in python only mode? @@ -22,21 +17,8 @@ install_tsunami: | src/tsunami-master ifneq ($(CONDA_PREFIX),) conda install --yes --channel conda-forge --override-channels numpy swig scikit-build-core endif - cd src/tsunami-master/build && cmake .. -DCMAKE_OSX_ARCHITECTURES=arm64 # FIXME: maybe we should ensure that build is clean and exists - $(MAKE) -C src/tsunami-master/build -j $(CPU_COUNT) - -# Building the workers -# tsunami_worker.h: interface.py -# amusifier --type=h interface.py TsunamiInterface -o $@ - -# tsunami_worker.cc: interface.py -# amusifier --type=c interface.py TsunamiInterface -o $@ - -# tsunami_worker.o: tsunami_worker.cc tsunami_worker.h -# $(MPICXX) -c -o $@ $(CFLAGS) $< + cd src/tsunami-master/ && pip install . -# tsunami_worker: interface.o tsunami_worker.o $(CODELIB) -# $(MPICXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) tsunami_worker: interface.py install_tsunami PYTHONPATH=. amusifier --type=py --mode=mpi -x interface TsunamiInterface TsunamiImplementation -o $@ From 9c71767c79c0a6803f37bfe7a5ddc182f0985b90 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Jun 2026 13:44:27 +0200 Subject: [PATCH 052/132] tsunami configuration files --- src/amuse_tsunami/support/aclocal.m4 | 19 + src/amuse_tsunami/support/configure | 6560 ++++++++++++++++++++++++++ 2 files changed, 6579 insertions(+) create mode 100644 src/amuse_tsunami/support/aclocal.m4 create mode 100755 src/amuse_tsunami/support/configure diff --git a/src/amuse_tsunami/support/aclocal.m4 b/src/amuse_tsunami/support/aclocal.m4 new file mode 100644 index 0000000000..8724018e56 --- /dev/null +++ b/src/amuse_tsunami/support/aclocal.m4 @@ -0,0 +1,19 @@ +# generated automatically by aclocal 1.18.1 -*- Autoconf -*- + +# Copyright (C) 1996-2025 Free Software Foundation, Inc. + +# 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. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_include([shared/m4/amuse_lib.m4]) +m4_include([shared/m4/amuse_venv.m4]) +m4_include([shared/m4/ax_count_cpus.m4]) +m4_include([shared/m4/ax_mpi.m4]) +m4_include([shared/m4/pkg.m4]) diff --git a/src/amuse_tsunami/support/configure b/src/amuse_tsunami/support/configure new file mode 100755 index 0000000000..58052e17ee --- /dev/null +++ b/src/amuse_tsunami/support/configure @@ -0,0 +1,6560 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.72 for amuse-tsunami 1.0. +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else case e in #( + e) case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as 'sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed 'exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else case e in #( + e) case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else case e in #( + e) exitcode=1; echo positional parameters were not saved. ;; +esac +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else case e in #( + e) as_have_required=no ;; +esac +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else case e in #( + e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else case e in #( + e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi ;; +esac +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed 'exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi ;; +esac +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else case e in #( + e) as_fn_append () + { + eval $1=\$$1\$2 + } ;; +esac +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else case e in #( + e) as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } ;; +esac +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + t clear + :clear + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated + +# Sed expression to map a string onto a valid variable name. +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='amuse-tsunami' +PACKAGE_TARNAME='amuse-tsunami' +PACKAGE_VERSION='1.0' +PACKAGE_STRING='amuse-tsunami 1.0' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +ac_subst_vars='LTLIBOBJS +LIBOBJS +MPILIBS +MPI_CXXLIBS +MPI_CXXFLAGS +MPICXX +FOUND_STOPCOND +STOPCOND_LIBS +STOPCOND_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +ac_ct_CC +CFLAGS +CC +TAR +RANLIB +AR +target_os +target_vendor +target_cpu +target +OBJEXT +EXEEXT +ac_ct_CXX +CPPFLAGS +LDFLAGS +CXXFLAGS +CXX +CPU_COUNT +EGREP +GREP +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +FFLAGS +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +' + ac_precious_vars='build_alias +host_alias +target_alias +CXX +CXXFLAGS +LDFLAGS +LIBS +CPPFLAGS +CCC +CC +CFLAGS +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +STOPCOND_CFLAGS +STOPCOND_LIBS +MPICXX' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: '$ac_option' +Try '$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: '$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: '$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +'configure' configures amuse-tsunami 1.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print 'checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for '--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or '..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, 'make install' will install all the files in +'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify +an installation prefix other than '$ac_default_prefix' using '--prefix', +for instance '--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/amuse-tsunami] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of amuse-tsunami 1.0:";; + esac + cat <<\_ACEOF + +Some influential environment variables: + CXX C++ compiler command + CXXFLAGS C++ compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CC C compiler command + CFLAGS C compiler flags + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + STOPCOND_CFLAGS + C compiler flags for STOPCOND, overriding pkg-config + STOPCOND_LIBS + linker flags for STOPCOND, overriding pkg-config + MPICXX MPI C++ compiler command + +Use these variables to override the choices made by 'configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +amuse-tsunami configure 1.0 +generated by GNU Autoconf 2.72 + +Copyright (C) 2023 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_cxx_check_func LINENO FUNC VAR +# ------------------------------------ +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_cxx_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (void); below. */ + +#include +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (void); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$3=yes" +else case e in #( + e) eval "$3=no" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext ;; +esac +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_cxx_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by amuse-tsunami $as_me 1.0, which was +generated by GNU Autoconf 2.72. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See 'config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif + +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (char **p, int i) +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* C89 style stringification. */ +#define noexpand_stringify(a) #a +const char *stringified = noexpand_stringify(arbitrary+token=sequence); + +/* C89 style token pasting. Exercises some of the corner cases that + e.g. old MSVC gets wrong, but not very hard. */ +#define noexpand_concat(a,b) a##b +#define expand_concat(a,b) noexpand_concat(a,b) +extern int vA; +extern int vbee; +#define aye A +#define bee B +int *pvA = &expand_concat(v,aye); +int *pvbee = &noexpand_concat(v,bee); + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +/* Does the compiler advertise C99 conformance? */ +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +// See if C++-style comments work. + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); +extern void free (void *); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + // Work around memory leak warnings. + free (ia); + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +/* Does the compiler advertise C11 conformance? */ +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + + +# Auxiliary files required by this configure script. +ac_aux_files="config.guess config.sub" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/shared" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else case e in #( + e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;; +esac +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# Pick up Conda env or virtualenv + + if test "x$VIRTUAL_ENV" != x +then : + + CFLAGS="$CFLAGS -I${VIRTUAL_ENV}/include" + CXXFLAGS="$CXXFLAGS -I${VIRTUAL_ENV}/include" + FFLAGS="$FFLAGS -I${VIRTUAL_ENV}/include" + FCFLAGS="$FCFLAGS -I${VIRTUAL_ENV}/include" + LDFLAGS="$LDFLAGS -L${VIRTUAL_ENV}/lib -Wl,-rpath,${VIRTUAL_ENV}/lib" + PKG_CONFIG_PATH="$VIRTUAL_ENV/lib/pkgconfig:$PKG_CONFIG_PATH" + +fi + + if test "x$CONDA_PREFIX" != x +then : + + # Conda does not set FCFLAGS, so we copy from FFLAGS here + FCFLAGS="$FFLAGS" + LDFLAGS="$LDFLAGS -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib" + # Conda pkg-config includes this already, but in case we have one from + # the system... + PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${CONDA_PREFIX}/lib/pkgconfig" + +fi + # Needs to be exported or the PKG_CHECK_MODULES macro won't see it + export PKG_CONFIG_PATH + + + +# Set CPU_COUNT + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in #( +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in #( +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + EGREP_TRADITIONAL=$EGREP + ac_cv_path_EGREP_TRADITIONAL=$EGREP + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the number of available CPUs" >&5 +printf %s "checking the number of available CPUs... " >&6; } + CPU_COUNT="0" + + # Try generic methods + + # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and + # 'NPROCESSORS_ONLN' are platform-specific + command -v getconf >/dev/null 2>&1 && \ + CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" + if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1 +then : + : # empty +else case e in #( + e) # 'nproc' is part of GNU Coreutils and is widely available + CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" + ;; +esac +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null +then : + : # empty +else case e in #( + e) # Try platform-specific preferred methods + case $host_os in #( + *linux*) : + CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^[0-9]+,' -c` || CPU_COUNT="0" ;; #( + *darwin*) : + CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0" ;; #( + freebsd*) : + command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0" ;; #( + netbsd*) : + command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0" ;; #( + solaris*) : + command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^[0-9].*on-line' -c 2>/dev/null` || CPU_COUNT="0" ;; #( + mingw*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + msys*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + cygwin*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + *) : + ;; +esac ;; +esac +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1 +then : + : # empty +else case e in #( + e) # Try less preferred generic method + # 'hw.ncpu' exist on many platforms, but not on GNU/Linux + CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" + ;; +esac +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null +then : + : # empty +else case e in #( + e) # Try platform-specific fallback methods + # They can be less accurate and slower then preferred methods + case $host_os in #( + *linux*) : + CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0" ;; #( + *darwin*) : + CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0" ;; #( + freebsd*) : + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( + netbsd*) : + CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^[0-9]+ .* online ' -c` || \ + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( + solaris*) : + command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ + CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0" ;; #( + mingw*) : + if CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\[0-9]+$' -c` +then : + : # empty +else case e in #( + e) test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; +esac +fi ;; #( + msys*) : + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( + cygwin*) : + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( + *) : + ;; +esac ;; +esac +fi + if test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPU_COUNT" >&5 +printf "%s\n" "$CPU_COUNT" >&6; } + +else case e in #( + e) CPU_COUNT="1" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unable to detect (assuming 1)" >&5 +printf "%s\n" "unable to detect (assuming 1)" >&6; } + ;; +esac +fi + + +# Find the compiler(s) + + + + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 +printf %s "checking whether the C++ compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'. +# So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an '-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else case e in #( + e) ac_file='' ;; +esac +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "C++ compiler cannot create executables +See 'config.log' for more details" "$LINENO" 5; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 +printf %s "checking for C++ compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both 'conftest.exe' and 'conftest' are 'present' (well, observable) +# catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will +# work properly (i.e., refer to 'conftest.exe'), while it won't with +# 'rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else case e in #( + e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See 'config.log' for more details" "$LINENO" 5; } ;; +esac +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + if (!f) + return 1; + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C++ compiled programs. +If you meant to cross compile, use '--host'. +See 'config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext \ + conftest.o conftest.obj conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See 'config.log' for more details" "$LINENO" 5; } ;; +esac +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else case e in #( + e) ac_compiler_gnu=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_save_CXXFLAGS=$CXXFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +else case e in #( + e) CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +else case e in #( + e) ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx11+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cxx_cxx11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX ;; +esac +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" ;; +esac +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 ;; +esac +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx98+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cxx_cxx98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX ;; +esac +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" ;; +esac +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 ;; +esac +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Find tools for creating static libraries +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +printf %s "checking target system type... " >&6; } +if test ${ac_cv_target+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "${ac_aux_dir}config.sub" $target_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $target_alias failed" "$LINENO" 5 +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +printf "%s\n" "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- +# Extract the first word of "$target_alias-ar", so it can be a program name with args. +set dummy $target_alias-ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$target_alias-ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +if test -z "$ac_cv_prog_AR"; then + if test "$build" = "$target"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR=":" +fi ;; +esac +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + AR=$ac_ct_AR + else + AR=":" + fi +else + AR="$ac_cv_prog_AR" +fi + +if test $AR = ":" +then : + as_fn_error $? "ar command not found." "$LINENO" 5 +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test $RANLIB = ":" +then : + as_fn_error $? "ranlib command not found." "$LINENO" 5 +fi + +# Find tools to download and unpack with +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}tar", so it can be a program name with args. +set dummy ${ac_tool_prefix}tar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_TAR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$TAR"; then + ac_cv_prog_TAR="$TAR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_TAR="${ac_tool_prefix}tar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +TAR=$ac_cv_prog_TAR +if test -n "$TAR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5 +printf "%s\n" "$TAR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_TAR"; then + ac_ct_TAR=$TAR + # Extract the first word of "tar", so it can be a program name with args. +set dummy tar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_TAR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_TAR"; then + ac_cv_prog_ac_ct_TAR="$ac_ct_TAR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_TAR="tar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_TAR=$ac_cv_prog_ac_ct_TAR +if test -n "$ac_ct_TAR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_TAR" >&5 +printf "%s\n" "$ac_ct_TAR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_TAR" = x; then + TAR="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + TAR=$ac_ct_TAR + fi +else + TAR="$ac_cv_prog_TAR" +fi + + +# Find AMUSE libraries + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See 'config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else case e in #( + e) ac_compiler_gnu=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else case e in #( + e) CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else case e in #( + e) ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 ;; +esac +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + PKG_CONFIG="" + fi +fi + + + amuse_save_LIBS="$LIBS" + amuse_save_LIB_CFLAGS="$STOPCOND_CFLAGS" + amuse_save_LIB_LIBS="$STOPCOND_LIBS" + amuse_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" + + # If we have an active virtualenv, make sure pkg-config searches it + if test "a${VIRTUAL_ENV}" != "a" + then + PKG_CONFIG_PATH="${VIRTUAL_ENV}/lib/pkgconfig:${PKG_CONFIG_PATH}" + fi + + # All AMUSE libs export C symbols + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + # Search for the library, first directly then fall back to pkg-config + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing is_condition_enabled" >&5 +printf %s "checking for library containing is_condition_enabled... " >&6; } +if test ${ac_cv_search_is_condition_enabled+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char is_condition_enabled (void); +int +main (void) +{ +return is_condition_enabled (); + ; + return 0; +} +_ACEOF +for ac_lib in '' stopcond +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_is_condition_enabled=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_is_condition_enabled+y} +then : + break +fi +done +if test ${ac_cv_search_is_condition_enabled+y} +then : + +else case e in #( + e) ac_cv_search_is_condition_enabled=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_is_condition_enabled" >&5 +printf "%s\n" "$ac_cv_search_is_condition_enabled" >&6; } +ac_res=$ac_cv_search_is_condition_enabled +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + FOUND_STOPCOND="yes" + STOPCOND_LIBS="$LIBS" + STOPCOND_CFLAGS="" + +else case e in #( + e) + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for STOPCOND" >&5 +printf %s "checking for STOPCOND... " >&6; } + +if test -n "$STOPCOND_CFLAGS"; then + pkg_cv_STOPCOND_CFLAGS="$STOPCOND_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"stopcond\""; } >&5 + ($PKG_CONFIG --exists --print-errors "stopcond") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_STOPCOND_CFLAGS=`$PKG_CONFIG --cflags "stopcond" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$STOPCOND_LIBS"; then + pkg_cv_STOPCOND_LIBS="$STOPCOND_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"stopcond\""; } >&5 + ($PKG_CONFIG --exists --print-errors "stopcond") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_STOPCOND_LIBS=`$PKG_CONFIG --libs "stopcond" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + STOPCOND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "stopcond" 2>&1` + else + STOPCOND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "stopcond" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$STOPCOND_PKG_ERRORS" >&5 + + + FOUND_STOPCOND="no" + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + FOUND_STOPCOND="no" + +else + STOPCOND_CFLAGS=$pkg_cv_STOPCOND_CFLAGS + STOPCOND_LIBS=$pkg_cv_STOPCOND_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + FOUND_STOPCOND="yes" + +fi + ;; +esac +fi + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + PKG_CONFIG_PATH="$amuse_save_PKG_CONFIG_PATH" + LIBS="$amuse_save_LIBS" + + # If we have an active CONDA environment, assume that the lib is coming from + # there and add an additional flag so that .mod files can be found. Only really + # needed for stopcond and forsockets, and hopefully conda-forge will give us a + # better solution soon. + if test "${FOUND_STOPCOND}" == "yes" -a "x$CONDA_PREFIX" != "x" + then + STOPCOND_CFLAGS="${STOPCOND_CFLAGS} -I${CONDA_PREFIX}/include" + fi + + # If the user overrode the variables, go with what they set instead of + # what we just detected. + if test "x$amuse_save_LIB_CFLAGS" != "x" +then : + + STOPCOND_CFLAGS="$amuse_save_LIB_CFLAGS" + +fi + if test "x$amuse_save_LIB_LIBS" != "x" +then : + + STOPCOND_LIBS="$amuse_save_LIB_LIBS" + +fi + + + + + + + +# Find MPI for the worker +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + + + + + for ac_prog in mpicxx mpiCC mpic++ hcp mpxlC_r mpxlC mpCC cmpic++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MPICXX+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$MPICXX"; then + ac_cv_prog_MPICXX="$MPICXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_MPICXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +MPICXX=$ac_cv_prog_MPICXX +if test -n "$MPICXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPICXX" >&5 +printf "%s\n" "$MPICXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$MPICXX" && break +done +test -n "$MPICXX" || MPICXX="$CXX" + + ax_mpi_save_CXX="$CXX" + CXX="$MPICXX" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking checking MPI C++ flags" >&5 +printf %s "checking checking MPI C++ flags... " >&6; } + ax_mpi_cc_flags="`$MPICXX -showme:compile 2>/dev/null| cut -d\ -f2-`" + ax_mpi_cc_libs="`$MPICXX -showme:link 2>/dev/null| cut -d\ -f2-`" + if test "x$ax_mpi_cc_flags" = "x" +then : + + ax_mpi_cc_flags="`$MPICXX -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" + ax_mpi_cc_libs="`$MPICXX -show 2>/dev/null| cut -d\ -f2-`" + if test "x$ax_mpi_cc_flags" = "x" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not determine C++ flags from show functions" >&5 +printf "%s\n" "could not determine C++ flags from show functions" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: flags found" >&5 +printf "%s\n" "flags found" >&6; } ;; +esac +fi + + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: flags found" >&5 +printf "%s\n" "flags found" >&6; } ;; +esac +fi + MPI_CXXFLAGS="$ax_mpi_cc_flags" + MPI_CXXLIBS="$ax_mpi_cc_libs" + + + + + +if test x = x"$MPILIBS"; then + ac_fn_cxx_check_func "$LINENO" "MPI_Init" "ac_cv_func_MPI_Init" +if test "x$ac_cv_func_MPI_Init" = xyes +then : + MPILIBS=" " +fi + +fi + +if test x = x"$MPILIBS"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5 +printf %s "checking for MPI_Init in -lmpi... " >&6; } +if test ${ac_cv_lib_mpi_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lmpi $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +namespace conftest { + extern "C" int MPI_Init (); +} +int +main (void) +{ +return conftest::MPI_Init (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + ac_cv_lib_mpi_MPI_Init=yes +else case e in #( + e) ac_cv_lib_mpi_MPI_Init=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_mpi_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpi_MPI_Init" = xyes +then : + MPILIBS="-lmpi" +fi + +fi +if test x = x"$MPILIBS"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5 +printf %s "checking for MPI_Init in -lmpich... " >&6; } +if test ${ac_cv_lib_mpich_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lmpich $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +namespace conftest { + extern "C" int MPI_Init (); +} +int +main (void) +{ +return conftest::MPI_Init (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + ac_cv_lib_mpich_MPI_Init=yes +else case e in #( + e) ac_cv_lib_mpich_MPI_Init=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_mpich_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpich_MPI_Init" = xyes +then : + MPILIBS="-lmpich" +fi + +fi + +if test x != x"$MPILIBS"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mpi.h" >&5 +printf %s "checking for mpi.h... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) MPILIBS="" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +CXX="$ax_mpi_save_CXX" + + + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x = x"$MPILIBS"; then + + : +else + +printf "%s\n" "#define HAVE_MPI 1" >>confdefs.h + + : +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Generate output +ac_config_files="$ac_config_files config.mk" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# 'ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* 'ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # 'set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # 'set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[][ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else case e in #( + e) case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as 'sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else case e in #( + e) as_fn_append () + { + eval $1=\$$1\$2 + } ;; +esac +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else case e in #( + e) as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } ;; +esac +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated + +# Sed expression to map a string onto a valid variable name. +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by amuse-tsunami $as_me 1.0, which was +generated by GNU Autoconf 2.72. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +'$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to the package provider." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +amuse-tsunami config.status 1.0 +configured by $0, generated by GNU Autoconf 2.72, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2023 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: '$1' +Try '$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.mk") CONFIG_FILES="$CONFIG_FILES config.mk" ;; + + *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to '$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with './config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain ':'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is 'configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when '$srcdir' = '.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + + From 2a7315eeb9b719b1a646fef07314927b9f67b2e9 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Jun 2026 16:34:10 +0200 Subject: [PATCH 053/132] fixed makefile --- src/amuse_tsunami/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/Makefile b/src/amuse_tsunami/Makefile index 989301f5fc..f5799663db 100644 --- a/src/amuse_tsunami/Makefile +++ b/src/amuse_tsunami/Makefile @@ -6,7 +6,7 @@ endif support/config.mk: cd support && ./configure -src/tsunami-master: | tsunami.tar.gz +src/tsunami-master: | tsunami-master.tar.gz tar xf $< mv tsunami-master src/ @@ -17,7 +17,7 @@ install_tsunami: | src/tsunami-master ifneq ($(CONDA_PREFIX),) conda install --yes --channel conda-forge --override-channels numpy swig scikit-build-core endif - cd src/tsunami-master/ && pip install . + cd src/tsunami-master/ && pip install . -Ccmake.define.spin=ON tsunami_worker: interface.py install_tsunami From edf1d2d2fbfc7b83d4260dbc6244d88579caaaf7 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Jun 2026 16:35:36 +0200 Subject: [PATCH 054/132] rm stype from tsunami since its an unused param --- src/amuse_tsunami/interface.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 072cd0c4a5..642c97cd04 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1,5 +1,7 @@ import numpy as np from numpy.typing import NDArray +from amuse.community.interface.common import CommonCode, CommonCodeInterface +import tsunami from amuse.support.interface import InCodeComponentImplementation from amuse.community.interface.gd import ( @@ -15,14 +17,14 @@ from amuse.rfi.core import ( CodeInterface, LegacyFunctionSpecification, - legacy_function + PythonCodeInterface, + legacy_function, + remote_function ) from amuse.support.interface import MethodWithUnitsDefinition from amuse.support.literature import LiteratureReferencesMixIn from amuse.units import generic_unit_system, nbody_system -import tsunami - class TsunamiImplementation(object): """ @@ -43,7 +45,6 @@ def __init__(self): self._spin_list: list[list[float]] = [] self._mass_list: list[float] = [] self._radius_list: list[float] = [] - self._stype_list: list[int] = [] # commited particles self._pos: NDArray = np.empty((0, 3), dtype=np.float64) @@ -91,14 +92,15 @@ def commit_particles(self) -> int: return 0 if N_total < 2: - return -1 + raise ValueError( + 'Tsunami needs at least 2 particles when commiting!' + ) if not ( len(self._vel_list) == N_new and len(self._spin_list) == N_new and len(self._mass_list) == N_new and - len(self._radius_list) == N_new and - len(self._stype_list) == N_new + len(self._radius_list) == N_new ): return -1 @@ -108,7 +110,7 @@ def commit_particles(self) -> int: spin = np.empty((N_total, 3), dtype=np.float64) mass = np.empty(N_total, dtype=np.float64) radius = np.empty(N_total, dtype=np.float64) - stype = np.empty(N_total, dtype=np.int64) + stype = np.ones(N_total, dtype=np.int64) * -1 # add any existing Tsunami particles if N_existing != 0: @@ -117,7 +119,6 @@ def commit_particles(self) -> int: spin[:N_existing, :] = self._spin mass[:N_existing] = self._mass radius[:N_existing] = self._radius - stype[:N_existing] = self._stype # add new particles pos[N_existing:, :] = np.asarray(self._pos_list, dtype=np.float64).reshape(-1, 3) @@ -125,7 +126,6 @@ def commit_particles(self) -> int: spin[N_existing:, :] = np.asarray(self._spin_list, dtype=np.float64).reshape(-1, 3) mass[N_existing:] = np.asarray(self._mass_list, dtype=np.float64) radius[N_existing:] = np.asarray(self._radius_list, dtype=np.float64) - stype[N_existing:] = np.asarray(self._stype_list, dtype=np.int64) self.tsunami.add_particle_set(pos, vel, mass, radius, stype, spin) From 2b2398454780cca45862b7c682425c6136a82d03 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Jun 2026 16:36:38 +0200 Subject: [PATCH 055/132] def evolve_model and rm more stype --- src/amuse_tsunami/interface.py | 308 +++++++++++++++++++++------------ 1 file changed, 194 insertions(+), 114 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 642c97cd04..61df454f25 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -149,29 +149,96 @@ def recommit_particles(self) -> int: return 0 + def evolve_model(self, time) -> int: + if time <= self.tsunami.time: + return -1 + + self.tsunami.evolve_system(time) + + self.tsunami.sync_internal_state(self._pos, self._vel, self._spin) + + return 0 + + def get_state( + self, + index_of_the_particle, + mass, + x, + y, + z, + vx, + vy, + vz, + radius, + wx, + wy, + wz + ) -> int: + i = index_of_the_particle + mass.value = self._mass[i] + x.value = self._pos[i,0] + y.value = self._pos[i,1] + z.value = self._pos[i,2] + vx.value = self._vel[i,0] + vy.value = self._vel[i,1] + vz.value = self._vel[i,2] + radius.value = self._radius[i] + wx.value = self._spin[i,0] + wy.value = self._spin[i,1] + wz.value = self._spin[i,2] + return 0 + + def set_state( + self, + index_of_the_particle, + mass, + x, + y, + z, + vx, + vy, + vz, + radius, + wx, + wy, + wz + ) -> int: + # i = index_of_the_particle + # mass.value = self._mass[i] + # x.value = self._pos[i,0] + # y.value = self._pos[i,1] + # z.value = self._pos[i,2] + # vx.value = self._vel[i,0] + # vy.value = self._vel[i,1] + # vz.value = self._vel[i,2] + # radius.value = self._radius[i] + # wx.value = self._spin[i,0] + # wy.value = self._spin[i,1] + # wz.value = self._spin[i,2] + return 0 + def new_particle( self, - index_of_the_particle: int, - mass: float, - x: float, - y: float, - z: float, - vx: float, - vy: float, - vz: float, - radius: float, - wx: float, - wy: float, - wz: float, - stype: int + index_of_the_particle, + mass, + x, + y, + z, + vx, + vy, + vz, + radius, + wx, + wy, + wz, ) -> int: self._pos_list.append([x, y, z]) self._vel_list.append([vx, vy, vz]) self._mass_list.append(mass) self._radius_list.append(radius) self._spin_list.append([wx, wy, wz]) - self._stype_list.append(stype) - index_of_the_particle = len(self._pos_list) - 1 + + index_of_the_particle.value = len(self._pos_list) - 1 return 0 @@ -415,13 +482,6 @@ def new_particle(): description='The initial spin vector of the particle', default=0 ) - function.addParameter( - 'stype', - dtype='float64', - direction=function.IN, - description='The physical type of the particle', - default=0 - ) function.result_type = 'int32' function.can_handle_array = True function.result_doc = """ @@ -433,104 +493,130 @@ def new_particle(): return function @legacy_function - def get_state(): - """ - Retrieve the current state of a particle. The *minimal* information of - a stellar dynamics particle (mass, radius, position and velocity) is - returned. - """ + def get_time(): function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter( - 'index_of_the_particle', - dtype='int32', - direction=function.IN, - description=( - "Index of the particle to get the state from. This index must " - "have been returned by an earlier call to :meth:`new_particle`" - ), - ) - function.addParameter( - 'mass', - dtype='float64', - direction=function.OUT, - description='The current mass of the particle', - ) - function.addParameter( - 'x', - dtype='float64', - direction=function.OUT, - description='The current position vector of the particle', - ) - function.addParameter( - 'y', - dtype='float64', - direction=function.OUT, - description='The current position vector of the particle', - ) - function.addParameter( - 'z', - dtype='float64', - direction=function.OUT, - description='The current position vector of the particle', - ) - function.addParameter( - 'vx', - dtype='float64', - direction=function.OUT, - description='The current velocity vector of the particle', - ) - function.addParameter( - 'vy', - dtype='float64', - direction=function.OUT, - description='The current velocity vector of the particle', - ) - function.addParameter( - 'vz', - dtype='float64', - direction=function.OUT, - description='The current velocity vector of the particle', - ) - function.addParameter( - 'radius', - dtype='float64', - direction=function.OUT, - description='The current radius of the particle', - ) - function.addParameter( - 'wx', - dtype='float64', - direction=function.OUT, - description='The current spin of the particle', - ) - function.addParameter( - 'wy', - dtype='float64', - direction=function.OUT, - description='The current spin of the particle', - ) - function.addParameter( - 'wz', - dtype='float64', - direction=function.OUT, - description='The current spin of the particle', - ) function.addParameter( - 'stype', + 'time', dtype='float64', direction=function.OUT, - description='The particle type', + description='time to evolve to' ) function.result_type = 'int32' function.result_doc = """ 0 - OK - particle was removed from the model + System was evolved to time -1 - ERROR - particle could not be found + Requested time is <= current model time """ return function + + @remote_function(can_handle_array=True) + def get_state( + index_of_the_particle='i' + ): + returns ( + mass='d', + x='d', y='d', z='d', + vx='d', vy='d', vz='d', + radius='d', + wx='d', wy='d', wz='d' + ) + + + # @legacy_function + # def get_state(): + # """ + # Retrieve the current state of a particle. The *minimal* information of + # a stellar dynamics particle (mass, radius, position and velocity) is + # returned. + # """ + # function = LegacyFunctionSpecification() + # function.can_handle_array = True + # function.addParameter( + # 'index_of_the_particle', + # dtype='int32', + # direction=function.IN, + # description=( + # "Index of the particle to get the state from. This index must " + # "have been returned by an earlier call to :meth:`new_particle`" + # ), + # ) + # function.addParameter( + # 'mass', + # dtype='float64', + # direction=function.OUT, + # description='The current mass of the particle', + # ) + # function.addParameter( + # 'x', + # dtype='float64', + # direction=function.OUT, + # description='The current position vector of the particle', + # ) + # function.addParameter( + # 'y', + # dtype='float64', + # direction=function.OUT, + # description='The current position vector of the particle', + # ) + # function.addParameter( + # 'z', + # dtype='float64', + # direction=function.OUT, + # description='The current position vector of the particle', + # ) + # function.addParameter( + # 'vx', + # dtype='float64', + # direction=function.OUT, + # description='The current velocity vector of the particle', + # ) + # function.addParameter( + # 'vy', + # dtype='float64', + # direction=function.OUT, + # description='The current velocity vector of the particle', + # ) + # function.addParameter( + # 'vz', + # dtype='float64', + # direction=function.OUT, + # description='The current velocity vector of the particle', + # ) + # function.addParameter( + # 'radius', + # dtype='float64', + # direction=function.OUT, + # description='The current radius of the particle', + # ) + # function.addParameter( + # 'wx', + # dtype='float64', + # direction=function.OUT, + # description='The current spin of the particle', + # ) + # function.addParameter( + # 'wy', + # dtype='float64', + # direction=function.OUT, + # description='The current spin of the particle', + # ) + # function.addParameter( + # 'wz', + # dtype='float64', + # direction=function.OUT, + # description='The current spin of the particle', + # ) + # function.result_type = 'int32' + # function.result_doc = """ + # 0 - OK + # particle was removed from the model + # -1 - ERROR + # particle could not be found + # """ + # return function + @legacy_function def set_state(): """ @@ -616,12 +702,6 @@ def set_state(): direction=function.IN, description='The current spin of the particle', ) - function.addParameter( - 'stype', - dtype='float64', - direction=function.IN, - description='The particle type', - ) function.result_type = 'int32' function.result_doc = """ 0 - OK From 52eacf975e2662a24c3abc308fb431ed7580142a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Jun 2026 16:37:05 +0200 Subject: [PATCH 056/132] fixed TsunamiImplementation to use .value in getters --- src/amuse_tsunami/interface.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 61df454f25..15545a4c87 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -248,9 +248,9 @@ def get_position(self, index_of_the_particle, x, y, z) -> int: self.tsunami.sync_internal_state(self._pos, self._vel, self._spin) - x = self._pos[index_of_the_particle, 0] - y = self._pos[index_of_the_particle, 1] - z = self._pos[index_of_the_particle, 2] + x.value = self._pos[index_of_the_particle, 0] + y.value = self._pos[index_of_the_particle, 1] + z.value = self._pos[index_of_the_particle, 2] return 0 @@ -281,7 +281,7 @@ def get_mscale(self, Mscale) -> int: """ Get mass unit of Tsunami in MSun. """ - Mscale = self.tsunami.Mscale + Mscale.value = self.tsunami.Mscale return 0 @@ -300,7 +300,7 @@ def get_lscale(self, Lscale) -> int: """ Get length unit of Tsunami in AU. """ - Lscale = self.tsunami.Lscale + Lscale.value = self.tsunami.Lscale return 0 @@ -323,7 +323,7 @@ def get_tscale(self, Tscale) -> int: This value is read only; to set it change Mscale and Lscale. """ - Tscale = self.tsunami.Tscale + Tscale.value = self.tsunami.Tscale return 0 @@ -335,7 +335,7 @@ def get_vscale(self, Vscale) -> int: This value is read only; to set it change Mscale and Lscale. """ - Vscale = self.tsunami.Vscale + Vscale.value = self.tsunami.Vscale return 0 @@ -345,23 +345,33 @@ def get_time(self, time) -> int: tsunami.time returns time in N-body units. """ - time = self.tsunami.time + time.value = self.tsunami.time + return 0 + + def get_wpn(self, wpn) -> int: + wpn.value = self.tsunami.Conf.wPNs + return 0 + def set_wpn(self, wpn) -> int: + self.tsunami.Conf.wPNs = bool(wpn) return 0 def get_potential_energy(self, potential_energy) -> int: - potential_energy = self.tsunami.pot + potential_energy.value = self.tsunami.pot return 0 def get_kinetic_energy(self, kinetic_energy) -> int: - kinetic_energy = self.tsunami.kin + kinetic_energy.value = self.tsunami.kin return 0 def get_total_energy(self, total_energy) -> int: - total_energy = self.tsunami.energy + total_energy.value = self.tsunami.energy + + return 0 + def synchronize_model(self) -> int: return 0 def _clear_temporary_particle_buffers(self) -> None: From d4789a1a8b4fcfb28c56390fe035af3f546202c1 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Jun 2026 16:37:27 +0200 Subject: [PATCH 057/132] fixed TsunamiInterface definition --- src/amuse_tsunami/interface.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 15545a4c87..4db5a364a8 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -381,13 +381,12 @@ def _clear_temporary_particle_buffers(self) -> None: self._spin_list.clear() self._mass_list.clear() self._radius_list.clear() - self._stype_list.clear() class TsunamiInterface( - CodeInterface, - LiteratureReferencesMixIn, + PythonCodeInterface, GravitationalDynamicsInterface, - StoppingConditionInterface, + GravityFieldInterface, + LiteratureReferencesMixIn, ): """ Description of the interface with the community code. @@ -400,11 +399,14 @@ class TsunamiInterface( corresponding request from the Python part of AMUSE. """ - include_headers = ['tsunami_worker.h', 'stopcond.h'] + # include_headers = ['tsunami_worker.h', 'stopcond.h'] def __init__(self, **kwargs): - CodeInterface.__init__( - self, name_of_the_worker='tsunami_worker', **kwargs + PythonCodeInterface.__init__( + self, + TsunamiImplementation, + 'tsunami_worker', + **kwargs ) LiteratureReferencesMixIn.__init__(self) From 698d034c33ed2b8dcdacfc982ccc2fef11af3bce Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Jun 2026 16:38:15 +0200 Subject: [PATCH 058/132] fixed Tsunami user interface --- src/amuse_tsunami/interface.py | 134 +++++++++++++++++++++++---------- 1 file changed, 93 insertions(+), 41 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 4db5a364a8..05ce9c45d3 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -723,8 +723,38 @@ def set_state(): """ return function + # @legacy_function + # def get_wpn(): + # function = LegacyFunctionSpecification() + # function.addParameter( + # 'wpn', + # dtype='bool', + # direction=function.OUT + # ) + # function.result_type = 'int32' + # return function + + # @legacy_function + # def set_wpn(): + # function = LegacyFunctionSpecification() + # function.addParameter( + # 'wpn', + # dtype='bool', + # direction=function.IN + # ) + # function.result_type = 'int32' + # return function + + @remote_function + def get_wpn(): + returns (wpn='b') + + @remote_function + def set_wpn(wpn='b'): + returns () -class Tsunami(GravitationalDynamics, GravityFieldCode): + +class Tsunami(GravitationalDynamics, GravityFieldCode, CommonCode): """One line description of this code Some more details about what it does, any special features it has beyond the @@ -756,18 +786,11 @@ def __init__(self, convert_nbody=None, **options): def define_state(self, handler): """Define the state model of the code.""" - # for example: - # handler.set_initial_state('UNINITIALIZED') - # handler.add_transition('!UNINITIALIZED!STOPPED', 'END', 'cleanup_code') - # handler.add_transition('END', 'STOPPED', 'stop', False) - # handler.add_transition( - # 'UNINITIALIZED', 'INITIALIZED', 'initialize_code') - # handler.add_method('STOPPED', 'stop') - pass + GravitationalDynamics.define_state(self, handler) + GravityFieldCode.define_state(self, handler) def define_properties(self, handler): - # handler.add_property('name_of_the_getter', public_name="name_of_the_property") - pass + handler.add_property('get_time', public_name='model_time') def define_methods(self, handler): """ @@ -787,15 +810,52 @@ def define_methods(self, handler): generic_unit_system.speed, generic_unit_system.speed, generic_unit_system.speed, - generic_unit_system.length, # radius - 1 / generic_unit_system.time, # wx - 1 / generic_unit_system.time, # wy - 1 / generic_unit_system.time, # wz - handler.NO_UNIT, # stype + generic_unit_system.length, + 1 / generic_unit_system.time, + 1 / generic_unit_system.time, + 1 / generic_unit_system.time, ), (handler.INDEX, handler.ERROR_CODE) ) + handler.add_method( + 'get_state', + (handler.INDEX,), + ( + generic_unit_system.mass, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.length, + 1 / generic_unit_system.time, + 1 / generic_unit_system.time, + 1 / generic_unit_system.time, + handler.ERROR_CODE + ), + ) + + handler.add_method( + 'set_state', + ( + handler.INDEX, + generic_unit_system.mass, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.length, + 1 / generic_unit_system.time, + 1 / generic_unit_system.time, + 1 / generic_unit_system.time, + ), + (handler.ERROR_CODE,) + ) + def define_parameters(self, handler): """Define model parameters. @@ -803,17 +863,19 @@ def define_parameters(self, handler): and a name, description and default value. Functions with the appropriate names must be defined in the native wrapper code. """ - # handler.add_method_parameter( - # "name_of_the_getter", - # "name_of_the_setter", - # "parameter_name", - # "description", - # default_value = - # ) - pass + handler.add_method_parameter( + 'get_wpn', + 'set_wpn', + 'wpn', + 'enable post newtonian corrections', + default_value=False + ) + # GravitationalDynamics.define_parameters(self, handler) + def define_particle_sets(self, handler): """Define any particle sets inside the model.""" + GravitationalDynamics.define_particle_sets(self, handler) # handler.define_set('particles', 'index_of_the_particle') # handler.set_new('particles', 'new_particle') # handler.set_delete('particles', 'delete_particle') @@ -821,20 +883,10 @@ def define_particle_sets(self, handler): # handler.add_getter('particles', 'get_state') # handler.add_setter('particles', 'set_mass') # handler.add_getter('particles', 'get_mass', names=('mass',)) - pass - - def define_grids(self, handler): - """Define any grids inside the model.""" - # handler.define_grid('grid',axes_names = ["x", "y"], grid_class=StructuredGrid) - # handler.set_grid_range('grid', '_grid_range') - # handler.add_getter('grid', 'get_grid_position', names=["x", "y"]) - # handler.add_getter('grid', 'get_rho', names=["density"]) - # handler.add_setter('grid', 'set_rho', names=["density"]) - pass - - # def define_converter(self, handler): - # """Handle unit conversion if an (optional) unit converter is specified.""" - # if self.unit_converter is not None: - # handler.set_converter( - # self.unit_converter.as_converter_from_si_to_generic() - # ) + + def define_converter(self, handler): + """Handle unit conversion if an (optional) unit converter is specified.""" + if self.unit_converter is not None: + handler.set_converter( + self.unit_converter.as_converter_from_si_to_generic() + ) From 2d32cbce5ee555dd38cdb18b0bd57fa08f087f21 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Jun 2026 16:38:42 +0200 Subject: [PATCH 059/132] def test_tsunami --- src/amuse_tsunami/tests/test_tsunami.py | 134 +++++++++++++++++++++++- 1 file changed, 129 insertions(+), 5 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index cbd8f87ef9..234af05fbf 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -1,13 +1,137 @@ +from amuse.datamodel import Particle, Particles +from amuse.ext.orbital_elements import generate_binaries from amuse.support.testing.amusetest import TestWithMPI - from amuse_tsunami.interface import TsunamiInterface, Tsunami +from amuse.units import constants as c, nbody_system as ns, units as u -class TestTsunamiInterface(TestWithMPI): +# class TestTsunamiInterface(TestWithMPI): - def test_echo_int(self): - instance = TsunamiInterface() +# def test_echo_int(self): +# instance = TsunamiInterface() - instance.stop() +# instance.stop() class TestTsunami(TestWithMPI): + def generate_HD80606b_system(self): + """ + Initial conditions for the exoplanet system + HD80606b. Initial conditions courtesy of + Dr. Tjarda Boekholt. + """ + HD80606 = Particles(2) + star, planet = generate_binaries( + primary_mass=2.0088092e30 | u.kg, + secondary_mass=7.7459434e27 | u.kg, + semi_major_axis=0.455 | u.au, + eccentricity=0.9330 + ) + HD80606[0].name = 'HD80606' + HD80606[0].mass = star.mass + HD80606[0].radius = 702455.0 | u.km + HD80606[0].x = star.x.as_quantity_in(u.km) + HD80606[0].y = star.y.as_quantity_in(u.km) + HD80606[0].z = star.z.as_quantity_in(u.km) + HD80606[0].vx = star.vx.as_quantity_in(u.kms) + HD80606[0].vy = star.vy.as_quantity_in(u.kms) + HD80606[0].vz = star.vz.as_quantity_in(u.kms) + HD80606[0].wx = 0.0 | 1 / u.s + HD80606[0].wy = 0.0 | 1 / u.s + HD80606[0].wz = 2.97188607137e-6 | 1 / u.s + + HD80606[1].name = 'HD80606b' + HD80606[1].mass = planet.mass + HD80606[1].radius = 68488.3446 | u.km + HD80606[1].x = planet.x.as_quantity_in(u.km) + HD80606[1].y = planet.y.as_quantity_in(u.km) + HD80606[1].z = planet.z.as_quantity_in(u.km) + HD80606[1].vx = planet.vx.as_quantity_in(u.kms) + HD80606[1].vy = planet.vy.as_quantity_in(u.kms) + HD80606[1].vz = planet.vz.as_quantity_in(u.kms) + HD80606[1].wx = 0.0 | 1 / u.s + HD80606[1].wy = 0.0 | 1 / u.s + HD80606[1].wz = 0.000145444104333 | 1 / u.s + + return HD80606 + + + def generate_pythagorean(self): + p = Particles(3) + + p[0].mass = 3 | ns.mass + p[0].radius = 0 | ns.length + p[0].x = 1 | ns.length + p[0].y = 3 | ns.length + p[0].z = 0 | ns.length + p[0].vx = 0 | ns.speed + p[0].vy = 0 | ns.speed + p[0].vz = 0 | ns.speed + + p[1].mass = 4 | ns.mass + p[1].radius = 0 | ns.length + p[1].x = -2 | ns.length + p[1].y = -1 | ns.length + p[1].z = 0 | ns.length + p[1].vx = 0 | ns.speed + p[1].vy = 0 | ns.speed + p[1].vz = 0 | ns.speed + + p[2].mass = 5 | ns.mass + p[2].radius = 0 | ns.length + p[2].x = 1 | ns.length + p[2].y = -1 | ns.length + p[2].z = 0 | ns.length + p[2].vx = 0 | ns.speed + p[2].vy = 0 | ns.speed + p[2].vz = 0 | ns.speed + + return p + + def test_tsunami(self): + system = self.generate_pythagorean() + + instance = Tsunami(redirection='none') + assert instance is not None + + + print(instance.parameters) + + instance.commit_parameters() + + instance.particles.add_particles(system) + import matplotlib.pyplot as plt + + instance.commit_particles() + channel = instance.particles.new_channel_to(system) + + print('ic\n', instance.particles) + + t_end = 65 | ns.time + dt = 0.1 | ns.time + particles = [] + + while instance.model_time < t_end: + instance.evolve_model(instance.model_time + dt) + channel.copy() + particles.append(system.copy()) + print(instance.model_time) + + colors = ['darkslateblue', 'mediumvioletred', 'c'] + data = [[], [], []] + + for p in particles: + for i in range(3): + data[i].append((p[i].x.number, p[i].y.number)) + + import visualastro as va + with va.style('smplot'): + fig = plt.figure(figsize=(5,8), tight_layout=True) + ax = fig.add_subplot(111) + for i, (color, pts) in enumerate(zip(colors, data)): + xs, ys = zip(*pts) + ax.plot(xs, ys, color=color, linewidth=0.8) + + plt.show() + + + instance.stop() From ff9cb897476c07ff9442367cb47ed75d3f3642c0 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 4 Jun 2026 12:00:56 +0200 Subject: [PATCH 060/132] def evolve_model, evolve_model_dtmax, rearranged particle attributes tsunami --- src/amuse_tsunami/interface.py | 161 +++++++++++++++++++++++++-------- 1 file changed, 122 insertions(+), 39 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 05ce9c45d3..5c83c6c770 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -15,22 +15,20 @@ StoppingConditionInterface ) from amuse.rfi.core import ( - CodeInterface, LegacyFunctionSpecification, PythonCodeInterface, legacy_function, remote_function ) -from amuse.support.interface import MethodWithUnitsDefinition +from amuse.rfi.python_code import ValueHolder from amuse.support.literature import LiteratureReferencesMixIn -from amuse.units import generic_unit_system, nbody_system +from amuse.units import nbody_system as ns class TsunamiImplementation(object): """ Notes: what to do with spin? can be compiled with or without - what to do with import tsunami what to do with setters """ @@ -40,29 +38,31 @@ def __init__(self): self.tsunami = tsunami.Tsunami() # temporary buffers for staging particles + self._mass_list: list[float] = [] + self._radius_list: list[float] = [] self._pos_list: list[list[float]] = [] self._vel_list: list[list[float]] = [] self._spin_list: list[list[float]] = [] - self._mass_list: list[float] = [] - self._radius_list: list[float] = [] # commited particles - self._pos: NDArray = np.empty((0, 3), dtype=np.float64) - self._vel: NDArray = np.empty((0, 3), dtype=np.float64) - self._spin: NDArray = np.empty((0, 3), dtype=np.float64) - self._mass: NDArray = np.empty(0, dtype=np.float64) - self._radius: NDArray = np.empty(0, dtype=np.float64) - self._stype: NDArray = np.empty(0, dtype=np.int64) + self._mass = np.empty(0, dtype=np.float64) + self._radius = np.empty(0, dtype=np.float64) + self._pos = np.empty((0, 3), dtype=np.float64) + self._vel = np.empty((0, 3), dtype=np.float64) + self._spin = np.empty((0, 3), dtype=np.float64) + self._stype = np.empty(0, dtype=np.int64) def initialize_code(self) -> int: return 0 def cleanup_code(self) -> int: + """Deallocate Tsunami particles.""" + self._clear_temporary_particle_buffers() return 0 def commit_parameters(self) -> int: + """Commit Tsunami parameters.""" self.tsunami.commit_parameters() - return 0 def commit_particles(self) -> int: @@ -97,92 +97,175 @@ def commit_particles(self) -> int: ) if not ( - len(self._vel_list) == N_new and - len(self._spin_list) == N_new and len(self._mass_list) == N_new and - len(self._radius_list) == N_new + len(self._radius_list) == N_new and + len(self._vel_list) == N_new and + len(self._spin_list) == N_new ): return -1 # preallocate particleset for Tsunami + mass = np.empty(N_total, dtype=np.float64) + radius = np.empty(N_total, dtype=np.float64) pos = np.empty((N_total, 3), dtype=np.float64) vel = np.empty((N_total, 3), dtype=np.float64) spin = np.empty((N_total, 3), dtype=np.float64) - mass = np.empty(N_total, dtype=np.float64) - radius = np.empty(N_total, dtype=np.float64) stype = np.ones(N_total, dtype=np.int64) * -1 # add any existing Tsunami particles if N_existing != 0: + mass[:N_existing] = self._mass + radius[:N_existing] = self._radius pos[:N_existing, :] = self._pos vel[:N_existing, :] = self._vel spin[:N_existing, :] = self._spin - mass[:N_existing] = self._mass - radius[:N_existing] = self._radius # add new particles + mass[N_existing:] = np.asarray(self._mass_list, dtype=np.float64) + radius[N_existing:] = np.asarray(self._radius_list, dtype=np.float64) pos[N_existing:, :] = np.asarray(self._pos_list, dtype=np.float64).reshape(-1, 3) vel[N_existing:, :] = np.asarray(self._vel_list, dtype=np.float64).reshape(-1, 3) spin[N_existing:, :] = np.asarray(self._spin_list, dtype=np.float64).reshape(-1, 3) - mass[N_existing:] = np.asarray(self._mass_list, dtype=np.float64) - radius[N_existing:] = np.asarray(self._radius_list, dtype=np.float64) self.tsunami.add_particle_set(pos, vel, mass, radius, stype, spin) + self._mass = mass + self._radius = radius self._pos = pos self._vel = vel self._spin = spin - self._mass = mass - self._radius = radius self._stype = stype self._clear_temporary_particle_buffers() return 0 def recommit_parameters(self) -> int: + """Recommit parameters after commiting them.""" self.tsunami.commit_parameters() - return 0 def recommit_particles(self) -> int: + """Recommit particles after commiting them.""" self.commit_particles() - return 0 - def evolve_model(self, time) -> int: + def evolve_model(self, time: float) -> int: + """ + Evolve the system to a specified final time. + + Parameters + ---------- + time : float + Time to evolve to. + + Returns + ------- + 0 : If the evolution is succesful. + -1 : If `time` <= current model time. + """ if time <= self.tsunami.time: return -1 self.tsunami.evolve_system(time) + self.synchronize_model() - self.tsunami.sync_internal_state(self._pos, self._vel, self._spin) + return 0 + + def evolve_model_dtmax(self, time: float) -> int: + """ + Evolves the system for a single integration step, + ensuring that the system time does not exceed the + specified target `time`. This method is especially + useful when precise control over the maximum timestep + is needed, such as in visualizations or applications + requiring fixed time intervals. + + Unlike evolve_system(), this method performs only one + integration step and adapts the timestep to ensure + it does not exceed `time`. If the integration requires + a shorter timestep, it may stop well before `time`. + + Parameters + ---------- + time : float + Time to evolve to. + + Returns + ------- + 0 : If the evolution is succesful. + -1 : If `time` <= current model time. + """ + if time <= self.tsunami.time: + return -1 + + self.tsunami.evolve_system_dtmax(time) + self.synchronize_model() return 0 - def get_state( + def new_particle( self, index_of_the_particle, mass, - x, - y, - z, - vx, - vy, - vz, radius, - wx, - wy, - wz + x, y, z, + vx, vy, vz, + wx, wy, wz + ) -> int: + self._mass_list.append(mass) + self._radius_list.append(radius) + self._pos_list.append([x, y, z]) + self._vel_list.append([vx, vy, vz]) + self._spin_list.append([wx, wy, wz]) + + index_of_the_particle.value = len(self._pos_list) - 1 + + return 0 + + def get_state( + self, + index_of_the_particle: int, + mass: ValueHolder, + radius: ValueHolder, + x: ValueHolder, y: ValueHolder, z: ValueHolder, + vx: ValueHolder, vy: ValueHolder, vz: ValueHolder, + wx: ValueHolder, wy: ValueHolder, wz: ValueHolder ) -> int: + """ + Retrieve the state of a particle. + + Parameters + ---------- + index_of_the_particle : int + Particle index as returned by `new_particle`. + mass : ValueHolder[float] + ValueHolder instance to return the mass value. + radius : ValueHolder[float] + ValueHolder instance to return the radius value. + x, y, z : ValueHolder[float] + ValueHolder instance to return the particle position. + vx, vy, vz : ValueHolder[float] + ValueHolder instance to return the particle velocity. + wx, wy, wz : ValueHolder[float] + ValueHolder instance to return the particle spin. + + Returns + ------- + 0 : State was retrieved successfully. + """ i = index_of_the_particle + self._validate_particle_index(i) + + self.synchronize_model() + mass.value = self._mass[i] + radius.value = self._radius[i] x.value = self._pos[i,0] y.value = self._pos[i,1] z.value = self._pos[i,2] vx.value = self._vel[i,0] vy.value = self._vel[i,1] vz.value = self._vel[i,2] - radius.value = self._radius[i] wx.value = self._spin[i,0] wy.value = self._spin[i,1] wz.value = self._spin[i,2] From 65828afa7d25fc0c1aa5de01f15d663c392beb8e Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 4 Jun 2026 12:02:07 +0200 Subject: [PATCH 061/132] type annotations get/set state --- src/amuse_tsunami/interface.py | 102 ++++++++++++++++----------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 5c83c6c770..2a07bd9b9c 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -273,63 +273,44 @@ def get_state( def set_state( self, - index_of_the_particle, - mass, - x, - y, - z, - vx, - vy, - vz, - radius, - wx, - wy, - wz - ) -> int: - # i = index_of_the_particle - # mass.value = self._mass[i] - # x.value = self._pos[i,0] - # y.value = self._pos[i,1] - # z.value = self._pos[i,2] - # vx.value = self._vel[i,0] - # vy.value = self._vel[i,1] - # vz.value = self._vel[i,2] - # radius.value = self._radius[i] - # wx.value = self._spin[i,0] - # wy.value = self._spin[i,1] - # wz.value = self._spin[i,2] - return 0 - - def new_particle( - self, - index_of_the_particle, - mass, - x, - y, - z, - vx, - vy, - vz, - radius, - wx, - wy, - wz, + index_of_the_particle: int, + mass: float, + radius: float, + x: float, y: float, z: float, + vx: float, vy: float, vz: float, + wx: float, wy: float, wz: float ) -> int: - self._pos_list.append([x, y, z]) - self._vel_list.append([vx, vy, vz]) - self._mass_list.append(mass) - self._radius_list.append(radius) - self._spin_list.append([wx, wy, wz]) + i = index_of_the_particle + self._validate_particle_index(i) - index_of_the_particle.value = len(self._pos_list) - 1 + self._mass[i] = mass + self._radius[i] = radius + self._pos[i,0] = x + self._pos[i,1] = y + self._pos[i,2] = z + self._vel[i,0] = vx + self._vel[i,1] = vy + self._vel[i,2] = vz + self._spin[i,0] = wx + self._spin[i,1] = wy + self._spin[i,2] = wz + + self.tsunami.override_masses(self._mass) + self.tsunami.override_position_and_velocities(self._pos, self._vel) return 0 - def get_position(self, index_of_the_particle, x, y, z) -> int: + def get_position( + self, + index_of_the_particle: int, + x: ValueHolder, + y: ValueHolder, + z: ValueHolder + ) -> int: if self._pos.shape[0] == 0: return -1 - self.tsunami.sync_internal_state(self._pos, self._vel, self._spin) + self.synchronize_model() x.value = self._pos[index_of_the_particle, 0] y.value = self._pos[index_of_the_particle, 1] @@ -337,9 +318,28 @@ def get_position(self, index_of_the_particle, x, y, z) -> int: return 0 - def set_position(self, index_of_the_particle, x, y, z) -> int: + def set_position( + self, index_of_the_particle: int, x: float, y: float, z: float + ) -> int: + """ + Set the position of a particle. Ensure to update its mass first! - self.tsunami.sync_internal_state(self._pos, self._vel, self._spin) + Parameters + ---------- + index_of_the_particle : int + Particle index. + x, y, z : float + Particle position. + + Returns + ------- + 0 : If position was set. + + Raises + ------ + ValueError : If `index_of_the_particle` is not valid. + """ + self._validate_particle_index(index_of_the_particle) self._pos[index_of_the_particle, 0] = x self._pos[index_of_the_particle, 1] = y From dcd3c5df67d9a4cf17bae26e13f28d5ca06272b9 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 4 Jun 2026 12:02:51 +0200 Subject: [PATCH 062/132] def synchronize_model and _validate_particle_index --- src/amuse_tsunami/interface.py | 60 +++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 2a07bd9b9c..41d0c0f5f7 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -73,16 +73,22 @@ def commit_particles(self) -> int: preallocated np.ndarrays of particles. This method grabs all pre-existing particles in Tsunami - as well as any particles inside the temporary buffers + as well as any new particles inside the temporary buffers and formats them as a particle set to be read by Tsunami. + This method should only be called after 2 new particles were added. + Returns ------- - 0 : If particles were added to Tsunami succesfully or if no - new particles are available to be added - -1 : If less than 2 particles between the pre-existing particles - and the particles in the buffer, or if the shapes of the - particleset arrays dont match. + 0 : If particles were added to Tsunami succesfully or if no + new particles are available to be added. + -1 : If the shapes of the particleset arrays dont match. + + Raises + ------ + ValueError : + If the total particle count is less than 2 particles between + the pre-existing particles and the particles in the buffer. """ N_existing: int = self._pos.shape[0] N_new: int = len(self._pos_list) @@ -360,7 +366,7 @@ def set_units(self, Mscale, Lscale) -> int: return 0 - def get_mscale(self, Mscale) -> int: + def get_mscale(self, Mscale: ValueHolder) -> int: """ Get mass unit of Tsunami in MSun. """ @@ -379,7 +385,7 @@ def set_mscale(self, Mscale) -> int: return 0 - def get_lscale(self, Lscale) -> int: + def get_lscale(self, Lscale: ValueHolder) -> int: """ Get length unit of Tsunami in AU. """ @@ -387,7 +393,7 @@ def get_lscale(self, Lscale) -> int: return 0 - def set_lscale(self, Lscale) -> int: + def set_lscale(self, Lscale: float) -> int: """ Set length unit of Tsunami in AU. @@ -398,7 +404,7 @@ def set_lscale(self, Lscale) -> int: return 0 - def get_tscale(self, Tscale) -> int: + def get_tscale(self, Tscale: ValueHolder) -> int: """ Get time unit of Tsunami in years. Derived from Mscale, Lscale, and G=1. @@ -410,7 +416,7 @@ def get_tscale(self, Tscale) -> int: return 0 - def get_vscale(self, Vscale) -> int: + def get_vscale(self, Vscale: ValueHolder) -> int: """ Get velocity unit of Tsunami in km/s. Derived from Mscale, Lscale, and G=1. @@ -422,7 +428,7 @@ def get_vscale(self, Vscale) -> int: return 0 - def get_time(self, time) -> int: + def get_time(self, time: ValueHolder) -> int: """ Get current model time. @@ -431,39 +437,55 @@ def get_time(self, time) -> int: time.value = self.tsunami.time return 0 - def get_wpn(self, wpn) -> int: + def get_wpn(self, wpn: ValueHolder) -> int: wpn.value = self.tsunami.Conf.wPNs return 0 - def set_wpn(self, wpn) -> int: + def set_wpn(self, wpn: bool) -> int: self.tsunami.Conf.wPNs = bool(wpn) return 0 - def get_potential_energy(self, potential_energy) -> int: + def get_potential_energy(self, potential_energy: ValueHolder) -> int: potential_energy.value = self.tsunami.pot return 0 - def get_kinetic_energy(self, kinetic_energy) -> int: + def get_kinetic_energy(self, kinetic_energy: ValueHolder) -> int: kinetic_energy.value = self.tsunami.kin return 0 - def get_total_energy(self, total_energy) -> int: + def get_total_energy(self, total_energy: ValueHolder) -> int: total_energy.value = self.tsunami.energy return 0 def synchronize_model(self) -> int: + """ + Synchronize TsunamiImplementation with TSUNAMI. + Call this function before accessing values to ensure + that the returned values are up to date. + """ + self.tsunami.sync_internal_state(self._pos, self._vel, self._spin) return 0 + def _validate_particle_index(self, i) -> None: + """ + Validate that the requested particle index + refers to a particle in Tsunami. + """ + if not 0 <= i < len(self._pos): + raise ValueError( + f'Incorrect index of the particle! Max index: {len(self._pos) - 1}' + ) + def _clear_temporary_particle_buffers(self) -> None: """Clear temporary particle buffers after commiting particles""" + self._mass_list.clear() + self._radius_list.clear() self._pos_list.clear() self._vel_list.clear() self._spin_list.clear() - self._mass_list.clear() - self._radius_list.clear() class TsunamiInterface( PythonCodeInterface, From e481f8042200857d556bec15d33ff11c7d4ffde3 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 4 Jun 2026 12:04:30 +0200 Subject: [PATCH 063/132] cleaned up TsunamiInterface --- src/amuse_tsunami/interface.py | 328 ++++----------------------------- 1 file changed, 34 insertions(+), 294 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 41d0c0f5f7..4a918cea0e 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -515,92 +515,18 @@ def __init__(self, **kwargs): ) LiteratureReferencesMixIn.__init__(self) + @remote_function + def evolve_model_dtmax(time='d'): + returns () + @legacy_function def new_particle(): function = LegacyFunctionSpecification() function.can_handle_array = True - function.addParameter( - 'index_of_the_particle', - dtype='int32', - direction=function.OUT, - description=( - 'An index assigned to the newly created particle. ' - 'This index is supposed to be a local index for the code ' - '(and not valid in other instances of the code or in other codes)' - ), - ) - function.addParameter( - 'mass', - dtype='float64', - direction=function.IN, - description='The mass of the particle', - ) - function.addParameter( - 'x', - dtype='float64', - direction=function.IN, - description='The initial position vector of the particle', - ) - function.addParameter( - 'y', - dtype='float64', - direction=function.IN, - description='The initial position vector of the particle', - ) - function.addParameter( - 'z', - dtype='float64', - direction=function.IN, - description='The initial position vector of the particle', - ) - function.addParameter( - 'vx', - dtype='float64', - direction=function.IN, - description='The initial velocity vector of the particle', - ) - function.addParameter( - 'vy', - dtype='float64', - direction=function.IN, - description='The initial velocity vector of the particle', - ) - function.addParameter( - 'vz', - dtype='float64', - direction=function.IN, - description='The initial velocity vector of the particle', - ) - function.addParameter( - 'radius', - dtype='float64', - direction=function.IN, - description='The radius of the particle', - default=0, - ) - function.addParameter( - 'wx', - dtype='float64', - direction=function.IN, - description='The initial spin vector of the particle', - default=0 - ) - function.addParameter( - 'wy', - dtype='float64', - direction=function.IN, - description='The initial spin vector of the particle', - default=0 - ) - function.addParameter( - 'wz', - dtype='float64', - direction=function.IN, - description='The initial spin vector of the particle', - default=0 - ) - function.result_type = 'int32' - function.can_handle_array = True + function.addParameter('index_of_the_particle', dtype='i', direction=function.OUT) + for name in ['mass', 'radius', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'wx', 'wy', 'wz']: + function.addParameter(name, dtype='d', direction=function.IN) + function.result_type = 'i' function.result_doc = """ 0 - OK particle was added to Tsunami @@ -612,13 +538,8 @@ def new_particle(): @legacy_function def get_time(): function = LegacyFunctionSpecification() - function.addParameter( - 'time', - dtype='float64', - direction=function.OUT, - description='time to evolve to' - ) - function.result_type = 'int32' + function.addParameter('time', dtype='d', direction=function.OUT) + function.result_type = 'i' function.result_doc = """ 0 - OK System was evolved to time @@ -627,112 +548,26 @@ def get_time(): """ return function - - @remote_function(can_handle_array=True) - def get_state( - index_of_the_particle='i' - ): - returns ( - mass='d', - x='d', y='d', z='d', - vx='d', vy='d', vz='d', - radius='d', - wx='d', wy='d', wz='d' - ) - - - # @legacy_function - # def get_state(): - # """ - # Retrieve the current state of a particle. The *minimal* information of - # a stellar dynamics particle (mass, radius, position and velocity) is - # returned. - # """ - # function = LegacyFunctionSpecification() - # function.can_handle_array = True - # function.addParameter( - # 'index_of_the_particle', - # dtype='int32', - # direction=function.IN, - # description=( - # "Index of the particle to get the state from. This index must " - # "have been returned by an earlier call to :meth:`new_particle`" - # ), - # ) - # function.addParameter( - # 'mass', - # dtype='float64', - # direction=function.OUT, - # description='The current mass of the particle', - # ) - # function.addParameter( - # 'x', - # dtype='float64', - # direction=function.OUT, - # description='The current position vector of the particle', - # ) - # function.addParameter( - # 'y', - # dtype='float64', - # direction=function.OUT, - # description='The current position vector of the particle', - # ) - # function.addParameter( - # 'z', - # dtype='float64', - # direction=function.OUT, - # description='The current position vector of the particle', - # ) - # function.addParameter( - # 'vx', - # dtype='float64', - # direction=function.OUT, - # description='The current velocity vector of the particle', - # ) - # function.addParameter( - # 'vy', - # dtype='float64', - # direction=function.OUT, - # description='The current velocity vector of the particle', - # ) - # function.addParameter( - # 'vz', - # dtype='float64', - # direction=function.OUT, - # description='The current velocity vector of the particle', - # ) - # function.addParameter( - # 'radius', - # dtype='float64', - # direction=function.OUT, - # description='The current radius of the particle', - # ) - # function.addParameter( - # 'wx', - # dtype='float64', - # direction=function.OUT, - # description='The current spin of the particle', - # ) - # function.addParameter( - # 'wy', - # dtype='float64', - # direction=function.OUT, - # description='The current spin of the particle', - # ) - # function.addParameter( - # 'wz', - # dtype='float64', - # direction=function.OUT, - # description='The current spin of the particle', - # ) - # function.result_type = 'int32' - # function.result_doc = """ - # 0 - OK - # particle was removed from the model - # -1 - ERROR - # particle could not be found - # """ - # return function + @legacy_function + def get_state(): + """ + Retrieve the current state of a particle. The *minimal* information of + a stellar dynamics particle (mass, radius, position and velocity) is + returned. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter('index_of_the_particle', dtype='i', direction=function.IN) + for name in ['mass', 'radius', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'wx', 'wy', 'wz']: + function.addParameter(name, dtype='d', direction=function.OUT) + function.result_type = 'i' + function.result_doc = """ + 0 - OK + particle was removed from the model + -1 - ERROR + particle could not be found + """ + return function @legacy_function def set_state(): @@ -743,83 +578,10 @@ def set_state(): """ function = LegacyFunctionSpecification() function.can_handle_array = True - function.addParameter( - 'index_of_the_particle', - dtype='int32', - direction=function.IN, - description=( - "Index of the particle for which the state is to be updated. " - "This index must have been returned by an earlier call to " - ":meth:`new_particle`" - ), - ) - function.addParameter( - 'mass', - dtype='float64', - direction=function.IN, - description='The new mass of the particle', - ) - function.addParameter( - 'x', - dtype='float64', - direction=function.IN, - description='The new position vector of the particle', - ) - function.addParameter( - 'y', - dtype='float64', - direction=function.IN, - description='The new position vector of the particle', - ) - function.addParameter( - 'z', - dtype='float64', - direction=function.IN, - description='The new position vector of the particle', - ) - function.addParameter( - 'vx', - dtype='float64', - direction=function.IN, - description='The new velocity vector of the particle', - ) - function.addParameter( - 'vy', - dtype='float64', - direction=function.IN, - description='The new velocity vector of the particle', - ) - function.addParameter( - 'vz', - dtype='float64', - direction=function.IN, - description='The new velocity vector of the particle', - ) - function.addParameter( - 'radius', - dtype='float64', - direction=function.IN, - description='The new radius of the particle', - ) - function.addParameter( - 'wx', - dtype='float64', - direction=function.IN, - description='The current spin of the particle', - ) - function.addParameter( - 'wy', - dtype='float64', - direction=function.IN, - description='The current spin of the particle', - ) - function.addParameter( - 'wz', - dtype='float64', - direction=function.IN, - description='The current spin of the particle', - ) - function.result_type = 'int32' + function.addParameter('index_of_the_particle', dtype='i', direction=function.IN) + for name in ['mass', 'radius', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'wx', 'wy', 'wz']: + function.addParameter(name, dtype='d', direction=function.IN) + function.result_type = 'i' function.result_doc = """ 0 - OK particle was found in the model and the information was set @@ -828,28 +590,6 @@ def set_state(): """ return function - # @legacy_function - # def get_wpn(): - # function = LegacyFunctionSpecification() - # function.addParameter( - # 'wpn', - # dtype='bool', - # direction=function.OUT - # ) - # function.result_type = 'int32' - # return function - - # @legacy_function - # def set_wpn(): - # function = LegacyFunctionSpecification() - # function.addParameter( - # 'wpn', - # dtype='bool', - # direction=function.IN - # ) - # function.result_type = 'int32' - # return function - @remote_function def get_wpn(): returns (wpn='b') From d6b621c4073cdbb7fdc5f40cf9ff91f0b86a7c75 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 4 Jun 2026 12:05:34 +0200 Subject: [PATCH 064/132] cleaned up Tsunami --- src/amuse_tsunami/interface.py | 54 +++++++++++++--------------------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 4a918cea0e..67fc307351 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -645,20 +645,20 @@ def define_methods(self, handler): GravitationalDynamics.define_methods(self, handler) + handler.add_method( + 'evolve_model_dtmax', + (ns.time,), + (handler.ERROR_CODE,) + ) + handler.add_method( 'new_particle', ( - generic_unit_system.mass, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.length, - 1 / generic_unit_system.time, - 1 / generic_unit_system.time, - 1 / generic_unit_system.time, + ns.mass, + ns.length, + ns.length, ns.length, ns.length, + ns.speed, ns.speed, ns.speed, + 1 / ns.time, 1 / ns.time, 1 / ns.time, ), (handler.INDEX, handler.ERROR_CODE) ) @@ -667,17 +667,11 @@ def define_methods(self, handler): 'get_state', (handler.INDEX,), ( - generic_unit_system.mass, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.length, - 1 / generic_unit_system.time, - 1 / generic_unit_system.time, - 1 / generic_unit_system.time, + ns.mass, + ns.length, + ns.length, ns.length, ns.length, + ns.speed, ns.speed, ns.speed, + 1 / ns.time, 1 / ns.time, 1 / ns.time, handler.ERROR_CODE ), ) @@ -686,17 +680,11 @@ def define_methods(self, handler): 'set_state', ( handler.INDEX, - generic_unit_system.mass, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.length, - 1 / generic_unit_system.time, - 1 / generic_unit_system.time, - 1 / generic_unit_system.time, + ns.mass, + ns.length, + ns.length, ns.length, ns.length, + ns.speed, ns.speed, ns.speed, + 1 / ns.time, 1 / ns.time, 1 / ns.time, ), (handler.ERROR_CODE,) ) From 6b454923bacc9543c43f9a4357d131923f3d38a6 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 4 Jun 2026 18:51:03 +0200 Subject: [PATCH 065/132] tsunami type annotations and docs --- src/amuse_tsunami/interface.py | 141 ++++++++++++++++++++++++--------- 1 file changed, 104 insertions(+), 37 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 67fc307351..575474f315 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -34,8 +34,8 @@ class TsunamiImplementation(object): """ def __init__(self): - - self.tsunami = tsunami.Tsunami() + # hard code N-Body units to Lscale = Mscale = 1 + self.tsunami = tsunami.Tsunami(1, 1) # temporary buffers for staging particles self._mass_list: list[float] = [] @@ -68,19 +68,20 @@ def commit_parameters(self) -> int: def commit_particles(self) -> int: """ Add all particles stored in the particle buffers - into the Tsunami code. Tsunami does not support + into the TSUNAMI code. TSUNAMI does not support adding individual particles and instead requires preallocated np.ndarrays of particles. - This method grabs all pre-existing particles in Tsunami + This method grabs all pre-existing particles in TSUNAMI as well as any new particles inside the temporary buffers - and formats them as a particle set to be read by Tsunami. + and formats them as numpy arrays to be read by TSUNAMI. This method should only be called after 2 new particles were added. + Calling this method with no new particles in the buffers does nothing. Returns ------- - 0 : If particles were added to Tsunami succesfully or if no + 0 : If particles were added to TSUNAMI succesfully or if no new particles are available to be added. -1 : If the shapes of the particleset arrays dont match. @@ -209,15 +210,54 @@ def evolve_model_dtmax(self, time: float) -> int: return 0 + def synchronize_model(self) -> int: + """ + Synchronize TsunamiImplementation with TSUNAMI. + This ensures that the current particle state in + AMUSE matches the current state of TSUNAMI. + + Call this function before accessing values to ensure + that the returned values are up to date. + """ + self.tsunami.sync_internal_state(self._pos, self._vel, self._spin) + return 0 + def new_particle( self, - index_of_the_particle, - mass, - radius, - x, y, z, - vx, vy, vz, - wx, wy, wz + index_of_the_particle: ValueHolder, + mass: float, + radius: float, + x: float, y: float, z: float, + vx: float, vy: float, vz: float, + wx: float, wy: float, wz: float ) -> int: + """ + Add a new particle to TSUNAMI. + + The particles are added to a temporary buffer, + and are only added to TSUNAMI upon calling + `commit_particles` or `recommit_particles`. + + Parameters + ---------- + index_of_the_particle : ValueHolder[int] + ValueHolder instance to return the index + of the new particle. + mass : float + Particle mass. + radius : float + Particle radius. + x, y, z : float + Particle position. + vx, vy, vz : float + Particle velocity. + wx, wy, wz : float + Particle spin. + + Returns + ------- + 0 : Particle was created successfully. + """ self._mass_list.append(mass) self._radius_list.append(radius) self._pos_list.append([x, y, z]) @@ -258,6 +298,10 @@ def get_state( Returns ------- 0 : State was retrieved successfully. + + Raises + ------ + ValueError : If `index_of_the_particle` is not valid. """ i = index_of_the_particle self._validate_particle_index(i) @@ -286,6 +330,32 @@ def set_state( vx: float, vy: float, vz: float, wx: float, wy: float, wz: float ) -> int: + """ + Set the state of a particle. + + Parameters + ---------- + index_of_the_particle : int + Particle index as returned by `new_particle`. + mass : float + Particle mass. + radius : float + Particle radius. + x, y, z : float + Particle position. + vx, vy, vz : float + Particle velocity. + wx, wy, wz : float + Particle spin. + + Returns + ------- + 0 : State was retrieved successfully. + + Raises + ------ + ValueError : If `index_of_the_particle` is not valid. + """ i = index_of_the_particle self._validate_particle_index(i) @@ -313,6 +383,25 @@ def get_position( y: ValueHolder, z: ValueHolder ) -> int: + """ + Retrieve the position of a particle. + + Parameters + ---------- + index_of_the_particle : int + Particle index as returned by `new_particle`. + x, y, z : ValueHolder[float] + ValueHolder instance to return the position + of the particle. + + Returns + ------- + 0 : If position was set. + + Raises + ------ + ValueError : If `index_of_the_particle` is not valid. + """ if self._pos.shape[0] == 0: return -1 @@ -333,7 +422,7 @@ def set_position( Parameters ---------- index_of_the_particle : int - Particle index. + Particle index as returned by `new_particle`. x, y, z : float Particle position. @@ -393,24 +482,12 @@ def get_lscale(self, Lscale: ValueHolder) -> int: return 0 - def set_lscale(self, Lscale: float) -> int: - """ - Set length unit of Tsunami in AU. - - Used for changing the length unit of - Tsunami after initialization. - """ - self.tsunami.set_units(self.tsunami.Mscale, Lscale) - - return 0 - def get_tscale(self, Tscale: ValueHolder) -> int: """ Get time unit of Tsunami in years. Derived from Mscale, Lscale, and G=1. - This value is read only; to set it change - Mscale and Lscale. + This value is read only. """ Tscale.value = self.tsunami.Tscale @@ -421,8 +498,7 @@ def get_vscale(self, Vscale: ValueHolder) -> int: Get velocity unit of Tsunami in km/s. Derived from Mscale, Lscale, and G=1. - This value is read only; to set it change - Mscale and Lscale. + This value is read only. """ Vscale.value = self.tsunami.Vscale @@ -460,15 +536,6 @@ def get_total_energy(self, total_energy: ValueHolder) -> int: return 0 - def synchronize_model(self) -> int: - """ - Synchronize TsunamiImplementation with TSUNAMI. - Call this function before accessing values to ensure - that the returned values are up to date. - """ - self.tsunami.sync_internal_state(self._pos, self._vel, self._spin) - return 0 - def _validate_particle_index(self, i) -> None: """ Validate that the requested particle index From 2e241acc7ec8af746b30ba071d78ac4397cf2d1a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 4 Jun 2026 18:52:17 +0200 Subject: [PATCH 066/132] added regularization and pn parameters to tsunami --- src/amuse_tsunami/interface.py | 233 ++++++++++++++++++++++++++++----- 1 file changed, 201 insertions(+), 32 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 575474f315..fb805a6c58 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -444,17 +444,6 @@ def set_position( return 0 - def set_units(self, Mscale, Lscale) -> int: - """ - Set the mass and length units for Tsunami. - - Used for changing the unit system of - Tsunami after initialization. - """ - self.tsunami.set_units(Mscale, Lscale) - - return 0 - def get_mscale(self, Mscale: ValueHolder) -> int: """ Get mass unit of Tsunami in MSun. @@ -463,17 +452,6 @@ def get_mscale(self, Mscale: ValueHolder) -> int: return 0 - def set_mscale(self, Mscale) -> int: - """ - Set mass unit of Tsunami in MSun. - - Used for changing the length unit of - Tsunami after initialization. - """ - self.tsunami.set_units(Mscale, self.tsunami.Lscale) - - return 0 - def get_lscale(self, Lscale: ValueHolder) -> int: """ Get length unit of Tsunami in AU. @@ -513,12 +491,76 @@ def get_time(self, time: ValueHolder) -> int: time.value = self.tsunami.time return 0 - def get_wpn(self, wpn: ValueHolder) -> int: - wpn.value = self.tsunami.Conf.wPNs + def get_alpha(self, alpha: ValueHolder) -> int: + alpha.value = self.tsunami.Conf.alpha + return 0 + + def set_alpha(self, alpha: float) -> int: + self.tsunami.Conf.alpha = alpha + return 0 + + def get_beta(self, beta: ValueHolder) -> int: + beta.value = self.tsunami.Conf.beta + return 0 + + def set_beta(self, beta: float) -> int: + self.tsunami.Conf.beta = beta + return 0 + + def get_gamma(self, gamma: ValueHolder) -> int: + gamma.value = self.tsunami.Conf.gamma + return 0 + + def set_gamma(self, gamma: float) -> int: + self.tsunami.Conf.gamma = gamma + return 0 + + def get_pn(self, pn: ValueHolder) -> int: + pn.value = self.tsunami.Conf.wPNs + return 0 + + def set_pn(self, pn: bool) -> int: + self.tsunami.Conf.wPNs = bool(pn) + return 0 + + def get_pn1(self, pn1: ValueHolder) -> int: + pn1.value = self.tsunami.Conf.pn1 return 0 - def set_wpn(self, wpn: bool) -> int: - self.tsunami.Conf.wPNs = bool(wpn) + def set_pn1(self, pn1: bool) -> int: + self.tsunami.Conf.pn1 = bool(pn1) + return 0 + + def get_pn2(self, pn2: ValueHolder) -> int: + pn2.value = self.tsunami.Conf.pn2 + return 0 + + def set_pn2(self, pn2: bool) -> int: + self.tsunami.Conf.pn2 = bool(pn2) + return 0 + + def get_pn25(self, pn25: ValueHolder) -> int: + pn25.value = self.tsunami.Conf.pn25 + return 0 + + def set_pn25(self, pn25: bool) -> int: + self.tsunami.Conf.pn25 = bool(pn25) + return 0 + + def get_pn3(self, pn3: ValueHolder) -> int: + pn3.value = self.tsunami.Conf.pn3 + return 0 + + def set_pn3(self, pn3: bool) -> int: + self.tsunami.Conf.pn3 = bool(pn3) + return 0 + + def get_pn35(self, pn35: ValueHolder) -> int: + pn35.value = self.tsunami.Conf.pn35 + return 0 + + def set_pn35(self, pn35: bool) -> int: + self.tsunami.Conf.pn35 = bool(pn35) return 0 def get_potential_energy(self, potential_energy: ValueHolder) -> int: @@ -658,13 +700,76 @@ def set_state(): return function @remote_function - def get_wpn(): - returns (wpn='b') + def get_alpha(): + returns (alpha='d') + + @remote_function + def set_alpha(alpha='d'): + returns () + + @remote_function + def get_beta(): + returns (beta='d') + + @remote_function + def set_beta(beta='d'): + returns () + + @remote_function + def get_gamma(): + returns (gamma='d') + + @remote_function + def set_gamma(gamma='d'): + returns () + + @remote_function + def get_pn(): + returns (pn='b') + + @remote_function + def set_pn(pn='b'): + returns () + + @remote_function + def get_pn1(): + returns (pn1='b') + + @remote_function + def set_pn1(pn1='b'): + returns () + + @remote_function + def get_pn2(): + returns (pn2='b') + + @remote_function + def set_pn2(pn2='b'): + returns () + + @remote_function + def get_pn25(): + returns (pn25='b') + + @remote_function + def set_pn25(pn25='b'): + returns () @remote_function - def set_wpn(wpn='b'): + def get_pn3(): + returns (pn3='b') + + @remote_function + def set_pn3(pn3='b'): returns () + @remote_function + def get_pn35(): + returns (pn35='b') + + @remote_function + def set_pn35(pn35='b'): + returns () class Tsunami(GravitationalDynamics, GravityFieldCode, CommonCode): """One line description of this code @@ -764,12 +869,76 @@ def define_parameters(self, handler): must be defined in the native wrapper code. """ handler.add_method_parameter( - 'get_wpn', - 'set_wpn', - 'wpn', + 'get_alpha', + 'set_alpha', + 'alpha', + 'alpha regularization parameter.', + default_value=1.0 + ) + + handler.add_method_parameter( + 'get_beta', + 'set_beta', + 'beta', + 'beta regularization parameter.', + default_value=0.0 + ) + + handler.add_method_parameter( + 'get_gamma', + 'set_gamma', + 'gamma', + 'gamma regularization parameter.', + default_value=0.0 + ) + + handler.add_method_parameter( + 'get_pn', + 'set_pn', + 'pn', 'enable post newtonian corrections', default_value=False ) + + handler.add_method_parameter( + 'get_pn1', + 'set_pn1', + 'pn1', + 'enable post newtonian corrections', + default_value=True + ) + + handler.add_method_parameter( + 'get_pn2', + 'set_pn2', + 'pn2', + 'enable post newtonian corrections', + default_value=True + ) + + handler.add_method_parameter( + 'get_pn25', + 'set_pn25', + 'pn25', + 'enable post newtonian corrections', + default_value=True + ) + + handler.add_method_parameter( + 'get_pn3', + 'set_pn3', + 'pn3', + 'enable post newtonian corrections', + default_value=True + ) + + handler.add_method_parameter( + 'get_pn35', + 'set_pn35', + 'pn35', + 'enable post newtonian corrections', + default_value=True + ) # GravitationalDynamics.define_parameters(self, handler) From db71cc7ba19340e82750ec27feab2bfde0f66bd9 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 4 Jun 2026 18:53:24 +0200 Subject: [PATCH 067/132] better pn descriptions in docs --- src/amuse_tsunami/interface.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index fb805a6c58..212e5f076b 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -904,7 +904,7 @@ def define_parameters(self, handler): 'get_pn1', 'set_pn1', 'pn1', - 'enable post newtonian corrections', + 'enable post newtonian corrections of order 1', default_value=True ) @@ -912,7 +912,7 @@ def define_parameters(self, handler): 'get_pn2', 'set_pn2', 'pn2', - 'enable post newtonian corrections', + 'enable post newtonian corrections of order 2', default_value=True ) @@ -920,7 +920,7 @@ def define_parameters(self, handler): 'get_pn25', 'set_pn25', 'pn25', - 'enable post newtonian corrections', + 'enable post newtonian corrections of order 2.5', default_value=True ) @@ -928,7 +928,7 @@ def define_parameters(self, handler): 'get_pn3', 'set_pn3', 'pn3', - 'enable post newtonian corrections', + 'enable post newtonian corrections of order 3', default_value=True ) @@ -936,7 +936,7 @@ def define_parameters(self, handler): 'get_pn35', 'set_pn35', 'pn35', - 'enable post newtonian corrections', + 'enable post newtonian corrections of order 3.5', default_value=True ) # GravitationalDynamics.define_parameters(self, handler) From 57a3f640d4755c3a26f8f59cc1dd5bdf99ef07a3 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 8 Jun 2026 17:32:51 +0200 Subject: [PATCH 068/132] added _id_list and _ids to init of TsunamiImplementation --- src/amuse_tsunami/interface.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 212e5f076b..e93a77b38f 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1,9 +1,7 @@ import numpy as np -from numpy.typing import NDArray -from amuse.community.interface.common import CommonCode, CommonCodeInterface import tsunami -from amuse.support.interface import InCodeComponentImplementation +from amuse.community.interface.common import CommonCode, CommonCodeInterface from amuse.community.interface.gd import ( GravitationalDynamics, GravitationalDynamicsInterface, @@ -21,17 +19,12 @@ remote_function ) from amuse.rfi.python_code import ValueHolder +from amuse.support.interface import InCodeComponentImplementation from amuse.support.literature import LiteratureReferencesMixIn from amuse.units import nbody_system as ns class TsunamiImplementation(object): - """ - Notes: - what to do with spin? can be compiled with or without - what to do with setters - - """ def __init__(self): # hard code N-Body units to Lscale = Mscale = 1 @@ -43,14 +36,18 @@ def __init__(self): self._pos_list: list[list[float]] = [] self._vel_list: list[list[float]] = [] self._spin_list: list[list[float]] = [] + self._id_list: list[int] = [] - # commited particles + # commited particle arrays self._mass = np.empty(0, dtype=np.float64) self._radius = np.empty(0, dtype=np.float64) self._pos = np.empty((0, 3), dtype=np.float64) self._vel = np.empty((0, 3), dtype=np.float64) self._spin = np.empty((0, 3), dtype=np.float64) self._stype = np.empty(0, dtype=np.int64) + self._ids = np.empty(0, dtype=np.int32) + + self._next_particle_id = 0 def initialize_code(self) -> int: return 0 From 1ff5df9fe1c500663408f87ea1018c49a3d91ce0 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 8 Jun 2026 17:41:18 +0200 Subject: [PATCH 069/132] added id_list logic to commit_particles --- src/amuse_tsunami/interface.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index e93a77b38f..243b0201f7 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -104,7 +104,8 @@ def commit_particles(self) -> int: len(self._mass_list) == N_new and len(self._radius_list) == N_new and len(self._vel_list) == N_new and - len(self._spin_list) == N_new + len(self._spin_list) == N_new and + len(self._id_list) == N_new ): return -1 @@ -115,6 +116,7 @@ def commit_particles(self) -> int: vel = np.empty((N_total, 3), dtype=np.float64) spin = np.empty((N_total, 3), dtype=np.float64) stype = np.ones(N_total, dtype=np.int64) * -1 + ids = np.empty(N_total, dtype=np.int32) # add any existing Tsunami particles if N_existing != 0: @@ -123,6 +125,7 @@ def commit_particles(self) -> int: pos[:N_existing, :] = self._pos vel[:N_existing, :] = self._vel spin[:N_existing, :] = self._spin + ids[:N_existing] = self._ids # add new particles mass[N_existing:] = np.asarray(self._mass_list, dtype=np.float64) @@ -130,6 +133,7 @@ def commit_particles(self) -> int: pos[N_existing:, :] = np.asarray(self._pos_list, dtype=np.float64).reshape(-1, 3) vel[N_existing:, :] = np.asarray(self._vel_list, dtype=np.float64).reshape(-1, 3) spin[N_existing:, :] = np.asarray(self._spin_list, dtype=np.float64).reshape(-1, 3) + ids[N_existing:] = np.asarray(self._id_list, dtype=np.int32) self.tsunami.add_particle_set(pos, vel, mass, radius, stype, spin) @@ -139,7 +143,9 @@ def commit_particles(self) -> int: self._vel = vel self._spin = spin self._stype = stype + self._ids = ids self._clear_temporary_particle_buffers() + self.synchronize_model() return 0 From 2c3cafb3488fb4d8b8888440526c0d82a5235077 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 8 Jun 2026 17:53:19 +0200 Subject: [PATCH 070/132] added sync_masses and radii to synchronize_state --- src/amuse_tsunami/interface.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 243b0201f7..c77356f17d 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -222,6 +222,8 @@ def synchronize_model(self) -> int: Call this function before accessing values to ensure that the returned values are up to date. """ + self.tsunami.sync_masses(self._mass) + self.tsunami.sync_radii(self._radius) self.tsunami.sync_internal_state(self._pos, self._vel, self._spin) return 0 From ce2713e6879e61af00a057a6195a8727878cf4b1 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 8 Jun 2026 17:55:18 +0200 Subject: [PATCH 071/132] refactored new_particle id assignment and def delete_particle --- src/amuse_tsunami/interface.py | 44 +++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index c77356f17d..38351d288c 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -269,7 +269,49 @@ def new_particle( self._vel_list.append([vx, vy, vz]) self._spin_list.append([wx, wy, wz]) - index_of_the_particle.value = len(self._pos_list) - 1 + id = self._get_new_id() + index_of_the_particle.value = id + self._id_list.append(id) + + return 0 + + def delete_particle(self, index_of_the_particle: int) -> int: + """ + Delete a particle in TSUNAMI. + + Parameters + ---------- + index_of_the_particle : int + Particle index as returned by `new_particle`. + + Returns + ------- + 0 : The particle was deleted successfully. + + Raises + ------ + ValueError : + If `index_of_the_particle` is not valid. + ValueError : + If deleting a particle would cause TSUNAMI + to have less than 2 particles. + """ + i = self._get_particle_index_by_id(index_of_the_particle) + + if len(self._pos)-1 < 2: + raise ValueError( + 'TSUNAMI does not support less than 2 particles!' + ) + + self._mass = np.delete(self._mass, i) + self._radius = np.delete(self._radius, i) + self._pos = np.delete(self._pos, i, axis=0) + self._vel = np.delete(self._vel, i, axis=0) + self._spin = np.delete(self._spin, i, axis=0) + self._ids = np.delete(self._ids, i) + + self.tsunami.remove_particle(i) + self.synchronize_model() return 0 From 68e7f96d3d32ecf8d0f6b2517141e7e06dde6ecc Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 8 Jun 2026 17:56:28 +0200 Subject: [PATCH 072/132] def _get_particle_index_by_id, def _get_new_id, def get_number_of_particles --- src/amuse_tsunami/interface.py | 69 ++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 38351d288c..58a74dba5d 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -350,9 +350,7 @@ def get_state( ------ ValueError : If `index_of_the_particle` is not valid. """ - i = index_of_the_particle - self._validate_particle_index(i) - + i = self._get_particle_index_by_id(index_of_the_particle) self.synchronize_model() mass.value = self._mass[i] @@ -366,6 +364,7 @@ def get_state( wx.value = self._spin[i,0] wy.value = self._spin[i,1] wz.value = self._spin[i,2] + return 0 def set_state( @@ -380,6 +379,9 @@ def set_state( """ Set the state of a particle. + TSUNAMI will rescale the positions and velocities + to the center of mass frame. + Parameters ---------- index_of_the_particle : int @@ -403,8 +405,7 @@ def set_state( ------ ValueError : If `index_of_the_particle` is not valid. """ - i = index_of_the_particle - self._validate_particle_index(i) + i = self._get_particle_index_by_id(index_of_the_particle) self._mass[i] = mass self._radius[i] = radius @@ -452,11 +453,12 @@ def get_position( if self._pos.shape[0] == 0: return -1 + i = self._get_particle_index_by_id(index_of_the_particle) self.synchronize_model() - x.value = self._pos[index_of_the_particle, 0] - y.value = self._pos[index_of_the_particle, 1] - z.value = self._pos[index_of_the_particle, 2] + x.value = self._pos[i, 0] + y.value = self._pos[i, 1] + z.value = self._pos[i, 2] return 0 @@ -481,11 +483,11 @@ def set_position( ------ ValueError : If `index_of_the_particle` is not valid. """ - self._validate_particle_index(index_of_the_particle) + i = self._get_particle_index_by_id(index_of_the_particle) - self._pos[index_of_the_particle, 0] = x - self._pos[index_of_the_particle, 1] = y - self._pos[index_of_the_particle, 2] = z + self._pos[i, 0] = x + self._pos[i, 1] = y + self._pos[i, 2] = z self.tsunami.override_position_and_velocities(self._pos, self._vel) @@ -496,7 +498,6 @@ def get_mscale(self, Mscale: ValueHolder) -> int: Get mass unit of Tsunami in MSun. """ Mscale.value = self.tsunami.Mscale - return 0 def get_lscale(self, Lscale: ValueHolder) -> int: @@ -504,7 +505,6 @@ def get_lscale(self, Lscale: ValueHolder) -> int: Get length unit of Tsunami in AU. """ Lscale.value = self.tsunami.Lscale - return 0 def get_tscale(self, Tscale: ValueHolder) -> int: @@ -515,7 +515,6 @@ def get_tscale(self, Tscale: ValueHolder) -> int: This value is read only. """ Tscale.value = self.tsunami.Tscale - return 0 def get_vscale(self, Vscale: ValueHolder) -> int: @@ -526,7 +525,6 @@ def get_vscale(self, Vscale: ValueHolder) -> int: This value is read only. """ Vscale.value = self.tsunami.Vscale - return 0 def get_time(self, time: ValueHolder) -> int: @@ -612,28 +610,49 @@ def set_pn35(self, pn35: bool) -> int: def get_potential_energy(self, potential_energy: ValueHolder) -> int: potential_energy.value = self.tsunami.pot - return 0 def get_kinetic_energy(self, kinetic_energy: ValueHolder) -> int: kinetic_energy.value = self.tsunami.kin - return 0 def get_total_energy(self, total_energy: ValueHolder) -> int: total_energy.value = self.tsunami.energy + return 0 + + def get_number_of_particles(self, number_of_particles: ValueHolder) -> int: + """ + Get total number of particles in TSUNAMI. + + Paramters + --------- + number_of_particles : ValueHolder[int] + ValueHolder instance to return the number of particles in TSUNAMI. + Returns + ------- + 0 : If position was set. + """ + number_of_particles.value = len(self._pos) return 0 - def _validate_particle_index(self, i) -> None: + def _get_particle_index_by_id(self, index_of_the_particle: int) -> int: """ - Validate that the requested particle index - refers to a particle in Tsunami. + Given an amuse particle id as returned by `new_particle`, find the + index of that particle in TSUNAMI. """ - if not 0 <= i < len(self._pos): - raise ValueError( - f'Incorrect index of the particle! Max index: {len(self._pos) - 1}' - ) + idx = np.where(self._ids == index_of_the_particle)[0] + if idx.size == 0: + raise ValueError('Incorrect particle id!') + + return int(idx[0]) + + def _get_new_id(self) -> int: + """Create a unique, monotonically increasing id for `new_particle`.""" + new_id = self._next_particle_id + self._next_particle_id += 1 + + return int(new_id) def _clear_temporary_particle_buffers(self) -> None: """Clear temporary particle buffers after commiting particles""" From 4f6e63235553dd41b0bab00a0b511c69092e3853 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 8 Jun 2026 17:57:19 +0200 Subject: [PATCH 073/132] tsunami tests --- src/amuse_tsunami/tests/test_tsunami.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 234af05fbf..4a1d552619 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -66,6 +66,9 @@ def generate_pythagorean(self): p[0].vx = 0 | ns.speed p[0].vy = 0 | ns.speed p[0].vz = 0 | ns.speed + p[0].wx = 0 | 1 / ns.time + p[0].wy = 0 | 1 / ns.time + p[0].wz = 0 | 1 / ns.time p[1].mass = 4 | ns.mass p[1].radius = 0 | ns.length @@ -75,6 +78,9 @@ def generate_pythagorean(self): p[1].vx = 0 | ns.speed p[1].vy = 0 | ns.speed p[1].vz = 0 | ns.speed + p[1].wx = 0 | 1 / ns.time + p[1].wy = 0 | 1 / ns.time + p[1].wz = 0 | 1 / ns.time p[2].mass = 5 | ns.mass p[2].radius = 0 | ns.length From 6968df1ddfeaf3ed857e5a0b1d85787e99cf9fbb Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 8 Jun 2026 18:58:39 +0200 Subject: [PATCH 074/132] def test_adding_and_deleting_particles, def test_tsunami_pythagorean_triple, def validate_tsunami_state --- src/amuse_tsunami/tests/test_tsunami.py | 133 ++++++++++++++++++------ 1 file changed, 102 insertions(+), 31 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 4a1d552619..7f643eefcc 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -54,8 +54,8 @@ def generate_HD80606b_system(self): return HD80606 - def generate_pythagorean(self): + """Generate 3 particles in a pythagorean triangle configuration.""" p = Particles(3) p[0].mass = 3 | ns.mass @@ -90,54 +90,125 @@ def generate_pythagorean(self): p[2].vx = 0 | ns.speed p[2].vy = 0 | ns.speed p[2].vz = 0 | ns.speed + p[2].wx = 0 | 1 / ns.time + p[2].wy = 0 | 1 / ns.time + p[2].wz = 0 | 1 / ns.time return p - def test_tsunami(self): + def validate_tsunami_state(self, state, particle) -> None: + """ + Validate that a state retrieved by `Tsunami.get_state` + matches the state of `particle`. + + Parameters + ---------- + state : list + List containing the state of the particle, + as returned by `get_state`. + particle : amuse.datamodel.particles.particle + Particle to validate against `state`. + + Raises + ------ + AssertionError : If the states don't match. + """ + self.assertEquals(state[0], particle.mass) + self.assertEquals(state[1], particle.radius) + self.assertEquals(state[2], particle.x) + self.assertEquals(state[3], particle.y) + self.assertEquals(state[4], particle.z) + self.assertEquals(state[5], particle.vx) + self.assertEquals(state[6], particle.vy) + self.assertEquals(state[7], particle.vz) + self.assertEquals(state[8], particle.wx) + self.assertEquals(state[9], particle.wy) + self.assertEquals(state[10], particle.wz) + + def test_add_and_delete_particles(self): + """Test adding and deleting particles in Tsunami.""" system = self.generate_pythagorean() - instance = Tsunami(redirection='none') + instance = self.new_instance_of_an_optional_code(Tsunami) assert instance is not None + instance.particles.add_particles(system) + instance.commit_particles() - print(instance.parameters) + self.assertEquals(instance.get_number_of_particles(), len(system)) - instance.commit_parameters() + state0 = instance.get_state(0) + state1 = instance.get_state(1) + state2 = instance.get_state(2) - instance.particles.add_particles(system) - import matplotlib.pyplot as plt + self.validate_tsunami_state(state0, system[0]) + self.validate_tsunami_state(state1, system[1]) + self.validate_tsunami_state(state2, system[2]) - instance.commit_particles() - channel = instance.particles.new_channel_to(system) + self.assertEquals(system[0].key, instance.particles[0].key) + self.assertEquals(system[1].key, instance.particles[1].key) + self.assertEquals(system[2].key, instance.particles[2].key) - print('ic\n', instance.particles) + instance.particles.remove_particle(system[0]) + self.assertEquals(instance.get_number_of_particles(), len(system)-1) - t_end = 65 | ns.time - dt = 0.1 | ns.time - particles = [] + instance.stop() - while instance.model_time < t_end: - instance.evolve_model(instance.model_time + dt) - channel.copy() - particles.append(system.copy()) - print(instance.model_time) + def test_tsunami_pythagorean_triple(self): + system = self.generate_pythagorean() - colors = ['darkslateblue', 'mediumvioletred', 'c'] - data = [[], [], []] + instance = Tsunami(redirection='none') + assert instance is not None - for p in particles: - for i in range(3): - data[i].append((p[i].x.number, p[i].y.number)) + instance.parameters.pn = False + instance.commit_parameters() - import visualastro as va - with va.style('smplot'): - fig = plt.figure(figsize=(5,8), tight_layout=True) - ax = fig.add_subplot(111) - for i, (color, pts) in enumerate(zip(colors, data)): - xs, ys = zip(*pts) - ax.plot(xs, ys, color=color, linewidth=0.8) + instance.particles.add_particles(system) + instance.commit_particles() - plt.show() + t_end = 65 | ns.time + dt = 0.1 | ns.time + while instance.model_time < t_end: + instance.evolve_model(instance.model_time + dt) + state0 = instance.get_state(0) + state1 = instance.get_state(1) + state2 = instance.get_state(2) + + self.assertEquals(state0[0], 3 | ns.mass) + self.assertEquals(state0[1], 0 | ns.length) + self.assertAlmostRelativeEquals(state0[2], 4.15498855 | ns.length, places=7) + self.assertAlmostRelativeEquals(state0[3], 12.01338805 | ns.length, places=7) + self.assertEquals(state0[4], 0 | ns.length) + self.assertAlmostRelativeEquals(state0[5], 0.59219296 | ns.speed, places=7) + self.assertAlmostRelativeEquals(state0[6], 1.75695995 | ns.speed, places=7) + self.assertEquals(state0[7], 0 | ns.speed) + self.assertEquals(state0[8], 0 | 1 / ns.time) + self.assertEquals(state0[9], 0 | 1 / ns.time) + self.assertEquals(state0[10], 0 | 1 / ns.time) + + self.assertEquals(state1[0], 4 | ns.mass) + self.assertEquals(state1[1], 0 | ns.length) + self.assertAlmostRelativeEquals(state1[2], -0.86025151 | ns.length, places=7) + self.assertAlmostRelativeEquals(state1[3], -4.09450317 | ns.length, places=7) + self.assertEquals(state1[4], 0 | ns.length) + self.assertAlmostRelativeEquals(state1[5], 0.61291976 | ns.speed, places=7) + self.assertAlmostRelativeEquals(state1[6], -0.92151518 | ns.speed, places=7) + self.assertEquals(state1[7], 0 | ns.speed) + self.assertEquals(state1[8], 0 | 1 / ns.time) + self.assertEquals(state1[9], 0 | 1 / ns.time) + self.assertEquals(state1[10], 0 | 1 / ns.time) + + self.assertEquals(state2[0], 5 | ns.mass) + self.assertEquals(state2[1], 0 | ns.length) + self.assertAlmostRelativeEquals(state2[2], -1.80479192 | ns.length, places=7) + self.assertAlmostRelativeEquals(state2[3], -3.9324303 | ns.length, places=7) + self.assertEquals(state2[4], 0 | ns.length) + self.assertAlmostRelativeEquals(state2[5], -0.84565158 | ns.speed, places=7) + self.assertAlmostRelativeEquals(state2[6], -0.31696382 | ns.speed, places=7) + self.assertEquals(state2[7], 0 | ns.speed) + self.assertEquals(state2[8], 0 | 1 / ns.time) + self.assertEquals(state2[9], 0 | 1 / ns.time) + self.assertEquals(state2[10], 0 | 1 / ns.time) instance.stop() From 17e6fdc77dfbaf4c79f3a2957df7a2adf46329a5 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 9 Jun 2026 13:35:05 +0200 Subject: [PATCH 075/132] updated TsunamiImplementation docs --- src/amuse_tsunami/interface.py | 251 ++++++++++++++++++++++++++++----- 1 file changed, 213 insertions(+), 38 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 58a74dba5d..5153a2039e 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -355,15 +355,15 @@ def get_state( mass.value = self._mass[i] radius.value = self._radius[i] - x.value = self._pos[i,0] - y.value = self._pos[i,1] - z.value = self._pos[i,2] - vx.value = self._vel[i,0] - vy.value = self._vel[i,1] - vz.value = self._vel[i,2] - wx.value = self._spin[i,0] - wy.value = self._spin[i,1] - wz.value = self._spin[i,2] + x.value = self._pos[i, 0] + y.value = self._pos[i, 1] + z.value = self._pos[i, 2] + vx.value = self._vel[i, 0] + vy.value = self._vel[i, 1] + vz.value = self._vel[i, 2] + wx.value = self._spin[i, 0] + wy.value = self._spin[i, 1] + wz.value = self._spin[i, 2] return 0 @@ -409,15 +409,15 @@ def set_state( self._mass[i] = mass self._radius[i] = radius - self._pos[i,0] = x - self._pos[i,1] = y - self._pos[i,2] = z - self._vel[i,0] = vx - self._vel[i,1] = vy - self._vel[i,2] = vz - self._spin[i,0] = wx - self._spin[i,1] = wy - self._spin[i,2] = wz + self._pos[i, 0] = x + self._pos[i, 1] = y + self._pos[i, 2] = z + self._vel[i, 0] = vx + self._vel[i, 1] = vy + self._vel[i, 2] = vz + self._spin[i, 0] = wx + self._spin[i, 1] = wy + self._spin[i, 2] = wz self.tsunami.override_masses(self._mass) self.tsunami.override_position_and_velocities(self._pos, self._vel) @@ -537,86 +537,274 @@ def get_time(self, time: ValueHolder) -> int: return 0 def get_alpha(self, alpha: ValueHolder) -> int: + """ + Get alpha regularization parameter. + + Parameters + ---------- + alpha : ValueHolder[float] + ValueHolder instance to return alpha value. + """ alpha.value = self.tsunami.Conf.alpha return 0 def set_alpha(self, alpha: float) -> int: + """ + Set alpha regularization parameter. + + Parameters + ---------- + alpha : float + alpha regularization value. + """ self.tsunami.Conf.alpha = alpha return 0 def get_beta(self, beta: ValueHolder) -> int: + """ + Get beta regularization parameter. + + Parameters + ---------- + beta : ValueHolder[float] + ValueHolder instance to return beta value. + """ beta.value = self.tsunami.Conf.beta return 0 def set_beta(self, beta: float) -> int: + """ + Set beta regularization parameter. + + Parameters + ---------- + beta : float + beta regularization value. + """ self.tsunami.Conf.beta = beta return 0 def get_gamma(self, gamma: ValueHolder) -> int: + """ + Get gamma regularization parameter. + + Parameters + ---------- + gamma : ValueHolder[float] + ValueHolder instance to return gamma value. + """ gamma.value = self.tsunami.Conf.gamma return 0 def set_gamma(self, gamma: float) -> int: + """ + Set gamma regularization parameter. + + Parameters + ---------- + gamma : float + gamma regularization value. + """ self.tsunami.Conf.gamma = gamma return 0 def get_pn(self, pn: ValueHolder) -> int: + """ + Get pn parameter. Enables or disables + post-Newtonian corrections. + + Parameters + ---------- + pn : ValueHolder[bool] + ValueHolder instance to return pn value. If `True`, + enables post-Newtonian corrections. Ensure that `pn1`, + `pn2`, `pn25`, `pn3` or `pn35` is also set. + """ pn.value = self.tsunami.Conf.wPNs return 0 def set_pn(self, pn: bool) -> int: + """ + Set pn parameter. Enables or disables + post-Newtonian corrections. + + Parameters + ---------- + pn : bool + If `True`, enables post-Newtonian corrections. Ensure + that `pn1`, `pn2`, `pn25`, `pn3` or `pn35` is also set. + """ self.tsunami.Conf.wPNs = bool(pn) return 0 def get_pn1(self, pn1: ValueHolder) -> int: + """ + Get pn1 parameter. Enables or disables + post-Newtonian corrections of order 1. + + Parameters + ---------- + pn1 : ValueHolder[bool] + ValueHolder instance to return pn1 value. If `True`, + enables post-Newtonian corrections of order 1. + """ pn1.value = self.tsunami.Conf.pn1 return 0 def set_pn1(self, pn1: bool) -> int: + """ + Set pn1 parameter. Enables or disables + post-Newtonian corrections of order 1. + + Parameters + ---------- + pn1 : bool + If True, enables post-Newtonian corrections of order 1. + """ self.tsunami.Conf.pn1 = bool(pn1) return 0 def get_pn2(self, pn2: ValueHolder) -> int: + """ + Get pn2 parameter. Enables or disables + post-Newtonian corrections of order 2. + + Parameters + ---------- + pn2 : ValueHolder[bool] + ValueHolder instance to return pn2 value. If `True`, + enables post-Newtonian corrections of order 2. + """ pn2.value = self.tsunami.Conf.pn2 return 0 def set_pn2(self, pn2: bool) -> int: + """ + Set pn2 parameter. Enables or disables + post-Newtonian corrections of order 2. + + Parameters + ---------- + pn2 : bool + If True, enables post-Newtonian corrections of order 2. + """ self.tsunami.Conf.pn2 = bool(pn2) return 0 def get_pn25(self, pn25: ValueHolder) -> int: + """ + Get pn25 parameter. Enables or disables + post-Newtonian corrections of order 2.5. + + Parameters + ---------- + pn25 : ValueHolder[bool] + ValueHolder instance to return pn25 value. If `True`, + enables post-Newtonian corrections of order 2.5. + """ pn25.value = self.tsunami.Conf.pn25 return 0 def set_pn25(self, pn25: bool) -> int: + """ + Set pn25 parameter. Enables or disables + post-Newtonian corrections of order 2.5. + + Parameters + ---------- + pn25 : bool + If True, enables post-Newtonian corrections of order 2.5. + """ self.tsunami.Conf.pn25 = bool(pn25) return 0 def get_pn3(self, pn3: ValueHolder) -> int: + """ + Get pn3 parameter. Enables or disables + post-Newtonian corrections of order 3. + + Parameters + ---------- + pn3 : ValueHolder[bool] + ValueHolder instance to return pn3 value. If `True`, + enables post-Newtonian corrections of order 3. + """ pn3.value = self.tsunami.Conf.pn3 return 0 def set_pn3(self, pn3: bool) -> int: + """ + Set pn3 parameter. Enables or disables + post-Newtonian corrections of order 3. + + Parameters + ---------- + pn3 : bool + If True, enables post-Newtonian corrections of order 3. + """ self.tsunami.Conf.pn3 = bool(pn3) return 0 def get_pn35(self, pn35: ValueHolder) -> int: + """ + Get pn35 parameter. Enables or disables + post-Newtonian corrections of order 3.5. + + Parameters + ---------- + pn35 : ValueHolder[bool] + ValueHolder instance to return pn35 value. If `True`, + enables post-Newtonian corrections of order 3.5. + """ pn35.value = self.tsunami.Conf.pn35 return 0 def set_pn35(self, pn35: bool) -> int: + """ + Set pn35 parameter. Enables or disables + post-Newtonian corrections of order 3.5. + + Parameters + ---------- + pn35 : bool + If True, enables post-Newtonian corrections of order 3.5. + """ self.tsunami.Conf.pn35 = bool(pn35) return 0 def get_potential_energy(self, potential_energy: ValueHolder) -> int: + """ + Get total potential energy of the system. This value is read only. + + Parameters + ---------- + potential_energy : ValueHolder[float] + ValueHolder instance to return the potential energy of the system. + """ potential_energy.value = self.tsunami.pot return 0 def get_kinetic_energy(self, kinetic_energy: ValueHolder) -> int: + """ + Get total kinetic energy of the system. This value is read only. + + Parameters + ---------- + kinetic_energy : ValueHolder[float] + ValueHolder instance to return the kinetic energy of the system. + """ kinetic_energy.value = self.tsunami.kin return 0 def get_total_energy(self, total_energy: ValueHolder) -> int: + """ + Get total energy of the system. This value is read only. + + Parameters + ---------- + total_energy : ValueHolder[float] + ValueHolder instance to return the total energy of the system. + """ total_energy.value = self.tsunami.energy return 0 @@ -628,10 +816,6 @@ def get_number_of_particles(self, number_of_particles: ValueHolder) -> int: --------- number_of_particles : ValueHolder[int] ValueHolder instance to return the number of particles in TSUNAMI. - - Returns - ------- - 0 : If position was set. """ number_of_particles.value = len(self._pos) return 0 @@ -640,10 +824,15 @@ def _get_particle_index_by_id(self, index_of_the_particle: int) -> int: """ Given an amuse particle id as returned by `new_particle`, find the index of that particle in TSUNAMI. + + Parameters + ---------- + index_of_the_particle : int + Particle id as returned by `new_particle`. """ idx = np.where(self._ids == index_of_the_particle)[0] if idx.size == 0: - raise ValueError('Incorrect particle id!') + raise ValueError(f'Particle id: {index_of_the_particle} not found!') return int(idx[0]) @@ -655,7 +844,7 @@ def _get_new_id(self) -> int: return int(new_id) def _clear_temporary_particle_buffers(self) -> None: - """Clear temporary particle buffers after commiting particles""" + """Clear temporary particle buffers after commiting particles.""" self._mass_list.clear() self._radius_list.clear() self._pos_list.clear() @@ -725,11 +914,6 @@ def get_time(): @legacy_function def get_state(): - """ - Retrieve the current state of a particle. The *minimal* information of - a stellar dynamics particle (mass, radius, position and velocity) is - returned. - """ function = LegacyFunctionSpecification() function.can_handle_array = True function.addParameter('index_of_the_particle', dtype='i', direction=function.IN) @@ -739,18 +923,11 @@ def get_state(): function.result_doc = """ 0 - OK particle was removed from the model - -1 - ERROR - particle could not be found """ return function @legacy_function def set_state(): - """ - Update the current state of a particle. The *minimal* information of a - stellar dynamics particle (mass, radius, position and velocity) is - updated. - """ function = LegacyFunctionSpecification() function.can_handle_array = True function.addParameter('index_of_the_particle', dtype='i', direction=function.IN) @@ -760,8 +937,6 @@ def set_state(): function.result_doc = """ 0 - OK particle was found in the model and the information was set - -1 - ERROR - particle could not be found """ return function From ca7db86d400157400e8e7984151a921d09eb665f Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 9 Jun 2026 14:07:21 +0200 Subject: [PATCH 076/132] def get/set_spin tsunami --- src/amuse_tsunami/interface.py | 151 +++++++++++++++++++++++++++++++-- 1 file changed, 143 insertions(+), 8 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 5153a2039e..193e48f09e 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -215,9 +215,12 @@ def evolve_model_dtmax(self, time: float) -> int: def synchronize_model(self) -> int: """ - Synchronize TsunamiImplementation with TSUNAMI. - This ensures that the current particle state in - AMUSE matches the current state of TSUNAMI. + Synchronize AMUSE with TSUNAMI. This ensures that + the current particle state in AMUSE matches the + current state of TSUNAMI. + + Synchronizes the masses, radii, positions, velocities, + and spins of the system. Call this function before accessing values to ensure that the returned values are up to date. @@ -444,7 +447,7 @@ def get_position( Returns ------- - 0 : If position was set. + 0 : Position was retrieved successfully. Raises ------ @@ -477,7 +480,7 @@ def set_position( Returns ------- - 0 : If position was set. + 0 : Position was set. Raises ------ @@ -493,6 +496,73 @@ def set_position( return 0 + def get_spin( + self, + index_of_the_particle: int, + wx: ValueHolder, + wy: ValueHolder, + wz: ValueHolder + ) -> int: + """ + Retrieve the spin of a particle. + + Parameters + ---------- + index_of_the_particle : int + Particle index as returned by `new_particle`. + wx, wy, wz : ValueHolder[float] + ValueHolder instance to return the spin + of the particle. + + Returns + ------- + 0 : Spin was retrieved. + + Raises + ------ + ValueError : If `index_of_the_particle` is not valid. + """ + if self._pos.shape[0] == 0: + return -1 + + i = self._get_particle_index_by_id(index_of_the_particle) + self.synchronize_model() + + wx.value = self._spin[i, 0] + wy.value = self._spin[i, 1] + wz.value = self._spin[i, 2] + + return 0 + + def set_spin( + self, index_of_the_particle: int, wx: float, wy: float, wz: float + ) -> int: + """ + Set the spin of a particle. + + Parameters + ---------- + index_of_the_particle : int + Particle index as returned by `new_particle`. + wx, wy, wz : float + Particle spin. + + Returns + ------- + 0 : If spin was set. + + Raises + ------ + ValueError : If `index_of_the_particle` is not valid. + """ + i = self._get_particle_index_by_id(index_of_the_particle) + + self._spin[i, 0] = wx + self._spin[i, 1] = wy + self._spin[i, 2] = wz + + return 0 + def get_mscale(self, Mscale: ValueHolder) -> int: """ Get mass unit of Tsunami in MSun. @@ -894,8 +964,6 @@ def new_particle(): function.result_doc = """ 0 - OK particle was added to Tsunami - -1 - ERROR - particle could not be added """ return function @@ -922,7 +990,7 @@ def get_state(): function.result_type = 'i' function.result_doc = """ 0 - OK - particle was removed from the model + particle state was retrieved """ return function @@ -940,6 +1008,42 @@ def set_state(): """ return function + @legacy_function + def get_spin(): + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter('index_of_the_particle', dtype='i', direction=function.IN) + for name in ['wx', 'wy', 'wz']: + function.addParameter(name, dtype='d', direction=function.OUT) + function.result_type = 'i' + function.result_doc = """ + 0 - OK + particle was found in the model and the information was retrieved + """ + return function + + @legacy_function + def set_spin(): + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter('index_of_the_particle', dtype='i', direction=function.IN) + for name in ['wx', 'wy', 'wz']: + function.addParameter(name, dtype='d', direction=function.IN) + function.result_type = 'i' + function.result_doc = """ + 0 - OK + particle was found in the model and the information was retrieved + """ + return function + + @remote_function + def get_equilibrium_tides(): + returns (equilibrium_tides='b') + + @remote_function + def set_equilibrium_tides(equilibrium_tides='b'): + returns () + @remote_function def get_alpha(): returns (alpha='d') @@ -1102,6 +1206,37 @@ def define_methods(self, handler): (handler.ERROR_CODE,) ) + handler.add_method( + 'get_spin', + (handler.INDEX,), + ( + 1 / ns.time, + 1 / ns.time, + 1 / ns.time, + handler.ERROR_CODE + ) + ) + + handler.add_method( + 'set_spin', + ( + handler.INDEX, + 1 / ns.time, + 1 / ns.time, + 1 / ns.time, + ), + (handler.ERROR_CODE,) + ) + + handler.add_method( + 'get_total_energy', + (), + ( + ns.mass * ns.length**2 * ns.time**-2, + handler.ERROR_CODE, + ), + ) + def define_parameters(self, handler): """Define model parameters. From fb7613c373ec38cf5af90b3fa08ed0df327e55cc Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 9 Jun 2026 14:07:41 +0200 Subject: [PATCH 077/132] def get/set_equilibrium_tides --- src/amuse_tsunami/interface.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 193e48f09e..ac4ad6809d 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -606,6 +606,32 @@ def get_time(self, time: ValueHolder) -> int: time.value = self.tsunami.time return 0 + def get_equilibrium_tides(self, equilibrium_tides: ValueHolder) -> int: + """ + Get equilibrium tides parameter. Enables or disables equilibrium tides. + + Parameters + ---------- + equilibrium_tides : ValueHolder[bool] + ValueHolder instance to return equilibrium tides value. + If `True`, enables equilibrium tides. + """ + equilibrium_tides.value = self.tsunami.Conf.wEqTides + return 0 + + def set_equilibrium_tides(self, equilibrium_tides: bool) -> int: + """ + Set equilibrium tides parameter. Enables or disables equilibrium tides. + + Parameters + ---------- + equilibrium_tides : ValueHolder[bool] + ValueHolder instance to return equilibrium tides value. + If `True`, enables equilibrium tides. + """ + self.tsunami.Conf.wEqTides = bool(equilibrium_tides) + return 0 + def get_alpha(self, alpha: ValueHolder) -> int: """ Get alpha regularization parameter. @@ -1244,6 +1270,14 @@ def define_parameters(self, handler): and a name, description and default value. Functions with the appropriate names must be defined in the native wrapper code. """ + handler.add_method_parameter( + 'get_equilibrium_tides', + 'set_equilibrium_tides', + 'equilibrium_tides', + 'enable equilibrium tides.', + default_value=False + ) + handler.add_method_parameter( 'get_alpha', 'set_alpha', From b5351157817f2154f4950f19a7a0fc83c1266804 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 9 Jun 2026 14:08:03 +0200 Subject: [PATCH 078/132] added more properties to tsunami --- src/amuse_tsunami/interface.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index ac4ad6809d..7216fafe0f 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1178,14 +1178,15 @@ def define_state(self, handler): GravityFieldCode.define_state(self, handler) def define_properties(self, handler): + """Define properties of the code. These are read-only!""" + GravitationalDynamics.define_properties(self, handler) + handler.add_property('get_kinetic_energy', public_name='potential_energy') + handler.add_property('get_potential_energy', public_name='kinetic_energy') + handler.add_property('get_total_energy', public_name='total_energy') handler.add_property('get_time', public_name='model_time') def define_methods(self, handler): - """ - Map legacy functions in TsunamiInterface into - Tsunami user methods. - """ - + """Map legacy functions in TsunamiInterface into Tsunami user methods.""" GravitationalDynamics.define_methods(self, handler) handler.add_method( From f747ec09d46fb0397305478f1d3b1059b653dbd5 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 9 Jun 2026 14:19:53 +0200 Subject: [PATCH 079/132] cleaned up id logic in tsunamiImplementation --- src/amuse_tsunami/interface.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 7216fafe0f..880f0ff37d 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -31,25 +31,27 @@ def __init__(self): self.tsunami = tsunami.Tsunami(1, 1) # temporary buffers for staging particles + self._id_list: list[int] = [] self._mass_list: list[float] = [] self._radius_list: list[float] = [] self._pos_list: list[list[float]] = [] self._vel_list: list[list[float]] = [] self._spin_list: list[list[float]] = [] - self._id_list: list[int] = [] # commited particle arrays + self._ids = np.empty(0, dtype=np.int32) self._mass = np.empty(0, dtype=np.float64) self._radius = np.empty(0, dtype=np.float64) self._pos = np.empty((0, 3), dtype=np.float64) self._vel = np.empty((0, 3), dtype=np.float64) self._spin = np.empty((0, 3), dtype=np.float64) self._stype = np.empty(0, dtype=np.int64) - self._ids = np.empty(0, dtype=np.int32) self._next_particle_id = 0 def initialize_code(self) -> int: + """Disable any TSUNAMI features that are not needed in AMUSE.""" + self.tsunami.Conf.wExt = False return 0 def cleanup_code(self) -> int: @@ -101,49 +103,49 @@ def commit_particles(self) -> int: ) if not ( + len(self._id_list) == N_new and len(self._mass_list) == N_new and len(self._radius_list) == N_new and len(self._vel_list) == N_new and - len(self._spin_list) == N_new and - len(self._id_list) == N_new + len(self._spin_list) == N_new ): return -1 # preallocate particleset for Tsunami + ids = np.empty(N_total, dtype=np.int32) mass = np.empty(N_total, dtype=np.float64) radius = np.empty(N_total, dtype=np.float64) pos = np.empty((N_total, 3), dtype=np.float64) vel = np.empty((N_total, 3), dtype=np.float64) spin = np.empty((N_total, 3), dtype=np.float64) stype = np.ones(N_total, dtype=np.int64) * -1 - ids = np.empty(N_total, dtype=np.int32) # add any existing Tsunami particles if N_existing != 0: + ids[:N_existing] = self._ids mass[:N_existing] = self._mass radius[:N_existing] = self._radius pos[:N_existing, :] = self._pos vel[:N_existing, :] = self._vel spin[:N_existing, :] = self._spin - ids[:N_existing] = self._ids # add new particles + ids[N_existing:] = np.asarray(self._id_list, dtype=np.int32) mass[N_existing:] = np.asarray(self._mass_list, dtype=np.float64) radius[N_existing:] = np.asarray(self._radius_list, dtype=np.float64) pos[N_existing:, :] = np.asarray(self._pos_list, dtype=np.float64).reshape(-1, 3) vel[N_existing:, :] = np.asarray(self._vel_list, dtype=np.float64).reshape(-1, 3) spin[N_existing:, :] = np.asarray(self._spin_list, dtype=np.float64).reshape(-1, 3) - ids[N_existing:] = np.asarray(self._id_list, dtype=np.int32) self.tsunami.add_particle_set(pos, vel, mass, radius, stype, spin) + self._ids = ids self._mass = mass self._radius = radius self._pos = pos self._vel = vel self._spin = spin self._stype = stype - self._ids = ids self._clear_temporary_particle_buffers() self.synchronize_model() @@ -306,12 +308,12 @@ def delete_particle(self, index_of_the_particle: int) -> int: 'TSUNAMI does not support less than 2 particles!' ) + self._ids = np.delete(self._ids, i) self._mass = np.delete(self._mass, i) self._radius = np.delete(self._radius, i) self._pos = np.delete(self._pos, i, axis=0) self._vel = np.delete(self._vel, i, axis=0) self._spin = np.delete(self._spin, i, axis=0) - self._ids = np.delete(self._ids, i) self.tsunami.remove_particle(i) self.synchronize_model() @@ -941,6 +943,7 @@ def _get_new_id(self) -> int: def _clear_temporary_particle_buffers(self) -> None: """Clear temporary particle buffers after commiting particles.""" + self._id_list.clear() self._mass_list.clear() self._radius_list.clear() self._pos_list.clear() From e82aa4b9e841ce08ce3fefaffbf9749ade6ec9bb Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 9 Jun 2026 14:20:15 +0200 Subject: [PATCH 080/132] cleaned up interface --- src/amuse_tsunami/interface.py | 44 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 880f0ff37d..7afb56d222 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -599,15 +599,6 @@ def get_vscale(self, Vscale: ValueHolder) -> int: Vscale.value = self.tsunami.Vscale return 0 - def get_time(self, time: ValueHolder) -> int: - """ - Get current model time. - - tsunami.time returns time in N-body units. - """ - time.value = self.tsunami.time - return 0 - def get_equilibrium_tides(self, equilibrium_tides: ValueHolder) -> int: """ Get equilibrium tides parameter. Enables or disables equilibrium tides. @@ -906,6 +897,15 @@ def get_total_energy(self, total_energy: ValueHolder) -> int: total_energy.value = self.tsunami.energy return 0 + def get_time(self, time: ValueHolder) -> int: + """ + Get current model time. + + tsunami.time returns time in N-body units. + """ + time.value = self.tsunami.time + return 0 + def get_number_of_particles(self, number_of_particles: ValueHolder) -> int: """ Get total number of particles in TSUNAMI. @@ -996,19 +996,6 @@ def new_particle(): """ return function - @legacy_function - def get_time(): - function = LegacyFunctionSpecification() - function.addParameter('time', dtype='d', direction=function.OUT) - function.result_type = 'i' - function.result_doc = """ - 0 - OK - System was evolved to time - -1 - ERROR - Requested time is <= current model time - """ - return function - @legacy_function def get_state(): function = LegacyFunctionSpecification() @@ -1065,6 +1052,19 @@ def set_spin(): """ return function + @legacy_function + def get_time(): + function = LegacyFunctionSpecification() + function.addParameter('time', dtype='d', direction=function.OUT) + function.result_type = 'i' + function.result_doc = """ + 0 - OK + System was evolved to time + -1 - ERROR + Requested time is <= current model time + """ + return function + @remote_function def get_equilibrium_tides(): returns (equilibrium_tides='b') From 1fbe3a06bbcd0f91da1f8dca1f4953484793291a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 9 Jun 2026 14:20:31 +0200 Subject: [PATCH 081/132] def get/set_dynamical_tides --- src/amuse_tsunami/interface.py | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 7afb56d222..b31cf28d3b 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -625,6 +625,32 @@ def set_equilibrium_tides(self, equilibrium_tides: bool) -> int: self.tsunami.Conf.wEqTides = bool(equilibrium_tides) return 0 + def get_dynamical_tides(self, dynamical_tides: ValueHolder) -> int: + """ + Get dynamical tides parameter. Enables or disables dynamical tides. + + Parameters + ---------- + dynamical_tides : ValueHolder[bool] + ValueHolder instance to return dynamical tides value. + If `True`, enables dynamical tides. + """ + dynamical_tides.value = self.tsunami.Conf.wEqTides + return 0 + + def set_dynamical_tides(self, dynamical_tides: bool) -> int: + """ + Set dynamical tides parameter. Enables or disables dynamical tides. + + Parameters + ---------- + dynamical_tides : ValueHolder[bool] + ValueHolder instance to return dynamical tides value. + If `True`, enables dynamical tides. + """ + self.tsunami.Conf.wEqTides = bool(dynamical_tides) + return 0 + def get_alpha(self, alpha: ValueHolder) -> int: """ Get alpha regularization parameter. @@ -1073,6 +1099,14 @@ def get_equilibrium_tides(): def set_equilibrium_tides(equilibrium_tides='b'): returns () + @remote_function + def get_dynamical_tides(): + returns (dynamical_tides='b') + + @remote_function + def set_dynamical_tides(dynamical_tides='b'): + returns () + @remote_function def get_alpha(): returns (alpha='d') @@ -1282,6 +1316,14 @@ def define_parameters(self, handler): default_value=False ) + handler.add_method_parameter( + 'get_dynamical_tides', + 'set_dynamical_tides', + 'dynamical_tides', + 'enable dynamical tides.', + default_value=False + ) + handler.add_method_parameter( 'get_alpha', 'set_alpha', From 87087a80ca39172f6178490462772bb7165dcd4c Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 12 Jun 2026 16:14:04 +0200 Subject: [PATCH 082/132] refactored commit_particles and delete_particle in tsunami -> now only rescales to cdm frame during commit_particles and recommit_particles but not new_particle or delete_particle --- src/amuse_tsunami/interface.py | 44 ++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index b31cf28d3b..c19b859ca9 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -137,6 +137,7 @@ def commit_particles(self) -> int: vel[N_existing:, :] = np.asarray(self._vel_list, dtype=np.float64).reshape(-1, 3) spin[N_existing:, :] = np.asarray(self._spin_list, dtype=np.float64).reshape(-1, 3) + self.tsunami.reallocate_arrays(N_total) self.tsunami.add_particle_set(pos, vel, mass, radius, stype, spin) self._ids = ids @@ -315,11 +316,50 @@ def delete_particle(self, index_of_the_particle: int) -> int: self._vel = np.delete(self._vel, i, axis=0) self._spin = np.delete(self._spin, i, axis=0) - self.tsunami.remove_particle(i) - self.synchronize_model() + print('delete_particle\n') return 0 + # def delete_particle2(self, index_of_the_particle: int) -> int: + # """ + # Delete a particle in TSUNAMI. + + # Parameters + # ---------- + # index_of_the_particle : int + # Particle index as returned by `new_particle`. + + # Returns + # ------- + # 0 : The particle was deleted successfully. + + # Raises + # ------ + # ValueError : + # If `index_of_the_particle` is not valid. + # ValueError : + # If deleting a particle would cause TSUNAMI + # to have less than 2 particles. + # """ + # i = self._get_particle_index_by_id(index_of_the_particle) + + # if len(self._pos)-1 < 2: + # raise ValueError( + # 'TSUNAMI does not support less than 2 particles!' + # ) + + # self._ids = np.delete(self._ids, i) + # self._mass = np.delete(self._mass, i) + # self._radius = np.delete(self._radius, i) + # self._pos = np.delete(self._pos, i, axis=0) + # self._vel = np.delete(self._vel, i, axis=0) + # self._spin = np.delete(self._spin, i, axis=0) + + # self.tsunami.remove_particle(i) + # self.synchronize_model() + + # return 0 + def get_state( self, index_of_the_particle: int, From a5f8fbce7c8d7f0f059f8c0e36034214abbcd5a6 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 12 Jun 2026 16:14:49 +0200 Subject: [PATCH 083/132] def get/set_mass and velocity --- src/amuse_tsunami/interface.py | 95 ++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 3 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index c19b859ca9..4a690e0ed5 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -469,6 +469,29 @@ def set_state( return 0 + def get_mass( + self, + index_of_the_particle: int, + mass: ValueHolder + ) -> int: + i = self._get_particle_index_by_id(index_of_the_particle) + self.synchronize_model() + + mass.value = self._mass[i] + return 0 + + def set_mass( + self, + index_of_the_particle: int, + mass: float + ) -> int: + i = self._get_particle_index_by_id(index_of_the_particle) + + self._mass[i] = mass + self.tsunami.override_masses(self._mass) + + return 0 + def get_position( self, index_of_the_particle: int, @@ -495,9 +518,6 @@ def get_position( ------ ValueError : If `index_of_the_particle` is not valid. """ - if self._pos.shape[0] == 0: - return -1 - i = self._get_particle_index_by_id(index_of_the_particle) self.synchronize_model() @@ -538,6 +558,75 @@ def set_position( return 0 + def get_velocity( + self, + index_of_the_particle: int, + vx: ValueHolder, + vy: ValueHolder, + vz: ValueHolder + ) -> int: + """ + Retrieve the velocity of a particle. + + Parameters + ---------- + index_of_the_particle : int + Particle index as returned by `new_particle`. + vx, vy, vz : ValueHolder[float] + ValueHolder instance to return the velocity + of the particle. + + Returns + ------- + 0 : velocity was retrieved successfully. + + Raises + ------ + ValueError : If `index_of_the_particle` is not valid. + """ + if self._pos.shape[0] == 0: + return -1 + + i = self._get_particle_index_by_id(index_of_the_particle) + self.synchronize_model() + + vx.value = self._vel[i, 0] + vy.value = self._vel[i, 1] + vz.value = self._vel[i, 2] + + return 0 + + def set_velocity( + self, index_of_the_particle: int, vx: float, vy: float, vz: float + ) -> int: + """ + Set the velocity of a particle. Ensure to update its mass first! + + Parameters + ---------- + index_of_the_particle : int + Particle index as returned by `new_particle`. + vx, vy, vz : float + Particle velocity. + + Returns + ------- + 0 : velocity was set. + + Raises + ------ + ValueError : If `index_of_the_particle` is not valid. + """ + i = self._get_particle_index_by_id(index_of_the_particle) + + self._vel[i, 0] = vx + self._vel[i, 1] = vy + self._vel[i, 2] = vz + + self.tsunami.override_position_and_velocities(self._pos, self._vel) + + return 0 + def get_spin( self, index_of_the_particle: int, From 5bddaee3875d27623dcc46f72651e6c085886646 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 12 Jun 2026 16:15:16 +0200 Subject: [PATCH 084/132] rename tsunami parameters --- src/amuse_tsunami/interface.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 4a690e0ed5..45d07eadb4 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1440,7 +1440,7 @@ def define_parameters(self, handler): handler.add_method_parameter( 'get_equilibrium_tides', 'set_equilibrium_tides', - 'equilibrium_tides', + 'wEqTides', 'enable equilibrium tides.', default_value=False ) @@ -1448,7 +1448,7 @@ def define_parameters(self, handler): handler.add_method_parameter( 'get_dynamical_tides', 'set_dynamical_tides', - 'dynamical_tides', + 'wDynTides', 'enable dynamical tides.', default_value=False ) @@ -1480,7 +1480,7 @@ def define_parameters(self, handler): handler.add_method_parameter( 'get_pn', 'set_pn', - 'pn', + 'wPNs', 'enable post newtonian corrections', default_value=False ) From 8d4e7259e8a0add8350ab2da00882210b0bcc35a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 12 Jun 2026 16:17:47 +0200 Subject: [PATCH 085/132] add speed of light property tsunami --- src/amuse_tsunami/interface.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 45d07eadb4..c51a877b39 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -728,6 +728,10 @@ def get_vscale(self, Vscale: ValueHolder) -> int: Vscale.value = self.tsunami.Vscale return 0 + def get_speed_of_light(self, speed_of_light: ValueHolder) -> int: + speed_of_light.value = self.tsunami.speed_of_light + return 0 + def get_equilibrium_tides(self, equilibrium_tides: ValueHolder) -> int: """ Get equilibrium tides parameter. Enables or disables equilibrium tides. @@ -1207,6 +1211,10 @@ def set_spin(): """ return function + @remote_function + def get_speed_of_light(): + returns (speed_of_light='d') + @legacy_function def get_time(): function = LegacyFunctionSpecification() @@ -1350,6 +1358,7 @@ def define_properties(self, handler): handler.add_property('get_potential_energy', public_name='kinetic_energy') handler.add_property('get_total_energy', public_name='total_energy') handler.add_property('get_time', public_name='model_time') + handler.add_property('get_speed_of_light', public_name='speed_of_light') def define_methods(self, handler): """Map legacy functions in TsunamiInterface into Tsunami user methods.""" From 59eb4782185e9e9ca335c5e5bf3e7a9759fafea9 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 15 Jun 2026 17:24:51 +0200 Subject: [PATCH 086/132] TsunamiInterface tests --- src/amuse_tsunami/tests/test_tsunami.py | 146 +++++++++++++++++++++++- 1 file changed, 142 insertions(+), 4 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 7f643eefcc..34eecc7e8d 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -1,15 +1,153 @@ +from matplotlib.axes import Axes +import matplotlib.pyplot as plt +import numpy as np +import tsunami + from amuse.datamodel import Particle, Particles from amuse.ext.orbital_elements import generate_binaries from amuse.support.testing.amusetest import TestWithMPI from amuse_tsunami.interface import TsunamiInterface, Tsunami from amuse.units import constants as c, nbody_system as ns, units as u -# class TestTsunamiInterface(TestWithMPI): +# if True, show comparison plots for certain tests +show_plots = False + +class TestTsunamiInterface(TestWithMPI): + + def test_initialization(self): + """ + Test Tsunami initialization. + """ + instance = self.new_instance_of_an_optional_code(TsunamiInterface) + assert instance is not None + + self.assertEquals(0, instance.initialize_code()) + self.assertEquals(0, instance.commit_parameters()) + self.assertEquals(0, instance.cleanup_code()) + instance.stop() + + def test_setters_and_getters(self): + """ + Test TsunamiInterface setters and getters. + """ + # instance = self.new_instance_of_an_optional_code(TsunamiInterface, redirection='none') + instance = TsunamiInterface(redirection='none') + assert instance is not None + + self.assertEquals(0, instance.initialize_code()) + self.assertEquals(0, instance.commit_parameters()) + + result = instance.get_number_of_particles() + self.assertEquals(result['number_of_particles'], 0) -# def test_echo_int(self): -# instance = TsunamiInterface() + result = instance.new_particle(3,0,1,3,0,0,0,0,0,0,0) + self.assertEquals(result['index_of_the_particle'], 0) -# instance.stop() + result = instance.new_particle(4,0,-2,-1,0,0,0,0,1,1,1) + self.assertEquals(result['index_of_the_particle'], 1) + + result = instance.new_particle(5,0,1,-1,0,0,0,0,0,0,0) + self.assertEquals(result['index_of_the_particle'], 2) + + instance.commit_particles() + result = instance.get_number_of_particles() + self.assertEquals(result['number_of_particles'], 3) + + result = instance.get_state(0) + self.assertEquals(result['mass'], 3.0) + self.assertEquals(result['radius'], 0.0) + self.assertEquals(result['x'], 1.0) + self.assertEquals(result['y'], 3.0) + self.assertEquals(result['z'], 0.0) + self.assertEquals(result['vx'], 0.0) + self.assertEquals(result['vy'], 0.0) + self.assertEquals(result['vz'], 0.0) + self.assertEquals(result['wx'], 0.0) + self.assertEquals(result['wy'], 0.0) + self.assertEquals(result['wz'], 0.0) + + result = instance.get_state(1) + self.assertEquals(result['mass'], 4) + self.assertEquals(result['radius'], 0) + self.assertEquals(result['x'], -2) + self.assertEquals(result['y'], -1) + self.assertEquals(result['z'], 0) + self.assertEquals(result['vx'], 0) + self.assertEquals(result['vy'], 0) + self.assertEquals(result['vz'], 0) + self.assertEquals(result['wx'], 1) + self.assertEquals(result['wy'], 1) + self.assertEquals(result['wz'], 1) + + result = instance.get_state(2) + self.assertEquals(result['mass'], 5) + self.assertEquals(result['radius'], 0) + self.assertEquals(result['x'], 1) + self.assertEquals(result['y'], -1) + self.assertEquals(result['z'], 0) + self.assertEquals(result['vx'], 0) + self.assertEquals(result['vy'], 0) + self.assertEquals(result['vz'], 0) + self.assertEquals(result['wx'], 0) + self.assertEquals(result['wy'], 0) + self.assertEquals(result['wz'], 0) + + instance.set_mass(0, 1.5) + self.assertEquals(instance.get_mass(0)['mass'], 1.5) + + instance.set_position(0, 2.5, 3.5, 4.5) + result = instance.get_position(0) + self.assertEquals(result['x'], 2.5) + self.assertEquals(result['y'], 3.5) + self.assertEquals(result['z'], 4.5) + + instance.set_velocity(0, 5.5, 6.5, 7.5) + result = instance.get_velocity(0) + self.assertEquals(result['vx'], 5.5) + self.assertEquals(result['vy'], 6.5) + self.assertEquals(result['vz'], 7.5) + + result = instance.get_radius(0) + self.assertEquals(result['radius'], 0) + + result = instance.get_spin(1) + self.assertEquals(result['wx'], 1) + self.assertEquals(result['wy'], 1) + self.assertEquals(result['wz'], 1) + + instance.delete_particle(0) + instance.recommit_particles() + result = instance.get_number_of_particles() + self.assertEquals(result['number_of_particles'], 2) + + result = instance.get_state(1) + self.assertEquals(result['mass'], 4) + self.assertEquals(result['radius'], 0) + self.assertEquals(result['x'], -2) + self.assertEquals(result['y'], -1) + self.assertEquals(result['z'], 0) + self.assertEquals(result['vx'], 0) + self.assertEquals(result['vy'], 0) + self.assertEquals(result['vz'], 0) + self.assertEquals(result['wx'], 1) + self.assertEquals(result['wy'], 1) + self.assertEquals(result['wz'], 1) + + result = instance.get_state(2) + self.assertEquals(result['mass'], 5) + self.assertEquals(result['radius'], 0) + self.assertEquals(result['x'], 1) + self.assertEquals(result['y'], -1) + self.assertEquals(result['z'], 0) + self.assertEquals(result['vx'], 0) + self.assertEquals(result['vy'], 0) + self.assertEquals(result['vz'], 0) + self.assertEquals(result['wx'], 0) + self.assertEquals(result['wy'], 0) + self.assertEquals(result['wz'], 0) + + self.assertEquals(0, instance.cleanup_code()) + instance.stop() class TestTsunami(TestWithMPI): From 125d5434956d456e91f8a85b6d16d3e9a3fd4a75 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 15 Jun 2026 17:25:24 +0200 Subject: [PATCH 087/132] TestTsunami validation methods --- src/amuse_tsunami/tests/test_tsunami.py | 44 +++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 34eecc7e8d..06dd1b5d42 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -234,10 +234,10 @@ def generate_pythagorean(self): return p - def validate_tsunami_state(self, state, particle) -> None: + def validate_tsunami_state_equality(self, state: list, particle: Particle) -> None: """ Validate that a state retrieved by `Tsunami.get_state` - matches the state of `particle`. + matches the state of `particle` exactly. Parameters ---------- @@ -263,6 +263,46 @@ def validate_tsunami_state(self, state, particle) -> None: self.assertEquals(state[9], particle.wy) self.assertEquals(state[10], particle.wz) + + def validate_tsunami_state_relative_equality( + self, + state: list, + particle: Particle, + places: int = 7 + ) -> None: + """ + Validate that a state retrieved via `Tsunami.get_state` matches + the corresponding attributes of `particle`, within relative tolerance. + + Parameters + ---------- + state : list + State vector as returned by `get_state`, ordered as + [mass, radius, x, y, z, vx, vy, vz, wx, wy, wz]. + particle : amuse.datamodel.particles.Particle + Particle instance whose attributes are compared against `state`. + places : int, optional, default=7 + Number of decimal places of relative precision required for equality. + + Raises + ------ + AssertionError + If any corresponding value in `state` and `particle` does not match + within `places` relative precision. + + """ + self.assertAlmostRelativeEquals(state[0], particle.mass, places=places) + self.assertAlmostRelativeEquals(state[1], particle.radius, places=places) + self.assertAlmostRelativeEquals(state[2], particle.x, places=places) + self.assertAlmostRelativeEquals(state[3], particle.y, places=places) + self.assertAlmostRelativeEquals(state[4], particle.z, places=places) + self.assertAlmostRelativeEquals(state[5], particle.vx, places=places) + self.assertAlmostRelativeEquals(state[6], particle.vy, places=places) + self.assertAlmostRelativeEquals(state[7], particle.vz, places=places) + self.assertAlmostRelativeEquals(state[8], particle.wx, places=places) + self.assertAlmostRelativeEquals(state[9], particle.wy, places=places) + self.assertAlmostRelativeEquals(state[10], particle.wz, places=places) + def test_add_and_delete_particles(self): """Test adding and deleting particles in Tsunami.""" system = self.generate_pythagorean() From fb6ff5ac60938bb7f118f07eb8d1c66a13899372 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 15 Jun 2026 17:26:17 +0200 Subject: [PATCH 088/132] fixed test_tsunami_pythagoran_triangle --- src/amuse_tsunami/tests/test_tsunami.py | 29 ++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 06dd1b5d42..7d9a2ff092 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -319,9 +319,9 @@ def test_add_and_delete_particles(self): state1 = instance.get_state(1) state2 = instance.get_state(2) - self.validate_tsunami_state(state0, system[0]) - self.validate_tsunami_state(state1, system[1]) - self.validate_tsunami_state(state2, system[2]) + self.validate_tsunami_state_equality(state0, system[0]) + self.validate_tsunami_state_equality(state1, system[1]) + self.validate_tsunami_state_equality(state2, system[2]) self.assertEquals(system[0].key, instance.particles[0].key) self.assertEquals(system[1].key, instance.particles[1].key) @@ -330,15 +330,27 @@ def test_add_and_delete_particles(self): instance.particles.remove_particle(system[0]) self.assertEquals(instance.get_number_of_particles(), len(system)-1) + state1 = instance.get_state(1) + state2 = instance.get_state(2) + + self.validate_tsunami_state_equality(state1, system[1]) + self.validate_tsunami_state_equality(state2, system[2]) + instance.stop() def test_tsunami_pythagorean_triple(self): + """ + Test identical to `test_tsunami.py` from the TSUNAMI package. + Simulation results should be identical to standalone TSUNAMI. + """ system = self.generate_pythagorean() - instance = Tsunami(redirection='none') + instance = self.new_instance_of_an_optional_code(Tsunami, redirection='none') assert instance is not None - instance.parameters.pn = False + instance.parameters.wPNs = False + instance.parameters.wEqTides = False + instance.parameters.wDynTides = False instance.commit_parameters() instance.particles.add_particles(system) @@ -349,10 +361,17 @@ def test_tsunami_pythagorean_triple(self): while instance.model_time < t_end: instance.evolve_model(instance.model_time + dt) + # validate energies + self.assertAlmostRelativeEquals(instance.potential_energy.number, 22.461771188652676) + self.assertAlmostRelativeEquals(instance.kinetic_energy.number, 9.645104521979146) + self.assertAlmostRelativeEquals(instance.deltaE, 3.055333763768898e-13) + + self.assertAlmostRelativeEquals(instance.model_time, t_end, places=2) state0 = instance.get_state(0) state1 = instance.get_state(1) state2 = instance.get_state(2) + # compare with standalone TSUNAMI simulation results self.assertEquals(state0[0], 3 | ns.mass) self.assertEquals(state0[1], 0 | ns.length) self.assertAlmostRelativeEquals(state0[2], 4.15498855 | ns.length, places=7) From 741637db2b0c65709c9edb5a153213386677231e Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 15 Jun 2026 17:27:06 +0200 Subject: [PATCH 089/132] def test_delete_particle_and_restart and test_tsunami_does_not_rescale_to_com_frame as well as plots --- src/amuse_tsunami/tests/test_tsunami.py | 236 ++++++++++++++++++++++++ 1 file changed, 236 insertions(+) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 7d9a2ff092..92b7f1bf5a 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -409,3 +409,239 @@ def test_tsunami_pythagorean_triple(self): self.assertEquals(state2[10], 0 | 1 / ns.time) instance.stop() + + def test_delete_particle_and_restart(self): + """ + This test simulates a pythagorean triangle system + identical to `test_tsunami_pythagorean_triangle`, + but instead of evolving to time t=65, it first evolves + to time t=30, then deletes a particle, then adds it back + in before finishing the integration to t=65. + Both this test and `test_tsunami_pythagorean_triangle` + should agree. Due to integration differences, the results + of the two different simulations differ by more than 1 decimal + point, and the states are not compared in this test. + Set `show_plots=True` at the top of the test file to show the + comparison plot. + """ + system = self.generate_pythagorean() + + instance = self.new_instance_of_an_optional_code(Tsunami, redirection='none') + assert instance is not None + + instance.parameters.wPNs = False + instance.parameters.wEqTides = False + instance.parameters.wDynTides = False + instance.commit_parameters() + + instance.particles.add_particles(system) + channel = instance.particles.new_channel_to(system) + instance.commit_particles() + + particles = [] + + t_midpoint = 30 | ns.time + dt = 0.1 | ns.time + while instance.model_time < t_midpoint: + instance.evolve_model(instance.model_time + dt) + channel.copy() + particles.append(system.copy()) + + self.assertAlmostRelativeEquals(instance.model_time, t_midpoint, places=2) + + # save original state after evolving to t=30 + pars = instance.particles.copy() + + # remove particle 0 + instance.particles.remove_particle(instance.particles[0]) + self.assertEquals(instance.get_number_of_particles(), 2) + + # add 'particle 0' back in + instance.particles.add_particle(pars[0]) + instance.recommit_particles() + self.assertEquals(instance.get_number_of_particles(), 3) + + # check that new starting state is the same as t=30 state before deleting + # particle 0 now has id=3 because ids are unique and increasing monotonically + state0 = instance.get_state(3) + state1 = instance.get_state(1) + state2 = instance.get_state(2) + self.validate_tsunami_state_relative_equality(state0, pars[0], places=10) + self.validate_tsunami_state_relative_equality(state1, pars[1], places=10) + self.validate_tsunami_state_relative_equality(state2, pars[2], places=10) + + t_end = 65 | ns.time + dt = 0.1 | ns.time + while instance.model_time < t_end: + instance.evolve_model(instance.model_time + dt) + channel.copy() + particles.append(system.copy()) + + self.assertAlmostRelativeEquals(instance.model_time, t_end, places=2) + + if show_plots: + colors = ['#483d8b', '#d81b60', '#dbb0ff'] + ax = self.plot_particles_xy( + particles, colors=colors, labels=['star1', 'star2', 'star3'] + ) + self.plot_tsunami_pythagorean_triangle(ax) + ax.legend(edgecolor='w') + plt.show() + + instance.stop() + + def test_tsunami_does_not_rescale_to_com_frame(self): + """ + By default Tsunami will rescale a system to its center + of mass frame. Test that this behavior is turned off. + """ + p = Particles(3) + p.mass = [1,4,8] | ns.mass + p.radius = [1,1,2] | ns.length + p.position = [[0,1,2],[3,4,5],[6,7,8]] | ns.length + p.velocity = [[6,7,8],[9,10,11],[12,13,14]] | ns.speed + p.wx = [12,15,19] | 1 / ns.time + p.wy = [13,16,20] | 1 / ns.time + p.wz = [14,17,21] | 1 / ns.time + + instance = self.new_instance_of_an_optional_code(Tsunami, redirection='none') + instance.particles.add_particles(p) + instance.commit_particles() + + state0 = instance.get_state(0) + state1 = instance.get_state(1) + state2 = instance.get_state(2) + + self.validate_tsunami_state_equality(state0, p[0]) + self.validate_tsunami_state_equality(state1, p[1]) + self.validate_tsunami_state_equality(state2, p[2]) + + instance.delete_particle(1) + + state0 = instance.get_state(0) + state2 = instance.get_state(2) + self.validate_tsunami_state_relative_equality(state0, p[0]) + self.validate_tsunami_state_relative_equality(state2, p[2]) + + instance.stop() + + + def test_pns(self): + def setup_binary(a=0.1, e=0.99, m1=50.0, m2=50.0, nu=0.0, pn1=True, pn2=True): + i = ome = Ome = 0.0 # rad + pos_vel2 = np.array([0.,0.,0., 0.,0.,0.]) + + print("\nGenerating binary") + + print("kepl_to_cart corrections:\n PN1 = {}\n PN2 = {}".format(pn1, pn2)) + + pos_vel1 = keplutils.kepl_to_cart(pos_vel2, m1, m2, a, e, i, ome, Ome, nu, pn1=pn1, pn2=pn2) + + m = np.array([m1, m2]) + p = np.array([pos_vel1[:3], pos_vel2[:3]]) + v = np.array([pos_vel1[3:], pos_vel2[3:]]) + + return m, p, v + keplutils = tsunami.KeplerUtils() + instance = self.new_instance_of_an_optional_code(Tsunami, redirection='none') + assert instance is not None + + instance.parameters.wPNs = True + + + def plot_particles_xy( + self, + particles: list[Particles], + colors: list[str], + labels: list[str] | None = None, + figsize: tuple[float, float] = (6,6) + ) -> Axes: + """ + Plot the xy position of a list of `Particles`. + + Parameters + ---------- + particles : list[Particles] + List of `amuse.datamodel.particles.Particles`, where each `Particles` + in the list is a simulation snapshot containing each `Particle` in the system. + colors : list[ColorType] + List of colors for each particle. Should have same length as the number of particles + in the system. + labels : list[str] + Label for each particle. Should have same length as the number of particles + in the system. + figsize : tuple[float, float] + Size of the figure. + """ + data = [[], [], []] + + for p in particles: + for i in range(len(p)): + data[i].append((p[i].x.number, p[i].y.number)) + + fig = plt.figure(figsize=figsize, tight_layout=True) + ax = fig.add_subplot(111) + ax.set_aspect('equal') + ax.minorticks_on() + ax.tick_params( + axis='both', length=2, direction='in', + which='both', right=True, top=True + ) + + for i, (color, pts) in enumerate(zip(colors, data)): + xs, ys = zip(*pts) + l = None if labels is None else labels[i] + ax.plot(xs, ys, color=color, linewidth=0.8, label=l) + + ax.set_xlabel('x') + ax.set_ylabel('y') + + return ax + + def plot_tsunami_pythagorean_triangle(self, ax: Axes) -> None: + """ + Plot `test_tsunami.py` from the standalone TSUNAMI package. + """ + import tsunami + code = tsunami.Tsunami(1.0, 1.0) + + code.Conf.wPNs = False + code.Conf.wEqTides = False + code.Conf.wDynTides = False + code.Conf.wExt = False + + code.Conf.dcoll = 0.0 + + m = np.array([3., 4., 5.]) + p = np.array([[1.,3.,0.], [-2.,-1.,0.], [1.,-1.,0.]]) + v = np.array([[0.,0.,0.], [0.,0.,0.], [0.,0.,0.]]) + R = np.array([0., 0., 0.]) + sp = np.array([[0.,0.,0.], [0.,0.,0.], [0.,0.,0.]]) + st = np.array([-1, -1, -1]) + code.add_particle_set(p, v, m, R, st, sp) + + code.sync_internal_state(p, v, sp) + totp = [p.copy()] + + dt = 0.1 + ft = 65 + + time = 0 + while time < ft: + time = time + dt + + code.evolve_system(time) + time = code.time + code.sync_internal_state(p, v, sp) + + totp.append(p.copy()) + + totp = np.vstack(totp) + code.sync_masses(m) + code.sync_radii(R) + + colors = ['#26dcba', '#7d7ff3', '#cfe23c'] + + ax.plot(totp[::3,0], totp[::3,1], lw=0.8, ls='--', color=colors[0], label='star1 tsunami') + ax.plot(totp[1::3,0], totp[1::3,1], lw=0.8, ls='--', color=colors[1], label='star2 tsunami') + ax.plot(totp[2::3,0], totp[2::3,1], lw=0.8, ls='--', color=colors[2], label='star3 tsunami') From d22ce032a834e8e8fd1806785ffcbe36f0c8a0b2 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 15 Jun 2026 17:29:39 +0200 Subject: [PATCH 090/132] fixed delete_particle method and commit_particles --- src/amuse_tsunami/interface.py | 54 +++++++--------------------------- 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index c51a877b39..d52f02b5ca 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -50,8 +50,14 @@ def __init__(self): self._next_particle_id = 0 def initialize_code(self) -> int: - """Disable any TSUNAMI features that are not needed in AMUSE.""" - self.tsunami.Conf.wExt = False + """ + Disable any TSUNAMI features that are not needed in AMUSE. + + Tsunami by default will recenter the system to its center of mass + frame by subtracting it. External forces must be set to `True` so + that Tsunami adds the center of mass back into the system. + """ + self.tsunami.Conf.wExt = True return 0 def cleanup_code(self) -> int: @@ -137,7 +143,6 @@ def commit_particles(self) -> int: vel[N_existing:, :] = np.asarray(self._vel_list, dtype=np.float64).reshape(-1, 3) spin[N_existing:, :] = np.asarray(self._spin_list, dtype=np.float64).reshape(-1, 3) - self.tsunami.reallocate_arrays(N_total) self.tsunami.add_particle_set(pos, vel, mass, radius, stype, spin) self._ids = ids @@ -316,50 +321,11 @@ def delete_particle(self, index_of_the_particle: int) -> int: self._vel = np.delete(self._vel, i, axis=0) self._spin = np.delete(self._spin, i, axis=0) - print('delete_particle\n') + self.tsunami.remove_particle(i) + self.synchronize_model() return 0 - # def delete_particle2(self, index_of_the_particle: int) -> int: - # """ - # Delete a particle in TSUNAMI. - - # Parameters - # ---------- - # index_of_the_particle : int - # Particle index as returned by `new_particle`. - - # Returns - # ------- - # 0 : The particle was deleted successfully. - - # Raises - # ------ - # ValueError : - # If `index_of_the_particle` is not valid. - # ValueError : - # If deleting a particle would cause TSUNAMI - # to have less than 2 particles. - # """ - # i = self._get_particle_index_by_id(index_of_the_particle) - - # if len(self._pos)-1 < 2: - # raise ValueError( - # 'TSUNAMI does not support less than 2 particles!' - # ) - - # self._ids = np.delete(self._ids, i) - # self._mass = np.delete(self._mass, i) - # self._radius = np.delete(self._radius, i) - # self._pos = np.delete(self._pos, i, axis=0) - # self._vel = np.delete(self._vel, i, axis=0) - # self._spin = np.delete(self._spin, i, axis=0) - - # self.tsunami.remove_particle(i) - # self.synchronize_model() - - # return 0 - def get_state( self, index_of_the_particle: int, From 2c141752486e70eaf85a46da9fa767e92e20440b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 7 Jul 2026 13:26:15 +0200 Subject: [PATCH 091/132] fix imports in Tsunami --- src/amuse/community/tsunami/__init__.py | 2 +- src/amuse_tsunami/__init__.py | 2 +- src/amuse_tsunami/interface.py | 35 +++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/amuse/community/tsunami/__init__.py b/src/amuse/community/tsunami/__init__.py index c6e1df9a04..eed8878a60 100644 --- a/src/amuse/community/tsunami/__init__.py +++ b/src/amuse/community/tsunami/__init__.py @@ -1 +1 @@ -from .interface import Tsunami +from amuse.community.tsunami.interface import Tsunami diff --git a/src/amuse_tsunami/__init__.py b/src/amuse_tsunami/__init__.py index eed8878a60..37693c6876 100644 --- a/src/amuse_tsunami/__init__.py +++ b/src/amuse_tsunami/__init__.py @@ -1 +1 @@ -from amuse.community.tsunami.interface import Tsunami +from amuse_tsunami.interface import Tsunami diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index d52f02b5ca..19b87fd83b 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -440,6 +440,23 @@ def get_mass( index_of_the_particle: int, mass: ValueHolder ) -> int: + """ + Retrieve the mass of a particle. + + Parameters + ---------- + index_of_the_particle : int + Particle index as returned by `new_particle`. + mass : ValueHolder[float] + ValueHolder instance to return the mass value. + Returns + ------- + 0 : Mass was retrieved successfully. + + Raises + ------ + ValueError : If `index_of_the_particle` is not valid. + """ i = self._get_particle_index_by_id(index_of_the_particle) self.synchronize_model() @@ -451,6 +468,24 @@ def set_mass( index_of_the_particle: int, mass: float ) -> int: + """ + Set the mass of a particle. + + Parameters + ---------- + index_of_the_particle : int + Particle index as returned by `new_particle`. + mass : float + Particle mass. + + Returns + ------- + 0 : Mass was retrieved successfully. + + Raises + ------ + ValueError : If `index_of_the_particle` is not valid. + """ i = self._get_particle_index_by_id(index_of_the_particle) self._mass[i] = mass From f313311c0c35bd5185aa57b283e3196ce51acb35 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 7 Jul 2026 13:28:09 +0200 Subject: [PATCH 092/132] rename packages/amuse-tsunami/tsunami -> packages/amuse-tsunami/amuse_tsunami --- .../packages/amuse-tsunami/{tsunami => amuse_tsunami} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/amuse_tsunami/packages/amuse-tsunami/{tsunami => amuse_tsunami} (100%) diff --git a/src/amuse_tsunami/packages/amuse-tsunami/tsunami b/src/amuse_tsunami/packages/amuse-tsunami/amuse_tsunami similarity index 100% rename from src/amuse_tsunami/packages/amuse-tsunami/tsunami rename to src/amuse_tsunami/packages/amuse-tsunami/amuse_tsunami From 406e6cfbd24d206ccb622e7a94ae54bc717c9453 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 16:09:45 +0200 Subject: [PATCH 093/132] update tsunami imports --- src/amuse_tsunami/interface.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 19b87fd83b..84f38813da 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1,17 +1,13 @@ import numpy as np import tsunami -from amuse.community.interface.common import CommonCode, CommonCodeInterface +from amuse.community.interface.common import CommonCode from amuse.community.interface.gd import ( GravitationalDynamics, GravitationalDynamicsInterface, GravityFieldCode, GravityFieldInterface ) -from amuse.community.interface.stopping_conditions import ( - StoppingConditions, - StoppingConditionInterface -) from amuse.rfi.core import ( LegacyFunctionSpecification, PythonCodeInterface, @@ -19,9 +15,10 @@ remote_function ) from amuse.rfi.python_code import ValueHolder -from amuse.support.interface import InCodeComponentImplementation from amuse.support.literature import LiteratureReferencesMixIn -from amuse.units import nbody_system as ns +from amuse.units import ( + generic_unit_system, nbody_system as ns, units as u +) class TsunamiImplementation(object): From 3ce7f62176141e13487fa45dc2db8698566aad80 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 16:11:41 +0200 Subject: [PATCH 094/132] def get_radius --- src/amuse_tsunami/interface.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 84f38813da..20742069ea 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -490,6 +490,35 @@ def set_mass( return 0 + def get_radius( + self, + index_of_the_particle: int, + radius: ValueHolder + ) -> int: + """ + Retrieve the radius of a particle. + + Parameters + ---------- + index_of_the_particle : int + Particle index as returned by `new_particle`. + radius : ValueHolder[float] + ValueHolder instance to return the radius value. + + Returns + ------- + 0 : Radius was retrieved successfully. + + Raises + ------ + ValueError : If `index_of_the_particle` is not valid. + """ + i = self._get_particle_index_by_id(index_of_the_particle) + self.synchronize_model() + + radius.value = self._radius[i] + return 0 + def get_position( self, index_of_the_particle: int, From 81210d0002ce4503d9e80640cfbe0c1ea6d81f61 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 16:12:46 +0200 Subject: [PATCH 095/132] rm set_spin, cleanup getters --- src/amuse_tsunami/interface.py | 45 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 20742069ea..308891d31d 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -692,50 +692,35 @@ def get_spin( return 0 - def set_spin( - self, index_of_the_particle: int, wx: float, wy: float, wz: float - ) -> int: + def set_units(self, Mscale: float, Lscale: float) -> int: """ - Set the spin of a particle. + Set the mass and length scale of Tsunami. Parameters ---------- - index_of_the_particle : int - Particle index as returned by `new_particle`. - wx, wy, wz : float - Particle spin. - - Returns - ------- - 0 : If spin was set. - - Raises - ------ - ValueError : If `index_of_the_particle` is not valid. + Mscale : float + Mass scale of Tsunami in MSun. + Lscale : float + Length scale of Tsunami in AU. """ - i = self._get_particle_index_by_id(index_of_the_particle) - - self._spin[i, 0] = wx - self._spin[i, 1] = wy - self._spin[i, 2] = wz - + self.tsunami.set_units(float(Mscale), float(Lscale)) return 0 - def get_mscale(self, Mscale: ValueHolder) -> int: + def get_Mscale(self, Mscale: ValueHolder) -> int: """ Get mass unit of Tsunami in MSun. """ Mscale.value = self.tsunami.Mscale return 0 - def get_lscale(self, Lscale: ValueHolder) -> int: + def get_Lscale(self, Lscale: ValueHolder) -> int: """ Get length unit of Tsunami in AU. """ Lscale.value = self.tsunami.Lscale return 0 - def get_tscale(self, Tscale: ValueHolder) -> int: + def get_Tscale(self, Tscale: ValueHolder) -> int: """ Get time unit of Tsunami in years. Derived from Mscale, Lscale, and G=1. @@ -745,7 +730,7 @@ def get_tscale(self, Tscale: ValueHolder) -> int: Tscale.value = self.tsunami.Tscale return 0 - def get_vscale(self, Vscale: ValueHolder) -> int: + def get_Vscale(self, Vscale: ValueHolder) -> int: """ Get velocity unit of Tsunami in km/s. Derived from Mscale, Lscale, and G=1. @@ -756,6 +741,14 @@ def get_vscale(self, Vscale: ValueHolder) -> int: return 0 def get_speed_of_light(self, speed_of_light: ValueHolder) -> int: + """ + Get Tsunami speed of light in N-body units. + + Parameters + ---------- + speed_of_light : ValueHolder[float] + ValueHolder instance to return the speed of light value. + """ speed_of_light.value = self.tsunami.speed_of_light return 0 From c0f5a1c20044edd0f4d1dcb14d15ab350f0e55a7 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 16:13:20 +0200 Subject: [PATCH 096/132] clean up remote function getters and setters --- src/amuse_tsunami/interface.py | 75 ++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 308891d31d..e5a3817131 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1064,16 +1064,17 @@ def get_kinetic_energy(self, kinetic_energy: ValueHolder) -> int: kinetic_energy.value = self.tsunami.kin return 0 - def get_total_energy(self, total_energy: ValueHolder) -> int: + def get_deltaE(self, deltaE: ValueHolder) -> int: """ - Get total energy of the system. This value is read only. + Get fractional energy error `deltaE = (E - E0) / E0` excluding energy losses + due to dissipative terms (tides, post-Newtonians, external potentials) Parameters ---------- - total_energy : ValueHolder[float] - ValueHolder instance to return the total energy of the system. + deltaE : ValueHolder[float] + ValueHolder instance to return the fraction energy error value. """ - total_energy.value = self.tsunami.energy + deltaE.value = self.tsunami.deltaE return 0 def get_time(self, time: ValueHolder) -> int: @@ -1203,38 +1204,18 @@ def set_state(): """ return function - @legacy_function - def get_spin(): - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter('index_of_the_particle', dtype='i', direction=function.IN) - for name in ['wx', 'wy', 'wz']: - function.addParameter(name, dtype='d', direction=function.OUT) - function.result_type = 'i' - function.result_doc = """ - 0 - OK - particle was found in the model and the information was retrieved - """ - return function - - @legacy_function - def set_spin(): - function = LegacyFunctionSpecification() - function.can_handle_array = True - function.addParameter('index_of_the_particle', dtype='i', direction=function.IN) - for name in ['wx', 'wy', 'wz']: - function.addParameter(name, dtype='d', direction=function.IN) - function.result_type = 'i' - function.result_doc = """ - 0 - OK - particle was found in the model and the information was retrieved - """ - return function + @remote_function(can_handle_array=True) + def get_spin(index_of_the_particle='i'): + returns (wx='d', wy='d', wz='d') @remote_function def get_speed_of_light(): returns (speed_of_light='d') + @remote_function + def get_deltaE(): + returns (deltaE='d') + @legacy_function def get_time(): function = LegacyFunctionSpecification() @@ -1336,15 +1317,37 @@ def get_pn35(): def set_pn35(pn35='b'): returns () + @remote_function + def set_units(Mscale='d', Lscale='d'): + returns () + + @remote_function + def use_physical_units(use_physical_units='b'): + returns () + + @remote_function + def get_Mscale(): + returns (Mscale='d') + + @remote_function + def get_Lscale(): + returns (Lscale='d') + + @remote_function + def get_Tscale(): + returns (Tscale='d') + + @remote_function + def get_Vscale(): + returns (Vscale='d') + + class Tsunami(GravitationalDynamics, GravityFieldCode, CommonCode): - """One line description of this code + """ - Some more details about what it does, any special features it has beyond the - standard interfaces, and anything else the user needs to know. """ def __init__(self, convert_nbody=None, **options): """Create a Tsunami instance to run simulations with.""" - super().__init__(self, TsunamiInterface(**options), **options) legacy_interface = TsunamiInterface(**options) From a4de752a26131a94476de36418d1960ecbc2ae4b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 16:13:50 +0200 Subject: [PATCH 097/132] added converter logic to convert physical units to nbody in Tsunami __init__ --- src/amuse_tsunami/interface.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index e5a3817131..bc1fe07ff0 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1358,16 +1358,11 @@ def __init__(self, convert_nbody=None, **options): **options ) - # the following alternative __init__ is appropiate for codes that use an unspecified - # unit system (i.e. the quantities have dimension but no definite scale) - # - # def __init__(self, unit_converter=None, **options): - # self.unit_converter = unit_converter - # super().__init__(self, tsunamiInterface(**options), **options) - # - # in this case you also need to use the define_converter below - - # typically the high level specification also contains the following: + if convert_nbody is not None: + M_s = convert_nbody.to_si(1 | generic_unit_system.mass).value_in(u.MSun) + L_s = convert_nbody.to_si(1 | generic_unit_system.length).value_in(u.AU) + self.set_units(M_s, L_s) + def define_state(self, handler): """Define the state model of the code.""" From 025f8fbe0100df42443ef4a8adaa3e1bd8428de0 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 16:14:19 +0200 Subject: [PATCH 098/132] added more properties of the code --- src/amuse_tsunami/interface.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index bc1fe07ff0..0033348a17 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1372,10 +1372,15 @@ def define_state(self, handler): def define_properties(self, handler): """Define properties of the code. These are read-only!""" GravitationalDynamics.define_properties(self, handler) - handler.add_property('get_kinetic_energy', public_name='potential_energy') - handler.add_property('get_potential_energy', public_name='kinetic_energy') + handler.add_property('get_kinetic_energy', public_name='kinetic_energy') + handler.add_property('get_potential_energy', public_name='potential_energy') handler.add_property('get_total_energy', public_name='total_energy') + handler.add_property('get_deltaE', public_name='deltaE') handler.add_property('get_time', public_name='model_time') + handler.add_property('get_Mscale', public_name='Mscale') + handler.add_property('get_Lscale', public_name='Lscale') + handler.add_property('get_Tscale', public_name='Tscale') + handler.add_property('get_Vscale', public_name='Vscale') handler.add_property('get_speed_of_light', public_name='speed_of_light') def define_methods(self, handler): From 0bd75382806b1637141f31729ceb09f25f4606d9 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 16:15:11 +0200 Subject: [PATCH 099/132] cleaned up methods in Tsunami --- src/amuse_tsunami/interface.py | 35 +++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 0033348a17..db37ad8452 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1432,36 +1432,45 @@ def define_methods(self, handler): ) handler.add_method( - 'get_spin', + 'get_velocity', (handler.INDEX,), ( - 1 / ns.time, - 1 / ns.time, - 1 / ns.time, - handler.ERROR_CODE + ns.speed, + ns.speed, + ns.speed, + handler.ERROR_CODE, ) ) handler.add_method( - 'set_spin', + 'set_velocity', ( handler.INDEX, + ns.speed, + ns.speed, + ns.speed, + ), + (handler.ERROR_CODE,) + ) + + handler.add_method( + 'get_spin', + (handler.INDEX,), + ( 1 / ns.time, 1 / ns.time, 1 / ns.time, - ), - (handler.ERROR_CODE,) + handler.ERROR_CODE + ) ) handler.add_method( - 'get_total_energy', + 'get_speed_of_light', (), - ( - ns.mass * ns.length**2 * ns.time**-2, - handler.ERROR_CODE, - ), + (ns.speed, handler.ERROR_CODE) ) + def define_parameters(self, handler): """Define model parameters. From 8004c4a529a99f4a239727a893dfcc4791d825a8 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 16:17:41 +0200 Subject: [PATCH 100/132] cleaned up tsunami interface.py --- src/amuse_tsunami/interface.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index db37ad8452..d512940409 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1147,8 +1147,6 @@ class TsunamiInterface( corresponding request from the Python part of AMUSE. """ - # include_headers = ['tsunami_worker.h', 'stopcond.h'] - def __init__(self, **kwargs): PythonCodeInterface.__init__( self, @@ -1369,6 +1367,7 @@ def define_state(self, handler): GravitationalDynamics.define_state(self, handler) GravityFieldCode.define_state(self, handler) + def define_properties(self, handler): """Define properties of the code. These are read-only!""" GravitationalDynamics.define_properties(self, handler) @@ -1383,6 +1382,7 @@ def define_properties(self, handler): handler.add_property('get_Vscale', public_name='Vscale') handler.add_property('get_speed_of_light', public_name='speed_of_light') + def define_methods(self, handler): """Map legacy functions in TsunamiInterface into Tsunami user methods.""" GravitationalDynamics.define_methods(self, handler) @@ -1579,6 +1579,7 @@ def define_particle_sets(self, handler): # handler.add_setter('particles', 'set_mass') # handler.add_getter('particles', 'get_mass', names=('mass',)) + def define_converter(self, handler): """Handle unit conversion if an (optional) unit converter is specified.""" if self.unit_converter is not None: From a52b042bb7fd88e3a5830dcc909a24fa47dec101 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 16:40:17 +0200 Subject: [PATCH 101/132] clean up tsunami interface.py --- src/amuse_tsunami/interface.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index d512940409..014bbaa0ed 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1137,14 +1137,10 @@ class TsunamiInterface( LiteratureReferencesMixIn, ): """ - Description of the interface with the community code. + Tsunami is a direct few-body code with algorithmic regularization, + tidal forces and post-Newtonian corrections. - This class describes a set of functions in C++ or Fortran that are part of the AMUSE - wrapper of the community code. These functions in turn will call functions in the - community code, or update variables in it directly. - - These functions will be called by the worker program when it receives the - corresponding request from the Python part of AMUSE. + .. [#] ADS:2023IAUS..362..404T (Trani, A. A. & Spera, M., 2023, IAUS, 362, 404) """ def __init__(self, **kwargs): @@ -1342,7 +1338,8 @@ def get_Vscale(): class Tsunami(GravitationalDynamics, GravityFieldCode, CommonCode): """ - + Tsunami is a direct few-body code with algorithmic regularization, + tidal forces and post-Newtonian corrections. """ def __init__(self, convert_nbody=None, **options): """Create a Tsunami instance to run simulations with.""" @@ -1571,13 +1568,6 @@ def define_parameters(self, handler): def define_particle_sets(self, handler): """Define any particle sets inside the model.""" GravitationalDynamics.define_particle_sets(self, handler) - # handler.define_set('particles', 'index_of_the_particle') - # handler.set_new('particles', 'new_particle') - # handler.set_delete('particles', 'delete_particle') - # handler.add_setter('particles', 'set_state') - # handler.add_getter('particles', 'get_state') - # handler.add_setter('particles', 'set_mass') - # handler.add_getter('particles', 'get_mass', names=('mass',)) def define_converter(self, handler): From b87ab5840ce1f474491020d673a92e08c04e60e2 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 17:05:26 +0200 Subject: [PATCH 102/132] rm use_physical_units remote fn --- src/amuse_tsunami/interface.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 014bbaa0ed..7123668ca7 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1315,10 +1315,6 @@ def set_pn35(pn35='b'): def set_units(Mscale='d', Lscale='d'): returns () - @remote_function - def use_physical_units(use_physical_units='b'): - returns () - @remote_function def get_Mscale(): returns (Mscale='d') From 5cb679c364cf88afd4ec84becc8fdf04dadd2307 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 17:05:53 +0200 Subject: [PATCH 103/132] cleaned up test_setters_and_getters --- src/amuse_tsunami/tests/test_tsunami.py | 52 ++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 92b7f1bf5a..eb473ab1ba 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -30,11 +30,59 @@ def test_setters_and_getters(self): """ Test TsunamiInterface setters and getters. """ - # instance = self.new_instance_of_an_optional_code(TsunamiInterface, redirection='none') - instance = TsunamiInterface(redirection='none') + instance = self.new_instance_of_an_optional_code(TsunamiInterface) assert instance is not None self.assertEquals(0, instance.initialize_code()) + + instance.set_units(2, 2) + self.assertEquals(instance.get_Mscale()['Mscale'], 2) + self.assertEquals(instance.get_Lscale()['Lscale'], 2) + self.assertAlmostRelativeEquals( + instance.get_Vscale()['Vscale'], 29.78469182967693 + ) + self.assertAlmostRelativeEquals( + instance.get_Tscale()['Tscale'], 0.31831589802181726 + ) + self.assertAlmostRelativeEquals( + instance.get_speed_of_light()['speed_of_light'], + 10065.320121972596 + ) + + instance.set_equilibrium_tides(True) + self.assertEquals( + instance.get_equilibrium_tides()['equilibrium_tides'], + True + ) + + instance.set_dynamical_tides(True) + self.assertEquals( + instance.get_dynamical_tides()['dynamical_tides'], + True + ) + + instance.set_alpha(2) + self.assertEquals(instance.get_alpha()['alpha'], 2) + instance.set_beta(2) + self.assertEquals(instance.get_beta()['beta'], 2) + instance.set_gamma(2) + self.assertEquals(instance.get_gamma()['gamma'], 2) + + instance.set_pn(True) + self.assertEquals(instance.get_pn()['pn'], True) + instance.set_pn1(True) + self.assertEquals(instance.get_pn1()['pn1'], True) + instance.set_pn2(True) + self.assertEquals(instance.get_pn2()['pn2'], True) + instance.set_pn25(True) + self.assertEquals(instance.get_pn25()['pn25'], True) + instance.set_pn3(True) + self.assertEquals(instance.get_pn3()['pn3'], True) + instance.set_pn35(True) + self.assertEquals(instance.get_pn35()['pn35'], True) + + instance.set_units(1, 1) + self.assertEquals(0, instance.commit_parameters()) result = instance.get_number_of_particles() From 26765558e0149f5c726b4fabe313edb34f2e0ea5 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 17:06:18 +0200 Subject: [PATCH 104/132] cleaned up test_setters_and_getters --- src/amuse_tsunami/tests/test_tsunami.py | 35 ++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index eb473ab1ba..641ada33b5 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -143,6 +143,8 @@ def test_setters_and_getters(self): instance.set_mass(0, 1.5) self.assertEquals(instance.get_mass(0)['mass'], 1.5) + self.assertEquals(instance.get_radius(0)['radius'], 0.0) + instance.set_position(0, 2.5, 3.5, 4.5) result = instance.get_position(0) self.assertEquals(result['x'], 2.5) @@ -155,9 +157,6 @@ def test_setters_and_getters(self): self.assertEquals(result['vy'], 6.5) self.assertEquals(result['vz'], 7.5) - result = instance.get_radius(0) - self.assertEquals(result['radius'], 0) - result = instance.get_spin(1) self.assertEquals(result['wx'], 1) self.assertEquals(result['wy'], 1) @@ -194,6 +193,36 @@ def test_setters_and_getters(self): self.assertEquals(result['wy'], 0) self.assertEquals(result['wz'], 0) + instance.set_state( + 1, + 5, 5, + 5, 5, 5, + 5, 5, 5, + 5, 5, 5 + ) + result = instance.get_state(1) + self.assertEquals(result['mass'], 5) + self.assertEquals(result['x'], 5) + self.assertEquals(result['y'], 5) + self.assertEquals(result['z'], 5) + self.assertEquals(result['vx'], 5) + self.assertEquals(result['vy'], 5) + self.assertEquals(result['vz'], 5) + + # check that this is still the same + result = instance.get_state(2) + self.assertEquals(result['mass'], 5) + self.assertEquals(result['radius'], 0) + self.assertEquals(result['x'], 1) + self.assertEquals(result['y'], -1) + self.assertEquals(result['z'], 0) + self.assertEquals(result['vx'], 0) + self.assertEquals(result['vy'], 0) + self.assertEquals(result['vz'], 0) + self.assertEquals(result['wx'], 0) + self.assertEquals(result['wy'], 0) + self.assertEquals(result['wz'], 0) + self.assertEquals(0, instance.cleanup_code()) instance.stop() From 94f7234f47b43e7a7b9988548f3573eef35087eb Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 17:17:53 +0200 Subject: [PATCH 105/132] cleanup Tsunami tests --- src/amuse_tsunami/tests/test_tsunami.py | 103 ++++++++++++++++++++---- 1 file changed, 86 insertions(+), 17 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 641ada33b5..2dfaf8b2a1 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -366,7 +366,6 @@ def validate_tsunami_state_relative_equality( AssertionError If any corresponding value in `state` and `particle` does not match within `places` relative precision. - """ self.assertAlmostRelativeEquals(state[0], particle.mass, places=places) self.assertAlmostRelativeEquals(state[1], particle.radius, places=places) @@ -600,30 +599,96 @@ def test_tsunami_does_not_rescale_to_com_frame(self): self.validate_tsunami_state_relative_equality(state0, p[0]) self.validate_tsunami_state_relative_equality(state2, p[2]) - instance.stop() - + instance.set_mass(0, 4 | ns.mass) + instance.set_position(0, 67 | ns.length, 68 | ns.length, 69 | ns.length) + instance.set_velocity(2, 67 | ns.speed, 68 | ns.speed, 69 | ns.speed) - def test_pns(self): - def setup_binary(a=0.1, e=0.99, m1=50.0, m2=50.0, nu=0.0, pn1=True, pn2=True): - i = ome = Ome = 0.0 # rad - pos_vel2 = np.array([0.,0.,0., 0.,0.,0.]) + self.assertEquals(instance.get_mass(0), 4 | ns.mass) + self.assertEquals( + instance.get_position(0), + [67 | ns.length, 68 | ns.length, 69 | ns.length] + ) + self.assertEquals( + instance.get_velocity(2), + [67 | ns.speed, 68 | ns.speed, 69 | ns.speed] + ) + p3 = Particle( + mass=1 | ns.mass, + radius=100 | ns.length, + position=[89,90,91] | ns.length, + velocity=[92,93,94] | ns.speed, + wx=95 | 1 / ns.time, + wy=96 | 1 / ns.time, + wz=97 | 1 / ns.time + ) + instance.particles.add_particle(p3) - print("\nGenerating binary") + state3 = instance.get_state(3) + self.validate_tsunami_state_equality(state3, p3) - print("kepl_to_cart corrections:\n PN1 = {}\n PN2 = {}".format(pn1, pn2)) + # check that particles 0 and 2 have not changed + state0 = instance.get_state(0) + state2 = instance.get_state(2) + self.validate_tsunami_state_relative_equality(state0, instance.particles[0]) + self.validate_tsunami_state_relative_equality(state2, instance.particles[2]) - pos_vel1 = keplutils.kepl_to_cart(pos_vel2, m1, m2, a, e, i, ome, Ome, nu, pn1=pn1, pn2=pn2) + instance.stop() - m = np.array([m1, m2]) - p = np.array([pos_vel1[:3], pos_vel2[:3]]) - v = np.array([pos_vel1[3:], pos_vel2[3:]]) + def test_physical_units(self): + """ + Evolve a system with tidal effects in physical units. + + The reference values used in this test were generated + using the standalone Tidymess code. Because Tidymess + applies slightly different unit conversion factors in + physical-unit mode, the initial conditions were first + converted to N-body units before running the simulation + in Tidymess. The resulting outputs were then converted + back to physical units for comparison with the AMUSE results. + """ + system = self.generate_HD80606b_system() + converter = ns.nbody_to_si( + system.mass.sum(), 0.455 | u.AU + ) - return m, p, v - keplutils = tsunami.KeplerUtils() - instance = self.new_instance_of_an_optional_code(Tsunami, redirection='none') + instance = self.new_instance_of_an_optional_code( + Tsunami, convert_nbody=converter + ) assert instance is not None - instance.parameters.wPNs = True + instance.particles.add_particles(system) + instance.commit_particles() + + m = np.ascontiguousarray(system.mass.value_in(u.Msun)) + r = np.ascontiguousarray(system.radius.value_in(u.AU)) + pos = np.ascontiguousarray(system.position.value_in(u.AU)) + vel = np.ascontiguousarray(system.velocity.value_in(u.AU / u.yr)) + wx = np.ascontiguousarray(system.wx.value_in(1 / u.yr)) + wy = np.ascontiguousarray(system.wy.value_in(1 / u.yr)) + wz = np.ascontiguousarray(system.wz.value_in(1 / u.yr)) + spin = np.vstack([wx,wy,wz]).T + code = tsunami.Tsunami(1,1) + code.Conf.wExt = True + m_nb = m + r_nb = r + pos_nb = pos + vel_nb = vel / (2 * np.pi) + spin_nb = np.ascontiguousarray(spin / (2 * np.pi)) + pt = np.ones_like(m_nb, dtype=np.int64) * -1 + code.add_particle_set(pos_nb, vel_nb, m_nb, r_nb, pt, spin_nb) + code.sync_internal_state(pos_nb, vel_nb, spin_nb) + + positions = instance.particles.position.value_in(u.AU) + velocities = instance.particles.velocity.value_in(u.km/u.s) + wx = instance.particles.wx.value_in(u.rad/u.yr) + wy = instance.particles.wy.value_in(u.rad/u.yr) + wz = instance.particles.wz.value_in(u.rad/u.yr) + + self.assertAlmostRelativeEquals(positions, pos_nb * code.Lscale) + self.assertAlmostRelativeEquals(velocities, vel_nb * code.Vscale, places=4) + self.assertAlmostRelativeEquals(np.vstack([wx, wy, wz]).T, spin_nb / code.Tscale, places=4) + + instance.stop() def plot_particles_xy( @@ -649,6 +714,10 @@ def plot_particles_xy( in the system. figsize : tuple[float, float] Size of the figure. + + Returns + ------- + ax : Axes """ data = [[], [], []] From 7c23eb2dcfd4b82e95b140f919e836369ac63281 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 18:12:33 +0200 Subject: [PATCH 106/132] added earth-moon ics from jpl ephemeris --- src/amuse_tsunami/tests/test_tsunami.py | 54 ++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 2dfaf8b2a1..becf3fb308 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -1,6 +1,7 @@ from matplotlib.axes import Axes import matplotlib.pyplot as plt import numpy as np +import pytest import tsunami from amuse.datamodel import Particle, Particles @@ -270,7 +271,10 @@ def generate_HD80606b_system(self): return HD80606 def generate_pythagorean(self): - """Generate 3 particles in a pythagorean triangle configuration.""" + """ + Generate 3 particles in a pythagorean triangle configuration. + Initial conditions courtesty of Dr. Alessandro Trani + """ p = Particles(3) p[0].mass = 3 | ns.mass @@ -311,6 +315,54 @@ def generate_pythagorean(self): return p + def generate_earth_moon_initial_conditions(self): + """ + Earth and moon initial conditions taken from JPL Ephemeris. + + JPL Ephemeris, Pasadena, USA, Horizons System + + * Start time : A.D. 2026-Jan-01 00:00:00.0000 TDB + * Stop time : A.D. 2026-Jan-01 00:01:00.0000 TDB + * Coordinate Center : Solar System Barycenter + """ + p = Particles(2) + + p[0].name = "Earth" + p[0].mass = 5.97219e24 | u.kg + p[0].radius = 6371.01 | u.km + p[0].xi = 0.3308 + p[0].kf = 0.933 + p[0].tau = 60. | u.s + p[0].wx = 0.0 | u.rad/u.s + p[0].wy = 0.0 | u.rad/u.s + p[0].wz = 0.0 | u.rad/u.s + p[0].x = -2.653100241556548E+07 | u.km + p[0].y = 1.439468995740296E+08 | u.km + p[0].z = 1.080681311843544E+04 | u.km + p[0].vx = -2.977650610770464E+01 | u.kms + p[0].vy = -5.395962660572101E+00 | u.kms + p[0].vz = 1.753836198843395E-04 | u.kms + + p[1].name = "Moon" + p[1].mass = 7.349e22 | u.kg + p[1].radius = 1737.53 | u.km + p[1].xi = 0.394 + p[1].kf = 0.4 + p[1].tau = 60. | u.s + p[1].wx = 0.0 | u.rad/u.s + p[1].wy = 0.0 | u.rad/u.s + p[1].wz = 0.0 | u.rad/u.s + p[1].x = -2.638667668807356E+07 | u.km + p[1].y = 1.442762954049252E+08 | u.km + p[1].z = 4.255978946162760E+04 | u.km + p[1].vx = -3.078082024537686E+01 | u.kms + p[1].vy = -4.975097451815738E+00 | u.kms + p[1].vz = 5.760594917691098E-03 | u.kms + + p.move_to_center() + + return p + def validate_tsunami_state_equality(self, state: list, particle: Particle) -> None: """ Validate that a state retrieved by `Tsunami.get_state` From 4853408647adc754dbc57f8996ee77bee753acf8 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 18:12:51 +0200 Subject: [PATCH 107/132] def test_earth_moon_system --- src/amuse_tsunami/tests/test_tsunami.py | 93 +++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index becf3fb308..120c58d400 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -686,6 +686,99 @@ def test_tsunami_does_not_rescale_to_com_frame(self): instance.stop() + def test_earth_moon_system(self): + """ + Test the Earth Moon system with physical units. + Because of slight differences between the values + of units / constants used in Tsunami and AMUSE, + it is not possible to perfectly recreate Tsunami + simulation in AMUSE when physical units are used. + """ + p = self.generate_earth_moon_initial_conditions() + converter = ns.nbody_to_si( + p.mass.sum(), p.position.length() + ) + converter = ns.nbody_to_si(1 | u.MSun, 1 | u.au) + + instance = self.new_instance_of_an_optional_code( + Tsunami, convert_nbody=converter + ) + assert instance is not None + + instance.particles.add_particles(p) + + end_time = (2 | u.yr).as_quantity_in(u.s) + dt = 50000 | u.s + + while instance.model_time < end_time: + instance.evolve_model(instance.model_time + dt) + + p2 = self.generate_earth_moon_initial_conditions() + m = np.ascontiguousarray(p2.mass.value_in(u.Msun)) + r = np.ascontiguousarray(p2.radius.value_in(u.AU)) + pos = np.ascontiguousarray(p2.position.value_in(u.AU)) + vel = np.ascontiguousarray(p2.velocity.value_in(u.AU / u.yr)) + wx = np.ascontiguousarray(p2.wx.value_in(1 / u.yr)) + wy = np.ascontiguousarray(p2.wy.value_in(1 / u.yr)) + wz = np.ascontiguousarray(p2.wz.value_in(1 / u.yr)) + spin = np.vstack([wx,wy,wz]).T + + code = tsunami.Tsunami(1, 1) + code.Conf.wExt = True + m_nb = m / code.Mscale + r_nb = r / code.Lscale + pos_nb = pos / code.Lscale + vel_nb = vel / (code.Lscale / code.Tscale) + spin_nb = np.ascontiguousarray(spin * code.Tscale) + pt = np.ones_like(m_nb, dtype=np.int64) * -1 + + code.add_particle_set(pos_nb, vel_nb, m_nb, r_nb, pt, spin_nb) + code.sync_internal_state(pos_nb, vel_nb, spin_nb) + + t_end_yr = 2 + dt_yr = dt.value_in(u.yr) + t_end_nb = t_end_yr / code.Tscale + dt_nb = dt_yr / code.Tscale + t = 0 + + while t < t_end_nb: + code.evolve_system(t + dt_nb) + t = code.time + code.sync_internal_state(pos_nb, vel_nb, spin_nb) + + pos_au = instance.particles.position.as_quantity_in(u.AU) + vel_kms = instance.particles.velocity.as_quantity_in(u.kms) + wx = instance.particles.wx.as_quantity_in(1/u.yr) + wy = instance.particles.wy.as_quantity_in(1/u.yr) + wz = instance.particles.wz.as_quantity_in(1/u.yr) + + tsunami_pos = pos_nb * code.Lscale | u.AU + tsunami_vel = vel_nb * code.Vscale | u.kms + tsunami_spin = spin_nb / code.Tscale | 1 / u.yr + + self.assertAlmostRelativeEquals(pos_au, tsunami_pos, places=2) + + self.assertAlmostRelativeEquals(vel_kms[0,0], tsunami_vel[0,0], places=2) + self.assertAlmostRelativeEquals(vel_kms[0,1], tsunami_vel[0,1], places=2) + self.assertAlmostRelativeEquals(vel_kms[1,0], tsunami_vel[1,0], places=2) + self.assertAlmostRelativeEquals(vel_kms[1,1], tsunami_vel[1,1], places=2) + + # as of right now, Tsunami and AMUSE do not use the same exact unit values, + # namely the value of G and/or the value of pi. thus it is not possible + # to reproduce the exact values + with pytest.raises(AssertionError): + self.assertAlmostRelativeEquals(vel_kms[0,2], tsunami_vel[0,2], places=2) + self.assertAlmostRelativeEquals(vel_kms[1,2], tsunami_vel[1,2], places=2) + + self.assertEquals(wx[0], tsunami_spin[0,0]) + self.assertEquals(wx[1], tsunami_spin[1,0]) + self.assertEquals(wy[0], tsunami_spin[0,1]) + self.assertEquals(wy[1], tsunami_spin[1,1]) + self.assertEquals(wz[0], tsunami_spin[0,2]) + self.assertEquals(wz[1], tsunami_spin[1,2]) + + instance.stop() + def test_physical_units(self): """ Evolve a system with tidal effects in physical units. From d2dfd90600000845896091c3f31856c821af6351 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 18:13:30 +0200 Subject: [PATCH 108/132] rename test_earth_moon_system to test_earth_moon_system_physical_units --- src/amuse_tsunami/tests/test_tsunami.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 120c58d400..690401cb16 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -686,7 +686,7 @@ def test_tsunami_does_not_rescale_to_com_frame(self): instance.stop() - def test_earth_moon_system(self): + def test_earth_moon_system_physical_units(self): """ Test the Earth Moon system with physical units. Because of slight differences between the values From 26ca40687b30dc6103120638120cf86ed874e690 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 8 Jul 2026 18:27:25 +0200 Subject: [PATCH 109/132] def test_converter and clean up test_earth_moon_system_physical_units --- src/amuse_tsunami/tests/test_tsunami.py | 79 ++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 3 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 690401cb16..ce1fdad243 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -686,6 +686,63 @@ def test_tsunami_does_not_rescale_to_com_frame(self): instance.stop() + def test_converter(self): + """ + Test that the converter works to convert physical units + to nbody units. + + NOTE : To recreate a Tsunami simulation, please setup + the AMUSE converter as follows: + `converter = nbody_system.nbody_to_si(M | u.MSun, L | u.au)` + Where `M` and `L` match the values used in Tsunami, + ie. `code = tsunami.Tsunami(M, L)`. + + Due to small unit / constant value differences (ie. G), + do not expect AMUSE Tsunami and standalone Tsunami to + match perfectly. + """ + p = self.generate_earth_moon_initial_conditions() + converter = ns.nbody_to_si(1 | u.MSun, 1 | u.au) + + instance = self.new_instance_of_an_optional_code( + Tsunami, convert_nbody=converter + ) + assert instance is not None + instance.particles.add_particles(p) + + nbody_pos_amuse = converter.to_nbody(instance.particles.position) + nbody_vel_amuse = converter.to_nbody(instance.particles.velocity) + + p2 = self.generate_earth_moon_initial_conditions() + m = np.ascontiguousarray(p2.mass.value_in(u.Msun)) + r = np.ascontiguousarray(p2.radius.value_in(u.AU)) + pos = np.ascontiguousarray(p2.position.value_in(u.AU)) + vel = np.ascontiguousarray(p2.velocity.value_in(u.AU / u.yr)) + wx = np.ascontiguousarray(p2.wx.value_in(1 / u.yr)) + wy = np.ascontiguousarray(p2.wy.value_in(1 / u.yr)) + wz = np.ascontiguousarray(p2.wz.value_in(1 / u.yr)) + spin = np.vstack([wx,wy,wz]).T + + code = tsunami.Tsunami(1, 1) + code.Conf.wExt = True + + # convert tsunami ics to nbody units + m_nb = m / code.Mscale + r_nb = r / code.Lscale + pos_nb = pos / code.Lscale + vel_nb = vel / (code.Lscale / code.Tscale) + spin_nb = np.ascontiguousarray(spin * code.Tscale) + pt = np.ones_like(m_nb, dtype=np.int64) * -1 + + code.add_particle_set(pos_nb, vel_nb, m_nb, r_nb, pt, spin_nb) + code.sync_internal_state(pos_nb, vel_nb, spin_nb) + + # check that the converter works + self.assertAlmostRelativeEquals(nbody_pos_amuse.number, pos_nb) + self.assertAlmostRelativeEquals(nbody_vel_amuse.number, vel_nb, places=3) + + instance.stop() + def test_earth_moon_system_physical_units(self): """ Test the Earth Moon system with physical units. @@ -694,10 +751,9 @@ def test_earth_moon_system_physical_units(self): it is not possible to perfectly recreate Tsunami simulation in AMUSE when physical units are used. """ + # SETUP AMUSE RUN + # --------------- p = self.generate_earth_moon_initial_conditions() - converter = ns.nbody_to_si( - p.mass.sum(), p.position.length() - ) converter = ns.nbody_to_si(1 | u.MSun, 1 | u.au) instance = self.new_instance_of_an_optional_code( @@ -707,12 +763,19 @@ def test_earth_moon_system_physical_units(self): instance.particles.add_particles(p) + nbody_pos_amuse = converter.to_nbody(instance.particles.position) + nbody_vel_amuse = converter.to_nbody(instance.particles.velocity) + end_time = (2 | u.yr).as_quantity_in(u.s) dt = 50000 | u.s + # EVOLVE AMUSE + # ------------ while instance.model_time < end_time: instance.evolve_model(instance.model_time + dt) + # SETUP IDENTICAL TSUNAMI RUN + # --------------------------- p2 = self.generate_earth_moon_initial_conditions() m = np.ascontiguousarray(p2.mass.value_in(u.Msun)) r = np.ascontiguousarray(p2.radius.value_in(u.AU)) @@ -725,6 +788,8 @@ def test_earth_moon_system_physical_units(self): code = tsunami.Tsunami(1, 1) code.Conf.wExt = True + + # convert tsunami ics to nbody units m_nb = m / code.Mscale r_nb = r / code.Lscale pos_nb = pos / code.Lscale @@ -735,17 +800,25 @@ def test_earth_moon_system_physical_units(self): code.add_particle_set(pos_nb, vel_nb, m_nb, r_nb, pt, spin_nb) code.sync_internal_state(pos_nb, vel_nb, spin_nb) + # check that the converter works + self.assertAlmostRelativeEquals(nbody_pos_amuse.number, pos_nb) + self.assertAlmostRelativeEquals(nbody_vel_amuse.number, vel_nb, places=3) + t_end_yr = 2 dt_yr = dt.value_in(u.yr) t_end_nb = t_end_yr / code.Tscale dt_nb = dt_yr / code.Tscale t = 0 + # EVOLVE TSUNAMI + # -------------- while t < t_end_nb: code.evolve_system(t + dt_nb) t = code.time code.sync_internal_state(pos_nb, vel_nb, spin_nb) + # VALIDATE THAT BOTH RUNS MATCH + # ----------------------------- pos_au = instance.particles.position.as_quantity_in(u.AU) vel_kms = instance.particles.velocity.as_quantity_in(u.kms) wx = instance.particles.wx.as_quantity_in(1/u.yr) From ff52d80d87246324553dbdefe813c3b79db87e4b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 9 Jul 2026 18:05:51 +0200 Subject: [PATCH 110/132] def initialize_tidal_parameters tsunami interface.py --- src/amuse_tsunami/interface.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 7123668ca7..4b80f55876 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1,4 +1,5 @@ import numpy as np +from numpy.typing import NDArray import tsunami from amuse.community.interface.common import CommonCode @@ -804,6 +805,27 @@ def set_dynamical_tides(self, dynamical_tides: bool) -> int: self.tsunami.Conf.wEqTides = bool(dynamical_tides) return 0 + def initialize_tidal_parameters( + self, + kaps: NDArray[np.float64], + taulag: NDArray[np.float64], + polyt: NDArray[np.float64], + gyrad: NDArray[np.float64], + N: int + ) -> int: + if any(len(arr) != N for arr in [kaps, taulag, polyt, gyrad]): + raise ValueError( + f'All tidal parameter arrays must have the same length ({N}) ' + f'with one value for each particle.' + ) + self.tsunami.initialize_tidal_parameters( + kaps, + taulag, + polyt, + gyrad + ) + return 0 + def get_alpha(self, alpha: ValueHolder) -> int: """ Get alpha regularization parameter. @@ -1239,6 +1261,12 @@ def get_dynamical_tides(): def set_dynamical_tides(dynamical_tides='b'): returns () + @remote_function(must_handle_array=True) + def initialize_tidal_parameters( + kaps='d', taulag='d', polyt='d', gyrad='d' + ): + returns () + @remote_function def get_alpha(): returns (alpha='d') @@ -1463,6 +1491,12 @@ def define_methods(self, handler): (ns.speed, handler.ERROR_CODE) ) + handler.add_method( + 'initialize_tidal_parameters', + (handler.NO_UNIT, ns.time, handler.NO_UNIT, handler.NO_UNIT), + (handler.ERROR_CODE,) + ) + def define_parameters(self, handler): """Define model parameters. From 0abf9563dcbcd52b133d2a0e405fc016f9e398f4 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 12 Aug 2026 11:59:25 -0400 Subject: [PATCH 111/132] rm whitespace --- src/amuse_tsunami/tests/test_tsunami.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index ce1fdad243..7bd6d9b1de 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -908,7 +908,6 @@ def test_physical_units(self): instance.stop() - def plot_particles_xy( self, particles: list[Particles], From c8a37e2d610315e26b82a598874345282eed3c10 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 10 Sep 2026 15:50:32 +0200 Subject: [PATCH 112/132] add spin as a global vector Particles attribute --- src/amuse_tsunami/interface.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 4b80f55876..b43dc55690 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -9,6 +9,7 @@ GravityFieldCode, GravityFieldInterface ) +from amuse.datamodel.particles import Particles from amuse.rfi.core import ( LegacyFunctionSpecification, PythonCodeInterface, @@ -1382,6 +1383,8 @@ def __init__(self, convert_nbody=None, **options): L_s = convert_nbody.to_si(1 | generic_unit_system.length).value_in(u.AU) self.set_units(M_s, L_s) + Particles.add_global_vector_attribute('spin', ['wx', 'wy', 'wz']) + def define_state(self, handler): """Define the state model of the code.""" From 1775fafd4aa0f5a3a71803c0fefb866f8f631599 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 10 Sep 2026 15:50:51 +0200 Subject: [PATCH 113/132] tighten swig version dependency for tsunami --- src/amuse_tsunami/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse_tsunami/Makefile b/src/amuse_tsunami/Makefile index f5799663db..635aae3e6f 100644 --- a/src/amuse_tsunami/Makefile +++ b/src/amuse_tsunami/Makefile @@ -15,7 +15,7 @@ src/tsunami-master: | tsunami-master.tar.gz .PHONY: install_tsunami install_tsunami: | src/tsunami-master ifneq ($(CONDA_PREFIX),) - conda install --yes --channel conda-forge --override-channels numpy swig scikit-build-core + conda install --yes --channel conda-forge --override-channels numpy "swig=4.2.1" scikit-build-core endif cd src/tsunami-master/ && pip install . -Ccmake.define.spin=ON From df4c2ab8cbfbcdb198a167717e69d92a054a7639 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 10 Sep 2026 15:51:24 +0200 Subject: [PATCH 114/132] rm tsunami.commit_parameters call from commit_parameters since it was causing bugs. this method should be for recommit_parameters only --- src/amuse_tsunami/interface.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index b43dc55690..62a5778ef9 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -66,7 +66,6 @@ def cleanup_code(self) -> int: def commit_parameters(self) -> int: """Commit Tsunami parameters.""" - self.tsunami.commit_parameters() return 0 def commit_particles(self) -> int: From f92c28d849b52bf4ff20691372d250dd885f3d37 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 10 Sep 2026 15:51:51 +0200 Subject: [PATCH 115/132] fix issue where dynamical tides were activating equilibrium tides instead --- src/amuse_tsunami/interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 62a5778ef9..dd9011668f 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -789,7 +789,7 @@ def get_dynamical_tides(self, dynamical_tides: ValueHolder) -> int: ValueHolder instance to return dynamical tides value. If `True`, enables dynamical tides. """ - dynamical_tides.value = self.tsunami.Conf.wEqTides + dynamical_tides.value = self.tsunami.Conf.wDynTides return 0 def set_dynamical_tides(self, dynamical_tides: bool) -> int: @@ -802,7 +802,7 @@ def set_dynamical_tides(self, dynamical_tides: bool) -> int: ValueHolder instance to return dynamical tides value. If `True`, enables dynamical tides. """ - self.tsunami.Conf.wEqTides = bool(dynamical_tides) + self.tsunami.Conf.wDynTides = bool(dynamical_tides) return 0 def initialize_tidal_parameters( From e6697c7bc9c0ed6002b04d8f85a235fe66d2a5d1 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 10 Sep 2026 15:52:36 +0200 Subject: [PATCH 116/132] cleanup interface tsunami --- src/amuse_tsunami/interface.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index dd9011668f..77d9f7f305 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -819,11 +819,9 @@ def initialize_tidal_parameters( f'with one value for each particle.' ) self.tsunami.initialize_tidal_parameters( - kaps, - taulag, - polyt, - gyrad + kaps, taulag, polyt, gyrad ) + self.synchronize_model() return 0 def get_alpha(self, alpha: ValueHolder) -> int: @@ -1501,7 +1499,8 @@ def define_methods(self, handler): def define_parameters(self, handler): - """Define model parameters. + """ + Define model parameters. These have a native function for getting their value, another one for setting, and a name, description and default value. Functions with the appropriate names From f9e0dbca0ca506dde1685850749374c20e40254b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 10 Sep 2026 15:52:57 +0200 Subject: [PATCH 117/132] add spin in particle set --- src/amuse_tsunami/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 77d9f7f305..759fea606d 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -1593,12 +1593,12 @@ def define_parameters(self, handler): 'enable post newtonian corrections of order 3.5', default_value=True ) - # GravitationalDynamics.define_parameters(self, handler) def define_particle_sets(self, handler): """Define any particle sets inside the model.""" GravitationalDynamics.define_particle_sets(self, handler) + handler.add_getter('particles', 'get_spin', names=('wx', 'wy', 'wz')) def define_converter(self, handler): From 7e8a627dc4119991a0525e73d8a28b327f06293e Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 10 Sep 2026 15:53:57 +0200 Subject: [PATCH 118/132] tsunami docs --- src/amuse_tsunami/interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 759fea606d..239e599245 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -24,9 +24,9 @@ class TsunamiImplementation(object): - + """Implementation class for Tsunami Interface.""" def __init__(self): - # hard code N-Body units to Lscale = Mscale = 1 + # hard code N-Body units to: Lscale = 1 [AU], Mscale = 1 [MSun] self.tsunami = tsunami.Tsunami(1, 1) # temporary buffers for staging particles From 38768b07b96541ef497438773ebce30256c12826 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 10 Sep 2026 15:55:09 +0200 Subject: [PATCH 119/132] cleanup tsunami tests --- src/amuse_tsunami/tests/test_tsunami.py | 30 +++++++++++-------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 7bd6d9b1de..0a06ebc700 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -1,3 +1,4 @@ +from equilibrium_tides_averaged import EqTides, make_tsunami_ic from matplotlib.axes import Axes import matplotlib.pyplot as plt import numpy as np @@ -5,7 +6,7 @@ import tsunami from amuse.datamodel import Particle, Particles -from amuse.ext.orbital_elements import generate_binaries +from amuse.ext.orbital_elements import generate_binaries, orbital_elements from amuse.support.testing.amusetest import TestWithMPI from amuse_tsunami.interface import TsunamiInterface, Tsunami from amuse.units import constants as c, nbody_system as ns, units as u @@ -16,9 +17,7 @@ class TestTsunamiInterface(TestWithMPI): def test_initialization(self): - """ - Test Tsunami initialization. - """ + """Test Tsunami initialization.""" instance = self.new_instance_of_an_optional_code(TsunamiInterface) assert instance is not None @@ -28,9 +27,7 @@ def test_initialization(self): instance.stop() def test_setters_and_getters(self): - """ - Test TsunamiInterface setters and getters. - """ + """Test TsunamiInterface setters and getters.""" instance = self.new_instance_of_an_optional_code(TsunamiInterface) assert instance is not None @@ -273,7 +270,7 @@ def generate_HD80606b_system(self): def generate_pythagorean(self): """ Generate 3 particles in a pythagorean triangle configuration. - Initial conditions courtesty of Dr. Alessandro Trani + Initial conditions courtesy of Dr. Alessandro Alberto Trani. """ p = Particles(3) @@ -378,7 +375,8 @@ def validate_tsunami_state_equality(self, state: list, particle: Particle) -> No Raises ------ - AssertionError : If the states don't match. + AssertionError : + If the states don't match. """ self.assertEquals(state[0], particle.mass) self.assertEquals(state[1], particle.radius) @@ -415,7 +413,7 @@ def validate_tsunami_state_relative_equality( Raises ------ - AssertionError + AssertionError : If any corresponding value in `state` and `particle` does not match within `places` relative precision. """ @@ -790,10 +788,10 @@ def test_earth_moon_system_physical_units(self): code.Conf.wExt = True # convert tsunami ics to nbody units - m_nb = m / code.Mscale - r_nb = r / code.Lscale - pos_nb = pos / code.Lscale - vel_nb = vel / (code.Lscale / code.Tscale) + m_nb = m / code.Mscale + r_nb = r / code.Lscale + pos_nb = pos / code.Lscale + vel_nb = vel / (code.Lscale / code.Tscale) spin_nb = np.ascontiguousarray(spin * code.Tscale) pt = np.ones_like(m_nb, dtype=np.int64) * -1 @@ -962,9 +960,7 @@ def plot_particles_xy( return ax def plot_tsunami_pythagorean_triangle(self, ax: Axes) -> None: - """ - Plot `test_tsunami.py` from the standalone TSUNAMI package. - """ + """Plot `test_tsunami.py` from the standalone TSUNAMI package.""" import tsunami code = tsunami.Tsunami(1.0, 1.0) From 2d126ffcd1aa56109741554faf7432051d629df0 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 10 Sep 2026 15:55:32 +0200 Subject: [PATCH 120/132] create test_tides --- src/amuse_tsunami/tests/test_tsunami.py | 122 ++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 0a06ebc700..a179343d77 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -906,6 +906,128 @@ def test_physical_units(self): instance.stop() + def test_tides(self): + """ + Test Tsunami tidal evolution. An AMUSE simulation + is compared with a standalone Tsunami tidal evolution test + script written by Dr. Alessandro Alberto Trani. The initial + conditions are also from this test script. + """ + ############################ + # Tsunami Initial Conditions + ############################ + KU = tsunami.KeplerUtils() + m1 = 1 # MSun + m2 = 1 # MSun + R1 = 1 * KU.RSun2au + R2 = 1 * KU.RSun2au + # apsidal motion constant + kap = 0.05 + k1 = kap + k2 = kap + # time-lag, first in seconds, converted to N-body + tausec = 1e3 + tau1 = tausec / KU.yr2sec / KU.Tscale + tau2 = tausec / KU.yr2sec / KU.Tscale + # gyration radius, given inertia I = M * (rg * R)^2 + rg = 0.28 + rg1 = rg + rg2 = rg + # initial orbit + a0, e0 = 0.09, 0.3 + # spin, first in period (days) then in angular frequency + Ps1 = 100 / 365.25 / KU.Tscale + spin1 = 2 * np.pi / Ps1 + Ps2 = 0.0015 / KU.Tscale + spin2 = 2 * np.pi / Ps2 + + ET = EqTides(m1, m2, R1, R2, k1, k2, tau1, tau2, rg1, rg2, rotdist=False, usespin=True) + ET.setup_orbital_vectors(a0, e0) + obl1 = np.radians(30) + obl2 = 0.0 + ET.setup_spin_vectors(spin1, spin2, obl1, obl2) + ET.setup_vectors() + ET.initialize_integrator() + + m, R, p, v, spin, _ = make_tsunami_ic(m1, m2, R1, R2, a0, e0, ET.spin1_vec, ET.spin2_vec) + + # final time, in units of initial orbital period (in N-body units) + tfin = 5e5 * ET.P0 + dt = 5e1 * ET.P0 + + kaps = np.array([k1, k2]) + polyind = np.array([0.0, 0.0]) # only for dynamical tide, null values + gyrad = np.array([rg1, rg2]) + + ################## + # AMUSE SIMULATION + ################## + converter = ns.nbody_to_si(1 | u.MSun, 1 | u.au) + instance = self.new_instance_of_an_optional_code( + Tsunami, convert_nbody=converter + ) + assert instance is not None + # enable tides + instance.parameters.wEqTides = True + + mass = m | u.MSun + radii = R | u.au + pos = p | u.au + vel = converter.to_si(v | ns.speed).as_quantity_in(u.AU/u.yr) + spin_si = converter.to_si(spin | 1 / ns.time).as_quantity_in(1/u.yr) + tau = np.array([tausec, tausec]) | u.s + + p = Particles(2) + p.mass = mass + p.radius = radii + p.position = pos + p.velocity = vel + p.spin = spin_si + p[0].name = 'A' + p[1].name = 'B' + + # add particles + instance.particles.add_particles(p) + channel = instance.particles.new_channel_to(p) + instance.commit_particles() + # initialize tides + instance.initialize_tidal_parameters( + kaps, + tau, + polyind, + gyrad + ) + + # convert final time and dt to SI units + tfin_si = converter.to_si(tfin | ns.time).as_quantity_in(u.yr) + dt_si = converter.to_si(dt | ns.time).as_quantity_in(u.yr) + + pars = [p.copy()] + times = [instance.model_time] + while instance.model_time < tfin_si: + instance.evolve_model(instance.model_time + dt_si) + channel.copy() + pars.append(p.copy()) + times.append(instance.model_time) + + elements = [orbital_elements(p) for p in pars] + smas = [e[2].as_quantity_in(u.au) for e in elements] + eccentricities = [e[3] for e in elements] + print(eccentricities[-1]) + # check that last semi major axis & e measurements agrees with Tsunami + self.assertAlmostRelativeEquals( + smas[-1], 0.090719705156567 | u.au, places=5 + ) + self.assertAlmostRelativeEquals( + eccentricities[-1], 0.2992015985318265400, places=5 + ) + # check that final times are the same + self.assertAlmostRelativeEquals(converter.to_nbody( + instance.model_time).number, 59983.559799160954, places=1 + ) + + instance.stop() + def plot_particles_xy( self, particles: list[Particles], From e062d6a3ccc6fd231896ace6564d022cbf688c9f Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 11 Sep 2026 16:08:52 +0200 Subject: [PATCH 121/132] clean up Tsunami interface of typos, homogenize docstrings --- src/amuse_tsunami/interface.py | 317 ++++++++++++++++++++++++++------- 1 file changed, 249 insertions(+), 68 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 239e599245..85b5ecf3e0 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -46,7 +46,7 @@ def __init__(self): self._spin = np.empty((0, 3), dtype=np.float64) self._stype = np.empty(0, dtype=np.int64) - self._next_particle_id = 0 + self._next_particle_id: int = 0 def initialize_code(self) -> int: """ @@ -65,7 +65,16 @@ def cleanup_code(self) -> int: return 0 def commit_parameters(self) -> int: - """Commit Tsunami parameters.""" + """ + Commit Tsunami parameters. + + Notes + ----- + * `tsunami.commit_particles` should not be called + here as it introduced subtle bugs in setting + parameters. That method should be reserved for + `recommit_parameters`. + """ return 0 def commit_particles(self) -> int: @@ -103,7 +112,7 @@ def commit_particles(self) -> int: if N_total < 2: raise ValueError( - 'Tsunami needs at least 2 particles when commiting!' + 'Tsunami needs at least 2 particles when committing!' ) if not ( @@ -156,12 +165,12 @@ def commit_particles(self) -> int: return 0 def recommit_parameters(self) -> int: - """Recommit parameters after commiting them.""" + """Recommit parameters after committing them.""" self.tsunami.commit_parameters() return 0 def recommit_particles(self) -> int: - """Recommit particles after commiting them.""" + """Recommit particles after committing them.""" self.commit_particles() return 0 @@ -176,8 +185,10 @@ def evolve_model(self, time: float) -> int: Returns ------- - 0 : If the evolution is succesful. - -1 : If `time` <= current model time. + 0 : + If the evolution is successful. + -1 : + If `time` <= current model time. """ if time <= self.tsunami.time: return -1 @@ -196,10 +207,10 @@ def evolve_model_dtmax(self, time: float) -> int: is needed, such as in visualizations or applications requiring fixed time intervals. - Unlike evolve_system(), this method performs only one - integration step and adapts the timestep to ensure - it does not exceed `time`. If the integration requires - a shorter timestep, it may stop well before `time`. + Unlike `tsunami.evolve_system`, this method performs only + one integration step and adapts the timestep to ensure it + does not exceed `time`. If the integration requires a + shorter timestep, it may stop well before `time`. Parameters ---------- @@ -208,8 +219,10 @@ def evolve_model_dtmax(self, time: float) -> int: Returns ------- - 0 : If the evolution is succesful. - -1 : If `time` <= current model time. + 0 : + If the evolution is successful. + -1 : + If `time` <= current model time. """ if time <= self.tsunami.time: return -1 @@ -270,7 +283,8 @@ def new_particle( Returns ------- - 0 : Particle was created successfully. + 0 : + Particle was created successfully. """ self._mass_list.append(mass) self._radius_list.append(radius) @@ -295,7 +309,8 @@ def delete_particle(self, index_of_the_particle: int) -> int: Returns ------- - 0 : The particle was deleted successfully. + 0 : + Particle was deleted successfully. Raises ------ @@ -353,11 +368,13 @@ def get_state( Returns ------- - 0 : State was retrieved successfully. + 0 : + State was retrieved successfully. Raises ------ - ValueError : If `index_of_the_particle` is not valid. + ValueError : + If `index_of_the_particle` is not valid. """ i = self._get_particle_index_by_id(index_of_the_particle) self.synchronize_model() @@ -408,11 +425,13 @@ def set_state( Returns ------- - 0 : State was retrieved successfully. + 0 : + State was set successfully. Raises ------ - ValueError : If `index_of_the_particle` is not valid. + ValueError : + If `index_of_the_particle` is not valid. """ i = self._get_particle_index_by_id(index_of_the_particle) @@ -447,13 +466,16 @@ def get_mass( Particle index as returned by `new_particle`. mass : ValueHolder[float] ValueHolder instance to return the mass value. + Returns ------- - 0 : Mass was retrieved successfully. + 0 : + Mass was retrieved successfully. Raises ------ - ValueError : If `index_of_the_particle` is not valid. + ValueError : + If `index_of_the_particle` is not valid. """ i = self._get_particle_index_by_id(index_of_the_particle) self.synchronize_model() @@ -478,11 +500,13 @@ def set_mass( Returns ------- - 0 : Mass was retrieved successfully. + 0 : + Mass was set successfully. Raises ------ - ValueError : If `index_of_the_particle` is not valid. + ValueError : + If `index_of_the_particle` is not valid. """ i = self._get_particle_index_by_id(index_of_the_particle) @@ -508,11 +532,13 @@ def get_radius( Returns ------- - 0 : Radius was retrieved successfully. + 0 : + Radius was retrieved successfully. Raises ------ - ValueError : If `index_of_the_particle` is not valid. + ValueError : + If `index_of_the_particle` is not valid. """ i = self._get_particle_index_by_id(index_of_the_particle) self.synchronize_model() @@ -540,11 +566,13 @@ def get_position( Returns ------- - 0 : Position was retrieved successfully. + 0 : + Position was retrieved successfully. Raises ------ - ValueError : If `index_of_the_particle` is not valid. + ValueError : + If `index_of_the_particle` is not valid. """ i = self._get_particle_index_by_id(index_of_the_particle) self.synchronize_model() @@ -570,11 +598,13 @@ def set_position( Returns ------- - 0 : Position was set. + 0 : + Position was set successfully. Raises ------ - ValueError : If `index_of_the_particle` is not valid. + ValueError : + If `index_of_the_particle` is not valid. """ i = self._get_particle_index_by_id(index_of_the_particle) @@ -606,15 +636,14 @@ def get_velocity( Returns ------- - 0 : velocity was retrieved successfully. + 0 : + Velocity was retrieved successfully. Raises ------ - ValueError : If `index_of_the_particle` is not valid. + ValueError : + If `index_of_the_particle` is not valid. """ - if self._pos.shape[0] == 0: - return -1 - i = self._get_particle_index_by_id(index_of_the_particle) self.synchronize_model() @@ -639,11 +668,13 @@ def set_velocity( Returns ------- - 0 : velocity was set. + 0 : + Velocity was set successfully. Raises ------ - ValueError : If `index_of_the_particle` is not valid. + ValueError : + If `index_of_the_particle` is not valid. """ i = self._get_particle_index_by_id(index_of_the_particle) @@ -675,15 +706,14 @@ def get_spin( Returns ------- - 0 : Spin was retrieved. + 0 : + Spin was retrieved successfully. Raises ------ - ValueError : If `index_of_the_particle` is not valid. + ValueError : + If `index_of_the_particle` is not valid. """ - if self._pos.shape[0] == 0: - return -1 - i = self._get_particle_index_by_id(index_of_the_particle) self.synchronize_model() @@ -703,6 +733,11 @@ def set_units(self, Mscale: float, Lscale: float) -> int: Mass scale of Tsunami in MSun. Lscale : float Length scale of Tsunami in AU. + + Returns + ------- + 0 : + Units were set successfully. """ self.tsunami.set_units(float(Mscale), float(Lscale)) return 0 @@ -710,6 +745,8 @@ def set_units(self, Mscale: float, Lscale: float) -> int: def get_Mscale(self, Mscale: ValueHolder) -> int: """ Get mass unit of Tsunami in MSun. + + To set `Mscale`, use `set_units`. """ Mscale.value = self.tsunami.Mscale return 0 @@ -717,6 +754,8 @@ def get_Mscale(self, Mscale: ValueHolder) -> int: def get_Lscale(self, Lscale: ValueHolder) -> int: """ Get length unit of Tsunami in AU. + + To set `Lscale`, use `set_units`. """ Lscale.value = self.tsunami.Lscale return 0 @@ -724,7 +763,7 @@ def get_Lscale(self, Lscale: ValueHolder) -> int: def get_Tscale(self, Tscale: ValueHolder) -> int: """ Get time unit of Tsunami in years. - Derived from Mscale, Lscale, and G=1. + Derived from `Mscale`, `Lscale`, and G=1. This value is read only. """ @@ -734,7 +773,7 @@ def get_Tscale(self, Tscale: ValueHolder) -> int: def get_Vscale(self, Vscale: ValueHolder) -> int: """ Get velocity unit of Tsunami in km/s. - Derived from Mscale, Lscale, and G=1. + Derived from `Mscale`, `Lscale`, and G=1. This value is read only. """ @@ -749,6 +788,11 @@ def get_speed_of_light(self, speed_of_light: ValueHolder) -> int: ---------- speed_of_light : ValueHolder[float] ValueHolder instance to return the speed of light value. + + Returns + ------- + 0 : + Speed of light was retrieved successfully. """ speed_of_light.value = self.tsunami.speed_of_light return 0 @@ -762,6 +806,11 @@ def get_equilibrium_tides(self, equilibrium_tides: ValueHolder) -> int: equilibrium_tides : ValueHolder[bool] ValueHolder instance to return equilibrium tides value. If `True`, enables equilibrium tides. + + Returns + ------- + 0 : + Equilibrium tides parameter was retrieved successfully. """ equilibrium_tides.value = self.tsunami.Conf.wEqTides return 0 @@ -775,6 +824,11 @@ def set_equilibrium_tides(self, equilibrium_tides: bool) -> int: equilibrium_tides : ValueHolder[bool] ValueHolder instance to return equilibrium tides value. If `True`, enables equilibrium tides. + + Returns + ------- + 0 : + Equilibrium tides parameter was set successfully. """ self.tsunami.Conf.wEqTides = bool(equilibrium_tides) return 0 @@ -788,6 +842,11 @@ def get_dynamical_tides(self, dynamical_tides: ValueHolder) -> int: dynamical_tides : ValueHolder[bool] ValueHolder instance to return dynamical tides value. If `True`, enables dynamical tides. + + Returns + ------- + 0 : + Dynamical tides parameter was retrieved successfully. """ dynamical_tides.value = self.tsunami.Conf.wDynTides return 0 @@ -801,6 +860,11 @@ def set_dynamical_tides(self, dynamical_tides: bool) -> int: dynamical_tides : ValueHolder[bool] ValueHolder instance to return dynamical tides value. If `True`, enables dynamical tides. + + Returns + ------- + 0 : + Dynamical tides parameter was set successfully. """ self.tsunami.Conf.wDynTides = bool(dynamical_tides) return 0 @@ -832,6 +896,11 @@ def get_alpha(self, alpha: ValueHolder) -> int: ---------- alpha : ValueHolder[float] ValueHolder instance to return alpha value. + + Returns + ------- + 0 : + Alpha parameter was retrieved successfully. """ alpha.value = self.tsunami.Conf.alpha return 0 @@ -844,6 +913,11 @@ def set_alpha(self, alpha: float) -> int: ---------- alpha : float alpha regularization value. + + Returns + ------- + 0 : + Alpha parameter was set successfully. """ self.tsunami.Conf.alpha = alpha return 0 @@ -856,6 +930,11 @@ def get_beta(self, beta: ValueHolder) -> int: ---------- beta : ValueHolder[float] ValueHolder instance to return beta value. + + Returns + ------- + 0 : + Beta parameter was retrieved successfully. """ beta.value = self.tsunami.Conf.beta return 0 @@ -868,6 +947,11 @@ def set_beta(self, beta: float) -> int: ---------- beta : float beta regularization value. + + Returns + ------- + 0 : + Beta parameter was set successfully. """ self.tsunami.Conf.beta = beta return 0 @@ -880,6 +964,11 @@ def get_gamma(self, gamma: ValueHolder) -> int: ---------- gamma : ValueHolder[float] ValueHolder instance to return gamma value. + + Returns + ------- + 0 : + Gamma parameter was retrieved successfully. """ gamma.value = self.tsunami.Conf.gamma return 0 @@ -892,6 +981,11 @@ def set_gamma(self, gamma: float) -> int: ---------- gamma : float gamma regularization value. + + Returns + ------- + 0 : + Gamma parameter was set successfully. """ self.tsunami.Conf.gamma = gamma return 0 @@ -907,6 +1001,11 @@ def get_pn(self, pn: ValueHolder) -> int: ValueHolder instance to return pn value. If `True`, enables post-Newtonian corrections. Ensure that `pn1`, `pn2`, `pn25`, `pn3` or `pn35` is also set. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was retrieved successfully. """ pn.value = self.tsunami.Conf.wPNs return 0 @@ -921,6 +1020,11 @@ def set_pn(self, pn: bool) -> int: pn : bool If `True`, enables post-Newtonian corrections. Ensure that `pn1`, `pn2`, `pn25`, `pn3` or `pn35` is also set. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was set successfully. """ self.tsunami.Conf.wPNs = bool(pn) return 0 @@ -935,6 +1039,11 @@ def get_pn1(self, pn1: ValueHolder) -> int: pn1 : ValueHolder[bool] ValueHolder instance to return pn1 value. If `True`, enables post-Newtonian corrections of order 1. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was retrieved successfully. """ pn1.value = self.tsunami.Conf.pn1 return 0 @@ -948,6 +1057,11 @@ def set_pn1(self, pn1: bool) -> int: ---------- pn1 : bool If True, enables post-Newtonian corrections of order 1. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was set successfully. """ self.tsunami.Conf.pn1 = bool(pn1) return 0 @@ -962,6 +1076,11 @@ def get_pn2(self, pn2: ValueHolder) -> int: pn2 : ValueHolder[bool] ValueHolder instance to return pn2 value. If `True`, enables post-Newtonian corrections of order 2. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was retrieved successfully. """ pn2.value = self.tsunami.Conf.pn2 return 0 @@ -975,6 +1094,11 @@ def set_pn2(self, pn2: bool) -> int: ---------- pn2 : bool If True, enables post-Newtonian corrections of order 2. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was set successfully. """ self.tsunami.Conf.pn2 = bool(pn2) return 0 @@ -989,6 +1113,11 @@ def get_pn25(self, pn25: ValueHolder) -> int: pn25 : ValueHolder[bool] ValueHolder instance to return pn25 value. If `True`, enables post-Newtonian corrections of order 2.5. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was retrieved successfully. """ pn25.value = self.tsunami.Conf.pn25 return 0 @@ -1002,6 +1131,11 @@ def set_pn25(self, pn25: bool) -> int: ---------- pn25 : bool If True, enables post-Newtonian corrections of order 2.5. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was set successfully. """ self.tsunami.Conf.pn25 = bool(pn25) return 0 @@ -1016,6 +1150,11 @@ def get_pn3(self, pn3: ValueHolder) -> int: pn3 : ValueHolder[bool] ValueHolder instance to return pn3 value. If `True`, enables post-Newtonian corrections of order 3. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was retrieved successfully. """ pn3.value = self.tsunami.Conf.pn3 return 0 @@ -1029,6 +1168,11 @@ def set_pn3(self, pn3: bool) -> int: ---------- pn3 : bool If True, enables post-Newtonian corrections of order 3. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was set successfully. """ self.tsunami.Conf.pn3 = bool(pn3) return 0 @@ -1043,6 +1187,11 @@ def get_pn35(self, pn35: ValueHolder) -> int: pn35 : ValueHolder[bool] ValueHolder instance to return pn35 value. If `True`, enables post-Newtonian corrections of order 3.5. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was retrieved successfully. """ pn35.value = self.tsunami.Conf.pn35 return 0 @@ -1056,6 +1205,11 @@ def set_pn35(self, pn35: bool) -> int: ---------- pn35 : bool If True, enables post-Newtonian corrections of order 3.5. + + Returns + ------- + 0 : + Post-Newtonian correction parameter was set successfully. """ self.tsunami.Conf.pn35 = bool(pn35) return 0 @@ -1068,6 +1222,11 @@ def get_potential_energy(self, potential_energy: ValueHolder) -> int: ---------- potential_energy : ValueHolder[float] ValueHolder instance to return the potential energy of the system. + + Returns + ------- + 0 : + Potential energy was retrieved successfully. """ potential_energy.value = self.tsunami.pot return 0 @@ -1080,28 +1239,42 @@ def get_kinetic_energy(self, kinetic_energy: ValueHolder) -> int: ---------- kinetic_energy : ValueHolder[float] ValueHolder instance to return the kinetic energy of the system. + + Returns + ------- + 0 : + Kinetic energy was retrieved successfully. """ kinetic_energy.value = self.tsunami.kin return 0 def get_deltaE(self, deltaE: ValueHolder) -> int: """ - Get fractional energy error `deltaE = (E - E0) / E0` excluding energy losses - due to dissipative terms (tides, post-Newtonians, external potentials) + Get fractional energy error `deltaE = (E - E0) / E0` excluding + energy losses due to dissipative terms (tides, post-Newtonians, + external potentials) Parameters ---------- deltaE : ValueHolder[float] ValueHolder instance to return the fraction energy error value. + + Returns + ------- + 0 : + Energy error was retrieved successfully. """ deltaE.value = self.tsunami.deltaE return 0 def get_time(self, time: ValueHolder) -> int: """ - Get current model time. + Get current model time in N-body units. - tsunami.time returns time in N-body units. + Returns + ------- + 0 : + Current model time was retrieved successfully. """ time.value = self.tsunami.time return 0 @@ -1110,19 +1283,27 @@ def get_number_of_particles(self, number_of_particles: ValueHolder) -> int: """ Get total number of particles in TSUNAMI. - Paramters - --------- + Parameters + ---------- number_of_particles : ValueHolder[int] ValueHolder instance to return the number of particles in TSUNAMI. + + Returns + ------- + 0 : + Number of particles was retrieved successfully. """ number_of_particles.value = len(self._pos) return 0 def _get_particle_index_by_id(self, index_of_the_particle: int) -> int: """ - Given an amuse particle id as returned by `new_particle`, find the + Given an AMUSE particle id as returned by `new_particle`, find the index of that particle in TSUNAMI. + This ensures that `index_of_the_particle` always points to the + correct particle, even after particle deletion. + Parameters ---------- index_of_the_particle : int @@ -1135,14 +1316,21 @@ def _get_particle_index_by_id(self, index_of_the_particle: int) -> int: return int(idx[0]) def _get_new_id(self) -> int: - """Create a unique, monotonically increasing id for `new_particle`.""" + """ + Create a unique, monotonically increasing id for `new_particle`. + + Returns + ------- + int : + New particle id to be assigned. + """ new_id = self._next_particle_id self._next_particle_id += 1 return int(new_id) def _clear_temporary_particle_buffers(self) -> None: - """Clear temporary particle buffers after commiting particles.""" + """Clear temporary particle buffers after committing particles.""" self._id_list.clear() self._mass_list.clear() self._radius_list.clear() @@ -1180,7 +1368,9 @@ def evolve_model_dtmax(time='d'): def new_particle(): function = LegacyFunctionSpecification() function.can_handle_array = True - function.addParameter('index_of_the_particle', dtype='i', direction=function.OUT) + function.addParameter( + 'index_of_the_particle', dtype='i', direction=function.OUT + ) for name in ['mass', 'radius', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'wx', 'wy', 'wz']: function.addParameter(name, dtype='d', direction=function.IN) function.result_type = 'i' @@ -1194,7 +1384,9 @@ def new_particle(): def get_state(): function = LegacyFunctionSpecification() function.can_handle_array = True - function.addParameter('index_of_the_particle', dtype='i', direction=function.IN) + function.addParameter( + 'index_of_the_particle', dtype='i', direction=function.IN + ) for name in ['mass', 'radius', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'wx', 'wy', 'wz']: function.addParameter(name, dtype='d', direction=function.OUT) function.result_type = 'i' @@ -1208,7 +1400,9 @@ def get_state(): def set_state(): function = LegacyFunctionSpecification() function.can_handle_array = True - function.addParameter('index_of_the_particle', dtype='i', direction=function.IN) + function.addParameter( + 'index_of_the_particle', dtype='i', direction=function.IN + ) for name in ['mass', 'radius', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'wx', 'wy', 'wz']: function.addParameter(name, dtype='d', direction=function.IN) function.result_type = 'i' @@ -1230,19 +1424,6 @@ def get_speed_of_light(): def get_deltaE(): returns (deltaE='d') - @legacy_function - def get_time(): - function = LegacyFunctionSpecification() - function.addParameter('time', dtype='d', direction=function.OUT) - function.result_type = 'i' - function.result_doc = """ - 0 - OK - System was evolved to time - -1 - ERROR - Requested time is <= current model time - """ - return function - @remote_function def get_equilibrium_tides(): returns (equilibrium_tides='b') From af163a552c685f9835e0fd1aa747407614ec4be6 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 11 Sep 2026 16:11:01 +0200 Subject: [PATCH 122/132] refactor tsunami.commit_particles to use more robust set logic for checking input particle data shapes --- src/amuse_tsunami/interface.py | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index 85b5ecf3e0..f2fe2bcd83 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -88,14 +88,17 @@ def commit_particles(self) -> int: as well as any new particles inside the temporary buffers and formats them as numpy arrays to be read by TSUNAMI. - This method should only be called after 2 new particles were added. - Calling this method with no new particles in the buffers does nothing. + This method should only be called if at least 2 particles exist + between committed and buffered particles. Calling this method + with no new particles in the buffers does nothing. Returns ------- - 0 : If particles were added to TSUNAMI succesfully or if no - new particles are available to be added. - -1 : If the shapes of the particleset arrays dont match. + 0 : + If particles were added to TSUNAMI successfully or if no new + particles are available to be added. + -1 : + If the temporary particle buffers have inconsistent lengths. Raises ------ @@ -103,8 +106,23 @@ def commit_particles(self) -> int: If the total particle count is less than 2 particles between the pre-existing particles and the particles in the buffer. """ + buffer_lengths = { + len(self._id_list), + len(self._mass_list), + len(self._radius_list), + len(self._pos_list), + len(self._vel_list), + len(self._spin_list), + } + # if no new particles to add + if len(buffer_lengths) == 0: + return 0 + # if shape mismatch between particle buffers + if len(buffer_lengths) != 1: + return -1 + N_existing: int = self._pos.shape[0] - N_new: int = len(self._pos_list) + N_new: int = buffer_lengths.pop() N_total: int = N_existing + N_new if N_new == 0: From 13f1cb1a32856482ae92a98be17ab35249717787 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 11 Sep 2026 16:11:42 +0200 Subject: [PATCH 123/132] add omitted logic for deleting stypes in delete_particle --- src/amuse_tsunami/interface.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index f2fe2bcd83..bfc2c9580a 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -351,6 +351,7 @@ def delete_particle(self, index_of_the_particle: int) -> int: self._pos = np.delete(self._pos, i, axis=0) self._vel = np.delete(self._vel, i, axis=0) self._spin = np.delete(self._spin, i, axis=0) + self._stype = np.delete(self._stype, i) self.tsunami.remove_particle(i) self.synchronize_model() From 0e86aa6daab3a622bee4c1b1a7636cacd27b1ad3 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 11 Sep 2026 16:12:11 +0200 Subject: [PATCH 124/132] docstring for initialize_tidal_parameters --- src/amuse_tsunami/interface.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/amuse_tsunami/interface.py b/src/amuse_tsunami/interface.py index bfc2c9580a..a84fd8481a 100644 --- a/src/amuse_tsunami/interface.py +++ b/src/amuse_tsunami/interface.py @@ -896,6 +896,36 @@ def initialize_tidal_parameters( gyrad: NDArray[np.float64], N: int ) -> int: + """ + Initialize tidal parameters for all particles in TSUNAMI. + + Parameters + ---------- + kaps : NDArray[np.float64] + Apsidal motion constant (love number) for each particle + in dimensionless units. + taulag : NDArray[np.float64] + Tidal lag time for each particle in units of time. + polyt : NDArray[np.float64] + Polytropic index for each particle in dimensionless units. + gyrad : NDArray[np.float64] + Gyration radius for each particle in dimensionless units. + N : int + Number of particles. Must match the length of `kaps`, + `taulag`, `polyt`, and `gyrad`. Is used internally by AMUSE + and is not set by the caller. + + Returns + ------- + 0 : + Tidal parameters were initialized successfully. + + Raises + ------ + ValueError : + If `kaps`, `taulag`, `polyt`, or `gyrad` do not all have + length `N`. + """ if any(len(arr) != N for arr in [kaps, taulag, polyt, gyrad]): raise ValueError( f'All tidal parameter arrays must have the same length ({N}) ' From 2cb4ab040fe25f3bef0168916241a7e1c63e8a2a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 11 Sep 2026 16:15:16 +0200 Subject: [PATCH 125/132] cleanup tsunami interfaces --- src/amuse_tsunami/Makefile | 1 - src/amuse_tsunami/packages/amuse-tsunami.amuse_deps | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/amuse_tsunami/Makefile b/src/amuse_tsunami/Makefile index 635aae3e6f..b40633e872 100644 --- a/src/amuse_tsunami/Makefile +++ b/src/amuse_tsunami/Makefile @@ -10,7 +10,6 @@ src/tsunami-master: | tsunami-master.tar.gz tar xf $< mv tsunami-master src/ -# NOTE: how do stopconds work when in python only mode? .PHONY: install_tsunami install_tsunami: | src/tsunami-master diff --git a/src/amuse_tsunami/packages/amuse-tsunami.amuse_deps b/src/amuse_tsunami/packages/amuse-tsunami.amuse_deps index 35646e5605..e7b5293b1a 100644 --- a/src/amuse_tsunami/packages/amuse-tsunami.amuse_deps +++ b/src/amuse_tsunami/packages/amuse-tsunami.amuse_deps @@ -1 +1 @@ -c c++ cmake \ No newline at end of file +c++ cmake python From fdee37f5d0594c6539248fb16897b21a6dcadd22 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 11 Sep 2026 16:19:10 +0200 Subject: [PATCH 126/132] clean up tsunami tests --- src/amuse_tsunami/tests/test_tsunami.py | 40 ++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index a179343d77..62742e2e5e 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -8,8 +8,8 @@ from amuse.datamodel import Particle, Particles from amuse.ext.orbital_elements import generate_binaries, orbital_elements from amuse.support.testing.amusetest import TestWithMPI -from amuse_tsunami.interface import TsunamiInterface, Tsunami -from amuse.units import constants as c, nbody_system as ns, units as u +from amuse.community.tsunami.interface import Tsunami, TsunamiInterface +from amuse.units import nbody_system as ns, units as u # if True, show comparison plots for certain tests show_plots = False @@ -360,7 +360,7 @@ def generate_earth_moon_initial_conditions(self): return p - def validate_tsunami_state_equality(self, state: list, particle: Particle) -> None: + def _validate_tsunami_state_equality(self, state: list, particle: Particle) -> None: """ Validate that a state retrieved by `Tsunami.get_state` matches the state of `particle` exactly. @@ -391,7 +391,7 @@ def validate_tsunami_state_equality(self, state: list, particle: Particle) -> No self.assertEquals(state[10], particle.wz) - def validate_tsunami_state_relative_equality( + def _validate_tsunami_state_relative_equality( self, state: list, particle: Particle, @@ -445,9 +445,9 @@ def test_add_and_delete_particles(self): state1 = instance.get_state(1) state2 = instance.get_state(2) - self.validate_tsunami_state_equality(state0, system[0]) - self.validate_tsunami_state_equality(state1, system[1]) - self.validate_tsunami_state_equality(state2, system[2]) + self._validate_tsunami_state_equality(state0, system[0]) + self._validate_tsunami_state_equality(state1, system[1]) + self._validate_tsunami_state_equality(state2, system[2]) self.assertEquals(system[0].key, instance.particles[0].key) self.assertEquals(system[1].key, instance.particles[1].key) @@ -459,8 +459,8 @@ def test_add_and_delete_particles(self): state1 = instance.get_state(1) state2 = instance.get_state(2) - self.validate_tsunami_state_equality(state1, system[1]) - self.validate_tsunami_state_equality(state2, system[2]) + self._validate_tsunami_state_equality(state1, system[1]) + self._validate_tsunami_state_equality(state2, system[2]) instance.stop() @@ -592,9 +592,9 @@ def test_delete_particle_and_restart(self): state0 = instance.get_state(3) state1 = instance.get_state(1) state2 = instance.get_state(2) - self.validate_tsunami_state_relative_equality(state0, pars[0], places=10) - self.validate_tsunami_state_relative_equality(state1, pars[1], places=10) - self.validate_tsunami_state_relative_equality(state2, pars[2], places=10) + self._validate_tsunami_state_relative_equality(state0, pars[0], places=10) + self._validate_tsunami_state_relative_equality(state1, pars[1], places=10) + self._validate_tsunami_state_relative_equality(state2, pars[2], places=10) t_end = 65 | ns.time dt = 0.1 | ns.time @@ -638,16 +638,16 @@ def test_tsunami_does_not_rescale_to_com_frame(self): state1 = instance.get_state(1) state2 = instance.get_state(2) - self.validate_tsunami_state_equality(state0, p[0]) - self.validate_tsunami_state_equality(state1, p[1]) - self.validate_tsunami_state_equality(state2, p[2]) + self._validate_tsunami_state_equality(state0, p[0]) + self._validate_tsunami_state_equality(state1, p[1]) + self._validate_tsunami_state_equality(state2, p[2]) instance.delete_particle(1) state0 = instance.get_state(0) state2 = instance.get_state(2) - self.validate_tsunami_state_relative_equality(state0, p[0]) - self.validate_tsunami_state_relative_equality(state2, p[2]) + self._validate_tsunami_state_relative_equality(state0, p[0]) + self._validate_tsunami_state_relative_equality(state2, p[2]) instance.set_mass(0, 4 | ns.mass) instance.set_position(0, 67 | ns.length, 68 | ns.length, 69 | ns.length) @@ -674,13 +674,13 @@ def test_tsunami_does_not_rescale_to_com_frame(self): instance.particles.add_particle(p3) state3 = instance.get_state(3) - self.validate_tsunami_state_equality(state3, p3) + self._validate_tsunami_state_equality(state3, p3) # check that particles 0 and 2 have not changed state0 = instance.get_state(0) state2 = instance.get_state(2) - self.validate_tsunami_state_relative_equality(state0, instance.particles[0]) - self.validate_tsunami_state_relative_equality(state2, instance.particles[2]) + self._validate_tsunami_state_relative_equality(state0, instance.particles[0]) + self._validate_tsunami_state_relative_equality(state2, instance.particles[2]) instance.stop() From 37fb024c83fb0ac3197f5264d7b9a7e5429fe13f Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 11 Sep 2026 16:28:41 +0200 Subject: [PATCH 127/132] add tsunami README detailing installation notes --- src/amuse_tsunami/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/amuse_tsunami/README.md diff --git a/src/amuse_tsunami/README.md b/src/amuse_tsunami/README.md new file mode 100644 index 0000000000..8fccdf6851 --- /dev/null +++ b/src/amuse_tsunami/README.md @@ -0,0 +1,9 @@ +Tsunami is a private code and therefore cannot be shipped with AMUSE. + +To use Tsunami, contact Dr. Alessandro Alberto Trani for access to the +gitlab repository. + +To compile the interface, download the the `tsunami-master.tar.gz` file +from the gitlab repository. Please ensure that the file is named exactly +as above. Place the file inside `amuse/src/amuse_tsunami/` (where the tsunami +interface lives), then compile Tsunami like any other AMUSE community code. From 1e45a7d847d8a1b67609b88844ff627a58514da2 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 11 Sep 2026 16:37:35 +0200 Subject: [PATCH 128/132] rm unused tsunami interface.cc: --- src/amuse_tsunami/interface.cc | 912 --------------------------------- 1 file changed, 912 deletions(-) delete mode 100644 src/amuse_tsunami/interface.cc diff --git a/src/amuse_tsunami/interface.cc b/src/amuse_tsunami/interface.cc deleted file mode 100644 index f52d48b69f..0000000000 --- a/src/amuse_tsunami/interface.cc +++ /dev/null @@ -1,912 +0,0 @@ -#include -#include -#include -#include - -#include "tsunami_worker.h" - -// AMUSE STOPPING CONDITIONS SUPPORT -#include -#include -#include - -#include "chain.hpp" -#include "custom_types.hpp" -#include "errhand.hpp" -#include "tsunami.hpp" - -static TsunamiCode Tsunami; - -int particle_id_counter = 0; - -struct ParticleData { - double mass; - double pos[3]; - double vel[3]; - double radius; - double spin[3]; - long stype; -}; -std::vector particle_buffer; - - -/** - * Check that the index_of_the_particle points to - * an actual particle inside of Tsunami - */ -inline bool index_in_bounds(int index_of_the_particle) -{ - const ChainSys& system = Tsunami.System; - - return index_of_the_particle >= 0 && - index_of_the_particle < static_cast(system.Npart); -} - - -/** - * Define a new particle within Tsunami, initialized with the - * provided mass, radius, position, velocity, spin, and particle type. - * The particle type at the moment does nothing and is just 0 of type double. - * In the future, it seems stype could be used to specify a particle as a - * specific astronomical object, however this has not been implemented yet. - * This function returns an index that can be used to refer to this particle. - */ -int new_particle( - int* index_of_the_particle, - double mass, - double x, - double y, - double z, - double vx, - double vy, - double vz, - double radius, - double wx, - double wy, - double wz, - long stype -) { - if (!index_of_the_particle) return -1; - - ParticleData p = { - mass, - {x, y, z}, - {vx, vy, vz}, - radius, - {wx, wy, wz}, - stype - }; - - particle_buffer.push_back(p); - *index_of_the_particle = particle_id_counter; - particle_id_counter++; - return 0; -} - - -/** - * Commits all new particles into Tsunami - * - * Pre-existing particles along any new particles added to - * the buffer are copied into a set of arrays and passed to - * Tsunami.add_particle_set which reallocates all the arrays - * within Tsunami and copies the particles over. - */ -int commit_particles() { - - size_t N_existing = Tsunami.System.Npart; - size_t N_new = particle_buffer.size(); - size_t N_total = N_existing + N_new; - - // no new particles - if (N_new == 0) - return 0; - // not enough particles to commit - if (N_total < 2) - return -1; - - // preallocate vectors - std::vector pos(3 * N_total); - std::vector vel(3 * N_total); - std::vector spin(3 * N_total); - std::vector mass(N_total); - std::vector radius(N_total); - std::vector stype(N_total); - - for (size_t i = 0; i < N_existing; i++) { - pos[3*i] = Tsunami.System.pos[i].x; - pos[3*i + 1] = Tsunami.System.pos[i].y; - pos[3*i + 2] = Tsunami.System.pos[i].z; - - vel[3*i] = Tsunami.System.vel[i].x; - vel[3*i + 1] = Tsunami.System.vel[i].y; - vel[3*i + 2] = Tsunami.System.vel[i].z; - - spin[3*i] = Tsunami.System.spin[i][0]; - spin[3*i + 1] = Tsunami.System.spin[i][1]; - spin[3*i + 2] = Tsunami.System.spin[i][2]; - - mass[i] = Tsunami.System.mass[i]; - radius[i] = Tsunami.System.radius[i]; - stype[i] = static_cast(Tsunami.System.xdata[i].stype); - - } - for (size_t i = 0; i < N_new; i++) { - size_t idx = N_existing + i; - const ParticleData& p = particle_buffer[i]; - - pos[3*idx] = p.pos[0]; - pos[3*idx + 1] = p.pos[1]; - pos[3*idx + 2] = p.pos[2]; - - vel[3*idx] = p.vel[0]; - vel[3*idx + 1] = p.vel[1]; - vel[3*idx + 2] = p.vel[2]; - - spin[3*idx] = p.spin[0]; - spin[3*idx + 1] = p.spin[1]; - spin[3*idx + 2] = p.spin[2]; - - mass[idx] = p.mass; - radius[idx] = p.radius; - stype[idx] = p.stype; - } - - Tsunami.add_particle_set( - pos.data(), N_total, 3, - vel.data(), N_total, 3, - mass.data(), N_total, - radius.data(), N_total, - stype.data(), N_total, - spin.data(), N_total, 3 - ); - // clear particle buffer - particle_buffer.clear(); - - return 0; -} - -/** - * Get state of a particle - */ -int get_state( - int index_of_the_particle, - double* mass, - double* x, - double* y, - double* z, - double* vx, - double* vy, - double* vz, - double* radius, - double* wx, - double* wy, - double* wz, - long* stype -) { - if (!mass || !x || !y || !z || !vx || !vy || !vz || - !radius || !wx || !wy || !wz || !stype) return -1; - - ChainSys& system = Tsunami.System; - - if (!index_in_bounds(index_of_the_particle)) - return -1; - - *x = system.pos[index_of_the_particle].x; - *y = system.pos[index_of_the_particle].y; - *z = system.pos[index_of_the_particle].z; - - *vx = system.vel[index_of_the_particle].x; - *vy = system.vel[index_of_the_particle].y; - *vz = system.vel[index_of_the_particle].z; - - *wx = system.spin[index_of_the_particle][0]; - *wy = system.spin[index_of_the_particle][1]; - *wz = system.spin[index_of_the_particle][2]; - - *mass = system.mass[index_of_the_particle]; - *radius = system.radius[index_of_the_particle]; - *stype = static_cast(system.xdata[index_of_the_particle].stype); - - return 0; -} -/** - * Set state of a particle - */ -int set_state( - int index_of_the_particle, - double mass, - double x, - double y, - double z, - double vx, - double vy, - double vz, - double radius, - double wx, - double wy, - double wz, - long stype -) { - ChainSys& system = Tsunami.System; - - if (!index_in_bounds(index_of_the_particle)) - return -1; - - system.pos[index_of_the_particle].x = x; - system.pos[index_of_the_particle].y = y; - system.pos[index_of_the_particle].z = z; - - system.vel[index_of_the_particle].x = x; - system.vel[index_of_the_particle].y = y; - system.vel[index_of_the_particle].z = z; - - system.spin[index_of_the_particle][0] = wx; - system.spin[index_of_the_particle][1] = wy; - system.spin[index_of_the_particle][2] = wz; - - system.mass[index_of_the_particle] = mass; - system.radius[index_of_the_particle] = radius; - system.xdata[index_of_the_particle].stype = static_cast(stype); - - return 0; -} - -/** - * Get mass of a particle - */ -int get_mass(int index_of_the_particle, double* mass) { - if (!mass) return -1; - - ChainSys& system = Tsunami.System; - - if (!index_in_bounds(index_of_the_particle)) - return -1; - - *mass = system.mass[index_of_the_particle]; - - return 0; -} -/** - * Set mass of a particle - */ -int set_mass(int index_of_the_particle, double mass) { - ChainSys& system = Tsunami.System; - - if (!index_in_bounds(index_of_the_particle)) - return -1; - - system.mass[index_of_the_particle] = mass; - - return 0; -} - -/** - * Get radius of a particle - */ -int get_radius(int index_of_the_particle, double* radius) { - if (!radius) return -1; - - ChainSys& system = Tsunami.System; - - if (!index_in_bounds(index_of_the_particle)) - return -1; - - *radius = system.radius[index_of_the_particle]; - - return 0; -} -/** - * Set radius of a particle - */ -int set_radius(int index_of_the_particle, double radius) { - ChainSys& system = Tsunami.System; - - if (!index_in_bounds(index_of_the_particle)) - return -1; - - system.radius[index_of_the_particle] = radius; - - return 0; -} - -/** - * Get position of a particle - */ -int get_position(int index_of_the_particle, double* x, double* y, double* z) { - if (!x || !y || !z) return -1; - - ChainSys& system = Tsunami.System; - - if (!index_in_bounds(index_of_the_particle)) - return -1; - - *x = system.pos[index_of_the_particle].x; - *y = system.pos[index_of_the_particle].y; - *z = system.pos[index_of_the_particle].z; - - return 0; -} -/** - * Set position of a particle - */ -int set_position(int index_of_the_particle, double x, double y, double z) { - ChainSys& system = Tsunami.System; - - if (!index_in_bounds(index_of_the_particle)) - return -1; - - system.pos[index_of_the_particle].x = x; - system.pos[index_of_the_particle].y = y; - system.pos[index_of_the_particle].z = z; - - return 0; -} - -/** - * Get velocity of a particle - */ -int get_velocity(int index_of_the_particle, double* vx, double* vy, double* vz) { - if (!vx || !vy || !vz) return -1; - - ChainSys& system = Tsunami.System; - - if (!index_in_bounds(index_of_the_particle)) - return -1; - - *vx = system.vel[index_of_the_particle].x; - *vy = system.vel[index_of_the_particle].y; - *vz = system.vel[index_of_the_particle].z; - - return 0; -} -/** - * Set velocity of a particle - */ -int set_velocity(int index_of_the_particle, double vx, double vy, double vz) { - ChainSys& system = Tsunami.System; - - if (!index_in_bounds(index_of_the_particle)) - return -1; - - system.vel[index_of_the_particle].x = vx; - system.vel[index_of_the_particle].y = vy; - system.vel[index_of_the_particle].z = vz; - - return 0; -} - -/** - * Compute the acceleration onto a particle due to the - * gravitational influence from all other particles - */ -int get_acceleration( - int index_of_the_particle, - double *ax, - double *ay, - double *az -) { - ChainSys& system = Tsunami.System; - int i = index_of_the_particle; - - double ax_i = 0.0; - double ay_i = 0.0; - double az_i = 0.0; - - for (size_t j = i; j < system.Npart; j++) { - if (i == j) continue; - std::tuple, std::array> accel_pair = - Tsunami.get_accelerations_of_particles(i, j); - - const std::array& acc_i = std::get<0>(accel_pair); - - ax_1 += acc_i[0]; - ay_1 += acc_i[1]; - az_1 += acc_i[2]; - } - - *ax = ax_i; - *ay = ay_i; - *az = az_i; - - return 0; -} - -/** - * Set Tsunami code units - */ -int set_units(double Mscale, double Lscale) { - - Tsunami.set_units(Mscale, Lscale); - return 0; -} - -/** - * Get post-Newtonian correction flag value - * True enables post-Newtonian corrections - */ -int get_wPNs(bool *wPNs) { - if (!wPNs) return -1; - - *wPNs = Tsunami.Conf.wPNs; - return 0; -} -/** - * Set post-Newtonian correction flag value - * True enables post-Newtonian corrections - */ -int set_wPNs(bool wPNs) { - - Tsunami.Conf.wPNs = wPNs; - return 0; -} - -/** - * Get equilibrium tides flag value - * True enables equilibrium tides - */ -int get_wEqTides(bool *wEqTides) { - if (!wEqTides) return -1; - - *wEqTides = Tsunami.Conf.wEqTides; - return 0; -} -/** - * Set equilibrium tides flag value - * True enables equilibrium tides - */ -int set_wEqTides(bool wEqTides) { - - Tsunami.Conf.wEqTides = wEqTides; - return 0; -} - -/** - * Get external potential flag value - * True enables external potentials - */ -int get_wExt(bool *wExt) { - if (!wExt) return -1; - - *wExt = Tsunami.Conf.wExt; - return 0; -} -/** - * Set external potential flag value - * True enables external potentials - */ -int set_wExt(bool wExt) { - - Tsunami.Conf.wExt = wExt; - return 0; -} - -/** - * get external potential flag value - * True enables external potentials - */ -int get_wExt_vdep(bool *wExt_vdep) { - if (!wExt_vdep) return -1; - - *wExt_vdep = Tsunami.Conf.wExt_vdep; - return 0; -} -/** - * set external potential flag value - * True enables external potentials - */ -int set_wExt_vdep(bool wExt_vdep) { - - Tsunami.Conf.wExt_vdep = wExt_vdep; - return 0; -} - -/** - * get alpha regularization parameter - */ -int get_alpha(double *alpha) { - if (!alpha) return -1; - - *alpha = Tsunami.Config.alpha; - return 0; -} -/** - * set alpha regularization parameter - */ -int set_alpha(double alpha) { - - Tsunami.Config.alpha = alpha; - return 0; -} - -/** - * get beta regularization parameter - */ -int get_beta(double *beta) { - if (!beta) return -1; - - *beta = Tsunami.Config.beta - return 0; -} -/** - * set beta regularization parameter - */ -int set_beta(double beta) { - - Tsunami.Config.beta = beta; - return 0; -} - -/** - * get gamma regularization parameter - */ -int get_gamma(double *gamma) { - if (!gamma) return -1; - - *gamma = Tsunami.Config.gamma - return 0; -} -/** - * set gamma regularization parameter - */ -int set_gamma(double gamma) { - - Tsunami.Config.gamma = gamma; - return 0; -} - -/** - * get multiplying factor for particle radii that is - * used when checking for collisions. A collision - * between two particles is registered whenever: - * d < d_coll * (R1 + R2) - */ -int get_dcoll(double *dcoll) { - if (!dcoll) return -1; - - *dcoll = Tsunami.Config.dcoll - return 0; -} -/** - * set multiplying factor for particle radii that is - * used when checking for collisions. A collision - * between two particles is registered whenever: - * d < d_coll * (R1 + R2) - */ -int set_dcoll(double dcoll) { - - Tsunami.Config.dcoll = dcoll; - return 0; -} - -/** - * get pn1 flag value - * True enables first order post-Newtonian corrections - */ -int get_pn1(double *pn1) { - if (!pn1) return -1; - - *pn1 = Tsunami.Config.pn1 - return 0; -} -/** - * set pn1 flag value - * True enables first order post-Newtonian corrections - */ -int set_pn1(double pn1) { - - Tsunami.Config.pn1 = pn1; - return 0; -} - -/** - * get pn2 flag value - * True enables second order post-Newtonian corrections - */ -int get_pn2(double *pn2) { - if (!pn2) return -1; - - *pn2 = Tsunami.Config.pn2; - return 0; -} -/** - * set pn2 flag value - * True enables second order post-Newtonian corrections - */ -int set_pn2(double pn2) { - - Tsunami.Config.pn2 = pn2; - return 0; -} - -/** - * get pn2 flag value - * True enables 2.5 order post-Newtonian corrections - */ -int get_pn25(double *pn25) { - if (!pn25) return -1; - - *pn25 = Tsunami.Config.pn25; - return 0; -} -/** - * set pn25 flag value - * True enables 2.5 order post-Newtonian corrections - */ -int set_pn25(double pn25) { - - Tsunami.Config.pn25 = pn25; - return 0; -} - -/** - * get pn3 flag value - * True enables third order post-Newtonian corrections - */ -int get_pn3(double *pn3) { - if (!pn3) return -1; - - *pn3 = Tsunami.Config.pn3; - return 0; -} -/** - * set pn3 flag value - * True enables third order post-Newtonian corrections - */ -int set_pn3(double pn3) { - - Tsunami.Config.pn3 = pn3; - return 0; -} - -/** - * get pn35 flag value - * True enables 3.5 order post-Newtonian corrections - */ -int get_pn35(double *pn35) { - if (!pn35) return -1; - - *pn35 = Tsunami.Config.pn35; - return 0; -} -/** - * set pn35 flag value - * True enables 3.5 order post-Newtonian corrections - */ -int set_pn35(double pn35) { - - Tsunami.Config.pn35 = pn35; - return 0; -} - -/** - * Evolve Tsunami system - */ -int evolve_model(double time) { - try { - Tsunami.evolve_system(time); - return 0; - } catch (const TsuError& e) { //FIXME - std::cerr << "evolve_model error: " << e.what() << std::endl; - return -1; - } -} - -/** - * Get total kinetic energy of the system - */ -int get_kinetic_energy(double *kinetic_energy) { - if (!kinetic_energy) return -1; - - *kinetic_energy = Tsunami.kin; - return 0; -} - -/** - * Get total potential energy of the system - */ -int get_potential_energy(double *potential_energy) { - if (!potential_energy) return -1; - - *potential_energy = Tsunami.pot; - return 0; -} - -/** - * Get total energy of the system - */ -int get_total_energy(double *total_energy) { - if (!total_energy) return -1; - - *total_energy = Tsunami.energy; - return 0; -} - -/** - * Get current simulation timescale in years - */ -int get_time(double *time) { - if (!time) return -1; - - *time = Tsunami.Tscale; - return 0; -} - -/** - * Get total mass of all particles in Tsunami - */ -int get_total_mass(double *mass) { - if (!mass) return -1; - - ChainSys& system = Tsunami.System; - double m_total = 0.0; - - for (size_t i = 0; i < system.Npart; i++) { - m_total += system.mass[i]; - } - - *mass = m_total; - return 0; -} - -/** - * Get position center of mass of all particles - */ -int get_center_of_mass_position(double *x, double *y, double *z) { - if (!x || !y || !z) return -1; - - ChainSys& system = Tsunami.System; - size_t Npart = system.Npart; - - if (Npart == 0) { // FIXME - *x = 0.0; - *y = 0.0; - *z = 0.0; - return 0; - } - - double m_total = 0.0; - double xcom = 0.0; - double ycom = 0.0; - double zcom = 0.0; - - for (size_t i = 0; i < Npart; i++) { - m_total += system.mass[i]; - xcom += system.mass[i] * system.pos[i].x; - ycom += system.mass[i] * system.pos[i].y; - zcom += system.mass[i] * system.pos[i].z; - } - - if (m_total == 0) - return -1; - - *x = xcom / m_total; - *y = ycom / m_total; - *z = zcom / m_total; - - return 0; -} - -/** - * Get velocity center of mass of all particles - */ -int get_center_of_mass_velocity(double *vx, double *vy, double *vz) { - if (!vx || !vy || !vz) return -1; - - ChainSys& system = Tsunami.System; - size_t Npart = system.Npart; - - if (Npart == 0) { // FIXME - *vx = 0.0; - *vy = 0.0; - *vz = 0.0; - return 0; - } - - double m_total = 0.0; - double vxcom = 0.0; - double vycom = 0.0; - double vzcom = 0.0; - - for (size_t i = 0; i < Npart; i++) { - m_total += system.mass[i]; - vxcom += system.mass[i] * system.vel[i].x; - vycom += system.mass[i] * system.vel[i].y; - vzcom += system.mass[i] * system.vel[i].z; - } - - if (m_total == 0) - return -1; - - *vx = vxcom / m_total; - *vy = vycom / m_total; - *vz = vzcom / m_total; - - return 0; -} - -/** - * Get the minimum radius of a sphere centered around - * the center of mass of all particles that contains - * every particle within Tsunami - */ -int get_total_radius(double *radius) { - if (!radius) return -1; - - ChainSys& system = Tsunami.System; - double xcom, ycom, zcom; - double rsq_max = 0.0; - - // compute the COM - if (get_center_of_mass_position(&xcom, &ycom, &zcom) != 0) - return -1; - - for (size_t i = 0; i < system.Npart; i++) { - // compute distance between particle and COM - double dx = system.pos[i].x - xcom; - double dy = system.pos[i].y - ycom; - double dz = system.pos[i].z - zcom; - - double r_sq = dx*dx + dy*dy + dz*dz; - if (rsq_max < r_sq) - rsq_max = r_sq; - } - - *radius = std::sqrt(rsq_max); - return 0; -} - -/** - * Get number of particles in Tsunami - */ -int get_number_of_particles(int* number_of_particles) { - if (!number_of_particles) return -1; - - ChainSys& system = Tsunami.System; - - std::vector pos(3 * N_total) = Tsunami.System.pos; - - *number_of_particles = static_cast(Tsunami.System.Npart); - return 0; -} - -/** - * Get the index of the first particle - */ -int get_index_of_first_particle(int *index_of_the_particle) -{ - if (!index_of_the_particle) - return -1; - - ChainSys& system = Tsunami.System; - - if (system.Npart == 0) - return -1; - - *index_of_the_particle = 0; - - return 0; -} - -/** - * Get the index of the next particle - * given a particle index - */ -int get_index_of_next_particle( - int index_of_the_particle, - int *index_of_the_next_particle -) { - if (!index_of_the_next_particle) - return -1; - - ChainSys& system = Tsunami.System; - - int next = index_of_the_particle + 1; - - if (next >= (int)system.Npart) - return -1; - - *index_of_the_next_particle = next; - - return 0; -} From 77d36243f7b47fd7b612e1dbd0142ab0ed3b3af8 Mon Sep 17 00:00:00 2001 From: Elko Gerville-Reache <129769199+elkogerville@users.noreply.github.com> Date: Fri, 11 Sep 2026 16:40:11 +0200 Subject: [PATCH 129/132] Update test_tupan.py --- src/amuse_tupan/tests/test_tupan.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/amuse_tupan/tests/test_tupan.py b/src/amuse_tupan/tests/test_tupan.py index 655bfb317e..dd88f0f3c2 100644 --- a/src/amuse_tupan/tests/test_tupan.py +++ b/src/amuse_tupan/tests/test_tupan.py @@ -10,7 +10,6 @@ from amuse_tupan.interface import TupanInterface, Tupan, MODULES_MISSING except ImportError: MODULES_MISSING = True -print(MODULES_MISSING) class TestTupanInterface(TestWithMPI): From 2660609d3bfbab196658c76c3cd8acb512b5ea2d Mon Sep 17 00:00:00 2001 From: Elko Gerville-Reache <129769199+elkogerville@users.noreply.github.com> Date: Fri, 11 Sep 2026 16:40:56 +0200 Subject: [PATCH 130/132] Update test_tupan.py --- src/amuse_tupan/tests/test_tupan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse_tupan/tests/test_tupan.py b/src/amuse_tupan/tests/test_tupan.py index dd88f0f3c2..7e5460e813 100644 --- a/src/amuse_tupan/tests/test_tupan.py +++ b/src/amuse_tupan/tests/test_tupan.py @@ -176,7 +176,7 @@ def test01(self): def test02(self): if MODULES_MISSING: self.skip("Failed to import a module required for Tupan") - print("Testing Tupan parameters") + print("Testing Tupan default parameters") instance = Tupan(converter=self.default_converter) # instance = self.new_instance_of_an_optional_code(Tupan, self.default_converter) instance.initialize_code() From 12e2f100d75e18a4c9482f73a817cccd82743761 Mon Sep 17 00:00:00 2001 From: Elko Gerville-Reache <129769199+elkogerville@users.noreply.github.com> Date: Fri, 11 Sep 2026 16:41:34 +0200 Subject: [PATCH 131/132] Update test_tupan.py --- src/amuse_tupan/tests/test_tupan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amuse_tupan/tests/test_tupan.py b/src/amuse_tupan/tests/test_tupan.py index 7e5460e813..f6c32bdfab 100644 --- a/src/amuse_tupan/tests/test_tupan.py +++ b/src/amuse_tupan/tests/test_tupan.py @@ -11,6 +11,7 @@ except ImportError: MODULES_MISSING = True + class TestTupanInterface(TestWithMPI): def test01(self): @@ -177,8 +178,7 @@ def test02(self): if MODULES_MISSING: self.skip("Failed to import a module required for Tupan") print("Testing Tupan default parameters") - instance = Tupan(converter=self.default_converter) - # instance = self.new_instance_of_an_optional_code(Tupan, self.default_converter) + instance = self.new_instance_of_an_optional_code(Tupan, self.default_converter) instance.initialize_code() self.assertEquals(instance.parameters.timestep_parameter, 0.03125) From 158e11f231e8885c8e67744e1043944978327d96 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 11 Sep 2026 16:44:43 +0200 Subject: [PATCH 132/132] fixed whitespace issues in tsunami tests --- src/amuse_tsunami/tests/test_tsunami.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/amuse_tsunami/tests/test_tsunami.py b/src/amuse_tsunami/tests/test_tsunami.py index 62742e2e5e..67a5459fd7 100644 --- a/src/amuse_tsunami/tests/test_tsunami.py +++ b/src/amuse_tsunami/tests/test_tsunami.py @@ -484,7 +484,7 @@ def test_tsunami_pythagorean_triple(self): t_end = 65 | ns.time dt = 0.1 | ns.time - while instance.model_time < t_end: + while instance.model_time < t_end: instance.evolve_model(instance.model_time + dt) # validate energies @@ -568,7 +568,7 @@ def test_delete_particle_and_restart(self): t_midpoint = 30 | ns.time dt = 0.1 | ns.time - while instance.model_time < t_midpoint: + while instance.model_time < t_midpoint: instance.evolve_model(instance.model_time + dt) channel.copy() particles.append(system.copy()) @@ -598,7 +598,7 @@ def test_delete_particle_and_restart(self): t_end = 65 | ns.time dt = 0.1 | ns.time - while instance.model_time < t_end: + while instance.model_time < t_end: instance.evolve_model(instance.model_time + dt) channel.copy() particles.append(system.copy()) @@ -725,10 +725,10 @@ def test_converter(self): code.Conf.wExt = True # convert tsunami ics to nbody units - m_nb = m / code.Mscale - r_nb = r / code.Lscale - pos_nb = pos / code.Lscale - vel_nb = vel / (code.Lscale / code.Tscale) + m_nb = m / code.Mscale + r_nb = r / code.Lscale + pos_nb = pos / code.Lscale + vel_nb = vel / (code.Lscale / code.Tscale) spin_nb = np.ascontiguousarray(spin * code.Tscale) pt = np.ones_like(m_nb, dtype=np.int64) * -1 @@ -885,10 +885,10 @@ def test_physical_units(self): spin = np.vstack([wx,wy,wz]).T code = tsunami.Tsunami(1,1) code.Conf.wExt = True - m_nb = m - r_nb = r - pos_nb = pos - vel_nb = vel / (2 * np.pi) + m_nb = m + r_nb = r + pos_nb = pos + vel_nb = vel / (2 * np.pi) spin_nb = np.ascontiguousarray(spin / (2 * np.pi)) pt = np.ones_like(m_nb, dtype=np.int64) * -1 code.add_particle_set(pos_nb, vel_nb, m_nb, r_nb, pt, spin_nb)