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

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