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.
5 AC_DEFUN([_GCC_PICFLAG], [
8 # PIC is the default on some targets or must not be used.
10 # For darwin, common symbols are not allowed in MH_DYLIB files
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
16 *-mdynamic-no-pic*) $1='-fno-common -mno-dynamic-no-pic' ;;
24 # PIC is the default for 64-bit PA HP-UX.
26 i[[34567]]86-*-cygwin* | x86_64-*-cygwin*)
28 i[[34567]]86-*-mingw* | x86_64-*-mingw*)
30 i[[34567]]86-*-interix[[3-9]]*)
31 # Interix 3.x gcc -fpic/-fPIC options generate broken code.
32 # Instead, we relocate shared libraries at runtime.
34 i[[34567]]86-*-nto-qnx*)
35 # QNX uses GNU C++, but need to define -shared option too, otherwise
39 i[[34567]]86-pc-msdosdjgpp*)
40 # DJGPP does not support shared libraries at all.
43 # On IA64 HP-UX, PIC is the default but the pic flag
44 # sets the default TLS model and affects inlining.
50 rs6000-ibm-aix* | powerpc-ibm-aix*)
51 # All AIX code is PIC.
54 # Some targets support both -fPIC and -fpic, but prefer the latter.
56 i[[34567]]86-*-* | x86_64-*-*)
59 # FIXME: Override -fPIC default in libgcc only?
60 sh-*-linux* | sh[[2346lbe]]*-*-linux*)
63 # FIXME: Simplify to sh*-*-netbsd*?
64 sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
65 sh64-*-netbsd* | sh64l*-*-netbsd*)
68 # Default to -fPIC unless specified otherwise.
74 # If the user explicitly uses -fpic/-fPIC, keep that.
75 case "${m4_bpatsubsts($1, PICFLAG, CFLAGS)}" in
87 # Store host PIC flag in PICFLAG.
88 AC_DEFUN([GCC_PICFLAG], [
89 AC_REQUIRE([AC_CANONICAL_HOST])
90 _GCC_PICFLAG([PICFLAG], [host])])
92 # GCC_PICFLAG_FOR_TARGET
93 # ----------------------
94 # Store target PIC flag in PICFLAG_FOR_TARGET.
95 AC_DEFUN([GCC_PICFLAG_FOR_TARGET], [
96 AC_REQUIRE([AC_CANONICAL_TARGET])
97 _GCC_PICFLAG([PICFLAG_FOR_TARGET], [target])])