* configure.ac: New switch for disabling -O2 (--disable-optimizations).
[cacao.git] / m4 / debug.m4
1 dnl m4/debug.m4
2 dnl
3 dnl Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
4 dnl C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 dnl E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 dnl J. Wenninger, Institut f. Computersprachen - TU Wien
7 dnl 
8 dnl This file is part of CACAO.
9 dnl 
10 dnl This program is free software; you can redistribute it and/or
11 dnl modify it under the terms of the GNU General Public License as
12 dnl published by the Free Software Foundation; either version 2, or (at
13 dnl your option) any later version.
14 dnl 
15 dnl This program is distributed in the hope that it will be useful, but
16 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 dnl General Public License for more details.
19 dnl 
20 dnl You should have received a copy of the GNU General Public License
21 dnl along with this program; if not, write to the Free Software
22 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 dnl 02110-1301, USA.
24
25
26 dnl check for debug
27
28 AC_DEFUN([AC_CHECK_ENABLE_DEBUG],[
29 AC_MSG_CHECKING(whether debug code generation should be enabled)
30 AC_ARG_ENABLE([debug],
31               [AS_HELP_STRING(--disable-debug,disable debug code generation [[default=enabled]])],
32               [case "${enableval}" in
33                    no)
34                        NDEBUG=yes
35                        AC_DEFINE([NDEBUG], 1, [disable debug code])
36                        ;;
37                    *)
38                        NDEBUG=no
39                        ;;
40                esac],
41               [NDEBUG=no])
42
43 if test x"${NDEBUG}" = "xno"; then
44     AC_MSG_RESULT(yes)
45 else
46     AC_MSG_RESULT(no)
47 fi
48 AM_CONDITIONAL([NDEBUG], test x"${NDEBUG}" = "xyes")
49 ])