Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

acinclude.m4 4.1KB

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