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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348
  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"
  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="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_AUXILIARY_DIRS="rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices vl"
  386. GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
  387. GALLIUM_STATE_TRACKERS_DIRS=""
  388. case "$mesa_driver" in
  389. xlib)
  390. DRIVER_DIRS="x11"
  391. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
  392. ;;
  393. dri)
  394. SRC_DIRS="glx/x11 $SRC_DIRS"
  395. DRIVER_DIRS="dri"
  396. WINDOW_SYSTEM="dri"
  397. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
  398. ;;
  399. osmesa)
  400. DRIVER_DIRS="osmesa"
  401. ;;
  402. esac
  403. AC_SUBST([SRC_DIRS])
  404. AC_SUBST([GLU_DIRS])
  405. AC_SUBST([DRIVER_DIRS])
  406. AC_SUBST([WINDOW_SYSTEM])
  407. AC_SUBST([GALLIUM_DIRS])
  408. AC_SUBST([GALLIUM_WINSYS_DIRS])
  409. AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
  410. AC_SUBST([GALLIUM_DRIVERS_DIRS])
  411. AC_SUBST([GALLIUM_AUXILIARY_DIRS])
  412. AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
  413. AC_SUBST([RADEON_CFLAGS])
  414. AC_SUBST([RADEON_LDFLAGS])
  415. dnl
  416. dnl User supplied program configuration
  417. dnl
  418. if test -d "$srcdir/progs/demos"; then
  419. default_demos=yes
  420. else
  421. default_demos=no
  422. fi
  423. AC_ARG_WITH([demos],
  424. [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
  425. [optional comma delimited demo directories to build
  426. @<:@default=auto if source available@:>@])],
  427. [with_demos="$withval"],
  428. [with_demos="$default_demos"])
  429. if test "x$with_demos" = x; then
  430. with_demos=no
  431. fi
  432. dnl If $with_demos is yes, directories will be added as libs available
  433. PROGRAM_DIRS=""
  434. case "$with_demos" in
  435. no) ;;
  436. yes)
  437. # If the driver isn't osmesa, we have libGL and can build xdemos
  438. if test "$mesa_driver" != osmesa; then
  439. PROGRAM_DIRS="xdemos"
  440. fi
  441. ;;
  442. *)
  443. # verify the requested demos directories exist
  444. demos=`IFS=,; echo $with_demos`
  445. for demo in $demos; do
  446. test -d "$srcdir/progs/$demo" || \
  447. AC_MSG_ERROR([Program directory '$demo' doesn't exist])
  448. done
  449. PROGRAM_DIRS="$demos"
  450. ;;
  451. esac
  452. dnl
  453. dnl Find out if X is available. The variable have_x is set if libX11 is
  454. dnl found to mimic AC_PATH_XTRA.
  455. dnl
  456. if test -n "$PKG_CONFIG"; then
  457. AC_MSG_CHECKING([pkg-config files for X11 are available])
  458. PKG_CHECK_EXISTS([x11],[
  459. x11_pkgconfig=yes
  460. have_x=yes
  461. ],[
  462. x11_pkgconfig=no
  463. ])
  464. AC_MSG_RESULT([$x11_pkgconfig])
  465. else
  466. x11_pkgconfig=no
  467. fi
  468. dnl Use the autoconf macro if no pkg-config files
  469. if test "$x11_pkgconfig" = no; then
  470. AC_PATH_XTRA
  471. fi
  472. dnl Try to tell the user that the --x-* options are only used when
  473. dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
  474. m4_divert_once([HELP_BEGIN],
  475. [These options are only used when the X libraries cannot be found by the
  476. pkg-config utility.])
  477. dnl We need X for xlib and dri, so bomb now if it's not found
  478. case "$mesa_driver" in
  479. xlib|dri)
  480. if test "$no_x" = yes; then
  481. AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
  482. fi
  483. ;;
  484. esac
  485. dnl XCB - this is only used for GLX right now
  486. AC_ARG_ENABLE([xcb],
  487. [AS_HELP_STRING([--enable-xcb],
  488. [use XCB for GLX @<:@default=disabled@:>@])],
  489. [enable_xcb="$enableval"],
  490. [enable_xcb=no])
  491. if test "x$enable_xcb" = xyes; then
  492. DEFINES="$DEFINES -DUSE_XCB"
  493. else
  494. enable_xcb=no
  495. fi
  496. dnl
  497. dnl libGL configuration per driver
  498. dnl
  499. case "$mesa_driver" in
  500. xlib)
  501. if test "$x11_pkgconfig" = yes; then
  502. PKG_CHECK_MODULES([XLIBGL], [x11 xext])
  503. GL_PC_REQ_PRIV="x11 xext"
  504. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  505. GL_LIB_DEPS="$XLIBGL_LIBS"
  506. else
  507. # should check these...
  508. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  509. GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
  510. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  511. GL_PC_CFLAGS="$X11_INCLUDES"
  512. fi
  513. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
  514. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
  515. # if static, move the external libraries to the programs
  516. # and empty the libraries for libGL
  517. if test "$enable_static" = yes; then
  518. APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
  519. GL_LIB_DEPS=""
  520. fi
  521. ;;
  522. dri)
  523. # DRI must be shared, I think
  524. if test "$enable_static" = yes; then
  525. AC_MSG_ERROR([Can't use static libraries for DRI drivers])
  526. fi
  527. # Check for libdrm
  528. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
  529. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  530. GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
  531. DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
  532. PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no)
  533. if test "$HAVE_LIBDRM_RADEON" = yes; then
  534. RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
  535. RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
  536. fi
  537. # find the DRI deps for libGL
  538. if test "$x11_pkgconfig" = yes; then
  539. # add xcb modules if necessary
  540. dri_modules="x11 xext xxf86vm xdamage xfixes"
  541. if test "$enable_xcb" = yes; then
  542. dri_modules="$dri_modules x11-xcb xcb-glx"
  543. fi
  544. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  545. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  546. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  547. GL_LIB_DEPS="$DRIGL_LIBS"
  548. else
  549. # should check these...
  550. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  551. GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
  552. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  553. GL_PC_CFLAGS="$X11_INCLUDES"
  554. # XCB can only be used from pkg-config
  555. if test "$enable_xcb" = yes; then
  556. PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
  557. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
  558. X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
  559. GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
  560. fi
  561. fi
  562. # need DRM libs, -lpthread, etc.
  563. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  564. GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  565. ;;
  566. osmesa)
  567. # No libGL for osmesa
  568. GL_LIB_DEPS=""
  569. ;;
  570. esac
  571. AC_SUBST([GL_LIB_DEPS])
  572. AC_SUBST([GL_PC_REQ_PRIV])
  573. AC_SUBST([GL_PC_LIB_PRIV])
  574. AC_SUBST([GL_PC_CFLAGS])
  575. AC_SUBST([DRI_PC_REQ_PRIV])
  576. dnl
  577. dnl More X11 setup
  578. dnl
  579. if test "$mesa_driver" = xlib; then
  580. DEFINES="$DEFINES -DUSE_XSHM"
  581. fi
  582. dnl
  583. dnl More DRI setup
  584. dnl
  585. AC_ARG_ENABLE([glx-tls],
  586. [AS_HELP_STRING([--enable-glx-tls],
  587. [enable TLS support in GLX @<:@default=disabled@:>@])],
  588. [GLX_USE_TLS="$enableval"],
  589. [GLX_USE_TLS=no])
  590. dnl Directory for DRI drivers
  591. AC_ARG_WITH([dri-driverdir],
  592. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  593. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  594. [DRI_DRIVER_INSTALL_DIR="$withval"],
  595. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  596. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  597. dnl Extra search path for DRI drivers
  598. AC_ARG_WITH([dri-searchpath],
  599. [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
  600. [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
  601. [DRI_DRIVER_SEARCH_DIR="$withval"],
  602. [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
  603. AC_SUBST([DRI_DRIVER_SEARCH_DIR])
  604. dnl Direct rendering or just indirect rendering
  605. AC_ARG_ENABLE([driglx-direct],
  606. [AS_HELP_STRING([--disable-driglx-direct],
  607. [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
  608. [driglx_direct="$enableval"],
  609. [driglx_direct="yes"])
  610. dnl Which drivers to build - default is chosen by platform
  611. AC_ARG_WITH([dri-drivers],
  612. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  613. [comma delimited DRI drivers list, e.g.
  614. "swrast,i965,radeon" @<:@default=auto@:>@])],
  615. [with_dri_drivers="$withval"],
  616. [with_dri_drivers=yes])
  617. if test "x$with_dri_drivers" = x; then
  618. with_dri_drivers=no
  619. fi
  620. dnl If $with_dri_drivers is yes, directories will be added through
  621. dnl platform checks
  622. DRI_DIRS=""
  623. case "$with_dri_drivers" in
  624. no) ;;
  625. yes)
  626. DRI_DIRS="yes"
  627. ;;
  628. *)
  629. # verify the requested driver directories exist
  630. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  631. for driver in $dri_drivers; do
  632. test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
  633. AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
  634. done
  635. DRI_DIRS="$dri_drivers"
  636. ;;
  637. esac
  638. dnl Just default to no EGL for now
  639. USING_EGL=0
  640. AC_SUBST([USING_EGL])
  641. dnl Set DRI_DIRS, DEFINES and LIB_DEPS
  642. if test "$mesa_driver" = dri; then
  643. # Use TLS in GLX?
  644. if test "x$GLX_USE_TLS" = xyes; then
  645. DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
  646. fi
  647. if test "x$USING_EGL" = x1; then
  648. PROGRAM_DIRS="egl"
  649. fi
  650. # Platform specific settings and drivers to build
  651. case "$host_os" in
  652. linux*)
  653. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  654. if test "x$driglx_direct" = xyes; then
  655. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  656. fi
  657. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  658. case "$host_cpu" in
  659. x86_64)
  660. # ffb, gamma, and sis are missing because they have not be
  661. # converted to use the new interface. i810 are missing
  662. # because there is no x86-64 system where they could *ever*
  663. # be used.
  664. if test "x$DRI_DIRS" = "xyes"; then
  665. DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  666. savage tdfx unichrome swrast"
  667. fi
  668. ;;
  669. powerpc*)
  670. # Build only the drivers for cards that exist on PowerPC.
  671. # At some point MGA will be added, but not yet.
  672. if test "x$DRI_DIRS" = "xyes"; then
  673. DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
  674. fi
  675. ;;
  676. sparc*)
  677. # Build only the drivers for cards that exist on sparc`
  678. if test "x$DRI_DIRS" = "xyes"; then
  679. DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast"
  680. fi
  681. ;;
  682. esac
  683. ;;
  684. freebsd* | dragonfly*)
  685. DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
  686. DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
  687. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  688. if test "x$driglx_direct" = xyes; then
  689. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  690. fi
  691. if test "x$GXX" = xyes; then
  692. CXXFLAGS="$CXXFLAGS -ansi -pedantic"
  693. fi
  694. # ffb and gamma are missing because they have not been converted
  695. # to use the new interface.
  696. if test "x$DRI_DIRS" = "xyes"; then
  697. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
  698. unichrome savage sis swrast"
  699. fi
  700. ;;
  701. gnu*)
  702. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  703. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  704. ;;
  705. solaris*)
  706. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  707. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  708. if test "x$driglx_direct" = xyes; then
  709. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  710. fi
  711. ;;
  712. esac
  713. # default drivers
  714. if test "x$DRI_DIRS" = "xyes"; then
  715. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  716. savage sis tdfx unichrome ffb swrast"
  717. fi
  718. DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
  719. # Check for expat
  720. EXPAT_INCLUDES=""
  721. EXPAT_LIB=-lexpat
  722. AC_ARG_WITH([expat],
  723. [AS_HELP_STRING([--with-expat=DIR],
  724. [expat install directory])],[
  725. EXPAT_INCLUDES="-I$withval/include"
  726. CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
  727. LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
  728. EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
  729. ])
  730. AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
  731. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  732. [AC_MSG_ERROR([Expat required for DRI.])])
  733. # put all the necessary libs together
  734. DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
  735. fi
  736. AC_SUBST([DRI_DIRS])
  737. AC_SUBST([EXPAT_INCLUDES])
  738. AC_SUBST([DRI_LIB_DEPS])
  739. dnl
  740. dnl OSMesa configuration
  741. dnl
  742. if test "$mesa_driver" = xlib; then
  743. default_gl_osmesa=yes
  744. else
  745. default_gl_osmesa=no
  746. fi
  747. AC_ARG_ENABLE([gl-osmesa],
  748. [AS_HELP_STRING([--enable-gl-osmesa],
  749. [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
  750. [gl_osmesa="$enableval"],
  751. [gl_osmesa="$default_gl_osmesa"])
  752. if test "x$gl_osmesa" = xyes; then
  753. if test "$mesa_driver" = osmesa; then
  754. AC_MSG_ERROR([libGL is not available for OSMesa driver])
  755. else
  756. DRIVER_DIRS="$DRIVER_DIRS osmesa"
  757. fi
  758. fi
  759. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  760. AC_ARG_WITH([osmesa-bits],
  761. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  762. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  763. [osmesa_bits="$withval"],
  764. [osmesa_bits=8])
  765. if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
  766. AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
  767. osmesa_bits=8
  768. fi
  769. case "x$osmesa_bits" in
  770. x8)
  771. OSMESA_LIB=OSMesa
  772. ;;
  773. x16|x32)
  774. OSMESA_LIB="OSMesa$osmesa_bits"
  775. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  776. ;;
  777. *)
  778. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  779. ;;
  780. esac
  781. AC_SUBST([OSMESA_LIB])
  782. case "$mesa_driver" in
  783. osmesa)
  784. # only link libraries with osmesa if shared
  785. if test "$enable_static" = no; then
  786. OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  787. else
  788. OSMESA_LIB_DEPS=""
  789. fi
  790. OSMESA_MESA_DEPS=""
  791. OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  792. ;;
  793. *)
  794. # Link OSMesa to libGL otherwise
  795. OSMESA_LIB_DEPS=""
  796. # only link libraries with osmesa if shared
  797. if test "$enable_static" = no; then
  798. OSMESA_MESA_DEPS='-l$(GL_LIB)'
  799. else
  800. OSMESA_MESA_DEPS=""
  801. fi
  802. OSMESA_PC_REQ="gl"
  803. ;;
  804. esac
  805. OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
  806. AC_SUBST([OSMESA_LIB_DEPS])
  807. AC_SUBST([OSMESA_MESA_DEPS])
  808. AC_SUBST([OSMESA_PC_REQ])
  809. AC_SUBST([OSMESA_PC_LIB_PRIV])
  810. dnl
  811. dnl EGL configuration
  812. dnl
  813. AC_ARG_ENABLE([egl],
  814. [AS_HELP_STRING([--disable-egl],
  815. [disable EGL library @<:@default=enabled@:>@])],
  816. [enable_egl="$enableval"],
  817. [enable_egl=yes])
  818. if test "x$enable_egl" = xyes; then
  819. SRC_DIRS="$SRC_DIRS egl"
  820. if test "$x11_pkgconfig" = yes; then
  821. PKG_CHECK_MODULES([EGL], [x11])
  822. EGL_LIB_DEPS="$EGL_LIBS"
  823. else
  824. # should check these...
  825. EGL_LIB_DEPS="$X_LIBS -lX11"
  826. fi
  827. EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
  828. fi
  829. AC_SUBST([EGL_LIB_DEPS])
  830. dnl
  831. dnl GLU configuration
  832. dnl
  833. AC_ARG_ENABLE([glu],
  834. [AS_HELP_STRING([--disable-glu],
  835. [enable OpenGL Utility library @<:@default=enabled@:>@])],
  836. [enable_glu="$enableval"],
  837. [enable_glu=yes])
  838. if test "x$enable_glu" = xyes; then
  839. SRC_DIRS="$SRC_DIRS glu"
  840. case "$mesa_driver" in
  841. osmesa)
  842. # If GLU is available and we have libOSMesa (not 16 or 32),
  843. # we can build the osdemos
  844. if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
  845. PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
  846. fi
  847. # Link libGLU to libOSMesa instead of libGL
  848. GLU_LIB_DEPS=""
  849. GLU_PC_REQ="osmesa"
  850. if test "$enable_static" = no; then
  851. GLU_MESA_DEPS='-l$(OSMESA_LIB)'
  852. else
  853. GLU_MESA_DEPS=""
  854. fi
  855. ;;
  856. *)
  857. # If static, empty GLU_LIB_DEPS and add libs for programs to link
  858. GLU_PC_REQ="gl"
  859. GLU_PC_LIB_PRIV="-lm"
  860. if test "$enable_static" = no; then
  861. GLU_LIB_DEPS="-lm"
  862. GLU_MESA_DEPS='-l$(GL_LIB)'
  863. else
  864. GLU_LIB_DEPS=""
  865. GLU_MESA_DEPS=""
  866. APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
  867. fi
  868. ;;
  869. esac
  870. fi
  871. if test "$enable_static" = no; then
  872. GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
  873. fi
  874. GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
  875. AC_SUBST([GLU_LIB_DEPS])
  876. AC_SUBST([GLU_MESA_DEPS])
  877. AC_SUBST([GLU_PC_REQ])
  878. AC_SUBST([GLU_PC_REQ_PRIV])
  879. AC_SUBST([GLU_PC_LIB_PRIV])
  880. AC_SUBST([GLU_PC_CFLAGS])
  881. dnl
  882. dnl GLw configuration
  883. dnl
  884. AC_ARG_ENABLE([glw],
  885. [AS_HELP_STRING([--disable-glw],
  886. [enable Xt/Motif widget library @<:@default=enabled@:>@])],
  887. [enable_glw="$enableval"],
  888. [enable_glw=yes])
  889. dnl Don't build GLw on osmesa
  890. if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
  891. AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
  892. enable_glw=no
  893. fi
  894. AC_ARG_ENABLE([motif],
  895. [AS_HELP_STRING([--enable-motif],
  896. [use Motif widgets in GLw @<:@default=disabled@:>@])],
  897. [enable_motif="$enableval"],
  898. [enable_motif=no])
  899. if test "x$enable_glw" = xyes; then
  900. SRC_DIRS="$SRC_DIRS glw"
  901. if test "$x11_pkgconfig" = yes; then
  902. PKG_CHECK_MODULES([GLW],[x11 xt])
  903. GLW_PC_REQ_PRIV="x11 xt"
  904. GLW_LIB_DEPS="$GLW_LIBS"
  905. else
  906. # should check these...
  907. GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
  908. GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
  909. GLW_PC_CFLAGS="$X11_INCLUDES"
  910. fi
  911. GLW_SOURCES="GLwDrawA.c"
  912. MOTIF_CFLAGS=
  913. if test "x$enable_motif" = xyes; then
  914. GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
  915. AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
  916. if test "x$MOTIF_CONFIG" != xno; then
  917. MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
  918. MOTIF_LIBS=`$MOTIF_CONFIG --libs`
  919. else
  920. AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
  921. [AC_MSG_ERROR([Can't locate Motif headers])])
  922. AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
  923. [AC_MSG_ERROR([Can't locate Motif Xm library])])
  924. fi
  925. # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
  926. GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
  927. GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
  928. GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
  929. fi
  930. # If static, empty GLW_LIB_DEPS and add libs for programs to link
  931. GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
  932. if test "$enable_static" = no; then
  933. GLW_MESA_DEPS='-l$(GL_LIB)'
  934. GLW_LIB_DEPS="$GLW_LIB_DEPS"
  935. else
  936. APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
  937. GLW_LIB_DEPS=""
  938. GLW_MESA_DEPS=""
  939. fi
  940. fi
  941. AC_SUBST([GLW_LIB_DEPS])
  942. AC_SUBST([GLW_MESA_DEPS])
  943. AC_SUBST([GLW_SOURCES])
  944. AC_SUBST([MOTIF_CFLAGS])
  945. AC_SUBST([GLW_PC_REQ_PRIV])
  946. AC_SUBST([GLW_PC_LIB_PRIV])
  947. AC_SUBST([GLW_PC_CFLAGS])
  948. dnl
  949. dnl GLUT configuration
  950. dnl
  951. if test -f "$srcdir/include/GL/glut.h"; then
  952. default_glut=yes
  953. else
  954. default_glut=no
  955. fi
  956. AC_ARG_ENABLE([glut],
  957. [AS_HELP_STRING([--disable-glut],
  958. [enable GLUT library @<:@default=enabled if source available@:>@])],
  959. [enable_glut="$enableval"],
  960. [enable_glut="$default_glut"])
  961. dnl Can't build glut if GLU not available
  962. if test "x$enable_glu$enable_glut" = xnoyes; then
  963. AC_MSG_WARN([Disabling glut since GLU is disabled])
  964. enable_glut=no
  965. fi
  966. dnl Don't build glut on osmesa
  967. if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
  968. AC_MSG_WARN([Disabling glut since the driver is OSMesa])
  969. enable_glut=no
  970. fi
  971. if test "x$enable_glut" = xyes; then
  972. SRC_DIRS="$SRC_DIRS glut/glx"
  973. GLUT_CFLAGS=""
  974. if test "x$GCC" = xyes; then
  975. GLUT_CFLAGS="-fexceptions"
  976. fi
  977. if test "$x11_pkgconfig" = yes; then
  978. PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
  979. GLUT_PC_REQ_PRIV="x11 xmu xi"
  980. GLUT_LIB_DEPS="$GLUT_LIBS"
  981. else
  982. # should check these...
  983. GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
  984. GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
  985. GLUT_PC_CFLAGS="$X11_INCLUDES"
  986. fi
  987. GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
  988. GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
  989. # If glut is available, we can build most programs
  990. if test "$with_demos" = yes; then
  991. PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
  992. fi
  993. # If static, empty GLUT_LIB_DEPS and add libs for programs to link
  994. if test "$enable_static" = no; then
  995. GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
  996. else
  997. APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
  998. GLUT_LIB_DEPS=""
  999. GLUT_MESA_DEPS=""
  1000. fi
  1001. fi
  1002. AC_SUBST([GLUT_LIB_DEPS])
  1003. AC_SUBST([GLUT_MESA_DEPS])
  1004. AC_SUBST([GLUT_CFLAGS])
  1005. AC_SUBST([GLUT_PC_REQ_PRIV])
  1006. AC_SUBST([GLUT_PC_LIB_PRIV])
  1007. AC_SUBST([GLUT_PC_CFLAGS])
  1008. dnl
  1009. dnl Program library dependencies
  1010. dnl Only libm is added here if necessary as the libraries should
  1011. dnl be pulled in by the linker
  1012. dnl
  1013. if test "x$APP_LIB_DEPS" = x; then
  1014. case "$host_os" in
  1015. solaris*)
  1016. APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
  1017. ;;
  1018. cygwin*)
  1019. APP_LIB_DEPS="-lX11"
  1020. ;;
  1021. *)
  1022. APP_LIB_DEPS="-lm"
  1023. ;;
  1024. esac
  1025. fi
  1026. AC_SUBST([APP_LIB_DEPS])
  1027. AC_SUBST([PROGRAM_DIRS])
  1028. dnl
  1029. dnl Gallium configuration
  1030. dnl
  1031. AC_ARG_ENABLE([gallium],
  1032. [AS_HELP_STRING([--disable-gallium],
  1033. [build gallium @<:@default=enabled@:>@])],
  1034. [enable_gallium="$enableval"],
  1035. [enable_gallium=yes])
  1036. if test "x$enable_gallium" = xyes; then
  1037. SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
  1038. fi
  1039. dnl
  1040. dnl Gallium state trackers configuration
  1041. dnl
  1042. AC_ARG_WITH([state-trackers],
  1043. [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
  1044. [comma delimited state_trackers list, e.g.
  1045. "egl,glx" @<:@default=auto@:>@])],
  1046. [with_state_trackers="$withval"],
  1047. [with_state_trackers=yes])
  1048. case "$with_state_trackers" in
  1049. no)
  1050. GALLIUM_STATE_TRACKERS_DIRS=""
  1051. ;;
  1052. yes)
  1053. # look at what else is built
  1054. case "$mesa_driver" in
  1055. xlib)
  1056. GALLIUM_STATE_TRACKERS_DIRS=glx
  1057. ;;
  1058. dri)
  1059. GALLIUM_STATE_TRACKERS_DIRS="dri"
  1060. if test "x$enable_egl" = xyes; then
  1061. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
  1062. fi
  1063. # Have only tested st/xorg on 1.6.0 servers
  1064. PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0],
  1065. HAVE_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
  1066. HAVE_XORG="no")
  1067. ;;
  1068. esac
  1069. ;;
  1070. *)
  1071. # verify the requested state tracker exist
  1072. state_trackers=`IFS=', '; echo $with_state_trackers`
  1073. for tracker in $state_trackers; do
  1074. test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
  1075. AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
  1076. if test "$tracker" = egl && test "x$enable_egl" != xyes; then
  1077. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1078. fi
  1079. if test "$tracker" = xorg; then
  1080. PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
  1081. HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
  1082. HAVE_XEXTPROTO_71="no")
  1083. fi
  1084. done
  1085. GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
  1086. ;;
  1087. esac
  1088. AC_ARG_WITH([xorg-driver-dir],
  1089. [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
  1090. [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
  1091. [XORG_DRIVER_INSTALL_DIR="$withval"],
  1092. [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
  1093. AC_SUBST([XORG_DRIVER_INSTALL_DIR])
  1094. AC_ARG_WITH([max-width],
  1095. [AS_HELP_STRING([--with-max-width=N],
  1096. [Maximum framebuffer width (4096)])],
  1097. [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
  1098. AS_IF([test "${withval}" -gt "4096"],
  1099. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1100. )
  1101. AC_ARG_WITH([max-height],
  1102. [AS_HELP_STRING([--with-max-height=N],
  1103. [Maximum framebuffer height (4096)])],
  1104. [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
  1105. AS_IF([test "${withval}" -gt "4096"],
  1106. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1107. )
  1108. dnl
  1109. dnl Gallium SVGA configuration
  1110. dnl
  1111. AC_ARG_ENABLE([gallium-svga],
  1112. [AS_HELP_STRING([--enable-gallium-svga],
  1113. [build gallium SVGA @<:@default=disabled@:>@])],
  1114. [enable_gallium_svga="$enableval"],
  1115. [enable_gallium_svga=auto])
  1116. if test "x$enable_gallium_svga" = xyes; then
  1117. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
  1118. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
  1119. elif test "x$enable_gallium_svga" = xauto; then
  1120. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
  1121. fi
  1122. dnl
  1123. dnl Gallium Intel configuration
  1124. dnl
  1125. AC_ARG_ENABLE([gallium-intel],
  1126. [AS_HELP_STRING([--enable-gallium-intel],
  1127. [build gallium intel @<:@default=disabled@:>@])],
  1128. [enable_gallium_intel="$enableval"],
  1129. [enable_gallium_intel=auto])
  1130. if test "x$enable_gallium_intel" = xyes; then
  1131. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel"
  1132. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
  1133. elif test "x$enable_gallium_intel" = xauto; then
  1134. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
  1135. fi
  1136. dnl
  1137. dnl Gallium Radeon configuration
  1138. dnl
  1139. AC_ARG_ENABLE([gallium-radeon],
  1140. [AS_HELP_STRING([--enable-gallium-radeon],
  1141. [build gallium radeon @<:@default=disabled@:>@])],
  1142. [enable_gallium_radeon="$enableval"],
  1143. [enable_gallium_radeon=no])
  1144. if test "x$enable_gallium_radeon" = xyes; then
  1145. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
  1146. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1147. fi
  1148. dnl
  1149. dnl Gallium Nouveau configuration
  1150. dnl
  1151. AC_ARG_ENABLE([gallium-nouveau],
  1152. [AS_HELP_STRING([--enable-gallium-nouveau],
  1153. [build gallium nouveau @<:@default=disabled@:>@])],
  1154. [enable_gallium_nouveau="$enableval"],
  1155. [enable_gallium_nouveau=no])
  1156. if test "x$enable_gallium_nouveau" = xyes; then
  1157. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
  1158. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50"
  1159. fi
  1160. dnl Restore LDFLAGS and CPPFLAGS
  1161. LDFLAGS="$_SAVE_LDFLAGS"
  1162. CPPFLAGS="$_SAVE_CPPFLAGS"
  1163. dnl Substitute the config
  1164. AC_CONFIG_FILES([configs/autoconf])
  1165. dnl Replace the configs/current symlink
  1166. AC_CONFIG_COMMANDS([configs],[
  1167. if test -f configs/current || test -L configs/current; then
  1168. rm -f configs/current
  1169. fi
  1170. ln -s autoconf configs/current
  1171. ])
  1172. AC_OUTPUT
  1173. dnl
  1174. dnl Output some configuration info for the user
  1175. dnl
  1176. echo ""
  1177. echo " prefix: $prefix"
  1178. echo " exec_prefix: $exec_prefix"
  1179. echo " libdir: $libdir"
  1180. echo " includedir: $includedir"
  1181. dnl Driver info
  1182. echo ""
  1183. echo " Driver: $mesa_driver"
  1184. if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
  1185. echo " OSMesa: lib$OSMESA_LIB"
  1186. else
  1187. echo " OSMesa: no"
  1188. fi
  1189. if test "$mesa_driver" = dri; then
  1190. # cleanup the drivers var
  1191. dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1192. if test "x$DRI_DIRS" = x; then
  1193. echo " DRI drivers: no"
  1194. else
  1195. echo " DRI drivers: $dri_dirs"
  1196. fi
  1197. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  1198. fi
  1199. echo " Use XCB: $enable_xcb"
  1200. echo ""
  1201. if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
  1202. echo " Gallium: yes"
  1203. echo " Gallium dirs: $GALLIUM_DIRS"
  1204. echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
  1205. echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
  1206. echo " Auxiliary dirs: $GALLIUM_AUXILIARY_DIRS"
  1207. echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
  1208. echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
  1209. else
  1210. echo " Gallium: no"
  1211. fi
  1212. dnl Libraries
  1213. echo ""
  1214. echo " Shared libs: $enable_shared"
  1215. echo " Static libs: $enable_static"
  1216. echo " EGL: $enable_egl"
  1217. echo " GLU: $enable_glu"
  1218. echo " GLw: $enable_glw (Motif: $enable_motif)"
  1219. echo " glut: $enable_glut"
  1220. dnl Programs
  1221. # cleanup the programs var for display
  1222. program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1223. if test "x$program_dirs" = x; then
  1224. echo " Demos: no"
  1225. else
  1226. echo " Demos: $program_dirs"
  1227. fi
  1228. dnl Compiler options
  1229. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  1230. cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1231. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1232. cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1233. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1234. defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1235. echo ""
  1236. echo " CFLAGS: $cflags"
  1237. echo " CXXFLAGS: $cxxflags"
  1238. echo " Macros: $defines"
  1239. echo ""
  1240. echo " Run '${MAKE-make}' to build Mesa"
  1241. echo ""