Clone of mesa.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

configure.ac 50KB

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