Clone of mesa.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

configure.ac 48KB

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