Clone of mesa.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

configure.ac 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  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. AC_INIT([Mesa],[mesa_version],
  13. [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
  14. AC_CONFIG_AUX_DIR([bin])
  15. AC_CANONICAL_HOST
  16. dnl Versions for external dependencies
  17. LIBDRM_REQUIRED=2.3.1
  18. DRI2PROTO_REQUIRED=1.1
  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. MKDEP_OPTIONS=-fdepend
  27. dnl Ask gcc where it's keeping its secret headers
  28. if test "x$GCC" = xyes; then
  29. GCC_INCLUDES=`$CC -print-file-name=include`
  30. if test "x$GCC_INCLUDES" != x; then
  31. MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
  32. fi
  33. fi
  34. AC_SUBST([MKDEP_OPTIONS])
  35. dnl Check to see if dlopen is in default libraries (like Solaris, which
  36. dnl has it in libc), or if libdl is needed to get it.
  37. AC_CHECK_FUNC([dlopen], [],
  38. [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
  39. dnl Make sure the pkg-config macros are defined
  40. m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
  41. m4_errprint([Error: Could not locate the pkg-config autoconf macros.
  42. These are usually located in /usr/share/aclocal/pkg.m4. If your
  43. macros are in a different location, try setting the environment
  44. variable ACLOCAL="aclocal -I/other/macro/dir" before running
  45. autoreconf.
  46. ])
  47. m4_exit([1])
  48. ])
  49. PKG_PROG_PKG_CONFIG()
  50. dnl LIB_DIR - library basename
  51. LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
  52. AC_SUBST([LIB_DIR])
  53. dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
  54. _SAVE_LDFLAGS="$LDFLAGS"
  55. AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
  56. AC_SUBST([EXTRA_LIB_PATH])
  57. dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
  58. _SAVE_CPPFLAGS="$CPPFLAGS"
  59. AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
  60. AC_SUBST([X11_INCLUDES])
  61. dnl Compiler macros
  62. DEFINES=""
  63. AC_SUBST([DEFINES])
  64. case "$host_os" in
  65. linux*)
  66. if test "x$GCC" = xyes; then
  67. DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
  68. fi
  69. DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
  70. ;;
  71. esac
  72. dnl Add flags for gcc and g++
  73. if test "x$GCC" = xyes; then
  74. CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
  75. # Work around aliasing bugs - developers should comment this out
  76. CFLAGS="$CFLAGS -fno-strict-aliasing"
  77. fi
  78. if test "x$GXX" = xyes; then
  79. CXXFLAGS="$CXXFLAGS -Wall"
  80. # Work around aliasing bugs - developers should comment this out
  81. CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
  82. fi
  83. dnl These should be unnecessary, but let the user set them if they want
  84. AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
  85. Default is to use CFLAGS.])
  86. AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
  87. compiler. Default is to use CFLAGS.])
  88. AC_SUBST([OPT_FLAGS])
  89. AC_SUBST([ARCH_FLAGS])
  90. dnl
  91. dnl Hacks to enable 32 or 64 bit build
  92. dnl
  93. AC_ARG_ENABLE([32-bit],
  94. [AS_HELP_STRING([--enable-32-bit],
  95. [build 32-bit libraries @<:@default=auto@:>@])],
  96. [enable_32bit="$enableval"],
  97. [enable_32bit=auto]
  98. )
  99. if test "x$enable_32bit" = xyes; then
  100. if test "x$GCC" = xyes; then
  101. CFLAGS="$CFLAGS -m32"
  102. fi
  103. if test "x$GXX" = xyes; then
  104. CXXFLAGS="$CXXFLAGS -m32"
  105. fi
  106. fi
  107. AC_ARG_ENABLE([64-bit],
  108. [AS_HELP_STRING([--enable-64-bit],
  109. [build 64-bit libraries @<:@default=auto@:>@])],
  110. [enable_64bit="$enableval"],
  111. [enable_64bit=auto]
  112. )
  113. if test "x$enable_64bit" = xyes; then
  114. if test "x$GCC" = xyes; then
  115. CFLAGS="$CFLAGS -m64"
  116. fi
  117. if test "x$GXX" = xyes; then
  118. CXXFLAGS="$CXXFLAGS -m64"
  119. fi
  120. fi
  121. dnl
  122. dnl shared/static libraries, mimic libtool options
  123. dnl
  124. AC_ARG_ENABLE([static],
  125. [AS_HELP_STRING([--enable-static],
  126. [build static libraries @<:@default=disabled@:>@])],
  127. [enable_static="$enableval"],
  128. [enable_static=no]
  129. )
  130. case "x$enable_static" in
  131. xyes|xno ) ;;
  132. x ) enable_static=no ;;
  133. * )
  134. AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
  135. ;;
  136. esac
  137. AC_ARG_ENABLE([shared],
  138. [AS_HELP_STRING([--disable-shared],
  139. [build shared libraries @<:@default=enabled@:>@])],
  140. [enable_shared="$enableval"],
  141. [enable_shared=yes]
  142. )
  143. case "x$enable_shared" in
  144. xyes|xno ) ;;
  145. x ) enable_shared=yes ;;
  146. * )
  147. AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
  148. ;;
  149. esac
  150. dnl Can't have static and shared libraries, default to static if user
  151. dnl explicitly requested. If both disabled, set to static since shared
  152. dnl was explicitly requirested.
  153. case "x$enable_static$enable_shared" in
  154. xyesyes )
  155. AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
  156. enable_shared=no
  157. ;;
  158. xnono )
  159. AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
  160. enable_static=yes
  161. ;;
  162. esac
  163. dnl
  164. dnl mklib options
  165. dnl
  166. AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
  167. if test "$enable_static" = yes; then
  168. MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
  169. fi
  170. AC_SUBST([MKLIB_OPTIONS])
  171. dnl
  172. dnl other compiler options
  173. dnl
  174. AC_ARG_ENABLE([debug],
  175. [AS_HELP_STRING([--enable-debug],
  176. [use debug compiler flags and macros @<:@default=disabled@:>@])],
  177. [enable_debug="$enableval"],
  178. [enable_debug=no]
  179. )
  180. if test "x$enable_debug" = xyes; then
  181. DEFINES="$DEFINES -DDEBUG"
  182. if test "x$GCC" = xyes; then
  183. CFLAGS="$CFLAGS -g"
  184. fi
  185. if test "x$GXX" = xyes; then
  186. CXXFLAGS="$CXXFLAGS -g"
  187. fi
  188. fi
  189. dnl
  190. dnl library names
  191. dnl
  192. if test "$enable_static" = yes; then
  193. GL_LIB_NAME='lib$(GL_LIB).a'
  194. GLU_LIB_NAME='lib$(GLU_LIB).a'
  195. GLUT_LIB_NAME='lib$(GLUT_LIB).a'
  196. GLW_LIB_NAME='lib$(GLW_LIB).a'
  197. OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
  198. else
  199. GL_LIB_NAME='lib$(GL_LIB).so'
  200. GLU_LIB_NAME='lib$(GLU_LIB).so'
  201. GLUT_LIB_NAME='lib$(GLUT_LIB).so'
  202. GLW_LIB_NAME='lib$(GLW_LIB).so'
  203. OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
  204. fi
  205. AC_SUBST([GL_LIB_NAME])
  206. AC_SUBST([GLU_LIB_NAME])
  207. AC_SUBST([GLUT_LIB_NAME])
  208. AC_SUBST([GLW_LIB_NAME])
  209. AC_SUBST([OSMESA_LIB_NAME])
  210. dnl
  211. dnl Driver configuration. Options are xlib, dri and osmesa right now.
  212. dnl More later: directfb, fbdev, ...
  213. dnl
  214. default_driver="xlib"
  215. case "$host_os" in
  216. linux*)
  217. case "$host_cpu" in
  218. i*86|x86_64|powerpc*) default_driver="dri";;
  219. esac
  220. ;;
  221. freebsd* | dragonfly*)
  222. case "$host_cpu" in
  223. i*86|x86_64) default_driver="dri";;
  224. esac
  225. ;;
  226. esac
  227. AC_ARG_WITH([driver],
  228. [AS_HELP_STRING([--with-driver=DRIVER],
  229. [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
  230. [mesa_driver="$withval"],
  231. [mesa_driver="$default_driver"])
  232. dnl Check for valid option
  233. case "x$mesa_driver" in
  234. xxlib|xdri|xosmesa)
  235. ;;
  236. *)
  237. AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
  238. ;;
  239. esac
  240. dnl
  241. dnl Driver specific build directories
  242. dnl
  243. SRC_DIRS="mesa"
  244. GLU_DIRS="sgi"
  245. WINDOW_SYSTEM=""
  246. case "$mesa_driver" in
  247. xlib)
  248. DRIVER_DIRS="x11"
  249. ;;
  250. dri)
  251. SRC_DIRS="glx/x11 $SRC_DIRS"
  252. DRIVER_DIRS="dri"
  253. WINDOW_SYSTEM="dri"
  254. ;;
  255. osmesa)
  256. DRIVER_DIRS="osmesa"
  257. ;;
  258. esac
  259. AC_SUBST([SRC_DIRS])
  260. AC_SUBST([GLU_DIRS])
  261. AC_SUBST([DRIVER_DIRS])
  262. AC_SUBST([WINDOW_SYSTEM])
  263. dnl
  264. dnl User supplied program configuration
  265. dnl
  266. if test -d "$srcdir/progs/demos"; then
  267. default_demos=yes
  268. else
  269. default_demos=no
  270. fi
  271. AC_ARG_WITH([demos],
  272. [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
  273. [optional comma delimited demo directories to build
  274. @<:@default=auto if source available@:>@])],
  275. [with_demos="$withval"],
  276. [with_demos="$default_demos"])
  277. if test "x$with_demos" = x; then
  278. with_demos=no
  279. fi
  280. dnl If $with_demos is yes, directories will be added as libs available
  281. PROGRAM_DIRS=""
  282. case "$with_demos" in
  283. no) ;;
  284. yes)
  285. # If the driver isn't osmesa, we have libGL and can build xdemos
  286. if test "$mesa_driver" != osmesa; then
  287. PROGRAM_DIRS="xdemos"
  288. fi
  289. ;;
  290. *)
  291. # verify the requested demos directories exist
  292. demos=`IFS=,; echo $with_demos`
  293. for demo in $demos; do
  294. test -d "$srcdir/progs/$demo" || \
  295. AC_MSG_ERROR([Program directory '$demo' doesn't exist])
  296. done
  297. PROGRAM_DIRS="$demos"
  298. ;;
  299. esac
  300. dnl
  301. dnl Find out if X is available. The variable have_x is set if libX11 is
  302. dnl to mimic AC_PATH_XTRA.
  303. dnl
  304. if test -n "$PKG_CONFIG"; then
  305. AC_MSG_CHECKING([pkg-config files for X11 are available])
  306. PKG_CHECK_EXISTS([x11],[
  307. x11_pkgconfig=yes
  308. have_x=yes
  309. ],[
  310. x11_pkgconfig=no
  311. ])
  312. AC_MSG_RESULT([$x11_pkgconfig])
  313. else
  314. x11_pkgconfig=no
  315. fi
  316. dnl Use the autoconf macro if no pkg-config files
  317. if test "$x11_pkgconfig" = no; then
  318. AC_PATH_XTRA
  319. fi
  320. dnl We need X for xlib and dri, so bomb now if it's not found
  321. case "$mesa_driver" in
  322. xlib|dri)
  323. if test "$no_x" = yes; then
  324. AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
  325. fi
  326. ;;
  327. esac
  328. dnl XCB - this is only used for GLX right now
  329. AC_ARG_ENABLE([xcb],
  330. [AS_HELP_STRING([--enable-xcb],
  331. [use XCB for GLX @<:@default=disabled@:>@])],
  332. [enable_xcb="$enableval"],
  333. [enable_xcb=no])
  334. if test "x$enable_xcb" = xyes; then
  335. DEFINES="$DEFINES -DUSE_XCB"
  336. else
  337. enable_xcb=no
  338. fi
  339. # SELinux awareness.
  340. AC_ARG_ENABLE([selinux],
  341. [AS_HELP_STRING([--enable-selinux],
  342. [Build SELinux-aware Mesa (default: disabled)])],
  343. [MESA_SELINUX="$enableval"],
  344. [MESA_SELINUX=no])
  345. if test "x$enable_selinux" = "xyes"; then
  346. AC_CHECK_HEADER([selinux/selinux.h],[],
  347. [AC_MSG_ERROR([SELinux headers not found])])
  348. AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
  349. [AC_MSG_ERROR([SELinux library not found])])
  350. SELINUX_LIBS="-lselinux"
  351. DEFINES="$DEFINES -DMESA_SELINUX"
  352. fi
  353. dnl
  354. dnl libGL configuration per driver
  355. dnl
  356. case "$mesa_driver" in
  357. xlib)
  358. if test "$x11_pkgconfig" = yes; then
  359. PKG_CHECK_MODULES([XLIBGL], [x11 xext])
  360. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  361. GL_LIB_DEPS="$XLIBGL_LIBS"
  362. else
  363. # should check these...
  364. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  365. GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
  366. fi
  367. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
  368. # if static, move the external libraries to the programs
  369. # and empty the libraries for libGL
  370. if test "$enable_static" = yes; then
  371. APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
  372. GL_LIB_DEPS=""
  373. fi
  374. ;;
  375. dri)
  376. # DRI must be shared, I think
  377. if test "$enable_static" = yes; then
  378. AC_MSG_ERROR([Can't use static libraries for DRI drivers])
  379. fi
  380. # Check for libdrm
  381. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
  382. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  383. # find the DRI deps for libGL
  384. if test "$x11_pkgconfig" = yes; then
  385. # add xcb modules if necessary
  386. dri_modules="x11 xext xxf86vm xdamage xfixes"
  387. if test "$enable_xcb" = yes; then
  388. dri_modules="$dri_modules x11-xcb xcb-glx"
  389. fi
  390. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  391. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  392. GL_LIB_DEPS="$DRIGL_LIBS"
  393. else
  394. # should check these...
  395. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  396. GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
  397. # XCB can only be used from pkg-config
  398. if test "$enable_xcb" = yes; then
  399. PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
  400. X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
  401. GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
  402. fi
  403. fi
  404. # need DRM libs, -lpthread, etc.
  405. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  406. ;;
  407. osmesa)
  408. # No libGL for osmesa
  409. GL_LIB_DEPS=""
  410. ;;
  411. esac
  412. AC_SUBST([GL_LIB_DEPS])
  413. dnl
  414. dnl More X11 setup
  415. dnl
  416. if test "$mesa_driver" = xlib; then
  417. DEFINES="$DEFINES -DUSE_XSHM"
  418. fi
  419. dnl
  420. dnl More DRI setup
  421. dnl
  422. AC_ARG_ENABLE([glx-tls],
  423. [AS_HELP_STRING([--enable-glx-tls],
  424. [enable TLS support in GLX @<:@default=disabled@:>@])],
  425. [GLX_USE_TLS="$enableval"],
  426. [GLX_USE_TLS=no])
  427. dnl Directory for DRI drivers
  428. AC_ARG_WITH([dri-driverdir],
  429. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  430. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  431. [DRI_DRIVER_INSTALL_DIR="$withval"],
  432. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  433. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  434. dnl Direct rendering or just indirect rendering
  435. AC_ARG_ENABLE([driglx-direct],
  436. [AS_HELP_STRING([--disable-driglx-direct],
  437. [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
  438. [driglx_direct="$enableval"],
  439. [driglx_direct="yes"])
  440. dnl Which drivers to build - default is chosen by platform
  441. AC_ARG_WITH([dri-drivers],
  442. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  443. [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
  444. [with_dri_drivers="$withval"],
  445. [with_dri_drivers=yes])
  446. if test "x$with_dri_drivers" = x; then
  447. with_dri_drivers=no
  448. fi
  449. dnl If $with_dri_drivers is yes, directories will be added through
  450. dnl platform checks
  451. DRI_DIRS=""
  452. case "$with_dri_drivers" in
  453. no|yes) ;;
  454. *)
  455. # verify the requested driver directories exist
  456. dri_drivers=`IFS=,; echo $with_dri_drivers`
  457. for driver in $dri_drivers; do
  458. test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
  459. AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
  460. done
  461. DRI_DIRS="$dri_drivers"
  462. ;;
  463. esac
  464. dnl Just default to no EGL for now
  465. USING_EGL=0
  466. AC_SUBST([USING_EGL])
  467. dnl Set DRI_DIRS, DEFINES and LIB_DEPS
  468. if test "$mesa_driver" = dri; then
  469. # Use TLS in GLX?
  470. if test "x$GLX_USE_TLS" = xyes; then
  471. DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
  472. fi
  473. if test "x$USING_EGL" = x1; then
  474. PROGRAM_DIRS="egl"
  475. fi
  476. # Platform specific settings and drivers to build
  477. case "$host_os" in
  478. linux*)
  479. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  480. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  481. if test "x$driglx_direct" = xyes; then
  482. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  483. fi
  484. case "$host_cpu" in
  485. x86_64)
  486. # ffb, gamma, and sis are missing because they have not be
  487. # converted to use the new interface. i810 are missing
  488. # because there is no x86-64 system where they could *ever*
  489. # be used.
  490. if test "x$DRI_DIRS" = x; then
  491. DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
  492. savage tdfx unichrome swrast"
  493. fi
  494. ;;
  495. powerpc*)
  496. # Build only the drivers for cards that exist on PowerPC.
  497. # At some point MGA will be added, but not yet.
  498. if test "x$DRI_DIRS" = x; then
  499. DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
  500. fi
  501. ;;
  502. esac
  503. ;;
  504. freebsd* | dragonfly*)
  505. DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
  506. DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
  507. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  508. if test "x$driglx_direct" = xyes; then
  509. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  510. fi
  511. if test "x$GXX" = xyes; then
  512. CXXFLAGS="$CXXFLAGS -ansi -pedantic"
  513. fi
  514. # ffb and gamma are missing because they have not been converted
  515. # to use the new interface.
  516. if test "x$DRI_DIRS" = x; then
  517. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
  518. unichrome savage sis swrast"
  519. fi
  520. ;;
  521. esac
  522. # default drivers
  523. if test "x$DRI_DIRS" = x; then
  524. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
  525. savage sis tdfx trident unichrome ffb swrast"
  526. fi
  527. DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
  528. # Check for expat
  529. EXPAT_INCLUDES=""
  530. EXPAT_LIB=-lexpat
  531. AC_ARG_WITH([expat],
  532. [AS_HELP_STRING([--with-expat=DIR],
  533. [expat install directory])],[
  534. EXPAT_INCLUDES="-I$withval/include"
  535. CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
  536. LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
  537. EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
  538. ])
  539. AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
  540. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  541. [AC_MSG_ERROR([Expat required for DRI.])])
  542. # put all the necessary libs together
  543. DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
  544. fi
  545. AC_SUBST([DRI_DIRS])
  546. AC_SUBST([EXPAT_INCLUDES])
  547. AC_SUBST([DRI_LIB_DEPS])
  548. dnl
  549. dnl OSMesa configuration
  550. dnl
  551. if test "$mesa_driver" = xlib; then
  552. default_gl_osmesa=yes
  553. else
  554. default_gl_osmesa=no
  555. fi
  556. AC_ARG_ENABLE([gl-osmesa],
  557. [AS_HELP_STRING([--enable-gl-osmesa],
  558. [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
  559. [gl_osmesa="$enableval"],
  560. [gl_osmesa="$default_gl_osmesa"])
  561. if test "x$gl_osmesa" = xyes; then
  562. if test "$mesa_driver" = osmesa; then
  563. AC_MSG_ERROR([libGL is not available for OSMesa driver])
  564. else
  565. DRIVER_DIRS="$DRIVER_DIRS osmesa"
  566. fi
  567. fi
  568. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  569. AC_ARG_WITH([osmesa-bits],
  570. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  571. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  572. [osmesa_bits="$withval"],
  573. [osmesa_bits=8])
  574. if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
  575. AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
  576. osmesa_bits=8
  577. fi
  578. case "x$osmesa_bits" in
  579. x8)
  580. OSMESA_LIB=OSMesa
  581. ;;
  582. x16|x32)
  583. OSMESA_LIB="OSMesa$osmesa_bits"
  584. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  585. ;;
  586. *)
  587. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  588. ;;
  589. esac
  590. AC_SUBST([OSMESA_LIB])
  591. case "$mesa_driver" in
  592. osmesa)
  593. # only link librararies with osmesa if shared
  594. if test "$enable_static" = no; then
  595. OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
  596. else
  597. OSMESA_LIB_DEPS=""
  598. fi
  599. OSMESA_MESA_DEPS=""
  600. ;;
  601. *)
  602. # Link OSMesa to libGL otherwise
  603. OSMESA_LIB_DEPS=""
  604. # only link librararies with osmesa if shared
  605. if test "$enable_static" = no; then
  606. OSMESA_MESA_DEPS='-l$(GL_LIB)'
  607. else
  608. OSMESA_MESA_DEPS=""
  609. fi
  610. ;;
  611. esac
  612. AC_SUBST([OSMESA_LIB_DEPS])
  613. AC_SUBST([OSMESA_MESA_DEPS])
  614. dnl
  615. dnl GLU configuration
  616. dnl
  617. AC_ARG_ENABLE([glu],
  618. [AS_HELP_STRING([--disable-glu],
  619. [enable OpenGL Utility library @<:@default=enabled@:>@])],
  620. [enable_glu="$enableval"],
  621. [enable_glu=yes])
  622. if test "x$enable_glu" = xyes; then
  623. SRC_DIRS="$SRC_DIRS glu"
  624. case "$mesa_driver" in
  625. osmesa)
  626. # If GLU is available and we have libOSMesa (not 16 or 32),
  627. # we can build the osdemos
  628. if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
  629. PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
  630. fi
  631. # Link libGLU to libOSMesa instead of libGL
  632. GLU_LIB_DEPS=""
  633. if test "$enable_static" = no; then
  634. GLU_MESA_DEPS='-l$(OSMESA_LIB)'
  635. else
  636. GLU_MESA_DEPS=""
  637. fi
  638. ;;
  639. *)
  640. # If static, empty GLU_LIB_DEPS and add libs for programs to link
  641. if test "$enable_static" = no; then
  642. GLU_LIB_DEPS="-lm"
  643. GLU_MESA_DEPS='-l$(GL_LIB)'
  644. else
  645. GLU_LIB_DEPS=""
  646. GLU_MESA_DEPS=""
  647. APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
  648. fi
  649. ;;
  650. esac
  651. fi
  652. AC_SUBST([GLU_LIB_DEPS])
  653. AC_SUBST([GLU_MESA_DEPS])
  654. dnl
  655. dnl GLw configuration
  656. dnl
  657. AC_ARG_ENABLE([glw],
  658. [AS_HELP_STRING([--disable-glw],
  659. [enable Xt/Motif widget library @<:@default=enabled@:>@])],
  660. [enable_glw="$enableval"],
  661. [enable_glw=yes])
  662. dnl Don't build GLw on osmesa
  663. if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
  664. AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
  665. enable_glw=no
  666. fi
  667. if test "x$enable_glw" = xyes; then
  668. SRC_DIRS="$SRC_DIRS glw"
  669. if test "$x11_pkgconfig" = yes; then
  670. PKG_CHECK_MODULES([GLW],[x11 xt])
  671. GLW_LIB_DEPS="$GLW_LIBS"
  672. else
  673. # should check these...
  674. GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
  675. fi
  676. # If static, empty GLW_LIB_DEPS and add libs for programs to link
  677. if test "$enable_static" = no; then
  678. GLW_MESA_DEPS='-l$(GL_LIB)'
  679. else
  680. APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
  681. GLW_LIB_DEPS=""
  682. GLW_MESA_DEPS=""
  683. fi
  684. fi
  685. AC_SUBST([GLW_LIB_DEPS])
  686. AC_SUBST([GLW_MESA_DEPS])
  687. dnl
  688. dnl GLUT configuration
  689. dnl
  690. if test -f "$srcdir/include/GL/glut.h"; then
  691. default_glut=yes
  692. else
  693. default_glut=no
  694. fi
  695. AC_ARG_ENABLE([glut],
  696. [AS_HELP_STRING([--disable-glut],
  697. [enable GLUT library @<:@default=enabled if source available@:>@])],
  698. [enable_glut="$enableval"],
  699. [enable_glut="$default_glut"])
  700. dnl Can't build glut if GLU not available
  701. if test "x$enable_glu$enable_glut" = xnoyes; then
  702. AC_MSG_WARN([Disabling glut since GLU is disabled])
  703. enable_glut=no
  704. fi
  705. dnl Don't build glut on osmesa
  706. if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
  707. AC_MSG_WARN([Disabling glut since the driver is OSMesa])
  708. enable_glut=no
  709. fi
  710. if test "x$enable_glut" = xyes; then
  711. SRC_DIRS="$SRC_DIRS glut/glx"
  712. GLUT_CFLAGS=""
  713. if test "x$GCC" = xyes; then
  714. GLUT_CFLAGS="-fexceptions"
  715. fi
  716. if test "$x11_pkgconfig" = yes; then
  717. PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
  718. GLUT_LIB_DEPS="$GLUT_LIBS"
  719. else
  720. # should check these...
  721. GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
  722. fi
  723. GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
  724. # If glut is available, we can build most programs
  725. if test "$with_demos" = yes; then
  726. PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
  727. fi
  728. # If static, empty GLUT_LIB_DEPS and add libs for programs to link
  729. if test "$enable_static" = no; then
  730. GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
  731. else
  732. APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
  733. GLUT_LIB_DEPS=""
  734. GLUT_MESA_DEPS=""
  735. fi
  736. fi
  737. AC_SUBST([GLUT_LIB_DEPS])
  738. AC_SUBST([GLUT_MESA_DEPS])
  739. AC_SUBST([GLUT_CFLAGS])
  740. dnl
  741. dnl Program library dependencies
  742. dnl Only libm is added here if necessary as the libraries should
  743. dnl be pulled in by the linker
  744. dnl
  745. if test "x$APP_LIB_DEPS" = x; then
  746. APP_LIB_DEPS="-lm"
  747. fi
  748. AC_SUBST([APP_LIB_DEPS])
  749. AC_SUBST([PROGRAM_DIRS])
  750. dnl
  751. dnl Arch/platform-specific settings
  752. dnl
  753. AC_ARG_ENABLE([asm],
  754. [AS_HELP_STRING([--disable-asm],
  755. [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
  756. [enable_asm="$enableval"],
  757. [enable_asm=yes]
  758. )
  759. asm_arch=""
  760. ASM_FLAGS=""
  761. ASM_SOURCES=""
  762. ASM_API=""
  763. AC_MSG_CHECKING([whether to enable assembly])
  764. test "x$enable_asm" = xno && AC_MSG_RESULT([no])
  765. # disable if cross compiling on x86/x86_64 since we must run gen_matypes
  766. if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
  767. case "$host_cpu" in
  768. i?86 | x86_64)
  769. enable_asm=no
  770. AC_MSG_RESULT([no, cross compiling])
  771. ;;
  772. esac
  773. fi
  774. # check for supported arches
  775. if test "x$enable_asm" = xyes; then
  776. case "$host_cpu" in
  777. i?86)
  778. case "$host_os" in
  779. linux* | freebsd* | dragonfly*)
  780. test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
  781. ;;
  782. esac
  783. ;;
  784. x86_64)
  785. case "$host_os" in
  786. linux* | freebsd* | dragonfly*)
  787. test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
  788. ;;
  789. esac
  790. ;;
  791. powerpc)
  792. case "$host_os" in
  793. linux*)
  794. asm_arch=ppc
  795. ;;
  796. esac
  797. ;;
  798. esac
  799. case "$asm_arch" in
  800. x86)
  801. ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
  802. ASM_SOURCES='$(X86_SOURCES)'
  803. ASM_API='$(X86_API)'
  804. AC_MSG_RESULT([yes, x86])
  805. ;;
  806. x86_64)
  807. ASM_FLAGS="-DUSE_X86_64_ASM"
  808. ASM_SOURCES='$(X86-64_SOURCES)'
  809. ASM_API='$(X86-64_API)'
  810. AC_MSG_RESULT([yes, x86_64])
  811. ;;
  812. ppc)
  813. ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
  814. ASM_SOURCES='$(PPC_SOURCES)'
  815. AC_MSG_RESULT([yes, ppc])
  816. ;;
  817. *)
  818. AC_MSG_RESULT([no, platform not supported])
  819. ;;
  820. esac
  821. fi
  822. AC_SUBST([ASM_FLAGS])
  823. AC_SUBST([ASM_SOURCES])
  824. AC_SUBST([ASM_API])
  825. dnl PIC code macro
  826. MESA_PIC_FLAGS
  827. dnl Restore LDFLAGS and CPPFLAGS
  828. LDFLAGS="$_SAVE_LDFLAGS"
  829. CPPFLAGS="$_SAVE_CPPFLAGS"
  830. dnl Substitute the config
  831. AC_CONFIG_FILES([configs/autoconf])
  832. dnl Replace the configs/current symlink
  833. AC_CONFIG_COMMANDS([configs],[
  834. if test -f configs/current || test -L configs/current; then
  835. rm -f configs/current
  836. fi
  837. ln -s autoconf configs/current
  838. ])
  839. AC_OUTPUT
  840. dnl
  841. dnl Output some configuration info for the user
  842. dnl
  843. echo ""
  844. echo " prefix: $prefix"
  845. echo " exec_prefix: $exec_prefix"
  846. echo " libdir: $libdir"
  847. dnl Driver info
  848. echo ""
  849. echo " Driver: $mesa_driver"
  850. if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
  851. echo " OSMesa: lib$OSMESA_LIB"
  852. else
  853. echo " OSMesa: no"
  854. fi
  855. if test "$mesa_driver" = dri; then
  856. # cleanup the drivers var
  857. dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  858. echo " DRI drivers: $dri_dirs"
  859. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  860. fi
  861. dnl Libraries
  862. echo ""
  863. echo " Shared libs: $enable_shared"
  864. echo " Static libs: $enable_static"
  865. echo " GLU: $enable_glu"
  866. echo " GLw: $enable_glw"
  867. echo " glut: $enable_glut"
  868. dnl Programs
  869. # cleanup the programs var for display
  870. program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  871. if test "x$program_dirs" = x; then
  872. echo " Demos: no"
  873. else
  874. echo " Demos: $program_dirs"
  875. fi
  876. dnl Compiler options
  877. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  878. cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  879. $SED 's/^ *//;s/ */ /;s/ *$//'`
  880. cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  881. $SED 's/^ *//;s/ */ /;s/ *$//'`
  882. defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  883. echo ""
  884. echo " CFLAGS: $cflags"
  885. echo " CXXFLAGS: $cxxflags"
  886. echo " Macros: $defines"
  887. echo ""
  888. echo " Run '${MAKE-make}' to build Mesa"
  889. echo ""