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.

configure.ac 25KB

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