Commit be0903f9 be0903f92dcec7be9d6f6c5f54819701f08ec7c8 by Sergey Poznyakoff

Handle --enable-debug option. When the option is specified,

adds -ggdb to the invocation of	gcc, and removes any optimization
directives from CFLAGS.
1 parent bc7dbbd9
1 dnl This file is part of GNU mailutils.
2 dnl Copyright (C) 2001 Free Software Foundation, Inc.
3 dnl
4 dnl This file is free software; as a special exception the author gives
5 dnl unlimited permission to copy and/or distribute it, with or without
6 dnl modifications, as long as this notice is preserved.
7 dnl
8 dnl This program is distributed in the hope that it will be useful, but
9 dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 dnl
12 dnl Check for --enable-debug switch. When the switch is specified, add
13 dnl -ggdb to CFLAGS and remove any optimization options from there.
14 dnl
15
16 AC_DEFUN(MU_DEBUG_MODE,
17 [AC_ARG_ENABLE(debug,
18 [ --enable-debug enable debugging mode],
19 [if test x"$enableval" = xyes; then
20 if test x"$GCC" = xyes; then
21 AC_MSG_CHECKING(whether gcc accepts -ggdb)
22 save_CFLAGS=$CFLAGS
23 CFLAGS="-ggdb"
24 AC_TRY_COMPILE([],void f(){},
25 AC_MSG_RESULT(yes),
26 [if test x"$ac_cv_prog_cc_g" = xyes; then
27 CFLAGS=-g
28 else
29 CFLAGS=
30 fi
31 AC_MSG_RESULT(no)])
32 CFLAGS="`echo $save_CFLAGS | sed 's/-O[[0-9]]//g'` $CFLAGS"
33 fi
34 fi])])