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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443
  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: 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. # sis is missing because they have not be converted to use
  663. # the new interface. i810 are missing because there is no
  664. # x86-64 system where they could *ever* be used.
  665. if test "x$DRI_DIRS" = "xyes"; then
  666. DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  667. savage tdfx unichrome swrast"
  668. fi
  669. ;;
  670. powerpc*)
  671. # Build only the drivers for cards that exist on PowerPC.
  672. # At some point MGA will be added, but not yet.
  673. if test "x$DRI_DIRS" = "xyes"; then
  674. DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
  675. fi
  676. ;;
  677. sparc*)
  678. # Build only the drivers for cards that exist on sparc`
  679. if test "x$DRI_DIRS" = "xyes"; then
  680. DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
  681. fi
  682. ;;
  683. esac
  684. ;;
  685. freebsd* | dragonfly*)
  686. DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
  687. DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
  688. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  689. if test "x$driglx_direct" = xyes; then
  690. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  691. fi
  692. if test "x$GXX" = xyes; then
  693. CXXFLAGS="$CXXFLAGS -ansi -pedantic"
  694. fi
  695. if test "x$DRI_DIRS" = "xyes"; then
  696. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
  697. unichrome savage sis swrast"
  698. fi
  699. ;;
  700. gnu*)
  701. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  702. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  703. ;;
  704. solaris*)
  705. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  706. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  707. if test "x$driglx_direct" = xyes; then
  708. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  709. fi
  710. ;;
  711. esac
  712. # default drivers
  713. if test "x$DRI_DIRS" = "xyes"; then
  714. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  715. savage sis tdfx unichrome swrast"
  716. fi
  717. DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
  718. # Check for expat
  719. EXPAT_INCLUDES=""
  720. EXPAT_LIB=-lexpat
  721. AC_ARG_WITH([expat],
  722. [AS_HELP_STRING([--with-expat=DIR],
  723. [expat install directory])],[
  724. EXPAT_INCLUDES="-I$withval/include"
  725. CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
  726. LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
  727. EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
  728. ])
  729. AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
  730. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  731. [AC_MSG_ERROR([Expat required for DRI.])])
  732. # put all the necessary libs together
  733. DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
  734. fi
  735. AC_SUBST([DRI_DIRS])
  736. AC_SUBST([EXPAT_INCLUDES])
  737. AC_SUBST([DRI_LIB_DEPS])
  738. case $DRI_DIRS in
  739. *i915*|*i965*)
  740. PKG_CHECK_MODULES([INTEL], [libdrm_intel])
  741. ;;
  742. esac
  743. case $DRI_DIRS in
  744. *radeon*|*r200*|*r300*|*r600*)
  745. PKG_CHECK_MODULES([LIBDRM_RADEON],
  746. [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
  747. HAVE_LIBDRM_RADEON=yes,
  748. HAVE_LIBDRM_RADEON=no)
  749. if test "$HAVE_LIBDRM_RADEON" = yes; then
  750. RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
  751. RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
  752. fi
  753. ;;
  754. esac
  755. AC_SUBST([RADEON_CFLAGS])
  756. AC_SUBST([RADEON_LDFLAGS])
  757. dnl
  758. dnl OSMesa configuration
  759. dnl
  760. if test "$mesa_driver" = xlib; then
  761. default_gl_osmesa=yes
  762. else
  763. default_gl_osmesa=no
  764. fi
  765. AC_ARG_ENABLE([gl-osmesa],
  766. [AS_HELP_STRING([--enable-gl-osmesa],
  767. [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
  768. [gl_osmesa="$enableval"],
  769. [gl_osmesa="$default_gl_osmesa"])
  770. if test "x$gl_osmesa" = xyes; then
  771. if test "$mesa_driver" = osmesa; then
  772. AC_MSG_ERROR([libGL is not available for OSMesa driver])
  773. else
  774. DRIVER_DIRS="$DRIVER_DIRS osmesa"
  775. fi
  776. fi
  777. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  778. AC_ARG_WITH([osmesa-bits],
  779. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  780. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  781. [osmesa_bits="$withval"],
  782. [osmesa_bits=8])
  783. if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
  784. AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
  785. osmesa_bits=8
  786. fi
  787. case "x$osmesa_bits" in
  788. x8)
  789. OSMESA_LIB=OSMesa
  790. ;;
  791. x16|x32)
  792. OSMESA_LIB="OSMesa$osmesa_bits"
  793. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  794. ;;
  795. *)
  796. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  797. ;;
  798. esac
  799. AC_SUBST([OSMESA_LIB])
  800. case "$mesa_driver" in
  801. osmesa)
  802. # only link libraries with osmesa if shared
  803. if test "$enable_static" = no; then
  804. OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  805. else
  806. OSMESA_LIB_DEPS=""
  807. fi
  808. OSMESA_MESA_DEPS=""
  809. OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  810. ;;
  811. *)
  812. # Link OSMesa to libGL otherwise
  813. OSMESA_LIB_DEPS=""
  814. # only link libraries with osmesa if shared
  815. if test "$enable_static" = no; then
  816. OSMESA_MESA_DEPS='-l$(GL_LIB)'
  817. else
  818. OSMESA_MESA_DEPS=""
  819. fi
  820. OSMESA_PC_REQ="gl"
  821. ;;
  822. esac
  823. OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
  824. AC_SUBST([OSMESA_LIB_DEPS])
  825. AC_SUBST([OSMESA_MESA_DEPS])
  826. AC_SUBST([OSMESA_PC_REQ])
  827. AC_SUBST([OSMESA_PC_LIB_PRIV])
  828. dnl
  829. dnl EGL configuration
  830. dnl
  831. AC_ARG_ENABLE([egl],
  832. [AS_HELP_STRING([--disable-egl],
  833. [disable EGL library @<:@default=enabled@:>@])],
  834. [enable_egl="$enableval"],
  835. [enable_egl=yes])
  836. if test "x$enable_egl" = xyes; then
  837. SRC_DIRS="$SRC_DIRS egl"
  838. EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
  839. EGL_DRIVERS_DIRS=""
  840. if test "$enable_static" != yes; then
  841. # build egl_glx when libGL is built
  842. if test "$mesa_driver" != osmesa; then
  843. EGL_DRIVERS_DIRS="glx"
  844. fi
  845. # build egl_dri2 when xcb-dri2 is available
  846. PKG_CHECK_MODULES([EGL_DRI2], [x11-xcb xcb-dri2 xcb-xfixes libdrm],
  847. [have_xcb_dri2=yes],[have_xcb_dri2=no])
  848. if test "$have_xcb_dri2" = yes; then
  849. EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS dri2"
  850. fi
  851. fi
  852. if test "$with_demos" = yes; then
  853. PROGRAM_DIRS="$PROGRAM_DIRS egl"
  854. fi
  855. fi
  856. AC_SUBST([EGL_LIB_DEPS])
  857. AC_SUBST([EGL_DRIVERS_DIRS])
  858. dnl
  859. dnl GLU configuration
  860. dnl
  861. AC_ARG_ENABLE([glu],
  862. [AS_HELP_STRING([--disable-glu],
  863. [enable OpenGL Utility library @<:@default=enabled@:>@])],
  864. [enable_glu="$enableval"],
  865. [enable_glu=yes])
  866. if test "x$enable_glu" = xyes; then
  867. SRC_DIRS="$SRC_DIRS glu"
  868. case "$mesa_driver" in
  869. osmesa)
  870. # If GLU is available and we have libOSMesa (not 16 or 32),
  871. # we can build the osdemos
  872. if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
  873. PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
  874. fi
  875. # Link libGLU to libOSMesa instead of libGL
  876. GLU_LIB_DEPS=""
  877. GLU_PC_REQ="osmesa"
  878. if test "$enable_static" = no; then
  879. GLU_MESA_DEPS='-l$(OSMESA_LIB)'
  880. else
  881. GLU_MESA_DEPS=""
  882. fi
  883. ;;
  884. *)
  885. # If static, empty GLU_LIB_DEPS and add libs for programs to link
  886. GLU_PC_REQ="gl"
  887. GLU_PC_LIB_PRIV="-lm"
  888. if test "$enable_static" = no; then
  889. GLU_LIB_DEPS="-lm"
  890. GLU_MESA_DEPS='-l$(GL_LIB)'
  891. else
  892. GLU_LIB_DEPS=""
  893. GLU_MESA_DEPS=""
  894. APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
  895. fi
  896. ;;
  897. esac
  898. fi
  899. if test "$enable_static" = no; then
  900. GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
  901. fi
  902. GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
  903. AC_SUBST([GLU_LIB_DEPS])
  904. AC_SUBST([GLU_MESA_DEPS])
  905. AC_SUBST([GLU_PC_REQ])
  906. AC_SUBST([GLU_PC_REQ_PRIV])
  907. AC_SUBST([GLU_PC_LIB_PRIV])
  908. AC_SUBST([GLU_PC_CFLAGS])
  909. dnl
  910. dnl GLw configuration
  911. dnl
  912. AC_ARG_ENABLE([glw],
  913. [AS_HELP_STRING([--disable-glw],
  914. [enable Xt/Motif widget library @<:@default=enabled@:>@])],
  915. [enable_glw="$enableval"],
  916. [enable_glw=yes])
  917. dnl Don't build GLw on osmesa
  918. if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
  919. AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
  920. enable_glw=no
  921. fi
  922. AC_ARG_ENABLE([motif],
  923. [AS_HELP_STRING([--enable-motif],
  924. [use Motif widgets in GLw @<:@default=disabled@:>@])],
  925. [enable_motif="$enableval"],
  926. [enable_motif=no])
  927. if test "x$enable_glw" = xyes; then
  928. SRC_DIRS="$SRC_DIRS glw"
  929. if test "$x11_pkgconfig" = yes; then
  930. PKG_CHECK_MODULES([GLW],[x11 xt])
  931. GLW_PC_REQ_PRIV="x11 xt"
  932. GLW_LIB_DEPS="$GLW_LIBS"
  933. else
  934. # should check these...
  935. GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
  936. GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
  937. GLW_PC_CFLAGS="$X11_INCLUDES"
  938. fi
  939. GLW_SOURCES="GLwDrawA.c"
  940. MOTIF_CFLAGS=
  941. if test "x$enable_motif" = xyes; then
  942. GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
  943. AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
  944. if test "x$MOTIF_CONFIG" != xno; then
  945. MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
  946. MOTIF_LIBS=`$MOTIF_CONFIG --libs`
  947. else
  948. AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
  949. [AC_MSG_ERROR([Can't locate Motif headers])])
  950. AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
  951. [AC_MSG_ERROR([Can't locate Motif Xm library])])
  952. fi
  953. # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
  954. GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
  955. GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
  956. GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
  957. fi
  958. # If static, empty GLW_LIB_DEPS and add libs for programs to link
  959. GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
  960. if test "$enable_static" = no; then
  961. GLW_MESA_DEPS='-l$(GL_LIB)'
  962. GLW_LIB_DEPS="$GLW_LIB_DEPS"
  963. else
  964. APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
  965. GLW_LIB_DEPS=""
  966. GLW_MESA_DEPS=""
  967. fi
  968. fi
  969. AC_SUBST([GLW_LIB_DEPS])
  970. AC_SUBST([GLW_MESA_DEPS])
  971. AC_SUBST([GLW_SOURCES])
  972. AC_SUBST([MOTIF_CFLAGS])
  973. AC_SUBST([GLW_PC_REQ_PRIV])
  974. AC_SUBST([GLW_PC_LIB_PRIV])
  975. AC_SUBST([GLW_PC_CFLAGS])
  976. dnl
  977. dnl GLUT configuration
  978. dnl
  979. if test -f "$srcdir/include/GL/glut.h"; then
  980. default_glut=yes
  981. else
  982. default_glut=no
  983. fi
  984. AC_ARG_ENABLE([glut],
  985. [AS_HELP_STRING([--disable-glut],
  986. [enable GLUT library @<:@default=enabled if source available@:>@])],
  987. [enable_glut="$enableval"],
  988. [enable_glut="$default_glut"])
  989. dnl Can't build glut if GLU not available
  990. if test "x$enable_glu$enable_glut" = xnoyes; then
  991. AC_MSG_WARN([Disabling glut since GLU is disabled])
  992. enable_glut=no
  993. fi
  994. dnl Don't build glut on osmesa
  995. if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
  996. AC_MSG_WARN([Disabling glut since the driver is OSMesa])
  997. enable_glut=no
  998. fi
  999. if test "x$enable_glut" = xyes; then
  1000. SRC_DIRS="$SRC_DIRS glut/glx"
  1001. GLUT_CFLAGS=""
  1002. if test "x$GCC" = xyes; then
  1003. GLUT_CFLAGS="-fexceptions"
  1004. fi
  1005. if test "$x11_pkgconfig" = yes; then
  1006. PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
  1007. GLUT_PC_REQ_PRIV="x11 xmu xi"
  1008. GLUT_LIB_DEPS="$GLUT_LIBS"
  1009. else
  1010. # should check these...
  1011. GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
  1012. GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
  1013. GLUT_PC_CFLAGS="$X11_INCLUDES"
  1014. fi
  1015. GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
  1016. GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
  1017. # If glut is available, we can build most programs
  1018. if test "$with_demos" = yes; then
  1019. PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
  1020. fi
  1021. # If static, empty GLUT_LIB_DEPS and add libs for programs to link
  1022. if test "$enable_static" = no; then
  1023. GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
  1024. else
  1025. APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
  1026. GLUT_LIB_DEPS=""
  1027. GLUT_MESA_DEPS=""
  1028. fi
  1029. fi
  1030. AC_SUBST([GLUT_LIB_DEPS])
  1031. AC_SUBST([GLUT_MESA_DEPS])
  1032. AC_SUBST([GLUT_CFLAGS])
  1033. AC_SUBST([GLUT_PC_REQ_PRIV])
  1034. AC_SUBST([GLUT_PC_LIB_PRIV])
  1035. AC_SUBST([GLUT_PC_CFLAGS])
  1036. dnl
  1037. dnl Program library dependencies
  1038. dnl Only libm is added here if necessary as the libraries should
  1039. dnl be pulled in by the linker
  1040. dnl
  1041. if test "x$APP_LIB_DEPS" = x; then
  1042. case "$host_os" in
  1043. solaris*)
  1044. APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
  1045. ;;
  1046. cygwin*)
  1047. APP_LIB_DEPS="-lX11"
  1048. ;;
  1049. *)
  1050. APP_LIB_DEPS="-lm"
  1051. ;;
  1052. esac
  1053. fi
  1054. AC_SUBST([APP_LIB_DEPS])
  1055. AC_SUBST([PROGRAM_DIRS])
  1056. dnl
  1057. dnl Gallium configuration
  1058. dnl
  1059. AC_ARG_ENABLE([gallium],
  1060. [AS_HELP_STRING([--disable-gallium],
  1061. [build gallium @<:@default=enabled@:>@])],
  1062. [enable_gallium="$enableval"],
  1063. [enable_gallium=yes])
  1064. if test "x$enable_gallium" = xyes; then
  1065. SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
  1066. fi
  1067. dnl
  1068. dnl Gallium state trackers configuration
  1069. dnl
  1070. AC_ARG_WITH([state-trackers],
  1071. [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
  1072. [comma delimited state_trackers list, e.g.
  1073. "egl,glx" @<:@default=auto@:>@])],
  1074. [with_state_trackers="$withval"],
  1075. [with_state_trackers=yes])
  1076. case "$with_state_trackers" in
  1077. no)
  1078. GALLIUM_STATE_TRACKERS_DIRS=""
  1079. ;;
  1080. yes)
  1081. # look at what else is built
  1082. case "$mesa_driver" in
  1083. xlib)
  1084. GALLIUM_STATE_TRACKERS_DIRS=glx
  1085. ;;
  1086. dri)
  1087. GALLIUM_STATE_TRACKERS_DIRS="dri"
  1088. if test "x$enable_egl" = xyes; then
  1089. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
  1090. fi
  1091. # Have only tested st/xorg on 1.6.0 servers
  1092. PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0],
  1093. HAVE_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
  1094. HAVE_XORG="no")
  1095. ;;
  1096. esac
  1097. ;;
  1098. *)
  1099. # verify the requested state tracker exist
  1100. state_trackers=`IFS=', '; echo $with_state_trackers`
  1101. for tracker in $state_trackers; do
  1102. test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
  1103. AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
  1104. case "$tracker" in
  1105. egl)
  1106. if test "x$enable_egl" != xyes; then
  1107. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1108. fi
  1109. ;;
  1110. xorg)
  1111. PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
  1112. HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
  1113. HAVE_XEXTPROTO_71="no")
  1114. ;;
  1115. es)
  1116. # mesa/es is required to build es state tracker
  1117. CORE_DIRS="$CORE_DIRS mesa/es"
  1118. ;;
  1119. esac
  1120. done
  1121. GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
  1122. ;;
  1123. esac
  1124. AC_ARG_WITH([egl-displays],
  1125. [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
  1126. [comma delimited native displays libEGL supports, e.g.
  1127. "x11,kms" @<:@default=auto@:>@])],
  1128. [with_egl_displays="$withval"],
  1129. [with_egl_displays=yes])
  1130. EGL_DISPLAYS=""
  1131. case "$with_egl_displays" in
  1132. yes)
  1133. if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
  1134. EGL_DISPLAYS="x11"
  1135. fi
  1136. ;;
  1137. *)
  1138. if test "x$enable_egl" != xyes; then
  1139. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1140. fi
  1141. # verify the requested driver directories exist
  1142. egl_displays=`IFS=', '; echo $with_egl_displays`
  1143. for dpy in $egl_displays; do
  1144. test -d "$srcdir/src/gallium/state_trackers/egl/$dpy" || \
  1145. AC_MSG_ERROR([EGL display '$dpy' does't exist])
  1146. done
  1147. EGL_DISPLAYS="$egl_displays"
  1148. ;;
  1149. esac
  1150. AC_SUBST([EGL_DISPLAYS])
  1151. AC_ARG_WITH([egl-driver-dir],
  1152. [AS_HELP_STRING([--with-egl-driver-dir=DIR],
  1153. [directory for EGL drivers [[default=${libdir}/egl]]])],
  1154. [EGL_DRIVER_INSTALL_DIR="$withval"],
  1155. [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
  1156. AC_SUBST([EGL_DRIVER_INSTALL_DIR])
  1157. AC_ARG_WITH([xorg-driver-dir],
  1158. [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
  1159. [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
  1160. [XORG_DRIVER_INSTALL_DIR="$withval"],
  1161. [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
  1162. AC_SUBST([XORG_DRIVER_INSTALL_DIR])
  1163. AC_ARG_WITH([max-width],
  1164. [AS_HELP_STRING([--with-max-width=N],
  1165. [Maximum framebuffer width (4096)])],
  1166. [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
  1167. AS_IF([test "${withval}" -gt "4096"],
  1168. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1169. )
  1170. AC_ARG_WITH([max-height],
  1171. [AS_HELP_STRING([--with-max-height=N],
  1172. [Maximum framebuffer height (4096)])],
  1173. [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
  1174. AS_IF([test "${withval}" -gt "4096"],
  1175. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1176. )
  1177. dnl
  1178. dnl Gallium SVGA configuration
  1179. dnl
  1180. AC_ARG_ENABLE([gallium-svga],
  1181. [AS_HELP_STRING([--enable-gallium-svga],
  1182. [build gallium SVGA @<:@default=disabled@:>@])],
  1183. [enable_gallium_svga="$enableval"],
  1184. [enable_gallium_svga=auto])
  1185. if test "x$enable_gallium_svga" = xyes; then
  1186. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
  1187. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
  1188. elif test "x$enable_gallium_svga" = xauto; then
  1189. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
  1190. fi
  1191. dnl
  1192. dnl Gallium Intel configuration
  1193. dnl
  1194. AC_ARG_ENABLE([gallium-intel],
  1195. [AS_HELP_STRING([--enable-gallium-intel],
  1196. [build gallium intel @<:@default=disabled@:>@])],
  1197. [enable_gallium_intel="$enableval"],
  1198. [enable_gallium_intel=auto])
  1199. if test "x$enable_gallium_intel" = xyes; then
  1200. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel i965"
  1201. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
  1202. elif test "x$enable_gallium_intel" = xauto; then
  1203. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
  1204. fi
  1205. dnl
  1206. dnl Gallium Radeon configuration
  1207. dnl
  1208. AC_ARG_ENABLE([gallium-radeon],
  1209. [AS_HELP_STRING([--enable-gallium-radeon],
  1210. [build gallium radeon @<:@default=disabled@:>@])],
  1211. [enable_gallium_radeon="$enableval"],
  1212. [enable_gallium_radeon=auto])
  1213. if test "x$enable_gallium_radeon" = xyes; then
  1214. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
  1215. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1216. elif test "x$enable_gallium_radeon" = xauto; then
  1217. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1218. fi
  1219. dnl
  1220. dnl Gallium Nouveau configuration
  1221. dnl
  1222. AC_ARG_ENABLE([gallium-nouveau],
  1223. [AS_HELP_STRING([--enable-gallium-nouveau],
  1224. [build gallium nouveau @<:@default=disabled@:>@])],
  1225. [enable_gallium_nouveau="$enableval"],
  1226. [enable_gallium_nouveau=no])
  1227. if test "x$enable_gallium_nouveau" = xyes; then
  1228. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
  1229. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv30 nv40 nv50"
  1230. fi
  1231. dnl
  1232. dnl Gallium swrast configuration
  1233. dnl
  1234. AC_ARG_ENABLE([gallium-swrast],
  1235. [AS_HELP_STRING([--enable-gallium-swrast],
  1236. [build gallium swrast @<:@default=disabled@:>@])],
  1237. [enable_gallium_swrast="$enableval"],
  1238. [enable_gallium_swrast=auto])
  1239. if test "x$enable_gallium_swrast" = xyes; then
  1240. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS swrast"
  1241. fi
  1242. dnl prepend CORE_DIRS to SRC_DIRS
  1243. SRC_DIRS="$CORE_DIRS $SRC_DIRS"
  1244. dnl Restore LDFLAGS and CPPFLAGS
  1245. LDFLAGS="$_SAVE_LDFLAGS"
  1246. CPPFLAGS="$_SAVE_CPPFLAGS"
  1247. dnl Substitute the config
  1248. AC_CONFIG_FILES([configs/autoconf])
  1249. dnl Replace the configs/current symlink
  1250. AC_CONFIG_COMMANDS([configs],[
  1251. if test -f configs/current || test -L configs/current; then
  1252. rm -f configs/current
  1253. fi
  1254. ln -s autoconf configs/current
  1255. ])
  1256. AC_OUTPUT
  1257. dnl
  1258. dnl Output some configuration info for the user
  1259. dnl
  1260. echo ""
  1261. echo " prefix: $prefix"
  1262. echo " exec_prefix: $exec_prefix"
  1263. echo " libdir: $libdir"
  1264. echo " includedir: $includedir"
  1265. dnl Driver info
  1266. echo ""
  1267. echo " Driver: $mesa_driver"
  1268. if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
  1269. echo " OSMesa: lib$OSMESA_LIB"
  1270. else
  1271. echo " OSMesa: no"
  1272. fi
  1273. if test "$mesa_driver" = dri; then
  1274. # cleanup the drivers var
  1275. dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1276. if test "x$DRI_DIRS" = x; then
  1277. echo " DRI drivers: no"
  1278. else
  1279. echo " DRI drivers: $dri_dirs"
  1280. fi
  1281. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  1282. fi
  1283. echo " Use XCB: $enable_xcb"
  1284. echo ""
  1285. if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
  1286. echo " Gallium: yes"
  1287. echo " Gallium dirs: $GALLIUM_DIRS"
  1288. echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
  1289. echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
  1290. echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
  1291. echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
  1292. else
  1293. echo " Gallium: no"
  1294. fi
  1295. dnl Libraries
  1296. echo ""
  1297. echo " Shared libs: $enable_shared"
  1298. echo " Static libs: $enable_static"
  1299. if test "$enable_egl" = yes; then
  1300. echo " EGL: $EGL_DRIVERS_DIRS"
  1301. else
  1302. echo " EGL: no"
  1303. fi
  1304. echo " GLU: $enable_glu"
  1305. echo " GLw: $enable_glw (Motif: $enable_motif)"
  1306. echo " glut: $enable_glut"
  1307. dnl Programs
  1308. # cleanup the programs var for display
  1309. program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1310. if test "x$program_dirs" = x; then
  1311. echo " Demos: no"
  1312. else
  1313. echo " Demos: $program_dirs"
  1314. fi
  1315. dnl Compiler options
  1316. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  1317. cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1318. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1319. cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1320. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1321. defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1322. echo ""
  1323. echo " CFLAGS: $cflags"
  1324. echo " CXXFLAGS: $cxxflags"
  1325. echo " Macros: $defines"
  1326. echo ""
  1327. echo " Run '${MAKE-make}' to build Mesa"
  1328. echo ""