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

configure.ac 82KB

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