Clone of mesa.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

configure.ac 29KB

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