Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 87KB

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