Clone of mesa.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

configure.ac 39KB

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