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

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