Clone of mesa.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

configure.ac 36KB

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