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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668
  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' | tr -d '\r'])])
  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. GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
  253. GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
  254. VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
  255. GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
  256. GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
  257. GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
  258. GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
  259. OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
  260. EGL_LIB_GLOB='lib$(EGL_LIB).*'${LIB_EXTENSION}'*'
  261. GLESv1_CM_LIB_GLOB='lib$(GLESv1_CM_LIB).*'${LIB_EXTENSION}'*'
  262. GLESv2_LIB_GLOB='lib$(GLESv2_LIB).*'${LIB_EXTENSION}'*'
  263. VG_LIB_GLOB='lib$(VG_LIB).*'${LIB_EXTENSION}'*'
  264. AC_SUBST([GL_LIB_NAME])
  265. AC_SUBST([GLU_LIB_NAME])
  266. AC_SUBST([GLUT_LIB_NAME])
  267. AC_SUBST([GLW_LIB_NAME])
  268. AC_SUBST([OSMESA_LIB_NAME])
  269. AC_SUBST([EGL_LIB_NAME])
  270. AC_SUBST([GLESv1_CM_LIB_NAME])
  271. AC_SUBST([GLESv2_LIB_NAME])
  272. AC_SUBST([VG_LIB_NAME])
  273. AC_SUBST([GL_LIB_GLOB])
  274. AC_SUBST([GLU_LIB_GLOB])
  275. AC_SUBST([GLUT_LIB_GLOB])
  276. AC_SUBST([GLW_LIB_GLOB])
  277. AC_SUBST([OSMESA_LIB_GLOB])
  278. AC_SUBST([EGL_LIB_GLOB])
  279. AC_SUBST([GLESv1_CM_LIB_GLOB])
  280. AC_SUBST([GLESv2_LIB_GLOB])
  281. AC_SUBST([VG_LIB_GLOB])
  282. dnl
  283. dnl Arch/platform-specific settings
  284. dnl
  285. AC_ARG_ENABLE([asm],
  286. [AS_HELP_STRING([--disable-asm],
  287. [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
  288. [enable_asm="$enableval"],
  289. [enable_asm=yes]
  290. )
  291. asm_arch=""
  292. ASM_FLAGS=""
  293. MESA_ASM_SOURCES=""
  294. GLAPI_ASM_SOURCES=""
  295. AC_MSG_CHECKING([whether to enable assembly])
  296. test "x$enable_asm" = xno && AC_MSG_RESULT([no])
  297. # disable if cross compiling on x86/x86_64 since we must run gen_matypes
  298. if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
  299. case "$host_cpu" in
  300. i?86 | x86_64)
  301. enable_asm=no
  302. AC_MSG_RESULT([no, cross compiling])
  303. ;;
  304. esac
  305. fi
  306. # check for supported arches
  307. if test "x$enable_asm" = xyes; then
  308. case "$host_cpu" in
  309. i?86)
  310. case "$host_os" in
  311. linux* | *freebsd* | dragonfly*)
  312. test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
  313. ;;
  314. esac
  315. ;;
  316. x86_64)
  317. case "$host_os" in
  318. linux* | *freebsd* | dragonfly*)
  319. test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
  320. ;;
  321. esac
  322. ;;
  323. powerpc)
  324. case "$host_os" in
  325. linux*)
  326. asm_arch=ppc
  327. ;;
  328. esac
  329. ;;
  330. sparc*)
  331. case "$host_os" in
  332. linux*)
  333. asm_arch=sparc
  334. ;;
  335. esac
  336. ;;
  337. esac
  338. case "$asm_arch" in
  339. x86)
  340. ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
  341. MESA_ASM_SOURCES='$(X86_SOURCES)'
  342. GLAPI_ASM_SOURCES='$(X86_API)'
  343. AC_MSG_RESULT([yes, x86])
  344. ;;
  345. x86_64)
  346. ASM_FLAGS="-DUSE_X86_64_ASM"
  347. MESA_ASM_SOURCES='$(X86-64_SOURCES)'
  348. GLAPI_ASM_SOURCES='$(X86-64_API)'
  349. AC_MSG_RESULT([yes, x86_64])
  350. ;;
  351. ppc)
  352. ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
  353. MESA_ASM_SOURCES='$(PPC_SOURCES)'
  354. AC_MSG_RESULT([yes, ppc])
  355. ;;
  356. sparc)
  357. ASM_FLAGS="-DUSE_SPARC_ASM"
  358. MESA_ASM_SOURCES='$(SPARC_SOURCES)'
  359. GLAPI_ASM_SOURCES='$(SPARC_API)'
  360. AC_MSG_RESULT([yes, sparc])
  361. ;;
  362. *)
  363. AC_MSG_RESULT([no, platform not supported])
  364. ;;
  365. esac
  366. fi
  367. AC_SUBST([ASM_FLAGS])
  368. AC_SUBST([MESA_ASM_SOURCES])
  369. AC_SUBST([GLAPI_ASM_SOURCES])
  370. dnl PIC code macro
  371. MESA_PIC_FLAGS
  372. dnl Check to see if dlopen is in default libraries (like Solaris, which
  373. dnl has it in libc), or if libdl is needed to get it.
  374. AC_CHECK_FUNC([dlopen], [],
  375. [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
  376. dnl See if posix_memalign is available
  377. AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
  378. dnl SELinux awareness.
  379. AC_ARG_ENABLE([selinux],
  380. [AS_HELP_STRING([--enable-selinux],
  381. [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
  382. [MESA_SELINUX="$enableval"],
  383. [MESA_SELINUX=no])
  384. if test "x$enable_selinux" = "xyes"; then
  385. AC_CHECK_HEADER([selinux/selinux.h],[],
  386. [AC_MSG_ERROR([SELinux headers not found])])
  387. AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
  388. [AC_MSG_ERROR([SELinux library not found])])
  389. SELINUX_LIBS="-lselinux"
  390. DEFINES="$DEFINES -DMESA_SELINUX"
  391. fi
  392. dnl
  393. dnl Driver configuration. Options are xlib, dri and osmesa right now.
  394. dnl More later: fbdev, ...
  395. dnl
  396. default_driver="xlib"
  397. case "$host_os" in
  398. linux*)
  399. case "$host_cpu" in
  400. i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
  401. esac
  402. ;;
  403. *freebsd* | dragonfly*)
  404. case "$host_cpu" in
  405. i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
  406. esac
  407. ;;
  408. esac
  409. AC_ARG_WITH([driver],
  410. [AS_HELP_STRING([--with-driver=DRIVER],
  411. [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
  412. [mesa_driver="$withval"],
  413. [mesa_driver="$default_driver"])
  414. dnl Check for valid option
  415. case "x$mesa_driver" in
  416. xxlib|xdri|xosmesa)
  417. ;;
  418. *)
  419. AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
  420. ;;
  421. esac
  422. dnl
  423. dnl Driver specific build directories
  424. dnl
  425. dnl this variable will be prepended to SRC_DIRS and is not exported
  426. CORE_DIRS="mapi/glapi glsl mesa"
  427. SRC_DIRS="glew"
  428. GLU_DIRS="sgi"
  429. GALLIUM_DIRS="auxiliary drivers state_trackers"
  430. GALLIUM_TARGET_DIRS=""
  431. GALLIUM_WINSYS_DIRS="sw"
  432. GALLIUM_DRIVERS_DIRS="softpipe failover trace rbug identity"
  433. GALLIUM_STATE_TRACKERS_DIRS=""
  434. case "$mesa_driver" in
  435. xlib)
  436. DRIVER_DIRS="x11"
  437. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
  438. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
  439. ;;
  440. dri)
  441. SRC_DIRS="$SRC_DIRS glx"
  442. DRIVER_DIRS="dri"
  443. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri sw/drm"
  444. ;;
  445. osmesa)
  446. DRIVER_DIRS="osmesa"
  447. ;;
  448. esac
  449. AC_SUBST([SRC_DIRS])
  450. AC_SUBST([GLU_DIRS])
  451. AC_SUBST([DRIVER_DIRS])
  452. AC_SUBST([GALLIUM_DIRS])
  453. AC_SUBST([GALLIUM_TARGET_DIRS])
  454. AC_SUBST([GALLIUM_WINSYS_DIRS])
  455. AC_SUBST([GALLIUM_DRIVERS_DIRS])
  456. AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
  457. AC_SUBST([MESA_LLVM])
  458. dnl
  459. dnl User supplied program configuration
  460. dnl
  461. if test -d "$srcdir/progs/demos"; then
  462. default_demos=yes
  463. else
  464. default_demos=no
  465. fi
  466. AC_ARG_WITH([demos],
  467. [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
  468. [optional comma delimited demo directories to build
  469. @<:@default=auto if source available@:>@])],
  470. [with_demos="$withval"],
  471. [with_demos="$default_demos"])
  472. if test "x$with_demos" = x; then
  473. with_demos=no
  474. fi
  475. dnl If $with_demos is yes, directories will be added as libs available
  476. PROGRAM_DIRS=""
  477. case "$with_demos" in
  478. no) ;;
  479. yes)
  480. # If the driver isn't osmesa, we have libGL and can build xdemos
  481. if test "$mesa_driver" != osmesa; then
  482. PROGRAM_DIRS="xdemos"
  483. fi
  484. ;;
  485. *)
  486. # verify the requested demos directories exist
  487. demos=`IFS=,; echo $with_demos`
  488. for demo in $demos; do
  489. test -d "$srcdir/progs/$demo" || \
  490. AC_MSG_ERROR([Program directory '$demo' doesn't exist])
  491. done
  492. PROGRAM_DIRS="$demos"
  493. ;;
  494. esac
  495. dnl
  496. dnl Find out if X is available. The variable have_x is set if libX11 is
  497. dnl found to mimic AC_PATH_XTRA.
  498. dnl
  499. if test -n "$PKG_CONFIG"; then
  500. AC_MSG_CHECKING([pkg-config files for X11 are available])
  501. PKG_CHECK_EXISTS([x11],[
  502. x11_pkgconfig=yes
  503. have_x=yes
  504. ],[
  505. x11_pkgconfig=no
  506. ])
  507. AC_MSG_RESULT([$x11_pkgconfig])
  508. else
  509. x11_pkgconfig=no
  510. fi
  511. dnl Use the autoconf macro if no pkg-config files
  512. if test "$x11_pkgconfig" = yes; then
  513. PKG_CHECK_MODULES([X11], [x11])
  514. else
  515. AC_PATH_XTRA
  516. test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
  517. test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
  518. AC_SUBST([X11_CFLAGS])
  519. AC_SUBST([X11_LIBS])
  520. fi
  521. dnl Try to tell the user that the --x-* options are only used when
  522. dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
  523. m4_divert_once([HELP_BEGIN],
  524. [These options are only used when the X libraries cannot be found by the
  525. pkg-config utility.])
  526. dnl We need X for xlib and dri, so bomb now if it's not found
  527. case "$mesa_driver" in
  528. xlib|dri)
  529. if test "$no_x" = yes; then
  530. AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
  531. fi
  532. ;;
  533. esac
  534. dnl XCB - this is only used for GLX right now
  535. AC_ARG_ENABLE([xcb],
  536. [AS_HELP_STRING([--enable-xcb],
  537. [use XCB for GLX @<:@default=disabled@:>@])],
  538. [enable_xcb="$enableval"],
  539. [enable_xcb=no])
  540. if test "x$enable_xcb" = xyes; then
  541. DEFINES="$DEFINES -DUSE_XCB"
  542. else
  543. enable_xcb=no
  544. fi
  545. dnl
  546. dnl libGL configuration per driver
  547. dnl
  548. case "$mesa_driver" in
  549. xlib)
  550. if test "$x11_pkgconfig" = yes; then
  551. PKG_CHECK_MODULES([XLIBGL], [x11 xext])
  552. GL_PC_REQ_PRIV="x11 xext"
  553. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  554. GL_LIB_DEPS="$XLIBGL_LIBS"
  555. else
  556. # should check these...
  557. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  558. GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
  559. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  560. GL_PC_CFLAGS="$X11_INCLUDES"
  561. fi
  562. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
  563. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
  564. # if static, move the external libraries to the programs
  565. # and empty the libraries for libGL
  566. if test "$enable_static" = yes; then
  567. APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
  568. GL_LIB_DEPS=""
  569. fi
  570. ;;
  571. dri)
  572. # DRI must be shared, I think
  573. if test "$enable_static" = yes; then
  574. AC_MSG_ERROR([Can't use static libraries for DRI drivers])
  575. fi
  576. # Check for libdrm
  577. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
  578. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  579. PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
  580. GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
  581. DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
  582. # find the DRI deps for libGL
  583. if test "$x11_pkgconfig" = yes; then
  584. # add xcb modules if necessary
  585. dri_modules="x11 xext xxf86vm xdamage xfixes"
  586. if test "$enable_xcb" = yes; then
  587. dri_modules="$dri_modules x11-xcb xcb-glx"
  588. fi
  589. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  590. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  591. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  592. GL_LIB_DEPS="$DRIGL_LIBS"
  593. else
  594. # should check these...
  595. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  596. GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
  597. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  598. GL_PC_CFLAGS="$X11_INCLUDES"
  599. # XCB can only be used from pkg-config
  600. if test "$enable_xcb" = yes; then
  601. PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
  602. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
  603. X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
  604. GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
  605. fi
  606. fi
  607. # need DRM libs, -lpthread, etc.
  608. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  609. GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  610. GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  611. GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  612. GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  613. GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  614. ;;
  615. osmesa)
  616. # No libGL for osmesa
  617. GL_LIB_DEPS=""
  618. ;;
  619. esac
  620. AC_SUBST([GL_LIB_DEPS])
  621. AC_SUBST([GL_PC_REQ_PRIV])
  622. AC_SUBST([GL_PC_LIB_PRIV])
  623. AC_SUBST([GL_PC_CFLAGS])
  624. AC_SUBST([DRI_PC_REQ_PRIV])
  625. AC_SUBST([GLESv1_LIB_DEPS])
  626. AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
  627. AC_SUBST([GLESv2_LIB_DEPS])
  628. AC_SUBST([GLESv2_PC_LIB_PRIV])
  629. dnl
  630. dnl More X11 setup
  631. dnl
  632. if test "$mesa_driver" = xlib; then
  633. DEFINES="$DEFINES -DUSE_XSHM"
  634. fi
  635. dnl
  636. dnl More DRI setup
  637. dnl
  638. AC_ARG_ENABLE([glx-tls],
  639. [AS_HELP_STRING([--enable-glx-tls],
  640. [enable TLS support in GLX @<:@default=disabled@:>@])],
  641. [GLX_USE_TLS="$enableval"],
  642. [GLX_USE_TLS=no])
  643. dnl Directory for DRI drivers
  644. AC_ARG_WITH([dri-driverdir],
  645. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  646. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  647. [DRI_DRIVER_INSTALL_DIR="$withval"],
  648. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  649. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  650. dnl Extra search path for DRI drivers
  651. AC_ARG_WITH([dri-searchpath],
  652. [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
  653. [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
  654. [DRI_DRIVER_SEARCH_DIR="$withval"],
  655. [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
  656. AC_SUBST([DRI_DRIVER_SEARCH_DIR])
  657. dnl Direct rendering or just indirect rendering
  658. AC_ARG_ENABLE([driglx-direct],
  659. [AS_HELP_STRING([--disable-driglx-direct],
  660. [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
  661. [driglx_direct="$enableval"],
  662. [driglx_direct="yes"])
  663. dnl Which drivers to build - default is chosen by platform
  664. AC_ARG_WITH([dri-drivers],
  665. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  666. [comma delimited DRI drivers list, e.g.
  667. "swrast,i965,radeon" @<:@default=auto@:>@])],
  668. [with_dri_drivers="$withval"],
  669. [with_dri_drivers=yes])
  670. if test "x$with_dri_drivers" = x; then
  671. with_dri_drivers=no
  672. fi
  673. dnl Determine which APIs to support
  674. AC_ARG_ENABLE([opengl],
  675. [AS_HELP_STRING([--disable-opengl],
  676. [disable support for standard OpenGL API @<:@default=no@:>@])],
  677. [enable_opengl="$enableval"],
  678. [enable_opengl=yes])
  679. AC_ARG_ENABLE([gles1],
  680. [AS_HELP_STRING([--enable-gles1],
  681. [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
  682. [enable_gles1="$enableval"],
  683. [enable_gles1=no])
  684. AC_ARG_ENABLE([gles2],
  685. [AS_HELP_STRING([--enable-gles2],
  686. [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
  687. [enable_gles2="$enableval"],
  688. [enable_gles2=no])
  689. AC_ARG_ENABLE([gles-overlay],
  690. [AS_HELP_STRING([--enable-gles-overlay],
  691. [build separate OpenGL ES only libraries @<:@default=no@:>@])],
  692. [enable_gles_overlay="$enableval"],
  693. [enable_gles_overlay=no])
  694. API_DEFINES=""
  695. APIS=""
  696. GLES_OVERLAY=0
  697. if test "x$enable_opengl" = xno; then
  698. API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
  699. else
  700. API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
  701. APIS="$APIS gl"
  702. fi
  703. if test "x$enable_gles1" = xyes; then
  704. API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
  705. APIS="$APIS es1"
  706. fi
  707. if test "x$enable_gles2" = xyes; then
  708. API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
  709. APIS="$APIS es2"
  710. fi
  711. if test "x$enable_gles_overlay" = xyes -o \
  712. "x$enable_gles1" = xyes -o "x$enable_gles2" = xyes; then
  713. CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
  714. if test "x$enable_gles_overlay" = xyes; then
  715. GLES_OVERLAY=1
  716. fi
  717. fi
  718. AC_SUBST([API_DEFINES])
  719. AC_SUBST([APIS])
  720. AC_SUBST([GLES_OVERLAY])
  721. dnl If $with_dri_drivers is yes, directories will be added through
  722. dnl platform checks
  723. DRI_DIRS=""
  724. case "$with_dri_drivers" in
  725. no) ;;
  726. yes)
  727. DRI_DIRS="yes"
  728. ;;
  729. *)
  730. # verify the requested driver directories exist
  731. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  732. for driver in $dri_drivers; do
  733. test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
  734. AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
  735. done
  736. DRI_DIRS="$dri_drivers"
  737. ;;
  738. esac
  739. dnl Set DRI_DIRS, DEFINES and LIB_DEPS
  740. if test "$mesa_driver" = dri; then
  741. # Use TLS in GLX?
  742. if test "x$GLX_USE_TLS" = xyes; then
  743. DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
  744. fi
  745. # Platform specific settings and drivers to build
  746. case "$host_os" in
  747. linux*)
  748. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  749. if test "x$driglx_direct" = xyes; then
  750. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  751. fi
  752. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  753. case "$host_cpu" in
  754. x86_64)
  755. # sis is missing because they have not be converted to use
  756. # the new interface. i810 are missing because there is no
  757. # x86-64 system where they could *ever* be used.
  758. if test "x$DRI_DIRS" = "xyes"; then
  759. DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  760. savage tdfx unichrome swrast"
  761. fi
  762. ;;
  763. powerpc*)
  764. # Build only the drivers for cards that exist on PowerPC.
  765. # At some point MGA will be added, but not yet.
  766. if test "x$DRI_DIRS" = "xyes"; then
  767. DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
  768. fi
  769. ;;
  770. sparc*)
  771. # Build only the drivers for cards that exist on sparc`
  772. if test "x$DRI_DIRS" = "xyes"; then
  773. DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
  774. fi
  775. ;;
  776. esac
  777. ;;
  778. freebsd* | dragonfly*)
  779. DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
  780. DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
  781. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  782. if test "x$driglx_direct" = xyes; then
  783. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  784. fi
  785. if test "x$GXX" = xyes; then
  786. CXXFLAGS="$CXXFLAGS -ansi -pedantic"
  787. fi
  788. if test "x$DRI_DIRS" = "xyes"; then
  789. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
  790. unichrome savage sis swrast"
  791. fi
  792. ;;
  793. gnu*)
  794. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  795. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  796. ;;
  797. solaris*)
  798. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  799. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  800. if test "x$driglx_direct" = xyes; then
  801. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  802. fi
  803. ;;
  804. esac
  805. # default drivers
  806. if test "x$DRI_DIRS" = "xyes"; then
  807. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  808. savage sis tdfx unichrome swrast"
  809. fi
  810. DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
  811. # Check for expat
  812. EXPAT_INCLUDES=""
  813. EXPAT_LIB=-lexpat
  814. AC_ARG_WITH([expat],
  815. [AS_HELP_STRING([--with-expat=DIR],
  816. [expat install directory])],[
  817. EXPAT_INCLUDES="-I$withval/include"
  818. CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
  819. LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
  820. EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
  821. ])
  822. AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
  823. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  824. [AC_MSG_ERROR([Expat required for DRI.])])
  825. # put all the necessary libs together
  826. DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
  827. fi
  828. AC_SUBST([DRI_DIRS])
  829. AC_SUBST([EXPAT_INCLUDES])
  830. AC_SUBST([DRI_LIB_DEPS])
  831. case $DRI_DIRS in
  832. *i915*|*i965*)
  833. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= 2.4.19])
  834. ;;
  835. esac
  836. case $DRI_DIRS in
  837. *radeon*|*r200*|*r300*|*r600*)
  838. PKG_CHECK_MODULES([LIBDRM_RADEON],
  839. [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
  840. HAVE_LIBDRM_RADEON=yes,
  841. HAVE_LIBDRM_RADEON=no)
  842. if test "$HAVE_LIBDRM_RADEON" = yes; then
  843. RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
  844. RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
  845. fi
  846. ;;
  847. esac
  848. AC_SUBST([RADEON_CFLAGS])
  849. AC_SUBST([RADEON_LDFLAGS])
  850. dnl
  851. dnl OSMesa configuration
  852. dnl
  853. if test "$mesa_driver" = xlib; then
  854. default_gl_osmesa=yes
  855. else
  856. default_gl_osmesa=no
  857. fi
  858. AC_ARG_ENABLE([gl-osmesa],
  859. [AS_HELP_STRING([--enable-gl-osmesa],
  860. [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
  861. [gl_osmesa="$enableval"],
  862. [gl_osmesa="$default_gl_osmesa"])
  863. if test "x$gl_osmesa" = xyes; then
  864. if test "$mesa_driver" = osmesa; then
  865. AC_MSG_ERROR([libGL is not available for OSMesa driver])
  866. else
  867. DRIVER_DIRS="$DRIVER_DIRS osmesa"
  868. fi
  869. fi
  870. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  871. AC_ARG_WITH([osmesa-bits],
  872. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  873. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  874. [osmesa_bits="$withval"],
  875. [osmesa_bits=8])
  876. if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
  877. AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
  878. osmesa_bits=8
  879. fi
  880. case "x$osmesa_bits" in
  881. x8)
  882. OSMESA_LIB=OSMesa
  883. ;;
  884. x16|x32)
  885. OSMESA_LIB="OSMesa$osmesa_bits"
  886. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  887. ;;
  888. *)
  889. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  890. ;;
  891. esac
  892. AC_SUBST([OSMESA_LIB])
  893. case "$mesa_driver" in
  894. osmesa)
  895. # only link libraries with osmesa if shared
  896. if test "$enable_static" = no; then
  897. OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  898. else
  899. OSMESA_LIB_DEPS=""
  900. fi
  901. OSMESA_MESA_DEPS=""
  902. OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  903. ;;
  904. *)
  905. # Link OSMesa to libGL otherwise
  906. OSMESA_LIB_DEPS=""
  907. # only link libraries with osmesa if shared
  908. if test "$enable_static" = no; then
  909. OSMESA_MESA_DEPS='-l$(GL_LIB)'
  910. else
  911. OSMESA_MESA_DEPS=""
  912. fi
  913. OSMESA_PC_REQ="gl"
  914. ;;
  915. esac
  916. OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
  917. AC_SUBST([OSMESA_LIB_DEPS])
  918. AC_SUBST([OSMESA_MESA_DEPS])
  919. AC_SUBST([OSMESA_PC_REQ])
  920. AC_SUBST([OSMESA_PC_LIB_PRIV])
  921. dnl
  922. dnl EGL configuration
  923. dnl
  924. AC_ARG_ENABLE([egl],
  925. [AS_HELP_STRING([--disable-egl],
  926. [disable EGL library @<:@default=enabled@:>@])],
  927. [enable_egl="$enableval"],
  928. [enable_egl=yes])
  929. if test "x$enable_egl" = xyes; then
  930. SRC_DIRS="$SRC_DIRS egl"
  931. EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
  932. EGL_DRIVERS_DIRS=""
  933. if test "$enable_static" != yes; then
  934. # build egl_glx when libGL is built
  935. if test "$mesa_driver" != osmesa; then
  936. EGL_DRIVERS_DIRS="glx"
  937. fi
  938. # build egl_dri2 when xcb-dri2 is available
  939. PKG_CHECK_MODULES([EGL_DRI2], [x11-xcb xcb-dri2 xcb-xfixes libdrm],
  940. [have_xcb_dri2=yes],[have_xcb_dri2=no])
  941. if test "$have_xcb_dri2" = yes; then
  942. EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS dri2"
  943. fi
  944. fi
  945. if test "$with_demos" = yes; then
  946. PROGRAM_DIRS="$PROGRAM_DIRS egl/eglut egl/opengl"
  947. fi
  948. fi
  949. AC_SUBST([EGL_LIB_DEPS])
  950. AC_SUBST([EGL_DRIVERS_DIRS])
  951. dnl
  952. dnl GLU configuration
  953. dnl
  954. AC_ARG_ENABLE([glu],
  955. [AS_HELP_STRING([--disable-glu],
  956. [enable OpenGL Utility library @<:@default=enabled@:>@])],
  957. [enable_glu="$enableval"],
  958. [enable_glu=yes])
  959. if test "x$enable_glu" = xyes; then
  960. SRC_DIRS="$SRC_DIRS glu"
  961. case "$mesa_driver" in
  962. osmesa)
  963. # If GLU is available and we have libOSMesa (not 16 or 32),
  964. # we can build the osdemos
  965. if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
  966. PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
  967. fi
  968. # Link libGLU to libOSMesa instead of libGL
  969. GLU_LIB_DEPS=""
  970. GLU_PC_REQ="osmesa"
  971. if test "$enable_static" = no; then
  972. GLU_MESA_DEPS='-l$(OSMESA_LIB)'
  973. else
  974. GLU_MESA_DEPS=""
  975. fi
  976. ;;
  977. *)
  978. # If static, empty GLU_LIB_DEPS and add libs for programs to link
  979. GLU_PC_REQ="gl"
  980. GLU_PC_LIB_PRIV="-lm"
  981. if test "$enable_static" = no; then
  982. GLU_LIB_DEPS="-lm"
  983. GLU_MESA_DEPS='-l$(GL_LIB)'
  984. else
  985. GLU_LIB_DEPS=""
  986. GLU_MESA_DEPS=""
  987. APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
  988. fi
  989. ;;
  990. esac
  991. fi
  992. if test "$enable_static" = no; then
  993. GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
  994. fi
  995. GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
  996. AC_SUBST([GLU_LIB_DEPS])
  997. AC_SUBST([GLU_MESA_DEPS])
  998. AC_SUBST([GLU_PC_REQ])
  999. AC_SUBST([GLU_PC_REQ_PRIV])
  1000. AC_SUBST([GLU_PC_LIB_PRIV])
  1001. AC_SUBST([GLU_PC_CFLAGS])
  1002. dnl
  1003. dnl GLw configuration
  1004. dnl
  1005. AC_ARG_ENABLE([glw],
  1006. [AS_HELP_STRING([--disable-glw],
  1007. [enable Xt/Motif widget library @<:@default=enabled@:>@])],
  1008. [enable_glw="$enableval"],
  1009. [enable_glw=yes])
  1010. dnl Don't build GLw on osmesa
  1011. if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
  1012. AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
  1013. enable_glw=no
  1014. fi
  1015. AC_ARG_ENABLE([motif],
  1016. [AS_HELP_STRING([--enable-motif],
  1017. [use Motif widgets in GLw @<:@default=disabled@:>@])],
  1018. [enable_motif="$enableval"],
  1019. [enable_motif=no])
  1020. if test "x$enable_glw" = xyes; then
  1021. SRC_DIRS="$SRC_DIRS glw"
  1022. if test "$x11_pkgconfig" = yes; then
  1023. PKG_CHECK_MODULES([GLW],[x11 xt])
  1024. GLW_PC_REQ_PRIV="x11 xt"
  1025. GLW_LIB_DEPS="$GLW_LIBS"
  1026. else
  1027. # should check these...
  1028. GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
  1029. GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
  1030. GLW_PC_CFLAGS="$X11_INCLUDES"
  1031. fi
  1032. GLW_SOURCES="GLwDrawA.c"
  1033. MOTIF_CFLAGS=
  1034. if test "x$enable_motif" = xyes; then
  1035. GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
  1036. AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
  1037. if test "x$MOTIF_CONFIG" != xno; then
  1038. MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
  1039. MOTIF_LIBS=`$MOTIF_CONFIG --libs`
  1040. else
  1041. AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
  1042. [AC_MSG_ERROR([Can't locate Motif headers])])
  1043. AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
  1044. [AC_MSG_ERROR([Can't locate Motif Xm library])])
  1045. fi
  1046. # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
  1047. GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
  1048. GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
  1049. GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
  1050. fi
  1051. # If static, empty GLW_LIB_DEPS and add libs for programs to link
  1052. GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
  1053. if test "$enable_static" = no; then
  1054. GLW_MESA_DEPS='-l$(GL_LIB)'
  1055. GLW_LIB_DEPS="$GLW_LIB_DEPS"
  1056. else
  1057. APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
  1058. GLW_LIB_DEPS=""
  1059. GLW_MESA_DEPS=""
  1060. fi
  1061. fi
  1062. AC_SUBST([GLW_LIB_DEPS])
  1063. AC_SUBST([GLW_MESA_DEPS])
  1064. AC_SUBST([GLW_SOURCES])
  1065. AC_SUBST([MOTIF_CFLAGS])
  1066. AC_SUBST([GLW_PC_REQ_PRIV])
  1067. AC_SUBST([GLW_PC_LIB_PRIV])
  1068. AC_SUBST([GLW_PC_CFLAGS])
  1069. dnl
  1070. dnl GLUT configuration
  1071. dnl
  1072. if test -f "$srcdir/include/GL/glut.h"; then
  1073. default_glut=yes
  1074. else
  1075. default_glut=no
  1076. fi
  1077. AC_ARG_ENABLE([glut],
  1078. [AS_HELP_STRING([--disable-glut],
  1079. [enable GLUT library @<:@default=enabled if source available@:>@])],
  1080. [enable_glut="$enableval"],
  1081. [enable_glut="$default_glut"])
  1082. dnl Can't build glut if GLU not available
  1083. if test "x$enable_glu$enable_glut" = xnoyes; then
  1084. AC_MSG_WARN([Disabling glut since GLU is disabled])
  1085. enable_glut=no
  1086. fi
  1087. dnl Don't build glut on osmesa
  1088. if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
  1089. AC_MSG_WARN([Disabling glut since the driver is OSMesa])
  1090. enable_glut=no
  1091. fi
  1092. if test "x$enable_glut" = xyes; then
  1093. SRC_DIRS="$SRC_DIRS glut/glx"
  1094. GLUT_CFLAGS=""
  1095. if test "x$GCC" = xyes; then
  1096. GLUT_CFLAGS="-fexceptions"
  1097. fi
  1098. if test "$x11_pkgconfig" = yes; then
  1099. PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
  1100. GLUT_PC_REQ_PRIV="x11 xmu xi"
  1101. GLUT_LIB_DEPS="$GLUT_LIBS"
  1102. else
  1103. # should check these...
  1104. GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
  1105. GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
  1106. GLUT_PC_CFLAGS="$X11_INCLUDES"
  1107. fi
  1108. GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
  1109. GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
  1110. # If glut is available, we can build most programs
  1111. if test "$with_demos" = yes; then
  1112. PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
  1113. fi
  1114. # If static, empty GLUT_LIB_DEPS and add libs for programs to link
  1115. if test "$enable_static" = no; then
  1116. GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
  1117. else
  1118. APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
  1119. GLUT_LIB_DEPS=""
  1120. GLUT_MESA_DEPS=""
  1121. fi
  1122. fi
  1123. AC_SUBST([GLUT_LIB_DEPS])
  1124. AC_SUBST([GLUT_MESA_DEPS])
  1125. AC_SUBST([GLUT_CFLAGS])
  1126. AC_SUBST([GLUT_PC_REQ_PRIV])
  1127. AC_SUBST([GLUT_PC_LIB_PRIV])
  1128. AC_SUBST([GLUT_PC_CFLAGS])
  1129. dnl
  1130. dnl Program library dependencies
  1131. dnl Only libm is added here if necessary as the libraries should
  1132. dnl be pulled in by the linker
  1133. dnl
  1134. if test "x$APP_LIB_DEPS" = x; then
  1135. case "$host_os" in
  1136. solaris*)
  1137. APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
  1138. ;;
  1139. cygwin*)
  1140. APP_LIB_DEPS="-lX11"
  1141. ;;
  1142. *)
  1143. APP_LIB_DEPS="-lm"
  1144. ;;
  1145. esac
  1146. fi
  1147. AC_SUBST([APP_LIB_DEPS])
  1148. AC_SUBST([PROGRAM_DIRS])
  1149. dnl
  1150. dnl Gallium configuration
  1151. dnl
  1152. AC_ARG_ENABLE([gallium],
  1153. [AS_HELP_STRING([--disable-gallium],
  1154. [build gallium @<:@default=enabled@:>@])],
  1155. [enable_gallium="$enableval"],
  1156. [enable_gallium=yes])
  1157. if test "x$enable_gallium" = xyes; then
  1158. SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
  1159. AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
  1160. [HAS_UDIS86="no"])
  1161. AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
  1162. fi
  1163. AC_SUBST([LLVM_CFLAGS])
  1164. AC_SUBST([LLVM_LIBS])
  1165. AC_SUBST([LLVM_LDFLAGS])
  1166. AC_SUBST([LLVM_VERSION])
  1167. VG_LIB_DEPS=""
  1168. EGL_CLIENT_APIS='$(GL_LIB)'
  1169. if test "x$enable_gles_overlay" = xyes; then
  1170. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
  1171. fi
  1172. dnl
  1173. dnl Gallium state trackers configuration
  1174. dnl
  1175. AC_ARG_WITH([state-trackers],
  1176. [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
  1177. [comma delimited state_trackers list, e.g.
  1178. "egl,glx" @<:@default=auto@:>@])],
  1179. [with_state_trackers="$withval"],
  1180. [with_state_trackers=yes])
  1181. case "$with_state_trackers" in
  1182. no)
  1183. GALLIUM_STATE_TRACKERS_DIRS=""
  1184. ;;
  1185. yes)
  1186. # look at what else is built
  1187. case "$mesa_driver" in
  1188. xlib)
  1189. GALLIUM_STATE_TRACKERS_DIRS=glx
  1190. ;;
  1191. dri)
  1192. GALLIUM_STATE_TRACKERS_DIRS="dri"
  1193. HAVE_ST_DRI="yes"
  1194. if test "x$enable_egl" = xyes; then
  1195. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
  1196. HAVE_ST_EGL="yes"
  1197. fi
  1198. # Have only tested st/xorg on 1.6.0 servers
  1199. PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
  1200. HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
  1201. HAVE_ST_XORG="no")
  1202. ;;
  1203. esac
  1204. ;;
  1205. *)
  1206. # verify the requested state tracker exist
  1207. state_trackers=""
  1208. _state_trackers=`IFS=', '; echo $with_state_trackers`
  1209. for tracker in $_state_trackers; do
  1210. case "$tracker" in
  1211. dri)
  1212. if test "x$mesa_driver" != xdri; then
  1213. AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
  1214. fi
  1215. HAVE_ST_DRI="yes"
  1216. ;;
  1217. egl)
  1218. if test "x$enable_egl" != xyes; then
  1219. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1220. fi
  1221. HAVE_ST_EGL="yes"
  1222. ;;
  1223. xorg)
  1224. PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
  1225. PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
  1226. HAVE_ST_XORG="yes"
  1227. ;;
  1228. es)
  1229. AC_MSG_WARN([state tracker 'es' has been replaced by --enable-gles-overlay])
  1230. if test "x$enable_gles_overlay" != xyes; then
  1231. if test "x$enable_gles1" != xyes -a "x$enable_gles2" != xyes; then
  1232. CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
  1233. fi
  1234. GLES_OVERLAY=1
  1235. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
  1236. fi
  1237. tracker=""
  1238. ;;
  1239. vega)
  1240. CORE_DIRS="$CORE_DIRS mapi/vgapi"
  1241. VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
  1242. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
  1243. ;;
  1244. esac
  1245. if test -n "$tracker"; then
  1246. test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
  1247. AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
  1248. if test -n "$state_trackers"; then
  1249. state_trackers="$state_trackers $tracker"
  1250. else
  1251. state_trackers="$tracker"
  1252. fi
  1253. fi
  1254. done
  1255. GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
  1256. ;;
  1257. esac
  1258. AC_SUBST([VG_LIB_DEPS])
  1259. AC_SUBST([EGL_CLIENT_APIS])
  1260. if test "x$HAVE_ST_EGL" = xyes; then
  1261. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-apis"
  1262. fi
  1263. if test "x$HAVE_ST_XORG" = xyes; then
  1264. PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
  1265. HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
  1266. HAVE_XEXTPROTO_71="no")
  1267. fi
  1268. AC_ARG_WITH([egl-displays],
  1269. [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
  1270. [comma delimited native displays libEGL supports, e.g.
  1271. "x11,kms" @<:@default=auto@:>@])],
  1272. [with_egl_displays="$withval"],
  1273. [with_egl_displays=yes])
  1274. EGL_DISPLAYS=""
  1275. case "$with_egl_displays" in
  1276. yes)
  1277. if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
  1278. EGL_DISPLAYS="x11"
  1279. fi
  1280. ;;
  1281. *)
  1282. if test "x$enable_egl" != xyes; then
  1283. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1284. fi
  1285. # verify the requested driver directories exist
  1286. egl_displays=`IFS=', '; echo $with_egl_displays`
  1287. for dpy in $egl_displays; do
  1288. test -d "$srcdir/src/gallium/state_trackers/egl/$dpy" || \
  1289. AC_MSG_ERROR([EGL display '$dpy' does't exist])
  1290. done
  1291. EGL_DISPLAYS="$egl_displays"
  1292. ;;
  1293. esac
  1294. AC_SUBST([EGL_DISPLAYS])
  1295. AC_ARG_WITH([egl-driver-dir],
  1296. [AS_HELP_STRING([--with-egl-driver-dir=DIR],
  1297. [directory for EGL drivers [[default=${libdir}/egl]]])],
  1298. [EGL_DRIVER_INSTALL_DIR="$withval"],
  1299. [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
  1300. AC_SUBST([EGL_DRIVER_INSTALL_DIR])
  1301. AC_ARG_WITH([xorg-driver-dir],
  1302. [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
  1303. [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
  1304. [XORG_DRIVER_INSTALL_DIR="$withval"],
  1305. [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
  1306. AC_SUBST([XORG_DRIVER_INSTALL_DIR])
  1307. AC_ARG_WITH([max-width],
  1308. [AS_HELP_STRING([--with-max-width=N],
  1309. [Maximum framebuffer width (4096)])],
  1310. [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
  1311. AS_IF([test "${withval}" -gt "4096"],
  1312. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1313. )
  1314. AC_ARG_WITH([max-height],
  1315. [AS_HELP_STRING([--with-max-height=N],
  1316. [Maximum framebuffer height (4096)])],
  1317. [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
  1318. AS_IF([test "${withval}" -gt "4096"],
  1319. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1320. )
  1321. dnl
  1322. dnl Gallium LLVM
  1323. dnl
  1324. AC_ARG_ENABLE([gallium-llvm],
  1325. [AS_HELP_STRING([--enable-gallium-llvm],
  1326. [build gallium LLVM support @<:@default=disabled@:>@])],
  1327. [enable_gallium_llvm="$enableval"],
  1328. [enable_gallium_llvm=auto])
  1329. if test "x$enable_gallium_llvm" = xyes; then
  1330. if test "x$LLVM_CONFIG" != xno; then
  1331. LLVM_VERSION=`$LLVM_CONFIG --version`
  1332. LLVM_CFLAGS=`$LLVM_CONFIG --cflags`
  1333. LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
  1334. if test "x$HAS_UDIS86" != xno; then
  1335. LLVM_LIBS="$LLVM_LIBS -ludis86"
  1336. DEFINES="$DEFINES -DHAVE_UDIS86"
  1337. fi
  1338. LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
  1339. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
  1340. DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
  1341. MESA_LLVM=1
  1342. else
  1343. MESA_LLVM=0
  1344. fi
  1345. else
  1346. MESA_LLVM=0
  1347. fi
  1348. dnl
  1349. dnl Gallium helper functions
  1350. dnl
  1351. gallium_check_st() {
  1352. if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_EGL" = xyes || test "x$HAVE_ST_XORG" = xyes; then
  1353. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
  1354. fi
  1355. if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
  1356. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
  1357. fi
  1358. if test "x$HAVE_ST_EGL" = xyes && test "x$3" != x; then
  1359. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
  1360. fi
  1361. if test "x$HAVE_ST_XORG" = xyes && test "x$4" != x; then
  1362. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
  1363. fi
  1364. }
  1365. dnl
  1366. dnl Gallium SVGA configuration
  1367. dnl
  1368. AC_ARG_ENABLE([gallium-svga],
  1369. [AS_HELP_STRING([--enable-gallium-svga],
  1370. [build gallium SVGA @<:@default=disabled@:>@])],
  1371. [enable_gallium_svga="$enableval"],
  1372. [enable_gallium_svga=auto])
  1373. if test "x$enable_gallium_svga" = xyes; then
  1374. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
  1375. gallium_check_st "svga/drm" "dri-vmwgfx" "egl-vmwgfx" "xorg-vmwgfx"
  1376. elif test "x$enable_gallium_svga" = xauto; then
  1377. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
  1378. fi
  1379. dnl
  1380. dnl Gallium Intel configuration
  1381. dnl
  1382. AC_ARG_ENABLE([gallium-intel],
  1383. [AS_HELP_STRING([--enable-gallium-intel],
  1384. [build gallium intel @<:@default=disabled@:>@])],
  1385. [enable_gallium_intel="$enableval"],
  1386. [enable_gallium_intel=auto])
  1387. if test "x$enable_gallium_intel" = xyes; then
  1388. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
  1389. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
  1390. gallium_check_st "i915/drm i965/drm" "dri-i915 dri-i965" "egl-i915 egl-i965" "xorg-i915 xorg-i965"
  1391. elif test "x$enable_gallium_intel" = xauto; then
  1392. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
  1393. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
  1394. fi
  1395. dnl
  1396. dnl Gallium Radeon configuration
  1397. dnl
  1398. AC_ARG_ENABLE([gallium-radeon],
  1399. [AS_HELP_STRING([--enable-gallium-radeon],
  1400. [build gallium radeon @<:@default=disabled@:>@])],
  1401. [enable_gallium_radeon="$enableval"],
  1402. [enable_gallium_radeon=auto])
  1403. if test "x$enable_gallium_radeon" = xyes; then
  1404. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1405. gallium_check_st "radeon/drm" "dri-radeong" "egl-radeon" "xorg-radeon"
  1406. elif test "x$enable_gallium_radeon" = xauto; then
  1407. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1408. fi
  1409. dnl
  1410. dnl Gallium Nouveau configuration
  1411. dnl
  1412. AC_ARG_ENABLE([gallium-nouveau],
  1413. [AS_HELP_STRING([--enable-gallium-nouveau],
  1414. [build gallium nouveau @<:@default=disabled@:>@])],
  1415. [enable_gallium_nouveau="$enableval"],
  1416. [enable_gallium_nouveau=no])
  1417. if test "x$enable_gallium_nouveau" = xyes; then
  1418. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50"
  1419. gallium_check_st "nouveau/drm" "dri-nouveau" "egl-nouveau" "xorg-nouveau"
  1420. fi
  1421. dnl
  1422. dnl Gallium swrast configuration
  1423. dnl
  1424. AC_ARG_ENABLE([gallium-swrast],
  1425. [AS_HELP_STRING([--enable-gallium-swrast],
  1426. [build gallium swrast @<:@default=auto@:>@])],
  1427. [enable_gallium_swrast="$enableval"],
  1428. [enable_gallium_swrast=auto])
  1429. if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
  1430. if test "x$HAVE_ST_DRI" = xyes; then
  1431. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
  1432. fi
  1433. if test "x$HAVE_ST_EGL" = xyes; then
  1434. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-swrast"
  1435. fi
  1436. fi
  1437. dnl prepend CORE_DIRS to SRC_DIRS
  1438. SRC_DIRS="$CORE_DIRS $SRC_DIRS"
  1439. dnl Restore LDFLAGS and CPPFLAGS
  1440. LDFLAGS="$_SAVE_LDFLAGS"
  1441. CPPFLAGS="$_SAVE_CPPFLAGS"
  1442. dnl Substitute the config
  1443. AC_CONFIG_FILES([configs/autoconf])
  1444. dnl Replace the configs/current symlink
  1445. AC_CONFIG_COMMANDS([configs],[
  1446. if test -f configs/current || test -L configs/current; then
  1447. rm -f configs/current
  1448. fi
  1449. ln -s autoconf configs/current
  1450. ])
  1451. AC_OUTPUT
  1452. dnl
  1453. dnl Output some configuration info for the user
  1454. dnl
  1455. echo ""
  1456. echo " prefix: $prefix"
  1457. echo " exec_prefix: $exec_prefix"
  1458. echo " libdir: $libdir"
  1459. echo " includedir: $includedir"
  1460. dnl Driver info
  1461. echo ""
  1462. echo " Driver: $mesa_driver"
  1463. if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
  1464. echo " OSMesa: lib$OSMESA_LIB"
  1465. else
  1466. echo " OSMesa: no"
  1467. fi
  1468. if test "$mesa_driver" = dri; then
  1469. # cleanup the drivers var
  1470. dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1471. if test "x$DRI_DIRS" = x; then
  1472. echo " DRI drivers: no"
  1473. else
  1474. echo " DRI drivers: $dri_dirs"
  1475. fi
  1476. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  1477. fi
  1478. echo " Use XCB: $enable_xcb"
  1479. echo ""
  1480. if test "x$MESA_LLVM" == x1; then
  1481. echo " llvm: yes"
  1482. echo " llvm-config: $LLVM_CONFIG"
  1483. echo " llvm-version: $LLVM_VERSION"
  1484. else
  1485. echo " llvm: no"
  1486. fi
  1487. echo ""
  1488. if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
  1489. echo " Gallium: yes"
  1490. echo " Gallium dirs: $GALLIUM_DIRS"
  1491. echo " Target dirs: $GALLIUM_TARGET_DIRS"
  1492. echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
  1493. echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
  1494. echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
  1495. if test "x$HAVE_ST_EGL" = xyes; then
  1496. echo " EGL client APIs: $EGL_CLIENT_APIS"
  1497. fi
  1498. else
  1499. echo " Gallium: no"
  1500. fi
  1501. dnl Libraries
  1502. echo ""
  1503. echo " Shared libs: $enable_shared"
  1504. echo " Static libs: $enable_static"
  1505. if test "$enable_egl" = yes; then
  1506. echo " EGL: $EGL_DRIVERS_DIRS"
  1507. echo " EGL displays: $EGL_DISPLAYS"
  1508. else
  1509. echo " EGL: no"
  1510. fi
  1511. echo " GLU: $enable_glu"
  1512. echo " GLw: $enable_glw (Motif: $enable_motif)"
  1513. echo " glut: $enable_glut"
  1514. dnl Programs
  1515. # cleanup the programs var for display
  1516. program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1517. if test "x$program_dirs" = x; then
  1518. echo " Demos: no"
  1519. else
  1520. echo " Demos: $program_dirs"
  1521. fi
  1522. dnl Compiler options
  1523. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  1524. cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1525. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1526. cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1527. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1528. defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1529. echo ""
  1530. echo " CFLAGS: $cflags"
  1531. echo " CXXFLAGS: $cxxflags"
  1532. echo " Macros: $defines"
  1533. echo ""
  1534. echo " Run '${MAKE-make}' to build Mesa"
  1535. echo ""