Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 36KB

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