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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631
  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. dnl See if posix_memalign is available
  377. AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
  378. dnl SELinux awareness.
  379. AC_ARG_ENABLE([selinux],
  380. [AS_HELP_STRING([--enable-selinux],
  381. [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
  382. [MESA_SELINUX="$enableval"],
  383. [MESA_SELINUX=no])
  384. if test "x$enable_selinux" = "xyes"; then
  385. AC_CHECK_HEADER([selinux/selinux.h],[],
  386. [AC_MSG_ERROR([SELinux headers not found])])
  387. AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
  388. [AC_MSG_ERROR([SELinux library not found])])
  389. SELINUX_LIBS="-lselinux"
  390. DEFINES="$DEFINES -DMESA_SELINUX"
  391. fi
  392. dnl
  393. dnl Driver configuration. Options are xlib, dri and osmesa right now.
  394. dnl More later: fbdev, ...
  395. dnl
  396. default_driver="xlib"
  397. case "$host_os" in
  398. linux*)
  399. case "$host_cpu" in
  400. i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
  401. esac
  402. ;;
  403. *freebsd* | dragonfly*)
  404. case "$host_cpu" in
  405. i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
  406. esac
  407. ;;
  408. esac
  409. AC_ARG_WITH([driver],
  410. [AS_HELP_STRING([--with-driver=DRIVER],
  411. [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
  412. [mesa_driver="$withval"],
  413. [mesa_driver="$default_driver"])
  414. dnl Check for valid option
  415. case "x$mesa_driver" in
  416. xxlib|xdri|xosmesa)
  417. ;;
  418. *)
  419. AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
  420. ;;
  421. esac
  422. dnl
  423. dnl Driver specific build directories
  424. dnl
  425. dnl this variable will be prepended to SRC_DIRS and is not exported
  426. CORE_DIRS="mapi/glapi glsl mesa"
  427. SRC_DIRS=""
  428. GLU_DIRS="sgi"
  429. GALLIUM_DIRS="auxiliary drivers state_trackers"
  430. GALLIUM_TARGET_DIRS=""
  431. GALLIUM_WINSYS_DIRS="sw"
  432. GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug identity"
  433. GALLIUM_STATE_TRACKERS_DIRS=""
  434. case "$mesa_driver" in
  435. xlib)
  436. DRIVER_DIRS="x11"
  437. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
  438. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
  439. ;;
  440. dri)
  441. SRC_DIRS="$SRC_DIRS glx"
  442. DRIVER_DIRS="dri"
  443. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri"
  444. ;;
  445. osmesa)
  446. DRIVER_DIRS="osmesa"
  447. ;;
  448. esac
  449. AC_SUBST([SRC_DIRS])
  450. AC_SUBST([GLU_DIRS])
  451. AC_SUBST([DRIVER_DIRS])
  452. AC_SUBST([GALLIUM_DIRS])
  453. AC_SUBST([GALLIUM_TARGET_DIRS])
  454. AC_SUBST([GALLIUM_WINSYS_DIRS])
  455. AC_SUBST([GALLIUM_DRIVERS_DIRS])
  456. AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
  457. AC_SUBST([MESA_LLVM])
  458. dnl
  459. dnl Find out if X is available. The variable have_x is set if libX11 is
  460. dnl found to mimic AC_PATH_XTRA.
  461. dnl
  462. if test -n "$PKG_CONFIG"; then
  463. AC_MSG_CHECKING([pkg-config files for X11 are available])
  464. PKG_CHECK_EXISTS([x11],[
  465. x11_pkgconfig=yes
  466. have_x=yes
  467. ],[
  468. x11_pkgconfig=no
  469. ])
  470. AC_MSG_RESULT([$x11_pkgconfig])
  471. else
  472. x11_pkgconfig=no
  473. fi
  474. dnl Use the autoconf macro if no pkg-config files
  475. if test "$x11_pkgconfig" = yes; then
  476. PKG_CHECK_MODULES([X11], [x11])
  477. else
  478. AC_PATH_XTRA
  479. test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
  480. test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
  481. AC_SUBST([X11_CFLAGS])
  482. AC_SUBST([X11_LIBS])
  483. fi
  484. dnl Try to tell the user that the --x-* options are only used when
  485. dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
  486. m4_divert_once([HELP_BEGIN],
  487. [These options are only used when the X libraries cannot be found by the
  488. pkg-config utility.])
  489. dnl We need X for xlib and dri, so bomb now if it's not found
  490. case "$mesa_driver" in
  491. xlib|dri)
  492. if test "$no_x" = yes; then
  493. AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
  494. fi
  495. ;;
  496. esac
  497. dnl XCB - this is only used for GLX right now
  498. AC_ARG_ENABLE([xcb],
  499. [AS_HELP_STRING([--enable-xcb],
  500. [use XCB for GLX @<:@default=disabled@:>@])],
  501. [enable_xcb="$enableval"],
  502. [enable_xcb=no])
  503. if test "x$enable_xcb" = xyes; then
  504. DEFINES="$DEFINES -DUSE_XCB"
  505. else
  506. enable_xcb=no
  507. fi
  508. dnl
  509. dnl libGL configuration per driver
  510. dnl
  511. case "$mesa_driver" in
  512. xlib)
  513. if test "$x11_pkgconfig" = yes; then
  514. PKG_CHECK_MODULES([XLIBGL], [x11 xext])
  515. GL_PC_REQ_PRIV="x11 xext"
  516. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  517. GL_LIB_DEPS="$XLIBGL_LIBS"
  518. else
  519. # should check these...
  520. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  521. GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
  522. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  523. GL_PC_CFLAGS="$X11_INCLUDES"
  524. fi
  525. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
  526. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
  527. # if static, move the external libraries to the programs
  528. # and empty the libraries for libGL
  529. if test "$enable_static" = yes; then
  530. APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
  531. GL_LIB_DEPS=""
  532. fi
  533. ;;
  534. dri)
  535. # DRI must be shared, I think
  536. if test "$enable_static" = yes; then
  537. AC_MSG_ERROR([Can't use static libraries for DRI drivers])
  538. fi
  539. # Check for libdrm
  540. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
  541. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  542. PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
  543. GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
  544. DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
  545. # find the DRI deps for libGL
  546. if test "$x11_pkgconfig" = yes; then
  547. # add xcb modules if necessary
  548. dri_modules="x11 xext xxf86vm xdamage xfixes"
  549. if test "$enable_xcb" = yes; then
  550. dri_modules="$dri_modules x11-xcb xcb-glx"
  551. fi
  552. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  553. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  554. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  555. GL_LIB_DEPS="$DRIGL_LIBS"
  556. else
  557. # should check these...
  558. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  559. GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
  560. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  561. GL_PC_CFLAGS="$X11_INCLUDES"
  562. # XCB can only be used from pkg-config
  563. if test "$enable_xcb" = yes; then
  564. PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
  565. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
  566. X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
  567. GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
  568. fi
  569. fi
  570. # need DRM libs, -lpthread, etc.
  571. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  572. GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  573. GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  574. GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  575. GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  576. GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  577. ;;
  578. osmesa)
  579. # No libGL for osmesa
  580. GL_LIB_DEPS=""
  581. ;;
  582. esac
  583. AC_SUBST([GL_LIB_DEPS])
  584. AC_SUBST([GL_PC_REQ_PRIV])
  585. AC_SUBST([GL_PC_LIB_PRIV])
  586. AC_SUBST([GL_PC_CFLAGS])
  587. AC_SUBST([DRI_PC_REQ_PRIV])
  588. AC_SUBST([GLESv1_LIB_DEPS])
  589. AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
  590. AC_SUBST([GLESv2_LIB_DEPS])
  591. AC_SUBST([GLESv2_PC_LIB_PRIV])
  592. dnl
  593. dnl More X11 setup
  594. dnl
  595. if test "$mesa_driver" = xlib; then
  596. DEFINES="$DEFINES -DUSE_XSHM"
  597. fi
  598. dnl
  599. dnl More DRI setup
  600. dnl
  601. AC_ARG_ENABLE([glx-tls],
  602. [AS_HELP_STRING([--enable-glx-tls],
  603. [enable TLS support in GLX @<:@default=disabled@:>@])],
  604. [GLX_USE_TLS="$enableval"],
  605. [GLX_USE_TLS=no])
  606. dnl Directory for DRI drivers
  607. AC_ARG_WITH([dri-driverdir],
  608. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  609. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  610. [DRI_DRIVER_INSTALL_DIR="$withval"],
  611. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  612. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  613. dnl Extra search path for DRI drivers
  614. AC_ARG_WITH([dri-searchpath],
  615. [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
  616. [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
  617. [DRI_DRIVER_SEARCH_DIR="$withval"],
  618. [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
  619. AC_SUBST([DRI_DRIVER_SEARCH_DIR])
  620. dnl Direct rendering or just indirect rendering
  621. AC_ARG_ENABLE([driglx-direct],
  622. [AS_HELP_STRING([--disable-driglx-direct],
  623. [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
  624. [driglx_direct="$enableval"],
  625. [driglx_direct="yes"])
  626. dnl Which drivers to build - default is chosen by platform
  627. AC_ARG_WITH([dri-drivers],
  628. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  629. [comma delimited DRI drivers list, e.g.
  630. "swrast,i965,radeon" @<:@default=auto@:>@])],
  631. [with_dri_drivers="$withval"],
  632. [with_dri_drivers=yes])
  633. if test "x$with_dri_drivers" = x; then
  634. with_dri_drivers=no
  635. fi
  636. dnl Determine which APIs to support
  637. AC_ARG_ENABLE([opengl],
  638. [AS_HELP_STRING([--disable-opengl],
  639. [disable support for standard OpenGL API @<:@default=no@:>@])],
  640. [enable_opengl="$enableval"],
  641. [enable_opengl=yes])
  642. AC_ARG_ENABLE([gles1],
  643. [AS_HELP_STRING([--enable-gles1],
  644. [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
  645. [enable_gles1="$enableval"],
  646. [enable_gles1=no])
  647. AC_ARG_ENABLE([gles2],
  648. [AS_HELP_STRING([--enable-gles2],
  649. [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
  650. [enable_gles2="$enableval"],
  651. [enable_gles2=no])
  652. AC_ARG_ENABLE([gles-overlay],
  653. [AS_HELP_STRING([--enable-gles-overlay],
  654. [build separate OpenGL ES only libraries @<:@default=no@:>@])],
  655. [enable_gles_overlay="$enableval"],
  656. [enable_gles_overlay=no])
  657. API_DEFINES=""
  658. GLES_OVERLAY=0
  659. if test "x$enable_opengl" = xno; then
  660. API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
  661. else
  662. API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
  663. fi
  664. if test "x$enable_gles1" = xyes; then
  665. API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
  666. fi
  667. if test "x$enable_gles2" = xyes; then
  668. API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
  669. fi
  670. if test "x$enable_gles_overlay" = xyes -o \
  671. "x$enable_gles1" = xyes -o "x$enable_gles2" = xyes; then
  672. CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
  673. if test "x$enable_gles_overlay" = xyes; then
  674. GLES_OVERLAY=1
  675. fi
  676. fi
  677. AC_SUBST([API_DEFINES])
  678. AC_SUBST([GLES_OVERLAY])
  679. dnl If $with_dri_drivers is yes, directories will be added through
  680. dnl platform checks
  681. DRI_DIRS=""
  682. case "$with_dri_drivers" in
  683. no) ;;
  684. yes)
  685. DRI_DIRS="yes"
  686. ;;
  687. *)
  688. # verify the requested driver directories exist
  689. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  690. for driver in $dri_drivers; do
  691. test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
  692. AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
  693. done
  694. DRI_DIRS="$dri_drivers"
  695. ;;
  696. esac
  697. dnl Set DRI_DIRS, DEFINES and LIB_DEPS
  698. if test "$mesa_driver" = dri; then
  699. # Use TLS in GLX?
  700. if test "x$GLX_USE_TLS" = xyes; then
  701. DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
  702. fi
  703. # Platform specific settings and drivers to build
  704. case "$host_os" in
  705. linux*)
  706. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  707. if test "x$driglx_direct" = xyes; then
  708. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  709. fi
  710. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  711. case "$host_cpu" in
  712. x86_64)
  713. # sis is missing because they have not be converted to use
  714. # the new interface. i810 are missing because there is no
  715. # x86-64 system where they could *ever* be used.
  716. if test "x$DRI_DIRS" = "xyes"; then
  717. DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  718. savage tdfx unichrome swrast"
  719. fi
  720. ;;
  721. powerpc*)
  722. # Build only the drivers for cards that exist on PowerPC.
  723. # At some point MGA will be added, but not yet.
  724. if test "x$DRI_DIRS" = "xyes"; then
  725. DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
  726. fi
  727. ;;
  728. sparc*)
  729. # Build only the drivers for cards that exist on sparc`
  730. if test "x$DRI_DIRS" = "xyes"; then
  731. DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
  732. fi
  733. ;;
  734. esac
  735. ;;
  736. freebsd* | dragonfly*)
  737. DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
  738. DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
  739. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  740. if test "x$driglx_direct" = xyes; then
  741. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  742. fi
  743. if test "x$GXX" = xyes; then
  744. CXXFLAGS="$CXXFLAGS -ansi -pedantic"
  745. fi
  746. if test "x$DRI_DIRS" = "xyes"; then
  747. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
  748. unichrome savage sis swrast"
  749. fi
  750. ;;
  751. gnu*)
  752. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  753. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  754. ;;
  755. solaris*)
  756. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  757. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  758. if test "x$driglx_direct" = xyes; then
  759. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  760. fi
  761. ;;
  762. esac
  763. # default drivers
  764. if test "x$DRI_DIRS" = "xyes"; then
  765. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  766. savage sis tdfx unichrome swrast"
  767. fi
  768. DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
  769. # Check for expat
  770. EXPAT_INCLUDES=""
  771. EXPAT_LIB=-lexpat
  772. AC_ARG_WITH([expat],
  773. [AS_HELP_STRING([--with-expat=DIR],
  774. [expat install directory])],[
  775. EXPAT_INCLUDES="-I$withval/include"
  776. CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
  777. LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
  778. EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
  779. ])
  780. AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
  781. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  782. [AC_MSG_ERROR([Expat required for DRI.])])
  783. # put all the necessary libs together
  784. DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
  785. fi
  786. AC_SUBST([DRI_DIRS])
  787. AC_SUBST([EXPAT_INCLUDES])
  788. AC_SUBST([DRI_LIB_DEPS])
  789. case $DRI_DIRS in
  790. *i915*|*i965*)
  791. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= 2.4.21])
  792. ;;
  793. esac
  794. case $DRI_DIRS in
  795. *radeon*|*r200*|*r300*|*r600*)
  796. PKG_CHECK_MODULES([LIBDRM_RADEON],
  797. [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
  798. HAVE_LIBDRM_RADEON=yes,
  799. HAVE_LIBDRM_RADEON=no)
  800. if test "$HAVE_LIBDRM_RADEON" = yes; then
  801. RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
  802. RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
  803. fi
  804. ;;
  805. esac
  806. AC_SUBST([RADEON_CFLAGS])
  807. AC_SUBST([RADEON_LDFLAGS])
  808. dnl
  809. dnl OSMesa configuration
  810. dnl
  811. if test "$mesa_driver" = xlib; then
  812. default_gl_osmesa=yes
  813. else
  814. default_gl_osmesa=no
  815. fi
  816. AC_ARG_ENABLE([gl-osmesa],
  817. [AS_HELP_STRING([--enable-gl-osmesa],
  818. [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])],
  819. [gl_osmesa="$enableval"],
  820. [gl_osmesa="$default_gl_osmesa"])
  821. if test "x$gl_osmesa" = xyes; then
  822. if test "$mesa_driver" = osmesa; then
  823. AC_MSG_ERROR([libGL is not available for OSMesa driver])
  824. else
  825. DRIVER_DIRS="$DRIVER_DIRS osmesa"
  826. fi
  827. fi
  828. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  829. AC_ARG_WITH([osmesa-bits],
  830. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  831. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  832. [osmesa_bits="$withval"],
  833. [osmesa_bits=8])
  834. if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
  835. AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
  836. osmesa_bits=8
  837. fi
  838. case "x$osmesa_bits" in
  839. x8)
  840. OSMESA_LIB=OSMesa
  841. ;;
  842. x16|x32)
  843. OSMESA_LIB="OSMesa$osmesa_bits"
  844. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  845. ;;
  846. *)
  847. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  848. ;;
  849. esac
  850. AC_SUBST([OSMESA_LIB])
  851. case "$DRIVER_DIRS" in
  852. *osmesa*)
  853. # only link libraries with osmesa if shared
  854. if test "$enable_static" = no; then
  855. OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  856. else
  857. OSMESA_LIB_DEPS=""
  858. fi
  859. OSMESA_MESA_DEPS=""
  860. OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  861. ;;
  862. esac
  863. AC_SUBST([OSMESA_LIB_DEPS])
  864. AC_SUBST([OSMESA_MESA_DEPS])
  865. AC_SUBST([OSMESA_PC_REQ])
  866. AC_SUBST([OSMESA_PC_LIB_PRIV])
  867. dnl
  868. dnl EGL configuration
  869. dnl
  870. AC_ARG_ENABLE([egl],
  871. [AS_HELP_STRING([--disable-egl],
  872. [disable EGL library @<:@default=enabled@:>@])],
  873. [enable_egl="$enableval"],
  874. [enable_egl=yes])
  875. if test "x$enable_egl" = xyes; then
  876. SRC_DIRS="$SRC_DIRS egl"
  877. EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
  878. EGL_DRIVERS_DIRS=""
  879. if test "$enable_static" != yes; then
  880. # build egl_glx when libGL is built
  881. if test "$mesa_driver" != osmesa; then
  882. EGL_DRIVERS_DIRS="glx"
  883. fi
  884. # build egl_dri2 when xcb-dri2 is available
  885. PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
  886. [have_xcb_dri2=yes],[have_xcb_dri2=no])
  887. PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
  888. [have_libudev=yes],[have_libudev=no])
  889. if test "$have_xcb_dri2" = yes; then
  890. EGL_DRIVER_DRI2=dri2
  891. DEFINES="$DEFINES -DHAVE_XCB_DRI2"
  892. if test "$have_libudev" = yes; then
  893. DEFINES="$DEFINES -DHAVE_LIBUDEV"
  894. fi
  895. fi
  896. EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
  897. fi
  898. fi
  899. AC_SUBST([EGL_LIB_DEPS])
  900. AC_SUBST([EGL_DRIVERS_DIRS])
  901. dnl
  902. dnl GLU configuration
  903. dnl
  904. AC_ARG_ENABLE([glu],
  905. [AS_HELP_STRING([--disable-glu],
  906. [enable OpenGL Utility library @<:@default=enabled@:>@])],
  907. [enable_glu="$enableval"],
  908. [enable_glu=yes])
  909. if test "x$enable_glu" = xyes; then
  910. SRC_DIRS="$SRC_DIRS glu"
  911. case "$mesa_driver" in
  912. osmesa)
  913. # Link libGLU to libOSMesa instead of libGL
  914. GLU_LIB_DEPS=""
  915. GLU_PC_REQ="osmesa"
  916. if test "$enable_static" = no; then
  917. GLU_MESA_DEPS='-l$(OSMESA_LIB)'
  918. else
  919. GLU_MESA_DEPS=""
  920. fi
  921. ;;
  922. *)
  923. # If static, empty GLU_LIB_DEPS and add libs for programs to link
  924. GLU_PC_REQ="gl"
  925. GLU_PC_LIB_PRIV="-lm"
  926. if test "$enable_static" = no; then
  927. GLU_LIB_DEPS="-lm"
  928. GLU_MESA_DEPS='-l$(GL_LIB)'
  929. else
  930. GLU_LIB_DEPS=""
  931. GLU_MESA_DEPS=""
  932. APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
  933. fi
  934. ;;
  935. esac
  936. fi
  937. if test "$enable_static" = no; then
  938. GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
  939. fi
  940. GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
  941. AC_SUBST([GLU_LIB_DEPS])
  942. AC_SUBST([GLU_MESA_DEPS])
  943. AC_SUBST([GLU_PC_REQ])
  944. AC_SUBST([GLU_PC_REQ_PRIV])
  945. AC_SUBST([GLU_PC_LIB_PRIV])
  946. AC_SUBST([GLU_PC_CFLAGS])
  947. dnl
  948. dnl GLw configuration
  949. dnl
  950. AC_ARG_ENABLE([glw],
  951. [AS_HELP_STRING([--disable-glw],
  952. [enable Xt/Motif widget library @<:@default=enabled@:>@])],
  953. [enable_glw="$enableval"],
  954. [enable_glw=yes])
  955. dnl Don't build GLw on osmesa
  956. if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
  957. AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
  958. enable_glw=no
  959. fi
  960. AC_ARG_ENABLE([motif],
  961. [AS_HELP_STRING([--enable-motif],
  962. [use Motif widgets in GLw @<:@default=disabled@:>@])],
  963. [enable_motif="$enableval"],
  964. [enable_motif=no])
  965. if test "x$enable_glw" = xyes; then
  966. SRC_DIRS="$SRC_DIRS glw"
  967. if test "$x11_pkgconfig" = yes; then
  968. PKG_CHECK_MODULES([GLW],[x11 xt])
  969. GLW_PC_REQ_PRIV="x11 xt"
  970. GLW_LIB_DEPS="$GLW_LIBS"
  971. else
  972. # should check these...
  973. GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
  974. GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
  975. GLW_PC_CFLAGS="$X11_INCLUDES"
  976. fi
  977. GLW_SOURCES="GLwDrawA.c"
  978. MOTIF_CFLAGS=
  979. if test "x$enable_motif" = xyes; then
  980. GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
  981. AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
  982. if test "x$MOTIF_CONFIG" != xno; then
  983. MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
  984. MOTIF_LIBS=`$MOTIF_CONFIG --libs`
  985. else
  986. AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
  987. [AC_MSG_ERROR([Can't locate Motif headers])])
  988. AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
  989. [AC_MSG_ERROR([Can't locate Motif Xm library])])
  990. fi
  991. # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
  992. GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
  993. GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
  994. GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
  995. fi
  996. # If static, empty GLW_LIB_DEPS and add libs for programs to link
  997. GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
  998. if test "$enable_static" = no; then
  999. GLW_MESA_DEPS='-l$(GL_LIB)'
  1000. GLW_LIB_DEPS="$GLW_LIB_DEPS"
  1001. else
  1002. APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
  1003. GLW_LIB_DEPS=""
  1004. GLW_MESA_DEPS=""
  1005. fi
  1006. fi
  1007. AC_SUBST([GLW_LIB_DEPS])
  1008. AC_SUBST([GLW_MESA_DEPS])
  1009. AC_SUBST([GLW_SOURCES])
  1010. AC_SUBST([MOTIF_CFLAGS])
  1011. AC_SUBST([GLW_PC_REQ_PRIV])
  1012. AC_SUBST([GLW_PC_LIB_PRIV])
  1013. AC_SUBST([GLW_PC_CFLAGS])
  1014. dnl
  1015. dnl GLUT configuration
  1016. dnl
  1017. if test -f "$srcdir/include/GL/glut.h"; then
  1018. default_glut=yes
  1019. else
  1020. default_glut=no
  1021. fi
  1022. AC_ARG_ENABLE([glut],
  1023. [AS_HELP_STRING([--disable-glut],
  1024. [enable GLUT library @<:@default=enabled if source available@:>@])],
  1025. [enable_glut="$enableval"],
  1026. [enable_glut="$default_glut"])
  1027. dnl Can't build glut if GLU not available
  1028. if test "x$enable_glu$enable_glut" = xnoyes; then
  1029. AC_MSG_WARN([Disabling glut since GLU is disabled])
  1030. enable_glut=no
  1031. fi
  1032. dnl Don't build glut on osmesa
  1033. if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
  1034. AC_MSG_WARN([Disabling glut since the driver is OSMesa])
  1035. enable_glut=no
  1036. fi
  1037. if test "x$enable_glut" = xyes; then
  1038. SRC_DIRS="$SRC_DIRS glut/glx"
  1039. if test "$x11_pkgconfig" = yes; then
  1040. PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
  1041. GLUT_PC_REQ_PRIV="x11 xmu xi"
  1042. GLUT_LIB_DEPS="$GLUT_LIBS"
  1043. else
  1044. # should check these...
  1045. GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
  1046. GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
  1047. GLUT_PC_CFLAGS="$X11_INCLUDES"
  1048. fi
  1049. if test "x$GCC" = xyes; then
  1050. GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
  1051. fi
  1052. GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
  1053. GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
  1054. # If static, empty GLUT_LIB_DEPS and add libs for programs to link
  1055. if test "$enable_static" = no; then
  1056. GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
  1057. else
  1058. APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
  1059. GLUT_LIB_DEPS=""
  1060. GLUT_MESA_DEPS=""
  1061. fi
  1062. fi
  1063. AC_SUBST([GLUT_LIB_DEPS])
  1064. AC_SUBST([GLUT_MESA_DEPS])
  1065. AC_SUBST([GLUT_CFLAGS])
  1066. AC_SUBST([GLUT_PC_REQ_PRIV])
  1067. AC_SUBST([GLUT_PC_LIB_PRIV])
  1068. AC_SUBST([GLUT_PC_CFLAGS])
  1069. dnl
  1070. dnl Program library dependencies
  1071. dnl Only libm is added here if necessary as the libraries should
  1072. dnl be pulled in by the linker
  1073. dnl
  1074. if test "x$APP_LIB_DEPS" = x; then
  1075. case "$host_os" in
  1076. solaris*)
  1077. APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
  1078. ;;
  1079. cygwin*)
  1080. APP_LIB_DEPS="-lX11"
  1081. ;;
  1082. *)
  1083. APP_LIB_DEPS="-lm"
  1084. ;;
  1085. esac
  1086. fi
  1087. AC_SUBST([APP_LIB_DEPS])
  1088. AC_SUBST([PROGRAM_DIRS])
  1089. dnl
  1090. dnl Gallium configuration
  1091. dnl
  1092. AC_ARG_ENABLE([gallium],
  1093. [AS_HELP_STRING([--disable-gallium],
  1094. [build gallium @<:@default=enabled@:>@])],
  1095. [enable_gallium="$enableval"],
  1096. [enable_gallium=yes])
  1097. if test "x$enable_gallium" = xyes; then
  1098. SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
  1099. AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
  1100. [HAS_UDIS86="no"])
  1101. AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
  1102. fi
  1103. AC_SUBST([LLVM_CFLAGS])
  1104. AC_SUBST([LLVM_LIBS])
  1105. AC_SUBST([LLVM_LDFLAGS])
  1106. AC_SUBST([LLVM_VERSION])
  1107. VG_LIB_DEPS=""
  1108. EGL_CLIENT_APIS='$(GL_LIB)'
  1109. if test "x$enable_gles_overlay" = xyes; then
  1110. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
  1111. fi
  1112. dnl
  1113. dnl Gallium state trackers configuration
  1114. dnl
  1115. AC_ARG_WITH([state-trackers],
  1116. [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
  1117. [comma delimited state_trackers list, e.g.
  1118. "egl,glx" @<:@default=auto@:>@])],
  1119. [with_state_trackers="$withval"],
  1120. [with_state_trackers=yes])
  1121. case "$with_state_trackers" in
  1122. no)
  1123. GALLIUM_STATE_TRACKERS_DIRS=""
  1124. ;;
  1125. yes)
  1126. # look at what else is built
  1127. case "$mesa_driver" in
  1128. xlib)
  1129. GALLIUM_STATE_TRACKERS_DIRS=glx
  1130. ;;
  1131. dri)
  1132. GALLIUM_STATE_TRACKERS_DIRS="dri"
  1133. HAVE_ST_DRI="yes"
  1134. if test "x$enable_egl" = xyes; then
  1135. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
  1136. HAVE_ST_EGL="yes"
  1137. fi
  1138. # Have only tested st/xorg on 1.6.0 servers
  1139. PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
  1140. HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
  1141. HAVE_ST_XORG="no")
  1142. ;;
  1143. esac
  1144. ;;
  1145. *)
  1146. # verify the requested state tracker exist
  1147. state_trackers=""
  1148. _state_trackers=`IFS=', '; echo $with_state_trackers`
  1149. for tracker in $_state_trackers; do
  1150. case "$tracker" in
  1151. dri)
  1152. if test "x$mesa_driver" != xdri; then
  1153. AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
  1154. fi
  1155. HAVE_ST_DRI="yes"
  1156. ;;
  1157. egl)
  1158. if test "x$enable_egl" != xyes; then
  1159. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1160. fi
  1161. HAVE_ST_EGL="yes"
  1162. ;;
  1163. xorg)
  1164. PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
  1165. PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
  1166. PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
  1167. HAVE_ST_XORG="yes"
  1168. ;;
  1169. es)
  1170. AC_MSG_WARN([state tracker 'es' has been replaced by --enable-gles-overlay])
  1171. if test "x$enable_gles_overlay" != xyes; then
  1172. if test "x$enable_gles1" != xyes -a "x$enable_gles2" != xyes; then
  1173. CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
  1174. fi
  1175. GLES_OVERLAY=1
  1176. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
  1177. fi
  1178. tracker=""
  1179. ;;
  1180. vega)
  1181. CORE_DIRS="$CORE_DIRS mapi/vgapi"
  1182. VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
  1183. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
  1184. ;;
  1185. esac
  1186. if test -n "$tracker"; then
  1187. test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
  1188. AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
  1189. if test -n "$state_trackers"; then
  1190. state_trackers="$state_trackers $tracker"
  1191. else
  1192. state_trackers="$tracker"
  1193. fi
  1194. fi
  1195. done
  1196. GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
  1197. ;;
  1198. esac
  1199. AC_SUBST([VG_LIB_DEPS])
  1200. AC_SUBST([EGL_CLIENT_APIS])
  1201. if test "x$HAVE_ST_EGL" = xyes; then
  1202. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
  1203. # define GLX_DIRECT_RENDERING even when the driver is not dri
  1204. if test "x$mesa_driver" != xdri -a "x$driglx_direct" = xyes; then
  1205. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  1206. fi
  1207. fi
  1208. if test "x$HAVE_ST_XORG" = xyes; then
  1209. PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
  1210. HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
  1211. HAVE_XEXTPROTO_71="no")
  1212. fi
  1213. AC_ARG_WITH([egl-platforms],
  1214. [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
  1215. [comma delimited native platforms libEGL supports, e.g.
  1216. "x11,kms" @<:@default=auto@:>@])],
  1217. [with_egl_platforms="$withval"],
  1218. [with_egl_platforms=yes])
  1219. AC_ARG_WITH([egl-displays],
  1220. [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
  1221. [DEPRECATED. Use --with-egl-platforms instead])],
  1222. [with_egl_platforms="$withval"])
  1223. EGL_PLATFORMS=""
  1224. case "$with_egl_platforms" in
  1225. yes)
  1226. if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
  1227. EGL_PLATFORMS="x11"
  1228. fi
  1229. ;;
  1230. *)
  1231. if test "x$enable_egl" != xyes; then
  1232. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1233. fi
  1234. # verify the requested driver directories exist
  1235. egl_platforms=`IFS=', '; echo $with_egl_platforms`
  1236. for plat in $egl_platforms; do
  1237. test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
  1238. AC_MSG_ERROR([EGL platform '$plat' does't exist])
  1239. if test "$plat" = "fbdev"; then
  1240. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
  1241. fi
  1242. done
  1243. EGL_PLATFORMS="$egl_platforms"
  1244. ;;
  1245. esac
  1246. AC_SUBST([EGL_PLATFORMS])
  1247. AC_ARG_WITH([egl-driver-dir],
  1248. [AS_HELP_STRING([--with-egl-driver-dir=DIR],
  1249. [directory for EGL drivers [[default=${libdir}/egl]]])],
  1250. [EGL_DRIVER_INSTALL_DIR="$withval"],
  1251. [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
  1252. AC_SUBST([EGL_DRIVER_INSTALL_DIR])
  1253. AC_ARG_WITH([xorg-driver-dir],
  1254. [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
  1255. [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
  1256. [XORG_DRIVER_INSTALL_DIR="$withval"],
  1257. [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
  1258. AC_SUBST([XORG_DRIVER_INSTALL_DIR])
  1259. AC_ARG_WITH([max-width],
  1260. [AS_HELP_STRING([--with-max-width=N],
  1261. [Maximum framebuffer width (4096)])],
  1262. [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
  1263. AS_IF([test "${withval}" -gt "4096"],
  1264. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1265. )
  1266. AC_ARG_WITH([max-height],
  1267. [AS_HELP_STRING([--with-max-height=N],
  1268. [Maximum framebuffer height (4096)])],
  1269. [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
  1270. AS_IF([test "${withval}" -gt "4096"],
  1271. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1272. )
  1273. dnl
  1274. dnl Gallium LLVM
  1275. dnl
  1276. AC_ARG_ENABLE([gallium-llvm],
  1277. [AS_HELP_STRING([--enable-gallium-llvm],
  1278. [build gallium LLVM support @<:@default=disabled@:>@])],
  1279. [enable_gallium_llvm="$enableval"],
  1280. [enable_gallium_llvm=auto])
  1281. if test "x$enable_gallium_llvm" = xyes; then
  1282. if test "x$LLVM_CONFIG" != xno; then
  1283. LLVM_VERSION=`$LLVM_CONFIG --version`
  1284. LLVM_CFLAGS=`$LLVM_CONFIG --cflags`
  1285. LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
  1286. if test "x$HAS_UDIS86" != xno; then
  1287. LLVM_LIBS="$LLVM_LIBS -ludis86"
  1288. DEFINES="$DEFINES -DHAVE_UDIS86"
  1289. fi
  1290. LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
  1291. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
  1292. DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
  1293. MESA_LLVM=1
  1294. else
  1295. MESA_LLVM=0
  1296. fi
  1297. else
  1298. MESA_LLVM=0
  1299. fi
  1300. dnl
  1301. dnl Gallium helper functions
  1302. dnl
  1303. gallium_check_st() {
  1304. if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then
  1305. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
  1306. fi
  1307. if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
  1308. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
  1309. fi
  1310. if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
  1311. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
  1312. fi
  1313. }
  1314. dnl
  1315. dnl Gallium SVGA configuration
  1316. dnl
  1317. AC_ARG_ENABLE([gallium-svga],
  1318. [AS_HELP_STRING([--enable-gallium-svga],
  1319. [build gallium SVGA @<:@default=disabled@:>@])],
  1320. [enable_gallium_svga="$enableval"],
  1321. [enable_gallium_svga=auto])
  1322. if test "x$enable_gallium_svga" = xyes; then
  1323. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
  1324. gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
  1325. elif test "x$enable_gallium_svga" = xauto; then
  1326. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
  1327. fi
  1328. dnl
  1329. dnl Gallium i915 configuration
  1330. dnl
  1331. AC_ARG_ENABLE([gallium-i915],
  1332. [AS_HELP_STRING([--enable-gallium-i915],
  1333. [build gallium i915 @<:@default=disabled@:>@])],
  1334. [enable_gallium_i915="$enableval"],
  1335. [enable_gallium_i915=auto])
  1336. if test "x$enable_gallium_i915" = xyes; then
  1337. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
  1338. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
  1339. gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
  1340. elif test "x$enable_gallium_i915" = xauto; then
  1341. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
  1342. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
  1343. fi
  1344. dnl
  1345. dnl Gallium i965 configuration
  1346. dnl
  1347. AC_ARG_ENABLE([gallium-i965],
  1348. [AS_HELP_STRING([--enable-gallium-i965],
  1349. [build gallium i965 @<:@default=disabled@:>@])],
  1350. [enable_gallium_i965="$enableval"],
  1351. [enable_gallium_i965=auto])
  1352. if test "x$enable_gallium_i965" = xyes; then
  1353. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
  1354. gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
  1355. elif test "x$enable_gallium_i965" = xauto; then
  1356. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
  1357. fi
  1358. dnl
  1359. dnl Gallium Radeon configuration
  1360. dnl
  1361. AC_ARG_ENABLE([gallium-radeon],
  1362. [AS_HELP_STRING([--enable-gallium-radeon],
  1363. [build gallium radeon @<:@default=disabled@:>@])],
  1364. [enable_gallium_radeon="$enableval"],
  1365. [enable_gallium_radeon=auto])
  1366. if test "x$enable_gallium_radeon" = xyes; then
  1367. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1368. gallium_check_st "radeon/drm" "dri-radeong" "xorg-radeon"
  1369. elif test "x$enable_gallium_radeon" = xauto; then
  1370. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1371. fi
  1372. dnl
  1373. dnl Gallium Radeon r600g configuration
  1374. dnl
  1375. AC_ARG_ENABLE([gallium-r600],
  1376. [AS_HELP_STRING([--enable-gallium-r600],
  1377. [build gallium radeon @<:@default=disabled@:>@])],
  1378. [enable_gallium_r600="$enableval"],
  1379. [enable_gallium_r600=auto])
  1380. if test "x$enable_gallium_r600" = xyes; then
  1381. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
  1382. gallium_check_st "r600/drm" "dri-r600"
  1383. fi
  1384. dnl
  1385. dnl Gallium Nouveau configuration
  1386. dnl
  1387. AC_ARG_ENABLE([gallium-nouveau],
  1388. [AS_HELP_STRING([--enable-gallium-nouveau],
  1389. [build gallium nouveau @<:@default=disabled@:>@])],
  1390. [enable_gallium_nouveau="$enableval"],
  1391. [enable_gallium_nouveau=no])
  1392. if test "x$enable_gallium_nouveau" = xyes; then
  1393. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50"
  1394. gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
  1395. fi
  1396. dnl
  1397. dnl Gallium swrast configuration
  1398. dnl
  1399. AC_ARG_ENABLE([gallium-swrast],
  1400. [AS_HELP_STRING([--enable-gallium-swrast],
  1401. [build gallium swrast @<:@default=auto@:>@])],
  1402. [enable_gallium_swrast="$enableval"],
  1403. [enable_gallium_swrast=auto])
  1404. if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
  1405. if test "x$HAVE_ST_DRI" = xyes; then
  1406. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
  1407. fi
  1408. fi
  1409. dnl prepend CORE_DIRS to SRC_DIRS
  1410. SRC_DIRS="$CORE_DIRS $SRC_DIRS"
  1411. dnl Restore LDFLAGS and CPPFLAGS
  1412. LDFLAGS="$_SAVE_LDFLAGS"
  1413. CPPFLAGS="$_SAVE_CPPFLAGS"
  1414. dnl Substitute the config
  1415. AC_CONFIG_FILES([configs/autoconf])
  1416. dnl Replace the configs/current symlink
  1417. AC_CONFIG_COMMANDS([configs],[
  1418. if test -f configs/current || test -L configs/current; then
  1419. rm -f configs/current
  1420. fi
  1421. ln -s autoconf configs/current
  1422. ])
  1423. AC_OUTPUT
  1424. dnl
  1425. dnl Output some configuration info for the user
  1426. dnl
  1427. echo ""
  1428. echo " prefix: $prefix"
  1429. echo " exec_prefix: $exec_prefix"
  1430. echo " libdir: $libdir"
  1431. echo " includedir: $includedir"
  1432. dnl Driver info
  1433. echo ""
  1434. echo " Driver: $mesa_driver"
  1435. if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
  1436. echo " OSMesa: lib$OSMESA_LIB"
  1437. else
  1438. echo " OSMesa: no"
  1439. fi
  1440. if test "$mesa_driver" = dri; then
  1441. # cleanup the drivers var
  1442. dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1443. if test "x$DRI_DIRS" = x; then
  1444. echo " DRI drivers: no"
  1445. else
  1446. echo " DRI drivers: $dri_dirs"
  1447. fi
  1448. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  1449. fi
  1450. echo " Use XCB: $enable_xcb"
  1451. echo ""
  1452. if test "x$MESA_LLVM" = x1; then
  1453. echo " llvm: yes"
  1454. echo " llvm-config: $LLVM_CONFIG"
  1455. echo " llvm-version: $LLVM_VERSION"
  1456. else
  1457. echo " llvm: no"
  1458. fi
  1459. echo ""
  1460. if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
  1461. echo " Gallium: yes"
  1462. echo " Gallium dirs: $GALLIUM_DIRS"
  1463. echo " Target dirs: $GALLIUM_TARGET_DIRS"
  1464. echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
  1465. echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
  1466. echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
  1467. if test "x$HAVE_ST_EGL" = xyes; then
  1468. echo " EGL client APIs: $EGL_CLIENT_APIS"
  1469. fi
  1470. else
  1471. echo " Gallium: no"
  1472. fi
  1473. dnl Libraries
  1474. echo ""
  1475. echo " Shared libs: $enable_shared"
  1476. echo " Static libs: $enable_static"
  1477. if test "$enable_egl" = yes; then
  1478. echo " EGL: $EGL_DRIVERS_DIRS"
  1479. echo " EGL platforms: $EGL_PLATFORMS"
  1480. else
  1481. echo " EGL: no"
  1482. fi
  1483. echo " GLU: $enable_glu"
  1484. echo " GLw: $enable_glw (Motif: $enable_motif)"
  1485. echo " glut: $enable_glut"
  1486. dnl Compiler options
  1487. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  1488. cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1489. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1490. cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1491. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1492. defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1493. echo ""
  1494. echo " CFLAGS: $cflags"
  1495. echo " CXXFLAGS: $cxxflags"
  1496. echo " Macros: $defines"
  1497. echo ""
  1498. echo " Run '${MAKE-make}' to build Mesa"
  1499. echo ""