Import gdb-7.10.1
[dragonfly.git] / contrib / gdb-7 / gdb / libmcheck.m4
1 dnl Copyright (C) 2012-2015 Free Software Foundation, Inc.
2 dnl
3 dnl This file is part of GDB.
4 dnl
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
9 dnl
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl GNU General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 dnl GDB_AC_LIBMCHECK([DEFAULT])
19 dnl Provide an --enable-libmcheck/--disable-libmcheck set of options
20 dnl allowing a user to enable this option even when building releases,
21 dnl or to disable it when building a snapshot.
22 dnl DEFAULT (yes/no) is used as default if the user doesn't set
23 dnl the option explicitly.
24
25 AC_DEFUN([GDB_AC_LIBMCHECK],
26 [
27   AC_ARG_ENABLE(libmcheck,
28     AS_HELP_STRING([--enable-libmcheck],
29                    [Try linking with -lmcheck if available]),
30     [case "${enableval}" in
31       yes | y) ENABLE_LIBMCHECK="yes" ;;
32       no | n)  ENABLE_LIBMCHECK="no" ;;
33       *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmcheck) ;;
34     esac])
35
36   if test -z "${ENABLE_LIBMCHECK}"; then
37     ENABLE_LIBMCHECK=[$1]
38   fi
39
40   if test "$ENABLE_LIBMCHECK" = "yes" ; then
41     AC_CHECK_LIB(mcheck, main)
42   fi
43 ])