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

configure.ac 82KB

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.38.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. if test "x$enable_dri" = xno; then
  689. dri3_default=no
  690. fi
  691. AC_ARG_ENABLE([dri3],
  692. [AS_HELP_STRING([--enable-dri3],
  693. [enable DRI3 @<:@default=auto@:>@])],
  694. [enable_dri3="$enableval"],
  695. [enable_dri3="$dri3_default"])
  696. AC_ARG_ENABLE([glx],
  697. [AS_HELP_STRING([--enable-glx],
  698. [enable GLX library @<:@default=enabled@:>@])],
  699. [enable_glx="$enableval"],
  700. [enable_glx=yes])
  701. AC_ARG_ENABLE([osmesa],
  702. [AS_HELP_STRING([--enable-osmesa],
  703. [enable OSMesa library @<:@default=disabled@:>@])],
  704. [enable_osmesa="$enableval"],
  705. [enable_osmesa=no])
  706. AC_ARG_ENABLE([gallium-osmesa],
  707. [AS_HELP_STRING([--enable-gallium-osmesa],
  708. [enable Gallium implementation of the OSMesa library @<:@default=disabled@:>@])],
  709. [enable_gallium_osmesa="$enableval"],
  710. [enable_gallium_osmesa=no])
  711. AC_ARG_ENABLE([egl],
  712. [AS_HELP_STRING([--disable-egl],
  713. [disable EGL library @<:@default=enabled@:>@])],
  714. [enable_egl="$enableval"],
  715. [enable_egl=yes])
  716. AC_ARG_ENABLE([xa],
  717. [AS_HELP_STRING([--enable-xa],
  718. [enable build of the XA X Acceleration API @<:@default=disabled@:>@])],
  719. [enable_xa="$enableval"],
  720. [enable_xa=no])
  721. AC_ARG_ENABLE([gbm],
  722. [AS_HELP_STRING([--enable-gbm],
  723. [enable gbm library @<:@default=auto@:>@])],
  724. [enable_gbm="$enableval"],
  725. [enable_gbm=auto])
  726. AC_ARG_ENABLE([nine],
  727. [AS_HELP_STRING([--enable-nine],
  728. [enable build of the nine Direct3D9 API @<:@default=no@:>@])],
  729. [enable_nine="$enableval"],
  730. [enable_nine=no])
  731. AC_ARG_ENABLE([xvmc],
  732. [AS_HELP_STRING([--enable-xvmc],
  733. [enable xvmc library @<:@default=auto@:>@])],
  734. [enable_xvmc="$enableval"],
  735. [enable_xvmc=auto])
  736. AC_ARG_ENABLE([vdpau],
  737. [AS_HELP_STRING([--enable-vdpau],
  738. [enable vdpau library @<:@default=auto@:>@])],
  739. [enable_vdpau="$enableval"],
  740. [enable_vdpau=auto])
  741. AC_ARG_ENABLE([omx],
  742. [AS_HELP_STRING([--enable-omx],
  743. [enable OpenMAX library @<:@default=disabled@:>@])],
  744. [enable_omx="$enableval"],
  745. [enable_omx=no])
  746. AC_ARG_ENABLE([va],
  747. [AS_HELP_STRING([--enable-va],
  748. [enable va library @<:@default=auto@:>@])],
  749. [enable_va="$enableval"],
  750. [enable_va=auto])
  751. AC_ARG_ENABLE([opencl],
  752. [AS_HELP_STRING([--enable-opencl],
  753. [enable OpenCL library @<:@default=disabled@:>@])],
  754. [enable_opencl="$enableval"],
  755. [enable_opencl=no])
  756. AC_ARG_ENABLE([opencl_icd],
  757. [AS_HELP_STRING([--enable-opencl-icd],
  758. [Build an OpenCL ICD library to be loaded by an ICD implementation
  759. @<:@default=disabled@:>@])],
  760. [enable_opencl_icd="$enableval"],
  761. [enable_opencl_icd=no])
  762. AC_ARG_ENABLE([xlib-glx],
  763. [AS_HELP_STRING([--enable-xlib-glx],
  764. [make GLX library Xlib-based instead of DRI-based @<:@default=disabled@:>@])],
  765. [enable_xlib_glx="$enableval"],
  766. [enable_xlib_glx=no])
  767. AC_ARG_ENABLE([r600-llvm-compiler],
  768. [AS_HELP_STRING([--enable-r600-llvm-compiler],
  769. [Enable experimental LLVM backend for graphics shaders @<:@default=disabled@:>@])],
  770. [enable_r600_llvm="$enableval"],
  771. [enable_r600_llvm=no])
  772. AC_ARG_ENABLE([gallium-tests],
  773. [AS_HELP_STRING([--enable-gallium-tests],
  774. [Enable optional Gallium tests) @<:@default=disabled@:>@])],
  775. [enable_gallium_tests="$enableval"],
  776. [enable_gallium_tests=no])
  777. # Option for Gallium drivers
  778. # Keep this in sync with the --with-gallium-drivers help string default value
  779. GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
  780. AC_ARG_WITH([gallium-drivers],
  781. [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
  782. [comma delimited Gallium drivers list, e.g.
  783. "i915,ilo,nouveau,r300,r600,radeonsi,freedreno,svga,swrast,vc4,virgl"
  784. @<:@default=r300,r600,svga,swrast@:>@])],
  785. [with_gallium_drivers="$withval"],
  786. [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
  787. # Doing '--without-gallium-drivers' will set this variable to 'no'. Clear it
  788. # here so that the script doesn't choke on an unknown driver name later.
  789. case "$with_gallium_drivers" in
  790. yes) with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT" ;;
  791. no) with_gallium_drivers='' ;;
  792. esac
  793. if test "x$enable_opengl" = xno -a \
  794. "x$enable_gles1" = xno -a \
  795. "x$enable_gles2" = xno -a \
  796. "x$enable_nine" = xno -a \
  797. "x$enable_xa" = xno -a \
  798. "x$enable_xvmc" = xno -a \
  799. "x$enable_vdpau" = xno -a \
  800. "x$enable_omx" = xno -a \
  801. "x$enable_va" = xno -a \
  802. "x$enable_opencl" = xno; then
  803. AC_MSG_ERROR([at least one API should be enabled])
  804. fi
  805. # Building OpenGL ES1 and/or ES2 without OpenGL is not supported on mesa 9.0.x
  806. if test "x$enable_opengl" = xno -a \
  807. "x$enable_gles1" = xyes; then
  808. AC_MSG_ERROR([Building OpenGL ES1 without OpenGL is not supported])
  809. fi
  810. if test "x$enable_opengl" = xno -a \
  811. "x$enable_gles2" = xyes; then
  812. AC_MSG_ERROR([Building OpenGL ES2 without OpenGL is not supported])
  813. fi
  814. AM_CONDITIONAL(HAVE_OPENGL, test "x$enable_opengl" = xyes)
  815. AM_CONDITIONAL(HAVE_OPENGL_ES1, test "x$enable_gles1" = xyes)
  816. AM_CONDITIONAL(HAVE_OPENGL_ES2, test "x$enable_gles2" = xyes)
  817. AM_CONDITIONAL(NEED_OPENGL_COMMON, test "x$enable_opengl" = xyes -o \
  818. "x$enable_gles1" = xyes -o \
  819. "x$enable_gles2" = xyes)
  820. if test "x$enable_glx" = xno; then
  821. AC_MSG_WARN([GLX disabled, disabling Xlib-GLX])
  822. enable_xlib_glx=no
  823. fi
  824. if test "x$enable_dri$enable_xlib_glx" = xyesyes; then
  825. AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])
  826. fi
  827. if test "x$enable_opengl$enable_xlib_glx" = xnoyes; then
  828. AC_MSG_ERROR([Xlib-GLX cannot be built without OpenGL])
  829. fi
  830. # Disable GLX if OpenGL is not enabled
  831. if test "x$enable_glx$enable_opengl" = xyesno; then
  832. AC_MSG_WARN([OpenGL not enabled, disabling GLX])
  833. enable_glx=no
  834. fi
  835. # Disable GLX if DRI and Xlib-GLX are not enabled
  836. if test "x$enable_glx" = xyes -a \
  837. "x$enable_dri" = xno -a \
  838. "x$enable_xlib_glx" = xno; then
  839. AC_MSG_WARN([Neither DRI nor Xlib-GLX enabled, disabling GLX])
  840. enable_glx=no
  841. fi
  842. AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes -a \
  843. "x$enable_dri" = xyes)
  844. # Check for libdrm
  845. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
  846. [have_libdrm=yes], [have_libdrm=no])
  847. if test "x$have_libdrm" = xyes; then
  848. DEFINES="$DEFINES -DHAVE_LIBDRM"
  849. fi
  850. # Select which platform-dependent DRI code gets built
  851. case "$host_os" in
  852. darwin*)
  853. dri_platform='apple' ;;
  854. gnu*|cygwin*)
  855. dri_platform='none' ;;
  856. *)
  857. dri_platform='drm' ;;
  858. esac
  859. if test "x$enable_dri" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes; then
  860. have_drisw_kms='yes'
  861. fi
  862. AM_CONDITIONAL(HAVE_DRICOMMON, test "x$enable_dri" = xyes )
  863. AM_CONDITIONAL(HAVE_DRISW, test "x$enable_dri" = xyes )
  864. AM_CONDITIONAL(HAVE_DRISW_KMS, test "x$have_drisw_kms" = xyes )
  865. AM_CONDITIONAL(HAVE_DRI2, test "x$enable_dri" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes )
  866. AM_CONDITIONAL(HAVE_DRI3, test "x$enable_dri3" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes )
  867. AM_CONDITIONAL(HAVE_APPLEDRI, test "x$enable_dri" = xyes -a "x$dri_platform" = xapple )
  868. AC_ARG_ENABLE([shared-glapi],
  869. [AS_HELP_STRING([--enable-shared-glapi],
  870. [Enable shared glapi for OpenGL @<:@default=enabled@:>@])],
  871. [enable_shared_glapi="$enableval"],
  872. [enable_shared_glapi=yes])
  873. case "x$enable_opengl$enable_gles1$enable_gles2" in
  874. x*yes*yes*)
  875. if test "x$enable_shared_glapi" = xno; then
  876. AC_MSG_ERROR([shared GLAPI required when building two or more of
  877. the following APIs - opengl, gles1 gles2])
  878. fi
  879. ;;
  880. esac
  881. AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
  882. # Build the pipe-drivers as separate libraries/modules.
  883. # Do not touch this unless you know what you are doing.
  884. # XXX: Expose via configure option ?
  885. enable_shared_pipe_drivers=no
  886. dnl
  887. dnl Driver specific build directories
  888. dnl
  889. if test -n "$with_gallium_drivers" -a "x$enable_glx$enable_xlib_glx" = xyesyes; then
  890. NEED_WINSYS_XLIB="yes"
  891. fi
  892. if test "x$enable_gallium_osmesa" = xyes; then
  893. if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
  894. AC_MSG_ERROR([gallium_osmesa requires the gallium swrast driver])
  895. fi
  896. if test "x$enable_osmesa" = xyes; then
  897. AC_MSG_ERROR([Cannot enable both classic and Gallium OSMesa implementations])
  898. fi
  899. fi
  900. AC_SUBST([MESA_LLVM])
  901. # SHA1 hashing
  902. AC_ARG_WITH([sha1],
  903. [AS_HELP_STRING([--with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
  904. [choose SHA1 implementation])])
  905. case "x$with_sha1" in
  906. x | xlibc | xlibmd | xlibnettle | xlibgcrypt | xlibcrypto | xlibsha1 | xCommonCrypto | xCryptoAPI)
  907. ;;
  908. *)
  909. AC_MSG_ERROR([Illegal value for --with-sha1: $with_sha1])
  910. esac
  911. AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
  912. if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
  913. with_sha1=libc
  914. fi
  915. if test "x$with_sha1" = xlibc && test "x$HAVE_SHA1_IN_LIBC" != xyes; then
  916. AC_MSG_ERROR([sha1 in libc requested but not found])
  917. fi
  918. if test "x$with_sha1" = xlibc; then
  919. AC_DEFINE([HAVE_SHA1_IN_LIBC], [1],
  920. [Use libc SHA1 functions])
  921. SHA1_LIBS=""
  922. fi
  923. AC_CHECK_FUNC([CC_SHA1_Init], [HAVE_SHA1_IN_COMMONCRYPTO=yes])
  924. if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_COMMONCRYPTO" = xyes; then
  925. with_sha1=CommonCrypto
  926. fi
  927. if test "x$with_sha1" = xCommonCrypto && test "x$HAVE_SHA1_IN_COMMONCRYPTO" != xyes; then
  928. AC_MSG_ERROR([CommonCrypto requested but not found])
  929. fi
  930. if test "x$with_sha1" = xCommonCrypto; then
  931. AC_DEFINE([HAVE_SHA1_IN_COMMONCRYPTO], [1],
  932. [Use CommonCrypto SHA1 functions])
  933. SHA1_LIBS=""
  934. fi
  935. dnl stdcall functions cannot be tested with AC_CHECK_LIB
  936. AC_CHECK_HEADER([wincrypt.h], [HAVE_SHA1_IN_CRYPTOAPI=yes], [], [#include <windows.h>])
  937. if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_CRYPTOAPI" = xyes; then
  938. with_sha1=CryptoAPI
  939. fi
  940. if test "x$with_sha1" = xCryptoAPI && test "x$HAVE_SHA1_IN_CRYPTOAPI" != xyes; then
  941. AC_MSG_ERROR([CryptoAPI requested but not found])
  942. fi
  943. if test "x$with_sha1" = xCryptoAPI; then
  944. AC_DEFINE([HAVE_SHA1_IN_CRYPTOAPI], [1],
  945. [Use CryptoAPI SHA1 functions])
  946. SHA1_LIBS=""
  947. fi
  948. AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes])
  949. if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then
  950. with_sha1=libmd
  951. fi
  952. if test "x$with_sha1" = xlibmd && test "x$HAVE_LIBMD" != xyes; then
  953. AC_MSG_ERROR([libmd requested but not found])
  954. fi
  955. if test "x$with_sha1" = xlibmd; then
  956. AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
  957. [Use libmd SHA1 functions])
  958. SHA1_LIBS=-lmd
  959. fi
  960. PKG_CHECK_MODULES([LIBSHA1], [libsha1], [HAVE_LIBSHA1=yes], [HAVE_LIBSHA1=no])
  961. if test "x$with_sha1" = x && test "x$HAVE_LIBSHA1" = xyes; then
  962. with_sha1=libsha1
  963. fi
  964. if test "x$with_sha1" = xlibsha1 && test "x$HAVE_LIBSHA1" != xyes; then
  965. AC_MSG_ERROR([libsha1 requested but not found])
  966. fi
  967. if test "x$with_sha1" = xlibsha1; then
  968. AC_DEFINE([HAVE_SHA1_IN_LIBSHA1], [1],
  969. [Use libsha1 for SHA1])
  970. SHA1_LIBS=-lsha1
  971. fi
  972. AC_CHECK_LIB([nettle], [nettle_sha1_init], [HAVE_LIBNETTLE=yes])
  973. if test "x$with_sha1" = x && test "x$HAVE_LIBNETTLE" = xyes; then
  974. with_sha1=libnettle
  975. fi
  976. if test "x$with_sha1" = xlibnettle && test "x$HAVE_LIBNETTLE" != xyes; then
  977. AC_MSG_ERROR([libnettle requested but not found])
  978. fi
  979. if test "x$with_sha1" = xlibnettle; then
  980. AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1],
  981. [Use libnettle SHA1 functions])
  982. SHA1_LIBS=-lnettle
  983. fi
  984. AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
  985. if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
  986. with_sha1=libgcrypt
  987. fi
  988. if test "x$with_sha1" = xlibgcrypt && test "x$HAVE_LIBGCRYPT" != xyes; then
  989. AC_MSG_ERROR([libgcrypt requested but not found])
  990. fi
  991. if test "x$with_sha1" = xlibgcrypt; then
  992. AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1],
  993. [Use libgcrypt SHA1 functions])
  994. SHA1_LIBS=-lgcrypt
  995. fi
  996. # We don't need all of the OpenSSL libraries, just libcrypto
  997. AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes])
  998. PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
  999. [HAVE_OPENSSL_PKC=no])
  1000. if test "x$HAVE_LIBCRYPTO" = xyes || test "x$HAVE_OPENSSL_PKC" = xyes; then
  1001. if test "x$with_sha1" = x; then
  1002. with_sha1=libcrypto
  1003. fi
  1004. else
  1005. if test "x$with_sha1" = xlibcrypto; then
  1006. AC_MSG_ERROR([OpenSSL libcrypto requested but not found])
  1007. fi
  1008. fi
  1009. if test "x$with_sha1" = xlibcrypto; then
  1010. if test "x$HAVE_LIBCRYPTO" = xyes; then
  1011. SHA1_LIBS=-lcrypto
  1012. else
  1013. SHA1_LIBS="$OPENSSL_LIBS"
  1014. SHA1_CFLAGS="$OPENSSL_CFLAGS"
  1015. fi
  1016. fi
  1017. AC_MSG_CHECKING([for SHA1 implementation])
  1018. AC_MSG_RESULT([$with_sha1])
  1019. AC_SUBST(SHA1_LIBS)
  1020. AC_SUBST(SHA1_CFLAGS)
  1021. # Enable a define for SHA1
  1022. if test "x$with_sha1" != "x"; then
  1023. DEFINES="$DEFINES -DHAVE_SHA1"
  1024. fi
  1025. # Allow user to configure out the shader-cache feature
  1026. AC_ARG_ENABLE([shader-cache],
  1027. AS_HELP_STRING([--disable-shader-cache], [Disable binary shader cache]),
  1028. [enable_shader_cache="$enableval"],
  1029. [if test "x$with_sha1" != "x"; then
  1030. enable_shader_cache=yes
  1031. else
  1032. enable_shader_cache=no
  1033. fi])
  1034. if test "x$with_sha1" = "x"; then
  1035. if test "x$enable_shader_cache" = "xyes"; then
  1036. AC_MSG_ERROR([Cannot enable shader cache (no SHA-1 implementation found)])
  1037. fi
  1038. fi
  1039. AM_CONDITIONAL([ENABLE_SHADER_CACHE], [test x$enable_shader_cache = xyes])
  1040. case "$host_os" in
  1041. linux*)
  1042. need_pci_id=yes ;;
  1043. *)
  1044. need_pci_id=no ;;
  1045. esac
  1046. PKG_CHECK_MODULES([LIBUDEV], [libudev >= $LIBUDEV_REQUIRED],
  1047. have_libudev=yes, have_libudev=no)
  1048. AC_ARG_ENABLE([sysfs],
  1049. [AS_HELP_STRING([--enable-sysfs],
  1050. [enable /sys PCI identification @<:@default=disabled@:>@])],
  1051. [have_sysfs="$enableval"],
  1052. [have_sysfs=no]
  1053. )
  1054. if test "x$enable_dri" = xyes; then
  1055. if test "$enable_static" = yes; then
  1056. AC_MSG_ERROR([Cannot use static libraries for DRI drivers])
  1057. fi
  1058. # not a hard requirement as swrast does not depend on it
  1059. if test "x$have_libdrm" = xyes; then
  1060. DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
  1061. fi
  1062. fi
  1063. AC_ARG_ENABLE([driglx-direct],
  1064. [AS_HELP_STRING([--disable-driglx-direct],
  1065. [disable direct rendering in GLX and EGL for DRI \
  1066. @<:@default=auto@:>@])],
  1067. [driglx_direct="$enableval"],
  1068. [driglx_direct="yes"])
  1069. dnl
  1070. dnl libGL configuration per driver
  1071. dnl
  1072. case "x$enable_glx$enable_xlib_glx" in
  1073. xyesyes)
  1074. # Xlib-based GLX
  1075. dri_modules="x11 xext xcb"
  1076. PKG_CHECK_MODULES([XLIBGL], [$dri_modules])
  1077. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  1078. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  1079. GL_LIB_DEPS="$XLIBGL_LIBS"
  1080. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1081. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm $PTHREAD_LIBS"
  1082. ;;
  1083. xyesno)
  1084. # DRI-based GLX
  1085. PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
  1086. # find the DRI deps for libGL
  1087. dri_modules="x11 xext xdamage xfixes x11-xcb xcb xcb-glx >= $XCBGLX_REQUIRED"
  1088. if test x"$driglx_direct" = xyes; then
  1089. if test x"$dri_platform" = xdrm ; then
  1090. DEFINES="$DEFINES -DGLX_USE_DRM"
  1091. if test "x$have_libdrm" != xyes; then
  1092. AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
  1093. fi
  1094. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  1095. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
  1096. if test x"$enable_dri3" = xyes; then
  1097. PKG_CHECK_MODULES([DRI3PROTO], [dri3proto >= $DRI3PROTO_REQUIRED])
  1098. PKG_CHECK_MODULES([PRESENTPROTO], [presentproto >= $PRESENTPROTO_REQUIRED])
  1099. fi
  1100. if test x"$enable_dri" = xyes; then
  1101. dri_modules="$dri_modules xcb-dri2 >= $XCBDRI2_REQUIRED"
  1102. fi
  1103. if test x"$enable_dri3" = xyes; then
  1104. PKG_CHECK_EXISTS([xcb >= $XCB_REQUIRED], [], AC_MSG_ERROR([DRI3 requires xcb >= $XCB_REQUIRED]))
  1105. dri3_modules="xcb-dri3 xcb-present xcb-sync xshmfence >= $XSHMFENCE_REQUIRED"
  1106. PKG_CHECK_MODULES([XCB_DRI3], [$dri3_modules])
  1107. fi
  1108. fi
  1109. if test x"$dri_platform" = xapple ; then
  1110. DEFINES="$DEFINES -DGLX_USE_APPLEGL"
  1111. fi
  1112. fi
  1113. # add xf86vidmode if available
  1114. PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
  1115. if test "$HAVE_XF86VIDMODE" = yes ; then
  1116. dri_modules="$dri_modules xxf86vm"
  1117. fi
  1118. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  1119. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  1120. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  1121. GL_LIB_DEPS="$DRIGL_LIBS"
  1122. # need DRM libs, $PTHREAD_LIBS, etc.
  1123. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1124. GL_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1125. ;;
  1126. esac
  1127. have_pci_id=no
  1128. if test "$have_libudev" = yes; then
  1129. DEFINES="$DEFINES -DHAVE_LIBUDEV"
  1130. have_pci_id=yes
  1131. fi
  1132. if test "$have_sysfs" = yes; then
  1133. DEFINES="$DEFINES -DHAVE_SYSFS"
  1134. have_pci_id=yes
  1135. fi
  1136. # This is outside the case (above) so that it is invoked even for non-GLX
  1137. # builds.
  1138. AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
  1139. GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1140. GLESv1_CM_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1141. GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1142. GLESv2_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1143. AC_SUBST([X11_INCLUDES])
  1144. AC_SUBST([GL_LIB_DEPS])
  1145. AC_SUBST([GL_PC_REQ_PRIV])
  1146. AC_SUBST([GL_PC_LIB_PRIV])
  1147. AC_SUBST([GL_PC_CFLAGS])
  1148. AC_SUBST([DRI_PC_REQ_PRIV])
  1149. AC_SUBST([GLESv1_CM_LIB_DEPS])
  1150. AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
  1151. AC_SUBST([GLESv2_LIB_DEPS])
  1152. AC_SUBST([GLESv2_PC_LIB_PRIV])
  1153. AC_SUBST([HAVE_XF86VIDMODE])
  1154. dnl
  1155. dnl More GLX setup
  1156. dnl
  1157. case "x$enable_glx$enable_xlib_glx" in
  1158. xyesyes)
  1159. DEFINES="$DEFINES -DUSE_XSHM"
  1160. ;;
  1161. xyesno)
  1162. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  1163. if test "x$driglx_direct" = xyes; then
  1164. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  1165. fi
  1166. ;;
  1167. esac
  1168. dnl
  1169. dnl TLS detection
  1170. dnl
  1171. AC_ARG_ENABLE([glx-tls],
  1172. [AS_HELP_STRING([--enable-glx-tls],
  1173. [enable TLS support in GLX @<:@default=disabled@:>@])],
  1174. [GLX_USE_TLS="$enableval"],
  1175. [GLX_USE_TLS=no])
  1176. AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
  1177. AS_IF([test "x$GLX_USE_TLS" = xyes -a "x$ax_pthread_ok" = xyes],
  1178. [DEFINES="${DEFINES} -DGLX_USE_TLS"])
  1179. dnl Read-only text section on x86 hardened platforms
  1180. AC_ARG_ENABLE([glx-read-only-text],
  1181. [AS_HELP_STRING([--enable-glx-read-only-text],
  1182. [Disable writable .text section on x86 (decreases performance) @<:@default=disabled@:>@])],
  1183. [enable_glx_read_only_text="$enableval"],
  1184. [enable_glx_read_only_text=no])
  1185. if test "x$enable_glx_read_only_text" = xyes; then
  1186. DEFINES="$DEFINES -DGLX_X86_READONLY_TEXT"
  1187. fi
  1188. dnl
  1189. dnl More DRI setup
  1190. dnl
  1191. dnl Directory for DRI drivers
  1192. AC_ARG_WITH([dri-driverdir],
  1193. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  1194. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  1195. [DRI_DRIVER_INSTALL_DIR="$withval"],
  1196. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  1197. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  1198. dnl Extra search path for DRI drivers
  1199. AC_ARG_WITH([dri-searchpath],
  1200. [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
  1201. [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
  1202. [DRI_DRIVER_SEARCH_DIR="$withval"],
  1203. [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
  1204. AC_SUBST([DRI_DRIVER_SEARCH_DIR])
  1205. dnl Which drivers to build - default is chosen by platform
  1206. AC_ARG_WITH([dri-drivers],
  1207. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  1208. [comma delimited classic DRI drivers list, e.g.
  1209. "swrast,i965,radeon" @<:@default=auto@:>@])],
  1210. [with_dri_drivers="$withval"],
  1211. [with_dri_drivers=auto])
  1212. if test "x$with_dri_drivers" = xauto; then
  1213. if test "x$enable_opengl" = xyes -a "x$enable_dri" = xyes; then
  1214. with_dri_drivers="yes"
  1215. else
  1216. with_dri_drivers="no"
  1217. fi
  1218. fi
  1219. if test "x$with_dri_drivers" = xno; then
  1220. with_dri_drivers=''
  1221. fi
  1222. dnl If $with_dri_drivers is yes, drivers will be added through
  1223. dnl platform checks. Set DEFINES and LIB_DEPS
  1224. if test "x$enable_dri" = xyes; then
  1225. # Platform specific settings and drivers to build
  1226. case "$host_os" in
  1227. linux*)
  1228. DEFINES="$DEFINES -DHAVE_ALIAS"
  1229. if test "x$enable_dri3" = xyes; then
  1230. DEFINES="$DEFINES -DHAVE_DRI3"
  1231. fi
  1232. if test "x$have_pci_id" != xyes; then
  1233. AC_MSG_ERROR([libudev-dev or sysfs required for building DRI])
  1234. fi
  1235. case "$host_cpu" in
  1236. powerpc* | sparc*)
  1237. # Build only the drivers for cards that exist on PowerPC/sparc
  1238. if test "x$with_dri_drivers" = "xyes"; then
  1239. with_dri_drivers="r200 radeon swrast"
  1240. fi
  1241. ;;
  1242. esac
  1243. ;;
  1244. *freebsd* | dragonfly* | *netbsd* | openbsd*)
  1245. DEFINES="$DEFINES -DHAVE_ALIAS"
  1246. ;;
  1247. gnu*)
  1248. DEFINES="$DEFINES -DHAVE_ALIAS"
  1249. ;;
  1250. cygwin*)
  1251. if test "x$with_dri_drivers" = "xyes"; then
  1252. with_dri_drivers="swrast"
  1253. fi
  1254. ;;
  1255. darwin*)
  1256. DEFINES="$DEFINES -DGLX_ALIAS_UNSUPPORTED -DBUILDING_MESA"
  1257. if test "x$with_dri_drivers" = "xyes"; then
  1258. with_dri_drivers="swrast"
  1259. fi
  1260. ;;
  1261. esac
  1262. # default drivers
  1263. if test "x$with_dri_drivers" = "xyes"; then
  1264. with_dri_drivers="i915 i965 nouveau r200 radeon swrast"
  1265. fi
  1266. # Check for expat
  1267. PKG_CHECK_MODULES([EXPAT], [expat], [],
  1268. # expat version 2.0 and earlier do not provide expat.pc
  1269. [AC_CHECK_HEADER([expat.h],[],
  1270. [AC_MSG_ERROR([Expat headers required for DRI not found])])
  1271. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  1272. [AC_MSG_ERROR([Expat library required for DRI not found])])
  1273. EXPAT_LIBS="-lexpat"])
  1274. # put all the necessary libs together
  1275. DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1276. fi
  1277. AC_SUBST([DRI_LIB_DEPS])
  1278. DRI_DIRS=''
  1279. dnl Duplicates in DRI_DIRS are removed by sorting it at the end of this block
  1280. if test -n "$with_dri_drivers"; then
  1281. if test "x$enable_opengl" != xyes; then
  1282. AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
  1283. fi
  1284. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  1285. for driver in $dri_drivers; do
  1286. DRI_DIRS="$DRI_DIRS $driver"
  1287. case "x$driver" in
  1288. xi915)
  1289. HAVE_I915_DRI=yes;
  1290. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1291. ;;
  1292. xi965)
  1293. HAVE_I965_DRI=yes;
  1294. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1295. ;;
  1296. xnouveau)
  1297. HAVE_NOUVEAU_DRI=yes;
  1298. PKG_CHECK_MODULES([NVVIEUX], [libdrm_nouveau >= $LIBDRM_NVVIEUX_REQUIRED])
  1299. ;;
  1300. xradeon)
  1301. HAVE_RADEON_DRI=yes;
  1302. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1303. ;;
  1304. xr200)
  1305. HAVE_R200_DRI=yes;
  1306. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1307. ;;
  1308. xswrast)
  1309. HAVE_SWRAST_DRI=yes;
  1310. ;;
  1311. *)
  1312. AC_MSG_ERROR([classic DRI driver '$driver' does not exist])
  1313. ;;
  1314. esac
  1315. done
  1316. DRI_DIRS=`echo $DRI_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
  1317. fi
  1318. AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")
  1319. AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
  1320. "x$enable_osmesa" = xyes -o \
  1321. -n "$DRI_DIRS")
  1322. dnl
  1323. dnl OSMesa configuration
  1324. dnl
  1325. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  1326. AC_ARG_WITH([osmesa-bits],
  1327. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  1328. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  1329. [osmesa_bits="$withval"],
  1330. [osmesa_bits=8])
  1331. if test "x$osmesa_bits" != x8; then
  1332. if test "x$enable_dri" = xyes -o "x$enable_glx" = xyes; then
  1333. AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa driver])
  1334. osmesa_bits=8
  1335. fi
  1336. fi
  1337. case "x$osmesa_bits" in
  1338. x8)
  1339. OSMESA_LIB="${OSMESA_LIB}"
  1340. ;;
  1341. x16|x32)
  1342. OSMESA_LIB="${OSMESA_LIB}$osmesa_bits"
  1343. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  1344. ;;
  1345. *)
  1346. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  1347. ;;
  1348. esac
  1349. if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then
  1350. # only link libraries with osmesa if shared
  1351. if test "$enable_static" = no; then
  1352. OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
  1353. else
  1354. OSMESA_LIB_DEPS=""
  1355. fi
  1356. OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
  1357. fi
  1358. AC_SUBST([OSMESA_LIB_DEPS])
  1359. AC_SUBST([OSMESA_PC_REQ])
  1360. AC_SUBST([OSMESA_PC_LIB_PRIV])
  1361. dnl
  1362. dnl gbm configuration
  1363. dnl
  1364. if test "x$enable_gbm" = xauto; then
  1365. case "$with_egl_platforms" in
  1366. *drm*)
  1367. enable_gbm=yes ;;
  1368. *)
  1369. enable_gbm=no ;;
  1370. esac
  1371. fi
  1372. if test "x$enable_gbm" = xyes; then
  1373. if test "x$need_pci_id$have_pci_id" = xyesno; then
  1374. AC_MSG_ERROR([gbm requires udev >= $LIBUDEV_REQUIRED or sysfs])
  1375. fi
  1376. if test "x$enable_dri" = xyes; then
  1377. if test "x$enable_shared_glapi" = xno; then
  1378. AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
  1379. fi
  1380. else
  1381. # Strictly speaking libgbm does not require --enable-dri, although
  1382. # both of its backends do. Thus one can build libgbm without any
  1383. # backends if --disable-dri is set.
  1384. # To avoid unnecessary complexity of checking if at least one backend
  1385. # is available when building, just mandate --enable-dri.
  1386. AC_MSG_ERROR([gbm requires --enable-dri])
  1387. fi
  1388. fi
  1389. AM_CONDITIONAL(HAVE_GBM, test "x$enable_gbm" = xyes)
  1390. if test "x$need_pci_id$have_libudev" = xyesyes; then
  1391. GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED"
  1392. else
  1393. GBM_PC_REQ_PRIV=""
  1394. fi
  1395. GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
  1396. AC_SUBST([GBM_PC_REQ_PRIV])
  1397. AC_SUBST([GBM_PC_LIB_PRIV])
  1398. dnl
  1399. dnl EGL configuration
  1400. dnl
  1401. EGL_CLIENT_APIS=""
  1402. if test "x$enable_egl" = xyes; then
  1403. EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS $PTHREAD_LIBS"
  1404. AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
  1405. if test "$enable_static" != yes; then
  1406. if test "x$enable_dri" = xyes; then
  1407. HAVE_EGL_DRIVER_DRI2=1
  1408. if test "x$enable_shared_glapi" = xno; then
  1409. AC_MSG_ERROR([egl_dri2 requires --enable-shared-glapi])
  1410. fi
  1411. if test "x$enable_dri3" = xyes; then
  1412. HAVE_EGL_DRIVER_DRI3=1
  1413. if test "x$enable_shared_glapi" = xno; then
  1414. AC_MSG_ERROR([egl_dri3 requires --enable-shared-glapi])
  1415. fi
  1416. fi
  1417. else
  1418. # Avoid building an "empty" libEGL. Drop/update this
  1419. # when other backends (haiku?) come along.
  1420. AC_MSG_ERROR([egl requires --enable-dri])
  1421. fi
  1422. fi
  1423. fi
  1424. AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes)
  1425. AC_SUBST([EGL_LIB_DEPS])
  1426. gallium_st="mesa"
  1427. dnl
  1428. dnl XA configuration
  1429. dnl
  1430. if test "x$enable_xa" = xyes; then
  1431. if test "x$with_gallium_drivers" = xswrast; then
  1432. AC_MSG_ERROR([
  1433. Building xa requires at least one non swrast gallium driver.
  1434. If you are looking to use libxatracker.so with the VMware driver,
  1435. make sure to include svga in the gallium drivers list, apart from
  1436. enabling XA.
  1437. Example: ./configure --enable-xa --with-gallium-drivers=svga...])
  1438. fi
  1439. gallium_st="$gallium_st xa"
  1440. fi
  1441. AM_CONDITIONAL(HAVE_ST_XA, test "x$enable_xa" = xyes)
  1442. dnl
  1443. dnl Gallium G3DVL configuration
  1444. dnl
  1445. if test -n "$with_gallium_drivers" -a "x$with_gallium_drivers" != xswrast; then
  1446. if test "x$enable_xvmc" = xauto; then
  1447. PKG_CHECK_EXISTS([xvmc >= $XVMC_REQUIRED], [enable_xvmc=yes], [enable_xvmc=no])
  1448. fi
  1449. if test "x$enable_vdpau" = xauto; then
  1450. PKG_CHECK_EXISTS([vdpau >= $VDPAU_REQUIRED], [enable_vdpau=yes], [enable_vdpau=no])
  1451. fi
  1452. if test "x$enable_omx" = xauto; then
  1453. PKG_CHECK_EXISTS([libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED], [enable_omx=yes], [enable_omx=no])
  1454. fi
  1455. if test "x$enable_va" = xauto; then
  1456. PKG_CHECK_EXISTS([libva >= $LIBVA_REQUIRED], [enable_va=yes], [enable_va=no])
  1457. fi
  1458. fi
  1459. if test "x$enable_dri" = xyes -o \
  1460. "x$enable_xvmc" = xyes -o \
  1461. "x$enable_vdpau" = xyes -o \
  1462. "x$enable_omx" = xyes -o \
  1463. "x$enable_va" = xyes; then
  1464. need_gallium_vl=yes
  1465. fi
  1466. AM_CONDITIONAL(NEED_GALLIUM_VL, test "x$need_gallium_vl" = xyes)
  1467. if test "x$enable_xvmc" = xyes -o \
  1468. "x$enable_vdpau" = xyes -o \
  1469. "x$enable_omx" = xyes -o \
  1470. "x$enable_va" = xyes; then
  1471. PKG_CHECK_MODULES([VL], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED])
  1472. need_gallium_vl_winsys=yes
  1473. fi
  1474. AM_CONDITIONAL(NEED_GALLIUM_VL_WINSYS, test "x$need_gallium_vl_winsys" = xyes)
  1475. if test "x$enable_xvmc" = xyes; then
  1476. PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED])
  1477. gallium_st="$gallium_st xvmc"
  1478. fi
  1479. AM_CONDITIONAL(HAVE_ST_XVMC, test "x$enable_xvmc" = xyes)
  1480. if test "x$enable_vdpau" = xyes; then
  1481. PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED])
  1482. gallium_st="$gallium_st vdpau"
  1483. fi
  1484. AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes)
  1485. if test "x$enable_omx" = xyes; then
  1486. PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED])
  1487. gallium_st="$gallium_st omx"
  1488. fi
  1489. AM_CONDITIONAL(HAVE_ST_OMX, test "x$enable_omx" = xyes)
  1490. if test "x$enable_va" = xyes; then
  1491. PKG_CHECK_MODULES([VA], [libva >= $LIBVA_REQUIRED])
  1492. gallium_st="$gallium_st va"
  1493. fi
  1494. AM_CONDITIONAL(HAVE_ST_VA, test "x$enable_va" = xyes)
  1495. dnl
  1496. dnl Nine Direct3D9 configuration
  1497. dnl
  1498. if test "x$enable_nine" = xyes; then
  1499. if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
  1500. AC_MSG_ERROR([nine requires the gallium swrast driver])
  1501. fi
  1502. if test "x$with_gallium_drivers" = xswrast; then
  1503. AC_MSG_ERROR([nine requires at least one non-swrast gallium driver])
  1504. fi
  1505. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 6; then
  1506. AC_MSG_ERROR([gcc >= 4.6 is required to build nine])
  1507. fi
  1508. if test "x$enable_dri3" = xno; then
  1509. AC_MSG_WARN([using nine together with wine requires DRI3 enabled system])
  1510. fi
  1511. gallium_st="$gallium_st nine"
  1512. fi
  1513. AM_CONDITIONAL(HAVE_ST_NINE, test "x$enable_nine" = xyes)
  1514. dnl
  1515. dnl OpenCL configuration
  1516. dnl
  1517. AC_ARG_WITH([clang-libdir],
  1518. [AS_HELP_STRING([--with-clang-libdir],
  1519. [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
  1520. [CLANG_LIBDIR="$withval"],
  1521. [CLANG_LIBDIR=''])
  1522. PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
  1523. AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;ELF_LIB=-lelf])
  1524. if test "x$enable_opencl" = xyes; then
  1525. if test -z "$with_gallium_drivers"; then
  1526. AC_MSG_ERROR([cannot enable OpenCL without Gallium])
  1527. fi
  1528. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 7; then
  1529. AC_MSG_ERROR([gcc >= 4.7 is required to build clover])
  1530. fi
  1531. if test "x$have_libclc" = xno; then
  1532. AC_MSG_ERROR([pkg-config cannot find libclc.pc which is required to build clover.
  1533. Make sure the directory containing libclc.pc is specified in your
  1534. PKG_CONFIG_PATH environment variable.
  1535. By default libclc.pc is installed to /usr/local/share/pkgconfig/])
  1536. else
  1537. LIBCLC_INCLUDEDIR=`$PKG_CONFIG --variable=includedir libclc`
  1538. LIBCLC_LIBEXECDIR=`$PKG_CONFIG --variable=libexecdir libclc`
  1539. AC_SUBST([LIBCLC_INCLUDEDIR])
  1540. AC_SUBST([LIBCLC_LIBEXECDIR])
  1541. fi
  1542. gallium_st="$gallium_st clover"
  1543. if test "x$enable_opencl_icd" = xyes; then
  1544. OPENCL_LIBNAME="MesaOpenCL"
  1545. else
  1546. OPENCL_LIBNAME="OpenCL"
  1547. fi
  1548. if test "x$have_libelf" != xyes; then
  1549. AC_MSG_ERROR([Clover requires libelf])
  1550. fi
  1551. fi
  1552. AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
  1553. AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
  1554. AC_SUBST([OPENCL_LIBNAME])
  1555. dnl
  1556. dnl Gallium configuration
  1557. dnl
  1558. AM_CONDITIONAL(HAVE_GALLIUM, test -n "$with_gallium_drivers")
  1559. AC_SUBST([LLVM_BINDIR])
  1560. AC_SUBST([LLVM_CFLAGS])
  1561. AC_SUBST([LLVM_CPPFLAGS])
  1562. AC_SUBST([LLVM_CXXFLAGS])
  1563. AC_SUBST([LLVM_LIBDIR])
  1564. AC_SUBST([LLVM_LIBS])
  1565. AC_SUBST([LLVM_LDFLAGS])
  1566. AC_SUBST([LLVM_INCLUDEDIR])
  1567. AC_SUBST([LLVM_VERSION])
  1568. AC_SUBST([CLANG_RESOURCE_DIR])
  1569. case "x$enable_opengl$enable_gles1$enable_gles2" in
  1570. x*yes*)
  1571. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
  1572. ;;
  1573. esac
  1574. AC_SUBST([VG_LIB_DEPS])
  1575. AC_SUBST([EGL_CLIENT_APIS])
  1576. dnl
  1577. dnl EGL Platforms configuration
  1578. dnl
  1579. AC_ARG_WITH([egl-platforms],
  1580. [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
  1581. [comma delimited native platforms libEGL supports, e.g.
  1582. "x11,drm" @<:@default=auto@:>@])],
  1583. [with_egl_platforms="$withval"],
  1584. [if test "x$enable_egl" = xyes; then
  1585. with_egl_platforms="x11"
  1586. else
  1587. with_egl_platforms=""
  1588. fi])
  1589. if test "x$with_egl_platforms" != "x" -a "x$enable_egl" != xyes; then
  1590. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1591. fi
  1592. PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland_scanner],
  1593. WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland_scanner`,
  1594. WAYLAND_SCANNER='')
  1595. if test "x$WAYLAND_SCANNER" = x; then
  1596. AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner])
  1597. fi
  1598. # Do per-EGL platform setups and checks
  1599. egl_platforms=`IFS=', '; echo $with_egl_platforms`
  1600. for plat in $egl_platforms; do
  1601. case "$plat" in
  1602. wayland)
  1603. test "x$have_libdrm" != xyes &&
  1604. AC_MSG_ERROR([EGL platform wayland requires libdrm >= $LIBDRM_REQUIRED])
  1605. PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED wayland-server >= $WAYLAND_REQUIRED])
  1606. if test "x$WAYLAND_SCANNER" = x; then
  1607. AC_MSG_ERROR([wayland-scanner is needed to compile the wayland egl platform])
  1608. fi
  1609. ;;
  1610. x11)
  1611. PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED xcb-xfixes])
  1612. ;;
  1613. drm)
  1614. test "x$enable_gbm" = "xno" &&
  1615. AC_MSG_ERROR([EGL platform drm needs gbm])
  1616. test "x$have_libdrm" != xyes &&
  1617. AC_MSG_ERROR([EGL platform drm requires libdrm >= $LIBDRM_REQUIRED])
  1618. ;;
  1619. surfaceless)
  1620. test "x$have_libdrm" != xyes &&
  1621. AC_MSG_ERROR([EGL platform surfaceless requires libdrm >= $LIBDRM_REQUIRED])
  1622. ;;
  1623. *)
  1624. AC_MSG_ERROR([EGL platform '$plat' does not exist])
  1625. ;;
  1626. esac
  1627. case "$plat$need_pci_id$have_pci_id" in
  1628. waylandyesno|drmyesno)
  1629. AC_MSG_ERROR([cannot build $plat platform without udev >= $LIBUDEV_REQUIRED or sysfs]) ;;
  1630. esac
  1631. done
  1632. # libEGL wants to default to the first platform specified in
  1633. # ./configure. parse that here.
  1634. if test "x$egl_platforms" != "x"; then
  1635. FIRST_PLATFORM_CAPS=`echo $egl_platforms | sed 's| .*||' | tr '[[a-z]]' '[[A-Z]]'`
  1636. EGL_NATIVE_PLATFORM="_EGL_PLATFORM_$FIRST_PLATFORM_CAPS"
  1637. else
  1638. EGL_NATIVE_PLATFORM="_EGL_INVALID_PLATFORM"
  1639. fi
  1640. AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep -q 'x11')
  1641. AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 'wayland')
  1642. AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm')
  1643. AM_CONDITIONAL(HAVE_EGL_PLATFORM_SURFACELESS, echo "$egl_platforms" | grep -q 'surfaceless')
  1644. AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep -q 'null')
  1645. AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
  1646. AC_SUBST([EGL_NATIVE_PLATFORM])
  1647. AC_SUBST([EGL_CFLAGS])
  1648. # If we don't have the X11 platform, set this define so we don't try to include
  1649. # the X11 headers.
  1650. if ! echo "$egl_platforms" | grep -q 'x11'; then
  1651. DEFINES="$DEFINES -DMESA_EGL_NO_X11_HEADERS"
  1652. GL_PC_CFLAGS="$GL_PC_CFLAGS -DMESA_EGL_NO_X11_HEADERS"
  1653. fi
  1654. dnl
  1655. dnl Gallium LLVM
  1656. dnl
  1657. AC_ARG_ENABLE([gallium-llvm],
  1658. [AS_HELP_STRING([--enable-gallium-llvm],
  1659. [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
  1660. [enable_gallium_llvm="$enableval"],
  1661. [enable_gallium_llvm=auto])
  1662. AC_ARG_ENABLE([llvm-shared-libs],
  1663. [AS_HELP_STRING([--enable-llvm-shared-libs],
  1664. [link with LLVM shared libraries @<:@default=enabled@:>@])],
  1665. [enable_llvm_shared_libs="$enableval"],
  1666. [enable_llvm_shared_libs=yes])
  1667. AC_ARG_WITH([llvm-prefix],
  1668. [AS_HELP_STRING([--with-llvm-prefix],
  1669. [Prefix for LLVM installations in non-standard locations])],
  1670. [llvm_prefix="$withval"],
  1671. [llvm_prefix=''])
  1672. # Call this inside ` ` to get the return value.
  1673. # $1 is the llvm-config command with arguments.
  1674. strip_unwanted_llvm_flags() {
  1675. # Use \> (marks the end of the word)
  1676. echo `$1` | sed \
  1677. -e 's/-DNDEBUG\>//g' \
  1678. -e 's/-D_GNU_SOURCE\>//g' \
  1679. -e 's/-pedantic\>//g' \
  1680. -e 's/-Wcovered-switch-default\>//g' \
  1681. -e 's/-O.\>//g' \
  1682. -e 's/-g\>//g' \
  1683. -e 's/-Wall\>//g' \
  1684. -e 's/-Wcast-qual\>//g' \
  1685. -e 's/-Woverloaded-virtual\>//g' \
  1686. -e 's/-fcolor-diagnostics\>//g' \
  1687. -e 's/-fdata-sections\>//g' \
  1688. -e 's/-ffunction-sections\>//g' \
  1689. -e 's/-fno-exceptions\>//g' \
  1690. -e 's/-fomit-frame-pointer\>//g' \
  1691. -e 's/-fvisibility-inlines-hidden\>//g' \
  1692. -e 's/-fPIC\>//g' \
  1693. -e 's/-fstack-protector-strong\>//g'
  1694. }
  1695. llvm_check_version_for() {
  1696. if test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${1}0${2}${3}"; then
  1697. AC_MSG_ERROR([LLVM $1.$2.$3 or newer is required for $4])
  1698. fi
  1699. }
  1700. if test -z "$with_gallium_drivers"; then
  1701. enable_gallium_llvm=no
  1702. fi
  1703. if test "x$enable_gallium_llvm" = xauto; then
  1704. case "$host_cpu" in
  1705. i*86|x86_64|amd64) enable_gallium_llvm=yes;;
  1706. esac
  1707. fi
  1708. if test "x$enable_gallium_llvm" = xyes; then
  1709. if test -n "$llvm_prefix"; then
  1710. AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
  1711. else
  1712. AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
  1713. fi
  1714. if test "x$LLVM_CONFIG" != xno; then
  1715. LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
  1716. LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
  1717. LLVM_BINDIR=`$LLVM_CONFIG --bindir`
  1718. LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
  1719. LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
  1720. LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
  1721. LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
  1722. LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
  1723. AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
  1724. [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
  1725. AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
  1726. [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
  1727. LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o '^[[0-9]]+'`
  1728. if test -z "$LLVM_VERSION_PATCH"; then
  1729. LLVM_VERSION_PATCH=0
  1730. fi
  1731. if test -n "${LLVM_VERSION_MAJOR}"; then
  1732. LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
  1733. else
  1734. LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
  1735. fi
  1736. LLVM_REQUIRED_VERSION_MAJOR="3"
  1737. LLVM_REQUIRED_VERSION_MINOR="3"
  1738. if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
  1739. AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
  1740. fi
  1741. LLVM_COMPONENTS="engine bitwriter mcjit mcdisassembler"
  1742. if test "x$enable_opencl" = xyes; then
  1743. llvm_check_version_for "3" "5" "0" "opencl"
  1744. LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker instrumentation"
  1745. LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader option objcarcopts profiledata"
  1746. fi
  1747. DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
  1748. MESA_LLVM=1
  1749. dnl Check for Clang internal headers
  1750. if test "x$enable_opencl" = xyes; then
  1751. if test -z "$CLANG_LIBDIR"; then
  1752. CLANG_LIBDIR=${LLVM_LIBDIR}
  1753. fi
  1754. CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
  1755. AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
  1756. [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.])])
  1757. fi
  1758. else
  1759. MESA_LLVM=0
  1760. LLVM_VERSION_INT=0
  1761. fi
  1762. else
  1763. MESA_LLVM=0
  1764. LLVM_VERSION_INT=0
  1765. if test "x$enable_opencl" = xyes; then
  1766. AC_MSG_ERROR([cannot enable OpenCL without LLVM])
  1767. fi
  1768. fi
  1769. dnl Directory for XVMC libs
  1770. AC_ARG_WITH([xvmc-libdir],
  1771. [AS_HELP_STRING([--with-xvmc-libdir=DIR],
  1772. [directory for the XVMC libraries @<:@default=${libdir}@:>@])],
  1773. [XVMC_LIB_INSTALL_DIR="$withval"],
  1774. [XVMC_LIB_INSTALL_DIR='${libdir}'])
  1775. AC_SUBST([XVMC_LIB_INSTALL_DIR])
  1776. dnl
  1777. dnl Gallium Tests
  1778. dnl
  1779. AM_CONDITIONAL(HAVE_GALLIUM_TESTS, test "x$enable_gallium_tests" = xyes)
  1780. dnl Directory for VDPAU libs
  1781. AC_ARG_WITH([vdpau-libdir],
  1782. [AS_HELP_STRING([--with-vdpau-libdir=DIR],
  1783. [directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
  1784. [VDPAU_LIB_INSTALL_DIR="$withval"],
  1785. [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
  1786. AC_SUBST([VDPAU_LIB_INSTALL_DIR])
  1787. dnl Directory for OMX libs
  1788. AC_ARG_WITH([omx-libdir],
  1789. [AS_HELP_STRING([--with-omx-libdir=DIR],
  1790. [directory for the OMX libraries])],
  1791. [OMX_LIB_INSTALL_DIR="$withval"],
  1792. [OMX_LIB_INSTALL_DIR=`$PKG_CONFIG --define-variable=libdir=\$libdir --variable=pluginsdir libomxil-bellagio`])
  1793. AC_SUBST([OMX_LIB_INSTALL_DIR])
  1794. dnl Directory for VA libs
  1795. AC_ARG_WITH([va-libdir],
  1796. [AS_HELP_STRING([--with-va-libdir=DIR],
  1797. [directory for the VA libraries @<:@${libdir}/dri@:>@])],
  1798. [VA_LIB_INSTALL_DIR="$withval"],
  1799. [VA_LIB_INSTALL_DIR="${libdir}/dri"])
  1800. AC_SUBST([VA_LIB_INSTALL_DIR])
  1801. AC_ARG_WITH([d3d-libdir],
  1802. [AS_HELP_STRING([--with-d3d-libdir=DIR],
  1803. [directory for the D3D modules @<:@${libdir}/d3d@:>@])],
  1804. [D3D_DRIVER_INSTALL_DIR="$withval"],
  1805. [D3D_DRIVER_INSTALL_DIR="${libdir}/d3d"])
  1806. AC_SUBST([D3D_DRIVER_INSTALL_DIR])
  1807. dnl
  1808. dnl Gallium helper functions
  1809. dnl
  1810. gallium_require_drm() {
  1811. if test "x$have_libdrm" != xyes; then
  1812. AC_MSG_ERROR([$1 requires libdrm >= $LIBDRM_REQUIRED])
  1813. fi
  1814. }
  1815. gallium_require_llvm() {
  1816. if test "x$MESA_LLVM" = x0; then
  1817. case "$host" in *gnux32) return;; esac
  1818. case "$host_cpu" in
  1819. i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on x86 and x86_64]);;
  1820. esac
  1821. fi
  1822. }
  1823. gallium_require_drm_loader() {
  1824. if test "x$need_pci_id$have_pci_id" = xyesno; then
  1825. AC_MSG_ERROR([Gallium drm loader requires libudev >= $LIBUDEV_REQUIRED or sysfs])
  1826. fi
  1827. }
  1828. require_egl_drm() {
  1829. case "$with_egl_platforms" in
  1830. *drm*)
  1831. ;;
  1832. *)
  1833. AC_MSG_ERROR([--with-egl-platforms=drm is required to build the $1 driver.])
  1834. ;;
  1835. esac
  1836. if test "x$enable_gbm" != xyes; then
  1837. AC_MSG_ERROR([--enable-gbm is required to build the $1 driver.])
  1838. fi
  1839. }
  1840. radeon_llvm_check() {
  1841. if test ${LLVM_VERSION_INT} -lt 307; then
  1842. amdgpu_llvm_target_name='r600'
  1843. else
  1844. amdgpu_llvm_target_name='amdgpu'
  1845. fi
  1846. if test "x$enable_gallium_llvm" != "xyes"; then
  1847. AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
  1848. fi
  1849. llvm_check_version_for "3" "5" "0" $1
  1850. if test true && $LLVM_CONFIG --targets-built | grep -iqvw $amdgpu_llvm_target_name ; then
  1851. AC_MSG_ERROR([LLVM $amdgpu_llvm_target_name not enabled in your LLVM build.])
  1852. fi
  1853. LLVM_COMPONENTS="${LLVM_COMPONENTS} $amdgpu_llvm_target_name bitreader ipo"
  1854. NEED_RADEON_LLVM=yes
  1855. if test "x$have_libelf" != xyes; then
  1856. AC_MSG_ERROR([$1 requires libelf when using llvm])
  1857. fi
  1858. }
  1859. dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
  1860. if test -n "$with_gallium_drivers"; then
  1861. gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
  1862. for driver in $gallium_drivers; do
  1863. case "x$driver" in
  1864. xsvga)
  1865. HAVE_GALLIUM_SVGA=yes
  1866. gallium_require_drm "svga"
  1867. gallium_require_drm_loader
  1868. ;;
  1869. xi915)
  1870. HAVE_GALLIUM_I915=yes
  1871. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1872. gallium_require_drm "Gallium i915"
  1873. gallium_require_drm_loader
  1874. ;;
  1875. xilo)
  1876. HAVE_GALLIUM_ILO=yes
  1877. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1878. gallium_require_drm "Gallium i965/ilo"
  1879. gallium_require_drm_loader
  1880. ;;
  1881. xr300)
  1882. HAVE_GALLIUM_R300=yes
  1883. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1884. gallium_require_drm "Gallium R300"
  1885. gallium_require_drm_loader
  1886. gallium_require_llvm "Gallium R300"
  1887. ;;
  1888. xr600)
  1889. HAVE_GALLIUM_R600=yes
  1890. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1891. gallium_require_drm "Gallium R600"
  1892. gallium_require_drm_loader
  1893. if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes; then
  1894. radeon_llvm_check "r600g"
  1895. LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
  1896. fi
  1897. if test "x$enable_r600_llvm" = xyes; then
  1898. USE_R600_LLVM_COMPILER=yes;
  1899. fi
  1900. if test "x$enable_opencl" = xyes; then
  1901. LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
  1902. fi
  1903. ;;
  1904. xradeonsi)
  1905. HAVE_GALLIUM_RADEONSI=yes
  1906. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1907. PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
  1908. gallium_require_drm "radeonsi"
  1909. gallium_require_drm_loader
  1910. radeon_llvm_check "radeonsi"
  1911. require_egl_drm "radeonsi"
  1912. ;;
  1913. xnouveau)
  1914. HAVE_GALLIUM_NOUVEAU=yes
  1915. PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
  1916. gallium_require_drm "nouveau"
  1917. gallium_require_drm_loader
  1918. ;;
  1919. xfreedreno)
  1920. HAVE_GALLIUM_FREEDRENO=yes
  1921. PKG_CHECK_MODULES([FREEDRENO], [libdrm_freedreno >= $LIBDRM_FREEDRENO_REQUIRED])
  1922. gallium_require_drm "freedreno"
  1923. gallium_require_drm_loader
  1924. ;;
  1925. xswrast)
  1926. HAVE_GALLIUM_SOFTPIPE=yes
  1927. if test "x$MESA_LLVM" = x1; then
  1928. HAVE_GALLIUM_LLVMPIPE=yes
  1929. fi
  1930. ;;
  1931. xvc4)
  1932. HAVE_GALLIUM_VC4=yes
  1933. gallium_require_drm "vc4"
  1934. gallium_require_drm_loader
  1935. PKG_CHECK_MODULES([SIMPENROSE], [simpenrose],
  1936. [USE_VC4_SIMULATOR=yes;
  1937. DEFINES="$DEFINES -DUSE_VC4_SIMULATOR"],
  1938. [USE_VC4_SIMULATOR=no])
  1939. ;;
  1940. xvirgl)
  1941. HAVE_GALLIUM_VIRGL=yes
  1942. gallium_require_drm "virgl"
  1943. gallium_require_drm_loader
  1944. require_egl_drm "virgl"
  1945. ;;
  1946. *)
  1947. AC_MSG_ERROR([Unknown Gallium driver: $driver])
  1948. ;;
  1949. esac
  1950. done
  1951. fi
  1952. dnl Set LLVM_LIBS - This is done after the driver configuration so
  1953. dnl that drivers can add additional components to LLVM_COMPONENTS.
  1954. dnl Previously, gallium drivers were updating LLVM_LIBS directly
  1955. dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
  1956. dnl this was causing the same libraries to be appear multiple times
  1957. dnl in LLVM_LIBS.
  1958. if test "x$MESA_LLVM" != x0; then
  1959. LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
  1960. dnl llvm-config may not give the right answer when llvm is a built as a
  1961. dnl single shared library, so we must work the library name out for
  1962. dnl ourselves.
  1963. dnl (See https://llvm.org/bugs/show_bug.cgi?id=6823)
  1964. if test "x$enable_llvm_shared_libs" = xyes; then
  1965. dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
  1966. LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
  1967. AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.$IMP_LIB_EXT"], [llvm_have_one_so=yes])
  1968. if test "x$llvm_have_one_so" = xyes; then
  1969. dnl LLVM was built using auto*, so there is only one shared object.
  1970. LLVM_LIBS="-l$LLVM_SO_NAME"
  1971. else
  1972. dnl If LLVM was built with CMake, there will be one shared object per
  1973. dnl component.
  1974. AS_IF([test ! -f "$LLVM_LIBDIR/libLLVMTarget.$IMP_LIB_EXT"],
  1975. [AC_MSG_ERROR([Could not find llvm shared libraries:
  1976. Please make sure you have built llvm with the --enable-shared option
  1977. and that your llvm libraries are installed in $LLVM_LIBDIR
  1978. If you have installed your llvm libraries to a different directory you
  1979. can use the --with-llvm-prefix= configure flag to specify this directory.
  1980. NOTE: Mesa is attempting to use llvm shared libraries by default.
  1981. If you do not want to build with llvm shared libraries and instead want to
  1982. use llvm static libraries then add --disable-llvm-shared-libs to your configure
  1983. invocation and rebuild.])])
  1984. dnl We don't need to update LLVM_LIBS in this case because the LLVM
  1985. dnl install uses a shared object for each component and we have
  1986. dnl already added all of these objects to LLVM_LIBS.
  1987. fi
  1988. else
  1989. AC_MSG_WARN([Building mesa with statically linked LLVM may cause compilation issues])
  1990. dnl We need to link to llvm system libs when using static libs
  1991. dnl However, only llvm 3.5+ provides --system-libs
  1992. if test $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5; then
  1993. LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --system-libs`"
  1994. fi
  1995. fi
  1996. fi
  1997. AM_CONDITIONAL(HAVE_GALLIUM_SVGA, test "x$HAVE_GALLIUM_SVGA" = xyes)
  1998. AM_CONDITIONAL(HAVE_GALLIUM_I915, test "x$HAVE_GALLIUM_I915" = xyes)
  1999. AM_CONDITIONAL(HAVE_GALLIUM_ILO, test "x$HAVE_GALLIUM_ILO" = xyes)
  2000. AM_CONDITIONAL(HAVE_GALLIUM_R300, test "x$HAVE_GALLIUM_R300" = xyes)
  2001. AM_CONDITIONAL(HAVE_GALLIUM_R600, test "x$HAVE_GALLIUM_R600" = xyes)
  2002. AM_CONDITIONAL(HAVE_GALLIUM_RADEONSI, test "x$HAVE_GALLIUM_RADEONSI" = xyes)
  2003. AM_CONDITIONAL(HAVE_GALLIUM_RADEON_COMMON, test "x$HAVE_GALLIUM_R600" = xyes -o \
  2004. "x$HAVE_GALLIUM_RADEONSI" = xyes)
  2005. AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
  2006. AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes)
  2007. AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
  2008. AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes)
  2009. AM_CONDITIONAL(HAVE_GALLIUM_VC4, test "x$HAVE_GALLIUM_VC4" = xyes)
  2010. AM_CONDITIONAL(HAVE_GALLIUM_VIRGL, test "x$HAVE_GALLIUM_VIRGL" = xyes)
  2011. AM_CONDITIONAL(HAVE_GALLIUM_STATIC_TARGETS, test "x$enable_shared_pipe_drivers" = xno)
  2012. if test "x$enable_dri" = xyes; then
  2013. GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRI"
  2014. fi
  2015. if test "x$have_drisw_kms" = xyes; then
  2016. GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_KMS"
  2017. fi
  2018. AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
  2019. AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
  2020. AM_CONDITIONAL(HAVE_I965_DRI, test x$HAVE_I965_DRI = xyes)
  2021. AM_CONDITIONAL(HAVE_NOUVEAU_DRI, test x$HAVE_NOUVEAU_DRI = xyes)
  2022. AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
  2023. AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
  2024. AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
  2025. AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test "x$HAVE_GALLIUM_R300" = xyes -o \
  2026. "x$HAVE_GALLIUM_R600" = xyes -o \
  2027. "x$HAVE_GALLIUM_RADEONSI" = xyes)
  2028. AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes)
  2029. AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
  2030. AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
  2031. AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
  2032. AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
  2033. AM_CONDITIONAL(USE_VC4_SIMULATOR, test x$USE_VC4_SIMULATOR = xyes)
  2034. if test "x$USE_VC4_SIMULATOR" = xyes -a "x$HAVE_GALLIUM_ILO" = xyes; then
  2035. AC_MSG_ERROR([VC4 simulator on x86 replaces i965 driver build, so ilo must be disabled.])
  2036. fi
  2037. AC_SUBST([ELF_LIB])
  2038. AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)
  2039. AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" = xyes)
  2040. AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
  2041. AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)
  2042. AM_CONDITIONAL(HAVE_X86_ASM, test "x$asm_arch" = xx86 -o "x$asm_arch" = xx86_64)
  2043. AM_CONDITIONAL(HAVE_X86_64_ASM, test "x$asm_arch" = xx86_64)
  2044. AM_CONDITIONAL(HAVE_SPARC_ASM, test "x$asm_arch" = xsparc)
  2045. AC_SUBST([NINE_MAJOR], 1)
  2046. AC_SUBST([NINE_MINOR], 0)
  2047. AC_SUBST([NINE_TINY], 0)
  2048. AC_SUBST([NINE_VERSION], "$NINE_MAJOR.$NINE_MINOR.$NINE_TINY")
  2049. AC_SUBST([VDPAU_MAJOR], 1)
  2050. AC_SUBST([VDPAU_MINOR], 0)
  2051. VA_MAJOR=`$PKG_CONFIG --modversion libva | $SED -n 's/\([[^\.]]*\)\..*$/\1/p'`
  2052. VA_MINOR=`$PKG_CONFIG --modversion libva | $SED -n 's/.*\.\(.*\)\..*$/\1/p'`
  2053. AC_SUBST([VA_MAJOR], $VA_MAJOR)
  2054. AC_SUBST([VA_MINOR], $VA_MINOR)
  2055. AC_SUBST([XVMC_MAJOR], 1)
  2056. AC_SUBST([XVMC_MINOR], 0)
  2057. XA_HEADER="$srcdir/src/gallium/state_trackers/xa/xa_tracker.h"
  2058. XA_MAJOR=`grep "#define XA_TRACKER_VERSION_MAJOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MAJOR //'`
  2059. XA_MINOR=`grep "#define XA_TRACKER_VERSION_MINOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MINOR //'`
  2060. XA_TINY=`grep "#define XA_TRACKER_VERSION_PATCH" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_PATCH //'`
  2061. AC_SUBST([XA_MAJOR], $XA_MAJOR)
  2062. AC_SUBST([XA_MINOR], $XA_MINOR)
  2063. AC_SUBST([XA_TINY], $XA_TINY)
  2064. AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
  2065. dnl Restore LDFLAGS and CPPFLAGS
  2066. LDFLAGS="$_SAVE_LDFLAGS"
  2067. CPPFLAGS="$_SAVE_CPPFLAGS"
  2068. dnl Suppress clang's warnings about unused CFLAGS and CXXFLAGS
  2069. if test "x$acv_mesa_CLANG" = xyes; then
  2070. CFLAGS="$CFLAGS -Qunused-arguments"
  2071. CXXFLAGS="$CXXFLAGS -Qunused-arguments"
  2072. fi
  2073. dnl Add user CFLAGS and CXXFLAGS
  2074. CFLAGS="$CFLAGS $USER_CFLAGS"
  2075. CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
  2076. dnl Substitute the config
  2077. AC_CONFIG_FILES([Makefile
  2078. src/Makefile
  2079. src/egl/Makefile
  2080. src/egl/main/egl.pc
  2081. src/egl/wayland/wayland-drm/Makefile
  2082. src/egl/wayland/wayland-egl/Makefile
  2083. src/egl/wayland/wayland-egl/wayland-egl.pc
  2084. src/gallium/Makefile
  2085. src/gallium/auxiliary/Makefile
  2086. src/gallium/auxiliary/pipe-loader/Makefile
  2087. src/gallium/drivers/freedreno/Makefile
  2088. src/gallium/drivers/ddebug/Makefile
  2089. src/gallium/drivers/i915/Makefile
  2090. src/gallium/drivers/ilo/Makefile
  2091. src/gallium/drivers/llvmpipe/Makefile
  2092. src/gallium/drivers/noop/Makefile
  2093. src/gallium/drivers/nouveau/Makefile
  2094. src/gallium/drivers/r300/Makefile
  2095. src/gallium/drivers/r600/Makefile
  2096. src/gallium/drivers/radeon/Makefile
  2097. src/gallium/drivers/radeonsi/Makefile
  2098. src/gallium/drivers/rbug/Makefile
  2099. src/gallium/drivers/softpipe/Makefile
  2100. src/gallium/drivers/svga/Makefile
  2101. src/gallium/drivers/trace/Makefile
  2102. src/gallium/drivers/vc4/Makefile
  2103. src/gallium/drivers/virgl/Makefile
  2104. src/gallium/state_trackers/clover/Makefile
  2105. src/gallium/state_trackers/dri/Makefile
  2106. src/gallium/state_trackers/glx/xlib/Makefile
  2107. src/gallium/state_trackers/nine/Makefile
  2108. src/gallium/state_trackers/omx/Makefile
  2109. src/gallium/state_trackers/osmesa/Makefile
  2110. src/gallium/state_trackers/va/Makefile
  2111. src/gallium/state_trackers/vdpau/Makefile
  2112. src/gallium/state_trackers/xa/Makefile
  2113. src/gallium/state_trackers/xvmc/Makefile
  2114. src/gallium/targets/d3dadapter9/Makefile
  2115. src/gallium/targets/d3dadapter9/d3d.pc
  2116. src/gallium/targets/dri/Makefile
  2117. src/gallium/targets/libgl-xlib/Makefile
  2118. src/gallium/targets/omx/Makefile
  2119. src/gallium/targets/opencl/Makefile
  2120. src/gallium/targets/opencl/mesa.icd
  2121. src/gallium/targets/osmesa/Makefile
  2122. src/gallium/targets/osmesa/osmesa.pc
  2123. src/gallium/targets/pipe-loader/Makefile
  2124. src/gallium/targets/va/Makefile
  2125. src/gallium/targets/vdpau/Makefile
  2126. src/gallium/targets/xa/Makefile
  2127. src/gallium/targets/xa/xatracker.pc
  2128. src/gallium/targets/xvmc/Makefile
  2129. src/gallium/tests/trivial/Makefile
  2130. src/gallium/tests/unit/Makefile
  2131. src/gallium/winsys/freedreno/drm/Makefile
  2132. src/gallium/winsys/i915/drm/Makefile
  2133. src/gallium/winsys/intel/drm/Makefile
  2134. src/gallium/winsys/nouveau/drm/Makefile
  2135. src/gallium/winsys/radeon/drm/Makefile
  2136. src/gallium/winsys/amdgpu/drm/Makefile
  2137. src/gallium/winsys/svga/drm/Makefile
  2138. src/gallium/winsys/sw/dri/Makefile
  2139. src/gallium/winsys/sw/kms-dri/Makefile
  2140. src/gallium/winsys/sw/null/Makefile
  2141. src/gallium/winsys/sw/wrapper/Makefile
  2142. src/gallium/winsys/sw/xlib/Makefile
  2143. src/gallium/winsys/vc4/drm/Makefile
  2144. src/gallium/winsys/virgl/drm/Makefile
  2145. src/gallium/winsys/virgl/vtest/Makefile
  2146. src/gbm/Makefile
  2147. src/gbm/main/gbm.pc
  2148. src/glsl/Makefile
  2149. src/glx/Makefile
  2150. src/glx/apple/Makefile
  2151. src/glx/tests/Makefile
  2152. src/gtest/Makefile
  2153. src/loader/Makefile
  2154. src/mapi/Makefile
  2155. src/mapi/es1api/glesv1_cm.pc
  2156. src/mapi/es2api/glesv2.pc
  2157. src/mapi/glapi/gen/Makefile
  2158. src/mesa/Makefile
  2159. src/mesa/gl.pc
  2160. src/mesa/drivers/dri/dri.pc
  2161. src/mesa/drivers/dri/common/Makefile
  2162. src/mesa/drivers/dri/common/xmlpool/Makefile
  2163. src/mesa/drivers/dri/i915/Makefile
  2164. src/mesa/drivers/dri/i965/Makefile
  2165. src/mesa/drivers/dri/Makefile
  2166. src/mesa/drivers/dri/nouveau/Makefile
  2167. src/mesa/drivers/dri/r200/Makefile
  2168. src/mesa/drivers/dri/radeon/Makefile
  2169. src/mesa/drivers/dri/swrast/Makefile
  2170. src/mesa/drivers/osmesa/Makefile
  2171. src/mesa/drivers/osmesa/osmesa.pc
  2172. src/mesa/drivers/x11/Makefile
  2173. src/mesa/main/tests/Makefile
  2174. src/util/Makefile
  2175. src/util/tests/hash_table/Makefile])
  2176. AC_OUTPUT
  2177. dnl
  2178. dnl Output some configuration info for the user
  2179. dnl
  2180. echo ""
  2181. echo " prefix: $prefix"
  2182. echo " exec_prefix: $exec_prefix"
  2183. echo " libdir: $libdir"
  2184. echo " includedir: $includedir"
  2185. dnl API info
  2186. echo ""
  2187. echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
  2188. dnl Driver info
  2189. echo ""
  2190. case "x$enable_osmesa$enable_gallium_osmesa" in
  2191. xnoyes)
  2192. echo " OSMesa: lib$OSMESA_LIB (Gallium)"
  2193. ;;
  2194. xyesno)
  2195. echo " OSMesa: lib$OSMESA_LIB"
  2196. ;;
  2197. xnono)
  2198. echo " OSMesa: no"
  2199. ;;
  2200. esac
  2201. echo ""
  2202. if test "x$enable_dri" != xno; then
  2203. echo " DRI platform: $dri_platform"
  2204. if test -z "$DRI_DIRS"; then
  2205. echo " DRI drivers: no"
  2206. else
  2207. echo " DRI drivers: $DRI_DIRS"
  2208. fi
  2209. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  2210. fi
  2211. case "x$enable_glx$enable_xlib_glx" in
  2212. xyesyes)
  2213. echo " GLX: Xlib-based"
  2214. ;;
  2215. xyesno)
  2216. echo " GLX: DRI-based"
  2217. ;;
  2218. *)
  2219. echo " GLX: $enable_glx"
  2220. ;;
  2221. esac
  2222. dnl EGL
  2223. echo ""
  2224. echo " EGL: $enable_egl"
  2225. if test "$enable_egl" = yes; then
  2226. echo " EGL platforms: $egl_platforms"
  2227. egl_drivers=""
  2228. if test "x$HAVE_EGL_DRIVER_DRI2" != "x"; then
  2229. egl_drivers="$egl_drivers builtin:egl_dri2"
  2230. fi
  2231. if test "x$HAVE_EGL_DRIVER_DRI3" != "x"; then
  2232. egl_drivers="$egl_drivers builtin:egl_dri3"
  2233. fi
  2234. echo " EGL drivers: $egl_drivers"
  2235. fi
  2236. echo ""
  2237. if test "x$MESA_LLVM" = x1; then
  2238. echo " llvm: yes"
  2239. echo " llvm-config: $LLVM_CONFIG"
  2240. echo " llvm-version: $LLVM_VERSION"
  2241. else
  2242. echo " llvm: no"
  2243. fi
  2244. echo ""
  2245. if test -n "$with_gallium_drivers"; then
  2246. echo " Gallium drivers: $gallium_drivers"
  2247. echo " Gallium st: $gallium_st"
  2248. else
  2249. echo " Gallium: no"
  2250. fi
  2251. dnl Shader cache
  2252. echo ""
  2253. echo " Shader cache: $enable_shader_cache"
  2254. if test "x$enable_shader_cache" = "xyes"; then
  2255. echo " With SHA1 from: $with_sha1"
  2256. fi
  2257. dnl Libraries
  2258. echo ""
  2259. echo " Shared libs: $enable_shared"
  2260. echo " Static libs: $enable_static"
  2261. echo " Shared-glapi: $enable_shared_glapi"
  2262. dnl Compiler options
  2263. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  2264. cflags=`echo $CFLAGS | \
  2265. $SED 's/^ *//;s/ */ /;s/ *$//'`
  2266. cxxflags=`echo $CXXFLAGS | \
  2267. $SED 's/^ *//;s/ */ /;s/ *$//'`
  2268. defines=`echo $DEFINES | $SED 's/^ *//;s/ */ /;s/ *$//'`
  2269. echo ""
  2270. echo " CFLAGS: $cflags"
  2271. echo " CXXFLAGS: $cxxflags"
  2272. echo " Macros: $defines"
  2273. echo ""
  2274. if test "x$MESA_LLVM" = x1; then
  2275. echo " LLVM_CFLAGS: $LLVM_CFLAGS"
  2276. echo " LLVM_CXXFLAGS: $LLVM_CXXFLAGS"
  2277. echo " LLVM_CPPFLAGS: $LLVM_CPPFLAGS"
  2278. echo " LLVM_LDFLAGS: $LLVM_LDFLAGS"
  2279. echo ""
  2280. fi
  2281. echo " PYTHON2: $PYTHON2"
  2282. echo ""
  2283. echo " Run '${MAKE-make}' to build Mesa"
  2284. echo ""