Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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