Clone of mesa.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

configure.ac 42KB

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