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

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