1*5ba1f45fSchristosdnl Copyright (C) 2018-2024 Free Software Foundation, Inc. 28dffb485Schristosdnl 38dffb485Schristosdnl This file is part of GDB. 48dffb485Schristosdnl 58dffb485Schristosdnl This program is free software; you can redistribute it and/or modify 68dffb485Schristosdnl it under the terms of the GNU General Public License as published by 78dffb485Schristosdnl the Free Software Foundation; either version 3 of the License, or 88dffb485Schristosdnl (at your option) any later version. 98dffb485Schristosdnl 108dffb485Schristosdnl This program is distributed in the hope that it will be useful, 118dffb485Schristosdnl but WITHOUT ANY WARRANTY; without even the implied warranty of 128dffb485Schristosdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 138dffb485Schristosdnl GNU General Public License for more details. 148dffb485Schristosdnl 158dffb485Schristosdnl You should have received a copy of the GNU General Public License 168dffb485Schristosdnl along with this program. If not, see <http://www.gnu.org/licenses/>. 178dffb485Schristos 188dffb485Schristosdnl GDB_AC_SELFTEST(ACTION-IF-ENABLED) 198dffb485Schristosdnl 208dffb485Schristosdnl Enable the unit/self tests if needed. If they are enabled, AC_DEFINE 218dffb485Schristosdnl the GDB_SELF_TEST macro, and execute ACTION-IF-ENABLED. 228dffb485Schristos 238dffb485SchristosAC_DEFUN([GDB_AC_SELFTEST],[ 248dffb485Schristos# Check whether we will enable the inclusion of unit tests when 258dffb485Schristos# compiling GDB. 268dffb485Schristos# 278dffb485Schristos# The default value of this option changes depending whether we're on 288dffb485Schristos# development mode (in which case it's "true") or not (in which case 298dffb485Schristos# it's "false"). The $development variable is set by the GDB_AC_COMMON 308dffb485Schristos# macro, which must therefore be used before GDB_AC_SELFTEST. 318dffb485Schristos 328dffb485SchristosAS_IF([test "x$development" != xtrue && test "x$development" != xfalse], 338dffb485Schristos [AC_MSG_ERROR([Invalid value for \$development, got "$development", expecting "true" or "false".])]) 348dffb485Schristos 358dffb485SchristosAC_ARG_ENABLE(unit-tests, 368dffb485SchristosAS_HELP_STRING([--enable-unit-tests], 378dffb485Schristos[Enable the inclusion of unit tests when compiling GDB]), 388dffb485Schristos[case "${enableval}" in 398dffb485Schristos yes) enable_unittests=true ;; 408dffb485Schristos no) enable_unittests=false ;; 418dffb485Schristos *) AC_MSG_ERROR( 428dffb485Schristos[bad value ${enableval} for --{enable,disable}-unit-tests option]) ;; 438dffb485Schristosesac], [enable_unittests=$development]) 448dffb485Schristos 458dffb485Schristosif $enable_unittests; then 468dffb485Schristos AC_DEFINE(GDB_SELF_TEST, 1, 478dffb485Schristos [Define if self-testing features should be enabled]) 488dffb485Schristos $1 498dffb485Schristosfi 508dffb485Schristos]) 51