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

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