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

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