File: picflag.m4

package info (click to toggle)
gdb 7.12-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 216,152 kB
  • ctags: 304,881
  • sloc: ansic: 2,141,328; asm: 331,662; exp: 133,348; makefile: 57,698; sh: 23,586; yacc: 14,054; cpp: 12,262; perl: 5,300; python: 4,685; ada: 4,343; xml: 3,670; pascal: 3,120; lisp: 1,516; cs: 879; lex: 624; f90: 457; sed: 228; awk: 142; objc: 134; java: 73; fortran: 43
file content (97 lines) | stat: -rw-r--r-- 2,605 bytes parent folder | download | duplicates (12)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# _GCC_PICFLAG(FLAG, DISPATCH)
# ----------------------------
# Store PIC flag corresponding to DISPATCH triplet in FLAG.
# Explit use of -fpic in CFLAGS corresponding to FLAG overrides default.
AC_DEFUN([_GCC_PICFLAG], [

case "${$2}" in
    # PIC is the default on some targets or must not be used.
    *-*-darwin*)
	# For darwin, common symbols are not allowed in MH_DYLIB files
	case "${CFLAGS}" in
	  # If we are using a compiler supporting mdynamic-no-pic
	  # and the option has been tested as safe to add, then cancel
	  # it here, since the code generated is incompatible with shared
	  # libs.
	  *-mdynamic-no-pic*) $1='-fno-common -mno-dynamic-no-pic' ;;
	  *) $1=-fno-common ;;
	esac
	;;
    alpha*-dec-osf5*)
	# PIC is the default.
	;;
    hppa*64*-*-hpux*)
	# PIC is the default for 64-bit PA HP-UX.
	;;
    i[[34567]]86-*-cygwin* | x86_64-*-cygwin*)
	;;
    i[[34567]]86-*-mingw* | x86_64-*-mingw*)
	;;
    i[[34567]]86-*-interix[[3-9]]*)
	# Interix 3.x gcc -fpic/-fPIC options generate broken code.
	# Instead, we relocate shared libraries at runtime.
	;;
    i[[34567]]86-*-nto-qnx*)
	# QNX uses GNU C++, but need to define -shared option too, otherwise
	# it will coredump.
	$1='-fPIC -shared'
	;;
    i[[34567]]86-pc-msdosdjgpp*)
	# DJGPP does not support shared libraries at all.
	;;
    ia64*-*-hpux*)
	# On IA64 HP-UX, PIC is the default but the pic flag
	# sets the default TLS model and affects inlining.
	$1=-fPIC
	;;
    mips-sgi-irix6*)
	# PIC is the default.
	;;
    rs6000-ibm-aix* | powerpc-ibm-aix*)
	# All AIX code is PIC.
	;;

    # Some targets support both -fPIC and -fpic, but prefer the latter.
    # FIXME: Why?
    i[[34567]]86-*-* | x86_64-*-*)
	$1=-fpic
	;;
    # FIXME: Override -fPIC default in libgcc only? 
    sh-*-linux* | sh[[2346lbe]]*-*-linux*)
	$1=-fpic
	;;
    # FIXME: Simplify to sh*-*-netbsd*?
    sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
      sh64-*-netbsd* | sh64l*-*-netbsd*)
	$1=-fpic
	;;
    # Default to -fPIC unless specified otherwise.
    *)
	$1=-fPIC
	;;
esac

# If the user explicitly uses -fpic/-fPIC, keep that.
case "${m4_bpatsubsts($1, PICFLAG, CFLAGS)}" in
    *-fpic*)
	$1=-fpic
	;;
    *-fPIC*)
	$1=-fPIC
	;;
esac
])

# GCC_PICFLAG
# -----------
# Store host PIC flag in PICFLAG.
AC_DEFUN([GCC_PICFLAG], [
  AC_REQUIRE([AC_CANONICAL_HOST])
  _GCC_PICFLAG([PICFLAG], [host])])

# GCC_PICFLAG_FOR_TARGET
# ----------------------
# Store target PIC flag in PICFLAG_FOR_TARGET.
AC_DEFUN([GCC_PICFLAG_FOR_TARGET], [
  AC_REQUIRE([AC_CANONICAL_TARGET])
  _GCC_PICFLAG([PICFLAG_FOR_TARGET], [target])])