summaryrefslogtreecommitdiff
path: root/m4/ax_not_enable_frame_pointer.m4
blob: 741ce9e18acc1e44db85700a27f907a93cf68d47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# ================================================================================
#  https://www.gnu.org/software/autoconf-archive/ax_not_enable_frame_pointer.html
# ================================================================================
#
# SYNOPSIS
#
#   AX_NOT_ENABLE_FRAME_POINTER ([shellvar])
#
# DESCRIPTION
#
#   add --enable-frame-pointer option, the default will add the gcc
#   -fomit-frame-pointer option to the shellvar (per default CFLAGS) and
#   remove the " -g " debuginfo option from it. In other words, the default
#   is "--disable-frame-pointer"
#
# LICENSE
#
#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
#
#   Copying and distribution of this file, with or without modification, are
#   permitted in any medium without royalty provided the copyright notice
#   and this notice are preserved.  This file is offered as-is, without any
#   warranty.

#serial 10

AC_DEFUN([AX_NOT_ENABLE_FRAME_POINTER],[dnl
AS_VAR_PUSHDEF([VAR],[enable_frame_pointer])dnl
AC_MSG_CHECKING([m4_ifval($1,$1,CFLAGS) frame-pointer])
AC_ARG_ENABLE([frame-pointer], AS_HELP_STRING(
  [--enable-frame-pointer],[enable callframe generation for debugging]))
case ".$VAR" in
  .|.no|.no,*) test ".$VAR" = "." && VAR="no"
     m4_ifval($1,$1,CFLAGS)=`echo dnl
  " $m4_ifval($1,$1,CFLAGS) " | sed -e 's/ -g / /'`
     if test ".$GCC" = ".yes" ; then
        m4_ifval($1,$1,CFLAGS)="$m4_ifval($1,$1,CFLAGS) -fomit-frame-pointer"
        AC_MSG_RESULT([$VAR, -fomit-frame-pointer added])
     else
        AC_MSG_RESULT([$VAR, -g removed])
     fi  ;;
   *)  AC_MSG_RESULT([$VAR, kept]) ;;
esac
AS_VAR_POPDEF([VAR])dnl
])