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

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