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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345
  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="glsl 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 Extra search path for DRI drivers
  597. AC_ARG_WITH([dri-searchpath],
  598. [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
  599. [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
  600. [DRI_DRIVER_SEARCH_DIR="$withval"],
  601. [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
  602. AC_SUBST([DRI_DRIVER_SEARCH_DIR])
  603. dnl Direct rendering or just indirect rendering
  604. AC_ARG_ENABLE([driglx-direct],
  605. [AS_HELP_STRING([--disable-driglx-direct],
  606. [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
  607. [driglx_direct="$enableval"],
  608. [driglx_direct="yes"])
  609. dnl Which drivers to build - default is chosen by platform
  610. AC_ARG_WITH([dri-drivers],
  611. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  612. [comma delimited DRI drivers list, e.g.
  613. "swrast,i965,radeon" @<:@default=auto@:>@])],
  614. [with_dri_drivers="$withval"],
  615. [with_dri_drivers=yes])
  616. if test "x$with_dri_drivers" = x; then
  617. with_dri_drivers=no
  618. fi
  619. dnl If $with_dri_drivers is yes, directories will be added through
  620. dnl platform checks
  621. DRI_DIRS=""
  622. case "$with_dri_drivers" in
  623. no) ;;
  624. yes)
  625. DRI_DIRS="yes"
  626. ;;
  627. *)
  628. # verify the requested driver directories exist
  629. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  630. for driver in $dri_drivers; do
  631. test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
  632. AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
  633. done
  634. DRI_DIRS="$dri_drivers"
  635. ;;
  636. esac
  637. dnl Just default to no EGL for now
  638. USING_EGL=0
  639. AC_SUBST([USING_EGL])
  640. dnl Set DRI_DIRS, DEFINES and LIB_DEPS
  641. if test "$mesa_driver" = dri; then
  642. # Use TLS in GLX?
  643. if test "x$GLX_USE_TLS" = xyes; then
  644. DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
  645. fi
  646. if test "x$USING_EGL" = x1; then
  647. PROGRAM_DIRS="egl"
  648. fi
  649. # Platform specific settings and drivers to build
  650. case "$host_os" in
  651. linux*)
  652. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  653. if test "x$driglx_direct" = xyes; then
  654. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  655. fi
  656. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  657. case "$host_cpu" in
  658. x86_64)
  659. # ffb, gamma, and sis are missing because they have not be
  660. # converted to use the new interface. i810 are missing
  661. # because there is no x86-64 system where they could *ever*
  662. # be used.
  663. if test "x$DRI_DIRS" = "xyes"; then
  664. DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  665. savage tdfx unichrome swrast"
  666. fi
  667. ;;
  668. powerpc*)
  669. # Build only the drivers for cards that exist on PowerPC.
  670. # At some point MGA will be added, but not yet.
  671. if test "x$DRI_DIRS" = "xyes"; then
  672. DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
  673. fi
  674. ;;
  675. sparc*)
  676. # Build only the drivers for cards that exist on sparc`
  677. if test "x$DRI_DIRS" = "xyes"; then
  678. DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast"
  679. fi
  680. ;;
  681. esac
  682. ;;
  683. freebsd* | dragonfly*)
  684. DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
  685. DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
  686. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  687. if test "x$driglx_direct" = xyes; then
  688. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  689. fi
  690. if test "x$GXX" = xyes; then
  691. CXXFLAGS="$CXXFLAGS -ansi -pedantic"
  692. fi
  693. # ffb and gamma are missing because they have not been converted
  694. # to use the new interface.
  695. if test "x$DRI_DIRS" = "xyes"; then
  696. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
  697. unichrome savage sis swrast"
  698. fi
  699. ;;
  700. gnu*)
  701. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  702. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  703. ;;
  704. solaris*)
  705. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  706. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  707. if test "x$driglx_direct" = xyes; then
  708. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  709. fi
  710. ;;
  711. esac
  712. # default drivers
  713. if test "x$DRI_DIRS" = "xyes"; then
  714. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  715. savage sis tdfx unichrome ffb swrast"
  716. fi
  717. DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
  718. # Check for expat
  719. EXPAT_INCLUDES=""
  720. EXPAT_LIB=-lexpat
  721. AC_ARG_WITH([expat],
  722. [AS_HELP_STRING([--with-expat=DIR],
  723. [expat install directory])],[
  724. EXPAT_INCLUDES="-I$withval/include"
  725. CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
  726. LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
  727. EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
  728. ])
  729. AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
  730. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  731. [AC_MSG_ERROR([Expat required for DRI.])])
  732. # put all the necessary libs together
  733. DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
  734. fi
  735. AC_SUBST([DRI_DIRS])
  736. AC_SUBST([EXPAT_INCLUDES])
  737. AC_SUBST([DRI_LIB_DEPS])
  738. dnl
  739. dnl OSMesa configuration
  740. dnl
  741. if test "$mesa_driver" = xlib; then
  742. default_gl_osmesa=yes
  743. else
  744. default_gl_osmesa=no
  745. fi
  746. AC_ARG_ENABLE([gl-osmesa],
  747. [AS_HELP_STRING([--enable-gl-osmesa],
  748. [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
  749. [gl_osmesa="$enableval"],
  750. [gl_osmesa="$default_gl_osmesa"])
  751. if test "x$gl_osmesa" = xyes; then
  752. if test "$mesa_driver" = osmesa; then
  753. AC_MSG_ERROR([libGL is not available for OSMesa driver])
  754. else
  755. DRIVER_DIRS="$DRIVER_DIRS osmesa"
  756. fi
  757. fi
  758. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  759. AC_ARG_WITH([osmesa-bits],
  760. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  761. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  762. [osmesa_bits="$withval"],
  763. [osmesa_bits=8])
  764. if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
  765. AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
  766. osmesa_bits=8
  767. fi
  768. case "x$osmesa_bits" in
  769. x8)
  770. OSMESA_LIB=OSMesa
  771. ;;
  772. x16|x32)
  773. OSMESA_LIB="OSMesa$osmesa_bits"
  774. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  775. ;;
  776. *)
  777. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  778. ;;
  779. esac
  780. AC_SUBST([OSMESA_LIB])
  781. case "$mesa_driver" in
  782. osmesa)
  783. # only link libraries with osmesa if shared
  784. if test "$enable_static" = no; then
  785. OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  786. else
  787. OSMESA_LIB_DEPS=""
  788. fi
  789. OSMESA_MESA_DEPS=""
  790. OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  791. ;;
  792. *)
  793. # Link OSMesa to libGL otherwise
  794. OSMESA_LIB_DEPS=""
  795. # only link libraries with osmesa if shared
  796. if test "$enable_static" = no; then
  797. OSMESA_MESA_DEPS='-l$(GL_LIB)'
  798. else
  799. OSMESA_MESA_DEPS=""
  800. fi
  801. OSMESA_PC_REQ="gl"
  802. ;;
  803. esac
  804. OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
  805. AC_SUBST([OSMESA_LIB_DEPS])
  806. AC_SUBST([OSMESA_MESA_DEPS])
  807. AC_SUBST([OSMESA_PC_REQ])
  808. AC_SUBST([OSMESA_PC_LIB_PRIV])
  809. dnl
  810. dnl EGL configuration
  811. dnl
  812. AC_ARG_ENABLE([egl],
  813. [AS_HELP_STRING([--disable-egl],
  814. [disable EGL library @<:@default=enabled@:>@])],
  815. [enable_egl="$enableval"],
  816. [enable_egl=yes])
  817. if test "x$enable_egl" = xyes; then
  818. SRC_DIRS="$SRC_DIRS egl"
  819. if test "$x11_pkgconfig" = yes; then
  820. PKG_CHECK_MODULES([EGL], [x11])
  821. EGL_LIB_DEPS="$EGL_LIBS"
  822. else
  823. # should check these...
  824. EGL_LIB_DEPS="$X_LIBS -lX11"
  825. fi
  826. EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
  827. fi
  828. AC_SUBST([EGL_LIB_DEPS])
  829. dnl
  830. dnl GLU configuration
  831. dnl
  832. AC_ARG_ENABLE([glu],
  833. [AS_HELP_STRING([--disable-glu],
  834. [enable OpenGL Utility library @<:@default=enabled@:>@])],
  835. [enable_glu="$enableval"],
  836. [enable_glu=yes])
  837. if test "x$enable_glu" = xyes; then
  838. SRC_DIRS="$SRC_DIRS glu"
  839. case "$mesa_driver" in
  840. osmesa)
  841. # If GLU is available and we have libOSMesa (not 16 or 32),
  842. # we can build the osdemos
  843. if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
  844. PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
  845. fi
  846. # Link libGLU to libOSMesa instead of libGL
  847. GLU_LIB_DEPS=""
  848. GLU_PC_REQ="osmesa"
  849. if test "$enable_static" = no; then
  850. GLU_MESA_DEPS='-l$(OSMESA_LIB)'
  851. else
  852. GLU_MESA_DEPS=""
  853. fi
  854. ;;
  855. *)
  856. # If static, empty GLU_LIB_DEPS and add libs for programs to link
  857. GLU_PC_REQ="gl"
  858. GLU_PC_LIB_PRIV="-lm"
  859. if test "$enable_static" = no; then
  860. GLU_LIB_DEPS="-lm"
  861. GLU_MESA_DEPS='-l$(GL_LIB)'
  862. else
  863. GLU_LIB_DEPS=""
  864. GLU_MESA_DEPS=""
  865. APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
  866. fi
  867. ;;
  868. esac
  869. fi
  870. if test "$enable_static" = no; then
  871. GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
  872. fi
  873. GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
  874. AC_SUBST([GLU_LIB_DEPS])
  875. AC_SUBST([GLU_MESA_DEPS])
  876. AC_SUBST([GLU_PC_REQ])
  877. AC_SUBST([GLU_PC_REQ_PRIV])
  878. AC_SUBST([GLU_PC_LIB_PRIV])
  879. AC_SUBST([GLU_PC_CFLAGS])
  880. dnl
  881. dnl GLw configuration
  882. dnl
  883. AC_ARG_ENABLE([glw],
  884. [AS_HELP_STRING([--disable-glw],
  885. [enable Xt/Motif widget library @<:@default=enabled@:>@])],
  886. [enable_glw="$enableval"],
  887. [enable_glw=yes])
  888. dnl Don't build GLw on osmesa
  889. if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
  890. AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
  891. enable_glw=no
  892. fi
  893. AC_ARG_ENABLE([motif],
  894. [AS_HELP_STRING([--enable-motif],
  895. [use Motif widgets in GLw @<:@default=disabled@:>@])],
  896. [enable_motif="$enableval"],
  897. [enable_motif=no])
  898. if test "x$enable_glw" = xyes; then
  899. SRC_DIRS="$SRC_DIRS glw"
  900. if test "$x11_pkgconfig" = yes; then
  901. PKG_CHECK_MODULES([GLW],[x11 xt])
  902. GLW_PC_REQ_PRIV="x11 xt"
  903. GLW_LIB_DEPS="$GLW_LIBS"
  904. else
  905. # should check these...
  906. GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
  907. GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
  908. GLW_PC_CFLAGS="$X11_INCLUDES"
  909. fi
  910. GLW_SOURCES="GLwDrawA.c"
  911. MOTIF_CFLAGS=
  912. if test "x$enable_motif" = xyes; then
  913. GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
  914. AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
  915. if test "x$MOTIF_CONFIG" != xno; then
  916. MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
  917. MOTIF_LIBS=`$MOTIF_CONFIG --libs`
  918. else
  919. AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
  920. [AC_MSG_ERROR([Can't locate Motif headers])])
  921. AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
  922. [AC_MSG_ERROR([Can't locate Motif Xm library])])
  923. fi
  924. # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
  925. GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
  926. GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
  927. GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
  928. fi
  929. # If static, empty GLW_LIB_DEPS and add libs for programs to link
  930. GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
  931. if test "$enable_static" = no; then
  932. GLW_MESA_DEPS='-l$(GL_LIB)'
  933. GLW_LIB_DEPS="$GLW_LIB_DEPS"
  934. else
  935. APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
  936. GLW_LIB_DEPS=""
  937. GLW_MESA_DEPS=""
  938. fi
  939. fi
  940. AC_SUBST([GLW_LIB_DEPS])
  941. AC_SUBST([GLW_MESA_DEPS])
  942. AC_SUBST([GLW_SOURCES])
  943. AC_SUBST([MOTIF_CFLAGS])
  944. AC_SUBST([GLW_PC_REQ_PRIV])
  945. AC_SUBST([GLW_PC_LIB_PRIV])
  946. AC_SUBST([GLW_PC_CFLAGS])
  947. dnl
  948. dnl GLUT configuration
  949. dnl
  950. if test -f "$srcdir/include/GL/glut.h"; then
  951. default_glut=yes
  952. else
  953. default_glut=no
  954. fi
  955. AC_ARG_ENABLE([glut],
  956. [AS_HELP_STRING([--disable-glut],
  957. [enable GLUT library @<:@default=enabled if source available@:>@])],
  958. [enable_glut="$enableval"],
  959. [enable_glut="$default_glut"])
  960. dnl Can't build glut if GLU not available
  961. if test "x$enable_glu$enable_glut" = xnoyes; then
  962. AC_MSG_WARN([Disabling glut since GLU is disabled])
  963. enable_glut=no
  964. fi
  965. dnl Don't build glut on osmesa
  966. if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
  967. AC_MSG_WARN([Disabling glut since the driver is OSMesa])
  968. enable_glut=no
  969. fi
  970. if test "x$enable_glut" = xyes; then
  971. SRC_DIRS="$SRC_DIRS glut/glx"
  972. GLUT_CFLAGS=""
  973. if test "x$GCC" = xyes; then
  974. GLUT_CFLAGS="-fexceptions"
  975. fi
  976. if test "$x11_pkgconfig" = yes; then
  977. PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
  978. GLUT_PC_REQ_PRIV="x11 xmu xi"
  979. GLUT_LIB_DEPS="$GLUT_LIBS"
  980. else
  981. # should check these...
  982. GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
  983. GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
  984. GLUT_PC_CFLAGS="$X11_INCLUDES"
  985. fi
  986. GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
  987. GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
  988. # If glut is available, we can build most programs
  989. if test "$with_demos" = yes; then
  990. PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
  991. fi
  992. # If static, empty GLUT_LIB_DEPS and add libs for programs to link
  993. if test "$enable_static" = no; then
  994. GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
  995. else
  996. APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
  997. GLUT_LIB_DEPS=""
  998. GLUT_MESA_DEPS=""
  999. fi
  1000. fi
  1001. AC_SUBST([GLUT_LIB_DEPS])
  1002. AC_SUBST([GLUT_MESA_DEPS])
  1003. AC_SUBST([GLUT_CFLAGS])
  1004. AC_SUBST([GLUT_PC_REQ_PRIV])
  1005. AC_SUBST([GLUT_PC_LIB_PRIV])
  1006. AC_SUBST([GLUT_PC_CFLAGS])
  1007. dnl
  1008. dnl Program library dependencies
  1009. dnl Only libm is added here if necessary as the libraries should
  1010. dnl be pulled in by the linker
  1011. dnl
  1012. if test "x$APP_LIB_DEPS" = x; then
  1013. case "$host_os" in
  1014. solaris*)
  1015. APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
  1016. ;;
  1017. cygwin*)
  1018. APP_LIB_DEPS="-lX11"
  1019. ;;
  1020. *)
  1021. APP_LIB_DEPS="-lm"
  1022. ;;
  1023. esac
  1024. fi
  1025. AC_SUBST([APP_LIB_DEPS])
  1026. AC_SUBST([PROGRAM_DIRS])
  1027. dnl
  1028. dnl Gallium configuration
  1029. dnl
  1030. AC_ARG_ENABLE([gallium],
  1031. [AS_HELP_STRING([--disable-gallium],
  1032. [build gallium @<:@default=enabled@:>@])],
  1033. [enable_gallium="$enableval"],
  1034. [enable_gallium=yes])
  1035. if test "x$enable_gallium" = xyes; then
  1036. SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
  1037. fi
  1038. dnl
  1039. dnl Gallium state trackers configuration
  1040. dnl
  1041. AC_ARG_WITH([state-trackers],
  1042. [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
  1043. [comma delimited state_trackers list, e.g.
  1044. "egl,glx" @<:@default=auto@:>@])],
  1045. [with_state_trackers="$withval"],
  1046. [with_state_trackers=yes])
  1047. case "$with_state_trackers" in
  1048. no)
  1049. GALLIUM_STATE_TRACKERS_DIRS=""
  1050. ;;
  1051. yes)
  1052. # look at what else is built
  1053. case "$mesa_driver" in
  1054. xlib)
  1055. GALLIUM_STATE_TRACKERS_DIRS=glx
  1056. ;;
  1057. dri)
  1058. GALLIUM_STATE_TRACKERS_DIRS="dri"
  1059. if test "x$enable_egl" = xyes; then
  1060. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
  1061. fi
  1062. # Have only tested st/xorg on 1.6.0 servers
  1063. PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0],
  1064. HAVE_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
  1065. HAVE_XORG="no")
  1066. ;;
  1067. esac
  1068. ;;
  1069. *)
  1070. # verify the requested state tracker exist
  1071. state_trackers=`IFS=', '; echo $with_state_trackers`
  1072. for tracker in $state_trackers; do
  1073. test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
  1074. AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
  1075. if test "$tracker" = egl && test "x$enable_egl" != xyes; then
  1076. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1077. fi
  1078. if test "$tracker" = xorg; then
  1079. PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
  1080. HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
  1081. HAVE_XEXTPROTO_71="no")
  1082. fi
  1083. done
  1084. GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
  1085. ;;
  1086. esac
  1087. AC_ARG_WITH([xorg-driver-dir],
  1088. [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
  1089. [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
  1090. [XORG_DRIVER_INSTALL_DIR="$withval"],
  1091. [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
  1092. AC_SUBST([XORG_DRIVER_INSTALL_DIR])
  1093. AC_ARG_WITH([max-width],
  1094. [AS_HELP_STRING([--with-max-width=N],
  1095. [Maximum framebuffer width (4096)])],
  1096. [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
  1097. AS_IF([test "${withval}" -gt "4096"],
  1098. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1099. )
  1100. AC_ARG_WITH([max-height],
  1101. [AS_HELP_STRING([--with-max-height=N],
  1102. [Maximum framebuffer height (4096)])],
  1103. [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
  1104. AS_IF([test "${withval}" -gt "4096"],
  1105. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1106. )
  1107. dnl
  1108. dnl Gallium SVGA configuration
  1109. dnl
  1110. AC_ARG_ENABLE([gallium-svga],
  1111. [AS_HELP_STRING([--disable-gallium-svga],
  1112. [build gallium SVGA @<:@default=enabled@:>@])],
  1113. [enable_gallium_svga="$enableval"],
  1114. [enable_gallium_svga=yes])
  1115. if test "x$enable_gallium_svga" = xyes; then
  1116. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
  1117. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
  1118. fi
  1119. dnl
  1120. dnl Gallium Intel configuration
  1121. dnl
  1122. AC_ARG_ENABLE([gallium-intel],
  1123. [AS_HELP_STRING([--enable-gallium-intel],
  1124. [build gallium intel @<:@default=disabled@:>@])],
  1125. [enable_gallium_intel="$enableval"],
  1126. [enable_gallium_intel=auto])
  1127. if test "x$enable_gallium_intel" = xyes; then
  1128. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel"
  1129. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
  1130. elif test "x$enable_gallium_intel" = xauto; then
  1131. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
  1132. fi
  1133. dnl
  1134. dnl Gallium Radeon configuration
  1135. dnl
  1136. AC_ARG_ENABLE([gallium-radeon],
  1137. [AS_HELP_STRING([--enable-gallium-radeon],
  1138. [build gallium radeon @<:@default=disabled@:>@])],
  1139. [enable_gallium_radeon="$enableval"],
  1140. [enable_gallium_radeon=no])
  1141. if test "x$enable_gallium_radeon" = xyes; then
  1142. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
  1143. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1144. fi
  1145. dnl
  1146. dnl Gallium Nouveau configuration
  1147. dnl
  1148. AC_ARG_ENABLE([gallium-nouveau],
  1149. [AS_HELP_STRING([--enable-gallium-nouveau],
  1150. [build gallium nouveau @<:@default=disabled@:>@])],
  1151. [enable_gallium_nouveau="$enableval"],
  1152. [enable_gallium_nouveau=no])
  1153. if test "x$enable_gallium_nouveau" = xyes; then
  1154. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
  1155. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50"
  1156. fi
  1157. dnl Restore LDFLAGS and CPPFLAGS
  1158. LDFLAGS="$_SAVE_LDFLAGS"
  1159. CPPFLAGS="$_SAVE_CPPFLAGS"
  1160. dnl Substitute the config
  1161. AC_CONFIG_FILES([configs/autoconf])
  1162. dnl Replace the configs/current symlink
  1163. AC_CONFIG_COMMANDS([configs],[
  1164. if test -f configs/current || test -L configs/current; then
  1165. rm -f configs/current
  1166. fi
  1167. ln -s autoconf configs/current
  1168. ])
  1169. AC_OUTPUT
  1170. dnl
  1171. dnl Output some configuration info for the user
  1172. dnl
  1173. echo ""
  1174. echo " prefix: $prefix"
  1175. echo " exec_prefix: $exec_prefix"
  1176. echo " libdir: $libdir"
  1177. echo " includedir: $includedir"
  1178. dnl Driver info
  1179. echo ""
  1180. echo " Driver: $mesa_driver"
  1181. if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
  1182. echo " OSMesa: lib$OSMESA_LIB"
  1183. else
  1184. echo " OSMesa: no"
  1185. fi
  1186. if test "$mesa_driver" = dri; then
  1187. # cleanup the drivers var
  1188. dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1189. if test "x$DRI_DIRS" = x; then
  1190. echo " DRI drivers: no"
  1191. else
  1192. echo " DRI drivers: $dri_dirs"
  1193. fi
  1194. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  1195. fi
  1196. echo " Use XCB: $enable_xcb"
  1197. echo ""
  1198. if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
  1199. echo " Gallium: yes"
  1200. echo " Gallium dirs: $GALLIUM_DIRS"
  1201. echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
  1202. echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
  1203. echo " Auxiliary dirs: $GALLIUM_AUXILIARY_DIRS"
  1204. echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
  1205. echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
  1206. else
  1207. echo " Gallium: no"
  1208. fi
  1209. dnl Libraries
  1210. echo ""
  1211. echo " Shared libs: $enable_shared"
  1212. echo " Static libs: $enable_static"
  1213. echo " EGL: $enable_egl"
  1214. echo " GLU: $enable_glu"
  1215. echo " GLw: $enable_glw (Motif: $enable_motif)"
  1216. echo " glut: $enable_glut"
  1217. dnl Programs
  1218. # cleanup the programs var for display
  1219. program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1220. if test "x$program_dirs" = x; then
  1221. echo " Demos: no"
  1222. else
  1223. echo " Demos: $program_dirs"
  1224. fi
  1225. dnl Compiler options
  1226. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  1227. cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1228. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1229. cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1230. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1231. defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1232. echo ""
  1233. echo " CFLAGS: $cflags"
  1234. echo " CXXFLAGS: $cxxflags"
  1235. echo " Macros: $defines"
  1236. echo ""
  1237. echo " Run '${MAKE-make}' to build Mesa"
  1238. echo ""