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

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