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

configure.ac 111KB

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