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

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