Clone of mesa.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

configure.ac 106KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226
  1. dnl Copyright © 2011-2014 Intel Corporation
  2. dnl Copyright © 2011-2014 Emil Velikov <emil.l.velikov@gmail.com>
  3. dnl Copyright © 2007-2010 Dan Nicholson
  4. dnl Copyright © 2010-2014 Marek Olšák <maraeo@gmail.com>
  5. dnl Copyright © 2010-2014 Christian König
  6. dnl Copyright © 2012-2014 Tom Stellard <tstellar@gmail.com>
  7. dnl Copyright © 2009-2012 Jakob Bornecrantz
  8. dnl Copyright © 2009-2014 Jon TURNEY
  9. dnl Copyright © 2011-2012 Benjamin Franzke
  10. dnl Copyright © 2008-2014 David Airlie
  11. dnl Copyright © 2009-2013 Brian Paul
  12. dnl
  13. dnl Permission is hereby granted, free of charge, to any person obtaining a
  14. dnl copy of this software and associated documentation files (the "Software"),
  15. dnl to deal in the Software without restriction, including without limitation
  16. dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
  17. dnl and/or sell copies of the Software, and to permit persons to whom the
  18. dnl Software is furnished to do so, subject to the following conditions:
  19. dnl
  20. dnl The above copyright notice and this permission notice (including the next
  21. dnl paragraph) shall be included in all copies or substantial portions of the
  22. dnl Software.
  23. dnl
  24. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25. dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  26. dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  27. dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  28. dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  29. dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  30. dnl DEALINGS IN THE SOFTWARE.
  31. dnl
  32. dnl Process this file with autoconf to create configure.
  33. AC_PREREQ([2.60])
  34. dnl Tell the user about autoconf.html in the --help output
  35. m4_divert_once([HELP_END], [
  36. See docs/autoconf.html for more details on the options for Mesa.])
  37. m4_define(MESA_VERSION, m4_normalize(m4_include(VERSION)))
  38. AC_INIT([Mesa], [MESA_VERSION],
  39. [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
  40. AC_CONFIG_AUX_DIR([bin])
  41. AC_CONFIG_MACRO_DIR([m4])
  42. AC_CANONICAL_SYSTEM
  43. AM_INIT_AUTOMAKE([foreign tar-ustar dist-xz subdir-objects])
  44. dnl We only support native Windows builds (MinGW/MSVC) through SCons.
  45. case "$host_os" in
  46. mingw*)
  47. AC_MSG_ERROR([MinGW build not supported through autoconf/automake, use SCons instead])
  48. ;;
  49. esac
  50. # Support silent build rules, requires at least automake-1.11. Disable
  51. # by either passing --disable-silent-rules to configure or passing V=1
  52. # to make
  53. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
  54. [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
  55. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  56. dnl Set internal versions
  57. OSMESA_VERSION=8
  58. AC_SUBST([OSMESA_VERSION])
  59. OPENCL_VERSION=1
  60. AC_SUBST([OPENCL_VERSION])
  61. # The idea is that libdrm is distributed as one cohesive package, even
  62. # though it is composed of multiple libraries. However some drivers
  63. # may have different version requirements than others. This list
  64. # codifies which drivers need which version of libdrm. Any libdrm
  65. # version dependencies in non-driver-specific code should be reflected
  66. # in the first entry.
  67. LIBDRM_REQUIRED=2.4.75
  68. LIBDRM_RADEON_REQUIRED=2.4.71
  69. LIBDRM_AMDGPU_REQUIRED=2.4.90
  70. LIBDRM_INTEL_REQUIRED=2.4.75
  71. LIBDRM_NVVIEUX_REQUIRED=2.4.66
  72. LIBDRM_NOUVEAU_REQUIRED=2.4.66
  73. LIBDRM_FREEDRENO_REQUIRED=2.4.89
  74. LIBDRM_ETNAVIV_REQUIRED=2.4.82
  75. dnl Versions for external dependencies
  76. DRI2PROTO_REQUIRED=2.8
  77. GLPROTO_REQUIRED=1.4.14
  78. LIBOMXIL_BELLAGIO_REQUIRED=0.0
  79. LIBVA_REQUIRED=0.38.0
  80. VDPAU_REQUIRED=1.1
  81. WAYLAND_REQUIRED=1.11
  82. WAYLAND_PROTOCOLS_REQUIRED=1.8
  83. XCB_REQUIRED=1.9.3
  84. XCBDRI2_REQUIRED=1.8
  85. XCBGLX_REQUIRED=1.8.1
  86. XDAMAGE_REQUIRED=1.1
  87. XSHMFENCE_REQUIRED=1.1
  88. XVMC_REQUIRED=1.0.6
  89. PYTHON_MAKO_REQUIRED=0.8.0
  90. LIBSENSORS_REQUIRED=4.0.0
  91. ZLIB_REQUIRED=1.2.3
  92. dnl LLVM versions
  93. LLVM_REQUIRED_GALLIUM=3.3.0
  94. LLVM_REQUIRED_OPENCL=3.9.0
  95. LLVM_REQUIRED_R600=3.9.0
  96. LLVM_REQUIRED_RADEONSI=4.0.0
  97. LLVM_REQUIRED_RADV=4.0.0
  98. LLVM_REQUIRED_SWR=4.0.0
  99. dnl Check for progs
  100. AC_PROG_CPP
  101. AC_PROG_CC
  102. AC_PROG_CXX
  103. dnl add this here, so the help for this environmnet variable is close to
  104. dnl other CC/CXX flags related help
  105. AC_ARG_VAR([CXX11_CXXFLAGS], [Compiler flag to enable C++11 support (only needed if not
  106. enabled by default and different from -std=c++11)])
  107. AM_PROG_CC_C_O
  108. AM_PROG_AS
  109. AX_CHECK_GNU_MAKE
  110. AC_CHECK_PROGS([PYTHON2], [python2.7 python2 python])
  111. AC_PROG_SED
  112. AC_PROG_MKDIR_P
  113. AC_SYS_LARGEFILE
  114. LT_PREREQ([2.2])
  115. LT_INIT([disable-static])
  116. AC_CHECK_PROG(RM, rm, [rm -f])
  117. AX_PROG_BISON([],
  118. AS_IF([test ! -f "$srcdir/src/compiler/glsl/glcpp/glcpp-parse.c"],
  119. [AC_MSG_ERROR([bison not found - unable to compile glcpp-parse.y])]))
  120. AX_PROG_FLEX([],
  121. AS_IF([test ! -f "$srcdir/src/compiler/glsl/glcpp/glcpp-lex.c"],
  122. [AC_MSG_ERROR([flex not found - unable to compile glcpp-lex.l])]))
  123. AC_CHECK_PROG(INDENT, indent, indent, cat)
  124. if test "x$INDENT" != "xcat"; then
  125. # Only GNU indent is supported
  126. INDENT_VERSION=`indent --version | grep GNU`
  127. if test $? -eq 0; then
  128. AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte -TBool')
  129. else
  130. INDENT="cat"
  131. fi
  132. fi
  133. AX_CHECK_PYTHON_MAKO_MODULE($PYTHON_MAKO_REQUIRED)
  134. if test -z "$PYTHON2"; then
  135. if test ! -f "$srcdir/src/util/format_srgb.c"; then
  136. AC_MSG_ERROR([Python not found - unable to generate sources])
  137. fi
  138. else
  139. if test "x$acv_mako_found" = xno; then
  140. if test ! -f "$srcdir/src/mesa/main/format_unpack.c"; then
  141. AC_MSG_ERROR([Python mako module v$PYTHON_MAKO_REQUIRED or higher not found])
  142. fi
  143. fi
  144. fi
  145. AC_PROG_INSTALL
  146. dnl We need a POSIX shell for parts of the build. Assume we have one
  147. dnl in most cases.
  148. case "$host_os" in
  149. solaris*)
  150. # Solaris /bin/sh is too old/non-POSIX compliant
  151. AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
  152. SHELL="$POSIX_SHELL"
  153. ;;
  154. esac
  155. dnl clang is mostly GCC-compatible, but its version is much lower,
  156. dnl so we have to check for it.
  157. AC_MSG_CHECKING([if compiling with clang])
  158. AC_COMPILE_IFELSE(
  159. [AC_LANG_PROGRAM([], [[
  160. #ifndef __clang__
  161. not clang
  162. #endif
  163. ]])],
  164. [acv_mesa_CLANG=yes], [acv_mesa_CLANG=no])
  165. AC_MSG_RESULT([$acv_mesa_CLANG])
  166. dnl If we're using GCC, make sure that it is at least version 4.2.0. Older
  167. dnl versions are explictly not supported.
  168. GEN_ASM_OFFSETS=no
  169. USE_GNU99=no
  170. if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
  171. AC_MSG_CHECKING([whether gcc version is sufficient])
  172. major=0
  173. minor=0
  174. GCC_VERSION=`$CC -dumpversion`
  175. if test $? -eq 0; then
  176. GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
  177. GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
  178. fi
  179. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 2 ; then
  180. AC_MSG_RESULT([no])
  181. AC_MSG_ERROR([If using GCC, version 4.2.0 or later is required.])
  182. else
  183. AC_MSG_RESULT([yes])
  184. fi
  185. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 6 ; then
  186. USE_GNU99=yes
  187. fi
  188. if test "x$cross_compiling" = xyes; then
  189. GEN_ASM_OFFSETS=yes
  190. fi
  191. fi
  192. dnl We don't support building Mesa with Sun C compiler
  193. dnl https://bugs.freedesktop.org/show_bug.cgi?id=93189
  194. AC_CHECK_DECL([__SUNPRO_C], [SUNCC=yes], [SUNCC=no])
  195. if test "x$SUNCC" = xyes; then
  196. AC_MSG_ERROR([Building with Sun C compiler is not supported, use GCC instead.])
  197. fi
  198. dnl Check for compiler builtins
  199. AX_GCC_BUILTIN([__builtin_bswap32])
  200. AX_GCC_BUILTIN([__builtin_bswap64])
  201. AX_GCC_BUILTIN([__builtin_clz])
  202. AX_GCC_BUILTIN([__builtin_clzll])
  203. AX_GCC_BUILTIN([__builtin_ctz])
  204. AX_GCC_BUILTIN([__builtin_expect])
  205. AX_GCC_BUILTIN([__builtin_ffs])
  206. AX_GCC_BUILTIN([__builtin_ffsll])
  207. AX_GCC_BUILTIN([__builtin_popcount])
  208. AX_GCC_BUILTIN([__builtin_popcountll])
  209. AX_GCC_BUILTIN([__builtin_unreachable])
  210. AX_GCC_FUNC_ATTRIBUTE([const])
  211. AX_GCC_FUNC_ATTRIBUTE([flatten])
  212. AX_GCC_FUNC_ATTRIBUTE([format])
  213. AX_GCC_FUNC_ATTRIBUTE([malloc])
  214. AX_GCC_FUNC_ATTRIBUTE([packed])
  215. AX_GCC_FUNC_ATTRIBUTE([pure])
  216. AX_GCC_FUNC_ATTRIBUTE([returns_nonnull])
  217. AX_GCC_FUNC_ATTRIBUTE([unused])
  218. AX_GCC_FUNC_ATTRIBUTE([visibility])
  219. AX_GCC_FUNC_ATTRIBUTE([warn_unused_result])
  220. AX_GCC_FUNC_ATTRIBUTE([weak])
  221. AX_GCC_FUNC_ATTRIBUTE([alias])
  222. AX_GCC_FUNC_ATTRIBUTE([noreturn])
  223. AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)
  224. dnl Make sure the pkg-config macros are defined
  225. m4_ifndef([PKG_PROG_PKG_CONFIG],
  226. [m4_fatal([Could not locate the pkg-config autoconf macros.
  227. These are usually located in /usr/share/aclocal/pkg.m4. If your macros
  228. are in a different location, try setting the environment variable
  229. ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
  230. PKG_PROG_PKG_CONFIG()
  231. dnl LIB_DIR - library basename
  232. LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
  233. AC_SUBST([LIB_DIR])
  234. dnl Cache LDFLAGS and CPPFLAGS so we can add to them and restore later
  235. _SAVE_LDFLAGS="$LDFLAGS"
  236. _SAVE_CPPFLAGS="$CPPFLAGS"
  237. dnl Compiler macros
  238. DEFINES="-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
  239. AC_SUBST([DEFINES])
  240. android=no
  241. case "$host_os" in
  242. *-android*)
  243. android=yes
  244. ;;
  245. linux*|*-gnu*|gnu*|cygwin*)
  246. DEFINES="$DEFINES -D_GNU_SOURCE"
  247. ;;
  248. solaris*)
  249. DEFINES="$DEFINES -DSVR4"
  250. ;;
  251. esac
  252. AM_CONDITIONAL(HAVE_ANDROID, test "x$android" = xyes)
  253. dnl
  254. dnl Check compiler flags
  255. dnl
  256. AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
  257. AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration], [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"])
  258. AX_CHECK_COMPILE_FLAG([-Werror=missing-prototypes], [CFLAGS="$CFLAGS -Werror=missing-prototypes"])
  259. AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [CFLAGS="$CFLAGS -Wmissing-prototypes"])
  260. AX_CHECK_COMPILE_FLAG([-fno-math-errno], [CFLAGS="$CFLAGS -fno-math-errno"])
  261. AX_CHECK_COMPILE_FLAG([-fno-trapping-math], [CFLAGS="$CFLAGS -fno-trapping-math"])
  262. AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [VISIBILITY_CFLAGS="-fvisibility=hidden"])
  263. dnl
  264. dnl Check C++ compiler flags
  265. dnl
  266. AC_LANG_PUSH([C++])
  267. AX_CHECK_COMPILE_FLAG([-Wall], [CXXFLAGS="$CXXFLAGS -Wall"])
  268. AX_CHECK_COMPILE_FLAG([-fno-math-errno], [CXXFLAGS="$CXXFLAGS -fno-math-errno"])
  269. AX_CHECK_COMPILE_FLAG([-fno-trapping-math], [CXXFLAGS="$CXXFLAGS -fno-trapping-math"])
  270. AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [VISIBILITY_CXXFLAGS="-fvisibility=hidden"])
  271. AC_LANG_POP([C++])
  272. # Flags to help ensure that certain portions of the code -- and only those
  273. # portions -- can be built with MSVC:
  274. # - src/util, src/gallium/auxiliary, rc/gallium/drivers/llvmpipe, and
  275. # - non-Linux/Posix OpenGL portions needs to build on MSVC 2013 (which
  276. # supports most of C99)
  277. # - the rest has no compiler compiler restrictions
  278. AX_CHECK_COMPILE_FLAG([-Werror=pointer-arith], [MSVC2013_COMPAT_CFLAGS="$MSVC2013_COMPAT_CFLAGS -Werror=pointer-arith"])
  279. AX_CHECK_COMPILE_FLAG([-Werror=vla], [MSVC2013_COMPAT_CFLAGS="$MSVC2013_COMPAT_CFLAGS -Werror=vla"])
  280. AC_LANG_PUSH([C++])
  281. AX_CHECK_COMPILE_FLAG([-Werror=pointer-arith], [MSVC2013_COMPAT_CXXFLAGS="$MSVC2013_COMPAT_CXXFLAGS -Werror=pointer-arith"])
  282. AX_CHECK_COMPILE_FLAG([-Werror=vla], [MSVC2013_COMPAT_CXXFLAGS="$MSVC2013_COMPAT_CXXFLAGS -Werror=vla"])
  283. AC_LANG_POP([C++])
  284. AC_SUBST([MSVC2013_COMPAT_CFLAGS])
  285. AC_SUBST([MSVC2013_COMPAT_CXXFLAGS])
  286. if test "x$GCC" = xyes; then
  287. if test "x$USE_GNU99" = xyes; then
  288. CFLAGS="$CFLAGS -std=gnu99"
  289. else
  290. CFLAGS="$CFLAGS -std=c99"
  291. fi
  292. fi
  293. dnl
  294. dnl Check whether C++11 is supported, if the environment variable
  295. dnl CXX11_CXXFLAGS is set it takes precedence.
  296. dnl
  297. AC_LANG_PUSH([C++])
  298. check_cxx11_available() {
  299. output_support=$1
  300. AC_COMPILE_IFELSE(
  301. [AC_LANG_PROGRAM([
  302. #if !(__cplusplus >= 201103L)
  303. #error
  304. #endif
  305. #include <tuple>
  306. ])
  307. ], [
  308. AC_MSG_RESULT(yes)
  309. cxx11_support=yes
  310. ], AC_MSG_RESULT(no))
  311. eval "$output_support=\$cxx11_support"
  312. }
  313. HAVE_CXX11=no
  314. save_CXXFLAGS="$CXXFLAGS"
  315. dnl If the user provides a flag to enable c++11, then we test only this
  316. if test "x$CXX11_CXXFLAGS" != "x"; then
  317. CXXFLAGS="$CXXFLAGS $CXX11_CXXFLAGS"
  318. AC_MSG_CHECKING(whether c++11 is enabled by via $CXX11_CXXFLAGS)
  319. check_cxx11_available HAVE_CXX11
  320. else
  321. dnl test whether c++11 is enabled by default
  322. AC_MSG_CHECKING(whether c++11 is enabled by default)
  323. check_cxx11_available HAVE_CXX11
  324. dnl C++11 not enabled by default, test whether -std=c++11 does the job
  325. if test "x$HAVE_CXX11" != "xyes"; then
  326. CXX11_CXXFLAGS=-std=c++11
  327. CXXFLAGS="$CXXFLAGS $CXX11_CXXFLAGS"
  328. AC_MSG_CHECKING(whether c++11 is enabled by via $CXX11_CXXFLAGS)
  329. check_cxx11_available HAVE_CXX11
  330. fi
  331. fi
  332. CXXFLAGS="$save_CXXFLAGS"
  333. AM_CONDITIONAL(HAVE_STD_CXX11, test "x$HAVE_CXX11" = "xyes")
  334. AC_SUBST(CXX11_CXXFLAGS)
  335. AC_LANG_POP([C++])
  336. dnl even if the compiler appears to support it, using visibility attributes isn't
  337. dnl going to do anything useful currently on cygwin apart from emit lots of warnings
  338. case "$host_os" in
  339. cygwin*)
  340. VISIBILITY_CFLAGS=""
  341. VISIBILITY_CXXFLAGS=""
  342. ;;
  343. esac
  344. AC_SUBST([VISIBILITY_CFLAGS])
  345. AC_SUBST([VISIBILITY_CXXFLAGS])
  346. dnl For some reason, the test for -Wno-foo always succeeds with gcc, even if the
  347. dnl option is not supported. Hence, check for -Wfoo instead.
  348. AX_CHECK_COMPILE_FLAG([-Woverride-init], [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-override-init"]) # gcc
  349. AX_CHECK_COMPILE_FLAG([-Winitializer-overrides], [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-initializer-overrides"]) # clang
  350. AC_SUBST([WNO_OVERRIDE_INIT])
  351. dnl
  352. dnl Optional flags, check for compiler support
  353. dnl
  354. SSE41_CFLAGS="-msse4.1"
  355. dnl Code compiled by GCC with -msse* assumes a 16 byte aligned
  356. dnl stack, but on x86-32 such alignment is not guaranteed.
  357. case "$target_cpu" in
  358. i?86)
  359. SSE41_CFLAGS="$SSE41_CFLAGS -mstackrealign"
  360. ;;
  361. esac
  362. save_CFLAGS="$CFLAGS"
  363. CFLAGS="$SSE41_CFLAGS $CFLAGS"
  364. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  365. #include <smmintrin.h>
  366. int param;
  367. int main () {
  368. __m128i a = _mm_set1_epi32 (param), b = _mm_set1_epi32 (param + 1), c;
  369. c = _mm_max_epu32(a, b);
  370. return _mm_cvtsi128_si32(c);
  371. }]])], SSE41_SUPPORTED=1)
  372. CFLAGS="$save_CFLAGS"
  373. if test "x$SSE41_SUPPORTED" = x1; then
  374. DEFINES="$DEFINES -DUSE_SSE41"
  375. fi
  376. AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1])
  377. AC_SUBST([SSE41_CFLAGS], $SSE41_CFLAGS)
  378. dnl Check for new-style atomic builtins
  379. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  380. int main() {
  381. int n;
  382. return __atomic_load_n(&n, __ATOMIC_ACQUIRE);
  383. }]])], GCC_ATOMIC_BUILTINS_SUPPORTED=1)
  384. if test "x$GCC_ATOMIC_BUILTINS_SUPPORTED" = x1; then
  385. DEFINES="$DEFINES -DUSE_GCC_ATOMIC_BUILTINS"
  386. dnl On some platforms, new-style atomics need a helper library
  387. AC_MSG_CHECKING(whether -latomic is needed)
  388. AC_LINK_IFELSE([AC_LANG_SOURCE([[
  389. #include <stdint.h>
  390. uint64_t v;
  391. int main() {
  392. return (int)__atomic_load_n(&v, __ATOMIC_ACQUIRE);
  393. }]])], GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC=no, GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC=yes)
  394. AC_MSG_RESULT($GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC)
  395. if test "x$GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC" = xyes; then
  396. LIBATOMIC_LIBS="-latomic"
  397. fi
  398. fi
  399. AM_CONDITIONAL([GCC_ATOMIC_BUILTINS_SUPPORTED], [test x$GCC_ATOMIC_BUILTINS_SUPPORTED = x1])
  400. AC_SUBST([LIBATOMIC_LIBS])
  401. dnl Check if host supports 64-bit atomics
  402. dnl note that lack of support usually results in link (not compile) error
  403. AC_MSG_CHECKING(whether __sync_add_and_fetch_8 is supported)
  404. AC_LINK_IFELSE([AC_LANG_SOURCE([[
  405. #include <stdint.h>
  406. uint64_t v;
  407. int main() {
  408. return __sync_add_and_fetch(&v, (uint64_t)1);
  409. }]])], GCC_64BIT_ATOMICS_SUPPORTED=yes, GCC_64BIT_ATOMICS_SUPPORTED=no)
  410. if test "x$GCC_64BIT_ATOMICS_SUPPORTED" != xyes; then
  411. DEFINES="$DEFINES -DMISSING_64BIT_ATOMICS"
  412. fi
  413. AC_MSG_RESULT($GCC_64BIT_ATOMICS_SUPPORTED)
  414. dnl Check for Endianness
  415. AC_C_BIGENDIAN(
  416. little_endian=no,
  417. little_endian=yes,
  418. little_endian=no,
  419. little_endian=no
  420. )
  421. dnl Check for POWER8 Architecture
  422. PWR8_CFLAGS="-mpower8-vector"
  423. have_pwr8_intrinsics=no
  424. AC_MSG_CHECKING(whether gcc supports -mpower8-vector)
  425. save_CFLAGS=$CFLAGS
  426. CFLAGS="$PWR8_CFLAGS $CFLAGS"
  427. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  428. #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8))
  429. #error "Need GCC >= 4.8 for sane POWER8 support"
  430. #endif
  431. #include <altivec.h>
  432. int main () {
  433. vector unsigned char r;
  434. vector unsigned int v = vec_splat_u32 (1);
  435. r = __builtin_vec_vgbbd ((vector unsigned char) v);
  436. return 0;
  437. }]])], have_pwr8_intrinsics=yes)
  438. CFLAGS=$save_CFLAGS
  439. AC_ARG_ENABLE(pwr8,
  440. [AS_HELP_STRING([--disable-pwr8],
  441. [disable POWER8-specific instructions])],
  442. [enable_pwr8=$enableval], [enable_pwr8=auto])
  443. if test "x$enable_pwr8" = xno ; then
  444. have_pwr8_intrinsics=disabled
  445. fi
  446. if test $have_pwr8_intrinsics = yes && test $little_endian = yes ; then
  447. DEFINES="$DEFINES -D_ARCH_PWR8"
  448. CXXFLAGS="$CXXFLAGS $PWR8_CFLAGS"
  449. CFLAGS="$CFLAGS $PWR8_CFLAGS"
  450. else
  451. PWR8_CFLAGS=
  452. fi
  453. AC_MSG_RESULT($have_pwr8_intrinsics)
  454. if test "x$enable_pwr8" = xyes && test $have_pwr8_intrinsics = no ; then
  455. AC_MSG_ERROR([POWER8 compiler support not detected])
  456. fi
  457. if test $have_pwr8_intrinsics = yes && test $little_endian = no ; then
  458. AC_MSG_WARN([POWER8 optimization is enabled only on POWER8 Little-Endian])
  459. fi
  460. AC_SUBST([PWR8_CFLAGS], $PWR8_CFLAGS)
  461. dnl Can't have static and shared libraries, default to static if user
  462. dnl explicitly requested. If both disabled, set to static since shared
  463. dnl was explicitly requested.
  464. case "x$enable_static$enable_shared" in
  465. xyesyes)
  466. AC_MSG_ERROR([Cannot enable both static and shared. Building using --enable-shared is strongly recommended])
  467. ;;
  468. xnono)
  469. AC_MSG_ERROR([Cannot disable both static and shared. Building using --enable-shared is strongly recommended])
  470. ;;
  471. esac
  472. AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
  473. dnl
  474. dnl other compiler options
  475. dnl
  476. AC_ARG_ENABLE([debug],
  477. [AS_HELP_STRING([--enable-debug],
  478. [use debug compiler flags and macros @<:@default=disabled@:>@])],
  479. [enable_debug="$enableval"],
  480. [enable_debug=no]
  481. )
  482. AC_ARG_ENABLE([profile],
  483. [AS_HELP_STRING([--enable-profile],
  484. [enable profiling of code @<:@default=disabled@:>@])],
  485. [enable_profile="$enableval"],
  486. [enable_profile=no]
  487. )
  488. AC_ARG_ENABLE([sanitize],
  489. [AS_HELP_STRING([--enable-sanitize@<:@=address|undefined@:>@],
  490. [enable code sanitizer @<:@default=disabled@:>@])],
  491. [enable_sanitize="$enableval"],
  492. [enable_sanitize=no])
  493. if test "x$enable_profile" = xyes; then
  494. DEFINES="$DEFINES -DPROFILE"
  495. if test "x$GCC" = xyes; then
  496. CFLAGS="$CFLAGS -fno-omit-frame-pointer"
  497. fi
  498. if test "x$GXX" = xyes; then
  499. CXXFLAGS="$CXXFLAGS -fno-omit-frame-pointer"
  500. fi
  501. fi
  502. if test "x$enable_debug" = xyes; then
  503. DEFINES="$DEFINES -DDEBUG"
  504. if test "x$enable_profile" = xyes; then
  505. AC_MSG_WARN([Debug and Profile are enabled at the same time])
  506. fi
  507. if test "x$GCC" = xyes; then
  508. if ! echo "$CFLAGS" | grep -q -e '-g'; then
  509. CFLAGS="$CFLAGS -g"
  510. fi
  511. if ! echo "$CFLAGS" | grep -q -e '-O'; then
  512. CFLAGS="$CFLAGS -O0"
  513. fi
  514. fi
  515. if test "x$GXX" = xyes; then
  516. if ! echo "$CXXFLAGS" | grep -q -e '-g'; then
  517. CXXFLAGS="$CXXFLAGS -g"
  518. fi
  519. if ! echo "$CXXFLAGS" | grep -q -e '-O'; then
  520. CXXFLAGS="$CXXFLAGS -O0"
  521. fi
  522. fi
  523. else
  524. DEFINES="$DEFINES -DNDEBUG"
  525. fi
  526. if test "x$enable_sanitize" != xno; then
  527. if test "x$enable_profile" = xyes; then
  528. AC_MSG_WARN([Sanitize and Profile are enabled at the same time])
  529. fi
  530. CFLAGS="$CFLAGS -fsanitize=$enable_sanitize"
  531. CXXFLAGS="$CXXFLAGS -fsanitize=$enable_sanitize"
  532. LDFLAGS="$LDFLAGS -fsanitize=$enable_sanitize"
  533. AC_LINK_IFELSE(
  534. [AC_LANG_SOURCE([int main(){return 0;}])],
  535. [],
  536. [AC_MSG_FAILURE([sanitize flags '$enable_sanitize' not supported])])
  537. fi
  538. dnl
  539. dnl Check if linker supports -Bsymbolic
  540. dnl
  541. save_LDFLAGS=$LDFLAGS
  542. LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
  543. AC_MSG_CHECKING([if ld supports -Bsymbolic])
  544. AC_LINK_IFELSE(
  545. [AC_LANG_SOURCE([int main() { return 0;}])],
  546. [AC_MSG_RESULT([yes])
  547. BSYMBOLIC="-Wl,-Bsymbolic";],
  548. [AC_MSG_RESULT([no])
  549. BSYMBOLIC="";])
  550. LDFLAGS=$save_LDFLAGS
  551. AC_SUBST([BSYMBOLIC])
  552. dnl
  553. dnl Check if linker supports garbage collection
  554. dnl
  555. save_LDFLAGS=$LDFLAGS
  556. LDFLAGS="$LDFLAGS -Wl,--gc-sections"
  557. AC_MSG_CHECKING([whether ld supports --gc-sections])
  558. AC_LINK_IFELSE(
  559. [AC_LANG_SOURCE([static char UnusedFunc() { return 5; } int main() { return 0;}])],
  560. [AC_MSG_RESULT([yes])
  561. GC_SECTIONS="-Wl,--gc-sections";],
  562. [AC_MSG_RESULT([no])
  563. GC_SECTIONS="";])
  564. LDFLAGS=$save_LDFLAGS
  565. AC_SUBST([GC_SECTIONS])
  566. dnl
  567. dnl OpenBSD does not have DT_NEEDED entries for libc by design
  568. dnl so when these flags are passed to ld via libtool the checks will fail
  569. dnl
  570. case "$host_os" in
  571. openbsd* | darwin* )
  572. LD_NO_UNDEFINED="" ;;
  573. *)
  574. if test "x$enable_sanitize" = xno; then
  575. LD_NO_UNDEFINED="-Wl,--no-undefined"
  576. else
  577. LD_NO_UNDEFINED=""
  578. fi
  579. ;;
  580. esac
  581. AC_SUBST([LD_NO_UNDEFINED])
  582. dnl
  583. dnl Check if linker supports version scripts
  584. dnl
  585. AC_MSG_CHECKING([if the linker supports version-scripts])
  586. save_LDFLAGS=$LDFLAGS
  587. LDFLAGS="$LDFLAGS -Wl,--version-script=$srcdir/build-support/conftest.map"
  588. AC_LINK_IFELSE(
  589. [AC_LANG_SOURCE([int main() { return 0;}])],
  590. [have_ld_version_script=yes;AC_MSG_RESULT(yes)],
  591. [have_ld_version_script=no; AC_MSG_RESULT(no)])
  592. LDFLAGS=$save_LDFLAGS
  593. AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
  594. dnl
  595. dnl Check if linker supports dynamic list files
  596. dnl
  597. AC_MSG_CHECKING([if the linker supports --dynamic-list])
  598. save_LDFLAGS=$LDFLAGS
  599. LDFLAGS="$LDFLAGS -Wl,--dynamic-list=$srcdir/build-support/conftest.dyn"
  600. AC_LINK_IFELSE(
  601. [AC_LANG_SOURCE([int main() { return 0;}])],
  602. [have_ld_dynamic_list=yes;AC_MSG_RESULT(yes)],
  603. [have_ld_dynamic_list=no; AC_MSG_RESULT(no)])
  604. LDFLAGS=$save_LDFLAGS
  605. AM_CONDITIONAL(HAVE_LD_DYNAMIC_LIST, test "$have_ld_dynamic_list" = "yes")
  606. dnl
  607. dnl OSX linker does not support build-id
  608. dnl
  609. case "$host_os" in
  610. darwin*)
  611. LD_BUILD_ID=""
  612. ;;
  613. *)
  614. LD_BUILD_ID="-Wl,--build-id=sha1"
  615. ;;
  616. esac
  617. AC_SUBST([LD_BUILD_ID])
  618. dnl
  619. dnl compatibility symlinks
  620. dnl
  621. case "$host_os" in
  622. linux* )
  623. HAVE_COMPAT_SYMLINKS=yes ;;
  624. * )
  625. HAVE_COMPAT_SYMLINKS=no ;;
  626. esac
  627. AM_CONDITIONAL(HAVE_COMPAT_SYMLINKS, test "x$HAVE_COMPAT_SYMLINKS" = xyes)
  628. dnl
  629. dnl library names
  630. dnl
  631. dnl Unfortunately we need to do a few things that libtool can't help us with,
  632. dnl so we need some knowledge of shared library filenames:
  633. dnl
  634. dnl LIB_EXT is the extension used when creating symlinks for alternate
  635. dnl filenames for a shared library which will be dynamically loaded
  636. dnl
  637. dnl IMP_LIB_EXT is the extension used when checking for the presence of a
  638. dnl the file for a shared library we wish to link with
  639. dnl
  640. case "$host_os" in
  641. darwin* )
  642. LIB_EXT='dylib'
  643. IMP_LIB_EXT=$LIB_EXT
  644. ;;
  645. cygwin* )
  646. LIB_EXT='dll'
  647. IMP_LIB_EXT='dll.a'
  648. ;;
  649. aix* )
  650. LIB_EXT='a'
  651. IMP_LIB_EXT=$LIB_EXT
  652. ;;
  653. * )
  654. LIB_EXT='so'
  655. IMP_LIB_EXT=$LIB_EXT
  656. ;;
  657. esac
  658. AC_SUBST([LIB_EXT])
  659. dnl
  660. dnl potentially-infringing-but-nobody-knows-for-sure stuff
  661. dnl
  662. AC_ARG_ENABLE([texture-float],
  663. [AS_HELP_STRING([--enable-texture-float],
  664. [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
  665. [enable_texture_float="$enableval"],
  666. [enable_texture_float=no]
  667. )
  668. if test "x$enable_texture_float" = xyes; then
  669. AC_MSG_WARN([Floating-point textures enabled.])
  670. AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
  671. DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
  672. fi
  673. dnl
  674. dnl Arch/platform-specific settings
  675. dnl
  676. AC_ARG_ENABLE([asm],
  677. [AS_HELP_STRING([--disable-asm],
  678. [disable assembly usage @<:@default=enabled on supported platforms@:>@])],
  679. [enable_asm="$enableval"],
  680. [enable_asm=yes]
  681. )
  682. asm_arch=""
  683. AC_MSG_CHECKING([whether to enable assembly])
  684. test "x$enable_asm" = xno && AC_MSG_RESULT([no])
  685. # disable if cross compiling on x86/x86_64 since we must run gen_matypes
  686. if test "x$enable_asm" = xyes -a "x$cross_compiling" = xyes; then
  687. case "$host_cpu" in
  688. i?86 | x86_64 | amd64)
  689. if test "x$host_cpu" != "x$target_cpu"; then
  690. enable_asm=no
  691. AC_MSG_RESULT([no, cross compiling])
  692. fi
  693. ;;
  694. esac
  695. fi
  696. # check for supported arches
  697. if test "x$enable_asm" = xyes; then
  698. case "$host_cpu" in
  699. i?86)
  700. case "$host_os" in
  701. linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | gnu*)
  702. asm_arch=x86
  703. ;;
  704. esac
  705. ;;
  706. x86_64|amd64)
  707. case "$host_os" in
  708. linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
  709. asm_arch=x86_64
  710. ;;
  711. esac
  712. ;;
  713. sparc*)
  714. case "$host_os" in
  715. linux*)
  716. asm_arch=sparc
  717. ;;
  718. esac
  719. ;;
  720. powerpc64le)
  721. case "$host_os" in
  722. linux*)
  723. asm_arch=ppc64le
  724. ;;
  725. esac
  726. ;;
  727. aarch64)
  728. case "$host_os" in
  729. linux*)
  730. asm_arch=aarch64
  731. ;;
  732. esac
  733. ;;
  734. arm)
  735. case "$host_os" in
  736. linux*)
  737. asm_arch=arm
  738. ;;
  739. esac
  740. ;;
  741. esac
  742. case "$asm_arch" in
  743. x86)
  744. DEFINES="$DEFINES -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
  745. AC_MSG_RESULT([yes, x86])
  746. ;;
  747. x86_64|amd64)
  748. DEFINES="$DEFINES -DUSE_X86_64_ASM"
  749. AC_MSG_RESULT([yes, x86_64])
  750. ;;
  751. sparc)
  752. DEFINES="$DEFINES -DUSE_SPARC_ASM"
  753. AC_MSG_RESULT([yes, sparc])
  754. ;;
  755. ppc64le)
  756. DEFINES="$DEFINES -DUSE_PPC64LE_ASM"
  757. AC_MSG_RESULT([yes, ppc64le])
  758. ;;
  759. aarch64)
  760. DEFINES="$DEFINES -DUSE_AARCH64_ASM"
  761. AC_MSG_RESULT([yes, aarch64])
  762. ;;
  763. arm)
  764. DEFINES="$DEFINES -DUSE_ARM_ASM"
  765. AC_MSG_RESULT([yes, arm])
  766. ;;
  767. *)
  768. AC_MSG_RESULT([no, platform not supported])
  769. ;;
  770. esac
  771. fi
  772. AC_HEADER_MAJOR
  773. AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
  774. AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
  775. AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
  776. AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"])
  777. AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"])
  778. AC_CHECK_FUNC([memfd_create], [DEFINES="$DEFINES -DHAVE_MEMFD_CREATE"])
  779. AC_MSG_CHECKING([whether strtod has locale support])
  780. AC_LINK_IFELSE([AC_LANG_SOURCE([[
  781. #define _GNU_SOURCE
  782. #include <stdlib.h>
  783. #include <locale.h>
  784. #ifdef HAVE_XLOCALE_H
  785. #include <xlocale.h>
  786. #endif
  787. int main() {
  788. locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
  789. const char *s = "1.0";
  790. char *end;
  791. double d = strtod_l(s, end, loc);
  792. float f = strtof_l(s, end, loc);
  793. freelocale(loc);
  794. return 0;
  795. }]])],
  796. [DEFINES="$DEFINES -DHAVE_STRTOD_L"];
  797. AC_MSG_RESULT([yes]),
  798. AC_MSG_RESULT([no]))
  799. dnl Check to see if dlopen is in default libraries (like Solaris, which
  800. dnl has it in libc), or if libdl is needed to get it.
  801. AC_CHECK_FUNC([dlopen], [],
  802. [AC_CHECK_LIB([dl], [dlopen],
  803. [DLOPEN_LIBS="-ldl"])])
  804. AC_SUBST([DLOPEN_LIBS])
  805. dnl Check if that library also has dladdr
  806. save_LIBS="$LIBS"
  807. LIBS="$LIBS $DLOPEN_LIBS"
  808. AC_CHECK_FUNCS([dladdr])
  809. LIBS="$save_LIBS"
  810. AC_CHECK_FUNC([dl_iterate_phdr], [DEFINES="$DEFINES -DHAVE_DL_ITERATE_PHDR"])
  811. case "$host_os" in
  812. darwin*)
  813. ;;
  814. *)
  815. AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
  816. [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
  817. [AC_MSG_ERROR([Could not find clock_gettime])])])
  818. AC_SUBST([CLOCK_LIB])
  819. ;;
  820. esac
  821. dnl See if posix_memalign is available
  822. AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
  823. dnl Check for zlib
  824. PKG_CHECK_MODULES([ZLIB], [zlib >= $ZLIB_REQUIRED])
  825. DEFINES="$DEFINES -DHAVE_ZLIB"
  826. dnl Check for pthreads
  827. AX_PTHREAD
  828. if test "x$ax_pthread_ok" = xno; then
  829. AC_MSG_ERROR([Building mesa on this platform requires pthreads])
  830. fi
  831. dnl AX_PTHREADS leaves PTHREAD_LIBS empty for gcc and sets PTHREAD_CFLAGS
  832. dnl to -pthread, which causes problems if we need -lpthread to appear in
  833. dnl pkgconfig files. Since Android doesn't have a pthread lib, this check
  834. dnl is not valid for that platform.
  835. if test "x$android" = xno; then
  836. test -z "$PTHREAD_LIBS" && PTHREAD_LIBS="-lpthread"
  837. fi
  838. dnl According to the manual when using pthreads, one should add -pthread to
  839. dnl both compile and link-time arguments.
  840. dnl In practise that should be sufficient for all platforms, since any
  841. dnl platforms build with GCC and Clang support the flag.
  842. PTHREAD_LIBS="$PTHREAD_LIBS -pthread"
  843. dnl pthread-stubs is mandatory on BSD platforms, due to the nature of the
  844. dnl project. Even then there's a notable issue as described in the project README
  845. case "$host_os" in
  846. linux* | cygwin* | darwin* | solaris* | *-gnu* | gnu*)
  847. pthread_stubs_possible="no"
  848. ;;
  849. * )
  850. pthread_stubs_possible="yes"
  851. ;;
  852. esac
  853. if test "x$pthread_stubs_possible" = xyes; then
  854. PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs >= 0.4)
  855. fi
  856. dnl Check for futex for fast inline simple_mtx_t.
  857. AC_CHECK_HEADER([linux/futex.h], [DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"])
  858. dnl SELinux awareness.
  859. AC_ARG_ENABLE([selinux],
  860. [AS_HELP_STRING([--enable-selinux],
  861. [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
  862. [MESA_SELINUX="$enableval"],
  863. [MESA_SELINUX=no])
  864. if test "x$enable_selinux" = "xyes"; then
  865. PKG_CHECK_MODULES([SELINUX], [libselinux], [],
  866. [AC_CHECK_HEADER([selinux/selinux.h],[],
  867. [AC_MSG_ERROR([SELinux headers not found])])
  868. AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
  869. [AC_MSG_ERROR([SELinux library not found])])
  870. SELINUX_LIBS="-lselinux"])
  871. DEFINES="$DEFINES -DMESA_SELINUX"
  872. fi
  873. AC_SUBST([SELINUX_CFLAGS])
  874. AC_SUBST([SELINUX_LIBS])
  875. dnl
  876. dnl LLVM
  877. dnl
  878. AC_ARG_ENABLE([llvm-shared-libs],
  879. [AS_HELP_STRING([--enable-llvm-shared-libs],
  880. [link with LLVM shared libraries @<:@default=enabled@:>@])],
  881. [enable_llvm_shared_libs="$enableval"],
  882. [enable_llvm_shared_libs=yes])
  883. AC_ARG_WITH([llvm-prefix],
  884. [AS_HELP_STRING([--with-llvm-prefix],
  885. [Prefix for LLVM installations in non-standard locations])],
  886. [llvm_prefix="$withval"],
  887. [llvm_prefix=''])
  888. PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
  889. if test "x$have_libelf" = xno; then
  890. LIBELF_LIBS=''
  891. LIBELF_CFLAGS=''
  892. AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;LIBELF_LIBS=-lelf], [have_libelf=no])
  893. AC_SUBST([LIBELF_LIBS])
  894. AC_SUBST([LIBELF_CFLAGS])
  895. fi
  896. if test -z "$LLVM_CONFIG"; then
  897. if test -n "$llvm_prefix"; then
  898. AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
  899. else
  900. AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
  901. fi
  902. fi
  903. llvm_add_component() {
  904. new_llvm_component=$1
  905. driver_name=$2
  906. if $LLVM_CONFIG --components | grep -iqw $new_llvm_component ; then
  907. LLVM_COMPONENTS="${LLVM_COMPONENTS} ${new_llvm_component}"
  908. else
  909. AC_MSG_ERROR([LLVM component '$new_llvm_component' not enabled in your LLVM build. Required by $driver_name.])
  910. fi
  911. }
  912. llvm_add_optional_component() {
  913. new_llvm_component=$1
  914. driver_name=$2
  915. if $LLVM_CONFIG --components | grep -iqw $new_llvm_component ; then
  916. LLVM_COMPONENTS="${LLVM_COMPONENTS} ${new_llvm_component}"
  917. fi
  918. }
  919. llvm_add_default_components() {
  920. driver_name=$1
  921. # Required default components
  922. llvm_add_component "bitwriter" $driver_name
  923. llvm_add_component "engine" $driver_name
  924. llvm_add_component "mcdisassembler" $driver_name
  925. llvm_add_component "mcjit" $driver_name
  926. # Optional default components
  927. llvm_add_optional_component "inteljitevents" $driver_name
  928. }
  929. llvm_add_target() {
  930. new_llvm_target=$1
  931. driver_name=$2
  932. if $LLVM_CONFIG --targets-built | grep -iqw $new_llvm_target ; then
  933. llvm_add_component $new_llvm_target $driver_name
  934. else
  935. AC_MSG_ERROR([LLVM target '$new_llvm_target' not enabled in your LLVM build. Required by $driver_name.])
  936. fi
  937. }
  938. # Call this inside ` ` to get the return value.
  939. # $1 is the llvm-config command with arguments.
  940. strip_unwanted_llvm_flags() {
  941. echo " `$1` " | sed -E \
  942. -e 's/[[[:space:]]]+-m[[^[:space:]]]*//g' \
  943. -e 's/[[[:space:]]]+-DNDEBUG[[[:space:]]]/ /g' \
  944. -e 's/[[[:space:]]]+-D_GNU_SOURCE[[[:space:]]]/ /g' \
  945. -e 's/[[[:space:]]]+-pedantic[[[:space:]]]/ /g' \
  946. -e 's/[[[:space:]]]+-W[[^[:space:]]]*//g' \
  947. -e 's/[[[:space:]]]+-O[[^[:space:]]]*//g' \
  948. -e 's/[[[:space:]]]+-g[[^[:space:]]]*//g' \
  949. -e 's/-fno-rtti[[[:space:]]]/-Fno-rtti /g' \
  950. -e 's/[[[:space:]]]+-f[[^[:space:]]]*//g' \
  951. -e 's/-Fno-rtti[[[:space:]]]/-fno-rtti /g' \
  952. -e 's/^[[[:space:]]]//' \
  953. -e 's/[[[:space:]]]$//'
  954. }
  955. llvm_set_environment_variables() {
  956. if test "x$LLVM_CONFIG" != xno; then
  957. LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
  958. LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
  959. LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
  960. LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
  961. # We need to respect LLVM_CPPFLAGS when compiling LLVM headers.
  962. save_CFLAGS="$CFLAGS"
  963. CFLAGS="$CFLAGS $LLVM_CPPFLAGS"
  964. AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
  965. [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
  966. AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
  967. [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
  968. AC_COMPUTE_INT([LLVM_VERSION_PATCH], [LLVM_VERSION_PATCH],
  969. [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
  970. CFLAGS="$save_CFLAGS"
  971. # Only needed for LLVM < 3.6.0
  972. if test -z "$LLVM_VERSION_PATCH"; then
  973. LLVM_VERSION_PATCH=0
  974. fi
  975. LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
  976. FOUND_LLVM=yes
  977. else
  978. FOUND_LLVM=no
  979. LLVM_VERSION_INT=0
  980. fi
  981. }
  982. require_llvm() {
  983. if test "x$enable_llvm" != "xyes"; then
  984. AC_MSG_ERROR([--enable-llvm is required when building $1])
  985. fi
  986. }
  987. llvm_require_version() {
  988. require_llvm $2
  989. llvm_target_version_major=`echo $1 | cut -d. -f1 | egrep -o '^[[0-9]]+'`
  990. llvm_target_version_minor=`echo $1 | cut -d. -f2 | egrep -o '^[[0-9]]+'`
  991. llvm_target_version_patch=`echo $1 | cut -d. -f3 | egrep -o '^[[0-9]]+'`
  992. if test "$LLVM_VERSION_MAJOR" -gt "$llvm_target_version_major"; then
  993. # major > required major
  994. # --> OK
  995. return
  996. fi
  997. if test "$LLVM_VERSION_MAJOR" -eq "$llvm_target_version_major"; then
  998. if test "$LLVM_VERSION_MINOR" -gt "$llvm_target_version_minor"; then
  999. # major = required major and
  1000. # minor > required minor
  1001. # --> OK
  1002. return
  1003. else
  1004. if test "$LLVM_VERSION_MINOR" -eq "$llvm_target_version_minor"; then
  1005. if test "$LLVM_VERSION_PATCH" -ge "$llvm_target_version_patch"; then
  1006. # major = required major and
  1007. # minor = required minor and
  1008. # patch >= required patch
  1009. # --> OK
  1010. return
  1011. fi
  1012. fi
  1013. fi
  1014. fi
  1015. AC_MSG_ERROR([LLVM $1 or newer is required for $2])
  1016. }
  1017. radeon_llvm_check() {
  1018. if test ${LLVM_VERSION_INT} -lt 307; then
  1019. amdgpu_llvm_target_name='r600'
  1020. else
  1021. amdgpu_llvm_target_name='amdgpu'
  1022. fi
  1023. llvm_require_version $*
  1024. llvm_add_target $amdgpu_llvm_target_name $2
  1025. llvm_add_default_components $2
  1026. llvm_add_component "bitreader" $2
  1027. llvm_add_component "ipo" $2
  1028. if test "x$have_libelf" != xyes; then
  1029. AC_MSG_ERROR([$2 requires libelf when using llvm])
  1030. fi
  1031. }
  1032. llvm_set_environment_variables
  1033. AC_SUBST([LLVM_CFLAGS])
  1034. AC_SUBST([LLVM_CXXFLAGS])
  1035. AC_SUBST([LLVM_LIBS])
  1036. AC_SUBST([LLVM_LDFLAGS])
  1037. AC_SUBST([LLVM_INCLUDEDIR])
  1038. dnl
  1039. dnl libunwind
  1040. dnl
  1041. PKG_CHECK_EXISTS(libunwind, [HAVE_LIBUNWIND=yes], [HAVE_LIBUNWIND=no])
  1042. AC_ARG_ENABLE([libunwind],
  1043. [AS_HELP_STRING([--enable-libunwind],
  1044. [Use libunwind for backtracing (default: auto)])],
  1045. [LIBUNWIND="$enableval"],
  1046. [LIBUNWIND="$HAVE_LIBUNWIND"])
  1047. if test "x$LIBUNWIND" = "xyes"; then
  1048. PKG_CHECK_MODULES(LIBUNWIND, libunwind)
  1049. AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support])
  1050. fi
  1051. dnl Options for APIs
  1052. AC_ARG_ENABLE([opengl],
  1053. [AS_HELP_STRING([--disable-opengl],
  1054. [disable support for standard OpenGL API @<:@default=enabled@:>@])],
  1055. [enable_opengl="$enableval"],
  1056. [enable_opengl=yes])
  1057. AC_ARG_ENABLE([gles1],
  1058. [AS_HELP_STRING([--disable-gles1],
  1059. [disable support for OpenGL ES 1.x API @<:@default=enabled@:>@])],
  1060. [enable_gles1="$enableval"],
  1061. [enable_gles1=yes])
  1062. AC_ARG_ENABLE([gles2],
  1063. [AS_HELP_STRING([--disable-gles2],
  1064. [disable support for OpenGL ES 2.x API @<:@default=enabled@:>@])],
  1065. [enable_gles2="$enableval"],
  1066. [enable_gles2=yes])
  1067. AC_ARG_ENABLE([dri],
  1068. [AS_HELP_STRING([--enable-dri],
  1069. [enable DRI modules @<:@default=enabled@:>@])],
  1070. [enable_dri="$enableval"],
  1071. [enable_dri=yes])
  1072. AC_ARG_ENABLE([gallium-extra-hud],
  1073. [AS_HELP_STRING([--enable-gallium-extra-hud],
  1074. [enable HUD block/NIC I/O HUD stats support @<:@default=disabled@:>@])],
  1075. [enable_gallium_extra_hud="$enableval"],
  1076. [enable_gallium_extra_hud=no])
  1077. AM_CONDITIONAL(HAVE_GALLIUM_EXTRA_HUD, test "x$enable_gallium_extra_hud" = xyes)
  1078. if test "x$enable_gallium_extra_hud" = xyes ; then
  1079. DEFINES="${DEFINES} -DHAVE_GALLIUM_EXTRA_HUD=1"
  1080. fi
  1081. #TODO: no pkgconfig .pc available for libsensors.
  1082. #PKG_CHECK_MODULES([LIBSENSORS], [libsensors >= $LIBSENSORS_REQUIRED], [enable_lmsensors=yes], [enable_lmsensors=no])
  1083. AC_ARG_ENABLE([lmsensors],
  1084. [AS_HELP_STRING([--enable-lmsensors],
  1085. [enable HUD lmsensor support @<:@default=disabled@:>@])],
  1086. [enable_lmsensors="$enableval"],
  1087. [enable_lmsensors=no])
  1088. AM_CONDITIONAL(HAVE_LIBSENSORS, test "x$enable_lmsensors" = xyes)
  1089. if test "x$enable_lmsensors" = xyes ; then
  1090. DEFINES="${DEFINES} -DHAVE_LIBSENSORS=1"
  1091. LIBSENSORS_LIBS="-lsensors"
  1092. else
  1093. LIBSENSORS_LIBS=""
  1094. fi
  1095. AC_SUBST(LIBSENSORS_LIBS)
  1096. case "$host_os" in
  1097. linux*)
  1098. dri3_default=yes
  1099. ;;
  1100. *)
  1101. dri3_default=no
  1102. ;;
  1103. esac
  1104. if test "x$enable_dri" = xno; then
  1105. dri3_default=no
  1106. fi
  1107. AC_ARG_ENABLE([dri3],
  1108. [AS_HELP_STRING([--enable-dri3],
  1109. [enable DRI3 @<:@default=auto@:>@])],
  1110. [enable_dri3="$enableval"],
  1111. [enable_dri3="$dri3_default"])
  1112. AC_ARG_ENABLE([glx],
  1113. [AS_HELP_STRING([--enable-glx@<:@=dri|xlib|gallium-xlib@:>@],
  1114. [enable the GLX library and choose an implementation @<:@default=auto@:>@])],
  1115. [enable_glx="$enableval"],
  1116. [enable_glx=yes])
  1117. AC_ARG_ENABLE([osmesa],
  1118. [AS_HELP_STRING([--enable-osmesa],
  1119. [enable OSMesa library @<:@default=disabled@:>@])],
  1120. [enable_osmesa="$enableval"],
  1121. [enable_osmesa=no])
  1122. AC_ARG_ENABLE([gallium-osmesa],
  1123. [AS_HELP_STRING([--enable-gallium-osmesa],
  1124. [enable Gallium implementation of the OSMesa library @<:@default=disabled@:>@])],
  1125. [enable_gallium_osmesa="$enableval"],
  1126. [enable_gallium_osmesa=no])
  1127. AC_ARG_ENABLE([egl],
  1128. [AS_HELP_STRING([--disable-egl],
  1129. [disable EGL library @<:@default=enabled@:>@])],
  1130. [enable_egl="$enableval"],
  1131. [enable_egl=yes])
  1132. AC_ARG_ENABLE([xa],
  1133. [AS_HELP_STRING([--enable-xa],
  1134. [enable build of the XA X Acceleration API @<:@default=disabled@:>@])],
  1135. [enable_xa="$enableval"],
  1136. [enable_xa=no])
  1137. AC_ARG_ENABLE([gbm],
  1138. [AS_HELP_STRING([--enable-gbm],
  1139. [enable gbm library @<:@default=yes except cygwin and macOS@:>@])],
  1140. [enable_gbm="$enableval"],
  1141. [case "$host_os" in
  1142. cygwin* | darwin*)
  1143. enable_gbm=no
  1144. ;;
  1145. *)
  1146. enable_gbm=yes
  1147. ;;
  1148. esac])
  1149. AC_ARG_ENABLE([nine],
  1150. [AS_HELP_STRING([--enable-nine],
  1151. [enable build of the nine Direct3D9 API @<:@default=no@:>@])],
  1152. [enable_nine="$enableval"],
  1153. [enable_nine=no])
  1154. AC_ARG_ENABLE([xvmc],
  1155. [AS_HELP_STRING([--enable-xvmc],
  1156. [enable xvmc library @<:@default=auto@:>@])],
  1157. [enable_xvmc="$enableval"],
  1158. [enable_xvmc=auto])
  1159. AC_ARG_ENABLE([vdpau],
  1160. [AS_HELP_STRING([--enable-vdpau],
  1161. [enable vdpau library @<:@default=auto@:>@])],
  1162. [enable_vdpau="$enableval"],
  1163. [enable_vdpau=auto])
  1164. AC_ARG_ENABLE([omx],
  1165. [AS_HELP_STRING([--enable-omx],
  1166. [DEPRECATED: Use --enable-omx-bellagio instead @<:@default=auto@:>@])],
  1167. [AC_MSG_ERROR([--enable-omx is deprecated. Use --enable-omx-bellagio instead.])],
  1168. [])
  1169. AC_ARG_ENABLE([omx-bellagio],
  1170. [AS_HELP_STRING([--enable-omx-bellagio],
  1171. [enable OpenMAX Bellagio library @<:@default=disabled@:>@])],
  1172. [enable_omx_bellagio="$enableval"],
  1173. [enable_omx_bellagio=no])
  1174. AC_ARG_ENABLE([va],
  1175. [AS_HELP_STRING([--enable-va],
  1176. [enable va library @<:@default=auto@:>@])],
  1177. [enable_va="$enableval"],
  1178. [enable_va=auto])
  1179. AC_ARG_ENABLE([opencl],
  1180. [AS_HELP_STRING([--enable-opencl],
  1181. [enable OpenCL library @<:@default=disabled@:>@])],
  1182. [enable_opencl="$enableval"],
  1183. [enable_opencl=no])
  1184. AC_ARG_ENABLE([opencl_icd],
  1185. [AS_HELP_STRING([--enable-opencl-icd],
  1186. [Build an OpenCL ICD library to be loaded by an ICD implementation
  1187. @<:@default=enabled@:>@])],
  1188. [enable_opencl_icd="$enableval"],
  1189. [enable_opencl_icd=yes])
  1190. AC_ARG_ENABLE([gallium-tests],
  1191. [AS_HELP_STRING([--enable-gallium-tests],
  1192. [Enable optional Gallium tests) @<:@default=disabled@:>@])],
  1193. [enable_gallium_tests="$enableval"],
  1194. [enable_gallium_tests=no])
  1195. # Option for Gallium drivers
  1196. # Keep this in sync with the --with-gallium-drivers help string default value
  1197. GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
  1198. AC_ARG_WITH([gallium-drivers],
  1199. [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
  1200. [comma delimited Gallium drivers list, e.g.
  1201. "i915,nouveau,r300,r600,radeonsi,freedreno,pl111,svga,swrast,swr,vc4,vc5,virgl,etnaviv,imx"
  1202. @<:@default=r300,r600,svga,swrast@:>@])],
  1203. [with_gallium_drivers="$withval"],
  1204. [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
  1205. # Doing '--without-gallium-drivers' will set this variable to 'no'. Clear it
  1206. # here so that the script doesn't choke on an unknown driver name later.
  1207. case "$with_gallium_drivers" in
  1208. yes) with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT" ;;
  1209. no) with_gallium_drivers='' ;;
  1210. esac
  1211. if test "x$enable_opengl" = xno -a \
  1212. "x$enable_gles1" = xno -a \
  1213. "x$enable_gles2" = xno -a \
  1214. "x$enable_nine" = xno -a \
  1215. "x$enable_xa" = xno -a \
  1216. "x$enable_xvmc" = xno -a \
  1217. "x$enable_vdpau" = xno -a \
  1218. "x$enable_omx_bellagio" = xno -a \
  1219. "x$enable_va" = xno -a \
  1220. "x$enable_opencl" = xno; then
  1221. AC_MSG_ERROR([at least one API should be enabled])
  1222. fi
  1223. # Building OpenGL ES1 and/or ES2 without OpenGL is not supported on mesa 9.0.x
  1224. if test "x$enable_opengl" = xno -a \
  1225. "x$enable_gles1" = xyes; then
  1226. AC_MSG_ERROR([Building OpenGL ES1 without OpenGL is not supported])
  1227. fi
  1228. if test "x$enable_opengl" = xno -a \
  1229. "x$enable_gles2" = xyes; then
  1230. AC_MSG_ERROR([Building OpenGL ES2 without OpenGL is not supported])
  1231. fi
  1232. AM_CONDITIONAL(HAVE_OPENGL, test "x$enable_opengl" = xyes)
  1233. AM_CONDITIONAL(HAVE_OPENGL_ES1, test "x$enable_gles1" = xyes)
  1234. AM_CONDITIONAL(HAVE_OPENGL_ES2, test "x$enable_gles2" = xyes)
  1235. AM_CONDITIONAL(NEED_OPENGL_COMMON, test "x$enable_opengl" = xyes -o \
  1236. "x$enable_gles1" = xyes -o \
  1237. "x$enable_gles2" = xyes)
  1238. AM_CONDITIONAL(NEED_KHRPLATFORM, test "x$enable_egl" = xyes -o \
  1239. "x$enable_gles1" = xyes -o \
  1240. "x$enable_gles2" = xyes)
  1241. # Validate GLX options
  1242. if test "x$enable_glx" = xyes; then
  1243. if test "x$enable_dri" = xyes; then
  1244. enable_glx=dri
  1245. elif test -n "$with_gallium_drivers"; then
  1246. enable_glx=gallium-xlib
  1247. else
  1248. enable_glx=xlib
  1249. fi
  1250. fi
  1251. case "x$enable_glx" in
  1252. xdri | xxlib | xgallium-xlib)
  1253. # GLX requires OpenGL
  1254. if test "x$enable_opengl" = xno; then
  1255. AC_MSG_ERROR([GLX cannot be built without OpenGL])
  1256. fi
  1257. # Check individual dependencies
  1258. case "x$enable_glx" in
  1259. xdri)
  1260. if test "x$enable_dri" = xno; then
  1261. AC_MSG_ERROR([DRI-based GLX requires DRI to be enabled])
  1262. fi
  1263. ;;
  1264. xxlib)
  1265. if test "x$enable_dri" = xyes; then
  1266. AC_MSG_ERROR([Xlib-based GLX cannot be built with DRI enabled])
  1267. fi
  1268. ;;
  1269. xgallium-xlib )
  1270. if test "x$enable_dri" = xyes; then
  1271. AC_MSG_ERROR([Xlib-based (Gallium) GLX cannot be built with DRI enabled])
  1272. fi
  1273. if test -z "$with_gallium_drivers"; then
  1274. AC_MSG_ERROR([Xlib-based (Gallium) GLX cannot be built without Gallium enabled])
  1275. fi
  1276. ;;
  1277. esac
  1278. ;;
  1279. xno)
  1280. ;;
  1281. *)
  1282. AC_MSG_ERROR([Illegal value for --enable-glx: $enable_glx])
  1283. ;;
  1284. esac
  1285. AM_CONDITIONAL(HAVE_GLX, test "x$enable_glx" != xno)
  1286. AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xdri)
  1287. AM_CONDITIONAL(HAVE_XLIB_GLX, test "x$enable_glx" = xxlib)
  1288. AM_CONDITIONAL(HAVE_GALLIUM_XLIB_GLX, test "x$enable_glx" = xgallium-xlib)
  1289. DEFAULT_GL_LIB_NAME=GL
  1290. dnl
  1291. dnl Libglvnd configuration
  1292. dnl
  1293. AC_ARG_ENABLE([libglvnd],
  1294. [AS_HELP_STRING([--enable-libglvnd],
  1295. [Build GLX and EGL for libglvnd @<:@default=disabled@:>@])],
  1296. [enable_libglvnd="$enableval"],
  1297. [enable_libglvnd=no])
  1298. AM_CONDITIONAL(USE_LIBGLVND, test "x$enable_libglvnd" = xyes)
  1299. if test "x$enable_libglvnd" = xyes ; then
  1300. case "x$enable_glx" in
  1301. xxlib | xgallium-xlib )
  1302. AC_MSG_ERROR([cannot build libgvnd when Xlib-GLX or Gallium-Xlib-GLX is enabled])
  1303. ;;
  1304. esac
  1305. PKG_CHECK_MODULES([GLVND], libglvnd >= 0.2.0)
  1306. LIBGLVND_DATADIR=`$PKG_CONFIG --variable=datadir libglvnd`
  1307. AC_SUBST([LIBGLVND_DATADIR])
  1308. DEFINES="${DEFINES} -DUSE_LIBGLVND=1"
  1309. DEFAULT_GL_LIB_NAME=GLX_mesa
  1310. if test "x$enable_glx" = xno -a "x$enable_egl" = xno; then
  1311. AC_MSG_ERROR([cannot build libglvnd without GLX or EGL])
  1312. fi
  1313. fi
  1314. AC_ARG_WITH([gl-lib-name],
  1315. [AS_HELP_STRING([--with-gl-lib-name@<:@=NAME@:>@],
  1316. [specify GL library name @<:@default=GL@:>@])],
  1317. [GL_LIB=$withval],
  1318. [GL_LIB="$DEFAULT_GL_LIB_NAME"])
  1319. AC_ARG_WITH([osmesa-lib-name],
  1320. [AS_HELP_STRING([--with-osmesa-lib-name@<:@=NAME@:>@],
  1321. [specify OSMesa library name @<:@default=OSMesa@:>@])],
  1322. [OSMESA_LIB=$withval],
  1323. [OSMESA_LIB=OSMesa])
  1324. AS_IF([test "x$GL_LIB" = xyes], [GL_LIB="$DEFAULT_GL_LIB_NAME"])
  1325. AS_IF([test "x$OSMESA_LIB" = xyes], [OSMESA_LIB=OSMesa])
  1326. dnl
  1327. dnl Mangled Mesa support
  1328. dnl
  1329. AC_ARG_ENABLE([mangling],
  1330. [AS_HELP_STRING([--enable-mangling],
  1331. [enable mangled symbols and library name @<:@default=disabled@:>@])],
  1332. [enable_mangling="${enableval}"],
  1333. [enable_mangling=no]
  1334. )
  1335. if test "x${enable_mangling}" = "xyes" ; then
  1336. DEFINES="${DEFINES} -DUSE_MGL_NAMESPACE"
  1337. GL_LIB="Mangled${GL_LIB}"
  1338. OSMESA_LIB="Mangled${OSMESA_LIB}"
  1339. fi
  1340. AC_SUBST([GL_LIB])
  1341. AC_SUBST([OSMESA_LIB])
  1342. # Check for libdrm
  1343. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
  1344. [have_libdrm=yes], [have_libdrm=no])
  1345. if test "x$have_libdrm" = xyes; then
  1346. DEFINES="$DEFINES -DHAVE_LIBDRM"
  1347. fi
  1348. require_libdrm() {
  1349. if test "x$have_libdrm" != xyes; then
  1350. AC_MSG_ERROR([$1 requires libdrm >= $LIBDRM_REQUIRED])
  1351. fi
  1352. }
  1353. # Select which platform-dependent DRI code gets built
  1354. case "$host_os" in
  1355. darwin*)
  1356. dri_platform='apple' ;;
  1357. cygwin*)
  1358. dri_platform='windows' ;;
  1359. gnu*)
  1360. dri_platform='none' ;;
  1361. *)
  1362. dri_platform='drm' ;;
  1363. esac
  1364. if test "x$enable_dri" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes; then
  1365. have_drisw_kms='yes'
  1366. fi
  1367. AM_CONDITIONAL(HAVE_DRICOMMON, test "x$enable_dri" = xyes )
  1368. AM_CONDITIONAL(HAVE_DRISW, test "x$enable_dri" = xyes )
  1369. AM_CONDITIONAL(HAVE_DRISW_KMS, test "x$have_drisw_kms" = xyes )
  1370. AM_CONDITIONAL(HAVE_DRI2, test "x$enable_dri" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes )
  1371. AM_CONDITIONAL(HAVE_DRI3, test "x$enable_dri3" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes )
  1372. AM_CONDITIONAL(HAVE_APPLEDRI, test "x$enable_dri" = xyes -a "x$dri_platform" = xapple )
  1373. AM_CONDITIONAL(HAVE_LMSENSORS, test "x$enable_lmsensors" = xyes )
  1374. AM_CONDITIONAL(HAVE_GALLIUM_EXTRA_HUD, test "x$enable_gallium_extra_hud" = xyes )
  1375. AM_CONDITIONAL(HAVE_WINDOWSDRI, test "x$enable_dri" = xyes -a "x$dri_platform" = xwindows )
  1376. AC_ARG_ENABLE([shared-glapi],
  1377. [AS_HELP_STRING([--enable-shared-glapi],
  1378. [Enable shared glapi for OpenGL @<:@default=enabled@:>@])],
  1379. [enable_shared_glapi="$enableval"],
  1380. [enable_shared_glapi=yes])
  1381. case "x$enable_opengl$enable_gles1$enable_gles2" in
  1382. x*yes*yes*)
  1383. if test "x$enable_shared_glapi" = xno; then
  1384. AC_MSG_ERROR([shared GLAPI required when building two or more of
  1385. the following APIs - opengl, gles1 gles2])
  1386. fi
  1387. ;;
  1388. esac
  1389. AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
  1390. # Build the pipe-drivers as separate libraries/modules.
  1391. # Do not touch this unless you know what you are doing.
  1392. # XXX: Expose via configure option ?
  1393. enable_shared_pipe_drivers=no
  1394. dnl
  1395. dnl Driver specific build directories
  1396. dnl
  1397. if test "x$enable_gallium_osmesa" = xyes; then
  1398. if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
  1399. AC_MSG_ERROR([gallium_osmesa requires the gallium swrast driver])
  1400. fi
  1401. if test "x$enable_osmesa" = xyes; then
  1402. AC_MSG_ERROR([Cannot enable both classic and Gallium OSMesa implementations])
  1403. fi
  1404. fi
  1405. require_dri_shared_libs_and_glapi() {
  1406. if test "x$enable_static" = xyes; then
  1407. AC_MSG_ERROR([$1 cannot be build as static library])
  1408. fi
  1409. if test "x$enable_dri" != xyes; then
  1410. # There is only a single backend which won't be build/used otherwise.
  1411. # XXX: Revisit this as the egl/haiku is a thing.
  1412. AC_MSG_ERROR([$1 requires --enable-dri])
  1413. fi
  1414. if test "x$enable_shared_glapi" != xyes; then
  1415. AC_MSG_ERROR([$1 requires --enable-shared-glapi])
  1416. fi
  1417. }
  1418. if test "x$enable_dri" = xyes; then
  1419. require_dri_shared_libs_and_glapi "DRI"
  1420. # not a hard requirement as swrast does not depend on it
  1421. if test "x$have_libdrm" = xyes; then
  1422. DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
  1423. fi
  1424. fi
  1425. AC_ARG_ENABLE([driglx-direct],
  1426. [AS_HELP_STRING([--disable-driglx-direct],
  1427. [disable direct rendering in GLX and EGL for DRI \
  1428. @<:@default=enabled@:>@])],
  1429. [driglx_direct="$enableval"],
  1430. [driglx_direct="yes"])
  1431. dnl
  1432. dnl libGL configuration per driver
  1433. dnl
  1434. if test "x$enable_glx" != xno; then
  1435. PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
  1436. fi
  1437. case "x$enable_glx" in
  1438. xxlib | xgallium-xlib)
  1439. # Xlib-based GLX
  1440. dri_modules="x11 xext xcb"
  1441. PKG_CHECK_MODULES([XLIBGL], [$dri_modules])
  1442. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  1443. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  1444. GL_LIB_DEPS="$XLIBGL_LIBS"
  1445. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1446. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm $PTHREAD_LIBS"
  1447. ;;
  1448. xdri)
  1449. # DRI-based GLX
  1450. # find the DRI deps for libGL
  1451. dri_modules="x11 xext xdamage >= $XDAMAGE_REQUIRED xfixes x11-xcb xcb xcb-glx >= $XCBGLX_REQUIRED"
  1452. if test x"$driglx_direct" = xyes; then
  1453. if test x"$dri_platform" = xdrm ; then
  1454. DEFINES="$DEFINES -DGLX_USE_DRM"
  1455. require_libdrm "Direct rendering"
  1456. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  1457. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
  1458. if test x"$enable_dri" = xyes; then
  1459. dri_modules="$dri_modules xcb-dri2 >= $XCBDRI2_REQUIRED"
  1460. fi
  1461. fi
  1462. if test x"$dri_platform" = xapple ; then
  1463. DEFINES="$DEFINES -DGLX_USE_APPLEGL"
  1464. fi
  1465. if test x"$dri_platform" = xwindows ; then
  1466. DEFINES="$DEFINES -DGLX_USE_WINDOWSGL"
  1467. fi
  1468. fi
  1469. # add xf86vidmode if available
  1470. PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
  1471. if test "$HAVE_XF86VIDMODE" = yes ; then
  1472. dri_modules="$dri_modules xxf86vm"
  1473. fi
  1474. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  1475. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  1476. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  1477. GL_LIB_DEPS="$DRIGL_LIBS"
  1478. # need DRM libs, $PTHREAD_LIBS, etc.
  1479. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1480. GL_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1481. ;;
  1482. esac
  1483. # This is outside the case (above) so that it is invoked even for non-GLX
  1484. # builds.
  1485. AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
  1486. GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1487. GLESv1_CM_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1488. GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1489. GLESv2_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1490. AC_SUBST([X11_INCLUDES])
  1491. AC_SUBST([GL_LIB_DEPS])
  1492. AC_SUBST([GL_PC_REQ_PRIV])
  1493. AC_SUBST([GL_PC_LIB_PRIV])
  1494. AC_SUBST([GL_PC_CFLAGS])
  1495. AC_SUBST([DRI_PC_REQ_PRIV])
  1496. AC_SUBST([GLESv1_CM_LIB_DEPS])
  1497. AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
  1498. AC_SUBST([GLESv2_LIB_DEPS])
  1499. AC_SUBST([GLESv2_PC_LIB_PRIV])
  1500. AC_SUBST([HAVE_XF86VIDMODE])
  1501. dnl
  1502. dnl More GLX setup
  1503. dnl
  1504. case "x$enable_glx" in
  1505. xxlib | xgallium-xlib)
  1506. DEFINES="$DEFINES -DUSE_XSHM"
  1507. ;;
  1508. xdri)
  1509. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  1510. if test "x$driglx_direct" = xyes; then
  1511. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  1512. fi
  1513. ;;
  1514. esac
  1515. dnl
  1516. dnl TLS detection
  1517. dnl
  1518. AC_ARG_ENABLE([glx-tls],
  1519. [AS_HELP_STRING([--enable-glx-tls],
  1520. [enable TLS support in GLX @<:@default=enabled@:>@])],
  1521. [GLX_USE_TLS="$enableval"],
  1522. [GLX_USE_TLS=yes])
  1523. AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
  1524. if test "x$GLX_USE_TLS" = xyes; then
  1525. DEFINES="$DEFINES -DGLX_USE_TLS"
  1526. fi
  1527. dnl Read-only text section on x86 hardened platforms
  1528. AC_ARG_ENABLE([glx-read-only-text],
  1529. [AS_HELP_STRING([--enable-glx-read-only-text],
  1530. [Disable writable .text section on x86 (decreases performance) @<:@default=disabled@:>@])],
  1531. [enable_glx_read_only_text="$enableval"],
  1532. [enable_glx_read_only_text=no])
  1533. if test "x$enable_glx_read_only_text" = xyes; then
  1534. DEFINES="$DEFINES -DGLX_X86_READONLY_TEXT"
  1535. fi
  1536. dnl
  1537. dnl DEPRECATED: EGL Platforms configuration
  1538. dnl
  1539. AC_ARG_WITH([egl-platforms],
  1540. [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
  1541. [DEPRECATED: use --with-platforms instead@<:@default=auto@:>@])],
  1542. [with_egl_platforms="$withval"],
  1543. [with_egl_platforms=auto])
  1544. if test "x$with_egl_platforms" = xauto; then
  1545. with_egl_platforms="x11,surfaceless"
  1546. if test "x$enable_gbm" = xyes; then
  1547. with_egl_platforms="$with_egl_platforms,drm"
  1548. fi
  1549. else
  1550. AC_MSG_WARN([--with-egl-platforms is deprecated. Use --with-platforms instead.])
  1551. fi
  1552. dnl
  1553. dnl Platforms configuration
  1554. dnl
  1555. AC_ARG_WITH([platforms],
  1556. [AS_HELP_STRING([--with-platforms@<:@=DIRS...@:>@],
  1557. [comma delimited native platforms libEGL/Vulkan/other supports, e.g.
  1558. "x11,drm,wayland,surfaceless..." @<:@default=auto@:>@])],
  1559. [with_platforms="$withval"],
  1560. [with_platforms=auto])
  1561. # Reuse the autodetection rather than duplicating it.
  1562. if test "x$with_platforms" = xauto; then
  1563. with_platforms=$with_egl_platforms
  1564. fi
  1565. PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland-scanner],
  1566. WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`,
  1567. WAYLAND_SCANNER='')
  1568. if test "x$WAYLAND_SCANNER" = x; then
  1569. AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner], [:])
  1570. fi
  1571. PKG_CHECK_EXISTS([wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED], [have_wayland_protocols=yes], [have_wayland_protocols=no])
  1572. if test "x$have_wayland_protocols" = xyes; then
  1573. ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
  1574. fi
  1575. AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
  1576. # Do per platform setups and checks
  1577. platforms=`IFS=', '; echo $with_platforms`
  1578. for plat in $platforms; do
  1579. case "$plat" in
  1580. wayland)
  1581. PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client >= $WAYLAND_REQUIRED])
  1582. PKG_CHECK_MODULES([WAYLAND_SERVER], [wayland-server >= $WAYLAND_REQUIRED])
  1583. if test "x$WAYLAND_SCANNER" = "x:"; then
  1584. AC_MSG_ERROR([wayland-scanner is needed to compile the wayland platform])
  1585. fi
  1586. if test "x$have_wayland_protocols" = xno; then
  1587. AC_MSG_ERROR([wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED is needed to compile the wayland platform])
  1588. fi
  1589. DEFINES="$DEFINES -DHAVE_WAYLAND_PLATFORM -DWL_HIDE_DEPRECATED"
  1590. ;;
  1591. x11)
  1592. PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED xcb-xfixes])
  1593. DEFINES="$DEFINES -DHAVE_X11_PLATFORM"
  1594. ;;
  1595. drm)
  1596. test "x$enable_gbm" = "xno" &&
  1597. AC_MSG_ERROR([EGL platform drm needs gbm])
  1598. DEFINES="$DEFINES -DHAVE_DRM_PLATFORM"
  1599. ;;
  1600. surfaceless)
  1601. DEFINES="$DEFINES -DHAVE_SURFACELESS_PLATFORM"
  1602. ;;
  1603. android)
  1604. PKG_CHECK_MODULES([ANDROID], [cutils hardware sync])
  1605. DEFINES="$DEFINES -DHAVE_ANDROID_PLATFORM"
  1606. ;;
  1607. *)
  1608. AC_MSG_ERROR([platform '$plat' does not exist])
  1609. ;;
  1610. esac
  1611. case "$plat" in
  1612. wayland|drm|surfaceless)
  1613. require_libdrm "Platform $plat"
  1614. ;;
  1615. esac
  1616. done
  1617. if test "x$enable_glx" != xno; then
  1618. if ! echo "$platforms" | grep -q 'x11'; then
  1619. AC_MSG_ERROR([Building GLX without the x11 platform is not supported])
  1620. fi
  1621. fi
  1622. if test x"$enable_dri3" = xyes; then
  1623. DEFINES="$DEFINES -DHAVE_DRI3"
  1624. dri3_modules="x11-xcb xcb >= $XCB_REQUIRED xcb-dri3 xcb-xfixes xcb-present xcb-sync xshmfence >= $XSHMFENCE_REQUIRED"
  1625. PKG_CHECK_MODULES([XCB_DRI3], [$dri3_modules])
  1626. fi
  1627. AM_CONDITIONAL(HAVE_PLATFORM_X11, echo "$platforms" | grep -q 'x11')
  1628. AM_CONDITIONAL(HAVE_PLATFORM_WAYLAND, echo "$platforms" | grep -q 'wayland')
  1629. AM_CONDITIONAL(HAVE_PLATFORM_DRM, echo "$platforms" | grep -q 'drm')
  1630. AM_CONDITIONAL(HAVE_PLATFORM_SURFACELESS, echo "$platforms" | grep -q 'surfaceless')
  1631. AM_CONDITIONAL(HAVE_PLATFORM_ANDROID, echo "$platforms" | grep -q 'android')
  1632. dnl
  1633. dnl More DRI setup
  1634. dnl
  1635. dnl Directory for DRI drivers
  1636. AC_ARG_WITH([dri-driverdir],
  1637. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  1638. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  1639. [DRI_DRIVER_INSTALL_DIR="$withval"],
  1640. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  1641. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  1642. dnl Extra search path for DRI drivers
  1643. AC_ARG_WITH([dri-searchpath],
  1644. [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
  1645. [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
  1646. [DRI_DRIVER_SEARCH_DIR="$withval"],
  1647. [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
  1648. AC_SUBST([DRI_DRIVER_SEARCH_DIR])
  1649. dnl Which drivers to build - default is chosen by platform
  1650. AC_ARG_WITH([dri-drivers],
  1651. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  1652. [comma delimited classic DRI drivers list, e.g.
  1653. "i915,i965,nouveau,radeon,r200,swrast" @<:@default=auto@:>@])],
  1654. [with_dri_drivers="$withval"],
  1655. [with_dri_drivers=auto])
  1656. if test "x$with_dri_drivers" = xauto; then
  1657. if test "x$enable_opengl" = xyes -a "x$enable_dri" = xyes; then
  1658. with_dri_drivers="yes"
  1659. else
  1660. with_dri_drivers="no"
  1661. fi
  1662. fi
  1663. if test "x$with_dri_drivers" = xno; then
  1664. with_dri_drivers=''
  1665. fi
  1666. # Check for expat
  1667. PKG_CHECK_MODULES([EXPAT], [expat],,
  1668. [PKG_CHECK_MODULES([EXPAT], [expat21])]
  1669. )
  1670. dnl If $with_dri_drivers is yes, drivers will be added through
  1671. dnl platform checks. Set DEFINES and LIB_DEPS
  1672. if test "x$enable_dri" = xyes; then
  1673. # Platform specific settings and drivers to build
  1674. case "$host_os" in
  1675. linux*)
  1676. case "$host_cpu" in
  1677. powerpc* | sparc*)
  1678. # Build only the drivers for cards that exist on PowerPC/sparc
  1679. if test "x$with_dri_drivers" = "xyes"; then
  1680. with_dri_drivers="r200 radeon swrast"
  1681. fi
  1682. ;;
  1683. esac
  1684. ;;
  1685. cygwin*)
  1686. if test "x$with_dri_drivers" = "xyes"; then
  1687. with_dri_drivers="swrast"
  1688. fi
  1689. ;;
  1690. darwin*)
  1691. DEFINES="$DEFINES -DBUILDING_MESA"
  1692. if test "x$with_dri_drivers" = "xyes"; then
  1693. with_dri_drivers="swrast"
  1694. fi
  1695. ;;
  1696. esac
  1697. # default drivers
  1698. if test "x$with_dri_drivers" = "xyes"; then
  1699. with_dri_drivers="i915 i965 nouveau r200 radeon swrast"
  1700. fi
  1701. # put all the necessary libs together
  1702. DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1703. fi
  1704. AC_SUBST([DRI_LIB_DEPS])
  1705. DRI_DIRS=''
  1706. dnl Duplicates in DRI_DIRS are removed by sorting it at the end of this block
  1707. if test -n "$with_dri_drivers"; then
  1708. if test "x$enable_opengl" != xyes; then
  1709. AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
  1710. fi
  1711. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  1712. for driver in $dri_drivers; do
  1713. DRI_DIRS="$DRI_DIRS $driver"
  1714. case "x$driver" in
  1715. xi915)
  1716. require_libdrm "i915"
  1717. HAVE_I915_DRI=yes
  1718. PKG_CHECK_MODULES([I915], [libdrm >= $LIBDRM_INTEL_REQUIRED libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1719. ;;
  1720. xi965)
  1721. require_libdrm "i965"
  1722. HAVE_I965_DRI=yes
  1723. ;;
  1724. xnouveau)
  1725. require_libdrm "nouveau"
  1726. HAVE_NOUVEAU_DRI=yes
  1727. PKG_CHECK_MODULES([NVVIEUX], [libdrm >= $LIBDRM_NVVIEUX_REQUIRED libdrm_nouveau >= $LIBDRM_NVVIEUX_REQUIRED])
  1728. ;;
  1729. xradeon)
  1730. require_libdrm "radeon"
  1731. HAVE_RADEON_DRI=yes;
  1732. PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1733. ;;
  1734. xr200)
  1735. require_libdrm "r200"
  1736. HAVE_R200_DRI=yes
  1737. PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1738. ;;
  1739. xswrast)
  1740. HAVE_SWRAST_DRI=yes
  1741. ;;
  1742. *)
  1743. AC_MSG_ERROR([classic DRI driver '$driver' does not exist])
  1744. ;;
  1745. esac
  1746. done
  1747. DRI_DIRS=`echo $DRI_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
  1748. fi
  1749. dnl
  1750. dnl Gallium LLVM
  1751. dnl Deprecated: kept for backwards compatibility
  1752. dnl
  1753. AC_ARG_ENABLE([gallium-llvm],
  1754. [AS_HELP_STRING([--enable-gallium-llvm],
  1755. [DEPRECATED: use --enable-llvm instead])],
  1756. [enable_gallium_llvm="$enableval"],
  1757. [enable_gallium_llvm=auto])
  1758. if test "x$enable_gallium_llvm" != xauto; then
  1759. AC_MSG_WARN([The --enable-gallium-llvm option has been deprecated. Use --enable-llvm instead.])
  1760. enable_llvm=$enable_gallium_llvm
  1761. fi
  1762. dnl
  1763. dnl LLVM
  1764. dnl
  1765. AC_ARG_ENABLE([llvm],
  1766. [AS_HELP_STRING([--enable-llvm],
  1767. [build with LLVM support @<:@default=enabled on x86/x86_64@:>@])],
  1768. [enable_llvm="$enableval"],
  1769. [enable_llvm=auto])
  1770. if test "x$enable_llvm" = xauto -a "x$FOUND_LLVM" = xyes; then
  1771. if test "x$FOUND_LLVM" = xyes; then
  1772. case "$host_cpu" in
  1773. i*86|x86_64|amd64) enable_llvm=yes;;
  1774. *) enable_llvm=no;;
  1775. esac
  1776. else
  1777. enable_llvm=no
  1778. fi
  1779. fi
  1780. if test "x$enable_llvm" = xyes -a "x$FOUND_LLVM" = xno; then
  1781. AC_MSG_ERROR([--enable-llvm selected but llvm-config is not found])
  1782. fi
  1783. #
  1784. # Vulkan driver configuration
  1785. #
  1786. AC_ARG_WITH([vulkan-drivers],
  1787. [AS_HELP_STRING([--with-vulkan-drivers@<:@=DIRS...@:>@],
  1788. [comma delimited Vulkan drivers list, e.g.
  1789. "intel,radeon"
  1790. @<:@default=no@:>@])],
  1791. [with_vulkan_drivers="$withval"],
  1792. [with_vulkan_drivers="no"])
  1793. # Doing '--without-vulkan-drivers' will set this variable to 'no'. Clear it
  1794. # here so that the script doesn't choke on an unknown driver name later.
  1795. case "x$with_vulkan_drivers" in
  1796. xyes) with_vulkan_drivers="$VULKAN_DRIVERS_DEFAULT" ;;
  1797. xno) with_vulkan_drivers='' ;;
  1798. esac
  1799. AC_ARG_WITH([vulkan-icddir],
  1800. [AS_HELP_STRING([--with-vulkan-icddir=DIR],
  1801. [directory for the Vulkan driver icd files @<:@${datarootdir}/vulkan/icd.d@:>@])],
  1802. [VULKAN_ICD_INSTALL_DIR="$withval"],
  1803. [VULKAN_ICD_INSTALL_DIR='${datarootdir}/vulkan/icd.d'])
  1804. AC_SUBST([VULKAN_ICD_INSTALL_DIR])
  1805. require_x11_dri3() {
  1806. if echo "$platforms" | grep -q 'x11'; then
  1807. if test "x$enable_dri3" != xyes; then
  1808. AC_MSG_ERROR([$1 Vulkan driver requires DRI3 when built with X11])
  1809. fi
  1810. fi
  1811. }
  1812. if test -n "$with_vulkan_drivers"; then
  1813. if test "x$ac_cv_func_dl_iterate_phdr" = xno; then
  1814. AC_MSG_ERROR([Vulkan drivers require the dl_iterate_phdr function])
  1815. fi
  1816. VULKAN_DRIVERS=`IFS=', '; echo $with_vulkan_drivers`
  1817. for driver in $VULKAN_DRIVERS; do
  1818. case "x$driver" in
  1819. xintel)
  1820. require_libdrm "ANV"
  1821. require_x11_dri3 "ANV"
  1822. HAVE_INTEL_VULKAN=yes
  1823. ;;
  1824. xradeon)
  1825. require_libdrm "radv"
  1826. PKG_CHECK_MODULES([AMDGPU], [libdrm >= $LIBDRM_AMDGPU_REQUIRED libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
  1827. radeon_llvm_check $LLVM_REQUIRED_RADV "radv"
  1828. require_x11_dri3 "radv"
  1829. HAVE_RADEON_VULKAN=yes
  1830. ;;
  1831. *)
  1832. AC_MSG_ERROR([Vulkan driver '$driver' does not exist])
  1833. ;;
  1834. esac
  1835. done
  1836. VULKAN_DRIVERS=`echo $VULKAN_DRIVERS|tr " " "\n"|sort -u|tr "\n" " "`
  1837. fi
  1838. DEFINES="$DEFINES -DENABLE_SHADER_CACHE"
  1839. AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")
  1840. AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_glx" = xxlib -o \
  1841. "x$enable_osmesa" = xyes -o \
  1842. -n "$DRI_DIRS")
  1843. dnl
  1844. dnl OSMesa configuration
  1845. dnl
  1846. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  1847. AC_ARG_WITH([osmesa-bits],
  1848. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  1849. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  1850. [osmesa_bits="$withval"],
  1851. [osmesa_bits=8])
  1852. if test "x$osmesa_bits" != x8; then
  1853. if test "x$enable_dri" = xyes -o "x$enable_glx" != xno; then
  1854. AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa driver])
  1855. osmesa_bits=8
  1856. fi
  1857. fi
  1858. case "x$osmesa_bits" in
  1859. x8)
  1860. OSMESA_LIB="${OSMESA_LIB}"
  1861. ;;
  1862. x16|x32)
  1863. OSMESA_LIB="${OSMESA_LIB}$osmesa_bits"
  1864. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  1865. ;;
  1866. *)
  1867. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  1868. ;;
  1869. esac
  1870. if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then
  1871. # only link libraries with osmesa if shared
  1872. if test "$enable_static" = no; then
  1873. OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
  1874. else
  1875. OSMESA_LIB_DEPS=""
  1876. fi
  1877. OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
  1878. fi
  1879. AC_SUBST([OSMESA_LIB_DEPS])
  1880. AC_SUBST([OSMESA_PC_REQ])
  1881. AC_SUBST([OSMESA_PC_LIB_PRIV])
  1882. dnl
  1883. dnl gbm configuration
  1884. dnl
  1885. if test "x$enable_gbm" = xyes; then
  1886. require_dri_shared_libs_and_glapi "gbm"
  1887. fi
  1888. AM_CONDITIONAL(HAVE_GBM, test "x$enable_gbm" = xyes)
  1889. # FINISHME: GBM has a number of dependencies which we should add below
  1890. GBM_PC_REQ_PRIV=""
  1891. GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
  1892. AC_SUBST([GBM_PC_REQ_PRIV])
  1893. AC_SUBST([GBM_PC_LIB_PRIV])
  1894. dnl
  1895. dnl EGL configuration
  1896. dnl
  1897. if test "x$enable_egl" = xyes; then
  1898. EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS $PTHREAD_LIBS"
  1899. AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
  1900. require_dri_shared_libs_and_glapi "egl"
  1901. fi
  1902. AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes)
  1903. AC_SUBST([EGL_LIB_DEPS])
  1904. gallium_st="mesa"
  1905. dnl
  1906. dnl XA configuration
  1907. dnl
  1908. if test "x$enable_xa" = xyes; then
  1909. if test "x$with_gallium_drivers" = xswrast; then
  1910. AC_MSG_ERROR([
  1911. Building xa requires at least one non swrast gallium driver.
  1912. If you are looking to use libxatracker.so with the VMware driver,
  1913. make sure to include svga in the gallium drivers list, apart from
  1914. enabling XA.
  1915. Example: ./configure --enable-xa --with-gallium-drivers=svga...])
  1916. fi
  1917. gallium_st="$gallium_st xa"
  1918. fi
  1919. AM_CONDITIONAL(HAVE_ST_XA, test "x$enable_xa" = xyes)
  1920. if echo $platforms | grep -q "x11"; then
  1921. have_xvmc_platform=yes
  1922. else
  1923. have_xvmc_platform=no
  1924. fi
  1925. if echo $platforms | grep -q "x11"; then
  1926. have_vdpau_platform=yes
  1927. else
  1928. have_vdpau_platform=no
  1929. fi
  1930. if echo $platforms | grep -q "x11\|drm"; then
  1931. have_omx_platform=yes
  1932. else
  1933. have_omx_platform=no
  1934. fi
  1935. if echo $platforms | grep -q "x11\|drm\|wayland"; then
  1936. have_va_platform=yes
  1937. else
  1938. have_va_platform=no
  1939. fi
  1940. dnl
  1941. dnl Gallium G3DVL configuration
  1942. dnl
  1943. if test -n "$with_gallium_drivers" -a "x$with_gallium_drivers" != xswrast; then
  1944. if test "x$enable_xvmc" = xauto -a "x$have_xvmc_platform" = xyes; then
  1945. PKG_CHECK_EXISTS([xvmc >= $XVMC_REQUIRED], [enable_xvmc=yes], [enable_xvmc=no])
  1946. fi
  1947. if test "x$enable_vdpau" = xauto -a "x$have_vdpau_platform" = xyes; then
  1948. PKG_CHECK_EXISTS([vdpau >= $VDPAU_REQUIRED], [enable_vdpau=yes], [enable_vdpau=no])
  1949. fi
  1950. if test "x$enable_omx_bellagio" = xauto -a "x$have_omx_platform" = xyes; then
  1951. PKG_CHECK_EXISTS([libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED], [enable_omx_bellagio=yes], [enable_omx_bellagio=no])
  1952. fi
  1953. if test "x$enable_va" = xauto -a "x$have_va_platform" = xyes; then
  1954. PKG_CHECK_EXISTS([libva >= $LIBVA_REQUIRED], [enable_va=yes], [enable_va=no])
  1955. fi
  1956. fi
  1957. if test "x$enable_dri" = xyes -o \
  1958. "x$enable_xvmc" = xyes -o \
  1959. "x$enable_vdpau" = xyes -o \
  1960. "x$enable_omx_bellagio" = xyes -o \
  1961. "x$enable_va" = xyes; then
  1962. need_gallium_vl=yes
  1963. fi
  1964. AM_CONDITIONAL(NEED_GALLIUM_VL, test "x$need_gallium_vl" = xyes)
  1965. if test "x$enable_xvmc" = xyes -o \
  1966. "x$enable_vdpau" = xyes -o \
  1967. "x$enable_omx_bellagio" = xyes -o \
  1968. "x$enable_va" = xyes; then
  1969. if echo $platforms | grep -q "x11"; then
  1970. PKG_CHECK_MODULES([VL], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED])
  1971. fi
  1972. need_gallium_vl_winsys=yes
  1973. fi
  1974. AM_CONDITIONAL(NEED_GALLIUM_VL_WINSYS, test "x$need_gallium_vl_winsys" = xyes)
  1975. if test "x$enable_xvmc" = xyes; then
  1976. if test "x$have_xvmc_platform" != xyes; then
  1977. AC_MSG_ERROR([XVMC requires the x11 platforms])
  1978. fi
  1979. PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED])
  1980. gallium_st="$gallium_st xvmc"
  1981. fi
  1982. AM_CONDITIONAL(HAVE_ST_XVMC, test "x$enable_xvmc" = xyes)
  1983. if test "x$enable_vdpau" = xyes; then
  1984. if test "x$have_vdpau_platform" != xyes; then
  1985. AC_MSG_ERROR([VDPAU requires the x11 platforms])
  1986. fi
  1987. PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED])
  1988. gallium_st="$gallium_st vdpau"
  1989. DEFINES="$DEFINES -DHAVE_ST_VDPAU"
  1990. fi
  1991. AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes)
  1992. if test "x$enable_omx_bellagio" = xyes; then
  1993. if test "x$have_omx_platform" != xyes; then
  1994. AC_MSG_ERROR([OMX requires at least one of the x11 or drm platforms])
  1995. fi
  1996. PKG_CHECK_MODULES([OMX_BELLAGIO], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED])
  1997. gallium_st="$gallium_st omx_bellagio"
  1998. fi
  1999. AM_CONDITIONAL(HAVE_ST_OMX_BELLAGIO, test "x$enable_omx_bellagio" = xyes)
  2000. if test "x$enable_va" = xyes; then
  2001. if test "x$have_va_platform" != xyes; then
  2002. AC_MSG_ERROR([VA requires at least one of the x11 drm or wayland platforms])
  2003. fi
  2004. PKG_CHECK_MODULES([VA], [libva >= $LIBVA_REQUIRED])
  2005. gallium_st="$gallium_st va"
  2006. fi
  2007. AM_CONDITIONAL(HAVE_ST_VA, test "x$enable_va" = xyes)
  2008. dnl
  2009. dnl Nine Direct3D9 configuration
  2010. dnl
  2011. if test "x$enable_nine" = xyes; then
  2012. if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
  2013. AC_MSG_ERROR([nine requires the gallium swrast driver])
  2014. fi
  2015. if test "x$with_gallium_drivers" = xswrast; then
  2016. AC_MSG_ERROR([nine requires at least one non-swrast gallium driver])
  2017. fi
  2018. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 6; then
  2019. AC_MSG_ERROR([gcc >= 4.6 is required to build nine])
  2020. fi
  2021. if test "x$enable_dri3" = xno; then
  2022. AC_MSG_WARN([using nine together with wine requires DRI3 enabled system])
  2023. fi
  2024. gallium_st="$gallium_st nine"
  2025. fi
  2026. AM_CONDITIONAL(HAVE_ST_NINE, test "x$enable_nine" = xyes)
  2027. dnl
  2028. dnl OpenCL configuration
  2029. dnl
  2030. AC_ARG_WITH([clang-libdir],
  2031. [AS_HELP_STRING([--with-clang-libdir],
  2032. [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
  2033. [CLANG_LIBDIR="$withval"],
  2034. [CLANG_LIBDIR=''])
  2035. PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
  2036. if test "x$enable_opencl" = xyes; then
  2037. if test -z "$with_gallium_drivers"; then
  2038. AC_MSG_ERROR([cannot enable OpenCL without Gallium])
  2039. fi
  2040. if test "x$HAVE_CXX11" != "xyes"; then
  2041. AC_MSG_ERROR([clover requires c++11 support])
  2042. fi
  2043. if test "x$have_libclc" = xno; then
  2044. AC_MSG_ERROR([pkg-config cannot find libclc.pc which is required to build clover.
  2045. Make sure the directory containing libclc.pc is specified in your
  2046. PKG_CONFIG_PATH environment variable.
  2047. By default libclc.pc is installed to /usr/local/share/pkgconfig/])
  2048. else
  2049. LIBCLC_INCLUDEDIR=`$PKG_CONFIG --variable=includedir libclc`
  2050. LIBCLC_LIBEXECDIR=`$PKG_CONFIG --variable=libexecdir libclc`
  2051. AC_SUBST([LIBCLC_INCLUDEDIR])
  2052. AC_SUBST([LIBCLC_LIBEXECDIR])
  2053. fi
  2054. gallium_st="$gallium_st clover"
  2055. if test "x$enable_opencl_icd" = xyes; then
  2056. OPENCL_LIBNAME="MesaOpenCL"
  2057. else
  2058. OPENCL_LIBNAME="OpenCL"
  2059. fi
  2060. if test "x$have_libelf" != xyes; then
  2061. AC_MSG_ERROR([Clover requires libelf])
  2062. fi
  2063. if test "x${ac_cv_cxx_compiler_gnu}" = xyes; then
  2064. altivec_enabled=no
  2065. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  2066. #if !defined(__VEC__) || !defined(__ALTIVEC__)
  2067. #error "AltiVec not enabled"
  2068. #endif
  2069. ])], altivec_enabled=yes)
  2070. if test "$altivec_enabled" = yes; then
  2071. CLOVER_STD_OVERRIDE="-std=gnu++11"
  2072. fi
  2073. AC_SUBST([CLOVER_STD_OVERRIDE])
  2074. fi
  2075. llvm_require_version $LLVM_REQUIRED_OPENCL "opencl"
  2076. llvm_add_default_components "opencl"
  2077. llvm_add_component "all-targets" "opencl"
  2078. llvm_add_component "coverage" "opencl"
  2079. llvm_add_component "linker" "opencl"
  2080. llvm_add_component "instrumentation" "opencl"
  2081. llvm_add_component "ipo" "opencl"
  2082. llvm_add_component "irreader" "opencl"
  2083. llvm_add_component "lto" "opencl"
  2084. llvm_add_component "option" "opencl"
  2085. llvm_add_component "objcarcopts" "opencl"
  2086. llvm_add_component "profiledata" "opencl"
  2087. llvm_add_optional_component "coroutines" "opencl"
  2088. dnl Check for Clang internal headers
  2089. if test -z "$CLANG_LIBDIR"; then
  2090. CLANG_LIBDIR=${LLVM_LIBDIR}
  2091. fi
  2092. CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
  2093. AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
  2094. [AC_MSG_ERROR([Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries.])])
  2095. fi
  2096. AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
  2097. AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
  2098. AC_SUBST([OPENCL_LIBNAME])
  2099. AC_SUBST([CLANG_RESOURCE_DIR])
  2100. dnl
  2101. dnl Gallium configuration
  2102. dnl
  2103. AM_CONDITIONAL(HAVE_GALLIUM, test -n "$with_gallium_drivers")
  2104. # libEGL wants to default to the first platform specified in
  2105. # ./configure. parse that here.
  2106. if test "x$platforms" != "x"; then
  2107. FIRST_PLATFORM_CAPS=`echo $platforms | sed 's| .*||' | tr '[[a-z]]' '[[A-Z]]'`
  2108. EGL_NATIVE_PLATFORM="_EGL_PLATFORM_$FIRST_PLATFORM_CAPS"
  2109. else
  2110. EGL_NATIVE_PLATFORM="_EGL_INVALID_PLATFORM"
  2111. fi
  2112. AC_SUBST([EGL_NATIVE_PLATFORM])
  2113. AC_SUBST([EGL_CFLAGS])
  2114. # If we don't have the X11 platform, set this define so we don't try to include
  2115. # the X11 headers.
  2116. if ! echo "$platforms" | grep -q 'x11'; then
  2117. DEFINES="$DEFINES -DMESA_EGL_NO_X11_HEADERS"
  2118. GL_PC_CFLAGS="$GL_PC_CFLAGS -DMESA_EGL_NO_X11_HEADERS"
  2119. fi
  2120. dnl Directory for XVMC libs
  2121. AC_ARG_WITH([xvmc-libdir],
  2122. [AS_HELP_STRING([--with-xvmc-libdir=DIR],
  2123. [directory for the XVMC libraries @<:@default=${libdir}@:>@])],
  2124. [XVMC_LIB_INSTALL_DIR="$withval"],
  2125. [XVMC_LIB_INSTALL_DIR='${libdir}'])
  2126. AC_SUBST([XVMC_LIB_INSTALL_DIR])
  2127. dnl
  2128. dnl Gallium Tests
  2129. dnl
  2130. AM_CONDITIONAL(HAVE_GALLIUM_TESTS, test "x$enable_gallium_tests" = xyes)
  2131. dnl Directory for VDPAU libs
  2132. AC_ARG_WITH([vdpau-libdir],
  2133. [AS_HELP_STRING([--with-vdpau-libdir=DIR],
  2134. [directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
  2135. [VDPAU_LIB_INSTALL_DIR="$withval"],
  2136. [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
  2137. AC_SUBST([VDPAU_LIB_INSTALL_DIR])
  2138. dnl Directory for OMX_BELLAGIO libs
  2139. AC_ARG_WITH([omx-bellagio-libdir],
  2140. [AS_HELP_STRING([--with-omx-bellagio-libdir=DIR],
  2141. [directory for the OMX_BELLAGIO libraries])],
  2142. [OMX_BELLAGIO_LIB_INSTALL_DIR="$withval"],
  2143. [OMX_BELLAGIO_LIB_INSTALL_DIR=`$PKG_CONFIG --exists libomxil-bellagio && \
  2144. $PKG_CONFIG --define-variable=libdir=\$libdir --variable=pluginsdir libomxil-bellagio`])
  2145. AC_SUBST([OMX_BELLAGIO_LIB_INSTALL_DIR])
  2146. dnl Directory for VA libs
  2147. AC_ARG_WITH([va-libdir],
  2148. [AS_HELP_STRING([--with-va-libdir=DIR],
  2149. [directory for the VA libraries @<:@${libdir}/dri@:>@])],
  2150. [VA_LIB_INSTALL_DIR="$withval"],
  2151. [VA_LIB_INSTALL_DIR="${libdir}/dri"])
  2152. AC_SUBST([VA_LIB_INSTALL_DIR])
  2153. AC_ARG_WITH([d3d-libdir],
  2154. [AS_HELP_STRING([--with-d3d-libdir=DIR],
  2155. [directory for the D3D modules @<:@${libdir}/d3d@:>@])],
  2156. [D3D_DRIVER_INSTALL_DIR="$withval"],
  2157. [D3D_DRIVER_INSTALL_DIR="${libdir}/d3d"])
  2158. AC_SUBST([D3D_DRIVER_INSTALL_DIR])
  2159. dnl Architectures to build SWR library for
  2160. AC_ARG_WITH([swr-archs],
  2161. [AS_HELP_STRING([--with-swr-archs@<:@=DIRS...@:>@],
  2162. [comma delimited swr architectures list, e.g.
  2163. "avx,avx2,knl,skx" @<:@default="avx,avx2"@:>@])],
  2164. [with_swr_archs="$withval"],
  2165. [with_swr_archs="avx,avx2"])
  2166. dnl
  2167. dnl r300 doesn't strictly require LLVM, but for performance reasons we
  2168. dnl highly recommend LLVM usage. So require it at least on x86 and x86_64
  2169. dnl architectures.
  2170. dnl
  2171. r300_require_llvm() {
  2172. case "$host" in *gnux32) return;; esac
  2173. case "$host_cpu" in
  2174. i*86|x86_64|amd64) require_llvm $1
  2175. ;;
  2176. esac
  2177. }
  2178. dnl
  2179. dnl DRM is needed by X, Wayland, and offscreen rendering.
  2180. dnl Surfaceless is an alternative for the last one.
  2181. dnl
  2182. require_basic_egl() {
  2183. case "$with_platforms" in
  2184. *drm*|*surfaceless*|*android*)
  2185. ;;
  2186. *)
  2187. AC_MSG_ERROR([$1 requires one of these:
  2188. 1) --with-platforms=drm (X, Wayland, offscreen rendering based on DRM)
  2189. 2) --with-platforms=surfaceless (offscreen only)
  2190. 3) --with-platforms=android (Android only)
  2191. Recommended options: drm,x11])
  2192. ;;
  2193. esac
  2194. }
  2195. swr_require_cxx_feature_flags() {
  2196. feature_name="$1"
  2197. preprocessor_test="$2"
  2198. option_list="$3"
  2199. output_var="$4"
  2200. AC_MSG_CHECKING([whether $CXX supports $feature_name])
  2201. AC_LANG_PUSH([C++])
  2202. save_CXXFLAGS="$CXXFLAGS"
  2203. save_IFS="$IFS"
  2204. IFS=","
  2205. found=0
  2206. for opts in $option_list
  2207. do
  2208. unset IFS
  2209. CXXFLAGS="$opts $save_CXXFLAGS"
  2210. AC_COMPILE_IFELSE(
  2211. [AC_LANG_PROGRAM(
  2212. [ #if !($preprocessor_test)
  2213. #error
  2214. #endif
  2215. ])],
  2216. [found=1; break],
  2217. [])
  2218. IFS=","
  2219. done
  2220. IFS="$save_IFS"
  2221. CXXFLAGS="$save_CXXFLAGS"
  2222. AC_LANG_POP([C++])
  2223. if test $found -eq 1; then
  2224. AC_MSG_RESULT([$opts])
  2225. eval "$output_var=\$opts"
  2226. return 0
  2227. fi
  2228. AC_MSG_RESULT([no])
  2229. AC_MSG_ERROR([swr requires $feature_name support])
  2230. return 1
  2231. }
  2232. dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
  2233. if test -n "$with_gallium_drivers"; then
  2234. gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
  2235. for driver in $gallium_drivers; do
  2236. case "x$driver" in
  2237. xsvga)
  2238. HAVE_GALLIUM_SVGA=yes
  2239. require_libdrm "svga"
  2240. ;;
  2241. xi915)
  2242. HAVE_GALLIUM_I915=yes
  2243. PKG_CHECK_MODULES([I915], [libdrm >= $LIBDRM_INTEL_REQUIRED libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  2244. require_libdrm "Gallium i915"
  2245. ;;
  2246. xr300)
  2247. HAVE_GALLIUM_R300=yes
  2248. PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  2249. require_libdrm "r300"
  2250. r300_require_llvm "r300"
  2251. ;;
  2252. xr600)
  2253. HAVE_GALLIUM_R600=yes
  2254. PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  2255. require_libdrm "r600"
  2256. if test "x$enable_llvm" = xyes; then
  2257. radeon_llvm_check $LLVM_REQUIRED_R600 "r600"
  2258. llvm_add_component "asmparser" "r600"
  2259. llvm_add_component "bitreader" "r600"
  2260. fi
  2261. ;;
  2262. xradeonsi)
  2263. HAVE_GALLIUM_RADEONSI=yes
  2264. PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  2265. PKG_CHECK_MODULES([AMDGPU], [libdrm >= $LIBDRM_AMDGPU_REQUIRED libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
  2266. require_libdrm "radeonsi"
  2267. radeon_llvm_check $LLVM_REQUIRED_RADEONSI "radeonsi"
  2268. if test "x$enable_egl" = xyes; then
  2269. require_basic_egl "radeonsi"
  2270. fi
  2271. ;;
  2272. xnouveau)
  2273. HAVE_GALLIUM_NOUVEAU=yes
  2274. PKG_CHECK_MODULES([NOUVEAU], [libdrm >= $LIBDRM_NOUVEAU_REQUIRED libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
  2275. require_libdrm "nouveau"
  2276. ;;
  2277. xfreedreno)
  2278. HAVE_GALLIUM_FREEDRENO=yes
  2279. PKG_CHECK_MODULES([FREEDRENO], [libdrm >= $LIBDRM_FREEDRENO_REQUIRED libdrm_freedreno >= $LIBDRM_FREEDRENO_REQUIRED])
  2280. require_libdrm "freedreno"
  2281. ;;
  2282. xetnaviv)
  2283. HAVE_GALLIUM_ETNAVIV=yes
  2284. PKG_CHECK_MODULES([ETNAVIV], [libdrm >= $LIBDRM_ETNAVIV_REQUIRED libdrm_etnaviv >= $LIBDRM_ETNAVIV_REQUIRED])
  2285. require_libdrm "etnaviv"
  2286. ;;
  2287. ximx)
  2288. HAVE_GALLIUM_IMX=yes
  2289. ;;
  2290. xswrast)
  2291. HAVE_GALLIUM_SOFTPIPE=yes
  2292. if test "x$enable_llvm" = xyes; then
  2293. HAVE_GALLIUM_LLVMPIPE=yes
  2294. fi
  2295. ;;
  2296. xswr)
  2297. llvm_require_version $LLVM_REQUIRED_SWR "swr"
  2298. if test "x$HAVE_CXX11" != "xyes"; then
  2299. AC_MSG_ERROR([swr requires c++11 support])
  2300. fi
  2301. swr_require_cxx_feature_flags "AVX" "defined(__AVX__)" \
  2302. ",-target-cpu=sandybridge,-mavx,-march=core-avx,-tp=sandybridge" \
  2303. SWR_AVX_CXXFLAGS
  2304. AC_SUBST([SWR_AVX_CXXFLAGS])
  2305. swr_archs=`IFS=', '; echo $with_swr_archs`
  2306. for arch in $swr_archs; do
  2307. case "x$arch" in
  2308. xavx)
  2309. HAVE_SWR_AVX=yes
  2310. ;;
  2311. xavx2)
  2312. swr_require_cxx_feature_flags "AVX2" "defined(__AVX2__)" \
  2313. ",-target-cpu=haswell,-mavx2 -mfma -mbmi2 -mf16c,-march=core-avx2,-tp=haswell" \
  2314. SWR_AVX2_CXXFLAGS
  2315. AC_SUBST([SWR_AVX2_CXXFLAGS])
  2316. HAVE_SWR_AVX2=yes
  2317. ;;
  2318. xknl)
  2319. swr_require_cxx_feature_flags "KNL" "defined(__AVX512F__) && defined(__AVX512ER__)" \
  2320. ",-target-cpu=mic-knl,-march=knl,-xMIC-AVX512" \
  2321. SWR_KNL_CXXFLAGS
  2322. AC_SUBST([SWR_KNL_CXXFLAGS])
  2323. HAVE_SWR_KNL=yes
  2324. ;;
  2325. xskx)
  2326. swr_require_cxx_feature_flags "SKX" "defined(__AVX512F__) && defined(__AVX512BW__)" \
  2327. ",-target-cpu=x86-skylake,-march=skylake-avx512,-xCORE-AVX512" \
  2328. SWR_SKX_CXXFLAGS
  2329. AC_SUBST([SWR_SKX_CXXFLAGS])
  2330. HAVE_SWR_SKX=yes
  2331. ;;
  2332. *)
  2333. AC_MSG_ERROR([unknown SWR build architecture '$arch'])
  2334. ;;
  2335. esac
  2336. done
  2337. if test "x$HAVE_SWR_AVX" != xyes -a \
  2338. "x$HAVE_SWR_AVX2" != xyes -a \
  2339. "x$HAVE_SWR_KNL" != xyes -a \
  2340. "x$HAVE_SWR_SKX" != xyes; then
  2341. AC_MSG_ERROR([swr enabled but no swr architectures selected])
  2342. fi
  2343. # test if more than one swr arch configured
  2344. if test `echo $swr_archs | wc -w` -eq 1; then
  2345. HAVE_SWR_BUILTIN=yes
  2346. fi
  2347. HAVE_GALLIUM_SWR=yes
  2348. ;;
  2349. xvc4)
  2350. HAVE_GALLIUM_VC4=yes
  2351. require_libdrm "vc4"
  2352. PKG_CHECK_MODULES([SIMPENROSE], [simpenrose],
  2353. [USE_VC4_SIMULATOR=yes;
  2354. DEFINES="$DEFINES -DUSE_VC4_SIMULATOR"],
  2355. [USE_VC4_SIMULATOR=no])
  2356. ;;
  2357. xvc5)
  2358. HAVE_GALLIUM_VC5=yes
  2359. PKG_CHECK_MODULES([VC5_SIMULATOR], [v3dv3],
  2360. [USE_VC5_SIMULATOR=yes;
  2361. DEFINES="$DEFINES -DUSE_VC5_SIMULATOR"],
  2362. [AC_MSG_ERROR([vc5 requires the simulator])])
  2363. ;;
  2364. xpl111)
  2365. HAVE_GALLIUM_PL111=yes
  2366. ;;
  2367. xvirgl)
  2368. HAVE_GALLIUM_VIRGL=yes
  2369. require_libdrm "virgl"
  2370. if test "x$enable_egl" = xyes; then
  2371. require_basic_egl "virgl"
  2372. fi
  2373. ;;
  2374. *)
  2375. AC_MSG_ERROR([Unknown Gallium driver: $driver])
  2376. ;;
  2377. esac
  2378. done
  2379. fi
  2380. # XXX: Keep in sync with LLVM_REQUIRED_SWR
  2381. AM_CONDITIONAL(SWR_INVALID_LLVM_VERSION, test "x$LLVM_VERSION" != x4.0.0 -a \
  2382. "x$LLVM_VERSION" != x4.0.1)
  2383. if test "x$enable_llvm" = "xyes" -a "$with_gallium_drivers"; then
  2384. llvm_require_version $LLVM_REQUIRED_GALLIUM "gallium"
  2385. llvm_add_default_components "gallium"
  2386. fi
  2387. AM_CONDITIONAL(HAVE_SWR_AVX, test "x$HAVE_SWR_AVX" = xyes)
  2388. AM_CONDITIONAL(HAVE_SWR_AVX2, test "x$HAVE_SWR_AVX2" = xyes)
  2389. AM_CONDITIONAL(HAVE_SWR_KNL, test "x$HAVE_SWR_KNL" = xyes)
  2390. AM_CONDITIONAL(HAVE_SWR_SKX, test "x$HAVE_SWR_SKX" = xyes)
  2391. AM_CONDITIONAL(HAVE_SWR_BUILTIN, test "x$HAVE_SWR_BUILTIN" = xyes)
  2392. dnl We need to validate some needed dependencies for renderonly drivers.
  2393. if test "x$HAVE_GALLIUM_ETNAVIV" != xyes -a "x$HAVE_GALLIUM_IMX" = xyes ; then
  2394. AC_MSG_ERROR([Building with imx requires etnaviv])
  2395. fi
  2396. if test "x$HAVE_GALLIUM_VC4" != xyes -a "x$HAVE_GALLIUM_PL111" = xyes ; then
  2397. AC_MSG_ERROR([Building with pl111 requires vc4])
  2398. fi
  2399. detect_old_buggy_llvm() {
  2400. dnl llvm-config may not give the right answer when llvm is a built as a
  2401. dnl single shared library, so we must work the library name out for
  2402. dnl ourselves.
  2403. dnl (See https://llvm.org/bugs/show_bug.cgi?id=6823)
  2404. dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
  2405. LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
  2406. AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.$IMP_LIB_EXT"], [llvm_have_one_so=yes])
  2407. if test "x$llvm_have_one_so" = xyes; then
  2408. dnl LLVM was built using auto*, so there is only one shared object.
  2409. LLVM_LIBS="-l$LLVM_SO_NAME"
  2410. else
  2411. dnl If LLVM was built with CMake, there will be one shared object per
  2412. dnl component.
  2413. AS_IF([test ! -f "$LLVM_LIBDIR/libLLVMTarget.$IMP_LIB_EXT"],
  2414. [AC_MSG_ERROR([Could not find llvm shared libraries:
  2415. Please make sure you have built llvm with the --enable-shared option
  2416. and that your llvm libraries are installed in $LLVM_LIBDIR
  2417. If you have installed your llvm libraries to a different directory you
  2418. can use the --with-llvm-prefix= configure flag to specify this directory.
  2419. NOTE: Mesa is attempting to use llvm shared libraries by default.
  2420. If you do not want to build with llvm shared libraries and instead want to
  2421. use llvm static libraries then add --disable-llvm-shared-libs to your configure
  2422. invocation and rebuild.])])
  2423. dnl We don't need to update LLVM_LIBS in this case because the LLVM
  2424. dnl install uses a shared object for each component and we have
  2425. dnl already added all of these objects to LLVM_LIBS.
  2426. fi
  2427. }
  2428. dnl
  2429. dnl Set defines and buildtime variables only when using LLVM.
  2430. dnl
  2431. if test "x$enable_llvm" = xyes; then
  2432. DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
  2433. LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
  2434. LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
  2435. LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
  2436. dnl Set LLVM_LIBS - This is done after the driver configuration so
  2437. dnl that drivers can add additional components to LLVM_COMPONENTS.
  2438. dnl Previously, gallium drivers were updating LLVM_LIBS directly
  2439. dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
  2440. dnl this was causing the same libraries to be appear multiple times
  2441. dnl in LLVM_LIBS.
  2442. if test $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 9; then
  2443. if test "x$enable_llvm_shared_libs" = xyes; then
  2444. LLVM_LIBS="`$LLVM_CONFIG --link-shared --libs ${LLVM_COMPONENTS}`"
  2445. else
  2446. dnl Invoking llvm-config with both -libs and --system-libs produces the
  2447. dnl two separate lines - each for the set of libraries.
  2448. dnl Call the program twice, effectively folding them into a single line.
  2449. LLVM_LIBS="`$LLVM_CONFIG --link-static --libs ${LLVM_COMPONENTS}`"
  2450. dnl We need to link to llvm system libs when using static libs
  2451. LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --link-static --system-libs`"
  2452. fi
  2453. else
  2454. LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
  2455. if test "x$enable_llvm_shared_libs" = xyes; then
  2456. detect_old_buggy_llvm
  2457. else
  2458. AC_MSG_WARN([Building mesa with statically linked LLVM may cause compilation issues])
  2459. dnl We need to link to llvm system libs when using static libs
  2460. dnl However, only llvm 3.5+ provides --system-libs
  2461. if test $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5; then
  2462. LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --system-libs`"
  2463. fi
  2464. fi
  2465. fi
  2466. dnl The gallium-xlib GLX and gallium OSMesa targets directly embed the
  2467. dnl swr/llvmpipe driver into the final binary. Adding LLVM_LIBS results in
  2468. dnl the LLVM library propagated in the Libs.private of the respective .pc
  2469. dnl file which ensures complete dependency information when statically
  2470. dnl linking.
  2471. if test "x$enable_glx" == xgallium-xlib; then
  2472. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $LLVM_LIBS"
  2473. fi
  2474. if test "x$enable_gallium_osmesa" = xyes; then
  2475. OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV $LLVM_LIBS"
  2476. fi
  2477. fi
  2478. AM_CONDITIONAL(HAVE_GALLIUM_SVGA, test "x$HAVE_GALLIUM_SVGA" = xyes)
  2479. AM_CONDITIONAL(HAVE_GALLIUM_I915, test "x$HAVE_GALLIUM_I915" = xyes)
  2480. AM_CONDITIONAL(HAVE_GALLIUM_PL111, test "x$HAVE_GALLIUM_PL111" = xyes)
  2481. AM_CONDITIONAL(HAVE_GALLIUM_R300, test "x$HAVE_GALLIUM_R300" = xyes)
  2482. AM_CONDITIONAL(HAVE_GALLIUM_R600, test "x$HAVE_GALLIUM_R600" = xyes)
  2483. AM_CONDITIONAL(HAVE_GALLIUM_RADEONSI, test "x$HAVE_GALLIUM_RADEONSI" = xyes)
  2484. AM_CONDITIONAL(HAVE_GALLIUM_RADEON_COMMON, test "x$HAVE_GALLIUM_RADEONSI" = xyes)
  2485. AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
  2486. AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes)
  2487. AM_CONDITIONAL(HAVE_GALLIUM_ETNAVIV, test "x$HAVE_GALLIUM_ETNAVIV" = xyes)
  2488. AM_CONDITIONAL(HAVE_GALLIUM_IMX, test "x$HAVE_GALLIUM_IMX" = xyes)
  2489. AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
  2490. AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes)
  2491. AM_CONDITIONAL(HAVE_GALLIUM_SWR, test "x$HAVE_GALLIUM_SWR" = xyes)
  2492. AM_CONDITIONAL(HAVE_GALLIUM_SWRAST, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes -o \
  2493. "x$HAVE_GALLIUM_LLVMPIPE" = xyes -o \
  2494. "x$HAVE_GALLIUM_SWR" = xyes)
  2495. AM_CONDITIONAL(HAVE_GALLIUM_VC4, test "x$HAVE_GALLIUM_VC4" = xyes)
  2496. AM_CONDITIONAL(HAVE_GALLIUM_VC5, test "x$HAVE_GALLIUM_VC5" = xyes)
  2497. AM_CONDITIONAL(HAVE_GALLIUM_VIRGL, test "x$HAVE_GALLIUM_VIRGL" = xyes)
  2498. AM_CONDITIONAL(HAVE_GALLIUM_STATIC_TARGETS, test "x$enable_shared_pipe_drivers" = xno)
  2499. if test "x$enable_dri" = xyes; then
  2500. GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRI"
  2501. fi
  2502. if test "x$have_drisw_kms" = xyes; then
  2503. GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_KMS"
  2504. fi
  2505. AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
  2506. AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
  2507. AM_CONDITIONAL(HAVE_I965_DRI, test x$HAVE_I965_DRI = xyes)
  2508. AM_CONDITIONAL(HAVE_NOUVEAU_DRI, test x$HAVE_NOUVEAU_DRI = xyes)
  2509. AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
  2510. AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
  2511. AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
  2512. AM_CONDITIONAL(HAVE_RADEON_VULKAN, test "x$HAVE_RADEON_VULKAN" = xyes)
  2513. AM_CONDITIONAL(HAVE_INTEL_VULKAN, test "x$HAVE_INTEL_VULKAN" = xyes)
  2514. AM_CONDITIONAL(HAVE_AMD_DRIVERS, test "x$HAVE_GALLIUM_RADEONSI" = xyes -o \
  2515. "x$HAVE_RADEON_VULKAN" = xyes)
  2516. AM_CONDITIONAL(HAVE_BROADCOM_DRIVERS, test "x$HAVE_GALLIUM_VC4" = xyes -o \
  2517. "x$HAVE_GALLIUM_VC5" = xyes)
  2518. AM_CONDITIONAL(HAVE_INTEL_DRIVERS, test "x$HAVE_INTEL_VULKAN" = xyes -o \
  2519. "x$HAVE_I965_DRI" = xyes)
  2520. AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test "x$HAVE_GALLIUM_R300" = xyes -o \
  2521. "x$HAVE_GALLIUM_R600" = xyes -o \
  2522. "x$HAVE_GALLIUM_RADEONSI" = xyes)
  2523. AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$enable_glx" = xgallium-xlib)
  2524. AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
  2525. AM_CONDITIONAL(HAVE_GALLIUM_LLVM, test "x$enable_llvm" = xyes)
  2526. AM_CONDITIONAL(USE_VC4_SIMULATOR, test x$USE_VC4_SIMULATOR = xyes)
  2527. AM_CONDITIONAL(USE_VC5_SIMULATOR, test x$USE_VC5_SIMULATOR = xyes)
  2528. AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)
  2529. AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
  2530. AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)
  2531. AM_CONDITIONAL(HAVE_COMMON_OSMESA, test "x$enable_osmesa" = xyes -o \
  2532. "x$enable_gallium_osmesa" = xyes)
  2533. AM_CONDITIONAL(HAVE_X86_ASM, test "x$asm_arch" = xx86 -o "x$asm_arch" = xx86_64)
  2534. AM_CONDITIONAL(HAVE_X86_64_ASM, test "x$asm_arch" = xx86_64)
  2535. AM_CONDITIONAL(HAVE_SPARC_ASM, test "x$asm_arch" = xsparc)
  2536. AM_CONDITIONAL(HAVE_PPC64LE_ASM, test "x$asm_arch" = xppc64le)
  2537. AM_CONDITIONAL(HAVE_AARCH64_ASM, test "x$asm_arch" = xaarch64)
  2538. AM_CONDITIONAL(HAVE_ARM_ASM, test "x$asm_arch" = xarm)
  2539. AC_SUBST([NINE_MAJOR], 1)
  2540. AC_SUBST([NINE_MINOR], 0)
  2541. AC_SUBST([NINE_PATCH], 0)
  2542. AC_SUBST([NINE_VERSION], "$NINE_MAJOR.$NINE_MINOR.$NINE_PATCH")
  2543. AC_SUBST([VDPAU_MAJOR], 1)
  2544. AC_SUBST([VDPAU_MINOR], 0)
  2545. if test "x$enable_va" = xyes; then
  2546. VA_MAJOR=`$PKG_CONFIG --modversion libva | $SED -n 's/\([[^\.]]*\)\..*$/\1/p'`
  2547. VA_MINOR=`$PKG_CONFIG --modversion libva | $SED -n 's/.*\.\(.*\)\..*$/\1/p'`
  2548. fi
  2549. AC_SUBST([VA_MAJOR], $VA_MAJOR)
  2550. AC_SUBST([VA_MINOR], $VA_MINOR)
  2551. AM_CONDITIONAL(HAVE_VULKAN_COMMON, test "x$VULKAN_DRIVERS" != "x")
  2552. AC_SUBST([XVMC_MAJOR], 1)
  2553. AC_SUBST([XVMC_MINOR], 0)
  2554. AC_SUBST([XA_MAJOR], 2)
  2555. AC_SUBST([XA_MINOR], 3)
  2556. AC_SUBST([XA_PATCH], 0)
  2557. AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_PATCH")
  2558. AC_ARG_ENABLE(valgrind,
  2559. [AS_HELP_STRING([--enable-valgrind],
  2560. [Build mesa with valgrind support (default: auto)])],
  2561. [VALGRIND=$enableval], [VALGRIND=auto])
  2562. if test "x$VALGRIND" != xno; then
  2563. PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no])
  2564. fi
  2565. AC_MSG_CHECKING([whether to enable Valgrind support])
  2566. if test "x$VALGRIND" = xauto; then
  2567. VALGRIND="$have_valgrind"
  2568. fi
  2569. if test "x$VALGRIND" = "xyes"; then
  2570. if ! test "x$have_valgrind" = xyes; then
  2571. AC_MSG_ERROR([Valgrind support required but not present])
  2572. fi
  2573. AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings])
  2574. fi
  2575. AC_MSG_RESULT([$VALGRIND])
  2576. dnl Restore LDFLAGS and CPPFLAGS
  2577. LDFLAGS="$_SAVE_LDFLAGS"
  2578. CPPFLAGS="$_SAVE_CPPFLAGS"
  2579. dnl Suppress clang's warnings about unused CFLAGS and CXXFLAGS
  2580. if test "x$acv_mesa_CLANG" = xyes; then
  2581. CFLAGS="$CFLAGS -Qunused-arguments"
  2582. CXXFLAGS="$CXXFLAGS -Qunused-arguments"
  2583. fi
  2584. dnl Add user CFLAGS and CXXFLAGS
  2585. CFLAGS="$CFLAGS $USER_CFLAGS"
  2586. CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
  2587. dnl Substitute the config
  2588. AC_CONFIG_FILES([Makefile
  2589. src/Makefile
  2590. src/amd/Makefile
  2591. src/amd/vulkan/Makefile
  2592. src/broadcom/Makefile
  2593. src/compiler/Makefile
  2594. src/egl/Makefile
  2595. src/egl/main/egl.pc
  2596. src/egl/wayland/wayland-drm/Makefile
  2597. src/egl/wayland/wayland-egl/Makefile
  2598. src/egl/wayland/wayland-egl/wayland-egl.pc
  2599. src/gallium/Makefile
  2600. src/gallium/auxiliary/Makefile
  2601. src/gallium/auxiliary/pipe-loader/Makefile
  2602. src/gallium/drivers/freedreno/Makefile
  2603. src/gallium/drivers/ddebug/Makefile
  2604. src/gallium/drivers/i915/Makefile
  2605. src/gallium/drivers/llvmpipe/Makefile
  2606. src/gallium/drivers/noop/Makefile
  2607. src/gallium/drivers/nouveau/Makefile
  2608. src/gallium/drivers/pl111/Makefile
  2609. src/gallium/drivers/r300/Makefile
  2610. src/gallium/drivers/r600/Makefile
  2611. src/gallium/drivers/radeon/Makefile
  2612. src/gallium/drivers/radeonsi/Makefile
  2613. src/gallium/drivers/rbug/Makefile
  2614. src/gallium/drivers/softpipe/Makefile
  2615. src/gallium/drivers/svga/Makefile
  2616. src/gallium/drivers/swr/Makefile
  2617. src/gallium/drivers/trace/Makefile
  2618. src/gallium/drivers/etnaviv/Makefile
  2619. src/gallium/drivers/imx/Makefile
  2620. src/gallium/drivers/vc4/Makefile
  2621. src/gallium/drivers/vc5/Makefile
  2622. src/gallium/drivers/virgl/Makefile
  2623. src/gallium/state_trackers/clover/Makefile
  2624. src/gallium/state_trackers/dri/Makefile
  2625. src/gallium/state_trackers/glx/xlib/Makefile
  2626. src/gallium/state_trackers/nine/Makefile
  2627. src/gallium/state_trackers/omx_bellagio/Makefile
  2628. src/gallium/state_trackers/osmesa/Makefile
  2629. src/gallium/state_trackers/va/Makefile
  2630. src/gallium/state_trackers/vdpau/Makefile
  2631. src/gallium/state_trackers/xa/Makefile
  2632. src/gallium/state_trackers/xa/xa_tracker.h
  2633. src/gallium/state_trackers/xvmc/Makefile
  2634. src/gallium/targets/d3dadapter9/Makefile
  2635. src/gallium/targets/d3dadapter9/d3d.pc
  2636. src/gallium/targets/dri/Makefile
  2637. src/gallium/targets/libgl-xlib/Makefile
  2638. src/gallium/targets/omx-bellagio/Makefile
  2639. src/gallium/targets/opencl/Makefile
  2640. src/gallium/targets/opencl/mesa.icd
  2641. src/gallium/targets/osmesa/Makefile
  2642. src/gallium/targets/osmesa/osmesa.pc
  2643. src/gallium/targets/pipe-loader/Makefile
  2644. src/gallium/targets/va/Makefile
  2645. src/gallium/targets/vdpau/Makefile
  2646. src/gallium/targets/xa/Makefile
  2647. src/gallium/targets/xa/xatracker.pc
  2648. src/gallium/targets/xvmc/Makefile
  2649. src/gallium/tests/trivial/Makefile
  2650. src/gallium/tests/unit/Makefile
  2651. src/gallium/winsys/etnaviv/drm/Makefile
  2652. src/gallium/winsys/imx/drm/Makefile
  2653. src/gallium/winsys/freedreno/drm/Makefile
  2654. src/gallium/winsys/i915/drm/Makefile
  2655. src/gallium/winsys/nouveau/drm/Makefile
  2656. src/gallium/winsys/pl111/drm/Makefile
  2657. src/gallium/winsys/radeon/drm/Makefile
  2658. src/gallium/winsys/amdgpu/drm/Makefile
  2659. src/gallium/winsys/svga/drm/Makefile
  2660. src/gallium/winsys/sw/dri/Makefile
  2661. src/gallium/winsys/sw/kms-dri/Makefile
  2662. src/gallium/winsys/sw/null/Makefile
  2663. src/gallium/winsys/sw/wrapper/Makefile
  2664. src/gallium/winsys/sw/xlib/Makefile
  2665. src/gallium/winsys/vc4/drm/Makefile
  2666. src/gallium/winsys/vc5/drm/Makefile
  2667. src/gallium/winsys/virgl/drm/Makefile
  2668. src/gallium/winsys/virgl/vtest/Makefile
  2669. src/gbm/Makefile
  2670. src/gbm/main/gbm.pc
  2671. src/glx/Makefile
  2672. src/glx/apple/Makefile
  2673. src/glx/tests/Makefile
  2674. src/glx/windows/Makefile
  2675. src/glx/windows/windowsdriproto.pc
  2676. src/gtest/Makefile
  2677. src/intel/Makefile
  2678. src/loader/Makefile
  2679. src/mapi/Makefile
  2680. src/mapi/es1api/glesv1_cm.pc
  2681. src/mapi/es2api/glesv2.pc
  2682. src/mapi/glapi/gen/Makefile
  2683. src/mesa/Makefile
  2684. src/mesa/gl.pc
  2685. src/mesa/drivers/dri/dri.pc
  2686. src/mesa/drivers/dri/common/Makefile
  2687. src/mesa/drivers/dri/i915/Makefile
  2688. src/mesa/drivers/dri/i965/Makefile
  2689. src/mesa/drivers/dri/Makefile
  2690. src/mesa/drivers/dri/nouveau/Makefile
  2691. src/mesa/drivers/dri/r200/Makefile
  2692. src/mesa/drivers/dri/radeon/Makefile
  2693. src/mesa/drivers/dri/swrast/Makefile
  2694. src/mesa/drivers/osmesa/Makefile
  2695. src/mesa/drivers/osmesa/osmesa.pc
  2696. src/mesa/drivers/x11/Makefile
  2697. src/mesa/main/tests/Makefile
  2698. src/mesa/state_tracker/tests/Makefile
  2699. src/util/Makefile
  2700. src/util/tests/hash_table/Makefile
  2701. src/util/tests/string_buffer/Makefile
  2702. src/util/xmlpool/Makefile
  2703. src/vulkan/Makefile])
  2704. AC_OUTPUT
  2705. # Fix up dependencies in *.Plo files, where we changed the extension of a
  2706. # source file
  2707. $SED -i -e 's/brw_blorp.cpp/brw_blorp.c/' src/mesa/drivers/dri/i965/.deps/brw_blorp.Plo
  2708. rm -f src/compiler/spirv/spirv_info.lo
  2709. echo "# dummy" > src/compiler/spirv/.deps/spirv_info.Plo
  2710. dnl
  2711. dnl Output some configuration info for the user
  2712. dnl
  2713. echo ""
  2714. echo " prefix: $prefix"
  2715. echo " exec_prefix: $exec_prefix"
  2716. echo " libdir: $libdir"
  2717. echo " includedir: $includedir"
  2718. dnl API info
  2719. echo ""
  2720. echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
  2721. dnl Driver info
  2722. echo ""
  2723. case "x$enable_osmesa$enable_gallium_osmesa" in
  2724. xnoyes)
  2725. echo " OSMesa: lib$OSMESA_LIB (Gallium)"
  2726. ;;
  2727. xyesno)
  2728. echo " OSMesa: lib$OSMESA_LIB"
  2729. ;;
  2730. xnono)
  2731. echo " OSMesa: no"
  2732. ;;
  2733. esac
  2734. echo ""
  2735. if test "x$enable_dri" != xno; then
  2736. echo " DRI platform: $dri_platform"
  2737. if test -z "$DRI_DIRS"; then
  2738. echo " DRI drivers: no"
  2739. else
  2740. echo " DRI drivers: $DRI_DIRS"
  2741. fi
  2742. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  2743. fi
  2744. case "x$enable_glx" in
  2745. xdri)
  2746. echo " GLX: DRI-based"
  2747. ;;
  2748. xxlib)
  2749. echo " GLX: Xlib-based"
  2750. ;;
  2751. xgallium-xlib)
  2752. echo " GLX: Xlib-based (Gallium)"
  2753. ;;
  2754. *)
  2755. echo " GLX: $enable_glx"
  2756. ;;
  2757. esac
  2758. dnl EGL
  2759. echo ""
  2760. echo " EGL: $enable_egl"
  2761. if test "$enable_egl" = yes; then
  2762. egl_drivers=""
  2763. if test "x$enable_dri" != "xno"; then
  2764. egl_drivers="$egl_drivers builtin:egl_dri2"
  2765. fi
  2766. if test "x$enable_dri3" != "xno"; then
  2767. egl_drivers="$egl_drivers builtin:egl_dri3"
  2768. fi
  2769. echo " EGL drivers: $egl_drivers"
  2770. fi
  2771. if test "x$enable_gbm" = xyes; then
  2772. echo " GBM: yes"
  2773. else
  2774. echo " GBM: no"
  2775. fi
  2776. echo " EGL/Vulkan/VL platforms: $platforms"
  2777. # Vulkan
  2778. echo ""
  2779. if test "x$VULKAN_DRIVERS" != x; then
  2780. echo " Vulkan drivers: $VULKAN_DRIVERS"
  2781. echo " Vulkan ICD dir: $VULKAN_ICD_INSTALL_DIR"
  2782. else
  2783. echo " Vulkan drivers: no"
  2784. fi
  2785. echo ""
  2786. if test "x$enable_llvm" = xyes; then
  2787. echo " llvm: yes"
  2788. echo " llvm-config: $LLVM_CONFIG"
  2789. echo " llvm-version: $LLVM_VERSION"
  2790. else
  2791. echo " llvm: no"
  2792. fi
  2793. echo ""
  2794. if test -n "$with_gallium_drivers"; then
  2795. echo " Gallium drivers: $gallium_drivers"
  2796. echo " Gallium st: $gallium_st"
  2797. else
  2798. echo " Gallium: no"
  2799. fi
  2800. echo ""
  2801. if test "x$enable_gallium_extra_hud" != xyes; then
  2802. echo " HUD extra stats: no"
  2803. else
  2804. echo " HUD extra stats: yes"
  2805. fi
  2806. if test "x$enable_lmsensors" != xyes; then
  2807. echo " HUD lmsensors: no"
  2808. else
  2809. echo " HUD lmsensors: yes"
  2810. fi
  2811. echo ""
  2812. if test "x$HAVE_GALLIUM_SWR" != x; then
  2813. if test "x$HAVE_SWR_BUILTIN" = xyes; then
  2814. echo " SWR archs: $swr_archs (builtin)"
  2815. else
  2816. echo " SWR archs: $swr_archs"
  2817. fi
  2818. fi
  2819. dnl Libraries
  2820. echo ""
  2821. echo " Shared libs: $enable_shared"
  2822. echo " Static libs: $enable_static"
  2823. echo " Shared-glapi: $enable_shared_glapi"
  2824. dnl Compiler options
  2825. # cleanup the CFLAGS/CXXFLAGS/LDFLAGS/DEFINES vars
  2826. cflags=`echo $CFLAGS | \
  2827. $SED 's/^ *//;s/ */ /;s/ *$//'`
  2828. cxxflags=`echo $CXXFLAGS | \
  2829. $SED 's/^ *//;s/ */ /;s/ *$//'`
  2830. ldflags=`echo $LDFLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  2831. defines=`echo $DEFINES | $SED 's/^ *//;s/ */ /;s/ *$//'`
  2832. echo ""
  2833. echo " CFLAGS: $cflags"
  2834. echo " CXXFLAGS: $cxxflags"
  2835. echo " CXX11_CXXFLAGS: $CXX11_CXXFLAGS"
  2836. echo " LDFLAGS: $ldflags"
  2837. echo " Macros: $defines"
  2838. echo ""
  2839. if test "x$enable_llvm" = xyes; then
  2840. echo " LLVM_CFLAGS: $LLVM_CFLAGS"
  2841. echo " LLVM_CXXFLAGS: $LLVM_CXXFLAGS"
  2842. echo " LLVM_CPPFLAGS: $LLVM_CPPFLAGS"
  2843. echo " LLVM_LDFLAGS: $LLVM_LDFLAGS"
  2844. echo ""
  2845. fi
  2846. echo " PYTHON2: $PYTHON2"
  2847. echo ""
  2848. echo " Run '${MAKE-make}' to build Mesa"
  2849. echo ""