gdb/selftest.m4: ensure $development is set
[deliverable/binutils-gdb.git] / gdb / selftest.m4
CommitLineData
b811d2c2 1dnl Copyright (C) 2018-2020 Free Software Foundation, Inc.
8ecfd7bd
SDJ
2dnl
3dnl This file is part of GDB.
4dnl
5dnl This program is free software; you can redistribute it and/or modify
6dnl it under the terms of the GNU General Public License as published by
7dnl the Free Software Foundation; either version 3 of the License, or
8dnl (at your option) any later version.
9dnl
10dnl This program is distributed in the hope that it will be useful,
11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13dnl GNU General Public License for more details.
14dnl
15dnl You should have received a copy of the GNU General Public License
16dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18dnl GDB_AC_SELFTEST(ACTION-IF-ENABLED)
19dnl
20dnl Enable the unit/self tests if needed. If they are enabled, AC_DEFINE
21dnl the GDB_SELF_TEST macro, and execute ACTION-IF-ENABLED.
22
23AC_DEFUN([GDB_AC_SELFTEST],[
24# Check whether we will enable the inclusion of unit tests when
25# compiling GDB.
26#
27# The default value of this option changes depending whether we're on
28# development mode (in which case it's "true") or not (in which case
29# it's "false").
4d696a5c
SM
30
31AS_IF([test "x$development" != xtrue && test "x$development" != xfalse],
32 [AC_MSG_ERROR([Invalid value for \$development, got "$development", expecting "true" or "false".])])
33
8ecfd7bd
SDJ
34AC_ARG_ENABLE(unit-tests,
35AS_HELP_STRING([--enable-unit-tests],
36[Enable the inclusion of unit tests when compiling GDB]),
37[case "${enableval}" in
38 yes) enable_unittests=true ;;
39 no) enable_unittests=false ;;
40 *) AC_MSG_ERROR(
41[bad value ${enableval} for --{enable,disable}-unit-tests option]) ;;
42esac], [enable_unittests=$development])
43
44if $enable_unittests; then
45 AC_DEFINE(GDB_SELF_TEST, 1,
46 [Define if self-testing features should be enabled])
47 $1
48fi
49])
This page took 0.184949 seconds and 4 git commands to generate.