Debian Codegraph @

hmmer/easel/m4/esl_pic_flags.m4

raw
1 # ===========================================================================
2 # http://www.mesa3d.org/
3 # http://www.mail-archive.com/[email protected]/msg04938.html
4 # https://gitlab.freedesktop.org/lima/mesa/commit/d368eed9c78aa3ced8540c66bdc4c5e1d4a067b4
5 # ===========================================================================
6 #
7 # SYNOPSIS
8 #
9 # ESL_PIC_FLAGS
10 #
11 # DESCRIPTION
12 #
13 # Derived (essentially verbatim) from MESA_PIC_FLAGS, in the Mesa
14 # project's acinclude.m4 file originally written by Dan Nicholson in 2012
15 # according to https://gitlab.freedesktop.org/lima/mesa/commit/d368eed9c78aa3ced8540c66bdc4c5e1d4a067b4
16 # From the Mesa file's header:
17 # "Find out whether to build PIC code using the option --enable-pic and
18 # the configure enable_static/enable_shared settings. If PIC is needed,
19 # figure out the necessary flags for the platform and compiler.
20 #
21 # The platform checks have been shamelessly taken from libtool and
22 # stripped down to just what's needed for Mesa. See _LT_COMPILER_PIC in
23 # /usr/share/aclocal/libtool.m4 or
24 # http://git.savannah.gnu.org/gitweb/?p=libtool.git;a=blob;f=libltdl/m4/libtool.m4;hb=HEAD
25 #
26 # Sets an output variable @PIC_CFLAGS@ which should be added to
27 # CFLAGS lines.
28 #
29 #
30 AC_DEFUN([ESL_PIC_FLAGS],
31 [AC_REQUIRE([AC_PROG_CC])dnl
32 AC_ARG_VAR([PIC_CFLAGS], [compiler flags for PIC code])
33 AC_ARG_ENABLE([pic],
34 [AS_HELP_STRING([--disable-pic],
35 [compile PIC objects @<:@default=enabled for shared builds
36 on supported platforms@:>@])],
37 [enable_pic="$enableval"
38 test "x$enable_pic" = x && enable_pic=auto],
39 [enable_pic=auto])
40 # disable PIC by default for static builds
41 if test "$enable_pic" = auto && test "$enable_static" = yes; then
42 enable_pic=no
43 fi
44 # if PIC hasn't been explicitly disabled, try to figure out the flags
45 if test "$enable_pic" != no; then
46 AC_MSG_CHECKING([for $CC option to produce PIC])
47 # allow the user's flags to override
48 if test "x$PIC_CFLAGS" = x; then
49 # see if we're using GCC
50 if test "x$GCC" = xyes; then
51 case "$host_os" in
52 aix*|beos*|cygwin*|irix5*|irix6*|osf3*|osf4*|osf5*)
53 # PIC is the default for these OSes.
54 ;;
55 mingw*|os2*|pw32*)
56 # This hack is so that the source file can tell whether
57 # it is being built for inclusion in a dll (and should
58 # export symbols for example).
59 PIC_CFLAGS="-DDLL_EXPORT"
60 ;;
61 darwin*|rhapsody*)
62 # PIC is the default on this platform
63 # Common symbols not allowed in MH_DYLIB files
64 PIC_CFLAGS="-fno-common"
65 ;;
66 hpux*)
67 # PIC is the default for IA64 HP-UX and 64-bit HP-UX,
68 # but not for PA HP-UX.
69 case $host_cpu in
70 hppa*64*|ia64*)
71 ;;
72 *)
73 PIC_CFLAGS="-fPIC"
74 ;;
75 esac
76 ;;
77 *)
78 # Everyone else on GCC uses -fPIC
79 PIC_CFLAGS="-fPIC"
80 ;;
81 esac
82 else # !GCC
83 case "$host_os" in
84 hpux9*|hpux10*|hpux11*)
85 # PIC is the default for IA64 HP-UX and 64-bit HP-UX,
86 # but not for PA HP-UX.
87 case "$host_cpu" in
88 hppa*64*|ia64*)
89 # +Z the default
90 ;;
91 *)
92 PIC_CFLAGS="+Z"
93 ;;
94 esac
95 ;;
96 linux*|k*bsd*-gnu)
97 case `basename "$CC"` in
98 icc*|ecc*|ifort*)
99 PIC_CFLAGS="-KPIC"
100 ;;
101 pgcc*|pgf77*|pgf90*|pgf95*)
102 # Portland Group compilers (*not* the Pentium gcc
103 # compiler, which looks to be a dead project)
104 PIC_CFLAGS="-fpic"
105 ;;
106 ccc*)
107 # All Alpha code is PIC.
108 ;;
109 xl*)
110 # IBM XL C 8.0/Fortran 10.1 on PPC
111 PIC_CFLAGS="-qpic"
112 ;;
113 *)
114 case `$CC -V 2>&1 | sed 5q` in
115 *Sun\ C*|*Sun\ F*)
116 # Sun C 5.9 or Sun Fortran
117 PIC_CFLAGS="-KPIC"
118 ;;
119 esac
120 esac
121 ;;
122 solaris*)
123 PIC_CFLAGS="-KPIC"
124 ;;
125 sunos4*)
126 PIC_CFLAGS="-PIC"
127 ;;
128 esac
129 fi # GCC
130 fi # PIC_CFLAGS
131 AC_MSG_RESULT([$PIC_CFLAGS])
132 fi
133 AC_SUBST([PIC_CFLAGS])
134 ])