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

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