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 101KB

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