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

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