diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2001-10-17 09:56:47 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2001-10-17 09:56:47 +0000 |
commit | be0903f92dcec7be9d6f6c5f54819701f08ec7c8 (patch) | |
tree | de70d54e8324a0211d69a1b89a5e3de1e8203a53 /m4 | |
parent | bc7dbbd9ec449ad2ec7b14727031b5b3710d24ef (diff) | |
download | mailutils-be0903f92dcec7be9d6f6c5f54819701f08ec7c8.tar.gz mailutils-be0903f92dcec7be9d6f6c5f54819701f08ec7c8.tar.bz2 |
Handle --enable-debug option. When the option is specified,
adds -ggdb to the invocation of gcc, and removes any optimization
directives from CFLAGS.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/debug.m4 | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/m4/debug.m4 b/m4/debug.m4 new file mode 100644 index 000000000..2801acc89 --- /dev/null +++ b/m4/debug.m4 @@ -0,0 +1,34 @@ +dnl This file is part of GNU mailutils. +dnl Copyright (C) 2001 Free Software Foundation, Inc. +dnl +dnl This file is free software; as a special exception the author gives +dnl unlimited permission to copy and/or distribute it, with or without +dnl modifications, as long as this notice is preserved. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +dnl +dnl Check for --enable-debug switch. When the switch is specified, add +dnl -ggdb to CFLAGS and remove any optimization options from there. +dnl + +AC_DEFUN(MU_DEBUG_MODE, + [AC_ARG_ENABLE(debug, + [ --enable-debug enable debugging mode], + [if test x"$enableval" = xyes; then + if test x"$GCC" = xyes; then + AC_MSG_CHECKING(whether gcc accepts -ggdb) + save_CFLAGS=$CFLAGS + CFLAGS="-ggdb" + AC_TRY_COMPILE([],void f(){}, + AC_MSG_RESULT(yes), + [if test x"$ac_cv_prog_cc_g" = xyes; then + CFLAGS=-g + else + CFLAGS= + fi + AC_MSG_RESULT(no)]) + CFLAGS="`echo $save_CFLAGS | sed 's/-O[[0-9]]//g'` $CFLAGS" + fi + fi])]) |