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

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