PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/config/ac_debug.m4

https://code.google.com/
m4 | 53 lines | 30 code | 3 blank | 20 comment | 0 complexity | f79b2b7226156938eb64fd23f5aac1c2 MD5 | raw file
 1##*****************************************************************************
 2## $Id$
 3##*****************************************************************************
 4#  AUTHOR:
 5#    Chris Dunlap <cdunlap@llnl.gov>
 6#
 7#  SYNOPSIS:
 8#    AC_DEBUG
 9#
10#  DESCRIPTION:
11#    Adds support for the "--enable-debug" configure script option.
12#    If CFLAGS are not passed to configure, they will be set based
13#    on whether debugging has been enabled.  Also, the NDEBUG macro
14#    (used by assert) will be set accordingly.
15#
16#  WARNINGS:
17#    This macro must be placed after AC_PROG_CC or equivalent.
18##*****************************************************************************
19
20AC_DEFUN([AC_DEBUG],
21[
22  AC_MSG_CHECKING([whether debugging is enabled])
23  AC_ARG_ENABLE([debug],
24    AC_HELP_STRING([--enable-debug], [enable debugging code for development]),
25    [ case "$enableval" in
26        yes) ac_debug=yes ;;
27        no)  ac_debug=no ;;
28        *)   AC_MSG_RESULT([doh!])
29             AC_MSG_ERROR([bad value "$enableval" for --enable-debug]) ;;
30      esac
31    ]
32  )
33  if test "$ac_debug" = yes; then
34    if test -z "$ac_save_CFLAGS"; then
35      test "$ac_cv_prog_cc_g" = yes && CFLAGS="-g"
36      test "$GCC" = yes && CFLAGS="$CFLAGS -Wall"
37    fi
38  else
39    if test -z "$ac_save_CFLAGS"; then
40      test "$GCC" = yes && CFLAGS="-O3 -Wall -fno-strict-aliasing" || CFLAGS="-O3"
41
42      # Do not strip binaries on Mac OS X.
43      #
44	  if echo "$host" | grep -v darwin; then
45	     LDFLAGS="${LDFLAGS--s}"
46	  fi 
47
48    fi
49    AC_DEFINE([NDEBUG], [1],
50      [Define to 1 if you are building a production release.])
51  fi
52  AC_MSG_RESULT([${ac_debug=no}])
53])