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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
  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'])])
  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.3
  17. DRI2PROTO_REQUIRED=1.99.3
  18. dnl Check for progs
  19. AC_PROG_CPP
  20. AC_PROG_CC
  21. AC_PROG_CXX
  22. AC_CHECK_PROGS([MAKE], [gmake make])
  23. AC_PATH_PROG([MKDEP], [makedepend])
  24. AC_PATH_PROG([SED], [sed])
  25. dnl We need a POSIX shell for parts of the build. Assume we have one
  26. dnl in most cases.
  27. case "$host_os" in
  28. solaris*)
  29. # Solaris /bin/sh is too old/non-POSIX compliant
  30. AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
  31. SHELL="$POSIX_SHELL"
  32. ;;
  33. esac
  34. MKDEP_OPTIONS=-fdepend
  35. dnl Ask gcc where it's keeping its secret headers
  36. if test "x$GCC" = xyes; then
  37. for dir in include include-fixed; do
  38. GCC_INCLUDES=`$CC -print-file-name=$dir`
  39. if test "x$GCC_INCLUDES" != x && \
  40. test "$GCC_INCLUDES" != "$dir" && \
  41. test -d "$GCC_INCLUDES"; then
  42. MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
  43. fi
  44. done
  45. fi
  46. AC_SUBST([MKDEP_OPTIONS])
  47. dnl Make sure the pkg-config macros are defined
  48. m4_ifndef([PKG_PROG_PKG_CONFIG],
  49. [m4_fatal([Could not locate the pkg-config autoconf macros.
  50. These are usually located in /usr/share/aclocal/pkg.m4. If your macros
  51. are in a different location, try setting the environment variable
  52. ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
  53. PKG_PROG_PKG_CONFIG()
  54. dnl LIB_DIR - library basename
  55. LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
  56. AC_SUBST([LIB_DIR])
  57. dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
  58. _SAVE_LDFLAGS="$LDFLAGS"
  59. AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
  60. AC_SUBST([EXTRA_LIB_PATH])
  61. dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
  62. _SAVE_CPPFLAGS="$CPPFLAGS"
  63. AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
  64. AC_SUBST([X11_INCLUDES])
  65. dnl Compiler macros
  66. DEFINES=""
  67. AC_SUBST([DEFINES])
  68. case "$host_os" in
  69. linux*|*-gnu*|gnu*)
  70. DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
  71. ;;
  72. solaris*)
  73. DEFINES="$DEFINES -DPTHREADS -DSVR4"
  74. ;;
  75. esac
  76. dnl Add flags for gcc and g++
  77. if test "x$GCC" = xyes; then
  78. CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
  79. # Work around aliasing bugs - developers should comment this out
  80. CFLAGS="$CFLAGS -fno-strict-aliasing"
  81. fi
  82. if test "x$GXX" = xyes; then
  83. CXXFLAGS="$CXXFLAGS -Wall"
  84. # Work around aliasing bugs - developers should comment this out
  85. CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
  86. fi
  87. dnl These should be unnecessary, but let the user set them if they want
  88. AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
  89. Default is to use CFLAGS.])
  90. AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
  91. compiler. Default is to use CFLAGS.])
  92. AC_SUBST([OPT_FLAGS])
  93. AC_SUBST([ARCH_FLAGS])
  94. dnl
  95. dnl Hacks to enable 32 or 64 bit build
  96. dnl
  97. AC_ARG_ENABLE([32-bit],
  98. [AS_HELP_STRING([--enable-32-bit],
  99. [build 32-bit libraries @<:@default=auto@:>@])],
  100. [enable_32bit="$enableval"],
  101. [enable_32bit=auto]
  102. )
  103. if test "x$enable_32bit" = xyes; then
  104. if test "x$GCC" = xyes; then
  105. CFLAGS="$CFLAGS -m32"
  106. fi
  107. if test "x$GXX" = xyes; then
  108. CXXFLAGS="$CXXFLAGS -m32"
  109. fi
  110. fi
  111. AC_ARG_ENABLE([64-bit],
  112. [AS_HELP_STRING([--enable-64-bit],
  113. [build 64-bit libraries @<:@default=auto@:>@])],
  114. [enable_64bit="$enableval"],
  115. [enable_64bit=auto]
  116. )
  117. if test "x$enable_64bit" = xyes; then
  118. if test "x$GCC" = xyes; then
  119. CFLAGS="$CFLAGS -m64"
  120. fi
  121. if test "x$GXX" = xyes; then
  122. CXXFLAGS="$CXXFLAGS -m64"
  123. fi
  124. fi
  125. dnl
  126. dnl shared/static libraries, mimic libtool options
  127. dnl
  128. AC_ARG_ENABLE([static],
  129. [AS_HELP_STRING([--enable-static],
  130. [build static libraries @<:@default=disabled@:>@])],
  131. [enable_static="$enableval"],
  132. [enable_static=no]
  133. )
  134. case "x$enable_static" in
  135. xyes|xno ) ;;
  136. x ) enable_static=no ;;
  137. * )
  138. AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
  139. ;;
  140. esac
  141. AC_ARG_ENABLE([shared],
  142. [AS_HELP_STRING([--disable-shared],
  143. [build shared libraries @<:@default=enabled@:>@])],
  144. [enable_shared="$enableval"],
  145. [enable_shared=yes]
  146. )
  147. case "x$enable_shared" in
  148. xyes|xno ) ;;
  149. x ) enable_shared=yes ;;
  150. * )
  151. AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
  152. ;;
  153. esac
  154. dnl Can't have static and shared libraries, default to static if user
  155. dnl explicitly requested. If both disabled, set to static since shared
  156. dnl was explicitly requirested.
  157. case "x$enable_static$enable_shared" in
  158. xyesyes )
  159. AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
  160. enable_shared=no
  161. ;;
  162. xnono )
  163. AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
  164. enable_static=yes
  165. ;;
  166. esac
  167. dnl
  168. dnl mklib options
  169. dnl
  170. AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
  171. if test "$enable_static" = yes; then
  172. MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
  173. fi
  174. AC_SUBST([MKLIB_OPTIONS])
  175. dnl
  176. dnl other compiler options
  177. dnl
  178. AC_ARG_ENABLE([debug],
  179. [AS_HELP_STRING([--enable-debug],
  180. [use debug compiler flags and macros @<:@default=disabled@:>@])],
  181. [enable_debug="$enableval"],
  182. [enable_debug=no]
  183. )
  184. if test "x$enable_debug" = xyes; then
  185. DEFINES="$DEFINES -DDEBUG"
  186. if test "x$GCC" = xyes; then
  187. CFLAGS="$CFLAGS -g"
  188. fi
  189. if test "x$GXX" = xyes; then
  190. CXXFLAGS="$CXXFLAGS -g"
  191. fi
  192. fi
  193. dnl
  194. dnl library names
  195. dnl
  196. if test "$enable_static" = yes; then
  197. LIB_EXTENSION='a'
  198. else
  199. case "$host_os" in
  200. darwin* )
  201. LIB_EXTENSION='dylib' ;;
  202. * )
  203. LIB_EXTENSION='so' ;;
  204. esac
  205. fi
  206. GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
  207. GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
  208. GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
  209. GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
  210. OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
  211. GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
  212. GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
  213. GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
  214. GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
  215. OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
  216. AC_SUBST([GL_LIB_NAME])
  217. AC_SUBST([GLU_LIB_NAME])
  218. AC_SUBST([GLUT_LIB_NAME])
  219. AC_SUBST([GLW_LIB_NAME])
  220. AC_SUBST([OSMESA_LIB_NAME])
  221. AC_SUBST([GL_LIB_GLOB])
  222. AC_SUBST([GLU_LIB_GLOB])
  223. AC_SUBST([GLUT_LIB_GLOB])
  224. AC_SUBST([GLW_LIB_GLOB])
  225. AC_SUBST([OSMESA_LIB_GLOB])
  226. dnl
  227. dnl Arch/platform-specific settings
  228. dnl
  229. AC_ARG_ENABLE([asm],
  230. [AS_HELP_STRING([--disable-asm],
  231. [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
  232. [enable_asm="$enableval"],
  233. [enable_asm=yes]
  234. )
  235. asm_arch=""
  236. ASM_FLAGS=""
  237. MESA_ASM_SOURCES=""
  238. GLAPI_ASM_SOURCES=""
  239. AC_MSG_CHECKING([whether to enable assembly])
  240. test "x$enable_asm" = xno && AC_MSG_RESULT([no])
  241. # disable if cross compiling on x86/x86_64 since we must run gen_matypes
  242. if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
  243. case "$host_cpu" in
  244. i?86 | x86_64)
  245. enable_asm=no
  246. AC_MSG_RESULT([no, cross compiling])
  247. ;;
  248. esac
  249. fi
  250. # check for supported arches
  251. if test "x$enable_asm" = xyes; then
  252. case "$host_cpu" in
  253. i?86)
  254. case "$host_os" in
  255. linux* | *freebsd* | dragonfly*)
  256. test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
  257. ;;
  258. esac
  259. ;;
  260. x86_64)
  261. case "$host_os" in
  262. linux* | *freebsd* | dragonfly*)
  263. test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
  264. ;;
  265. esac
  266. ;;
  267. powerpc)
  268. case "$host_os" in
  269. linux*)
  270. asm_arch=ppc
  271. ;;
  272. esac
  273. ;;
  274. sparc*)
  275. case "$host_os" in
  276. linux*)
  277. asm_arch=sparc
  278. ;;
  279. esac
  280. ;;
  281. esac
  282. case "$asm_arch" in
  283. x86)
  284. ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
  285. MESA_ASM_SOURCES='$(X86_SOURCES)'
  286. GLAPI_ASM_SOURCES='$(X86_API)'
  287. AC_MSG_RESULT([yes, x86])
  288. ;;
  289. x86_64)
  290. ASM_FLAGS="-DUSE_X86_64_ASM"
  291. MESA_ASM_SOURCES='$(X86-64_SOURCES)'
  292. GLAPI_ASM_SOURCES='$(X86-64_API)'
  293. AC_MSG_RESULT([yes, x86_64])
  294. ;;
  295. ppc)
  296. ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
  297. MESA_ASM_SOURCES='$(PPC_SOURCES)'
  298. AC_MSG_RESULT([yes, ppc])
  299. ;;
  300. sparc)
  301. ASM_FLAGS="-DUSE_SPARC_ASM"
  302. MESA_ASM_SOURCES='$(SPARC_SOURCES)'
  303. GLAPI_ASM_SOURCES='$(SPARC_API)'
  304. AC_MSG_RESULT([yes, sparc])
  305. ;;
  306. *)
  307. AC_MSG_RESULT([no, platform not supported])
  308. ;;
  309. esac
  310. fi
  311. AC_SUBST([ASM_FLAGS])
  312. AC_SUBST([MESA_ASM_SOURCES])
  313. AC_SUBST([GLAPI_ASM_SOURCES])
  314. dnl PIC code macro
  315. MESA_PIC_FLAGS
  316. dnl Check to see if dlopen is in default libraries (like Solaris, which
  317. dnl has it in libc), or if libdl is needed to get it.
  318. AC_CHECK_FUNC([dlopen], [],
  319. [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
  320. dnl See if posix_memalign is available
  321. AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
  322. dnl SELinux awareness.
  323. AC_ARG_ENABLE([selinux],
  324. [AS_HELP_STRING([--enable-selinux],
  325. [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
  326. [MESA_SELINUX="$enableval"],
  327. [MESA_SELINUX=no])
  328. if test "x$enable_selinux" = "xyes"; then
  329. AC_CHECK_HEADER([selinux/selinux.h],[],
  330. [AC_MSG_ERROR([SELinux headers not found])])
  331. AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
  332. [AC_MSG_ERROR([SELinux library not found])])
  333. SELINUX_LIBS="-lselinux"
  334. DEFINES="$DEFINES -DMESA_SELINUX"
  335. fi
  336. dnl
  337. dnl Driver configuration. Options are xlib, dri and osmesa right now.
  338. dnl More later: directfb, fbdev, ...
  339. dnl
  340. default_driver="xlib"
  341. case "$host_os" in
  342. linux*)
  343. case "$host_cpu" in
  344. i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
  345. esac
  346. ;;
  347. *freebsd* | dragonfly*)
  348. case "$host_cpu" in
  349. i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
  350. esac
  351. ;;
  352. esac
  353. AC_ARG_WITH([driver],
  354. [AS_HELP_STRING([--with-driver=DRIVER],
  355. [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
  356. [mesa_driver="$withval"],
  357. [mesa_driver="$default_driver"])
  358. dnl Check for valid option
  359. case "x$mesa_driver" in
  360. xxlib|xdri|xosmesa)
  361. ;;
  362. *)
  363. AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
  364. ;;
  365. esac
  366. dnl
  367. dnl Driver specific build directories
  368. dnl
  369. SRC_DIRS="mesa glew"
  370. GLU_DIRS="sgi"
  371. WINDOW_SYSTEM=""
  372. GALLIUM_DIRS="auxiliary drivers state_trackers"
  373. GALLIUM_WINSYS_DIRS=""
  374. GALLIUM_WINSYS_DRM_DIRS=""
  375. GALLIUM_AUXILIARY_DIRS="draw translate cso_cache pipebuffer tgsi sct rtasm util indices"
  376. GALLIUM_DRIVERS_DIRS="softpipe failover trace"
  377. GALLIUM_STATE_TRACKERS_DIRS=""
  378. case "$mesa_driver" in
  379. xlib)
  380. DRIVER_DIRS="x11"
  381. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
  382. ;;
  383. dri)
  384. SRC_DIRS="glx/x11 $SRC_DIRS"
  385. DRIVER_DIRS="dri"
  386. WINDOW_SYSTEM="dri"
  387. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
  388. ;;
  389. osmesa)
  390. DRIVER_DIRS="osmesa"
  391. ;;
  392. esac
  393. AC_SUBST([SRC_DIRS])
  394. AC_SUBST([GLU_DIRS])
  395. AC_SUBST([DRIVER_DIRS])
  396. AC_SUBST([WINDOW_SYSTEM])
  397. AC_SUBST([GALLIUM_DIRS])
  398. AC_SUBST([GALLIUM_WINSYS_DIRS])
  399. AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
  400. AC_SUBST([GALLIUM_DRIVERS_DIRS])
  401. AC_SUBST([GALLIUM_AUXILIARY_DIRS])
  402. AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
  403. dnl
  404. dnl User supplied program configuration
  405. dnl
  406. if test -d "$srcdir/progs/demos"; then
  407. default_demos=yes
  408. else
  409. default_demos=no
  410. fi
  411. AC_ARG_WITH([demos],
  412. [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
  413. [optional comma delimited demo directories to build
  414. @<:@default=auto if source available@:>@])],
  415. [with_demos="$withval"],
  416. [with_demos="$default_demos"])
  417. if test "x$with_demos" = x; then
  418. with_demos=no
  419. fi
  420. dnl If $with_demos is yes, directories will be added as libs available
  421. PROGRAM_DIRS=""
  422. case "$with_demos" in
  423. no) ;;
  424. yes)
  425. # If the driver isn't osmesa, we have libGL and can build xdemos
  426. if test "$mesa_driver" != osmesa; then
  427. PROGRAM_DIRS="xdemos"
  428. fi
  429. ;;
  430. *)
  431. # verify the requested demos directories exist
  432. demos=`IFS=,; echo $with_demos`
  433. for demo in $demos; do
  434. test -d "$srcdir/progs/$demo" || \
  435. AC_MSG_ERROR([Program directory '$demo' doesn't exist])
  436. done
  437. PROGRAM_DIRS="$demos"
  438. ;;
  439. esac
  440. dnl
  441. dnl Find out if X is available. The variable have_x is set if libX11 is
  442. dnl found to mimic AC_PATH_XTRA.
  443. dnl
  444. if test -n "$PKG_CONFIG"; then
  445. AC_MSG_CHECKING([pkg-config files for X11 are available])
  446. PKG_CHECK_EXISTS([x11],[
  447. x11_pkgconfig=yes
  448. have_x=yes
  449. ],[
  450. x11_pkgconfig=no
  451. ])
  452. AC_MSG_RESULT([$x11_pkgconfig])
  453. else
  454. x11_pkgconfig=no
  455. fi
  456. dnl Use the autoconf macro if no pkg-config files
  457. if test "$x11_pkgconfig" = no; then
  458. AC_PATH_XTRA
  459. fi
  460. dnl Try to tell the user that the --x-* options are only used when
  461. dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
  462. m4_divert_once([HELP_BEGIN],
  463. [These options are only used when the X libraries cannot be found by the
  464. pkg-config utility.])
  465. dnl We need X for xlib and dri, so bomb now if it's not found
  466. case "$mesa_driver" in
  467. xlib|dri)
  468. if test "$no_x" = yes; then
  469. AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
  470. fi
  471. ;;
  472. esac
  473. dnl XCB - this is only used for GLX right now
  474. AC_ARG_ENABLE([xcb],
  475. [AS_HELP_STRING([--enable-xcb],
  476. [use XCB for GLX @<:@default=disabled@:>@])],
  477. [enable_xcb="$enableval"],
  478. [enable_xcb=no])
  479. if test "x$enable_xcb" = xyes; then
  480. DEFINES="$DEFINES -DUSE_XCB"
  481. else
  482. enable_xcb=no
  483. fi
  484. dnl
  485. dnl libGL configuration per driver
  486. dnl
  487. case "$mesa_driver" in
  488. xlib)
  489. if test "$x11_pkgconfig" = yes; then
  490. PKG_CHECK_MODULES([XLIBGL], [x11 xext])
  491. GL_PC_REQ_PRIV="x11 xext"
  492. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  493. GL_LIB_DEPS="$XLIBGL_LIBS"
  494. else
  495. # should check these...
  496. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  497. GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
  498. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  499. GL_PC_CFLAGS="$X11_INCLUDES"
  500. fi
  501. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
  502. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
  503. # if static, move the external libraries to the programs
  504. # and empty the libraries for libGL
  505. if test "$enable_static" = yes; then
  506. APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
  507. GL_LIB_DEPS=""
  508. fi
  509. ;;
  510. dri)
  511. # DRI must be shared, I think
  512. if test "$enable_static" = yes; then
  513. AC_MSG_ERROR([Can't use static libraries for DRI drivers])
  514. fi
  515. # Check for libdrm
  516. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
  517. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  518. GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
  519. DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
  520. # find the DRI deps for libGL
  521. if test "$x11_pkgconfig" = yes; then
  522. # add xcb modules if necessary
  523. dri_modules="x11 xext xxf86vm xdamage xfixes"
  524. if test "$enable_xcb" = yes; then
  525. dri_modules="$dri_modules x11-xcb xcb-glx"
  526. fi
  527. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  528. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  529. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  530. GL_LIB_DEPS="$DRIGL_LIBS"
  531. else
  532. # should check these...
  533. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  534. GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
  535. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  536. GL_PC_CFLAGS="$X11_INCLUDES"
  537. # XCB can only be used from pkg-config
  538. if test "$enable_xcb" = yes; then
  539. PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
  540. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
  541. X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
  542. GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
  543. fi
  544. fi
  545. # need DRM libs, -lpthread, etc.
  546. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  547. GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  548. ;;
  549. osmesa)
  550. # No libGL for osmesa
  551. GL_LIB_DEPS=""
  552. ;;
  553. esac
  554. AC_SUBST([GL_LIB_DEPS])
  555. AC_SUBST([GL_PC_REQ_PRIV])
  556. AC_SUBST([GL_PC_LIB_PRIV])
  557. AC_SUBST([GL_PC_CFLAGS])
  558. AC_SUBST([DRI_PC_REQ_PRIV])
  559. dnl
  560. dnl More X11 setup
  561. dnl
  562. if test "$mesa_driver" = xlib; then
  563. DEFINES="$DEFINES -DUSE_XSHM"
  564. fi
  565. dnl
  566. dnl More DRI setup
  567. dnl
  568. AC_ARG_ENABLE([glx-tls],
  569. [AS_HELP_STRING([--enable-glx-tls],
  570. [enable TLS support in GLX @<:@default=disabled@:>@])],
  571. [GLX_USE_TLS="$enableval"],
  572. [GLX_USE_TLS=no])
  573. dnl Directory for DRI drivers
  574. AC_ARG_WITH([dri-driverdir],
  575. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  576. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  577. [DRI_DRIVER_INSTALL_DIR="$withval"],
  578. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  579. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  580. dnl Direct rendering or just indirect rendering
  581. AC_ARG_ENABLE([driglx-direct],
  582. [AS_HELP_STRING([--disable-driglx-direct],
  583. [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
  584. [driglx_direct="$enableval"],
  585. [driglx_direct="yes"])
  586. dnl Which drivers to build - default is chosen by platform
  587. AC_ARG_WITH([dri-drivers],
  588. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  589. [comma delimited DRI drivers list, e.g.
  590. "swrast,i965,radeon,nouveau" @<:@default=auto@:>@])],
  591. [with_dri_drivers="$withval"],
  592. [with_dri_drivers=yes])
  593. if test "x$with_dri_drivers" = x; then
  594. with_dri_drivers=no
  595. fi
  596. dnl If $with_dri_drivers is yes, directories will be added through
  597. dnl platform checks
  598. DRI_DIRS=""
  599. case "$with_dri_drivers" in
  600. no) ;;
  601. yes)
  602. DRI_DIRS="yes"
  603. ;;
  604. *)
  605. # verify the requested driver directories exist
  606. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  607. for driver in $dri_drivers; do
  608. test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
  609. AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
  610. done
  611. DRI_DIRS="$dri_drivers"
  612. ;;
  613. esac
  614. dnl Just default to no EGL for now
  615. USING_EGL=0
  616. AC_SUBST([USING_EGL])
  617. dnl Set DRI_DIRS, DEFINES and LIB_DEPS
  618. if test "$mesa_driver" = dri; then
  619. # Use TLS in GLX?
  620. if test "x$GLX_USE_TLS" = xyes; then
  621. DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
  622. fi
  623. if test "x$USING_EGL" = x1; then
  624. PROGRAM_DIRS="egl"
  625. fi
  626. # Platform specific settings and drivers to build
  627. case "$host_os" in
  628. linux*)
  629. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  630. if test "x$driglx_direct" = xyes; then
  631. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  632. fi
  633. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  634. case "$host_cpu" in
  635. x86_64)
  636. # ffb, gamma, and sis are missing because they have not be
  637. # converted to use the new interface. i810 are missing
  638. # because there is no x86-64 system where they could *ever*
  639. # be used.
  640. if test "x$DRI_DIRS" = "xyes"; then
  641. DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
  642. savage tdfx unichrome swrast"
  643. fi
  644. ;;
  645. powerpc*)
  646. # Build only the drivers for cards that exist on PowerPC.
  647. # At some point MGA will be added, but not yet.
  648. if test "x$DRI_DIRS" = "xyes"; then
  649. DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
  650. fi
  651. ;;
  652. sparc*)
  653. # Build only the drivers for cards that exist on sparc`
  654. if test "x$DRI_DIRS" = "xyes"; then
  655. DRI_DIRS="mach64 r128 r200 r300 radeon ffb swrast"
  656. fi
  657. ;;
  658. esac
  659. ;;
  660. freebsd* | dragonfly*)
  661. DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
  662. DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
  663. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  664. if test "x$driglx_direct" = xyes; then
  665. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  666. fi
  667. if test "x$GXX" = xyes; then
  668. CXXFLAGS="$CXXFLAGS -ansi -pedantic"
  669. fi
  670. # ffb and gamma are missing because they have not been converted
  671. # to use the new interface.
  672. if test "x$DRI_DIRS" = "xyes"; then
  673. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
  674. unichrome savage sis swrast"
  675. fi
  676. ;;
  677. gnu*)
  678. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  679. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  680. ;;
  681. solaris*)
  682. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  683. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  684. if test "x$driglx_direct" = xyes; then
  685. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  686. fi
  687. ;;
  688. esac
  689. # default drivers
  690. if test "x$DRI_DIRS" = "xyes"; then
  691. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
  692. savage sis tdfx trident unichrome ffb swrast"
  693. fi
  694. DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
  695. # Check for expat
  696. EXPAT_INCLUDES=""
  697. EXPAT_LIB=-lexpat
  698. AC_ARG_WITH([expat],
  699. [AS_HELP_STRING([--with-expat=DIR],
  700. [expat install directory])],[
  701. EXPAT_INCLUDES="-I$withval/include"
  702. CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
  703. LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
  704. EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
  705. ])
  706. AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
  707. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  708. [AC_MSG_ERROR([Expat required for DRI.])])
  709. # put all the necessary libs together
  710. DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
  711. fi
  712. AC_SUBST([DRI_DIRS])
  713. AC_SUBST([EXPAT_INCLUDES])
  714. AC_SUBST([DRI_LIB_DEPS])
  715. dnl
  716. dnl OSMesa configuration
  717. dnl
  718. if test "$mesa_driver" = xlib; then
  719. default_gl_osmesa=yes
  720. else
  721. default_gl_osmesa=no
  722. fi
  723. AC_ARG_ENABLE([gl-osmesa],
  724. [AS_HELP_STRING([--enable-gl-osmesa],
  725. [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
  726. [gl_osmesa="$enableval"],
  727. [gl_osmesa="$default_gl_osmesa"])
  728. if test "x$gl_osmesa" = xyes; then
  729. if test "$mesa_driver" = osmesa; then
  730. AC_MSG_ERROR([libGL is not available for OSMesa driver])
  731. else
  732. DRIVER_DIRS="$DRIVER_DIRS osmesa"
  733. fi
  734. fi
  735. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  736. AC_ARG_WITH([osmesa-bits],
  737. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  738. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  739. [osmesa_bits="$withval"],
  740. [osmesa_bits=8])
  741. if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
  742. AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
  743. osmesa_bits=8
  744. fi
  745. case "x$osmesa_bits" in
  746. x8)
  747. OSMESA_LIB=OSMesa
  748. ;;
  749. x16|x32)
  750. OSMESA_LIB="OSMesa$osmesa_bits"
  751. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  752. ;;
  753. *)
  754. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  755. ;;
  756. esac
  757. AC_SUBST([OSMESA_LIB])
  758. case "$mesa_driver" in
  759. osmesa)
  760. # only link libraries with osmesa if shared
  761. if test "$enable_static" = no; then
  762. OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
  763. else
  764. OSMESA_LIB_DEPS=""
  765. fi
  766. OSMESA_MESA_DEPS=""
  767. OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS"
  768. ;;
  769. *)
  770. # Link OSMesa to libGL otherwise
  771. OSMESA_LIB_DEPS=""
  772. # only link libraries with osmesa if shared
  773. if test "$enable_static" = no; then
  774. OSMESA_MESA_DEPS='-l$(GL_LIB)'
  775. else
  776. OSMESA_MESA_DEPS=""
  777. fi
  778. OSMESA_PC_REQ="gl"
  779. ;;
  780. esac
  781. if test "$enable_static" = no; then
  782. OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS"
  783. fi
  784. OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
  785. AC_SUBST([OSMESA_LIB_DEPS])
  786. AC_SUBST([OSMESA_MESA_DEPS])
  787. AC_SUBST([OSMESA_PC_REQ])
  788. AC_SUBST([OSMESA_PC_LIB_PRIV])
  789. dnl
  790. dnl EGL configuration
  791. dnl
  792. AC_ARG_ENABLE([egl],
  793. [AS_HELP_STRING([--disable-egl],
  794. [disable EGL library @<:@default=enabled@:>@])],
  795. [enable_egl="$enableval"],
  796. [enable_egl=yes])
  797. if test "x$enable_egl" = xyes; then
  798. SRC_DIRS="$SRC_DIRS egl"
  799. if test "$x11_pkgconfig" = yes; then
  800. PKG_CHECK_MODULES([EGL], [x11])
  801. EGL_LIB_DEPS="$EGL_LIBS"
  802. else
  803. # should check these...
  804. EGL_LIB_DEPS="$X_LIBS -lX11"
  805. fi
  806. EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
  807. fi
  808. AC_SUBST([EGL_LIB_DEPS])
  809. dnl
  810. dnl GLU configuration
  811. dnl
  812. AC_ARG_ENABLE([glu],
  813. [AS_HELP_STRING([--disable-glu],
  814. [enable OpenGL Utility library @<:@default=enabled@:>@])],
  815. [enable_glu="$enableval"],
  816. [enable_glu=yes])
  817. if test "x$enable_glu" = xyes; then
  818. SRC_DIRS="$SRC_DIRS glu"
  819. case "$mesa_driver" in
  820. osmesa)
  821. # If GLU is available and we have libOSMesa (not 16 or 32),
  822. # we can build the osdemos
  823. if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
  824. PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
  825. fi
  826. # Link libGLU to libOSMesa instead of libGL
  827. GLU_LIB_DEPS=""
  828. GLU_PC_REQ="osmesa"
  829. if test "$enable_static" = no; then
  830. GLU_MESA_DEPS='-l$(OSMESA_LIB)'
  831. else
  832. GLU_MESA_DEPS=""
  833. fi
  834. ;;
  835. *)
  836. # If static, empty GLU_LIB_DEPS and add libs for programs to link
  837. GLU_PC_REQ="gl"
  838. GLU_PC_LIB_PRIV="-lm"
  839. if test "$enable_static" = no; then
  840. GLU_LIB_DEPS="-lm"
  841. GLU_MESA_DEPS='-l$(GL_LIB)'
  842. else
  843. GLU_LIB_DEPS=""
  844. GLU_MESA_DEPS=""
  845. APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
  846. fi
  847. ;;
  848. esac
  849. fi
  850. if test "$enable_static" = no; then
  851. GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
  852. fi
  853. GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
  854. AC_SUBST([GLU_LIB_DEPS])
  855. AC_SUBST([GLU_MESA_DEPS])
  856. AC_SUBST([GLU_PC_REQ])
  857. AC_SUBST([GLU_PC_REQ_PRIV])
  858. AC_SUBST([GLU_PC_LIB_PRIV])
  859. AC_SUBST([GLU_PC_CFLAGS])
  860. dnl
  861. dnl GLw configuration
  862. dnl
  863. AC_ARG_ENABLE([glw],
  864. [AS_HELP_STRING([--disable-glw],
  865. [enable Xt/Motif widget library @<:@default=enabled@:>@])],
  866. [enable_glw="$enableval"],
  867. [enable_glw=yes])
  868. dnl Don't build GLw on osmesa
  869. if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
  870. AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
  871. enable_glw=no
  872. fi
  873. AC_ARG_ENABLE([motif],
  874. [AS_HELP_STRING([--enable-motif],
  875. [use Motif widgets in GLw @<:@default=disabled@:>@])],
  876. [enable_motif="$enableval"],
  877. [enable_motif=no])
  878. if test "x$enable_glw" = xyes; then
  879. SRC_DIRS="$SRC_DIRS glw"
  880. if test "$x11_pkgconfig" = yes; then
  881. PKG_CHECK_MODULES([GLW],[x11 xt])
  882. GLW_PC_REQ_PRIV="x11 xt"
  883. GLW_LIB_DEPS="$GLW_LIBS"
  884. else
  885. # should check these...
  886. GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
  887. GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
  888. GLW_PC_CFLAGS="$X11_INCLUDES"
  889. fi
  890. GLW_SOURCES="GLwDrawA.c"
  891. MOTIF_CFLAGS=
  892. if test "x$enable_motif" = xyes; then
  893. GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
  894. AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
  895. if test "x$MOTIF_CONFIG" != xno; then
  896. MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
  897. MOTIF_LIBS=`$MOTIF_CONFIG --libs`
  898. else
  899. AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
  900. [AC_MSG_ERROR([Can't locate Motif headers])])
  901. AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
  902. [AC_MSG_ERROR([Can't locate Motif Xm library])])
  903. fi
  904. # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
  905. GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
  906. GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
  907. GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
  908. fi
  909. # If static, empty GLW_LIB_DEPS and add libs for programs to link
  910. GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
  911. if test "$enable_static" = no; then
  912. GLW_MESA_DEPS='-l$(GL_LIB)'
  913. GLW_LIB_DEPS="$GLW_LIB_DEPS"
  914. else
  915. APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
  916. GLW_LIB_DEPS=""
  917. GLW_MESA_DEPS=""
  918. fi
  919. fi
  920. AC_SUBST([GLW_LIB_DEPS])
  921. AC_SUBST([GLW_MESA_DEPS])
  922. AC_SUBST([GLW_SOURCES])
  923. AC_SUBST([MOTIF_CFLAGS])
  924. AC_SUBST([GLW_PC_REQ_PRIV])
  925. AC_SUBST([GLW_PC_LIB_PRIV])
  926. AC_SUBST([GLW_PC_CFLAGS])
  927. dnl
  928. dnl GLUT configuration
  929. dnl
  930. if test -f "$srcdir/include/GL/glut.h"; then
  931. default_glut=yes
  932. else
  933. default_glut=no
  934. fi
  935. AC_ARG_ENABLE([glut],
  936. [AS_HELP_STRING([--disable-glut],
  937. [enable GLUT library @<:@default=enabled if source available@:>@])],
  938. [enable_glut="$enableval"],
  939. [enable_glut="$default_glut"])
  940. dnl Can't build glut if GLU not available
  941. if test "x$enable_glu$enable_glut" = xnoyes; then
  942. AC_MSG_WARN([Disabling glut since GLU is disabled])
  943. enable_glut=no
  944. fi
  945. dnl Don't build glut on osmesa
  946. if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
  947. AC_MSG_WARN([Disabling glut since the driver is OSMesa])
  948. enable_glut=no
  949. fi
  950. if test "x$enable_glut" = xyes; then
  951. SRC_DIRS="$SRC_DIRS glut/glx"
  952. GLUT_CFLAGS=""
  953. if test "x$GCC" = xyes; then
  954. GLUT_CFLAGS="-fexceptions"
  955. fi
  956. if test "$x11_pkgconfig" = yes; then
  957. PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
  958. GLUT_PC_REQ_PRIV="x11 xmu xi"
  959. GLUT_LIB_DEPS="$GLUT_LIBS"
  960. else
  961. # should check these...
  962. GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
  963. GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
  964. GLUT_PC_CFLAGS="$X11_INCLUDES"
  965. fi
  966. GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
  967. GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
  968. # If glut is available, we can build most programs
  969. if test "$with_demos" = yes; then
  970. PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
  971. fi
  972. # If static, empty GLUT_LIB_DEPS and add libs for programs to link
  973. if test "$enable_static" = no; then
  974. GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
  975. else
  976. APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
  977. GLUT_LIB_DEPS=""
  978. GLUT_MESA_DEPS=""
  979. fi
  980. fi
  981. AC_SUBST([GLUT_LIB_DEPS])
  982. AC_SUBST([GLUT_MESA_DEPS])
  983. AC_SUBST([GLUT_CFLAGS])
  984. AC_SUBST([GLUT_PC_REQ_PRIV])
  985. AC_SUBST([GLUT_PC_LIB_PRIV])
  986. AC_SUBST([GLUT_PC_CFLAGS])
  987. dnl
  988. dnl Program library dependencies
  989. dnl Only libm is added here if necessary as the libraries should
  990. dnl be pulled in by the linker
  991. dnl
  992. if test "x$APP_LIB_DEPS" = x; then
  993. case "$host_os" in
  994. solaris*)
  995. APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
  996. ;;
  997. *)
  998. APP_LIB_DEPS="-lm"
  999. ;;
  1000. esac
  1001. fi
  1002. AC_SUBST([APP_LIB_DEPS])
  1003. AC_SUBST([PROGRAM_DIRS])
  1004. dnl
  1005. dnl Gallium configuration
  1006. dnl
  1007. AC_ARG_ENABLE([gallium],
  1008. [AS_HELP_STRING([--disable-gallium],
  1009. [build gallium @<:@default=enabled@:>@])],
  1010. [enable_gallium="$enableval"],
  1011. [enable_gallium=yes])
  1012. if test "x$enable_gallium" = xyes; then
  1013. SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
  1014. fi
  1015. dnl
  1016. dnl Gallium state trackers configuration
  1017. dnl
  1018. AC_ARG_WITH([state-trackers],
  1019. [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
  1020. [comma delimited state_trackers list, e.g.
  1021. "egl,glx" @<:@default=auto@:>@])],
  1022. [with_state_trackers="$withval"],
  1023. [with_state_trackers=yes])
  1024. case "$with_state_trackers" in
  1025. no)
  1026. GALLIUM_STATE_TRACKERS_DIRS=""
  1027. ;;
  1028. yes)
  1029. # look at what else is built
  1030. case "$mesa_driver" in
  1031. xlib)
  1032. GALLIUM_STATE_TRACKERS_DIRS=glx
  1033. ;;
  1034. dri)
  1035. test "x$enable_egl" = xyes && GALLIUM_STATE_TRACKERS_DIRS=egl
  1036. ;;
  1037. esac
  1038. ;;
  1039. *)
  1040. # verify the requested state tracker exist
  1041. state_trackers=`IFS=', '; echo $with_state_trackers`
  1042. for tracker in $state_trackers; do
  1043. test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
  1044. AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
  1045. if test "$tracker" = egl && test "x$enable_egl" != xyes; then
  1046. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1047. fi
  1048. done
  1049. GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
  1050. ;;
  1051. esac
  1052. AC_ARG_WITH([xorg-driver-dir],
  1053. [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
  1054. [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
  1055. [XORG_DRIVER_INSTALL_DIR="$withval"],
  1056. [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
  1057. AC_SUBST([XORG_DRIVER_INSTALL_DIR])
  1058. dnl
  1059. dnl Gallium Intel configuration
  1060. dnl
  1061. AC_ARG_ENABLE([gallium-intel],
  1062. [AS_HELP_STRING([--disable-gallium-intel],
  1063. [build gallium intel @<:@default=enabled@:>@])],
  1064. [enable_gallium_intel="$enableval"],
  1065. [enable_gallium_intel=yes])
  1066. if test "x$enable_gallium_intel" = xyes; then
  1067. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel"
  1068. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915simple"
  1069. fi
  1070. dnl
  1071. dnl Gallium Radeon configuration
  1072. dnl
  1073. AC_ARG_ENABLE([gallium-radeon],
  1074. [AS_HELP_STRING([--enable-gallium-radeon],
  1075. [build gallium radeon @<:@default=disabled@:>@])],
  1076. [enable_gallium_radeon="$enableval"],
  1077. [enable_gallium_radeon=no])
  1078. if test "x$enable_gallium_radeon" = xyes; then
  1079. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
  1080. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1081. fi
  1082. dnl
  1083. dnl Gallium Radeon configuration
  1084. dnl
  1085. AC_ARG_ENABLE([gallium-nouveau],
  1086. [AS_HELP_STRING([--enable-gallium-nouveau],
  1087. [build gallium nouveau @<:@default=disabled@:>@])],
  1088. [enable_gallium_nouveau="$enableval"],
  1089. [enable_gallium_nouveau=no])
  1090. if test "x$enable_gallium_nouveau" = xyes; then
  1091. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
  1092. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nv04 nv10 nv20 nv30 nv40 nv50"
  1093. fi
  1094. dnl Restore LDFLAGS and CPPFLAGS
  1095. LDFLAGS="$_SAVE_LDFLAGS"
  1096. CPPFLAGS="$_SAVE_CPPFLAGS"
  1097. dnl Substitute the config
  1098. AC_CONFIG_FILES([configs/autoconf])
  1099. dnl Replace the configs/current symlink
  1100. AC_CONFIG_COMMANDS([configs],[
  1101. if test -f configs/current || test -L configs/current; then
  1102. rm -f configs/current
  1103. fi
  1104. ln -s autoconf configs/current
  1105. ])
  1106. AC_OUTPUT
  1107. dnl
  1108. dnl Output some configuration info for the user
  1109. dnl
  1110. echo ""
  1111. echo " prefix: $prefix"
  1112. echo " exec_prefix: $exec_prefix"
  1113. echo " libdir: $libdir"
  1114. echo " includedir: $includedir"
  1115. dnl Driver info
  1116. echo ""
  1117. echo " Driver: $mesa_driver"
  1118. if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
  1119. echo " OSMesa: lib$OSMESA_LIB"
  1120. else
  1121. echo " OSMesa: no"
  1122. fi
  1123. if test "$mesa_driver" = dri; then
  1124. # cleanup the drivers var
  1125. dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1126. if test "x$DRI_DIRS" = x; then
  1127. echo " DRI drivers: no"
  1128. else
  1129. echo " DRI drivers: $dri_dirs"
  1130. fi
  1131. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  1132. fi
  1133. echo " Use XCB: $enable_xcb"
  1134. echo ""
  1135. if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
  1136. echo " Gallium: yes"
  1137. echo " Gallium dirs: $GALLIUM_DIRS"
  1138. echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
  1139. echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
  1140. echo " Auxiliary dirs: $GALLIUM_AUXILIARY_DIRS"
  1141. echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
  1142. echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
  1143. else
  1144. echo " Gallium: no"
  1145. fi
  1146. dnl Libraries
  1147. echo ""
  1148. echo " Shared libs: $enable_shared"
  1149. echo " Static libs: $enable_static"
  1150. echo " EGL: $enable_egl"
  1151. echo " GLU: $enable_glu"
  1152. echo " GLw: $enable_glw (Motif: $enable_motif)"
  1153. echo " glut: $enable_glut"
  1154. dnl Programs
  1155. # cleanup the programs var for display
  1156. program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1157. if test "x$program_dirs" = x; then
  1158. echo " Demos: no"
  1159. else
  1160. echo " Demos: $program_dirs"
  1161. fi
  1162. dnl Compiler options
  1163. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  1164. cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1165. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1166. cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1167. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1168. defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1169. echo ""
  1170. echo " CFLAGS: $cflags"
  1171. echo " CXXFLAGS: $cxxflags"
  1172. echo " Macros: $defines"
  1173. echo ""
  1174. echo " Run '${MAKE-make}' to build Mesa"
  1175. echo ""