build/autoconf/frameptr.m4

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/autoconf/frameptr.m4	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +dnl This Source Code Form is subject to the terms of the Mozilla Public
     1.5 +dnl License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 +dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.7 +
     1.8 +dnl Set MOZ_FRAMEPTR_FLAGS to the flags that should be used for enabling or
     1.9 +dnl disabling frame pointers in this architecture based on the configure
    1.10 +dnl options
    1.11 +
    1.12 +AC_DEFUN([MOZ_SET_FRAMEPTR_FLAGS], [
    1.13 +  case "$target" in
    1.14 +  *android*)
    1.15 +    unwind_tables="-funwind-tables"
    1.16 +    ;;
    1.17 +  esac
    1.18 +  if test "$GNU_CC"; then
    1.19 +    MOZ_ENABLE_FRAME_PTR="-fno-omit-frame-pointer $unwind_tables"
    1.20 +    MOZ_DISABLE_FRAME_PTR="-fomit-frame-pointer"
    1.21 +    if test "$CPU_ARCH" = arm; then
    1.22 +      # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54398
    1.23 +      MOZ_ENABLE_FRAME_PTR="$unwind_tables"
    1.24 +    fi
    1.25 +  else
    1.26 +    case "$target" in
    1.27 +    *-mingw*)
    1.28 +      MOZ_ENABLE_FRAME_PTR="-Oy-"
    1.29 +      MOZ_DISABLE_FRAME_PTR="-Oy"
    1.30 +    ;;
    1.31 +    esac
    1.32 +  fi
    1.33 +
    1.34 +  # if we are debugging, profiling or using ASAN, we want a frame pointer.
    1.35 +  if test -z "$MOZ_OPTIMIZE" -o \
    1.36 +          -n "$MOZ_PROFILING" -o \
    1.37 +          -n "$MOZ_DEBUG" -o \
    1.38 +          -n "$MOZ_ASAN"; then
    1.39 +    MOZ_FRAMEPTR_FLAGS="$MOZ_ENABLE_FRAME_PTR"
    1.40 +  else
    1.41 +    MOZ_FRAMEPTR_FLAGS="$MOZ_DISABLE_FRAME_PTR"
    1.42 +  fi
    1.43 +])

mercurial