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

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