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 81KB

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