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 37KB

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