source: trunk/libs/newlib/src/config/picflag.m4 @ 534

Last change on this file since 534 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.3 KB
Line 
1# _GCC_PICFLAG(FLAG, DISPATCH)
2# ----------------------------
3# Store PIC flag corresponding to DISPATCH triplet in FLAG.
4# Explit use of -fpic in CFLAGS corresponding to FLAG overrides default.
5AC_DEFUN([_GCC_PICFLAG], [
6
7case "${$2}" in
8    # PIC is the default on some targets or must not be used.
9    *-*-darwin*)
10        # For darwin, common symbols are not allowed in MH_DYLIB files
11        case "${CFLAGS}" in
12          # If we are using a compiler supporting mdynamic-no-pic
13          # and the option has been tested as safe to add, then cancel
14          # it here, since the code generated is incompatible with shared
15          # libs.
16          *-mdynamic-no-pic*) $1='-fno-common -mno-dynamic-no-pic' ;;
17          *) $1=-fno-common ;;
18        esac
19        ;;
20    alpha*-dec-osf5*)
21        # PIC is the default.
22        ;;
23    hppa*64*-*-hpux*)
24        # PIC is the default for 64-bit PA HP-UX.
25        ;;
26    i[[34567]]86-*-cygwin* | x86_64-*-cygwin*)
27        ;;
28    i[[34567]]86-*-mingw* | x86_64-*-mingw*)
29        ;;
30    i[[34567]]86-*-nto-qnx*)
31        # QNX uses GNU C++, but need to define -shared option too, otherwise
32        # it will coredump.
33        $1='-fPIC -shared'
34        ;;
35    i[[34567]]86-pc-msdosdjgpp*)
36        # DJGPP does not support shared libraries at all.
37        ;;
38    ia64*-*-hpux*)
39        # On IA64 HP-UX, PIC is the default but the pic flag
40        # sets the default TLS model and affects inlining.
41        $1=-fPIC
42        ;;
43    mips-sgi-irix6*)
44        # PIC is the default.
45        ;;
46    rs6000-ibm-aix* | powerpc-ibm-aix*)
47        # All AIX code is PIC.
48        ;;
49
50    # Some targets support both -fPIC and -fpic, but prefer the latter.
51    # FIXME: Why?
52    i[[34567]]86-*-* | x86_64-*-*)
53        $1=-fpic
54        ;;
55    # FIXME: Override -fPIC default in libgcc only?
56    sh-*-linux* | sh[[2346lbe]]*-*-linux*)
57        $1=-fpic
58        ;;
59    # FIXME: Simplify to sh*-*-netbsd*?
60    sh-*-netbsdelf* | shl*-*-netbsdelf*)
61        $1=-fpic
62        ;;
63    # Default to -fPIC unless specified otherwise.
64    *)
65        $1=-fPIC
66        ;;
67esac
68
69# If the user explicitly uses -fpic/-fPIC, keep that.
70case "${m4_bpatsubsts($1, PICFLAG, CFLAGS)}" in
71    *-fpic*)
72        $1=-fpic
73        ;;
74    *-fPIC*)
75        $1=-fPIC
76        ;;
77esac
78])
79
80# GCC_PICFLAG
81# -----------
82# Store host PIC flag in PICFLAG.
83AC_DEFUN([GCC_PICFLAG], [
84  AC_REQUIRE([AC_CANONICAL_HOST])
85  _GCC_PICFLAG([PICFLAG], [host])])
86
87# GCC_PICFLAG_FOR_TARGET
88# ----------------------
89# Store target PIC flag in PICFLAG_FOR_TARGET.
90AC_DEFUN([GCC_PICFLAG_FOR_TARGET], [
91  AC_REQUIRE([AC_CANONICAL_TARGET])
92  _GCC_PICFLAG([PICFLAG_FOR_TARGET], [target])])
Note: See TracBrowser for help on using the repository browser.