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

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