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.

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