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

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