Clone of mesa.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

configure.ac 41KB

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