Clone of mesa.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

configure.ac 63KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120
  1. dnl Process this file with autoconf to create configure.
  2. AC_PREREQ([2.59])
  3. dnl Versioning - scrape the version from configs/default
  4. m4_define([mesa_version],
  5. [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n' | tr -d '\r'])])
  6. m4_ifval(mesa_version,,
  7. [m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])])
  8. dnl Tell the user about autoconf.html in the --help output
  9. m4_divert_once([HELP_END], [
  10. See docs/autoconf.html for more details on the options for Mesa.])
  11. AC_INIT([Mesa],[mesa_version],
  12. [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
  13. AC_CONFIG_AUX_DIR([bin])
  14. AC_CANONICAL_HOST
  15. dnl Save user CFLAGS and CXXFLAGS so one can override the default ones
  16. USER_CFLAGS="$CFLAGS"
  17. USER_CXXFLAGS="$CXXFLAGS"
  18. dnl Versions for external dependencies
  19. LIBDRM_REQUIRED=2.4.24
  20. LIBDRM_RADEON_REQUIRED=2.4.24
  21. LIBDRM_INTEL_REQUIRED=2.4.24
  22. LIBDRM_NOUVEAU_REQUIRED=0.6
  23. DRI2PROTO_REQUIRED=2.6
  24. GLPROTO_REQUIRED=1.4.14
  25. LIBDRM_XORG_REQUIRED=2.4.24
  26. LIBKMS_XORG_REQUIRED=1.0.0
  27. dnl Check for progs
  28. AC_PROG_CPP
  29. AC_PROG_CC
  30. AC_PROG_CXX
  31. AC_CHECK_PROGS([MAKE], [gmake make])
  32. AC_CHECK_PROGS([PYTHON2], [python2 python])
  33. AC_PATH_PROG([MKDEP], [makedepend])
  34. AC_PATH_PROG([SED], [sed])
  35. if test "x$MKDEP" = "x"; then
  36. AC_MSG_ERROR([makedepend is required to build Mesa])
  37. fi
  38. AC_PATH_PROG([FLEX], [flex])
  39. test "x$FLEX" = "x" && AC_MSG_ERROR([flex is needed to build Mesa])
  40. AC_PATH_PROG([BISON], [bison])
  41. test "x$BISON" = "x" && AC_MSG_ERROR([bison is needed to build Mesa])
  42. dnl Our fallback install-sh is a symlink to minstall. Use the existing
  43. dnl configuration in that case.
  44. AC_PROG_INSTALL
  45. test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
  46. dnl We need a POSIX shell for parts of the build. Assume we have one
  47. dnl in most cases.
  48. case "$host_os" in
  49. solaris*)
  50. # Solaris /bin/sh is too old/non-POSIX compliant
  51. AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
  52. SHELL="$POSIX_SHELL"
  53. ;;
  54. esac
  55. dnl clang is mostly GCC-compatible, but its version is much lower,
  56. dnl so we have to check for it.
  57. AC_MSG_CHECKING([if compiling with clang])
  58. AC_COMPILE_IFELSE(
  59. [AC_LANG_PROGRAM([], [[
  60. #ifndef __clang__
  61. not clang
  62. #endif
  63. ]])],
  64. [CLANG=yes], [CLANG=no])
  65. AC_MSG_RESULT([$CLANG])
  66. dnl If we're using GCC, make sure that it is at least version 3.3.0. Older
  67. dnl versions are explictly not supported.
  68. if test "x$GCC" = xyes -a "x$CLANG" = xno; then
  69. AC_MSG_CHECKING([whether gcc version is sufficient])
  70. major=0
  71. minor=0
  72. GCC_VERSION=`$CC -dumpversion`
  73. if test $? -eq 0; then
  74. major=`echo $GCC_VERSION | cut -d. -f1`
  75. minor=`echo $GCC_VERSION | cut -d. -f2`
  76. fi
  77. if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
  78. AC_MSG_RESULT([no])
  79. AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
  80. else
  81. AC_MSG_RESULT([yes])
  82. fi
  83. fi
  84. MKDEP_OPTIONS=-fdepend
  85. dnl Ask gcc where it's keeping its secret headers
  86. if test "x$GCC" = xyes; then
  87. for dir in include include-fixed; do
  88. GCC_INCLUDES=`$CC -print-file-name=$dir`
  89. if test "x$GCC_INCLUDES" != x && \
  90. test "$GCC_INCLUDES" != "$dir" && \
  91. test -d "$GCC_INCLUDES"; then
  92. MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
  93. fi
  94. done
  95. fi
  96. AC_SUBST([MKDEP_OPTIONS])
  97. dnl Make sure the pkg-config macros are defined
  98. m4_ifndef([PKG_PROG_PKG_CONFIG],
  99. [m4_fatal([Could not locate the pkg-config autoconf macros.
  100. These are usually located in /usr/share/aclocal/pkg.m4. If your macros
  101. are in a different location, try setting the environment variable
  102. ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
  103. PKG_PROG_PKG_CONFIG()
  104. dnl LIB_DIR - library basename
  105. LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
  106. AC_SUBST([LIB_DIR])
  107. dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
  108. _SAVE_LDFLAGS="$LDFLAGS"
  109. AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
  110. AC_SUBST([EXTRA_LIB_PATH])
  111. dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
  112. _SAVE_CPPFLAGS="$CPPFLAGS"
  113. AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
  114. AC_SUBST([X11_INCLUDES])
  115. dnl Compiler macros
  116. DEFINES=""
  117. AC_SUBST([DEFINES])
  118. case "$host_os" in
  119. linux*|*-gnu*|gnu*)
  120. DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
  121. ;;
  122. solaris*)
  123. DEFINES="$DEFINES -DPTHREADS -DSVR4"
  124. ;;
  125. cygwin*)
  126. DEFINES="$DEFINES -DPTHREADS"
  127. ;;
  128. esac
  129. dnl Add flags for gcc and g++
  130. if test "x$GCC" = xyes; then
  131. CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99"
  132. if test "x$CLANG" = "xno"; then
  133. CFLAGS="$CFLAGS -ffast-math"
  134. fi
  135. # Enable -fvisibility=hidden if using a gcc that supports it
  136. save_CFLAGS="$CFLAGS"
  137. AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
  138. VISIBILITY_CFLAGS="-fvisibility=hidden"
  139. CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
  140. AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
  141. [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
  142. # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
  143. CFLAGS=$save_CFLAGS
  144. # Work around aliasing bugs - developers should comment this out
  145. CFLAGS="$CFLAGS -fno-strict-aliasing"
  146. fi
  147. if test "x$GXX" = xyes; then
  148. CXXFLAGS="$CXXFLAGS -Wall"
  149. # Enable -fvisibility=hidden if using a gcc that supports it
  150. save_CXXFLAGS="$CXXFLAGS"
  151. AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
  152. VISIBILITY_CXXFLAGS="-fvisibility=hidden"
  153. CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
  154. AC_LANG_PUSH([C++])
  155. AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
  156. [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
  157. AC_LANG_POP([C++])
  158. # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
  159. CXXFLAGS=$save_CXXFLAGS
  160. # Work around aliasing bugs - developers should comment this out
  161. CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
  162. fi
  163. dnl even if the compiler appears to support it, using visibility attributes isn't
  164. dnl going to do anything useful currently on cygwin apart from emit lots of warnings
  165. case "$host_os" in
  166. cygwin*)
  167. VISIBILITY_CFLAGS=""
  168. VISIBILITY_CXXFLAGS=""
  169. ;;
  170. esac
  171. AC_SUBST([VISIBILITY_CFLAGS])
  172. AC_SUBST([VISIBILITY_CXXFLAGS])
  173. dnl These should be unnecessary, but let the user set them if they want
  174. AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
  175. Default is to use CFLAGS.])
  176. AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
  177. compiler. Default is to use CFLAGS.])
  178. AC_SUBST([OPT_FLAGS])
  179. AC_SUBST([ARCH_FLAGS])
  180. dnl
  181. dnl Hacks to enable 32 or 64 bit build
  182. dnl
  183. AC_ARG_ENABLE([32-bit],
  184. [AS_HELP_STRING([--enable-32-bit],
  185. [build 32-bit libraries @<:@default=auto@:>@])],
  186. [enable_32bit="$enableval"],
  187. [enable_32bit=auto]
  188. )
  189. if test "x$enable_32bit" = xyes; then
  190. if test "x$GCC" = xyes; then
  191. CFLAGS="$CFLAGS -m32"
  192. ARCH_FLAGS="$ARCH_FLAGS -m32"
  193. fi
  194. if test "x$GXX" = xyes; then
  195. CXXFLAGS="$CXXFLAGS -m32"
  196. fi
  197. fi
  198. AC_ARG_ENABLE([64-bit],
  199. [AS_HELP_STRING([--enable-64-bit],
  200. [build 64-bit libraries @<:@default=auto@:>@])],
  201. [enable_64bit="$enableval"],
  202. [enable_64bit=auto]
  203. )
  204. if test "x$enable_64bit" = xyes; then
  205. if test "x$GCC" = xyes; then
  206. CFLAGS="$CFLAGS -m64"
  207. fi
  208. if test "x$GXX" = xyes; then
  209. CXXFLAGS="$CXXFLAGS -m64"
  210. fi
  211. fi
  212. dnl
  213. dnl shared/static libraries, mimic libtool options
  214. dnl
  215. AC_ARG_ENABLE([static],
  216. [AS_HELP_STRING([--enable-static],
  217. [build static libraries @<:@default=disabled@:>@])],
  218. [enable_static="$enableval"],
  219. [enable_static=no]
  220. )
  221. case "x$enable_static" in
  222. xyes|xno ) ;;
  223. x ) enable_static=no ;;
  224. * )
  225. AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
  226. ;;
  227. esac
  228. AC_ARG_ENABLE([shared],
  229. [AS_HELP_STRING([--disable-shared],
  230. [build shared libraries @<:@default=enabled@:>@])],
  231. [enable_shared="$enableval"],
  232. [enable_shared=yes]
  233. )
  234. case "x$enable_shared" in
  235. xyes|xno ) ;;
  236. x ) enable_shared=yes ;;
  237. * )
  238. AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
  239. ;;
  240. esac
  241. dnl Can't have static and shared libraries, default to static if user
  242. dnl explicitly requested. If both disabled, set to static since shared
  243. dnl was explicitly requirested.
  244. case "x$enable_static$enable_shared" in
  245. xyesyes )
  246. AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
  247. enable_shared=no
  248. ;;
  249. xnono )
  250. AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
  251. enable_static=yes
  252. ;;
  253. esac
  254. dnl
  255. dnl mklib options
  256. dnl
  257. AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
  258. if test "$enable_static" = yes; then
  259. MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
  260. fi
  261. AC_SUBST([MKLIB_OPTIONS])
  262. dnl
  263. dnl other compiler options
  264. dnl
  265. AC_ARG_ENABLE([debug],
  266. [AS_HELP_STRING([--enable-debug],
  267. [use debug compiler flags and macros @<:@default=disabled@:>@])],
  268. [enable_debug="$enableval"],
  269. [enable_debug=no]
  270. )
  271. if test "x$enable_debug" = xyes; then
  272. DEFINES="$DEFINES -DDEBUG"
  273. if test "x$GCC" = xyes; then
  274. CFLAGS="$CFLAGS -g"
  275. fi
  276. if test "x$GXX" = xyes; then
  277. CXXFLAGS="$CXXFLAGS -g"
  278. fi
  279. fi
  280. dnl
  281. dnl library names
  282. dnl
  283. LIB_PREFIX_GLOB='lib'
  284. LIB_VERSION_SEPARATOR='.'
  285. if test "$enable_static" = yes; then
  286. LIB_EXTENSION='a'
  287. else
  288. case "$host_os" in
  289. darwin* )
  290. LIB_EXTENSION='dylib' ;;
  291. cygwin* )
  292. dnl prefix can be 'cyg' or 'lib'
  293. LIB_PREFIX_GLOB='???'
  294. LIB_VERSION_SEPARATOR='-'
  295. LIB_EXTENSION='dll' ;;
  296. aix* )
  297. LIB_EXTENSION='a' ;;
  298. * )
  299. LIB_EXTENSION='so' ;;
  300. esac
  301. fi
  302. dnl
  303. dnl potentially-infringing-but-nobody-knows-for-sure stuff
  304. dnl
  305. AC_ARG_ENABLE([texture-float],
  306. [AS_HELP_STRING([--enable-texture-float],
  307. [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
  308. [enable_texture_float="$enableval"],
  309. [enable_texture_float=no]
  310. )
  311. if test "x$enable_texture_float" = xyes; then
  312. AC_MSG_WARN([Floating-point textures enabled.])
  313. AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
  314. DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
  315. fi
  316. GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
  317. GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
  318. GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
  319. GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
  320. OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
  321. EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
  322. GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
  323. GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
  324. VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
  325. GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
  326. WAYLAND_EGL_LIB_NAME='lib$(WAYLAND_EGL_LIB).'${LIB_EXTENSION}
  327. GBM_LIB_NAME='lib$(GBM_LIB).'${LIB_EXTENSION}
  328. GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  329. GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  330. GLUT_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLUT_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  331. GLW_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLW_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  332. OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  333. EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  334. EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  335. GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  336. GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  337. VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  338. GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  339. WAYLAND_EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(WAYLAND_EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  340. GBM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GBM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  341. AC_SUBST([GL_LIB_NAME])
  342. AC_SUBST([GLU_LIB_NAME])
  343. AC_SUBST([GLUT_LIB_NAME])
  344. AC_SUBST([GLW_LIB_NAME])
  345. AC_SUBST([OSMESA_LIB_NAME])
  346. AC_SUBST([EGL_LIB_NAME])
  347. AC_SUBST([GLESv1_CM_LIB_NAME])
  348. AC_SUBST([GLESv2_LIB_NAME])
  349. AC_SUBST([VG_LIB_NAME])
  350. AC_SUBST([GLAPI_LIB_NAME])
  351. AC_SUBST([WAYLAND_EGL_LIB_NAME])
  352. AC_SUBST([GBM_LIB_NAME])
  353. AC_SUBST([GL_LIB_GLOB])
  354. AC_SUBST([GLU_LIB_GLOB])
  355. AC_SUBST([GLUT_LIB_GLOB])
  356. AC_SUBST([GLW_LIB_GLOB])
  357. AC_SUBST([OSMESA_LIB_GLOB])
  358. AC_SUBST([EGL_LIB_GLOB])
  359. AC_SUBST([GLESv1_CM_LIB_GLOB])
  360. AC_SUBST([GLESv2_LIB_GLOB])
  361. AC_SUBST([VG_LIB_GLOB])
  362. AC_SUBST([GLAPI_LIB_GLOB])
  363. AC_SUBST([WAYLAND_EGL_LIB_GLOB])
  364. AC_SUBST([GBM_LIB_GLOB])
  365. dnl
  366. dnl Arch/platform-specific settings
  367. dnl
  368. AC_ARG_ENABLE([asm],
  369. [AS_HELP_STRING([--disable-asm],
  370. [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
  371. [enable_asm="$enableval"],
  372. [enable_asm=yes]
  373. )
  374. asm_arch=""
  375. ASM_FLAGS=""
  376. MESA_ASM_SOURCES=""
  377. GLAPI_ASM_SOURCES=""
  378. AC_MSG_CHECKING([whether to enable assembly])
  379. test "x$enable_asm" = xno && AC_MSG_RESULT([no])
  380. # disable if cross compiling on x86/x86_64 since we must run gen_matypes
  381. if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
  382. case "$host_cpu" in
  383. i?86 | x86_64)
  384. enable_asm=no
  385. AC_MSG_RESULT([no, cross compiling])
  386. ;;
  387. esac
  388. fi
  389. # check for supported arches
  390. if test "x$enable_asm" = xyes; then
  391. case "$host_cpu" in
  392. i?86)
  393. case "$host_os" in
  394. linux* | *freebsd* | dragonfly* | *netbsd*)
  395. test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
  396. ;;
  397. esac
  398. ;;
  399. x86_64)
  400. case "$host_os" in
  401. linux* | *freebsd* | dragonfly* | *netbsd*)
  402. test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
  403. ;;
  404. esac
  405. ;;
  406. powerpc)
  407. case "$host_os" in
  408. linux*)
  409. asm_arch=ppc
  410. ;;
  411. esac
  412. ;;
  413. sparc*)
  414. case "$host_os" in
  415. linux*)
  416. asm_arch=sparc
  417. ;;
  418. esac
  419. ;;
  420. esac
  421. case "$asm_arch" in
  422. x86)
  423. ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
  424. MESA_ASM_SOURCES='$(X86_SOURCES)'
  425. GLAPI_ASM_SOURCES='$(X86_API)'
  426. AC_MSG_RESULT([yes, x86])
  427. ;;
  428. x86_64)
  429. ASM_FLAGS="-DUSE_X86_64_ASM"
  430. MESA_ASM_SOURCES='$(X86-64_SOURCES)'
  431. GLAPI_ASM_SOURCES='$(X86-64_API)'
  432. AC_MSG_RESULT([yes, x86_64])
  433. ;;
  434. ppc)
  435. ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
  436. MESA_ASM_SOURCES='$(PPC_SOURCES)'
  437. AC_MSG_RESULT([yes, ppc])
  438. ;;
  439. sparc)
  440. ASM_FLAGS="-DUSE_SPARC_ASM"
  441. MESA_ASM_SOURCES='$(SPARC_SOURCES)'
  442. GLAPI_ASM_SOURCES='$(SPARC_API)'
  443. AC_MSG_RESULT([yes, sparc])
  444. ;;
  445. *)
  446. AC_MSG_RESULT([no, platform not supported])
  447. ;;
  448. esac
  449. fi
  450. AC_SUBST([ASM_FLAGS])
  451. AC_SUBST([MESA_ASM_SOURCES])
  452. AC_SUBST([GLAPI_ASM_SOURCES])
  453. dnl PIC code macro
  454. MESA_PIC_FLAGS
  455. dnl Check to see if dlopen is in default libraries (like Solaris, which
  456. dnl has it in libc), or if libdl is needed to get it.
  457. AC_CHECK_FUNC([dlopen], [],
  458. [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
  459. AC_SUBST([DLOPEN_LIBS])
  460. dnl See if posix_memalign is available
  461. AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
  462. dnl SELinux awareness.
  463. AC_ARG_ENABLE([selinux],
  464. [AS_HELP_STRING([--enable-selinux],
  465. [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
  466. [MESA_SELINUX="$enableval"],
  467. [MESA_SELINUX=no])
  468. if test "x$enable_selinux" = "xyes"; then
  469. AC_CHECK_HEADER([selinux/selinux.h],[],
  470. [AC_MSG_ERROR([SELinux headers not found])])
  471. AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
  472. [AC_MSG_ERROR([SELinux library not found])])
  473. SELINUX_LIBS="-lselinux"
  474. DEFINES="$DEFINES -DMESA_SELINUX"
  475. fi
  476. dnl Options for APIs
  477. AC_ARG_ENABLE([opengl],
  478. [AS_HELP_STRING([--disable-opengl],
  479. [disable support for standard OpenGL API @<:@default=no@:>@])],
  480. [enable_opengl="$enableval"],
  481. [enable_opengl=yes])
  482. AC_ARG_ENABLE([gles1],
  483. [AS_HELP_STRING([--enable-gles1],
  484. [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
  485. [enable_gles1="$enableval"],
  486. [enable_gles1=no])
  487. AC_ARG_ENABLE([gles2],
  488. [AS_HELP_STRING([--enable-gles2],
  489. [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
  490. [enable_gles2="$enableval"],
  491. [enable_gles2=no])
  492. AC_ARG_ENABLE([openvg],
  493. [AS_HELP_STRING([--enable-openvg],
  494. [enable support for OpenVG API @<:@default=no@:>@])],
  495. [enable_openvg="$enableval"],
  496. [enable_openvg=no])
  497. AC_ARG_ENABLE([dri],
  498. [AS_HELP_STRING([--enable-dri],
  499. [enable DRI modules @<:@default=auto@:>@])],
  500. [enable_dri="$enableval"],
  501. [enable_dri=auto])
  502. AC_ARG_ENABLE([glx],
  503. [AS_HELP_STRING([--enable-glx],
  504. [enable GLX library @<:@default=auto@:>@])],
  505. [enable_glx="$enableval"],
  506. [enable_glx=auto])
  507. AC_ARG_ENABLE([osmesa],
  508. [AS_HELP_STRING([--enable-osmesa],
  509. [enable OSMesa library @<:@default=auto@:>@])],
  510. [enable_osmesa="$enableval"],
  511. [enable_osmesa=auto])
  512. AC_ARG_ENABLE([egl],
  513. [AS_HELP_STRING([--disable-egl],
  514. [disable EGL library @<:@default=enabled@:>@])],
  515. [enable_egl="$enableval"],
  516. [enable_egl=yes])
  517. AC_ARG_ENABLE([xorg],
  518. [AS_HELP_STRING([--enable-xorg],
  519. [enable support for X.Org DDX API @<:@default=no@:>@])],
  520. [enable_xorg="$enableval"],
  521. [enable_xorg=no])
  522. AC_ARG_ENABLE([xa],
  523. [AS_HELP_STRING([--enable-xa],
  524. [enable build of the XA X Acceleration API @<:@default=no@:>@])],
  525. [enable_xa="$enableval"],
  526. [enable_xa=no])
  527. AC_ARG_ENABLE([d3d1x],
  528. [AS_HELP_STRING([--enable-d3d1x],
  529. [enable support for Direct3D 10 & 11 low-level API @<:@default=no@:>@])],
  530. [enable_d3d1x="$enableval"],
  531. [enable_d3d1x=no])
  532. AC_ARG_ENABLE([gbm],
  533. [AS_HELP_STRING([--enable-gbm],
  534. [enable gbm library @<:@default=auto@:>@])],
  535. [enable_gbm="$enableval"],
  536. [enable_gbm=auto])
  537. AC_ARG_ENABLE([xvmc],
  538. [AS_HELP_STRING([--enable-xvmc],
  539. [enable xvmc library @<:@default=auto@:>@])],
  540. [enable_xvmc="$enableval"],
  541. [enable_xvmc=auto])
  542. AC_ARG_ENABLE([vdpau],
  543. [AS_HELP_STRING([--enable-vdpau],
  544. [enable vdpau library @<:@default=auto@:>@])],
  545. [enable_vdpau="$enableval"],
  546. [enable_vdpau=auto])
  547. AC_ARG_ENABLE([va],
  548. [AS_HELP_STRING([--enable-va],
  549. [enable va library @<:@default=auto@:>@])],
  550. [enable_va="$enableval"],
  551. [enable_va=auto])
  552. AC_ARG_ENABLE([xlib_glx],
  553. [AS_HELP_STRING([--enable-xlib-glx],
  554. [make GLX library Xlib-based instead of DRI-based @<:@default=disable@:>@])],
  555. [enable_xlib_glx="$enableval"],
  556. [enable_xlib_glx=auto])
  557. AC_ARG_ENABLE([gallium_egl],
  558. [AS_HELP_STRING([--enable-gallium-egl],
  559. [enable optional EGL state tracker (not required
  560. for EGL support in Gallium with OpenGL and OpenGL ES)
  561. @<:@default=disable@:>@])],
  562. [enable_gallium_egl="$enableval"],
  563. [enable_gallium_egl=no])
  564. AC_ARG_ENABLE([gallium_gbm],
  565. [AS_HELP_STRING([--enable-gallium-gbm],
  566. [enable optional gbm state tracker (not required for
  567. gbm support in Gallium)
  568. @<:@default=auto@:>@])],
  569. [enable_gallium_gbm="$enableval"],
  570. [enable_gallium_gbm=auto])
  571. # Option for Gallium drivers
  572. GALLIUM_DRIVERS_DEFAULT="r300,r600,swrast"
  573. AC_ARG_WITH([gallium-drivers],
  574. [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
  575. [comma delimited Gallium drivers list, e.g.
  576. "i915,i965,nouveau,r300,r600,svga,swrast"
  577. @<:@default=r300,r600,swrast@:>@])],
  578. [with_gallium_drivers="$withval"],
  579. [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
  580. # Doing '--without-gallium-drivers' will set this variable to 'no'. Clear it
  581. # here so that the script doesn't choke on an unknown driver name later.
  582. case "$with_gallium_drivers" in
  583. yes) with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT" ;;
  584. no) with_gallium_drivers='' ;;
  585. esac
  586. if test "x$enable_opengl" = xno -a \
  587. "x$enable_gles1" = xno -a \
  588. "x$enable_gles2" = xno -a \
  589. "x$enable_openvg" = xno -a \
  590. "x$enable_xorg" = xno -a \
  591. "x$enable_xa" = xno -a \
  592. "x$enable_d3d1x" = xno -a \
  593. "x$enable_xvmc" = xno -a \
  594. "x$enable_vdpau" = xno -a \
  595. "x$enable_va" = xno; then
  596. AC_MSG_ERROR([at least one API should be enabled])
  597. fi
  598. API_DEFINES=""
  599. if test "x$enable_opengl" = xno; then
  600. API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
  601. else
  602. API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
  603. fi
  604. if test "x$enable_gles1" = xyes; then
  605. API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
  606. fi
  607. if test "x$enable_gles2" = xyes; then
  608. API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
  609. fi
  610. AC_SUBST([API_DEFINES])
  611. AC_ARG_ENABLE([shared-glapi],
  612. [AS_HELP_STRING([--enable-shared-glapi],
  613. [EXPERIMENTAL. Enable shared glapi for OpenGL @<:@default=no@:>@])],
  614. [enable_shared_glapi="$enableval"],
  615. [enable_shared_glapi=no])
  616. SHARED_GLAPI="0"
  617. if test "x$enable_shared_glapi" = xyes; then
  618. SHARED_GLAPI="1"
  619. fi
  620. AC_SUBST([SHARED_GLAPI])
  621. dnl
  622. dnl Driver configuration. Options are xlib, dri and osmesa right now.
  623. dnl More later: fbdev, ...
  624. dnl
  625. default_driver="xlib"
  626. case "$host_os" in
  627. linux*)
  628. case "$host_cpu" in
  629. i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
  630. esac
  631. ;;
  632. *freebsd* | dragonfly* | *netbsd*)
  633. case "$host_cpu" in
  634. i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
  635. esac
  636. ;;
  637. esac
  638. if test "x$enable_opengl" = xno; then
  639. default_driver="no"
  640. fi
  641. AC_ARG_WITH([driver],
  642. [AS_HELP_STRING([--with-driver=DRIVER], [DEPRECATED])],
  643. [mesa_driver="$withval"],
  644. [mesa_driver=auto])
  645. dnl Check for valid option
  646. case "x$mesa_driver" in
  647. xxlib|xdri|xosmesa|xno)
  648. if test "x$enable_dri" != xauto -o \
  649. "x$enable_glx" != xauto -o \
  650. "x$enable_osmesa" != xauto -o \
  651. "x$enable_xlib_glx" != xauto; then
  652. AC_MSG_ERROR([--with-driver=$mesa_driver is deprecated])
  653. fi
  654. ;;
  655. xauto)
  656. mesa_driver="$default_driver"
  657. ;;
  658. *)
  659. AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
  660. ;;
  661. esac
  662. # map $mesa_driver to APIs
  663. if test "x$enable_dri" = xauto; then
  664. case "x$mesa_driver" in
  665. xdri) enable_dri=yes ;;
  666. *) enable_dri=no ;;
  667. esac
  668. fi
  669. if test "x$enable_glx" = xauto; then
  670. case "x$mesa_driver" in
  671. xdri|xxlib) enable_glx=yes ;;
  672. *) enable_glx=no ;;
  673. esac
  674. fi
  675. if test "x$enable_osmesa" = xauto; then
  676. case "x$mesa_driver" in
  677. xxlib|xosmesa) enable_osmesa=yes ;;
  678. *) enable_osmesa=no ;;
  679. esac
  680. fi
  681. if test "x$enable_xlib_glx" = xauto; then
  682. case "x$mesa_driver" in
  683. xxlib) enable_xlib_glx=yes ;;
  684. *) enable_xlib_glx=no ;;
  685. esac
  686. fi
  687. if test "x$enable_glx" = xno; then
  688. enable_xlib_glx=no
  689. fi
  690. dnl
  691. dnl Driver specific build directories
  692. dnl
  693. dnl this variable will be prepended to SRC_DIRS and is not exported
  694. CORE_DIRS=""
  695. SRC_DIRS=""
  696. GLU_DIRS="sgi"
  697. GALLIUM_DIRS="auxiliary drivers state_trackers"
  698. GALLIUM_TARGET_DIRS=""
  699. GALLIUM_WINSYS_DIRS="sw"
  700. GALLIUM_DRIVERS_DIRS="failover galahad trace rbug noop identity"
  701. GALLIUM_STATE_TRACKERS_DIRS=""
  702. # build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled
  703. case "x$enable_shared_glapi$enable_gles1$enable_gles2" in
  704. x*yes*)
  705. CORE_DIRS="$CORE_DIRS mapi/shared-glapi"
  706. ;;
  707. esac
  708. # build glapi if OpenGL is enabled
  709. if test "x$enable_opengl" = xyes; then
  710. CORE_DIRS="$CORE_DIRS mapi/glapi"
  711. fi
  712. # build es1api if OpenGL ES 1.x is enabled
  713. if test "x$enable_gles1" = xyes; then
  714. CORE_DIRS="$CORE_DIRS mapi/es1api"
  715. fi
  716. # build es2api if OpenGL ES 2.x is enabled
  717. if test "x$enable_gles2" = xyes; then
  718. CORE_DIRS="$CORE_DIRS mapi/es2api"
  719. fi
  720. # build glsl and mesa if OpenGL or OpenGL ES is enabled
  721. case "x$enable_opengl$enable_gles1$enable_gles2" in
  722. x*yes*)
  723. CORE_DIRS="$CORE_DIRS glsl mesa"
  724. ;;
  725. esac
  726. case "x$enable_glx$enable_xlib_glx" in
  727. xyesyes)
  728. DRIVER_DIRS="$DRIVER_DIRS x11"
  729. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
  730. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
  731. GALLIUM_STATE_TRACKERS_DIRS="glx $GALLIUM_STATE_TRACKERS_DIRS"
  732. HAVE_WINSYS_XLIB="yes"
  733. ;;
  734. xyesno)
  735. # DRI-based GLX
  736. SRC_DIRS="$SRC_DIRS glx"
  737. ;;
  738. esac
  739. if test "x$enable_dri" = xyes; then
  740. DRIVER_DIRS="$DRIVER_DIRS dri"
  741. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/dri"
  742. GALLIUM_STATE_TRACKERS_DIRS="dri $GALLIUM_STATE_TRACKERS_DIRS"
  743. HAVE_ST_DRI="yes"
  744. fi
  745. if test "x$enable_osmesa" = xyes; then
  746. # the empty space matters for osmesa... (see src/mesa/Makefile)
  747. if test -n "$DRIVER_DIRS"; then
  748. DRIVER_DIRS="$DRIVER_DIRS osmesa"
  749. else
  750. DRIVER_DIRS="osmesa"
  751. fi
  752. fi
  753. AC_SUBST([SRC_DIRS])
  754. AC_SUBST([GLU_DIRS])
  755. AC_SUBST([DRIVER_DIRS])
  756. AC_SUBST([GALLIUM_DIRS])
  757. AC_SUBST([GALLIUM_TARGET_DIRS])
  758. AC_SUBST([GALLIUM_WINSYS_DIRS])
  759. AC_SUBST([GALLIUM_DRIVERS_DIRS])
  760. AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
  761. AC_SUBST([MESA_LLVM])
  762. # Check for libdrm
  763. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
  764. [have_libdrm=yes], [have_libdrm=no])
  765. if test "x$enable_dri" = xyes; then
  766. # DRI must be shared, I think
  767. if test "$enable_static" = yes; then
  768. AC_MSG_ERROR([Can't use static libraries for DRI drivers])
  769. fi
  770. # not a hard requirement as swrast does not depend on it
  771. if test "x$have_libdrm" = xyes; then
  772. DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
  773. fi
  774. fi
  775. dnl
  776. dnl Find out if X is available. The variable have_x is set if libX11 is
  777. dnl found to mimic AC_PATH_XTRA.
  778. dnl
  779. if test -n "$PKG_CONFIG"; then
  780. AC_MSG_CHECKING([pkg-config files for X11 are available])
  781. PKG_CHECK_EXISTS([x11],[
  782. x11_pkgconfig=yes
  783. have_x=yes
  784. ],[
  785. x11_pkgconfig=no
  786. ])
  787. AC_MSG_RESULT([$x11_pkgconfig])
  788. else
  789. x11_pkgconfig=no
  790. fi
  791. dnl Use the autoconf macro if no pkg-config files
  792. if test "$x11_pkgconfig" = yes; then
  793. PKG_CHECK_MODULES([X11], [x11])
  794. else
  795. AC_PATH_XTRA
  796. test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
  797. test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
  798. AC_SUBST([X11_CFLAGS])
  799. AC_SUBST([X11_LIBS])
  800. fi
  801. dnl Try to tell the user that the --x-* options are only used when
  802. dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
  803. m4_divert_once([HELP_BEGIN],
  804. [These options are only used when the X libraries cannot be found by the
  805. pkg-config utility.])
  806. dnl We need X for xlib and dri, so bomb now if it's not found
  807. if test "x$enable_glx" = xyes -a "x$no_x" = xyes; then
  808. AC_MSG_ERROR([X11 development libraries needed for GLX])
  809. fi
  810. dnl XCB - this is only used for GLX right now
  811. AC_ARG_ENABLE([xcb],
  812. [AS_HELP_STRING([--enable-xcb],
  813. [use XCB for GLX @<:@default=disabled@:>@])],
  814. [enable_xcb="$enableval"],
  815. [enable_xcb=no])
  816. if test "x$enable_xcb" = xyes; then
  817. DEFINES="$DEFINES -DUSE_XCB"
  818. else
  819. enable_xcb=no
  820. fi
  821. dnl Direct rendering or just indirect rendering
  822. case "$host_os" in
  823. gnu*)
  824. dnl Disable by default on GNU/Hurd
  825. driglx_direct_default="no"
  826. ;;
  827. cygwin*)
  828. dnl Disable by default on cygwin
  829. driglx_direct_default="no"
  830. ;;
  831. *)
  832. driglx_direct_default="yes"
  833. ;;
  834. esac
  835. AC_ARG_ENABLE([driglx-direct],
  836. [AS_HELP_STRING([--disable-driglx-direct],
  837. [enable direct rendering in GLX and EGL for DRI \
  838. @<:@default=auto@:>@])],
  839. [driglx_direct="$enableval"],
  840. [driglx_direct="$driglx_direct_default"])
  841. dnl
  842. dnl libGL configuration per driver
  843. dnl
  844. case "x$enable_glx$enable_xlib_glx" in
  845. xyesyes)
  846. # Xlib-based GLX
  847. if test "$x11_pkgconfig" = yes; then
  848. PKG_CHECK_MODULES([XLIBGL], [x11 xext])
  849. GL_PC_REQ_PRIV="x11 xext"
  850. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  851. GL_LIB_DEPS="$XLIBGL_LIBS"
  852. else
  853. # should check these...
  854. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  855. GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
  856. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  857. GL_PC_CFLAGS="$X11_INCLUDES"
  858. fi
  859. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
  860. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
  861. # if static, move the external libraries to the programs
  862. # and empty the libraries for libGL
  863. if test "$enable_static" = yes; then
  864. APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
  865. GL_LIB_DEPS=""
  866. fi
  867. ;;
  868. xyesno)
  869. # DRI-based GLX
  870. PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
  871. GL_PC_REQ_PRIV="glproto >= $GLPROTO_REQUIRED"
  872. if test x"$driglx_direct" = xyes; then
  873. if test "x$have_libdrm" != xyes; then
  874. AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
  875. fi
  876. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  877. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
  878. fi
  879. # find the DRI deps for libGL
  880. if test "$x11_pkgconfig" = yes; then
  881. dri_modules="x11 xext xdamage xfixes"
  882. # add xf86vidmode if available
  883. PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
  884. if test "$HAVE_XF86VIDMODE" = yes ; then
  885. dri_modules="$dri_modules xxf86vm"
  886. fi
  887. # add xcb modules if necessary
  888. if test "$enable_xcb" = yes; then
  889. dri_modules="$dri_modules x11-xcb xcb-glx"
  890. fi
  891. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  892. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  893. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  894. GL_LIB_DEPS="$DRIGL_LIBS"
  895. else
  896. # should check these...
  897. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  898. if test "x$HAVE_XF86VIDMODE" == xyes; then
  899. GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
  900. else
  901. GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXdamage -lXfixes"
  902. fi
  903. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  904. GL_PC_CFLAGS="$X11_INCLUDES"
  905. # XCB can only be used from pkg-config
  906. if test "$enable_xcb" = yes; then
  907. PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
  908. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
  909. X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
  910. GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
  911. fi
  912. fi
  913. # need DRM libs, -lpthread, etc.
  914. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  915. GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  916. ;;
  917. esac
  918. GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  919. GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  920. GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  921. GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  922. AC_SUBST([GL_LIB_DEPS])
  923. AC_SUBST([GL_PC_REQ_PRIV])
  924. AC_SUBST([GL_PC_LIB_PRIV])
  925. AC_SUBST([GL_PC_CFLAGS])
  926. AC_SUBST([DRI_PC_REQ_PRIV])
  927. AC_SUBST([GLESv1_CM_LIB_DEPS])
  928. AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
  929. AC_SUBST([GLESv2_LIB_DEPS])
  930. AC_SUBST([GLESv2_PC_LIB_PRIV])
  931. GLAPI_LIB_DEPS="-lpthread"
  932. AC_SUBST([GLAPI_LIB_DEPS])
  933. dnl Setup default DRI CFLAGS
  934. DRI_CFLAGS='$(CFLAGS)'
  935. DRI_CXXFLAGS='$(CXXFLAGS)'
  936. DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.a'
  937. MESA_MODULES='$(TOP)/src/mesa/libmesa.a'
  938. AC_ARG_ENABLE([shared-dricore],
  939. [AS_HELP_STRING([--enable-shared-dricore],
  940. [link DRI modules with shared core DRI routines @<:@default=disabled@:>@])],
  941. [enable_dricore="$enableval"],
  942. [enable_dricore=no])
  943. if test "x$enable_dri" = xyes ; then
  944. if test "$enable_dricore" = yes ; then
  945. if test "$GCC$GXX" != yesyes ; then
  946. AC_MSG_WARN([Shared dricore requires GCC-compatible rpath handling. Disabling shared dricore])
  947. enable_dricore=no
  948. else
  949. DRICORE_GLSL_LIBS='$(TOP)/$(LIB_DIR)/libglsl.so'
  950. DRICORE_LIBS='$(TOP)/$(LIB_DIR)/libdricore.so'
  951. DRICORE_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) -lglsl'
  952. DRI_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) -ldricore -lglsl'
  953. DRI_CFLAGS='$(CFLAGS_NOVISIBILITY) -DUSE_DRICORE'
  954. DRI_CXXFLAGS='$(CXXFLAGS_NOVISIBILITY) -DUSE_DRICORE'
  955. MESA_MODULES='$(DRICORE_LIBS) $(DRICORE_GLSL_LIBS)'
  956. fi
  957. fi
  958. fi
  959. AC_SUBST([DRICORE_LIBS])
  960. AC_SUBST([DRICORE_GLSL_LIBS])
  961. AC_SUBST([DRICORE_LIB_DEPS])
  962. AC_SUBST([DRI_CXXFLAGS])
  963. AC_SUBST([DRI_CFLAGS])
  964. AC_SUBST([MESA_MODULES])
  965. AC_SUBST([HAVE_XF86VIDMODE])
  966. PKG_CHECK_MODULES([LIBDRM_RADEON],
  967. [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED],
  968. HAVE_LIBDRM_RADEON=yes,
  969. HAVE_LIBDRM_RADEON=no)
  970. dnl
  971. dnl More GLX setup
  972. dnl
  973. case "x$enable_glx$enable_xlib_glx" in
  974. xyesyes)
  975. DEFINES="$DEFINES -DUSE_XSHM"
  976. ;;
  977. xyesno)
  978. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  979. if test "x$driglx_direct" = xyes; then
  980. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  981. fi
  982. ;;
  983. esac
  984. dnl
  985. dnl TLS detection
  986. dnl
  987. AC_ARG_ENABLE([glx-tls],
  988. [AS_HELP_STRING([--enable-glx-tls],
  989. [enable TLS support in GLX @<:@default=disabled@:>@])],
  990. [GLX_USE_TLS="$enableval"],
  991. [GLX_USE_TLS=no])
  992. AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
  993. AS_IF([test "x$GLX_USE_TLS" = xyes],
  994. [DEFINES="${DEFINES} -DGLX_USE_TLS -DPTHREADS"])
  995. dnl
  996. dnl More DRI setup
  997. dnl
  998. dnl Directory for DRI drivers
  999. AC_ARG_WITH([dri-driverdir],
  1000. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  1001. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  1002. [DRI_DRIVER_INSTALL_DIR="$withval"],
  1003. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  1004. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  1005. dnl Extra search path for DRI drivers
  1006. AC_ARG_WITH([dri-searchpath],
  1007. [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
  1008. [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
  1009. [DRI_DRIVER_SEARCH_DIR="$withval"],
  1010. [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
  1011. AC_SUBST([DRI_DRIVER_SEARCH_DIR])
  1012. dnl Which drivers to build - default is chosen by platform
  1013. AC_ARG_WITH([dri-drivers],
  1014. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  1015. [comma delimited DRI drivers list, e.g.
  1016. "swrast,i965,radeon" @<:@default=auto@:>@])],
  1017. [with_dri_drivers="$withval"],
  1018. [with_dri_drivers=yes])
  1019. if test "x$with_dri_drivers" = x; then
  1020. with_dri_drivers=no
  1021. fi
  1022. dnl If $with_dri_drivers is yes, directories will be added through
  1023. dnl platform checks
  1024. DRI_DIRS=""
  1025. case "$with_dri_drivers" in
  1026. no) ;;
  1027. yes)
  1028. # classic DRI drivers require FEATURE_GL to build
  1029. if test "x$enable_opengl" = xyes; then
  1030. DRI_DIRS="yes"
  1031. fi
  1032. ;;
  1033. *)
  1034. # verify the requested driver directories exist
  1035. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  1036. for driver in $dri_drivers; do
  1037. test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
  1038. AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
  1039. done
  1040. DRI_DIRS="$dri_drivers"
  1041. if test -n "$DRI_DIRS" -a "x$enable_opengl" != xyes; then
  1042. AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
  1043. fi
  1044. ;;
  1045. esac
  1046. dnl Set DRI_DIRS, DEFINES and LIB_DEPS
  1047. if test "x$enable_dri" = xyes; then
  1048. # Platform specific settings and drivers to build
  1049. case "$host_os" in
  1050. linux*)
  1051. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  1052. DEFINES="$DEFINES -DHAVE_ALIAS"
  1053. case "$host_cpu" in
  1054. x86_64)
  1055. # sis is missing because they have not be converted to use
  1056. # the new interface. i810 are missing because there is no
  1057. # x86-64 system where they could *ever* be used.
  1058. if test "x$DRI_DIRS" = "xyes"; then
  1059. DRI_DIRS="i915 i965 mach64 mga nouveau r128 r200 r300 r600 \
  1060. radeon savage tdfx unichrome swrast"
  1061. fi
  1062. ;;
  1063. powerpc*)
  1064. # Build only the drivers for cards that exist on PowerPC.
  1065. # At some point MGA will be added, but not yet.
  1066. if test "x$DRI_DIRS" = "xyes"; then
  1067. DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
  1068. fi
  1069. ;;
  1070. sparc*)
  1071. # Build only the drivers for cards that exist on sparc`
  1072. if test "x$DRI_DIRS" = "xyes"; then
  1073. DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
  1074. fi
  1075. ;;
  1076. esac
  1077. ;;
  1078. freebsd* | dragonfly* | *netbsd*)
  1079. DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
  1080. DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
  1081. if test "x$DRI_DIRS" = "xyes"; then
  1082. DRI_DIRS="i810 i915 i965 mach64 mga nouveau r128 r200 r300 r600 \
  1083. radeon tdfx unichrome savage sis swrast"
  1084. fi
  1085. ;;
  1086. gnu*)
  1087. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  1088. DEFINES="$DEFINES -DHAVE_ALIAS"
  1089. ;;
  1090. solaris*)
  1091. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  1092. ;;
  1093. cygwin*)
  1094. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  1095. if test "x$DRI_DIRS" = "xyes"; then
  1096. DRI_DIRS="swrast"
  1097. fi
  1098. ;;
  1099. esac
  1100. # default drivers
  1101. if test "x$DRI_DIRS" = "xyes"; then
  1102. DRI_DIRS="i810 i915 i965 mach64 mga nouveau r128 r200 r300 r600 radeon \
  1103. savage sis tdfx unichrome swrast"
  1104. fi
  1105. DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
  1106. # Check for expat
  1107. if test "x$enable_dri" = xyes; then
  1108. EXPAT_INCLUDES=""
  1109. EXPAT_LIB=-lexpat
  1110. AC_ARG_WITH([expat],
  1111. [AS_HELP_STRING([--with-expat=DIR],
  1112. [expat install directory])],[
  1113. EXPAT_INCLUDES="-I$withval/include"
  1114. CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
  1115. LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
  1116. EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
  1117. ])
  1118. AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
  1119. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  1120. [AC_MSG_ERROR([Expat required for DRI.])])
  1121. fi
  1122. # libdrm is required for all except swrast
  1123. if test -n "$DRI_DIRS" -a x"$DRI_DIRS" != xswrast; then
  1124. if test "x$have_libdrm" != xyes; then
  1125. AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED])
  1126. fi
  1127. fi
  1128. # put all the necessary libs together, including possibly libdricore
  1129. DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
  1130. fi
  1131. AC_SUBST([DRI_DIRS])
  1132. AC_SUBST([EXPAT_INCLUDES])
  1133. AC_SUBST([DRI_LIB_DEPS])
  1134. case $DRI_DIRS in
  1135. *i915*|*i965*)
  1136. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1137. ;;
  1138. esac
  1139. case $DRI_DIRS in
  1140. *nouveau*)
  1141. PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
  1142. ;;
  1143. esac
  1144. case $DRI_DIRS in
  1145. *radeon*|*r200*|*r300*|*r600*)
  1146. if test "x$HAVE_LIBDRM_RADEON" = xyes; then
  1147. RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
  1148. RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
  1149. fi
  1150. ;;
  1151. esac
  1152. AC_SUBST([RADEON_CFLAGS])
  1153. AC_SUBST([RADEON_LDFLAGS])
  1154. dnl
  1155. dnl OSMesa configuration
  1156. dnl
  1157. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  1158. AC_ARG_WITH([osmesa-bits],
  1159. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  1160. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  1161. [osmesa_bits="$withval"],
  1162. [osmesa_bits=8])
  1163. if test "x$osmesa_bits" != x8; then
  1164. if test "x$enable_dri" = xyes -o "x$enable_glx" = xyes; then
  1165. AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa driver])
  1166. osmesa_bits=8
  1167. fi
  1168. fi
  1169. case "x$osmesa_bits" in
  1170. x8)
  1171. OSMESA_LIB=OSMesa
  1172. ;;
  1173. x16|x32)
  1174. OSMESA_LIB="OSMesa$osmesa_bits"
  1175. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  1176. ;;
  1177. *)
  1178. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  1179. ;;
  1180. esac
  1181. AC_SUBST([OSMESA_LIB])
  1182. if test "x$enable_osmesa" = xyes; then
  1183. # only link libraries with osmesa if shared
  1184. if test "$enable_static" = no; then
  1185. OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  1186. else
  1187. OSMESA_LIB_DEPS=""
  1188. fi
  1189. OSMESA_MESA_DEPS=""
  1190. OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  1191. fi
  1192. AC_SUBST([OSMESA_LIB_DEPS])
  1193. AC_SUBST([OSMESA_MESA_DEPS])
  1194. AC_SUBST([OSMESA_PC_REQ])
  1195. AC_SUBST([OSMESA_PC_LIB_PRIV])
  1196. dnl
  1197. dnl EGL configuration
  1198. dnl
  1199. EGL_CLIENT_APIS=""
  1200. if test "x$enable_egl" = xyes; then
  1201. SRC_DIRS="$SRC_DIRS egl"
  1202. EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS -lpthread"
  1203. EGL_DRIVERS_DIRS=""
  1204. if test "$enable_static" != yes; then
  1205. # build egl_glx when libGL is built
  1206. if test "x$enable_glx" = xyes; then
  1207. EGL_DRIVERS_DIRS="glx"
  1208. fi
  1209. PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
  1210. [have_libudev=yes],[have_libudev=no])
  1211. if test "$have_libudev" = yes; then
  1212. DEFINES="$DEFINES -DHAVE_LIBUDEV"
  1213. fi
  1214. if test "x$enable_dri" = xyes; then
  1215. # build egl_dri2 when xcb-dri2 is available
  1216. PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
  1217. [have_xcb_dri2=yes],[have_xcb_dri2=no])
  1218. if test "$have_xcb_dri2" = yes; then
  1219. EGL_DRIVER_DRI2=dri2
  1220. DEFINES="$DEFINES -DHAVE_XCB_DRI2"
  1221. # workaround a bug in xcb-dri2 generated by xcb-proto 1.6
  1222. AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [],
  1223. [DEFINES="$DEFINES -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN"])
  1224. fi
  1225. fi
  1226. EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
  1227. fi
  1228. fi
  1229. AC_SUBST([EGL_LIB_DEPS])
  1230. AC_SUBST([EGL_DRIVERS_DIRS])
  1231. dnl
  1232. dnl gbm configuration
  1233. dnl
  1234. if test "x$enable_gbm" = xauto; then
  1235. case "$with_egl_platforms" in
  1236. *drm*)
  1237. enable_gbm=yes ;;
  1238. *)
  1239. enable_gbm=no ;;
  1240. esac
  1241. fi
  1242. if test "x$enable_gbm" = xyes; then
  1243. SRC_DIRS="$SRC_DIRS gbm"
  1244. GBM_BACKEND_DIRS=""
  1245. PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
  1246. AC_MSG_ERROR([gbm needs udev]))
  1247. GBM_LIB_DEPS="$DLOPEN_LIBS $LIBUDEV_LIBS"
  1248. if test "x$enable_dri" = xyes; then
  1249. GBM_BACKEND_DIRS="$GBM_BACKEND_DIRS dri"
  1250. if test "$SHARED_GLAPI" -eq 0; then
  1251. AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
  1252. fi
  1253. fi
  1254. fi
  1255. AC_SUBST([GBM_LIB_DEPS])
  1256. AC_SUBST([GBM_BACKEND_DIRS])
  1257. GBM_PC_REQ_PRIV="libudev"
  1258. GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
  1259. GBM_PC_CFLAGS=
  1260. AC_SUBST([GBM_PC_REQ_PRIV])
  1261. AC_SUBST([GBM_PC_LIB_PRIV])
  1262. AC_SUBST([GBM_PC_CFLAGS])
  1263. dnl
  1264. dnl EGL Gallium configuration
  1265. dnl
  1266. if test "x$enable_gallium_egl" = xyes; then
  1267. if test "x$with_gallium_drivers" = x; then
  1268. AC_MSG_ERROR([cannot enable egl_gallium without Gallium])
  1269. fi
  1270. if test "x$enable_egl" = xno; then
  1271. AC_MSG_ERROR([cannot enable egl_gallium without EGL])
  1272. fi
  1273. if test "x$have_libdrm" != xyes; then
  1274. AC_MSG_ERROR([egl_gallium requires libdrm >= $LIBDRM_REQUIRED])
  1275. fi
  1276. GALLIUM_STATE_TRACKERS_DIRS="egl $GALLIUM_STATE_TRACKERS_DIRS"
  1277. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-static"
  1278. HAVE_ST_EGL="yes"
  1279. fi
  1280. dnl
  1281. dnl gbm Gallium configuration
  1282. dnl
  1283. if test "x$enable_gallium_gbm" = xauto; then
  1284. case "$enable_gbm$HAVE_ST_EGL$with_egl_platforms" in
  1285. yesyes*drm*)
  1286. enable_gallium_gbm=yes ;;
  1287. *)
  1288. enable_gallium_gbm=no ;;
  1289. esac
  1290. fi
  1291. if test "x$enable_gallium_gbm" = xyes; then
  1292. if test "x$with_gallium_drivers" = x; then
  1293. AC_MSG_ERROR([cannot enable gbm_gallium without Gallium])
  1294. fi
  1295. if test "x$enable_gbm" = xno; then
  1296. AC_MSG_ERROR([cannot enable gbm_gallium without gbm])
  1297. fi
  1298. GALLIUM_STATE_TRACKERS_DIRS="gbm $GALLIUM_STATE_TRACKERS_DIRS"
  1299. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS gbm"
  1300. HAVE_ST_GBM="yes"
  1301. fi
  1302. dnl
  1303. dnl X.Org DDX configuration
  1304. dnl
  1305. if test "x$enable_xorg" = xyes; then
  1306. PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
  1307. PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
  1308. PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
  1309. PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
  1310. HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
  1311. HAVE_XEXTPROTO_71="no")
  1312. GALLIUM_STATE_TRACKERS_DIRS="xorg $GALLIUM_STATE_TRACKERS_DIRS"
  1313. HAVE_ST_XORG=yes
  1314. fi
  1315. dnl
  1316. dnl XA configuration
  1317. dnl
  1318. if test "x$enable_xa" = xyes; then
  1319. GALLIUM_STATE_TRACKERS_DIRS="xa $GALLIUM_STATE_TRACKERS_DIRS"
  1320. HAVE_ST_XA=yes
  1321. fi
  1322. dnl
  1323. dnl OpenVG configuration
  1324. dnl
  1325. VG_LIB_DEPS=""
  1326. if test "x$enable_openvg" = xyes; then
  1327. if test "x$enable_egl" = xno; then
  1328. AC_MSG_ERROR([cannot enable OpenVG without EGL])
  1329. fi
  1330. if test "x$with_gallium_drivers" = x; then
  1331. AC_MSG_ERROR([cannot enable OpenVG without Gallium])
  1332. fi
  1333. if test "x$enable_gallium_egl" = xno; then
  1334. AC_MSG_ERROR([cannot enable OpenVG without egl_gallium])
  1335. fi
  1336. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
  1337. VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS -lpthread"
  1338. CORE_DIRS="$CORE_DIRS mapi/vgapi"
  1339. GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS"
  1340. HAVE_ST_VEGA=yes
  1341. fi
  1342. dnl
  1343. dnl D3D1X configuration
  1344. dnl
  1345. if test "x$enable_d3d1x" = xyes; then
  1346. if test "x$with_gallium_drivers" = x; then
  1347. AC_MSG_ERROR([cannot enable D3D1X without Gallium])
  1348. fi
  1349. GALLIUM_STATE_TRACKERS_DIRS="d3d1x $GALLIUM_STATE_TRACKERS_DIRS"
  1350. HAVE_ST_D3D1X=yes
  1351. fi
  1352. dnl
  1353. dnl Gallium G3DVL configuration
  1354. dnl
  1355. AC_ARG_ENABLE([gallium-g3dvl],
  1356. [AS_HELP_STRING([--enable-gallium-g3dvl],
  1357. [build gallium g3dvl @<:@default=disabled@:>@])],
  1358. [enable_gallium_g3dvl="$enableval"],
  1359. [enable_gallium_g3dvl=no])
  1360. if test "x$enable_gallium_g3dvl" = xyes; then
  1361. if test "x$with_gallium_drivers" = x; then
  1362. AC_MSG_ERROR([cannot enable G3DVL without Gallium])
  1363. fi
  1364. if test "x$enable_xvmc" = xauto; then
  1365. PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no])
  1366. fi
  1367. if test "x$enable_vdpau" = xauto; then
  1368. PKG_CHECK_EXISTS([vdpau], [enable_vdpau=yes], [enable_vdpau=no])
  1369. fi
  1370. if test "x$enable_va" = xauto; then
  1371. #don't enable vaapi state tracker even if package exists
  1372. #PKG_CHECK_EXISTS([libva], [enable_vdpau=yes], [enable_vdpau=no])
  1373. enable_va=no
  1374. fi
  1375. fi
  1376. if test "x$enable_xvmc" = xyes; then
  1377. PKG_CHECK_MODULES([XVMC], [xvmc >= 1.0.6 xorg-server])
  1378. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg/xvmc"
  1379. HAVE_ST_XVMC="yes"
  1380. fi
  1381. if test "x$enable_vdpau" = xyes; then
  1382. PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.4.1])
  1383. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vdpau"
  1384. HAVE_ST_VDPAU="yes"
  1385. fi
  1386. if test "x$enable_va" = xyes; then
  1387. PKG_CHECK_MODULES([LIBVA], [libva = 0.31.1])
  1388. AC_MSG_WARN([vaapi state tracker currently unmaintained])
  1389. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS va"
  1390. HAVE_ST_VA="yes"
  1391. fi
  1392. dnl
  1393. dnl GLU configuration
  1394. dnl
  1395. AC_ARG_ENABLE([glu],
  1396. [AS_HELP_STRING([--disable-glu],
  1397. [enable OpenGL Utility library @<:@default=enabled@:>@])],
  1398. [enable_glu="$enableval"],
  1399. [enable_glu=yes])
  1400. if test "x$enable_glu" = xyes; then
  1401. if test "x$enable_glx" = xno -a "x$enable_osmesa" = xno; then
  1402. AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver])
  1403. enable_glu=no
  1404. fi
  1405. fi
  1406. if test "x$enable_glu" = xyes; then
  1407. SRC_DIRS="$SRC_DIRS glu"
  1408. if test "x$enable_glx" = xno; then
  1409. # Link libGLU to libOSMesa instead of libGL
  1410. GLU_LIB_DEPS=""
  1411. GLU_PC_REQ="osmesa"
  1412. if test "$enable_static" = no; then
  1413. GLU_MESA_DEPS='-l$(OSMESA_LIB)'
  1414. else
  1415. GLU_MESA_DEPS=""
  1416. fi
  1417. else
  1418. # If static, empty GLU_LIB_DEPS and add libs for programs to link
  1419. GLU_PC_REQ="gl"
  1420. GLU_PC_LIB_PRIV="-lm"
  1421. if test "$enable_static" = no; then
  1422. GLU_LIB_DEPS="-lm"
  1423. GLU_MESA_DEPS='-l$(GL_LIB)'
  1424. else
  1425. GLU_LIB_DEPS=""
  1426. GLU_MESA_DEPS=""
  1427. APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
  1428. fi
  1429. fi
  1430. fi
  1431. if test "$enable_static" = no; then
  1432. GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
  1433. fi
  1434. GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
  1435. AC_SUBST([GLU_LIB_DEPS])
  1436. AC_SUBST([GLU_MESA_DEPS])
  1437. AC_SUBST([GLU_PC_REQ])
  1438. AC_SUBST([GLU_PC_REQ_PRIV])
  1439. AC_SUBST([GLU_PC_LIB_PRIV])
  1440. AC_SUBST([GLU_PC_CFLAGS])
  1441. dnl
  1442. dnl GLw configuration
  1443. dnl
  1444. AC_ARG_ENABLE([glw],
  1445. [AS_HELP_STRING([--disable-glw],
  1446. [enable Xt/Motif widget library @<:@default=enabled@:>@])],
  1447. [enable_glw="$enableval"],
  1448. [enable_glw=yes])
  1449. dnl Don't build GLw on osmesa
  1450. if test "x$enable_glw" = xyes -a "x$enable_glx" = xno; then
  1451. AC_MSG_NOTICE([Disabling GLw since there is no OpenGL driver])
  1452. enable_glw=no
  1453. fi
  1454. AC_ARG_ENABLE([motif],
  1455. [AS_HELP_STRING([--enable-motif],
  1456. [use Motif widgets in GLw @<:@default=disabled@:>@])],
  1457. [enable_motif="$enableval"],
  1458. [enable_motif=no])
  1459. if test "x$enable_glw" = xyes; then
  1460. SRC_DIRS="$SRC_DIRS glw"
  1461. if test "$x11_pkgconfig" = yes; then
  1462. PKG_CHECK_MODULES([GLW],[x11 xt])
  1463. GLW_PC_REQ_PRIV="x11 xt"
  1464. GLW_LIB_DEPS="$GLW_LIBS"
  1465. else
  1466. # should check these...
  1467. GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
  1468. GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
  1469. GLW_PC_CFLAGS="$X11_INCLUDES"
  1470. fi
  1471. GLW_SOURCES="GLwDrawA.c"
  1472. MOTIF_CFLAGS=
  1473. if test "x$enable_motif" = xyes; then
  1474. GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
  1475. AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
  1476. if test "x$MOTIF_CONFIG" != xno; then
  1477. MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
  1478. MOTIF_LIBS=`$MOTIF_CONFIG --libs`
  1479. else
  1480. AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
  1481. [AC_MSG_ERROR([Can't locate Motif headers])])
  1482. AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
  1483. [AC_MSG_ERROR([Can't locate Motif Xm library])])
  1484. fi
  1485. # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
  1486. GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
  1487. GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
  1488. GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
  1489. fi
  1490. # If static, empty GLW_LIB_DEPS and add libs for programs to link
  1491. GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
  1492. if test "$enable_static" = no; then
  1493. GLW_MESA_DEPS='-l$(GL_LIB)'
  1494. GLW_LIB_DEPS="$GLW_LIB_DEPS"
  1495. else
  1496. APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
  1497. GLW_LIB_DEPS=""
  1498. GLW_MESA_DEPS=""
  1499. fi
  1500. fi
  1501. AC_SUBST([GLW_LIB_DEPS])
  1502. AC_SUBST([GLW_MESA_DEPS])
  1503. AC_SUBST([GLW_SOURCES])
  1504. AC_SUBST([MOTIF_CFLAGS])
  1505. AC_SUBST([GLW_PC_REQ_PRIV])
  1506. AC_SUBST([GLW_PC_LIB_PRIV])
  1507. AC_SUBST([GLW_PC_CFLAGS])
  1508. dnl
  1509. dnl Program library dependencies
  1510. dnl Only libm is added here if necessary as the libraries should
  1511. dnl be pulled in by the linker
  1512. dnl
  1513. if test "x$APP_LIB_DEPS" = x; then
  1514. case "$host_os" in
  1515. solaris*)
  1516. APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
  1517. ;;
  1518. cygwin*)
  1519. APP_LIB_DEPS="-lX11"
  1520. ;;
  1521. *)
  1522. APP_LIB_DEPS="-lm"
  1523. ;;
  1524. esac
  1525. fi
  1526. AC_SUBST([APP_LIB_DEPS])
  1527. AC_SUBST([PROGRAM_DIRS])
  1528. dnl
  1529. dnl Gallium configuration
  1530. dnl
  1531. if test "x$with_gallium_drivers" != x; then
  1532. SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
  1533. AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
  1534. else
  1535. LLVM_CONFIG=no
  1536. fi
  1537. AC_SUBST([LLVM_CFLAGS])
  1538. AC_SUBST([LLVM_LIBS])
  1539. AC_SUBST([LLVM_LDFLAGS])
  1540. AC_SUBST([LLVM_VERSION])
  1541. case "x$enable_opengl$enable_gles1$enable_gles2" in
  1542. x*yes*)
  1543. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
  1544. ;;
  1545. esac
  1546. AC_SUBST([VG_LIB_DEPS])
  1547. AC_SUBST([EGL_CLIENT_APIS])
  1548. AC_ARG_WITH([egl-platforms],
  1549. [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
  1550. [comma delimited native platforms libEGL supports, e.g.
  1551. "x11,drm" @<:@default=auto@:>@])],
  1552. [with_egl_platforms="$withval"],
  1553. [with_egl_platforms=yes])
  1554. EGL_PLATFORMS=""
  1555. WAYLAND_EGL_LIB_DEPS=""
  1556. case "$with_egl_platforms" in
  1557. yes)
  1558. if test "x$enable_egl" = xyes; then
  1559. EGL_PLATFORMS="x11"
  1560. fi
  1561. ;;
  1562. *)
  1563. if test "x$enable_egl" != xyes; then
  1564. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1565. fi
  1566. # verify the requested driver directories exist
  1567. egl_platforms=`IFS=', '; echo $with_egl_platforms`
  1568. for plat in $egl_platforms; do
  1569. test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
  1570. AC_MSG_ERROR([EGL platform '$plat' doesn't exist])
  1571. if test "$plat" = "fbdev"; then
  1572. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
  1573. fi
  1574. if test "$plat" = "wayland"; then
  1575. PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server],, \
  1576. [AC_MSG_ERROR([cannot find libwayland-client])])
  1577. WAYLAND_EGL_LIB_DEPS="$WAYLAND_LIBS $LIBDRM_LIBS"
  1578. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
  1579. fi
  1580. if test "$plat" = "drm" && test "x$enable_gbm" = "xno"; then
  1581. AC_MSG_ERROR([EGL platform drm needs gbm])
  1582. fi
  1583. case "$plat$have_libudev" in
  1584. waylandno|drmno)
  1585. AC_MSG_ERROR([cannot build $plat platfrom without udev]) ;;
  1586. esac
  1587. done
  1588. EGL_PLATFORMS="$egl_platforms"
  1589. ;;
  1590. esac
  1591. AC_SUBST([EGL_PLATFORMS])
  1592. AC_SUBST([WAYLAND_EGL_LIB_DEPS])
  1593. WAYLAND_EGL_PC_REQ_PRIV="wayland-client libdrm"
  1594. WAYLAND_EGL_PC_LIB_PRIV=
  1595. WAYLAND_EGL_PC_CFLAGS=
  1596. AC_SUBST([WAYLAND_EGL_PC_REQ_PRIV])
  1597. AC_SUBST([WAYLAND_EGL_PC_LIB_PRIV])
  1598. AC_SUBST([WAYLAND_EGL_PC_CFLAGS])
  1599. AC_ARG_WITH([egl-driver-dir],
  1600. [AS_HELP_STRING([--with-egl-driver-dir=DIR],
  1601. [directory for EGL drivers [[default=${libdir}/egl]]])],
  1602. [EGL_DRIVER_INSTALL_DIR="$withval"],
  1603. [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
  1604. AC_SUBST([EGL_DRIVER_INSTALL_DIR])
  1605. AC_ARG_WITH([xorg-driver-dir],
  1606. [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
  1607. [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
  1608. [XORG_DRIVER_INSTALL_DIR="$withval"],
  1609. [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
  1610. AC_SUBST([XORG_DRIVER_INSTALL_DIR])
  1611. AC_ARG_WITH([max-width],
  1612. [AS_HELP_STRING([--with-max-width=N],
  1613. [Maximum framebuffer width (4096)])],
  1614. [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
  1615. AS_IF([test "${withval}" -gt "4096"],
  1616. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1617. )
  1618. AC_ARG_WITH([max-height],
  1619. [AS_HELP_STRING([--with-max-height=N],
  1620. [Maximum framebuffer height (4096)])],
  1621. [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
  1622. AS_IF([test "${withval}" -gt "4096"],
  1623. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1624. )
  1625. dnl
  1626. dnl Gallium LLVM
  1627. dnl
  1628. AC_ARG_ENABLE([gallium-llvm],
  1629. [AS_HELP_STRING([--enable-gallium-llvm],
  1630. [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
  1631. [enable_gallium_llvm="$enableval"],
  1632. [enable_gallium_llvm=auto])
  1633. if test "x$with_gallium_drivers" = x; then
  1634. enable_gallium_llvm=no
  1635. fi
  1636. if test "x$enable_gallium_llvm" = xauto; then
  1637. case "$host_cpu" in
  1638. i*86|x86_64) enable_gallium_llvm=yes;;
  1639. esac
  1640. fi
  1641. if test "x$enable_gallium_llvm" = xyes; then
  1642. if test "x$LLVM_CONFIG" != xno; then
  1643. LLVM_VERSION=`$LLVM_CONFIG --version`
  1644. LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed 's/-DNDEBUG\>//g'`
  1645. LLVM_LIBS="`$LLVM_CONFIG --libs` -lstdc++"
  1646. LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
  1647. DEFINES="$DEFINES -D__STDC_CONSTANT_MACROS"
  1648. MESA_LLVM=1
  1649. else
  1650. MESA_LLVM=0
  1651. fi
  1652. else
  1653. MESA_LLVM=0
  1654. fi
  1655. dnl Directory for VDPAU libs
  1656. AC_ARG_WITH([vdpau-libdir],
  1657. [AS_HELP_STRING([--with-vdpau-libdir=DIR],
  1658. [directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
  1659. [VDPAU_LIB_INSTALL_DIR="$withval"],
  1660. [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
  1661. AC_SUBST([VDPAU_LIB_INSTALL_DIR])
  1662. dnl Directory for VA libs
  1663. AC_ARG_WITH([va-libdir],
  1664. [AS_HELP_STRING([--with-va-libdir=DIR],
  1665. [directory for the VA libraries @<:@default=${libdir}/va@:>@])],
  1666. [VA_LIB_INSTALL_DIR="$withval"],
  1667. [VA_LIB_INSTALL_DIR='${libdir}/va'])
  1668. AC_SUBST([VA_LIB_INSTALL_DIR])
  1669. dnl
  1670. dnl Gallium helper functions
  1671. dnl
  1672. gallium_check_st() {
  1673. if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes ||
  1674. test "x$HAVE_ST_XA" = xyes || test "x$HAVE_ST_XVMC" = xyes ||
  1675. test "x$HAVE_ST_VDPAU" = xyes || test "x$HAVE_ST_VA" = xyes; then
  1676. if test "x$have_libdrm" != xyes; then
  1677. AC_MSG_ERROR([DRI or Xorg DDX requires libdrm >= $LIBDRM_REQUIRED])
  1678. fi
  1679. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
  1680. fi
  1681. if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
  1682. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
  1683. fi
  1684. if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
  1685. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
  1686. fi
  1687. if test "x$HAVE_ST_XA" = xyes && test "x$4" != x; then
  1688. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
  1689. fi
  1690. if test "x$HAVE_ST_XVMC" = xyes && test "x$5" != x; then
  1691. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $5"
  1692. NEED_G3DVL_DRI="yes"
  1693. fi
  1694. if test "x$HAVE_ST_VDPAU" = xyes && test "x$6" != x; then
  1695. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $6"
  1696. NEED_G3DVL_DRI="yes"
  1697. fi
  1698. if test "x$HAVE_ST_VA" = xyes && test "x$7" != x; then
  1699. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $7"
  1700. NEED_G3DVL_DRI="yes"
  1701. fi
  1702. }
  1703. gallium_require_llvm() {
  1704. if test "x$MESA_LLVM" = x0; then
  1705. case "$host_cpu" in
  1706. i*86|x86_64) AC_MSG_ERROR([LLVM is required to build $1 on x86 and x86_64]);;
  1707. esac
  1708. fi
  1709. }
  1710. dnl Gallium drivers
  1711. dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
  1712. if test "x$with_gallium_drivers" != x; then
  1713. gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
  1714. for driver in $gallium_drivers; do
  1715. case "x$driver" in
  1716. xsvga)
  1717. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
  1718. gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx" "xa-vmwgfx"
  1719. ;;
  1720. xi915)
  1721. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1722. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 softpipe"
  1723. if test "x$MESA_LLVM" = x1; then
  1724. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
  1725. fi
  1726. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
  1727. gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
  1728. ;;
  1729. xi965)
  1730. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1731. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965 softpipe"
  1732. if test "x$MESA_LLVM" = x1; then
  1733. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
  1734. fi
  1735. gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
  1736. ;;
  1737. xr300)
  1738. gallium_require_llvm "Gallium R300"
  1739. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1740. gallium_check_st "radeon/drm" "dri-r300" "xorg-r300" "" "xvmc-r300" "vdpau-r300" "va-r300"
  1741. ;;
  1742. xr600)
  1743. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
  1744. gallium_check_st "r600/drm" "dri-r600" "" "" "xvmc-r600" "vdpau-r600" "va-r600"
  1745. ;;
  1746. xnouveau)
  1747. PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
  1748. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0"
  1749. gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" "" "xvmc-nouveau"
  1750. ;;
  1751. xswrast)
  1752. if test "x$HAVE_ST_DRI" = xyes; then
  1753. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS softpipe"
  1754. if test "x$MESA_LLVM" = x1; then
  1755. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
  1756. fi
  1757. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
  1758. fi
  1759. if test "x$HAVE_ST_VDPAU" = xyes; then
  1760. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS vdpau-softpipe"
  1761. fi
  1762. if test "x$HAVE_ST_XVMC" = xyes; then
  1763. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS xvmc-softpipe"
  1764. fi
  1765. if test "x$HAVE_ST_VA" = xyes; then
  1766. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS va-softpipe"
  1767. fi
  1768. if test "x$HAVE_ST_VDPAU" == xyes ||
  1769. test "x$HAVE_ST_XVMC" == xyes ||
  1770. test "x$HAVE_ST_VA" == xyes; then
  1771. if test "x$HAVE_WINSYS_XLIB" != xyes; then
  1772. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
  1773. fi
  1774. if test "x$HAVE_ST_DRI" != xyes; then
  1775. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS softpipe"
  1776. fi
  1777. fi
  1778. ;;
  1779. *)
  1780. AC_MSG_ERROR([Unknown Gallium driver: $driver])
  1781. ;;
  1782. esac
  1783. done
  1784. fi
  1785. if test "x$NEED_G3DVL_DRI" = xyes; then
  1786. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS g3dvl/dri"
  1787. fi
  1788. dnl prepend CORE_DIRS to SRC_DIRS
  1789. SRC_DIRS="$CORE_DIRS $SRC_DIRS"
  1790. dnl Restore LDFLAGS and CPPFLAGS
  1791. LDFLAGS="$_SAVE_LDFLAGS"
  1792. CPPFLAGS="$_SAVE_CPPFLAGS"
  1793. dnl Add user CFLAGS and CXXFLAGS
  1794. CFLAGS="$CFLAGS $USER_CFLAGS"
  1795. CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
  1796. dnl Substitute the config
  1797. AC_CONFIG_FILES([configs/autoconf])
  1798. dnl Replace the configs/current symlink
  1799. AC_CONFIG_COMMANDS([configs],[
  1800. if test -f configs/current || test -L configs/current; then
  1801. rm -f configs/current
  1802. fi
  1803. ln -s autoconf configs/current
  1804. ])
  1805. dnl Sort the dirs alphabetically
  1806. GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort|tr "\n" " "`
  1807. GALLIUM_WINSYS_DIRS=`echo $GALLIUM_WINSYS_DIRS|tr " " "\n"|sort|tr "\n" " "`
  1808. GALLIUM_DRIVERS_DIRS=`echo $GALLIUM_DRIVERS_DIRS|tr " " "\n"|sort|tr "\n" " "`
  1809. GALLIUM_STATE_TRACKERS_DIRS=`echo $GALLIUM_STATE_TRACKERS_DIRS|tr " " "\n"|sort|tr "\n" " "`
  1810. AC_OUTPUT
  1811. dnl
  1812. dnl Output some configuration info for the user
  1813. dnl
  1814. echo ""
  1815. echo " prefix: $prefix"
  1816. echo " exec_prefix: $exec_prefix"
  1817. echo " libdir: $libdir"
  1818. echo " includedir: $includedir"
  1819. dnl API info
  1820. echo ""
  1821. echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
  1822. echo " OpenVG: $enable_openvg"
  1823. dnl Driver info
  1824. echo ""
  1825. if test "x$enable_osmesa" != xno; then
  1826. echo " OSMesa: lib$OSMESA_LIB"
  1827. else
  1828. echo " OSMesa: no"
  1829. fi
  1830. if test "x$enable_dri" != xno; then
  1831. # cleanup the drivers var
  1832. dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1833. if test "x$DRI_DIRS" = x; then
  1834. echo " DRI drivers: no"
  1835. else
  1836. echo " DRI drivers: $dri_dirs"
  1837. fi
  1838. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  1839. echo " Shared dricore: $enable_dricore"
  1840. fi
  1841. case "x$enable_glx$enable_xlib_glx" in
  1842. xyesyes)
  1843. echo " GLX: Xlib-based"
  1844. ;;
  1845. xyesno)
  1846. echo " GLX: DRI-based"
  1847. echo " Use XCB: $enable_xcb"
  1848. ;;
  1849. *)
  1850. echo " GLX: $enable_glx"
  1851. ;;
  1852. esac
  1853. echo ""
  1854. echo " GLU: $enable_glu"
  1855. echo " GLw: $enable_glw (Motif: $enable_motif)"
  1856. dnl EGL
  1857. echo ""
  1858. echo " EGL: $enable_egl"
  1859. if test "$enable_egl" = yes; then
  1860. echo " EGL platforms: $EGL_PLATFORMS"
  1861. egl_drivers=""
  1862. for d in $EGL_DRIVERS_DIRS; do
  1863. egl_drivers="$egl_drivers builtin:egl_$d"
  1864. done
  1865. if test "x$HAVE_ST_EGL" = xyes; then
  1866. echo " EGL drivers: ${egl_drivers} egl_gallium"
  1867. echo " EGL Gallium STs:$EGL_CLIENT_APIS"
  1868. else
  1869. echo " EGL drivers: $egl_drivers"
  1870. fi
  1871. fi
  1872. echo ""
  1873. if test "x$MESA_LLVM" = x1; then
  1874. echo " llvm: yes"
  1875. echo " llvm-config: $LLVM_CONFIG"
  1876. echo " llvm-version: $LLVM_VERSION"
  1877. else
  1878. echo " llvm: no"
  1879. fi
  1880. echo ""
  1881. if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
  1882. echo " Gallium: yes"
  1883. echo " Gallium dirs: $GALLIUM_DIRS"
  1884. echo " Target dirs: $GALLIUM_TARGET_DIRS"
  1885. echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
  1886. echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
  1887. echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
  1888. else
  1889. echo " Gallium: no"
  1890. fi
  1891. dnl Libraries
  1892. echo ""
  1893. echo " Shared libs: $enable_shared"
  1894. echo " Static libs: $enable_static"
  1895. dnl Compiler options
  1896. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  1897. cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1898. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1899. cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1900. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1901. defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1902. echo ""
  1903. echo " CFLAGS: $cflags"
  1904. echo " CXXFLAGS: $cxxflags"
  1905. echo " Macros: $defines"
  1906. echo ""
  1907. echo " PYTHON2: $PYTHON2"
  1908. echo ""
  1909. echo " Run '${MAKE-make}' to build Mesa"
  1910. echo ""