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

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