abinit/tests/configure.ac

158 lines
3.9 KiB
Plaintext

-*- Autoconf -*-
#
# Copyright (C) 2011-2025 ABINIT Group (Yann Pouillon)
#
# This file is part of the ABINIT software package. For license information,
# please see the COPYING file in the top-level directory of the ABINIT source
# distribution.
#
# ---------------------------------------------------------------------------- #
#
# IMPORTANT NOTE
#
# Please DO NOT EDIT this file unless you REALLY know what you are doing.
# Everything is important, in particular the order of the various commands
# executed here. YOU HAVE BEEN WARNED !
#
# ---------------------------------------------------------------------------- #
#
# Autoconf & Automake startup
#
# Initialize Autoconf
AC_PREREQ(2.62)
AC_INIT([ABINIT-Test-Suite],
[m4_esyscmd([config/scripts/git-version-gen .tarball-version])],
[https://bugs.launchpad.net/abinit/],
[abinit-test])
AC_REVISION([Autotools support for the ABINIT Test Suite])
AC_CONFIG_AUX_DIR([config/gnu])
AC_CONFIG_MACRO_DIR([config/m4])
AC_CONFIG_SRCDIR([Timeout/timeout.c])
_AC_SRCDIRS(["."])
# ---------------------------------------------------------------------------- #
#
# Startup
#
# Initial setup
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(1.10)
# Check for common programs
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_SED
AC_PROG_AWK
AC_PROG_GREP
# Workaround for the "grep -e" issue on Solaris systems
AC_PROG_EGREP
# Workaround for the wrong path to install-sh on Mac systems
AX_PROG_MKDIR_P
# Interpreters
AC_CHECK_PROGS(PERL,[perl])
AC_CHECK_PROGS(PYTHON,[python])
# C support
AC_PROG_CC
# ---------------------------------------------------------------------------- #
#
# Command-line options and environment variables
#
# Timeout support
AC_ARG_ENABLE([test-timeout],
AS_HELP_STRING([--enable-test-timeout],[Enable timeout for tests (default: no)]))
AC_ARG_WITH([test-timeout],
AS_HELP_STRING([--with-test-timeout],[Test timeout in seconds]))
# ---------------------------------------------------------------------------- #
#
# Configuration
#
# FIXME: all should be done through command-line arguments
# Init timeout support
if test "${with_test_timeout}" = "0" -o \
"${with_test_timeout}" = "no" -o \
"${with_test_timeout}" = "yes"; then
AC_MSG_ERROR([--with-test-timeout must be a positive integer])
fi
if test "${enable_test_timeout}" = ""; then
if test "${with_test_timeout}" = ""; then
enable_test_timeout="no"
with_test_timeout="0"
else
enable_test_timeout="yes"
fi
fi
if test "${enable_test_timeout}" = "yes" -a "${with_test_timeout}" = ""; then
with_test_timeout="1200"
fi
nightly_timeout="${with_test_timeout}"
AC_SUBST(nightly_timeout)
# ---------------------------------------------------------------------------- #
#
# Timeout support
#
# Set timeout for tests
if test "${enable_test_timeout}" = "yes"; then
nightly_timeout="${with_test_timeout}"
else
nightly_timeout="0"
fi
AC_MSG_CHECKING([timeout for automatic tests])
if test "${nightly_timeout}" = "0"; then
AC_MSG_RESULT([none])
else
AC_MSG_RESULT([${nightly_timeout} seconds])
fi
AC_MSG_CHECKING([whether to build test timeout code])
AC_MSG_RESULT([${enable_test_timeout}])
# Check for headers
if test "${enable_test_timeout}" = "yes"; then
AC_LANG_PUSH([C])
AC_HEADER_STDC
AC_CHECK_HEADER([stdio.h],
[AC_DEFINE([HAVE_STDIO_H], 1,[Define to 1 if you have <stdio.h>.])],
[enable_test_timeout="no"])
AC_CHECK_HEADER([signal.h],
[AC_DEFINE([HAVE_SIGNAL_H], 1,[Define to 1 if you have <signal.h>.])],
[enable_test_timeout="no"])
if test "${enable_test_timeout}" = "no"; then
AC_MSG_WARN([test timeout support has been disabled])
fi
AC_LANG_POP([C])
fi
# Inform Automake
AC_SUBST(nightly_timeout)
AM_CONDITIONAL(DO_BUILD_TIMEOUT,[test "${enable_test_timeout}" = "yes"])
# ---------------------------------------------------------------------------- #
#
# Output configuration
#
AC_OUTPUT([Makefile Timeout/Makefile])