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

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