Clone of mesa.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

configure.ac 83KB

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