File: pandora_optimize.m4

package info (click to toggle)
libeatmydata 105-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,064 kB
  • sloc: sh: 12,301; ansic: 745; makefile: 113
file content (64 lines) | stat: -rw-r--r-- 1,902 bytes parent folder | download | duplicates (3)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
dnl  Copyright (C) 2009 Sun Microsystems, Inc.
dnl This file is free software; Sun Microsystems, Inc.
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

AC_DEFUN([PANDORA_OPTIMIZE],[
  dnl Build optimized or debug version ?
  dnl First check for gcc and g++
  AS_IF([test "$GCC" = "yes" -a "$INTELCC" = "no"],[

    dnl The following is required for portable results of floating point 
    dnl calculations on PowerPC. The same must also be done for IA-64, but 
    dnl this options is missing in the IA-64 gcc backend.
    case "$target_cpu" in
      *ppc* | *powerpc*)
        AM_CFLAGS="-mno-fused-madd ${AM_CFLAGS}"
      ;;
    esac

    dnl Once we can use a modern autoconf, we can replace the std=gnu99 here
    dnl with using AC_CC_STD_C99 above
    CC="${CC} -std=gnu99"

    AM_CPPFLAGS="-g ${AM_CPPFLAGS}"

    DEBUG_CFLAGS="-O0"

    OPTIMIZE_CFLAGS="-O2"
  ])
  AS_IF([test "$INTELCC" = "yes"],[
    AM_CPPFLAGS="-g ${AM_CPPFLAGS}"

    DEBUG_CFLAGS="-O0"

    OPTIMIZE_CFLAGS="-xHOST -O2 -no-prec-div -static"

  ])
  AS_IF([test "$SUNCC" = "yes"],[
    dnl Once we can use a modern autoconf, we can replace the -xc99=all here
    dnl with using AC_CC_STD_C99 above
    CC="${CC} -xc99=all"

    AM_CFLAGS="-g -mt -xstrconst -Xa ${AM_CFLAGS}"


    dnl TODO: Make a test for -xO4 usability here
    OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend -xbuiltin"
    OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS}"

  ])

  AC_ARG_WITH([debug],
    [AS_HELP_STRING([--with-debug],
       [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
    [with_debug=$withval],
    [with_debug=no])
  AS_IF([test "$with_debug" = "yes"],[
    # Debugging. No optimization.
    AM_CFLAGS="${AM_CFLAGS} ${DEBUG_CFLAGS} -DDEBUG"
  ],[
    # Optimized version. No debug
    AM_CFLAGS="${AM_CFLAGS} ${OPTIMIZE_CFLAGS}"
  ])
])