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.

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