Clone of mesa.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

configure.ac 83KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563
  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 Copyright © 2003-2007 Keith Packard, Daniel Stone
  13. dnl
  14. dnl Permission is hereby granted, free of charge, to any person obtaining a
  15. dnl copy of this software and associated documentation files (the "Software"),
  16. dnl to deal in the Software without restriction, including without limitation
  17. dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
  18. dnl and/or sell copies of the Software, and to permit persons to whom the
  19. dnl Software is furnished to do so, subject to the following conditions:
  20. dnl
  21. dnl The above copyright notice and this permission notice (including the next
  22. dnl paragraph) shall be included in all copies or substantial portions of the
  23. dnl Software.
  24. dnl
  25. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26. dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  27. dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  28. dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  29. dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  30. dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  31. dnl DEALINGS IN THE SOFTWARE.
  32. dnl
  33. dnl Process this file with autoconf to create configure.
  34. AC_PREREQ([2.60])
  35. dnl Tell the user about autoconf.html in the --help output
  36. m4_divert_once([HELP_END], [
  37. See docs/autoconf.html for more details on the options for Mesa.])
  38. m4_define(MESA_VERSION, m4_normalize(m4_include(VERSION)))
  39. AC_INIT([Mesa], [MESA_VERSION],
  40. [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
  41. AC_CONFIG_AUX_DIR([bin])
  42. AC_CONFIG_MACRO_DIR([m4])
  43. AC_CANONICAL_SYSTEM
  44. AM_INIT_AUTOMAKE([foreign tar-ustar dist-xz])
  45. dnl We only support native Windows builds (MinGW/MSVC) through SCons.
  46. case "$host_os" in
  47. mingw*)
  48. AC_MSG_ERROR([MinGW build not supported through autoconf/automake, use SCons instead])
  49. ;;
  50. esac
  51. # Support silent build rules, requires at least automake-1.11. Disable
  52. # by either passing --disable-silent-rules to configure or passing V=1
  53. # to make
  54. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
  55. [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
  56. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  57. dnl Set internal versions
  58. OSMESA_VERSION=8
  59. AC_SUBST([OSMESA_VERSION])
  60. dnl Versions for external dependencies
  61. LIBDRM_REQUIRED=2.4.38
  62. LIBDRM_RADEON_REQUIRED=2.4.56
  63. LIBDRM_INTEL_REQUIRED=2.4.60
  64. LIBDRM_NVVIEUX_REQUIRED=2.4.33
  65. LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41"
  66. LIBDRM_FREEDRENO_REQUIRED=2.4.57
  67. DRI2PROTO_REQUIRED=2.6
  68. DRI3PROTO_REQUIRED=1.0
  69. PRESENTPROTO_REQUIRED=1.0
  70. LIBUDEV_REQUIRED=151
  71. GLPROTO_REQUIRED=1.4.14
  72. LIBOMXIL_BELLAGIO_REQUIRED=0.0
  73. LIBVA_REQUIRED=0.35.0
  74. VDPAU_REQUIRED=0.4.1
  75. WAYLAND_REQUIRED=1.2.0
  76. XCB_REQUIRED=1.9.3
  77. XCBDRI2_REQUIRED=1.8
  78. XCBGLX_REQUIRED=1.8.1
  79. XSHMFENCE_REQUIRED=1.1
  80. XVMC_REQUIRED=1.0.6
  81. PYTHON_MAKO_REQUIRED=0.3.4
  82. dnl Check for progs
  83. AC_PROG_CPP
  84. AC_PROG_CC
  85. AC_PROG_CXX
  86. AM_PROG_CC_C_O
  87. AM_PROG_AS
  88. AX_CHECK_GNU_MAKE
  89. AC_CHECK_PROGS([PYTHON2], [python2 python])
  90. AC_PROG_SED
  91. AC_PROG_MKDIR_P
  92. AC_SYS_LARGEFILE
  93. LT_PREREQ([2.2])
  94. LT_INIT([disable-static])
  95. AX_PROG_BISON([],
  96. AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"],
  97. [AC_MSG_ERROR([bison not found - unable to compile glcpp-parse.y])]))
  98. AX_PROG_FLEX([],
  99. AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-lex.c"],
  100. [AC_MSG_ERROR([flex not found - unable to compile glcpp-lex.l])]))
  101. AC_CHECK_PROG(INDENT, indent, indent, cat)
  102. if test "x$INDENT" != "xcat"; then
  103. # Only GNU indent is supported
  104. INDENT_VERSION=`indent --version | grep GNU`
  105. if test $? -eq 0; then
  106. AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte -TBool')
  107. else
  108. INDENT="cat"
  109. fi
  110. fi
  111. AX_CHECK_PYTHON_MAKO_MODULE($PYTHON_MAKO_REQUIRED)
  112. if test -z "$PYTHON2"; then
  113. if test ! -f "$srcdir/src/util/format_srgb.c"; then
  114. AC_MSG_ERROR([Python not found - unable to generate sources])
  115. fi
  116. else
  117. if test "x$acv_mako_found" = xno; then
  118. if test ! -f "$srcdir/src/mesa/main/format_unpack.c"; then
  119. AC_MSG_ERROR([Python mako module v$PYTHON_MAKO_REQUIRED or higher not found])
  120. fi
  121. fi
  122. fi
  123. AC_PROG_INSTALL
  124. dnl We need a POSIX shell for parts of the build. Assume we have one
  125. dnl in most cases.
  126. case "$host_os" in
  127. solaris*)
  128. # Solaris /bin/sh is too old/non-POSIX compliant
  129. AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
  130. SHELL="$POSIX_SHELL"
  131. ;;
  132. esac
  133. dnl clang is mostly GCC-compatible, but its version is much lower,
  134. dnl so we have to check for it.
  135. AC_MSG_CHECKING([if compiling with clang])
  136. AC_COMPILE_IFELSE(
  137. [AC_LANG_PROGRAM([], [[
  138. #ifndef __clang__
  139. not clang
  140. #endif
  141. ]])],
  142. [acv_mesa_CLANG=yes], [acv_mesa_CLANG=no])
  143. AC_MSG_RESULT([$acv_mesa_CLANG])
  144. dnl If we're using GCC, make sure that it is at least version 4.2.0. Older
  145. dnl versions are explictly not supported.
  146. GEN_ASM_OFFSETS=no
  147. USE_GNU99=no
  148. if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
  149. AC_MSG_CHECKING([whether gcc version is sufficient])
  150. major=0
  151. minor=0
  152. GCC_VERSION=`$CC -dumpversion`
  153. if test $? -eq 0; then
  154. GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
  155. GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
  156. fi
  157. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 2 ; then
  158. AC_MSG_RESULT([no])
  159. AC_MSG_ERROR([If using GCC, version 4.2.0 or later is required.])
  160. else
  161. AC_MSG_RESULT([yes])
  162. fi
  163. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 6 ; then
  164. USE_GNU99=yes
  165. fi
  166. if test "x$cross_compiling" = xyes; then
  167. GEN_ASM_OFFSETS=yes
  168. fi
  169. fi
  170. dnl Check for compiler builtins
  171. AX_GCC_BUILTIN([__builtin_bswap32])
  172. AX_GCC_BUILTIN([__builtin_bswap64])
  173. AX_GCC_BUILTIN([__builtin_clz])
  174. AX_GCC_BUILTIN([__builtin_clzll])
  175. AX_GCC_BUILTIN([__builtin_ctz])
  176. AX_GCC_BUILTIN([__builtin_expect])
  177. AX_GCC_BUILTIN([__builtin_ffs])
  178. AX_GCC_BUILTIN([__builtin_ffsll])
  179. AX_GCC_BUILTIN([__builtin_popcount])
  180. AX_GCC_BUILTIN([__builtin_popcountll])
  181. AX_GCC_BUILTIN([__builtin_unreachable])
  182. AX_GCC_FUNC_ATTRIBUTE([flatten])
  183. AX_GCC_FUNC_ATTRIBUTE([format])
  184. AX_GCC_FUNC_ATTRIBUTE([malloc])
  185. AX_GCC_FUNC_ATTRIBUTE([packed])
  186. AX_GCC_FUNC_ATTRIBUTE([unused])
  187. AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)
  188. dnl Make sure the pkg-config macros are defined
  189. m4_ifndef([PKG_PROG_PKG_CONFIG],
  190. [m4_fatal([Could not locate the pkg-config autoconf macros.
  191. These are usually located in /usr/share/aclocal/pkg.m4. If your macros
  192. are in a different location, try setting the environment variable
  193. ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
  194. PKG_PROG_PKG_CONFIG()
  195. dnl LIB_DIR - library basename
  196. LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
  197. AC_SUBST([LIB_DIR])
  198. dnl Cache LDFLAGS and CPPFLAGS so we can add to them and restore later
  199. _SAVE_LDFLAGS="$LDFLAGS"
  200. _SAVE_CPPFLAGS="$CPPFLAGS"
  201. dnl Compiler macros
  202. DEFINES=""
  203. AC_SUBST([DEFINES])
  204. case "$host_os" in
  205. linux*|*-gnu*|gnu*)
  206. DEFINES="$DEFINES -D_GNU_SOURCE"
  207. ;;
  208. solaris*)
  209. DEFINES="$DEFINES -DSVR4"
  210. ;;
  211. cygwin*)
  212. DEFINES="$DEFINES -D_XOPEN_SOURCE=700"
  213. ;;
  214. esac
  215. dnl Add flags for gcc and g++
  216. if test "x$GCC" = xyes; then
  217. CFLAGS="$CFLAGS -Wall"
  218. if test "x$USE_GNU99" = xyes; then
  219. CFLAGS="$CFLAGS -std=gnu99"
  220. else
  221. CFLAGS="$CFLAGS -std=c99"
  222. fi
  223. # Enable -Werror=implicit-function-declaration and
  224. # -Werror=missing-prototypes, if available, or otherwise, just
  225. # -Wmissing-prototypes. This is particularly useful to avoid
  226. # generating a loadable driver module that has undefined symbols.
  227. save_CFLAGS="$CFLAGS"
  228. AC_MSG_CHECKING([whether $CC supports -Werror=missing-prototypes])
  229. CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
  230. CFLAGS="$CFLAGS -Werror=missing-prototypes"
  231. AC_LINK_IFELSE([AC_LANG_PROGRAM()],
  232. AC_MSG_RESULT([yes]),
  233. [CFLAGS="$save_CFLAGS -Wmissing-prototypes";
  234. AC_MSG_RESULT([no])]);
  235. # Enable -fvisibility=hidden if using a gcc that supports it
  236. save_CFLAGS="$CFLAGS"
  237. AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
  238. VISIBILITY_CFLAGS="-fvisibility=hidden"
  239. CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
  240. AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
  241. [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
  242. # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
  243. CFLAGS=$save_CFLAGS
  244. # Work around aliasing bugs - developers should comment this out
  245. CFLAGS="$CFLAGS -fno-strict-aliasing"
  246. # gcc's builtin memcmp is slower than glibc's
  247. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
  248. CFLAGS="$CFLAGS -fno-builtin-memcmp"
  249. # Flags to help ensure that certain portions of the code -- and only those
  250. # portions -- can be built with MSVC:
  251. # - src/util, src/gallium/auxiliary, and src/gallium/drivers/llvmpipe needs
  252. # to build with Windows SDK 7.0.7600, which bundles MSVC 2008
  253. # - non-Linux/Posix OpenGL portions needs to build on MSVC 2013 (which
  254. # supports most of C99)
  255. # - the rest has no compiler compiler restrictions
  256. MSVC2013_COMPAT_CFLAGS="-Werror=pointer-arith"
  257. MSVC2013_COMPAT_CXXFLAGS="-Werror=pointer-arith"
  258. # Enable -Werror=vla if compiler supports it
  259. save_CFLAGS="$CFLAGS"
  260. AC_MSG_CHECKING([whether $CC supports -Werror=vla])
  261. CFLAGS="$CFLAGS -Werror=vla"
  262. AC_LINK_IFELSE([AC_LANG_PROGRAM()],
  263. [MSVC2013_COMPAT_CFLAGS="$MSVC2013_COMPAT_CFLAGS -Werror=vla";
  264. MSVC2013_COMPAT_CXXFLAGS="$MSVC2013_COMPAT_CXXFLAGS -Werror=vla";
  265. AC_MSG_RESULT([yes])],
  266. AC_MSG_RESULT([no]));
  267. CFLAGS="$save_CFLAGS"
  268. MSVC2008_COMPAT_CFLAGS="$MSVC2013_COMPAT_CFLAGS -Werror=declaration-after-statement"
  269. MSVC2008_COMPAT_CXXFLAGS="$MSVC2013_COMPAT_CXXFLAGS"
  270. fi
  271. if test "x$GXX" = xyes; then
  272. CXXFLAGS="$CXXFLAGS -Wall"
  273. # Enable -fvisibility=hidden if using a gcc that supports it
  274. save_CXXFLAGS="$CXXFLAGS"
  275. AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
  276. VISIBILITY_CXXFLAGS="-fvisibility=hidden"
  277. CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
  278. AC_LANG_PUSH([C++])
  279. AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
  280. [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
  281. AC_LANG_POP([C++])
  282. # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
  283. CXXFLAGS=$save_CXXFLAGS
  284. # Work around aliasing bugs - developers should comment this out
  285. CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
  286. # gcc's builtin memcmp is slower than glibc's
  287. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
  288. CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
  289. fi
  290. AC_SUBST([MSVC2013_COMPAT_CFLAGS])
  291. AC_SUBST([MSVC2013_COMPAT_CXXFLAGS])
  292. AC_SUBST([MSVC2008_COMPAT_CFLAGS])
  293. AC_SUBST([MSVC2008_COMPAT_CXXFLAGS])
  294. dnl even if the compiler appears to support it, using visibility attributes isn't
  295. dnl going to do anything useful currently on cygwin apart from emit lots of warnings
  296. case "$host_os" in
  297. cygwin*)
  298. VISIBILITY_CFLAGS=""
  299. VISIBILITY_CXXFLAGS=""
  300. ;;
  301. esac
  302. AC_SUBST([VISIBILITY_CFLAGS])
  303. AC_SUBST([VISIBILITY_CXXFLAGS])
  304. dnl
  305. dnl Optional flags, check for compiler support
  306. dnl
  307. SSE41_CFLAGS="-msse4.1"
  308. dnl Code compiled by GCC with -msse* assumes a 16 byte aligned
  309. dnl stack, but on x86-32 such alignment is not guaranteed.
  310. case "$target_cpu" in
  311. i?86)
  312. SSE41_CFLAGS="$SSE41_CFLAGS -mstackrealign"
  313. ;;
  314. esac
  315. save_CFLAGS="$CFLAGS"
  316. CFLAGS="$SSE41_CFLAGS $CFLAGS"
  317. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  318. #include <smmintrin.h>
  319. int main () {
  320. __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
  321. c = _mm_max_epu32(a, b);
  322. return 0;
  323. }]])], SSE41_SUPPORTED=1)
  324. CFLAGS="$save_CFLAGS"
  325. if test "x$SSE41_SUPPORTED" = x1; then
  326. DEFINES="$DEFINES -DUSE_SSE41"
  327. fi
  328. AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1])
  329. AC_SUBST([SSE41_CFLAGS], $SSE41_CFLAGS)
  330. dnl Can't have static and shared libraries, default to static if user
  331. dnl explicitly requested. If both disabled, set to static since shared
  332. dnl was explicitly requested.
  333. case "x$enable_static$enable_shared" in
  334. xyesyes)
  335. AC_MSG_WARN([Cannot build static and shared libraries, disabling shared])
  336. enable_shared=no
  337. ;;
  338. xnono)
  339. AC_MSG_WARN([Cannot disable both static and shared libraries, enabling shared])
  340. enable_shared=yes
  341. ;;
  342. esac
  343. AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
  344. dnl
  345. dnl other compiler options
  346. dnl
  347. AC_ARG_ENABLE([debug],
  348. [AS_HELP_STRING([--enable-debug],
  349. [use debug compiler flags and macros @<:@default=disabled@:>@])],
  350. [enable_debug="$enableval"],
  351. [enable_debug=no]
  352. )
  353. if test "x$enable_debug" = xyes; then
  354. DEFINES="$DEFINES -DDEBUG"
  355. if test "x$GCC" = xyes; then
  356. if ! echo "$CFLAGS" | grep -q -e '-g'; then
  357. CFLAGS="$CFLAGS -g"
  358. fi
  359. if ! echo "$CFLAGS" | grep -q -e '-O'; then
  360. CFLAGS="$CFLAGS -O0"
  361. fi
  362. fi
  363. if test "x$GXX" = xyes; then
  364. if ! echo "$CXXFLAGS" | grep -q -e '-g'; then
  365. CXXFLAGS="$CXXFLAGS -g"
  366. fi
  367. if ! echo "$CXXFLAGS" | grep -q -e '-O'; then
  368. CXXFLAGS="$CXXFLAGS -O0"
  369. fi
  370. fi
  371. else
  372. DEFINES="$DEFINES -DNDEBUG"
  373. fi
  374. dnl
  375. dnl Check if linker supports -Bsymbolic
  376. dnl
  377. save_LDFLAGS=$LDFLAGS
  378. LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
  379. AC_MSG_CHECKING([if ld supports -Bsymbolic])
  380. AC_LINK_IFELSE(
  381. [AC_LANG_SOURCE([int main() { return 0;}])],
  382. [AC_MSG_RESULT([yes])
  383. BSYMBOLIC="-Wl,-Bsymbolic";],
  384. [AC_MSG_RESULT([no])
  385. BSYMBOLIC="";])
  386. LDFLAGS=$save_LDFLAGS
  387. AC_SUBST([BSYMBOLIC])
  388. dnl
  389. dnl Check if linker supports garbage collection
  390. dnl
  391. save_LDFLAGS=$LDFLAGS
  392. LDFLAGS="$LDFLAGS -Wl,--gc-sections"
  393. AC_MSG_CHECKING([whether ld supports --gc-sections])
  394. AC_LINK_IFELSE(
  395. [AC_LANG_SOURCE([static char UnusedFunc() { return 5; } int main() { return 0;}])],
  396. [AC_MSG_RESULT([yes])
  397. GC_SECTIONS="-Wl,--gc-sections";],
  398. [AC_MSG_RESULT([no])
  399. GC_SECTIONS="";])
  400. LDFLAGS=$save_LDFLAGS
  401. AC_SUBST([GC_SECTIONS])
  402. dnl
  403. dnl OpenBSD does not have DT_NEEDED entries for libc by design
  404. dnl so when these flags are passed to ld via libtool the checks will fail
  405. dnl
  406. case "$host_os" in
  407. openbsd* | darwin* )
  408. LD_NO_UNDEFINED="" ;;
  409. *)
  410. LD_NO_UNDEFINED="-Wl,--no-undefined" ;;
  411. esac
  412. AC_SUBST([LD_NO_UNDEFINED])
  413. dnl
  414. dnl Check if linker supports version scripts
  415. dnl
  416. AC_MSG_CHECKING([if the linker supports version-scripts])
  417. save_LDFLAGS=$LDFLAGS
  418. LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
  419. cat > conftest.map <<EOF
  420. VERSION_1 {
  421. global:
  422. main;
  423. local:
  424. *;
  425. };
  426. EOF
  427. AC_LINK_IFELSE(
  428. [AC_LANG_SOURCE([int main() { return 0;}])],
  429. [have_ld_version_script=yes;AC_MSG_RESULT(yes)],
  430. [have_ld_version_script=no; AC_MSG_RESULT(no)])
  431. LDFLAGS=$save_LDFLAGS
  432. AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
  433. dnl
  434. dnl Check if linker supports dynamic list files
  435. dnl
  436. AC_MSG_CHECKING([if the linker supports --dynamic-list])
  437. save_LDFLAGS=$LDFLAGS
  438. LDFLAGS="$LDFLAGS -Wl,--dynamic-list=conftest.dyn"
  439. cat > conftest.dyn <<EOF
  440. {
  441. radeon_drm_winsys_create;
  442. };
  443. EOF
  444. AC_LINK_IFELSE(
  445. [AC_LANG_SOURCE([int main() { return 0;}])],
  446. [have_ld_dynamic_list=yes;AC_MSG_RESULT(yes)],
  447. [have_ld_dynamic_list=no; AC_MSG_RESULT(no)])
  448. LDFLAGS=$save_LDFLAGS
  449. AM_CONDITIONAL(HAVE_LD_DYNAMIC_LIST, test "$have_ld_dynamic_list" = "yes")
  450. dnl
  451. dnl compatibility symlinks
  452. dnl
  453. case "$host_os" in
  454. linux* )
  455. HAVE_COMPAT_SYMLINKS=yes ;;
  456. * )
  457. HAVE_COMPAT_SYMLINKS=no ;;
  458. esac
  459. AM_CONDITIONAL(HAVE_COMPAT_SYMLINKS, test "x$HAVE_COMPAT_SYMLINKS" = xyes)
  460. dnl
  461. dnl library names
  462. dnl
  463. case "$host_os" in
  464. darwin* )
  465. LIB_EXT='dylib' ;;
  466. cygwin* )
  467. LIB_EXT='dll' ;;
  468. aix* )
  469. LIB_EXT='a' ;;
  470. * )
  471. LIB_EXT='so' ;;
  472. esac
  473. AC_SUBST([LIB_EXT])
  474. AC_ARG_WITH([gl-lib-name],
  475. [AS_HELP_STRING([--with-gl-lib-name@<:@=NAME@:>@],
  476. [specify GL library name @<:@default=GL@:>@])],
  477. [GL_LIB=$withval],
  478. [GL_LIB=GL])
  479. AC_ARG_WITH([osmesa-lib-name],
  480. [AS_HELP_STRING([--with-osmesa-lib-name@<:@=NAME@:>@],
  481. [specify OSMesa library name @<:@default=OSMesa@:>@])],
  482. [OSMESA_LIB=$withval],
  483. [OSMESA_LIB=OSMesa])
  484. AS_IF([test "x$GL_LIB" = xyes], [GL_LIB=GL])
  485. AS_IF([test "x$OSMESA_LIB" = xyes], [OSMESA_LIB=OSMesa])
  486. dnl
  487. dnl Mangled Mesa support
  488. dnl
  489. AC_ARG_ENABLE([mangling],
  490. [AS_HELP_STRING([--enable-mangling],
  491. [enable mangled symbols and library name @<:@default=disabled@:>@])],
  492. [enable_mangling="${enableval}"],
  493. [enable_mangling=no]
  494. )
  495. if test "x${enable_mangling}" = "xyes" ; then
  496. DEFINES="${DEFINES} -DUSE_MGL_NAMESPACE"
  497. GL_LIB="Mangled${GL_LIB}"
  498. OSMESA_LIB="Mangled${OSMESA_LIB}"
  499. fi
  500. AC_SUBST([GL_LIB])
  501. AC_SUBST([OSMESA_LIB])
  502. dnl
  503. dnl potentially-infringing-but-nobody-knows-for-sure stuff
  504. dnl
  505. AC_ARG_ENABLE([texture-float],
  506. [AS_HELP_STRING([--enable-texture-float],
  507. [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
  508. [enable_texture_float="$enableval"],
  509. [enable_texture_float=no]
  510. )
  511. if test "x$enable_texture_float" = xyes; then
  512. AC_MSG_WARN([Floating-point textures enabled.])
  513. AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
  514. DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
  515. fi
  516. dnl
  517. dnl Arch/platform-specific settings
  518. dnl
  519. AC_ARG_ENABLE([asm],
  520. [AS_HELP_STRING([--disable-asm],
  521. [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
  522. [enable_asm="$enableval"],
  523. [enable_asm=yes]
  524. )
  525. asm_arch=""
  526. AC_MSG_CHECKING([whether to enable assembly])
  527. test "x$enable_asm" = xno && AC_MSG_RESULT([no])
  528. # disable if cross compiling on x86/x86_64 since we must run gen_matypes
  529. if test "x$enable_asm" = xyes -a "x$cross_compiling" = xyes; then
  530. case "$host_cpu" in
  531. i?86 | x86_64 | amd64)
  532. enable_asm=no
  533. AC_MSG_RESULT([no, cross compiling])
  534. ;;
  535. esac
  536. fi
  537. # check for supported arches
  538. if test "x$enable_asm" = xyes; then
  539. case "$host_cpu" in
  540. i?86)
  541. case "$host_os" in
  542. linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | gnu*)
  543. asm_arch=x86
  544. ;;
  545. esac
  546. ;;
  547. x86_64|amd64)
  548. case "$host_os" in
  549. linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
  550. asm_arch=x86_64
  551. ;;
  552. esac
  553. ;;
  554. sparc*)
  555. case "$host_os" in
  556. linux*)
  557. asm_arch=sparc
  558. ;;
  559. esac
  560. ;;
  561. esac
  562. case "$asm_arch" in
  563. x86)
  564. DEFINES="$DEFINES -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
  565. AC_MSG_RESULT([yes, x86])
  566. ;;
  567. x86_64|amd64)
  568. DEFINES="$DEFINES -DUSE_X86_64_ASM"
  569. AC_MSG_RESULT([yes, x86_64])
  570. ;;
  571. sparc)
  572. DEFINES="$DEFINES -DUSE_SPARC_ASM"
  573. AC_MSG_RESULT([yes, sparc])
  574. ;;
  575. *)
  576. AC_MSG_RESULT([no, platform not supported])
  577. ;;
  578. esac
  579. fi
  580. AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
  581. AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
  582. AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
  583. dnl Check to see if dlopen is in default libraries (like Solaris, which
  584. dnl has it in libc), or if libdl is needed to get it.
  585. AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
  586. [AC_CHECK_LIB([dl], [dlopen],
  587. [DEFINES="$DEFINES -DHAVE_DLOPEN"; DLOPEN_LIBS="-ldl"])])
  588. AC_SUBST([DLOPEN_LIBS])
  589. dnl Check if that library also has dladdr
  590. save_LIBS="$LIBS"
  591. LIBS="$LIBS $DLOPEN_LIBS"
  592. AC_CHECK_FUNCS([dladdr])
  593. LIBS="$save_LIBS"
  594. case "$host_os" in
  595. darwin*)
  596. ;;
  597. *)
  598. AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
  599. [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
  600. [AC_MSG_ERROR([Could not find clock_gettime])])])
  601. AC_SUBST([CLOCK_LIB])
  602. ;;
  603. esac
  604. dnl See if posix_memalign is available
  605. AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
  606. dnl Check for pthreads
  607. AX_PTHREAD
  608. if test "x$ax_pthread_ok" = xno; then
  609. AC_MSG_ERROR([Building mesa on this platform requires pthreads])
  610. fi
  611. dnl AX_PTHREADS leaves PTHREAD_LIBS empty for gcc and sets PTHREAD_CFLAGS
  612. dnl to -pthread, which causes problems if we need -lpthread to appear in
  613. dnl pkgconfig files.
  614. test -z "$PTHREAD_LIBS" && PTHREAD_LIBS="-lpthread"
  615. dnl SELinux awareness.
  616. AC_ARG_ENABLE([selinux],
  617. [AS_HELP_STRING([--enable-selinux],
  618. [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
  619. [MESA_SELINUX="$enableval"],
  620. [MESA_SELINUX=no])
  621. if test "x$enable_selinux" = "xyes"; then
  622. PKG_CHECK_MODULES([SELINUX], [libselinux], [],
  623. [AC_CHECK_HEADER([selinux/selinux.h],[],
  624. [AC_MSG_ERROR([SELinux headers not found])])
  625. AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
  626. [AC_MSG_ERROR([SELinux library not found])])
  627. SELINUX_LIBS="-lselinux"])
  628. DEFINES="$DEFINES -DMESA_SELINUX"
  629. fi
  630. AC_SUBST([SELINUX_CFLAGS])
  631. AC_SUBST([SELINUX_LIBS])
  632. dnl Options for APIs
  633. AC_ARG_ENABLE([opengl],
  634. [AS_HELP_STRING([--disable-opengl],
  635. [disable support for standard OpenGL API @<:@default=enabled@:>@])],
  636. [enable_opengl="$enableval"],
  637. [enable_opengl=yes])
  638. AC_ARG_ENABLE([gles1],
  639. [AS_HELP_STRING([--disable-gles1],
  640. [disable support for OpenGL ES 1.x API @<:@default=enabled@:>@])],
  641. [enable_gles1="$enableval"],
  642. [enable_gles1=yes])
  643. AC_ARG_ENABLE([gles2],
  644. [AS_HELP_STRING([--disable-gles2],
  645. [disable support for OpenGL ES 2.x API @<:@default=enabled@:>@])],
  646. [enable_gles2="$enableval"],
  647. [enable_gles2=yes])
  648. AC_ARG_ENABLE([dri],
  649. [AS_HELP_STRING([--enable-dri],
  650. [enable DRI modules @<:@default=enabled@:>@])],
  651. [enable_dri="$enableval"],
  652. [enable_dri=yes])
  653. case "$host_os" in
  654. linux*)
  655. dri3_default=yes
  656. ;;
  657. *)
  658. dri3_default=no
  659. ;;
  660. esac
  661. AC_ARG_ENABLE([dri3],
  662. [AS_HELP_STRING([--enable-dri3],
  663. [enable DRI3 @<:@default=auto@:>@])],
  664. [enable_dri3="$enableval"],
  665. [enable_dri3="$dri3_default"])
  666. AC_ARG_ENABLE([glx],
  667. [AS_HELP_STRING([--enable-glx],
  668. [enable GLX library @<:@default=enabled@:>@])],
  669. [enable_glx="$enableval"],
  670. [enable_glx=yes])
  671. AC_ARG_ENABLE([osmesa],
  672. [AS_HELP_STRING([--enable-osmesa],
  673. [enable OSMesa library @<:@default=disabled@:>@])],
  674. [enable_osmesa="$enableval"],
  675. [enable_osmesa=no])
  676. AC_ARG_ENABLE([gallium-osmesa],
  677. [AS_HELP_STRING([--enable-gallium-osmesa],
  678. [enable Gallium implementation of the OSMesa library @<:@default=disabled@:>@])],
  679. [enable_gallium_osmesa="$enableval"],
  680. [enable_gallium_osmesa=no])
  681. AC_ARG_ENABLE([egl],
  682. [AS_HELP_STRING([--disable-egl],
  683. [disable EGL library @<:@default=enabled@:>@])],
  684. [enable_egl="$enableval"],
  685. [enable_egl=yes])
  686. AC_ARG_ENABLE([xa],
  687. [AS_HELP_STRING([--enable-xa],
  688. [enable build of the XA X Acceleration API @<:@default=disabled@:>@])],
  689. [enable_xa="$enableval"],
  690. [enable_xa=no])
  691. AC_ARG_ENABLE([gbm],
  692. [AS_HELP_STRING([--enable-gbm],
  693. [enable gbm library @<:@default=auto@:>@])],
  694. [enable_gbm="$enableval"],
  695. [enable_gbm=auto])
  696. AC_ARG_ENABLE([nine],
  697. [AS_HELP_STRING([--enable-nine],
  698. [enable build of the nine Direct3D9 API @<:@default=no@:>@])],
  699. [enable_nine="$enableval"],
  700. [enable_nine=no])
  701. AC_ARG_ENABLE([xvmc],
  702. [AS_HELP_STRING([--enable-xvmc],
  703. [enable xvmc library @<:@default=auto@:>@])],
  704. [enable_xvmc="$enableval"],
  705. [enable_xvmc=auto])
  706. AC_ARG_ENABLE([vdpau],
  707. [AS_HELP_STRING([--enable-vdpau],
  708. [enable vdpau library @<:@default=auto@:>@])],
  709. [enable_vdpau="$enableval"],
  710. [enable_vdpau=auto])
  711. AC_ARG_ENABLE([omx],
  712. [AS_HELP_STRING([--enable-omx],
  713. [enable OpenMAX library @<:@default=disabled@:>@])],
  714. [enable_omx="$enableval"],
  715. [enable_omx=no])
  716. AC_ARG_ENABLE([va],
  717. [AS_HELP_STRING([--enable-va],
  718. [enable va library @<:@default=auto@:>@])],
  719. [enable_va="$enableval"],
  720. [enable_va=auto])
  721. AC_ARG_ENABLE([opencl],
  722. [AS_HELP_STRING([--enable-opencl],
  723. [enable OpenCL library @<:@default=disabled@:>@])],
  724. [enable_opencl="$enableval"],
  725. [enable_opencl=no])
  726. AC_ARG_ENABLE([opencl_icd],
  727. [AS_HELP_STRING([--enable-opencl-icd],
  728. [Build an OpenCL ICD library to be loaded by an ICD implementation
  729. @<:@default=disabled@:>@])],
  730. [enable_opencl_icd="$enableval"],
  731. [enable_opencl_icd=no])
  732. AC_ARG_ENABLE([xlib-glx],
  733. [AS_HELP_STRING([--enable-xlib-glx],
  734. [make GLX library Xlib-based instead of DRI-based @<:@default=disabled@:>@])],
  735. [enable_xlib_glx="$enableval"],
  736. [enable_xlib_glx=no])
  737. AC_ARG_ENABLE([r600-llvm-compiler],
  738. [AS_HELP_STRING([--enable-r600-llvm-compiler],
  739. [Enable experimental LLVM backend for graphics shaders @<:@default=disabled@:>@])],
  740. [enable_r600_llvm="$enableval"],
  741. [enable_r600_llvm=no])
  742. AC_ARG_ENABLE([gallium-tests],
  743. [AS_HELP_STRING([--enable-gallium-tests],
  744. [Enable optional Gallium tests) @<:@default=disabled@:>@])],
  745. [enable_gallium_tests="$enableval"],
  746. [enable_gallium_tests=no])
  747. # Option for Gallium drivers
  748. # Keep this in sync with the --with-gallium-drivers help string default value
  749. GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
  750. AC_ARG_WITH([gallium-drivers],
  751. [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
  752. [comma delimited Gallium drivers list, e.g.
  753. "i915,ilo,nouveau,r300,r600,radeonsi,freedreno,svga,swrast,vc4"
  754. @<:@default=r300,r600,svga,swrast@:>@])],
  755. [with_gallium_drivers="$withval"],
  756. [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
  757. # Doing '--without-gallium-drivers' will set this variable to 'no'. Clear it
  758. # here so that the script doesn't choke on an unknown driver name later.
  759. case "$with_gallium_drivers" in
  760. yes) with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT" ;;
  761. no) with_gallium_drivers='' ;;
  762. esac
  763. if test "x$enable_opengl" = xno -a \
  764. "x$enable_gles1" = xno -a \
  765. "x$enable_gles2" = xno -a \
  766. "x$enable_nine" = xno -a \
  767. "x$enable_xa" = xno -a \
  768. "x$enable_xvmc" = xno -a \
  769. "x$enable_vdpau" = xno -a \
  770. "x$enable_omx" = xno -a \
  771. "x$enable_va" = xno -a \
  772. "x$enable_opencl" = xno; then
  773. AC_MSG_ERROR([at least one API should be enabled])
  774. fi
  775. # Building OpenGL ES1 and/or ES2 without OpenGL is not supported on mesa 9.0.x
  776. if test "x$enable_opengl" = xno -a \
  777. "x$enable_gles1" = xyes; then
  778. AC_MSG_ERROR([Building OpenGL ES1 without OpenGL is not supported])
  779. fi
  780. if test "x$enable_opengl" = xno -a \
  781. "x$enable_gles2" = xyes; then
  782. AC_MSG_ERROR([Building OpenGL ES2 without OpenGL is not supported])
  783. fi
  784. AM_CONDITIONAL(HAVE_OPENGL, test "x$enable_opengl" = xyes)
  785. AM_CONDITIONAL(HAVE_OPENGL_ES1, test "x$enable_gles1" = xyes)
  786. AM_CONDITIONAL(HAVE_OPENGL_ES2, test "x$enable_gles2" = xyes)
  787. AM_CONDITIONAL(NEED_OPENGL_COMMON, test "x$enable_opengl" = xyes -o \
  788. "x$enable_gles1" = xyes -o \
  789. "x$enable_gles2" = xyes)
  790. if test "x$enable_glx" = xno; then
  791. AC_MSG_WARN([GLX disabled, disabling Xlib-GLX])
  792. enable_xlib_glx=no
  793. fi
  794. if test "x$enable_dri$enable_xlib_glx" = xyesyes; then
  795. AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])
  796. fi
  797. if test "x$enable_opengl$enable_xlib_glx" = xnoyes; then
  798. AC_MSG_ERROR([Xlib-GLX cannot be built without OpenGL])
  799. fi
  800. # Disable GLX if OpenGL is not enabled
  801. if test "x$enable_glx$enable_opengl" = xyesno; then
  802. AC_MSG_WARN([OpenGL not enabled, disabling GLX])
  803. enable_glx=no
  804. fi
  805. # Disable GLX if DRI and Xlib-GLX are not enabled
  806. if test "x$enable_glx" = xyes -a \
  807. "x$enable_dri" = xno -a \
  808. "x$enable_xlib_glx" = xno; then
  809. AC_MSG_WARN([Neither DRI nor Xlib-GLX enabled, disabling GLX])
  810. enable_glx=no
  811. fi
  812. AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes -a \
  813. "x$enable_dri" = xyes)
  814. # Select which platform-dependent DRI code gets built
  815. case "$host_os" in
  816. darwin*)
  817. dri_platform='apple' ;;
  818. gnu*|cygwin*)
  819. dri_platform='none' ;;
  820. *)
  821. dri_platform='drm' ;;
  822. esac
  823. AM_CONDITIONAL(HAVE_DRICOMMON, test "x$enable_dri" = xyes )
  824. AM_CONDITIONAL(HAVE_DRISW, test "x$enable_dri" = xyes )
  825. AM_CONDITIONAL(HAVE_DRI2, test "x$enable_dri" = xyes -a "x$dri_platform" = xdrm )
  826. AM_CONDITIONAL(HAVE_DRI3, test "x$enable_dri3" = xyes -a "x$dri_platform" = xdrm )
  827. AM_CONDITIONAL(HAVE_APPLEDRI, test "x$enable_dri" = xyes -a "x$dri_platform" = xapple )
  828. AC_ARG_ENABLE([shared-glapi],
  829. [AS_HELP_STRING([--enable-shared-glapi],
  830. [Enable shared glapi for OpenGL @<:@default=enabled@:>@])],
  831. [enable_shared_glapi="$enableval"],
  832. [enable_shared_glapi=yes])
  833. case "x$enable_opengl$enable_gles1$enable_gles2" in
  834. x*yes*yes*)
  835. if test "x$enable_shared_glapi" = xno; then
  836. AC_MSG_ERROR([shared GLAPI required when building two or more of
  837. the following APIs - opengl, gles1 gles2])
  838. fi
  839. ;;
  840. esac
  841. AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
  842. # Build the pipe-drivers as separate libraries/modules.
  843. # Do not touch this unless you know what you are doing.
  844. # XXX: Expose via configure option ?
  845. enable_shared_pipe_drivers=no
  846. dnl
  847. dnl Driver specific build directories
  848. dnl
  849. case "x$enable_glx$enable_xlib_glx" in
  850. xyesyes)
  851. NEED_WINSYS_XLIB="yes"
  852. ;;
  853. esac
  854. if test "x$enable_dri" = xyes; then
  855. enable_gallium_loader="$enable_shared_pipe_drivers"
  856. fi
  857. if test "x$enable_gallium_osmesa" = xyes; then
  858. if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
  859. AC_MSG_ERROR([gallium_osmesa requires the gallium swrast driver])
  860. fi
  861. if test "x$enable_osmesa" = xyes; then
  862. AC_MSG_ERROR([Cannot enable both classic and Gallium OSMesa implementations])
  863. fi
  864. fi
  865. AC_SUBST([MESA_LLVM])
  866. # SHA1 hashing
  867. AC_ARG_WITH([sha1],
  868. [AS_HELP_STRING([--with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
  869. [choose SHA1 implementation])])
  870. case "x$with_sha1" in
  871. x | xlibc | xlibmd | xlibnettle | xlibgcrypt | xlibcrypto | xlibsha1 | xCommonCrypto | xCryptoAPI)
  872. ;;
  873. *)
  874. AC_MSG_ERROR([Illegal value for --with-sha1: $with_sha1])
  875. esac
  876. AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
  877. if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
  878. with_sha1=libc
  879. fi
  880. if test "x$with_sha1" = xlibc && test "x$HAVE_SHA1_IN_LIBC" != xyes; then
  881. AC_MSG_ERROR([sha1 in libc requested but not found])
  882. fi
  883. if test "x$with_sha1" = xlibc; then
  884. AC_DEFINE([HAVE_SHA1_IN_LIBC], [1],
  885. [Use libc SHA1 functions])
  886. SHA1_LIBS=""
  887. fi
  888. AC_CHECK_FUNC([CC_SHA1_Init], [HAVE_SHA1_IN_COMMONCRYPTO=yes])
  889. if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_COMMONCRYPTO" = xyes; then
  890. with_sha1=CommonCrypto
  891. fi
  892. if test "x$with_sha1" = xCommonCrypto && test "x$HAVE_SHA1_IN_COMMONCRYPTO" != xyes; then
  893. AC_MSG_ERROR([CommonCrypto requested but not found])
  894. fi
  895. if test "x$with_sha1" = xCommonCrypto; then
  896. AC_DEFINE([HAVE_SHA1_IN_COMMONCRYPTO], [1],
  897. [Use CommonCrypto SHA1 functions])
  898. SHA1_LIBS=""
  899. fi
  900. dnl stdcall functions cannot be tested with AC_CHECK_LIB
  901. AC_CHECK_HEADER([wincrypt.h], [HAVE_SHA1_IN_CRYPTOAPI=yes], [], [#include <windows.h>])
  902. if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_CRYPTOAPI" = xyes; then
  903. with_sha1=CryptoAPI
  904. fi
  905. if test "x$with_sha1" = xCryptoAPI && test "x$HAVE_SHA1_IN_CRYPTOAPI" != xyes; then
  906. AC_MSG_ERROR([CryptoAPI requested but not found])
  907. fi
  908. if test "x$with_sha1" = xCryptoAPI; then
  909. AC_DEFINE([HAVE_SHA1_IN_CRYPTOAPI], [1],
  910. [Use CryptoAPI SHA1 functions])
  911. SHA1_LIBS=""
  912. fi
  913. AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes])
  914. if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then
  915. with_sha1=libmd
  916. fi
  917. if test "x$with_sha1" = xlibmd && test "x$HAVE_LIBMD" != xyes; then
  918. AC_MSG_ERROR([libmd requested but not found])
  919. fi
  920. if test "x$with_sha1" = xlibmd; then
  921. AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
  922. [Use libmd SHA1 functions])
  923. SHA1_LIBS=-lmd
  924. fi
  925. PKG_CHECK_MODULES([LIBSHA1], [libsha1], [HAVE_LIBSHA1=yes], [HAVE_LIBSHA1=no])
  926. if test "x$with_sha1" = x && test "x$HAVE_LIBSHA1" = xyes; then
  927. with_sha1=libsha1
  928. fi
  929. if test "x$with_sha1" = xlibsha1 && test "x$HAVE_LIBSHA1" != xyes; then
  930. AC_MSG_ERROR([libsha1 requested but not found])
  931. fi
  932. if test "x$with_sha1" = xlibsha1; then
  933. AC_DEFINE([HAVE_SHA1_IN_LIBSHA1], [1],
  934. [Use libsha1 for SHA1])
  935. SHA1_LIBS=-lsha1
  936. fi
  937. AC_CHECK_LIB([nettle], [nettle_sha1_init], [HAVE_LIBNETTLE=yes])
  938. if test "x$with_sha1" = x && test "x$HAVE_LIBNETTLE" = xyes; then
  939. with_sha1=libnettle
  940. fi
  941. if test "x$with_sha1" = xlibnettle && test "x$HAVE_LIBNETTLE" != xyes; then
  942. AC_MSG_ERROR([libnettle requested but not found])
  943. fi
  944. if test "x$with_sha1" = xlibnettle; then
  945. AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1],
  946. [Use libnettle SHA1 functions])
  947. SHA1_LIBS=-lnettle
  948. fi
  949. AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
  950. if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
  951. with_sha1=libgcrypt
  952. fi
  953. if test "x$with_sha1" = xlibgcrypt && test "x$HAVE_LIBGCRYPT" != xyes; then
  954. AC_MSG_ERROR([libgcrypt requested but not found])
  955. fi
  956. if test "x$with_sha1" = xlibgcrypt; then
  957. AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1],
  958. [Use libgcrypt SHA1 functions])
  959. SHA1_LIBS=-lgcrypt
  960. fi
  961. # We don't need all of the OpenSSL libraries, just libcrypto
  962. AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes])
  963. PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
  964. [HAVE_OPENSSL_PKC=no])
  965. if test "x$HAVE_LIBCRYPTO" = xyes || test "x$HAVE_OPENSSL_PKC" = xyes; then
  966. if test "x$with_sha1" = x; then
  967. with_sha1=libcrypto
  968. fi
  969. else
  970. if test "x$with_sha1" = xlibcrypto; then
  971. AC_MSG_ERROR([OpenSSL libcrypto requested but not found])
  972. fi
  973. fi
  974. if test "x$with_sha1" = xlibcrypto; then
  975. if test "x$HAVE_LIBCRYPTO" = xyes; then
  976. SHA1_LIBS=-lcrypto
  977. else
  978. SHA1_LIBS="$OPENSSL_LIBS"
  979. SHA1_CFLAGS="$OPENSSL_CFLAGS"
  980. fi
  981. fi
  982. AC_MSG_CHECKING([for SHA1 implementation])
  983. AC_MSG_RESULT([$with_sha1])
  984. AC_SUBST(SHA1_LIBS)
  985. AC_SUBST(SHA1_CFLAGS)
  986. # Allow user to configure out the shader-cache feature
  987. AC_ARG_ENABLE([shader-cache],
  988. AS_HELP_STRING([--disable-shader-cache], [Disable binary shader cache]),
  989. [enable_shader_cache="$enableval"],
  990. [if test "x$with_sha1" != "x"; then
  991. enable_shader_cache=yes
  992. else
  993. enable_shader_cache=no
  994. fi])
  995. if test "x$with_sha1" = "x"; then
  996. if test "x$enable_shader_cache" = "xyes"; then
  997. AC_MSG_ERROR([Cannot enable shader cache (no SHA-1 implementation found)])
  998. fi
  999. fi
  1000. AM_CONDITIONAL([ENABLE_SHADER_CACHE], [test x$enable_shader_cache = xyes])
  1001. # Check for libdrm
  1002. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
  1003. [have_libdrm=yes], [have_libdrm=no])
  1004. if test "x$have_libdrm" = xyes; then
  1005. DEFINES="$DEFINES -DHAVE_LIBDRM"
  1006. fi
  1007. case "$host_os" in
  1008. linux*)
  1009. need_pci_id=yes ;;
  1010. *)
  1011. need_pci_id=no ;;
  1012. esac
  1013. PKG_CHECK_MODULES([LIBUDEV], [libudev >= $LIBUDEV_REQUIRED],
  1014. have_libudev=yes, have_libudev=no)
  1015. AC_ARG_ENABLE([sysfs],
  1016. [AS_HELP_STRING([--enable-sysfs],
  1017. [enable /sys PCI identification @<:@default=disabled@:>@])],
  1018. [have_sysfs="$enableval"],
  1019. [have_sysfs=no]
  1020. )
  1021. if test "x$enable_dri" = xyes; then
  1022. if test "$enable_static" = yes; then
  1023. AC_MSG_ERROR([Cannot use static libraries for DRI drivers])
  1024. fi
  1025. # not a hard requirement as swrast does not depend on it
  1026. if test "x$have_libdrm" = xyes; then
  1027. DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
  1028. fi
  1029. fi
  1030. AC_ARG_ENABLE([driglx-direct],
  1031. [AS_HELP_STRING([--disable-driglx-direct],
  1032. [disable direct rendering in GLX and EGL for DRI \
  1033. @<:@default=auto@:>@])],
  1034. [driglx_direct="$enableval"],
  1035. [driglx_direct="yes"])
  1036. # Check for libcaca
  1037. PKG_CHECK_EXISTS([caca], [have_libcaca=yes], [have_libcaca=no])
  1038. AM_CONDITIONAL([HAVE_LIBCACA], [test x$have_libcaca = xyes])
  1039. dnl
  1040. dnl libGL configuration per driver
  1041. dnl
  1042. case "x$enable_glx$enable_xlib_glx" in
  1043. xyesyes)
  1044. # Xlib-based GLX
  1045. dri_modules="x11 xext xcb"
  1046. PKG_CHECK_MODULES([XLIBGL], [$dri_modules])
  1047. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  1048. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  1049. GL_LIB_DEPS="$XLIBGL_LIBS"
  1050. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1051. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm $PTHREAD_LIBS"
  1052. ;;
  1053. xyesno)
  1054. # DRI-based GLX
  1055. PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
  1056. # find the DRI deps for libGL
  1057. dri_modules="x11 xext xdamage xfixes x11-xcb xcb xcb-glx >= $XCBGLX_REQUIRED"
  1058. if test x"$driglx_direct" = xyes; then
  1059. if test x"$dri_platform" = xdrm ; then
  1060. DEFINES="$DEFINES -DGLX_USE_DRM"
  1061. if test "x$have_libdrm" != xyes; then
  1062. AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
  1063. fi
  1064. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  1065. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
  1066. if test x"$enable_dri3" = xyes; then
  1067. PKG_CHECK_MODULES([DRI3PROTO], [dri3proto >= $DRI3PROTO_REQUIRED])
  1068. PKG_CHECK_MODULES([PRESENTPROTO], [presentproto >= $PRESENTPROTO_REQUIRED])
  1069. fi
  1070. if test x"$enable_dri" = xyes; then
  1071. dri_modules="$dri_modules xcb-dri2 >= $XCBDRI2_REQUIRED"
  1072. fi
  1073. if test x"$enable_dri3" = xyes; then
  1074. PKG_CHECK_EXISTS([xcb >= $XCB_REQUIRED], [], AC_MSG_ERROR([DRI3 requires xcb >= $XCB_REQUIRED]))
  1075. dri_modules="$dri_modules xcb-dri3 xcb-present xcb-sync xshmfence >= $XSHMFENCE_REQUIRED"
  1076. fi
  1077. fi
  1078. if test x"$dri_platform" = xapple ; then
  1079. DEFINES="$DEFINES -DGLX_USE_APPLEGL"
  1080. fi
  1081. fi
  1082. # add xf86vidmode if available
  1083. PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
  1084. if test "$HAVE_XF86VIDMODE" = yes ; then
  1085. dri_modules="$dri_modules xxf86vm"
  1086. fi
  1087. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  1088. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  1089. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  1090. GL_LIB_DEPS="$DRIGL_LIBS"
  1091. # need DRM libs, $PTHREAD_LIBS, etc.
  1092. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1093. GL_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1094. ;;
  1095. esac
  1096. have_pci_id=no
  1097. if test "$have_libudev" = yes; then
  1098. DEFINES="$DEFINES -DHAVE_LIBUDEV"
  1099. have_pci_id=yes
  1100. fi
  1101. if test "$have_sysfs" = yes; then
  1102. DEFINES="$DEFINES -DHAVE_SYSFS"
  1103. have_pci_id=yes
  1104. fi
  1105. # This is outside the case (above) so that it is invoked even for non-GLX
  1106. # builds.
  1107. AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
  1108. GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1109. GLESv1_CM_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1110. GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1111. GLESv2_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1112. AC_SUBST([X11_INCLUDES])
  1113. AC_SUBST([GL_LIB_DEPS])
  1114. AC_SUBST([GL_PC_REQ_PRIV])
  1115. AC_SUBST([GL_PC_LIB_PRIV])
  1116. AC_SUBST([GL_PC_CFLAGS])
  1117. AC_SUBST([DRI_PC_REQ_PRIV])
  1118. AC_SUBST([GLESv1_CM_LIB_DEPS])
  1119. AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
  1120. AC_SUBST([GLESv2_LIB_DEPS])
  1121. AC_SUBST([GLESv2_PC_LIB_PRIV])
  1122. AC_SUBST([HAVE_XF86VIDMODE])
  1123. dnl
  1124. dnl More GLX setup
  1125. dnl
  1126. case "x$enable_glx$enable_xlib_glx" in
  1127. xyesyes)
  1128. DEFINES="$DEFINES -DUSE_XSHM"
  1129. ;;
  1130. xyesno)
  1131. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  1132. if test "x$driglx_direct" = xyes; then
  1133. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  1134. fi
  1135. ;;
  1136. esac
  1137. dnl
  1138. dnl TLS detection
  1139. dnl
  1140. AC_ARG_ENABLE([glx-tls],
  1141. [AS_HELP_STRING([--enable-glx-tls],
  1142. [enable TLS support in GLX @<:@default=disabled@:>@])],
  1143. [GLX_USE_TLS="$enableval"],
  1144. [GLX_USE_TLS=no])
  1145. AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
  1146. AS_IF([test "x$GLX_USE_TLS" = xyes -a "x$ax_pthread_ok" = xyes],
  1147. [DEFINES="${DEFINES} -DGLX_USE_TLS"])
  1148. dnl
  1149. dnl More DRI setup
  1150. dnl
  1151. dnl Directory for DRI drivers
  1152. AC_ARG_WITH([dri-driverdir],
  1153. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  1154. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  1155. [DRI_DRIVER_INSTALL_DIR="$withval"],
  1156. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  1157. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  1158. dnl Extra search path for DRI drivers
  1159. AC_ARG_WITH([dri-searchpath],
  1160. [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
  1161. [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
  1162. [DRI_DRIVER_SEARCH_DIR="$withval"],
  1163. [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
  1164. AC_SUBST([DRI_DRIVER_SEARCH_DIR])
  1165. dnl Which drivers to build - default is chosen by platform
  1166. AC_ARG_WITH([dri-drivers],
  1167. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  1168. [comma delimited classic DRI drivers list, e.g.
  1169. "swrast,i965,radeon" @<:@default=auto@:>@])],
  1170. [with_dri_drivers="$withval"],
  1171. [with_dri_drivers=auto])
  1172. if test "x$with_dri_drivers" = xauto; then
  1173. if test "x$enable_opengl" = xyes -a "x$enable_dri" = xyes; then
  1174. with_dri_drivers="yes"
  1175. else
  1176. with_dri_drivers="no"
  1177. fi
  1178. fi
  1179. if test "x$with_dri_drivers" = xno; then
  1180. with_dri_drivers=''
  1181. fi
  1182. dnl If $with_dri_drivers is yes, drivers will be added through
  1183. dnl platform checks. Set DEFINES and LIB_DEPS
  1184. if test "x$enable_dri" = xyes; then
  1185. # Platform specific settings and drivers to build
  1186. case "$host_os" in
  1187. linux*)
  1188. DEFINES="$DEFINES -DHAVE_ALIAS"
  1189. if test "x$enable_dri3" = xyes; then
  1190. DEFINES="$DEFINES -DHAVE_DRI3"
  1191. fi
  1192. if test "x$have_pci_id" != xyes; then
  1193. AC_MSG_ERROR([libudev-dev or sysfs required for building DRI])
  1194. fi
  1195. case "$host_cpu" in
  1196. powerpc* | sparc*)
  1197. # Build only the drivers for cards that exist on PowerPC/sparc
  1198. if test "x$with_dri_drivers" = "xyes"; then
  1199. with_dri_drivers="r200 radeon swrast"
  1200. fi
  1201. ;;
  1202. esac
  1203. ;;
  1204. *freebsd* | dragonfly* | *netbsd* | openbsd*)
  1205. DEFINES="$DEFINES -DHAVE_ALIAS"
  1206. ;;
  1207. gnu*)
  1208. DEFINES="$DEFINES -DHAVE_ALIAS"
  1209. ;;
  1210. cygwin*)
  1211. if test "x$with_dri_drivers" = "xyes"; then
  1212. with_dri_drivers="swrast"
  1213. fi
  1214. ;;
  1215. darwin*)
  1216. DEFINES="$DEFINES -DGLX_ALIAS_UNSUPPORTED"
  1217. if test "x$with_dri_drivers" = "xyes"; then
  1218. with_dri_drivers="swrast"
  1219. fi
  1220. ;;
  1221. esac
  1222. # default drivers
  1223. if test "x$with_dri_drivers" = "xyes"; then
  1224. with_dri_drivers="i915 i965 nouveau r200 radeon swrast"
  1225. fi
  1226. # Check for expat
  1227. PKG_CHECK_MODULES([EXPAT], [expat], [],
  1228. # expat version 2.0 and earlier do not provide expat.pc
  1229. [AC_CHECK_HEADER([expat.h],[],
  1230. [AC_MSG_ERROR([Expat headers required for DRI not found])])
  1231. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  1232. [AC_MSG_ERROR([Expat library required for DRI not found])])
  1233. EXPAT_LIBS="-lexpat"])
  1234. DRICOMMON_NEED_LIBDRM=no
  1235. # If we are building any DRI driver other than swrast.
  1236. if test -n "$with_dri_drivers"; then
  1237. if test "x$with_dri_drivers" != xswrast; then
  1238. # ... libdrm is required
  1239. if test "x$have_libdrm" != xyes; then
  1240. AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED])
  1241. fi
  1242. DRICOMMON_NEED_LIBDRM=yes
  1243. fi
  1244. fi
  1245. # If we're building any gallium DRI driver other than swrast
  1246. if test -n "$with_gallium_drivers" -a "x$DRICOMMON_NEED_LIBDRM" = xno; then
  1247. if test "x$with_gallium_drivers" != xswrast; then
  1248. # ... build a libdrm aware dricommon
  1249. DRICOMMON_NEED_LIBDRM=yes
  1250. fi
  1251. fi
  1252. # put all the necessary libs together
  1253. DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1254. fi
  1255. AC_SUBST([DRI_LIB_DEPS])
  1256. DRI_DIRS=''
  1257. dnl Duplicates in DRI_DIRS are removed by sorting it at the end of this block
  1258. if test -n "$with_dri_drivers"; then
  1259. if test "x$enable_opengl" != xyes; then
  1260. AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
  1261. fi
  1262. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  1263. for driver in $dri_drivers; do
  1264. DRI_DIRS="$DRI_DIRS $driver"
  1265. case "x$driver" in
  1266. xi915)
  1267. HAVE_I915_DRI=yes;
  1268. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1269. ;;
  1270. xi965)
  1271. HAVE_I965_DRI=yes;
  1272. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1273. ;;
  1274. xnouveau)
  1275. HAVE_NOUVEAU_DRI=yes;
  1276. PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NVVIEUX_REQUIRED])
  1277. ;;
  1278. xradeon)
  1279. HAVE_RADEON_DRI=yes;
  1280. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1281. ;;
  1282. xr200)
  1283. HAVE_R200_DRI=yes;
  1284. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1285. ;;
  1286. xswrast)
  1287. HAVE_SWRAST_DRI=yes;
  1288. ;;
  1289. *)
  1290. AC_MSG_ERROR([classic DRI driver '$driver' does not exist])
  1291. ;;
  1292. esac
  1293. done
  1294. DRI_DIRS=`echo $DRI_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
  1295. fi
  1296. AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")
  1297. AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
  1298. "x$enable_osmesa" = xyes -o \
  1299. -n "$DRI_DIRS")
  1300. dnl
  1301. dnl OSMesa configuration
  1302. dnl
  1303. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  1304. AC_ARG_WITH([osmesa-bits],
  1305. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  1306. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  1307. [osmesa_bits="$withval"],
  1308. [osmesa_bits=8])
  1309. if test "x$osmesa_bits" != x8; then
  1310. if test "x$enable_dri" = xyes -o "x$enable_glx" = xyes; then
  1311. AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa driver])
  1312. osmesa_bits=8
  1313. fi
  1314. fi
  1315. case "x$osmesa_bits" in
  1316. x8)
  1317. OSMESA_LIB="${OSMESA_LIB}"
  1318. ;;
  1319. x16|x32)
  1320. OSMESA_LIB="${OSMESA_LIB}$osmesa_bits"
  1321. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  1322. ;;
  1323. *)
  1324. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  1325. ;;
  1326. esac
  1327. if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then
  1328. # only link libraries with osmesa if shared
  1329. if test "$enable_static" = no; then
  1330. OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
  1331. else
  1332. OSMESA_LIB_DEPS=""
  1333. fi
  1334. OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
  1335. fi
  1336. AC_SUBST([OSMESA_LIB_DEPS])
  1337. AC_SUBST([OSMESA_PC_REQ])
  1338. AC_SUBST([OSMESA_PC_LIB_PRIV])
  1339. dnl
  1340. dnl gbm configuration
  1341. dnl
  1342. if test "x$enable_gbm" = xauto; then
  1343. case "$with_egl_platforms" in
  1344. *drm*)
  1345. enable_gbm=yes ;;
  1346. *)
  1347. enable_gbm=no ;;
  1348. esac
  1349. fi
  1350. if test "x$enable_gbm" = xyes; then
  1351. if test "x$need_pci_id$have_pci_id" = xyesno; then
  1352. AC_MSG_ERROR([gbm requires udev >= $LIBUDEV_REQUIRED or sysfs])
  1353. fi
  1354. if test "x$enable_dri" = xyes; then
  1355. if test "x$enable_shared_glapi" = xno; then
  1356. AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
  1357. fi
  1358. else
  1359. # Strictly speaking libgbm does not require --enable-dri, although
  1360. # both of its backends do. Thus one can build libgbm without any
  1361. # backends if --disable-dri is set.
  1362. # To avoid unnecessary complexity of checking if at least one backend
  1363. # is available when building, just mandate --enable-dri.
  1364. AC_MSG_ERROR([gbm requires --enable-dri])
  1365. fi
  1366. fi
  1367. AM_CONDITIONAL(HAVE_GBM, test "x$enable_gbm" = xyes)
  1368. if test "x$need_pci_id$have_libudev" = xyesyes; then
  1369. GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED"
  1370. else
  1371. GBM_PC_REQ_PRIV=""
  1372. fi
  1373. GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
  1374. AC_SUBST([GBM_PC_REQ_PRIV])
  1375. AC_SUBST([GBM_PC_LIB_PRIV])
  1376. AM_CONDITIONAL(HAVE_VULKAN, true)
  1377. dnl
  1378. dnl EGL configuration
  1379. dnl
  1380. EGL_CLIENT_APIS=""
  1381. if test "x$enable_egl" = xyes; then
  1382. EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS $PTHREAD_LIBS"
  1383. AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
  1384. if test "$enable_static" != yes; then
  1385. if test "x$enable_dri" = xyes; then
  1386. HAVE_EGL_DRIVER_DRI2=1
  1387. if test "x$enable_shared_glapi" = xno; then
  1388. AC_MSG_ERROR([egl_dri2 requires --enable-shared-glapi])
  1389. fi
  1390. else
  1391. # Avoid building an "empty" libEGL. Drop/update this
  1392. # when other backends (haiku?) come along.
  1393. AC_MSG_ERROR([egl requires --enable-dri])
  1394. fi
  1395. fi
  1396. fi
  1397. AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes)
  1398. AC_SUBST([EGL_LIB_DEPS])
  1399. dnl
  1400. dnl XA configuration
  1401. dnl
  1402. if test "x$enable_xa" = xyes; then
  1403. if test "x$with_gallium_drivers" = xswrast; then
  1404. AC_MSG_ERROR([
  1405. Building xa requires at least one non swrast gallium driver.
  1406. If you are looking to use libxatracker.so with the VMware driver,
  1407. make sure to include svga in the gallium drivers list, apart from
  1408. enabling XA.
  1409. Example: ./configure --enable-xa --with-gallium-drivers=svga...])
  1410. fi
  1411. enable_gallium_loader=$enable_shared_pipe_drivers
  1412. fi
  1413. AM_CONDITIONAL(HAVE_ST_XA, test "x$enable_xa" = xyes)
  1414. dnl
  1415. dnl Gallium G3DVL configuration
  1416. dnl
  1417. if test -n "$with_gallium_drivers" -a "x$with_gallium_drivers" != xswrast; then
  1418. if test "x$enable_xvmc" = xauto; then
  1419. PKG_CHECK_EXISTS([xvmc >= $XVMC_REQUIRED], [enable_xvmc=yes], [enable_xvmc=no])
  1420. fi
  1421. if test "x$enable_vdpau" = xauto; then
  1422. PKG_CHECK_EXISTS([vdpau >= $VDPAU_REQUIRED], [enable_vdpau=yes], [enable_vdpau=no])
  1423. fi
  1424. if test "x$enable_omx" = xauto; then
  1425. PKG_CHECK_EXISTS([libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED], [enable_omx=yes], [enable_omx=no])
  1426. fi
  1427. if test "x$enable_va" = xauto; then
  1428. PKG_CHECK_EXISTS([libva >= $LIBVA_REQUIRED], [enable_va=yes], [enable_va=no])
  1429. fi
  1430. fi
  1431. if test "x$enable_dri" = xyes -o \
  1432. "x$enable_xvmc" = xyes -o \
  1433. "x$enable_vdpau" = xyes -o \
  1434. "x$enable_omx" = xyes -o \
  1435. "x$enable_va" = xyes; then
  1436. need_gallium_vl=yes
  1437. fi
  1438. AM_CONDITIONAL(NEED_GALLIUM_VL, test "x$need_gallium_vl" = xyes)
  1439. if test "x$enable_xvmc" = xyes -o \
  1440. "x$enable_vdpau" = xyes -o \
  1441. "x$enable_omx" = xyes -o \
  1442. "x$enable_va" = xyes; then
  1443. PKG_CHECK_MODULES([VL], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED])
  1444. need_gallium_vl_winsys=yes
  1445. fi
  1446. AM_CONDITIONAL(NEED_GALLIUM_VL_WINSYS, test "x$need_gallium_vl_winsys" = xyes)
  1447. if test "x$enable_xvmc" = xyes; then
  1448. PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED])
  1449. enable_gallium_loader=$enable_shared_pipe_drivers
  1450. fi
  1451. AM_CONDITIONAL(HAVE_ST_XVMC, test "x$enable_xvmc" = xyes)
  1452. if test "x$enable_vdpau" = xyes; then
  1453. PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED])
  1454. enable_gallium_loader=$enable_shared_pipe_drivers
  1455. fi
  1456. AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes)
  1457. if test "x$enable_omx" = xyes; then
  1458. PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED])
  1459. enable_gallium_loader=$enable_shared_pipe_drivers
  1460. fi
  1461. AM_CONDITIONAL(HAVE_ST_OMX, test "x$enable_omx" = xyes)
  1462. if test "x$enable_va" = xyes; then
  1463. PKG_CHECK_MODULES([VA], [libva >= $LIBVA_REQUIRED])
  1464. enable_gallium_loader=$enable_shared_pipe_drivers
  1465. fi
  1466. AM_CONDITIONAL(HAVE_ST_VA, test "x$enable_va" = xyes)
  1467. dnl
  1468. dnl Nine Direct3D9 configuration
  1469. dnl
  1470. if test "x$enable_nine" = xyes; then
  1471. if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
  1472. AC_MSG_ERROR([nine requires the gallium swrast driver])
  1473. fi
  1474. if test "x$with_gallium_drivers" = xswrast; then
  1475. AC_MSG_ERROR([nine requires at least one non-swrast gallium driver])
  1476. fi
  1477. if test "x$enable_dri3" = xno; then
  1478. AC_MSG_WARN([using nine together with wine requires DRI3 enabled system])
  1479. fi
  1480. enable_gallium_loader=$enable_shared_pipe_drivers
  1481. fi
  1482. AM_CONDITIONAL(HAVE_ST_NINE, test "x$enable_nine" = xyes)
  1483. dnl
  1484. dnl OpenCL configuration
  1485. dnl
  1486. AC_ARG_WITH([clang-libdir],
  1487. [AS_HELP_STRING([--with-clang-libdir],
  1488. [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
  1489. [CLANG_LIBDIR="$withval"],
  1490. [CLANG_LIBDIR=''])
  1491. PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
  1492. AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;ELF_LIB=-lelf])
  1493. if test "x$enable_opencl" = xyes; then
  1494. if test -z "$with_gallium_drivers"; then
  1495. AC_MSG_ERROR([cannot enable OpenCL without Gallium])
  1496. fi
  1497. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 7; then
  1498. AC_MSG_ERROR([gcc >= 4.7 is required to build clover])
  1499. fi
  1500. if test "x$have_libclc" = xno; then
  1501. AC_MSG_ERROR([pkg-config cannot find libclc.pc which is required to build clover.
  1502. Make sure the directory containing libclc.pc is specified in your
  1503. PKG_CONFIG_PATH environment variable.
  1504. By default libclc.pc is installed to /usr/local/share/pkgconfig/])
  1505. else
  1506. LIBCLC_INCLUDEDIR=`$PKG_CONFIG --variable=includedir libclc`
  1507. LIBCLC_LIBEXECDIR=`$PKG_CONFIG --variable=libexecdir libclc`
  1508. AC_SUBST([LIBCLC_INCLUDEDIR])
  1509. AC_SUBST([LIBCLC_LIBEXECDIR])
  1510. fi
  1511. # XXX: Use $enable_shared_pipe_drivers once converted to use static/shared pipe-drivers
  1512. enable_gallium_loader=yes
  1513. if test "x$enable_opencl_icd" = xyes; then
  1514. OPENCL_LIBNAME="MesaOpenCL"
  1515. else
  1516. OPENCL_LIBNAME="OpenCL"
  1517. fi
  1518. if test "x$have_libelf" != xyes; then
  1519. AC_MSG_ERROR([Clover requires libelf])
  1520. fi
  1521. fi
  1522. AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
  1523. AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
  1524. AC_SUBST([OPENCL_LIBNAME])
  1525. dnl
  1526. dnl Gallium configuration
  1527. dnl
  1528. AM_CONDITIONAL(HAVE_GALLIUM, test -n "$with_gallium_drivers")
  1529. AC_SUBST([LLVM_BINDIR])
  1530. AC_SUBST([LLVM_CFLAGS])
  1531. AC_SUBST([LLVM_CPPFLAGS])
  1532. AC_SUBST([LLVM_CXXFLAGS])
  1533. AC_SUBST([LLVM_LIBDIR])
  1534. AC_SUBST([LLVM_LIBS])
  1535. AC_SUBST([LLVM_LDFLAGS])
  1536. AC_SUBST([LLVM_INCLUDEDIR])
  1537. AC_SUBST([LLVM_VERSION])
  1538. AC_SUBST([CLANG_RESOURCE_DIR])
  1539. case "x$enable_opengl$enable_gles1$enable_gles2" in
  1540. x*yes*)
  1541. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
  1542. ;;
  1543. esac
  1544. AC_SUBST([VG_LIB_DEPS])
  1545. AC_SUBST([EGL_CLIENT_APIS])
  1546. dnl
  1547. dnl EGL Platforms configuration
  1548. dnl
  1549. AC_ARG_WITH([egl-platforms],
  1550. [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
  1551. [comma delimited native platforms libEGL supports, e.g.
  1552. "x11,drm" @<:@default=auto@:>@])],
  1553. [with_egl_platforms="$withval"],
  1554. [if test "x$enable_egl" = xyes; then
  1555. with_egl_platforms="x11"
  1556. else
  1557. with_egl_platforms=""
  1558. fi])
  1559. if test "x$with_egl_platforms" != "x" -a "x$enable_egl" != xyes; then
  1560. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1561. fi
  1562. PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland_scanner],
  1563. WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland_scanner`,
  1564. WAYLAND_SCANNER='')
  1565. if test "x$WAYLAND_SCANNER" = x; then
  1566. AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner])
  1567. fi
  1568. # Do per-EGL platform setups and checks
  1569. egl_platforms=`IFS=', '; echo $with_egl_platforms`
  1570. for plat in $egl_platforms; do
  1571. case "$plat" in
  1572. wayland)
  1573. PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED wayland-server >= $WAYLAND_REQUIRED])
  1574. if test "x$WAYLAND_SCANNER" = x; then
  1575. AC_MSG_ERROR([wayland-scanner is needed to compile the wayland egl platform])
  1576. fi
  1577. ;;
  1578. x11)
  1579. PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED xcb-xfixes])
  1580. ;;
  1581. drm)
  1582. test "x$enable_gbm" = "xno" &&
  1583. AC_MSG_ERROR([EGL platform drm needs gbm])
  1584. test "x$have_libdrm" != xyes &&
  1585. AC_MSG_ERROR([EGL platform drm requires libdrm >= $LIBDRM_REQUIRED])
  1586. ;;
  1587. surfaceless)
  1588. test "x$have_libdrm" != xyes &&
  1589. AC_MSG_ERROR([EGL platform surfaceless requires libdrm >= $LIBDRM_REQUIRED])
  1590. ;;
  1591. android|gdi|null)
  1592. ;;
  1593. *)
  1594. AC_MSG_ERROR([EGL platform '$plat' does not exist])
  1595. ;;
  1596. esac
  1597. case "$plat$need_pci_id$have_pci_id" in
  1598. waylandyesno|drmyesno)
  1599. AC_MSG_ERROR([cannot build $plat platform without udev >= $LIBUDEV_REQUIRED or sysfs]) ;;
  1600. esac
  1601. done
  1602. # libEGL wants to default to the first platform specified in
  1603. # ./configure. parse that here.
  1604. if test "x$egl_platforms" != "x"; then
  1605. FIRST_PLATFORM_CAPS=`echo $egl_platforms | sed 's| .*||' | tr '[[a-z]]' '[[A-Z]]'`
  1606. EGL_NATIVE_PLATFORM="_EGL_PLATFORM_$FIRST_PLATFORM_CAPS"
  1607. else
  1608. EGL_NATIVE_PLATFORM="_EGL_INVALID_PLATFORM"
  1609. fi
  1610. if echo "$egl_platforms" | grep -q 'x11'; then
  1611. NEED_WINSYS_XLIB=yes
  1612. fi
  1613. AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep -q 'x11')
  1614. AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 'wayland')
  1615. AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm')
  1616. AM_CONDITIONAL(HAVE_EGL_PLATFORM_SURFACELESS, echo "$egl_platforms" | grep -q 'surfaceless')
  1617. AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep -q 'null')
  1618. AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
  1619. AC_SUBST([EGL_NATIVE_PLATFORM])
  1620. AC_SUBST([EGL_CFLAGS])
  1621. # If we don't have the X11 platform, set this define so we don't try to include
  1622. # the X11 headers.
  1623. if ! echo "$egl_platforms" | grep -q 'x11'; then
  1624. DEFINES="$DEFINES -DMESA_EGL_NO_X11_HEADERS"
  1625. GL_PC_CFLAGS="$GL_PC_CFLAGS -DMESA_EGL_NO_X11_HEADERS"
  1626. fi
  1627. dnl
  1628. dnl Gallium LLVM
  1629. dnl
  1630. AC_ARG_ENABLE([gallium-llvm],
  1631. [AS_HELP_STRING([--enable-gallium-llvm],
  1632. [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
  1633. [enable_gallium_llvm="$enableval"],
  1634. [enable_gallium_llvm=auto])
  1635. AC_ARG_ENABLE([llvm-shared-libs],
  1636. [AS_HELP_STRING([--enable-llvm-shared-libs],
  1637. [link with LLVM shared libraries @<:@default=enabled@:>@])],
  1638. [enable_llvm_shared_libs="$enableval"],
  1639. [enable_llvm_shared_libs=yes])
  1640. AC_ARG_WITH([llvm-prefix],
  1641. [AS_HELP_STRING([--with-llvm-prefix],
  1642. [Prefix for LLVM installations in non-standard locations])],
  1643. [llvm_prefix="$withval"],
  1644. [llvm_prefix=''])
  1645. # Call this inside ` ` to get the return value.
  1646. # $1 is the llvm-config command with arguments.
  1647. strip_unwanted_llvm_flags() {
  1648. # Use \> (marks the end of the word)
  1649. echo `$1` | sed \
  1650. -e 's/-DNDEBUG\>//g' \
  1651. -e 's/-D_GNU_SOURCE\>//g' \
  1652. -e 's/-pedantic\>//g' \
  1653. -e 's/-Wcovered-switch-default\>//g' \
  1654. -e 's/-O.\>//g' \
  1655. -e 's/-g\>//g' \
  1656. -e 's/-Wall\>//g' \
  1657. -e 's/-Wcast-qual\>//g' \
  1658. -e 's/-Woverloaded-virtual\>//g' \
  1659. -e 's/-fcolor-diagnostics\>//g' \
  1660. -e 's/-fdata-sections\>//g' \
  1661. -e 's/-ffunction-sections\>//g' \
  1662. -e 's/-fno-exceptions\>//g' \
  1663. -e 's/-fomit-frame-pointer\>//g' \
  1664. -e 's/-fvisibility-inlines-hidden\>//g' \
  1665. -e 's/-fPIC\>//g' \
  1666. -e 's/-fstack-protector-strong\>//g'
  1667. }
  1668. llvm_check_version_for() {
  1669. if test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${1}0${2}${3}"; then
  1670. AC_MSG_ERROR([LLVM $1.$2.$3 or newer is required for $4])
  1671. fi
  1672. }
  1673. if test -z "$with_gallium_drivers"; then
  1674. enable_gallium_llvm=no
  1675. fi
  1676. if test "x$enable_gallium_llvm" = xauto; then
  1677. case "$host_cpu" in
  1678. i*86|x86_64|amd64) enable_gallium_llvm=yes;;
  1679. esac
  1680. fi
  1681. if test "x$enable_gallium_llvm" = xyes; then
  1682. if test -n "$llvm_prefix"; then
  1683. AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
  1684. else
  1685. AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
  1686. fi
  1687. if test "x$LLVM_CONFIG" != xno; then
  1688. LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
  1689. LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
  1690. LLVM_BINDIR=`$LLVM_CONFIG --bindir`
  1691. LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
  1692. LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
  1693. LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
  1694. LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
  1695. LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
  1696. AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
  1697. [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
  1698. AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
  1699. [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
  1700. LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o '^[[0-9]]+'`
  1701. if test -z "$LLVM_VERSION_PATCH"; then
  1702. LLVM_VERSION_PATCH=0
  1703. fi
  1704. if test -n "${LLVM_VERSION_MAJOR}"; then
  1705. LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
  1706. else
  1707. LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
  1708. fi
  1709. LLVM_REQUIRED_VERSION_MAJOR="3"
  1710. LLVM_REQUIRED_VERSION_MINOR="3"
  1711. if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
  1712. AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
  1713. fi
  1714. LLVM_COMPONENTS="engine bitwriter mcjit mcdisassembler"
  1715. if test "x$enable_opencl" = xyes; then
  1716. llvm_check_version_for "3" "5" "0" "opencl"
  1717. LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker instrumentation"
  1718. LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader option objcarcopts profiledata"
  1719. fi
  1720. DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
  1721. MESA_LLVM=1
  1722. dnl Check for Clang internal headers
  1723. if test "x$enable_opencl" = xyes; then
  1724. if test -z "$CLANG_LIBDIR"; then
  1725. CLANG_LIBDIR=${LLVM_LIBDIR}
  1726. fi
  1727. CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
  1728. AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
  1729. [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.])])
  1730. fi
  1731. else
  1732. MESA_LLVM=0
  1733. LLVM_VERSION_INT=0
  1734. fi
  1735. else
  1736. MESA_LLVM=0
  1737. LLVM_VERSION_INT=0
  1738. if test "x$enable_opencl" = xyes; then
  1739. AC_MSG_ERROR([cannot enable OpenCL without LLVM])
  1740. fi
  1741. fi
  1742. dnl Directory for XVMC libs
  1743. AC_ARG_WITH([xvmc-libdir],
  1744. [AS_HELP_STRING([--with-xvmc-libdir=DIR],
  1745. [directory for the XVMC libraries @<:@default=${libdir}@:>@])],
  1746. [XVMC_LIB_INSTALL_DIR="$withval"],
  1747. [XVMC_LIB_INSTALL_DIR='${libdir}'])
  1748. AC_SUBST([XVMC_LIB_INSTALL_DIR])
  1749. dnl
  1750. dnl Gallium Tests
  1751. dnl
  1752. if test "x$enable_gallium_tests" = xyes; then
  1753. # XXX: Use $enable_shared_pipe_drivers once converted to use static/shared pipe-drivers
  1754. enable_gallium_loader=yes
  1755. fi
  1756. AM_CONDITIONAL(HAVE_GALLIUM_TESTS, test "x$enable_gallium_tests" = xyes)
  1757. dnl Directory for VDPAU libs
  1758. AC_ARG_WITH([vdpau-libdir],
  1759. [AS_HELP_STRING([--with-vdpau-libdir=DIR],
  1760. [directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
  1761. [VDPAU_LIB_INSTALL_DIR="$withval"],
  1762. [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
  1763. AC_SUBST([VDPAU_LIB_INSTALL_DIR])
  1764. dnl Directory for OMX libs
  1765. AC_ARG_WITH([omx-libdir],
  1766. [AS_HELP_STRING([--with-omx-libdir=DIR],
  1767. [directory for the OMX libraries])],
  1768. [OMX_LIB_INSTALL_DIR="$withval"],
  1769. [OMX_LIB_INSTALL_DIR=`$PKG_CONFIG --define-variable=libdir=\$libdir --variable=pluginsdir libomxil-bellagio`])
  1770. AC_SUBST([OMX_LIB_INSTALL_DIR])
  1771. dnl Directory for VA libs
  1772. AC_ARG_WITH([va-libdir],
  1773. [AS_HELP_STRING([--with-va-libdir=DIR],
  1774. [directory for the VA libraries @<:@${libdir}/dri@:>@])],
  1775. [VA_LIB_INSTALL_DIR="$withval"],
  1776. [VA_LIB_INSTALL_DIR="${libdir}/dri"])
  1777. AC_SUBST([VA_LIB_INSTALL_DIR])
  1778. AC_ARG_WITH([d3d-libdir],
  1779. [AS_HELP_STRING([--with-d3d-libdir=DIR],
  1780. [directory for the D3D modules @<:@${libdir}/d3d@:>@])],
  1781. [D3D_DRIVER_INSTALL_DIR="$withval"],
  1782. [D3D_DRIVER_INSTALL_DIR="${libdir}/d3d"])
  1783. AC_SUBST([D3D_DRIVER_INSTALL_DIR])
  1784. dnl
  1785. dnl Gallium helper functions
  1786. dnl
  1787. gallium_require_drm() {
  1788. if test "x$have_libdrm" != xyes; then
  1789. AC_MSG_ERROR([$1 requires libdrm >= $LIBDRM_REQUIRED])
  1790. fi
  1791. }
  1792. gallium_require_llvm() {
  1793. if test "x$MESA_LLVM" = x0; then
  1794. case "$host" in *gnux32) return;; esac
  1795. case "$host_cpu" in
  1796. i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on x86 and x86_64]);;
  1797. esac
  1798. fi
  1799. }
  1800. gallium_require_drm_loader() {
  1801. if test "x$enable_gallium_loader" = xyes; then
  1802. if test "x$need_pci_id$have_pci_id" = xyesno; then
  1803. AC_MSG_ERROR([Gallium drm loader requires libudev >= $LIBUDEV_REQUIRED or sysfs])
  1804. fi
  1805. enable_gallium_drm_loader=yes
  1806. fi
  1807. if test "x$enable_va" = xyes && test "x$7" != x; then
  1808. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $7"
  1809. fi
  1810. }
  1811. require_egl_drm() {
  1812. case "$with_egl_platforms" in
  1813. *drm*)
  1814. ;;
  1815. *)
  1816. AC_MSG_ERROR([--with-egl-platforms=drm is required to build the $1 driver.])
  1817. ;;
  1818. esac
  1819. if test "x$enable_gbm" != xyes; then
  1820. AC_MSG_ERROR([--enable-gbm is required to build the $1 driver.])
  1821. fi
  1822. }
  1823. radeon_llvm_check() {
  1824. if test ${LLVM_VERSION_INT} -lt 307; then
  1825. amdgpu_llvm_target_name='r600'
  1826. else
  1827. amdgpu_llvm_target_name='amdgpu'
  1828. fi
  1829. if test "x$enable_gallium_llvm" != "xyes"; then
  1830. AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
  1831. fi
  1832. llvm_check_version_for "3" "4" "2" $1
  1833. if test true && $LLVM_CONFIG --targets-built | grep -iqvw $amdgpu_llvm_target_name ; then
  1834. AC_MSG_ERROR([LLVM $amdgpu_llvm_target_name not enabled in your LLVM build.])
  1835. fi
  1836. LLVM_COMPONENTS="${LLVM_COMPONENTS} $amdgpu_llvm_target_name bitreader ipo"
  1837. NEED_RADEON_LLVM=yes
  1838. if test "x$have_libelf" != xyes; then
  1839. AC_MSG_ERROR([$1 requires libelf when using llvm])
  1840. fi
  1841. }
  1842. dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
  1843. if test -n "$with_gallium_drivers"; then
  1844. gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
  1845. for driver in $gallium_drivers; do
  1846. case "x$driver" in
  1847. xsvga)
  1848. HAVE_GALLIUM_SVGA=yes
  1849. gallium_require_drm "svga"
  1850. gallium_require_drm_loader
  1851. ;;
  1852. xi915)
  1853. HAVE_GALLIUM_I915=yes
  1854. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1855. gallium_require_drm "Gallium i915"
  1856. gallium_require_drm_loader
  1857. ;;
  1858. xilo)
  1859. HAVE_GALLIUM_ILO=yes
  1860. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1861. gallium_require_drm "Gallium i965/ilo"
  1862. gallium_require_drm_loader
  1863. ;;
  1864. xr300)
  1865. HAVE_GALLIUM_R300=yes
  1866. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1867. gallium_require_drm "Gallium R300"
  1868. gallium_require_drm_loader
  1869. gallium_require_llvm "Gallium R300"
  1870. ;;
  1871. xr600)
  1872. HAVE_GALLIUM_R600=yes
  1873. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1874. gallium_require_drm "Gallium R600"
  1875. gallium_require_drm_loader
  1876. if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes; then
  1877. radeon_llvm_check "r600g"
  1878. LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
  1879. fi
  1880. if test "x$enable_r600_llvm" = xyes; then
  1881. USE_R600_LLVM_COMPILER=yes;
  1882. fi
  1883. if test "x$enable_opencl" = xyes; then
  1884. LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
  1885. fi
  1886. ;;
  1887. xradeonsi)
  1888. HAVE_GALLIUM_RADEONSI=yes
  1889. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1890. gallium_require_drm "radeonsi"
  1891. gallium_require_drm_loader
  1892. radeon_llvm_check "radeonsi"
  1893. require_egl_drm "radeonsi"
  1894. ;;
  1895. xnouveau)
  1896. HAVE_GALLIUM_NOUVEAU=yes
  1897. PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
  1898. gallium_require_drm "nouveau"
  1899. gallium_require_drm_loader
  1900. ;;
  1901. xfreedreno)
  1902. HAVE_GALLIUM_FREEDRENO=yes
  1903. PKG_CHECK_MODULES([FREEDRENO], [libdrm_freedreno >= $LIBDRM_FREEDRENO_REQUIRED])
  1904. gallium_require_drm "freedreno"
  1905. gallium_require_drm_loader
  1906. ;;
  1907. xswrast)
  1908. HAVE_GALLIUM_SOFTPIPE=yes
  1909. if test "x$MESA_LLVM" = x1; then
  1910. HAVE_GALLIUM_LLVMPIPE=yes
  1911. fi
  1912. ;;
  1913. xvc4)
  1914. HAVE_GALLIUM_VC4=yes
  1915. gallium_require_drm "vc4"
  1916. gallium_require_drm_loader
  1917. case "$host_cpu" in
  1918. i?86 | x86_64 | amd64)
  1919. USE_VC4_SIMULATOR=yes
  1920. ;;
  1921. esac
  1922. ;;
  1923. *)
  1924. AC_MSG_ERROR([Unknown Gallium driver: $driver])
  1925. ;;
  1926. esac
  1927. done
  1928. fi
  1929. dnl Set LLVM_LIBS - This is done after the driver configuration so
  1930. dnl that drivers can add additional components to LLVM_COMPONENTS.
  1931. dnl Previously, gallium drivers were updating LLVM_LIBS directly
  1932. dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
  1933. dnl this was causing the same libraries to be appear multiple times
  1934. dnl in LLVM_LIBS.
  1935. if test "x$MESA_LLVM" != x0; then
  1936. LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
  1937. if test "x$enable_llvm_shared_libs" = xyes; then
  1938. dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
  1939. LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
  1940. AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.so"], [llvm_have_one_so=yes])
  1941. if test "x$llvm_have_one_so" = xyes; then
  1942. dnl LLVM was built using auto*, so there is only one shared object.
  1943. LLVM_LIBS="-l$LLVM_SO_NAME"
  1944. else
  1945. dnl If LLVM was built with CMake, there will be one shared object per
  1946. dnl component.
  1947. AS_IF([test ! -f "$LLVM_LIBDIR/libLLVMTarget.so"],
  1948. [AC_MSG_ERROR([Could not find llvm shared libraries:
  1949. Please make sure you have built llvm with the --enable-shared option
  1950. and that your llvm libraries are installed in $LLVM_LIBDIR
  1951. If you have installed your llvm libraries to a different directory you
  1952. can use the --with-llvm-prefix= configure flag to specify this directory.
  1953. NOTE: Mesa is attempting to use llvm shared libraries by default.
  1954. If you do not want to build with llvm shared libraries and instead want to
  1955. use llvm static libraries then add --disable-llvm-shared-libs to your configure
  1956. invocation and rebuild.])])
  1957. dnl We don't need to update LLVM_LIBS in this case because the LLVM
  1958. dnl install uses a shared object for each component and we have
  1959. dnl already added all of these objects to LLVM_LIBS.
  1960. fi
  1961. else
  1962. AC_MSG_WARN([Building mesa with statically linked LLVM may cause compilation issues])
  1963. dnl We need to link to llvm system libs when using static libs
  1964. dnl However, only llvm 3.5+ provides --system-libs
  1965. if test $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5; then
  1966. LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --system-libs`"
  1967. fi
  1968. fi
  1969. fi
  1970. AM_CONDITIONAL(HAVE_GALLIUM_SVGA, test "x$HAVE_GALLIUM_SVGA" = xyes)
  1971. AM_CONDITIONAL(HAVE_GALLIUM_I915, test "x$HAVE_GALLIUM_I915" = xyes)
  1972. AM_CONDITIONAL(HAVE_GALLIUM_ILO, test "x$HAVE_GALLIUM_ILO" = xyes)
  1973. AM_CONDITIONAL(HAVE_GALLIUM_R300, test "x$HAVE_GALLIUM_R300" = xyes)
  1974. AM_CONDITIONAL(HAVE_GALLIUM_R600, test "x$HAVE_GALLIUM_R600" = xyes)
  1975. AM_CONDITIONAL(HAVE_GALLIUM_RADEONSI, test "x$HAVE_GALLIUM_RADEONSI" = xyes)
  1976. AM_CONDITIONAL(HAVE_GALLIUM_RADEON_COMMON, test "x$HAVE_GALLIUM_R600" = xyes -o \
  1977. "x$HAVE_GALLIUM_RADEONSI" = xyes)
  1978. AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
  1979. AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes)
  1980. AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
  1981. AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes)
  1982. AM_CONDITIONAL(HAVE_GALLIUM_VC4, test "x$HAVE_GALLIUM_VC4" = xyes)
  1983. AM_CONDITIONAL(HAVE_GALLIUM_STATIC_TARGETS, test "x$enable_shared_pipe_drivers" = xno)
  1984. # NOTE: anything using xcb or other client side libs ends up in separate
  1985. # _CLIENT variables. The pipe loader is built in two variants,
  1986. # one that is standalone and does not link any x client libs (for
  1987. # use by XA tracker in particular, but could be used in any case
  1988. # where communication with xserver is not desired).
  1989. if test "x$enable_gallium_loader" = xyes; then
  1990. if test "x$NEED_WINSYS_XLIB" = xyes; then
  1991. GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_XLIB"
  1992. fi
  1993. if test "x$enable_dri" = xyes; then
  1994. GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRI"
  1995. fi
  1996. if test "x$enable_gallium_drm_loader" = xyes; then
  1997. GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRM"
  1998. PKG_CHECK_MODULES([GALLIUM_PIPE_LOADER_XCB], [xcb xcb-dri2],
  1999. pipe_loader_have_xcb=yes, pipe_loader_have_xcb=no)
  2000. if test "x$pipe_loader_have_xcb" = xyes; then
  2001. GALLIUM_PIPE_LOADER_CLIENT_DEFINES="$GALLIUM_PIPE_LOADER_CLIENT_DEFINES -DHAVE_PIPE_LOADER_XCB"
  2002. GALLIUM_PIPE_LOADER_CLIENT_LIBS="$GALLIUM_PIPE_LOADER_CLIENT_LIBS $GALLIUM_PIPE_LOADER_XCB_LIBS $LIBDRM_LIBS"
  2003. fi
  2004. fi
  2005. GALLIUM_PIPE_LOADER_CLIENT_DEFINES="$GALLIUM_PIPE_LOADER_CLIENT_DEFINES $GALLIUM_PIPE_LOADER_DEFINES"
  2006. GALLIUM_PIPE_LOADER_CLIENT_LIBS="$GALLIUM_PIPE_LOADER_CLIENT_LIBS $GALLIUM_PIPE_LOADER_LIBS"
  2007. AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
  2008. AC_SUBST([GALLIUM_PIPE_LOADER_LIBS])
  2009. AC_SUBST([GALLIUM_PIPE_LOADER_CLIENT_DEFINES])
  2010. AC_SUBST([GALLIUM_PIPE_LOADER_CLIENT_LIBS])
  2011. fi
  2012. AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
  2013. AM_CONDITIONAL(HAVE_I965_DRI, test x$HAVE_I965_DRI = xyes)
  2014. AM_CONDITIONAL(HAVE_NOUVEAU_DRI, test x$HAVE_NOUVEAU_DRI = xyes)
  2015. AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
  2016. AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
  2017. AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
  2018. AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test "x$HAVE_GALLIUM_R300" = xyes -o \
  2019. "x$HAVE_GALLIUM_R600" = xyes -o \
  2020. "x$HAVE_GALLIUM_RADEONSI" = xyes)
  2021. AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes)
  2022. AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
  2023. AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
  2024. AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
  2025. AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes)
  2026. AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
  2027. AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
  2028. AM_CONDITIONAL(USE_VC4_SIMULATOR, test x$USE_VC4_SIMULATOR = xyes)
  2029. if test "x$USE_VC4_SIMULATOR" = xyes -a "x$HAVE_GALLIUM_ILO" = xyes; then
  2030. AC_MSG_ERROR([VC4 simulator on x86 replaces i965 driver build, so ilo must be disabled.])
  2031. fi
  2032. AC_SUBST([ELF_LIB])
  2033. AM_CONDITIONAL(DRICOMMON_NEED_LIBDRM, test "x$DRICOMMON_NEED_LIBDRM" = xyes)
  2034. AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)
  2035. AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" = xyes)
  2036. AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
  2037. AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)
  2038. AM_CONDITIONAL(HAVE_X86_ASM, test "x$asm_arch" = xx86 -o "x$asm_arch" = xx86_64)
  2039. AM_CONDITIONAL(HAVE_X86_64_ASM, test "x$asm_arch" = xx86_64)
  2040. AM_CONDITIONAL(HAVE_SPARC_ASM, test "x$asm_arch" = xsparc)
  2041. AC_SUBST([NINE_MAJOR], 1)
  2042. AC_SUBST([NINE_MINOR], 0)
  2043. AC_SUBST([NINE_TINY], 0)
  2044. AC_SUBST([NINE_VERSION], "$NINE_MAJOR.$NINE_MINOR.$NINE_TINY")
  2045. AC_SUBST([VDPAU_MAJOR], 1)
  2046. AC_SUBST([VDPAU_MINOR], 0)
  2047. VA_MAJOR=`$PKG_CONFIG --modversion libva | $SED -n 's/\([[^\.]]*\)\..*$/\1/p'`
  2048. VA_MINOR=`$PKG_CONFIG --modversion libva | $SED -n 's/.*\.\(.*\)\..*$/\1/p'`
  2049. AC_SUBST([VA_MAJOR], $VA_MAJOR)
  2050. AC_SUBST([VA_MINOR], $VA_MINOR)
  2051. AC_SUBST([XVMC_MAJOR], 1)
  2052. AC_SUBST([XVMC_MINOR], 0)
  2053. XA_HEADER="$srcdir/src/gallium/state_trackers/xa/xa_tracker.h"
  2054. XA_MAJOR=`grep "#define XA_TRACKER_VERSION_MAJOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MAJOR //'`
  2055. XA_MINOR=`grep "#define XA_TRACKER_VERSION_MINOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MINOR //'`
  2056. XA_TINY=`grep "#define XA_TRACKER_VERSION_PATCH" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_PATCH //'`
  2057. AC_SUBST([XA_MAJOR], $XA_MAJOR)
  2058. AC_SUBST([XA_MINOR], $XA_MINOR)
  2059. AC_SUBST([XA_TINY], $XA_TINY)
  2060. AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
  2061. PKG_CHECK_MODULES(VALGRIND, [valgrind],
  2062. [have_valgrind=yes], [have_valgrind=no])
  2063. if test "x$have_valgrind" = "xyes"; then
  2064. AC_DEFINE([HAVE_VALGRIND], 1,
  2065. [Use valgrind intrinsics to suppress false warnings])
  2066. fi
  2067. dnl Restore LDFLAGS and CPPFLAGS
  2068. LDFLAGS="$_SAVE_LDFLAGS"
  2069. CPPFLAGS="$_SAVE_CPPFLAGS"
  2070. dnl Suppress clang's warnings about unused CFLAGS and CXXFLAGS
  2071. if test "x$acv_mesa_CLANG" = xyes; then
  2072. CFLAGS="$CFLAGS -Qunused-arguments"
  2073. CXXFLAGS="$CXXFLAGS -Qunused-arguments"
  2074. fi
  2075. dnl Add user CFLAGS and CXXFLAGS
  2076. CFLAGS="$CFLAGS $USER_CFLAGS"
  2077. CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
  2078. dnl Substitute the config
  2079. AC_CONFIG_FILES([Makefile
  2080. src/Makefile
  2081. src/egl/drivers/dri2/Makefile
  2082. src/egl/main/Makefile
  2083. src/egl/main/egl.pc
  2084. src/egl/wayland/wayland-drm/Makefile
  2085. src/egl/wayland/wayland-egl/Makefile
  2086. src/egl/wayland/wayland-egl/wayland-egl.pc
  2087. src/gallium/Makefile
  2088. src/gallium/auxiliary/Makefile
  2089. src/gallium/auxiliary/pipe-loader/Makefile
  2090. src/gallium/drivers/freedreno/Makefile
  2091. src/gallium/drivers/i915/Makefile
  2092. src/gallium/drivers/ilo/Makefile
  2093. src/gallium/drivers/llvmpipe/Makefile
  2094. src/gallium/drivers/noop/Makefile
  2095. src/gallium/drivers/nouveau/Makefile
  2096. src/gallium/drivers/r300/Makefile
  2097. src/gallium/drivers/r600/Makefile
  2098. src/gallium/drivers/radeon/Makefile
  2099. src/gallium/drivers/radeonsi/Makefile
  2100. src/gallium/drivers/rbug/Makefile
  2101. src/gallium/drivers/softpipe/Makefile
  2102. src/gallium/drivers/svga/Makefile
  2103. src/gallium/drivers/trace/Makefile
  2104. src/gallium/drivers/vc4/Makefile
  2105. src/gallium/state_trackers/clover/Makefile
  2106. src/gallium/state_trackers/dri/Makefile
  2107. src/gallium/state_trackers/glx/xlib/Makefile
  2108. src/gallium/state_trackers/nine/Makefile
  2109. src/gallium/state_trackers/omx/Makefile
  2110. src/gallium/state_trackers/osmesa/Makefile
  2111. src/gallium/state_trackers/va/Makefile
  2112. src/gallium/state_trackers/vdpau/Makefile
  2113. src/gallium/state_trackers/xa/Makefile
  2114. src/gallium/state_trackers/xvmc/Makefile
  2115. src/gallium/targets/d3dadapter9/Makefile
  2116. src/gallium/targets/d3dadapter9/d3d.pc
  2117. src/gallium/targets/dri/Makefile
  2118. src/gallium/targets/libgl-xlib/Makefile
  2119. src/gallium/targets/omx/Makefile
  2120. src/gallium/targets/opencl/Makefile
  2121. src/gallium/targets/osmesa/Makefile
  2122. src/gallium/targets/osmesa/osmesa.pc
  2123. src/gallium/targets/pipe-loader/Makefile
  2124. src/gallium/targets/va/Makefile
  2125. src/gallium/targets/vdpau/Makefile
  2126. src/gallium/targets/xa/Makefile
  2127. src/gallium/targets/xa/xatracker.pc
  2128. src/gallium/targets/xvmc/Makefile
  2129. src/gallium/tests/trivial/Makefile
  2130. src/gallium/tests/unit/Makefile
  2131. src/gallium/winsys/freedreno/drm/Makefile
  2132. src/gallium/winsys/i915/drm/Makefile
  2133. src/gallium/winsys/intel/drm/Makefile
  2134. src/gallium/winsys/nouveau/drm/Makefile
  2135. src/gallium/winsys/radeon/drm/Makefile
  2136. src/gallium/winsys/svga/drm/Makefile
  2137. src/gallium/winsys/sw/dri/Makefile
  2138. src/gallium/winsys/sw/kms-dri/Makefile
  2139. src/gallium/winsys/sw/null/Makefile
  2140. src/gallium/winsys/sw/wrapper/Makefile
  2141. src/gallium/winsys/sw/xlib/Makefile
  2142. src/gallium/winsys/vc4/drm/Makefile
  2143. src/gbm/Makefile
  2144. src/gbm/main/gbm.pc
  2145. src/glsl/Makefile
  2146. src/glx/Makefile
  2147. src/glx/apple/Makefile
  2148. src/glx/tests/Makefile
  2149. src/gtest/Makefile
  2150. src/loader/Makefile
  2151. src/mapi/Makefile
  2152. src/mapi/es1api/glesv1_cm.pc
  2153. src/mapi/es2api/glesv2.pc
  2154. src/mapi/glapi/gen/Makefile
  2155. src/mesa/Makefile
  2156. src/mesa/gl.pc
  2157. src/mesa/drivers/dri/dri.pc
  2158. src/mesa/drivers/dri/common/Makefile
  2159. src/mesa/drivers/dri/common/xmlpool/Makefile
  2160. src/mesa/drivers/dri/i915/Makefile
  2161. src/mesa/drivers/dri/i965/Makefile
  2162. src/mesa/drivers/dri/Makefile
  2163. src/mesa/drivers/dri/nouveau/Makefile
  2164. src/mesa/drivers/dri/r200/Makefile
  2165. src/mesa/drivers/dri/radeon/Makefile
  2166. src/mesa/drivers/dri/swrast/Makefile
  2167. src/mesa/drivers/osmesa/Makefile
  2168. src/mesa/drivers/osmesa/osmesa.pc
  2169. src/mesa/drivers/x11/Makefile
  2170. src/mesa/main/tests/Makefile
  2171. src/vulkan/Makefile
  2172. src/util/Makefile
  2173. src/util/tests/hash_table/Makefile])
  2174. AC_OUTPUT
  2175. dnl
  2176. dnl Output some configuration info for the user
  2177. dnl
  2178. echo ""
  2179. echo " prefix: $prefix"
  2180. echo " exec_prefix: $exec_prefix"
  2181. echo " libdir: $libdir"
  2182. echo " includedir: $includedir"
  2183. dnl API info
  2184. echo ""
  2185. echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
  2186. dnl Driver info
  2187. echo ""
  2188. case "x$enable_osmesa$enable_gallium_osmesa" in
  2189. xnoyes)
  2190. echo " OSMesa: lib$OSMESA_LIB (Gallium)"
  2191. ;;
  2192. xyesno)
  2193. echo " OSMesa: lib$OSMESA_LIB"
  2194. ;;
  2195. xnono)
  2196. echo " OSMesa: no"
  2197. ;;
  2198. esac
  2199. echo ""
  2200. if test "x$enable_dri" != xno; then
  2201. echo " DRI platform: $dri_platform"
  2202. if test -z "$DRI_DIRS"; then
  2203. echo " DRI drivers: no"
  2204. else
  2205. echo " DRI drivers: $DRI_DIRS"
  2206. fi
  2207. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  2208. fi
  2209. case "x$enable_glx$enable_xlib_glx" in
  2210. xyesyes)
  2211. echo " GLX: Xlib-based"
  2212. ;;
  2213. xyesno)
  2214. echo " GLX: DRI-based"
  2215. ;;
  2216. *)
  2217. echo " GLX: $enable_glx"
  2218. ;;
  2219. esac
  2220. dnl EGL
  2221. echo ""
  2222. echo " EGL: $enable_egl"
  2223. if test "$enable_egl" = yes; then
  2224. echo " EGL platforms: $egl_platforms"
  2225. egl_drivers=""
  2226. if test "x$HAVE_EGL_DRIVER_DRI2" != "x"; then
  2227. egl_drivers="$egl_drivers builtin:egl_dri2"
  2228. fi
  2229. echo " EGL drivers: $egl_drivers"
  2230. fi
  2231. echo ""
  2232. if test "x$MESA_LLVM" = x1; then
  2233. echo " llvm: yes"
  2234. echo " llvm-config: $LLVM_CONFIG"
  2235. echo " llvm-version: $LLVM_VERSION"
  2236. else
  2237. echo " llvm: no"
  2238. fi
  2239. echo ""
  2240. if test -n "$with_gallium_drivers"; then
  2241. echo " Gallium: yes"
  2242. else
  2243. echo " Gallium: no"
  2244. fi
  2245. dnl Shader cache
  2246. echo ""
  2247. echo " Shader cache: $enable_shader_cache"
  2248. if test "x$enable_shader_cache" = "xyes"; then
  2249. echo " With SHA1 from: $with_sha1"
  2250. fi
  2251. dnl Libraries
  2252. echo ""
  2253. echo " Shared libs: $enable_shared"
  2254. echo " Static libs: $enable_static"
  2255. echo " Shared-glapi: $enable_shared_glapi"
  2256. dnl Compiler options
  2257. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  2258. cflags=`echo $CFLAGS | \
  2259. $SED 's/^ *//;s/ */ /;s/ *$//'`
  2260. cxxflags=`echo $CXXFLAGS | \
  2261. $SED 's/^ *//;s/ */ /;s/ *$//'`
  2262. defines=`echo $DEFINES | $SED 's/^ *//;s/ */ /;s/ *$//'`
  2263. echo ""
  2264. echo " CFLAGS: $cflags"
  2265. echo " CXXFLAGS: $cxxflags"
  2266. echo " Macros: $defines"
  2267. echo ""
  2268. if test "x$MESA_LLVM" = x1; then
  2269. echo " LLVM_CFLAGS: $LLVM_CFLAGS"
  2270. echo " LLVM_CXXFLAGS: $LLVM_CXXFLAGS"
  2271. echo " LLVM_CPPFLAGS: $LLVM_CPPFLAGS"
  2272. echo " LLVM_LDFLAGS: $LLVM_LDFLAGS"
  2273. echo ""
  2274. fi
  2275. echo " PYTHON2: $PYTHON2"
  2276. echo ""
  2277. echo " Run '${MAKE-make}' to build Mesa"
  2278. echo ""