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

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