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

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