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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302
  1. dnl Process this file with autoconf to create configure.
  2. AC_PREREQ([2.60])
  3. dnl Tell the user about autoconf.html in the --help output
  4. m4_divert_once([HELP_END], [
  5. See docs/autoconf.html for more details on the options for Mesa.])
  6. AC_INIT([Mesa], [8.1.0],
  7. [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
  8. AC_CONFIG_AUX_DIR([bin])
  9. AC_CANONICAL_HOST
  10. AM_INIT_AUTOMAKE([foreign])
  11. dnl http://people.gnome.org/~walters/docs/build-api.txt
  12. dnl We don't support srcdir != builddir.
  13. echo \#buildapi-variable-no-builddir >/dev/null
  14. # Support silent build rules, requires at least automake-1.11. Disable
  15. # by either passing --disable-silent-rules to configure or passing V=1
  16. # to make
  17. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  18. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  19. LT_PREREQ([2.2])
  20. LT_INIT([disable-static])
  21. dnl Save user CFLAGS and CXXFLAGS so one can override the default ones
  22. USER_CFLAGS="$CFLAGS"
  23. USER_CXXFLAGS="$CXXFLAGS"
  24. dnl Versions for external dependencies
  25. LIBDRM_REQUIRED=2.4.24
  26. LIBDRM_RADEON_REQUIRED=2.4.31
  27. LIBDRM_INTEL_REQUIRED=2.4.37
  28. LIBDRM_NVVIEUX_REQUIRED=2.4.33
  29. LIBDRM_NOUVEAU_REQUIRED=2.4.33
  30. DRI2PROTO_REQUIRED=2.6
  31. GLPROTO_REQUIRED=1.4.14
  32. LIBDRM_XORG_REQUIRED=2.4.24
  33. LIBKMS_XORG_REQUIRED=1.0.0
  34. dnl Check for progs
  35. AC_PROG_CPP
  36. AC_PROG_CC
  37. AC_PROG_CXX
  38. AM_PROG_CC_C_O
  39. AM_PROG_AS
  40. AC_CHECK_PROGS([MAKE], [gmake make])
  41. AC_CHECK_PROGS([PYTHON2], [python2 python])
  42. AC_PROG_SED
  43. AC_PROG_MKDIR_P
  44. AC_PATH_PROG([MKDEP], [makedepend])
  45. if test "x$MKDEP" = "x"; then
  46. AC_MSG_ERROR([makedepend is required to build Mesa])
  47. fi
  48. AC_PROG_YACC
  49. AC_PATH_PROG([YACC_INST], $YACC)
  50. if test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.y"; then
  51. if test -z "$YACC_INST"; then
  52. AC_MSG_ERROR([yacc not found - unable to compile glcpp-parse.y])
  53. fi
  54. fi
  55. AC_PROG_LEX
  56. AC_PATH_PROG([PERL], [perl])
  57. AC_CHECK_PROG(INDENT, indent, indent, cat)
  58. if test "x$INDENT" != "xcat"; then
  59. AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte -T Bool')
  60. fi
  61. dnl Our fallback install-sh is a symlink to minstall. Use the existing
  62. dnl configuration in that case.
  63. AC_PROG_INSTALL
  64. test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
  65. dnl We need a POSIX shell for parts of the build. Assume we have one
  66. dnl in most cases.
  67. case "$host_os" in
  68. solaris*)
  69. # Solaris /bin/sh is too old/non-POSIX compliant
  70. AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
  71. SHELL="$POSIX_SHELL"
  72. ;;
  73. esac
  74. dnl clang is mostly GCC-compatible, but its version is much lower,
  75. dnl so we have to check for it.
  76. AC_MSG_CHECKING([if compiling with clang])
  77. AC_COMPILE_IFELSE(
  78. [AC_LANG_PROGRAM([], [[
  79. #ifndef __clang__
  80. not clang
  81. #endif
  82. ]])],
  83. [acv_mesa_CLANG=yes], [acv_mesa_CLANG=no])
  84. AC_MSG_RESULT([$acv_mesa_CLANG])
  85. dnl If we're using GCC, make sure that it is at least version 3.3.0. Older
  86. dnl versions are explictly not supported.
  87. if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
  88. AC_MSG_CHECKING([whether gcc version is sufficient])
  89. major=0
  90. minor=0
  91. GCC_VERSION=`$CC -dumpversion`
  92. if test $? -eq 0; then
  93. GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
  94. GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
  95. fi
  96. if test $GCC_VERSION_MAJOR -lt 3 -o $GCC_VERSION_MAJOR -eq 3 -a $GCC_VERSION_MINOR -lt 3 ; then
  97. AC_MSG_RESULT([no])
  98. AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
  99. else
  100. AC_MSG_RESULT([yes])
  101. fi
  102. fi
  103. MKDEP_OPTIONS=-fdepend
  104. dnl Ask gcc where it's keeping its secret headers
  105. if test "x$GCC" = xyes; then
  106. for dir in include include-fixed; do
  107. GCC_INCLUDES=`$CC -print-file-name=$dir`
  108. if test "x$GCC_INCLUDES" != x && \
  109. test "$GCC_INCLUDES" != "$dir" && \
  110. test -d "$GCC_INCLUDES"; then
  111. MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
  112. fi
  113. done
  114. fi
  115. AC_SUBST([MKDEP_OPTIONS])
  116. dnl Make sure the pkg-config macros are defined
  117. m4_ifndef([PKG_PROG_PKG_CONFIG],
  118. [m4_fatal([Could not locate the pkg-config autoconf macros.
  119. These are usually located in /usr/share/aclocal/pkg.m4. If your macros
  120. are in a different location, try setting the environment variable
  121. ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
  122. PKG_PROG_PKG_CONFIG()
  123. dnl LIB_DIR - library basename
  124. LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
  125. AC_SUBST([LIB_DIR])
  126. dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
  127. _SAVE_LDFLAGS="$LDFLAGS"
  128. AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
  129. AC_SUBST([EXTRA_LIB_PATH])
  130. dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
  131. _SAVE_CPPFLAGS="$CPPFLAGS"
  132. AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
  133. AC_SUBST([X11_INCLUDES])
  134. dnl Compiler macros
  135. DEFINES=""
  136. AC_SUBST([DEFINES])
  137. case "$host_os" in
  138. linux*|*-gnu*|gnu*)
  139. DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
  140. ;;
  141. solaris*)
  142. DEFINES="$DEFINES -DPTHREADS -DSVR4"
  143. ;;
  144. cygwin*)
  145. DEFINES="$DEFINES -DPTHREADS"
  146. ;;
  147. esac
  148. dnl Add flags for gcc and g++
  149. if test "x$GCC" = xyes; then
  150. CFLAGS="$CFLAGS -Wall -std=c99"
  151. # Enable -Werror=implicit-function-declaration and
  152. # -Werror=missing-prototypes, if available, or otherwise, just
  153. # -Wmissing-prototypes. This is particularly useful to avoid
  154. # generating a loadable driver module that has undefined symbols.
  155. save_CFLAGS="$CFLAGS"
  156. AC_MSG_CHECKING([whether $CC supports -Werror=missing-prototypes])
  157. CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
  158. CFLAGS="$CFLAGS -Werror=missing-prototypes"
  159. AC_LINK_IFELSE([AC_LANG_PROGRAM()],
  160. AC_MSG_RESULT([yes]),
  161. [CFLAGS="$save_CFLAGS -Wmissing-prototypes";
  162. AC_MSG_RESULT([no])]);
  163. # Enable -fvisibility=hidden if using a gcc that supports it
  164. save_CFLAGS="$CFLAGS"
  165. AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
  166. VISIBILITY_CFLAGS="-fvisibility=hidden"
  167. CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
  168. AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
  169. [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
  170. # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
  171. CFLAGS=$save_CFLAGS
  172. # Work around aliasing bugs - developers should comment this out
  173. CFLAGS="$CFLAGS -fno-strict-aliasing"
  174. # gcc's builtin memcmp is slower than glibc's
  175. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
  176. CFLAGS="$CFLAGS -fno-builtin-memcmp"
  177. fi
  178. if test "x$GXX" = xyes; then
  179. CXXFLAGS="$CXXFLAGS -Wall"
  180. # Enable -fvisibility=hidden if using a gcc that supports it
  181. save_CXXFLAGS="$CXXFLAGS"
  182. AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
  183. VISIBILITY_CXXFLAGS="-fvisibility=hidden"
  184. CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
  185. AC_LANG_PUSH([C++])
  186. AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
  187. [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
  188. AC_LANG_POP([C++])
  189. # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
  190. CXXFLAGS=$save_CXXFLAGS
  191. # Work around aliasing bugs - developers should comment this out
  192. CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
  193. # gcc's builtin memcmp is slower than glibc's
  194. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
  195. CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
  196. fi
  197. dnl even if the compiler appears to support it, using visibility attributes isn't
  198. dnl going to do anything useful currently on cygwin apart from emit lots of warnings
  199. case "$host_os" in
  200. cygwin*)
  201. VISIBILITY_CFLAGS=""
  202. VISIBILITY_CXXFLAGS=""
  203. ;;
  204. esac
  205. AC_SUBST([VISIBILITY_CFLAGS])
  206. AC_SUBST([VISIBILITY_CXXFLAGS])
  207. dnl These should be unnecessary, but let the user set them if they want
  208. AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
  209. Default is to use CFLAGS.])
  210. AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
  211. compiler. Default is to use CFLAGS.])
  212. AC_SUBST([OPT_FLAGS])
  213. AC_SUBST([ARCH_FLAGS])
  214. dnl
  215. dnl Hacks to enable 32 or 64 bit build
  216. dnl
  217. AC_ARG_ENABLE([32-bit],
  218. [AS_HELP_STRING([--enable-32-bit],
  219. [build 32-bit libraries @<:@default=auto@:>@])],
  220. [enable_32bit="$enableval"],
  221. [enable_32bit=auto]
  222. )
  223. if test "x$enable_32bit" = xyes; then
  224. if test "x$GCC" = xyes; then
  225. CFLAGS="$CFLAGS -m32"
  226. ARCH_FLAGS="$ARCH_FLAGS -m32"
  227. CCASFLAGS="$CCASFLAGS -m32"
  228. fi
  229. if test "x$GXX" = xyes; then
  230. CXXFLAGS="$CXXFLAGS -m32"
  231. fi
  232. fi
  233. AC_ARG_ENABLE([64-bit],
  234. [AS_HELP_STRING([--enable-64-bit],
  235. [build 64-bit libraries @<:@default=auto@:>@])],
  236. [enable_64bit="$enableval"],
  237. [enable_64bit=auto]
  238. )
  239. if test "x$enable_64bit" = xyes; then
  240. if test "x$GCC" = xyes; then
  241. CFLAGS="$CFLAGS -m64"
  242. fi
  243. if test "x$GXX" = xyes; then
  244. CXXFLAGS="$CXXFLAGS -m64"
  245. fi
  246. fi
  247. dnl Can't have static and shared libraries, default to static if user
  248. dnl explicitly requested. If both disabled, set to static since shared
  249. dnl was explicitly requested.
  250. case "x$enable_static$enable_shared" in
  251. xyesyes )
  252. AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
  253. enable_shared=no
  254. ;;
  255. xnono )
  256. AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
  257. enable_static=yes
  258. ;;
  259. esac
  260. dnl
  261. dnl mklib options
  262. dnl
  263. AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
  264. if test "$enable_static" = yes; then
  265. MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
  266. fi
  267. AC_SUBST([MKLIB_OPTIONS])
  268. dnl
  269. dnl other compiler options
  270. dnl
  271. AC_ARG_ENABLE([debug],
  272. [AS_HELP_STRING([--enable-debug],
  273. [use debug compiler flags and macros @<:@default=disabled@:>@])],
  274. [enable_debug="$enableval"],
  275. [enable_debug=no]
  276. )
  277. if test "x$enable_debug" = xyes; then
  278. DEFINES="$DEFINES -DDEBUG"
  279. if test "x$GCC" = xyes; then
  280. CFLAGS="$CFLAGS -g"
  281. fi
  282. if test "x$GXX" = xyes; then
  283. CXXFLAGS="$CXXFLAGS -g"
  284. fi
  285. fi
  286. dnl
  287. dnl library names
  288. dnl
  289. LIB_PREFIX_GLOB='lib'
  290. LIB_VERSION_SEPARATOR='.'
  291. if test "$enable_static" = yes; then
  292. LIB_EXTENSION='a'
  293. else
  294. case "$host_os" in
  295. darwin* )
  296. LIB_EXTENSION='dylib' ;;
  297. cygwin* )
  298. dnl prefix can be 'cyg' or 'lib'
  299. LIB_PREFIX_GLOB='???'
  300. LIB_VERSION_SEPARATOR='-'
  301. LIB_EXTENSION='dll' ;;
  302. aix* )
  303. LIB_EXTENSION='a' ;;
  304. * )
  305. LIB_EXTENSION='so' ;;
  306. esac
  307. fi
  308. AC_ARG_WITH([gl-lib-name],
  309. [AS_HELP_STRING([--with-gl-lib-name@<:@=NAME@:>@],
  310. [specify GL library name @<:@default=GL@:>@])],
  311. [GL_LIB=$withval],
  312. [GL_LIB=GL])
  313. AC_ARG_WITH([glu-lib-name],
  314. [AS_HELP_STRING([--with-glu-lib-name@<:@=NAME@:>@],
  315. [specify GLU library name @<:@default=GLU@:>@])],
  316. [GLU_LIB=$withval],
  317. [GLU_LIB=GLU])
  318. AC_ARG_WITH([osmesa-lib-name],
  319. [AS_HELP_STRING([--with-osmesa-lib-name@<:@=NAME@:>@],
  320. [specify OSMesa library name @<:@default=OSMesa@:>@])],
  321. [OSMESA_LIB=$withval],
  322. [OSMESA_LIB=OSMesa])
  323. AS_IF([test "x$GL_LIB" = xyes], [GL_LIB=GL])
  324. AS_IF([test "x$GLU_LIB" = xyes], [GLU_LIB=GLU])
  325. AS_IF([test "x$OSMESA_LIB" = xyes], [OSMESA_LIB=OSMesa])
  326. dnl
  327. dnl Mangled Mesa support
  328. dnl
  329. AC_ARG_ENABLE([mangling],
  330. [AS_HELP_STRING([--enable-mangling],
  331. [enable mangled symbols and library name @<:@default=disabled@:>@])],
  332. [enable_mangling="${enableval}"],
  333. [enable_mangling=no]
  334. )
  335. if test "x${enable_mangling}" = "xyes" ; then
  336. DEFINES="${DEFINES} -DUSE_MGL_NAMESPACE"
  337. GL_LIB="Mangled${GL_LIB}"
  338. GLU_LIB="Mangled${GLU_LIB}"
  339. OSMESA_LIB="Mangled${OSMESA_LIB}"
  340. fi
  341. AC_SUBST([GL_LIB])
  342. AC_SUBST([GLU_LIB])
  343. AC_SUBST([OSMESA_LIB])
  344. AM_CONDITIONAL(HAVE_MANGLED_GL, test "x${enable_mangling}" = "xyes")
  345. dnl
  346. dnl potentially-infringing-but-nobody-knows-for-sure stuff
  347. dnl
  348. AC_ARG_ENABLE([texture-float],
  349. [AS_HELP_STRING([--enable-texture-float],
  350. [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
  351. [enable_texture_float="$enableval"],
  352. [enable_texture_float=no]
  353. )
  354. if test "x$enable_texture_float" = xyes; then
  355. AC_MSG_WARN([Floating-point textures enabled.])
  356. AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
  357. DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
  358. fi
  359. GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
  360. GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
  361. OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
  362. EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
  363. GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
  364. GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
  365. VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
  366. GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
  367. GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  368. GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  369. OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  370. EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  371. EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  372. GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  373. GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  374. VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  375. GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
  376. AC_SUBST([GL_LIB_NAME])
  377. AC_SUBST([GLU_LIB_NAME])
  378. AC_SUBST([OSMESA_LIB_NAME])
  379. AC_SUBST([EGL_LIB_NAME])
  380. AC_SUBST([GLESv1_CM_LIB_NAME])
  381. AC_SUBST([GLESv2_LIB_NAME])
  382. AC_SUBST([VG_LIB_NAME])
  383. AC_SUBST([GLAPI_LIB_NAME])
  384. AC_SUBST([GL_LIB_GLOB])
  385. AC_SUBST([GLU_LIB_GLOB])
  386. AC_SUBST([OSMESA_LIB_GLOB])
  387. AC_SUBST([EGL_LIB_GLOB])
  388. AC_SUBST([GLESv1_CM_LIB_GLOB])
  389. AC_SUBST([GLESv2_LIB_GLOB])
  390. AC_SUBST([VG_LIB_GLOB])
  391. AC_SUBST([GLAPI_LIB_GLOB])
  392. dnl
  393. dnl Arch/platform-specific settings
  394. dnl
  395. AC_ARG_ENABLE([asm],
  396. [AS_HELP_STRING([--disable-asm],
  397. [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
  398. [enable_asm="$enableval"],
  399. [enable_asm=yes]
  400. )
  401. asm_arch=""
  402. MESA_ASM_FILES=""
  403. GLAPI_ASM_SOURCES=""
  404. AC_MSG_CHECKING([whether to enable assembly])
  405. test "x$enable_asm" = xno && AC_MSG_RESULT([no])
  406. # disable if cross compiling on x86/x86_64 since we must run gen_matypes
  407. if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
  408. case "$host_cpu" in
  409. i?86 | x86_64)
  410. enable_asm=no
  411. AC_MSG_RESULT([no, cross compiling])
  412. ;;
  413. esac
  414. fi
  415. # check for supported arches
  416. if test "x$enable_asm" = xyes; then
  417. case "$host_cpu" in
  418. i?86)
  419. case "$host_os" in
  420. linux* | *freebsd* | dragonfly* | *netbsd*)
  421. test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
  422. ;;
  423. esac
  424. ;;
  425. x86_64)
  426. case "$host_os" in
  427. linux* | *freebsd* | dragonfly* | *netbsd*)
  428. test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
  429. ;;
  430. esac
  431. ;;
  432. powerpc)
  433. case "$host_os" in
  434. linux*)
  435. asm_arch=ppc
  436. ;;
  437. esac
  438. ;;
  439. sparc*)
  440. case "$host_os" in
  441. linux*)
  442. asm_arch=sparc
  443. ;;
  444. esac
  445. ;;
  446. esac
  447. case "$asm_arch" in
  448. x86)
  449. DEFINES="$DEFINES -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
  450. MESA_ASM_FILES='$(X86_FILES)'
  451. GLAPI_ASM_SOURCES='$(X86_API)'
  452. AC_MSG_RESULT([yes, x86])
  453. ;;
  454. x86_64)
  455. DEFINES="$DEFINES -DUSE_X86_64_ASM"
  456. MESA_ASM_FILES='$(X86_64_FILES)'
  457. GLAPI_ASM_SOURCES='$(X86-64_API)'
  458. AC_MSG_RESULT([yes, x86_64])
  459. ;;
  460. sparc)
  461. DEFINES="$DEFINES -DUSE_SPARC_ASM"
  462. MESA_ASM_FILES='$(SPARC_FILES)'
  463. GLAPI_ASM_SOURCES='$(SPARC_API)'
  464. AC_MSG_RESULT([yes, sparc])
  465. ;;
  466. *)
  467. AC_MSG_RESULT([no, platform not supported])
  468. ;;
  469. esac
  470. fi
  471. AC_SUBST([MESA_ASM_FILES])
  472. AC_SUBST([GLAPI_ASM_SOURCES])
  473. dnl PIC code macro
  474. MESA_PIC_FLAGS
  475. dnl Check to see if dlopen is in default libraries (like Solaris, which
  476. dnl has it in libc), or if libdl is needed to get it.
  477. AC_CHECK_FUNC([dlopen], [],
  478. [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
  479. AC_SUBST([DLOPEN_LIBS])
  480. dnl See if posix_memalign is available
  481. AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
  482. dnl SELinux awareness.
  483. AC_ARG_ENABLE([selinux],
  484. [AS_HELP_STRING([--enable-selinux],
  485. [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
  486. [MESA_SELINUX="$enableval"],
  487. [MESA_SELINUX=no])
  488. if test "x$enable_selinux" = "xyes"; then
  489. AC_CHECK_HEADER([selinux/selinux.h],[],
  490. [AC_MSG_ERROR([SELinux headers not found])])
  491. AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
  492. [AC_MSG_ERROR([SELinux library not found])])
  493. SELINUX_LIBS="-lselinux"
  494. DEFINES="$DEFINES -DMESA_SELINUX"
  495. fi
  496. dnl Options for APIs
  497. AC_ARG_ENABLE([opengl],
  498. [AS_HELP_STRING([--disable-opengl],
  499. [disable support for standard OpenGL API @<:@default=no@:>@])],
  500. [enable_opengl="$enableval"],
  501. [enable_opengl=yes])
  502. AC_ARG_ENABLE([gles1],
  503. [AS_HELP_STRING([--enable-gles1],
  504. [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
  505. [enable_gles1="$enableval"],
  506. [enable_gles1=no])
  507. AC_ARG_ENABLE([gles2],
  508. [AS_HELP_STRING([--enable-gles2],
  509. [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
  510. [enable_gles2="$enableval"],
  511. [enable_gles2=no])
  512. AC_ARG_ENABLE([openvg],
  513. [AS_HELP_STRING([--enable-openvg],
  514. [enable support for OpenVG API @<:@default=no@:>@])],
  515. [enable_openvg="$enableval"],
  516. [enable_openvg=no])
  517. AC_ARG_ENABLE([dri],
  518. [AS_HELP_STRING([--enable-dri],
  519. [enable DRI modules @<:@default=auto@:>@])],
  520. [enable_dri="$enableval"],
  521. [enable_dri=auto])
  522. AC_ARG_ENABLE([glx],
  523. [AS_HELP_STRING([--enable-glx],
  524. [enable GLX library @<:@default=auto@:>@])],
  525. [enable_glx="$enableval"],
  526. [enable_glx=auto])
  527. AC_ARG_ENABLE([osmesa],
  528. [AS_HELP_STRING([--enable-osmesa],
  529. [enable OSMesa library @<:@default=auto@:>@])],
  530. [enable_osmesa="$enableval"],
  531. [enable_osmesa=auto])
  532. AC_ARG_ENABLE([egl],
  533. [AS_HELP_STRING([--disable-egl],
  534. [disable EGL library @<:@default=enabled@:>@])],
  535. [enable_egl="$enableval"],
  536. [enable_egl=yes])
  537. AC_ARG_ENABLE([xorg],
  538. [AS_HELP_STRING([--enable-xorg],
  539. [enable support for X.Org DDX API @<:@default=no@:>@])],
  540. [enable_xorg="$enableval"],
  541. [enable_xorg=no])
  542. AC_ARG_ENABLE([xa],
  543. [AS_HELP_STRING([--enable-xa],
  544. [enable build of the XA X Acceleration API @<:@default=no@:>@])],
  545. [enable_xa="$enableval"],
  546. [enable_xa=no])
  547. AC_ARG_ENABLE([d3d1x],
  548. [AS_HELP_STRING([--enable-d3d1x],
  549. [enable support for Direct3D 10 & 11 low-level API @<:@default=no@:>@])],
  550. [enable_d3d1x="$enableval"],
  551. [enable_d3d1x=no])
  552. AC_ARG_ENABLE([gbm],
  553. [AS_HELP_STRING([--enable-gbm],
  554. [enable gbm library @<:@default=auto@:>@])],
  555. [enable_gbm="$enableval"],
  556. [enable_gbm=auto])
  557. AC_ARG_ENABLE([xvmc],
  558. [AS_HELP_STRING([--enable-xvmc],
  559. [enable xvmc library @<:@default=auto@:>@])],
  560. [enable_xvmc="$enableval"],
  561. [enable_xvmc=auto])
  562. AC_ARG_ENABLE([vdpau],
  563. [AS_HELP_STRING([--enable-vdpau],
  564. [enable vdpau library @<:@default=auto@:>@])],
  565. [enable_vdpau="$enableval"],
  566. [enable_vdpau=auto])
  567. AC_ARG_ENABLE([va],
  568. [AS_HELP_STRING([--enable-va],
  569. [enable va library @<:@default=auto@:>@])],
  570. [enable_va="$enableval"],
  571. [enable_va=auto])
  572. AC_ARG_ENABLE([opencl],
  573. [AS_HELP_STRING([--enable-opencl],
  574. [enable OpenCL library @<:@default=no@:>@])],
  575. [enable_opencl="$enableval"],
  576. [enable_opencl=no])
  577. AC_ARG_ENABLE([xlib_glx],
  578. [AS_HELP_STRING([--enable-xlib-glx],
  579. [make GLX library Xlib-based instead of DRI-based @<:@default=disable@:>@])],
  580. [enable_xlib_glx="$enableval"],
  581. [enable_xlib_glx=auto])
  582. AC_ARG_ENABLE([gallium_egl],
  583. [AS_HELP_STRING([--enable-gallium-egl],
  584. [enable optional EGL state tracker (not required
  585. for EGL support in Gallium with OpenGL and OpenGL ES)
  586. @<:@default=disable@:>@])],
  587. [enable_gallium_egl="$enableval"],
  588. [enable_gallium_egl=no])
  589. AC_ARG_ENABLE([gallium_gbm],
  590. [AS_HELP_STRING([--enable-gallium-gbm],
  591. [enable optional gbm state tracker (not required for
  592. gbm support in Gallium)
  593. @<:@default=auto@:>@])],
  594. [enable_gallium_gbm="$enableval"],
  595. [enable_gallium_gbm=auto])
  596. AC_ARG_ENABLE([r600-llvm-compiler],
  597. [AS_HELP_STRING([--enable-r600-llvm-compiler],
  598. [Enable experimental LLVM backend for graphics shaders @<:@default=disable@:>@])],
  599. [enable_r600_llvm="$enableval"],
  600. [enable_r600_llvm=no])
  601. AC_ARG_ENABLE([gallium_tests],
  602. [AS_HELP_STRING([--enable-gallium-tests],
  603. [Enable optional Gallium tests) @<:@default=disable@:>@])],
  604. [enable_gallium_tests="$enableval"],
  605. [enable_gallium_tests=no])
  606. # Option for Gallium drivers
  607. GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
  608. AC_ARG_WITH([gallium-drivers],
  609. [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
  610. [comma delimited Gallium drivers list, e.g.
  611. "i915,nouveau,r300,r600,svga,swrast"
  612. @<:@default=r300,r600,swrast@:>@])],
  613. [with_gallium_drivers="$withval"],
  614. [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
  615. # Doing '--without-gallium-drivers' will set this variable to 'no'. Clear it
  616. # here so that the script doesn't choke on an unknown driver name later.
  617. case "$with_gallium_drivers" in
  618. yes) with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT" ;;
  619. no) with_gallium_drivers='' ;;
  620. esac
  621. if test "x$enable_opengl" = xno -a \
  622. "x$enable_gles1" = xno -a \
  623. "x$enable_gles2" = xno -a \
  624. "x$enable_openvg" = xno -a \
  625. "x$enable_xorg" = xno -a \
  626. "x$enable_xa" = xno -a \
  627. "x$enable_d3d1x" = xno -a \
  628. "x$enable_xvmc" = xno -a \
  629. "x$enable_vdpau" = xno -a \
  630. "x$enable_va" = xno -a \
  631. "x$enable_opencl" = xno; then
  632. AC_MSG_ERROR([at least one API should be enabled])
  633. fi
  634. API_DEFINES=""
  635. if test "x$enable_opengl" = xno; then
  636. API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
  637. else
  638. API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
  639. fi
  640. if test "x$enable_gles1" = xyes; then
  641. API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
  642. fi
  643. if test "x$enable_gles2" = xyes; then
  644. API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
  645. fi
  646. AC_SUBST([API_DEFINES])
  647. AC_ARG_ENABLE([shared-glapi],
  648. [AS_HELP_STRING([--enable-shared-glapi],
  649. [EXPERIMENTAL. Enable shared glapi for OpenGL @<:@default=no@:>@])],
  650. [enable_shared_glapi="$enableval"],
  651. [enable_shared_glapi=no])
  652. SHARED_GLAPI="0"
  653. if test "x$enable_shared_glapi" = xyes; then
  654. SHARED_GLAPI="1"
  655. # libGL will use libglapi for function lookups (IN_DRI_DRIVER means to use
  656. # the remap table)
  657. DEFINES="$DEFINES -DIN_DRI_DRIVER"
  658. SRC_DIRS="$SRC_DIRS mapi/shared-glapi"
  659. fi
  660. AC_SUBST([SHARED_GLAPI])
  661. AM_CONDITIONAL(HAVE_SHARED_GLAPI, test $SHARED_GLAPI = 1)
  662. dnl
  663. dnl Driver configuration. Options are xlib, dri and osmesa right now.
  664. dnl More later: fbdev, ...
  665. dnl
  666. default_driver="xlib"
  667. case "$host_os" in
  668. linux*)
  669. case "$host_cpu" in
  670. i*86|x86_64|powerpc*|sparc*|ia64*) default_driver="dri";;
  671. esac
  672. ;;
  673. *freebsd* | dragonfly* | *netbsd*)
  674. case "$host_cpu" in
  675. i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
  676. esac
  677. ;;
  678. esac
  679. if test "x$enable_opengl" = xno; then
  680. default_driver="no"
  681. fi
  682. AC_ARG_WITH([driver],
  683. [AS_HELP_STRING([--with-driver=DRIVER], [DEPRECATED])],
  684. [mesa_driver="$withval"],
  685. [mesa_driver=auto])
  686. dnl Check for valid option
  687. case "x$mesa_driver" in
  688. xxlib|xdri|xosmesa|xno)
  689. if test "x$enable_dri" != xauto -o \
  690. "x$enable_glx" != xauto -o \
  691. "x$enable_osmesa" != xauto -o \
  692. "x$enable_xlib_glx" != xauto; then
  693. AC_MSG_ERROR([--with-driver=$mesa_driver is deprecated])
  694. fi
  695. ;;
  696. xauto)
  697. mesa_driver="$default_driver"
  698. ;;
  699. *)
  700. AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
  701. ;;
  702. esac
  703. # map $mesa_driver to APIs
  704. if test "x$enable_dri" = xauto; then
  705. case "x$mesa_driver" in
  706. xdri) enable_dri=yes ;;
  707. *) enable_dri=no ;;
  708. esac
  709. fi
  710. if test "x$enable_glx" = xauto; then
  711. case "x$mesa_driver" in
  712. xdri|xxlib) enable_glx=yes ;;
  713. *) enable_glx=no ;;
  714. esac
  715. fi
  716. if test "x$enable_osmesa" = xauto; then
  717. case "x$mesa_driver" in
  718. xxlib|xosmesa) enable_osmesa=yes ;;
  719. *) enable_osmesa=no ;;
  720. esac
  721. fi
  722. if test "x$enable_xlib_glx" = xauto; then
  723. case "x$mesa_driver" in
  724. xxlib) enable_xlib_glx=yes ;;
  725. *) enable_xlib_glx=no ;;
  726. esac
  727. fi
  728. if test "x$enable_glx" = xno; then
  729. enable_xlib_glx=no
  730. fi
  731. AM_CONDITIONAL(HAVE_DRI, test x"$enable_dri" = xyes)
  732. dnl
  733. dnl Driver specific build directories
  734. dnl
  735. dnl this variable will be prepended to SRC_DIRS and is not exported
  736. CORE_DIRS=""
  737. SRC_DIRS="gtest"
  738. GLU_DIRS="sgi"
  739. GALLIUM_DIRS="auxiliary drivers state_trackers"
  740. GALLIUM_TARGET_DIRS=""
  741. GALLIUM_WINSYS_DIRS="sw"
  742. GALLIUM_DRIVERS_DIRS="galahad trace rbug noop identity"
  743. GALLIUM_STATE_TRACKERS_DIRS=""
  744. # build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled
  745. case "x$enable_shared_glapi$enable_gles1$enable_gles2" in
  746. x*yes*)
  747. CORE_DIRS="$CORE_DIRS mapi/shared-glapi"
  748. ;;
  749. esac
  750. # build glapi if OpenGL is enabled
  751. if test "x$enable_opengl" = xyes; then
  752. CORE_DIRS="$CORE_DIRS mapi/glapi"
  753. fi
  754. # build es1api if OpenGL ES 1.x is enabled
  755. if test "x$enable_gles1" = xyes; then
  756. CORE_DIRS="$CORE_DIRS mapi/es1api"
  757. fi
  758. # build es2api if OpenGL ES 2.x is enabled
  759. if test "x$enable_gles2" = xyes; then
  760. CORE_DIRS="$CORE_DIRS mapi/es2api"
  761. fi
  762. # build glsl and mesa if OpenGL or OpenGL ES is enabled
  763. case "x$enable_opengl$enable_gles1$enable_gles2" in
  764. x*yes*)
  765. CORE_DIRS="mapi/glapi/gen $CORE_DIRS glsl mesa"
  766. ;;
  767. esac
  768. case "x$enable_glx$enable_xlib_glx" in
  769. xyesyes)
  770. DRIVER_DIRS="$DRIVER_DIRS x11"
  771. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
  772. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
  773. GALLIUM_STATE_TRACKERS_DIRS="glx $GALLIUM_STATE_TRACKERS_DIRS"
  774. HAVE_WINSYS_XLIB="yes"
  775. ;;
  776. xyesno)
  777. # DRI-based GLX
  778. SRC_DIRS="$SRC_DIRS glx"
  779. ;;
  780. esac
  781. if test "x$enable_dri" = xyes; then
  782. DRIVER_DIRS="$DRIVER_DIRS dri"
  783. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/dri"
  784. GALLIUM_STATE_TRACKERS_DIRS="dri $GALLIUM_STATE_TRACKERS_DIRS"
  785. HAVE_ST_DRI="yes"
  786. fi
  787. if test "x$enable_osmesa" = xyes; then
  788. DRIVER_DIRS="$DRIVER_DIRS osmesa"
  789. fi
  790. AC_SUBST([SRC_DIRS])
  791. AC_SUBST([GLU_DIRS])
  792. AC_SUBST([DRIVER_DIRS])
  793. AC_SUBST([GALLIUM_DIRS])
  794. AC_SUBST([GALLIUM_TARGET_DIRS])
  795. AC_SUBST([GALLIUM_WINSYS_DIRS])
  796. AC_SUBST([GALLIUM_DRIVERS_DIRS])
  797. AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
  798. AC_SUBST([MESA_LLVM])
  799. # Check for libdrm
  800. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
  801. [have_libdrm=yes], [have_libdrm=no])
  802. if test "x$enable_dri" = xyes; then
  803. # DRI must be shared, I think
  804. if test "$enable_static" = yes; then
  805. AC_MSG_ERROR([Can't use static libraries for DRI drivers])
  806. fi
  807. # not a hard requirement as swrast does not depend on it
  808. if test "x$have_libdrm" = xyes; then
  809. DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
  810. fi
  811. fi
  812. dnl
  813. dnl Find out if X is available. The variable have_x is set if libX11 is
  814. dnl found to mimic AC_PATH_XTRA.
  815. dnl
  816. if test -n "$PKG_CONFIG"; then
  817. AC_MSG_CHECKING([pkg-config files for X11 are available])
  818. PKG_CHECK_EXISTS([x11],[
  819. x11_pkgconfig=yes
  820. have_x=yes
  821. ],[
  822. x11_pkgconfig=no
  823. ])
  824. AC_MSG_RESULT([$x11_pkgconfig])
  825. else
  826. x11_pkgconfig=no
  827. fi
  828. dnl Use the autoconf macro if no pkg-config files
  829. if test "$x11_pkgconfig" = yes; then
  830. PKG_CHECK_MODULES([X11], [x11])
  831. else
  832. AC_PATH_XTRA
  833. test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
  834. test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
  835. AC_SUBST([X11_CFLAGS])
  836. AC_SUBST([X11_LIBS])
  837. fi
  838. dnl Try to tell the user that the --x-* options are only used when
  839. dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
  840. m4_divert_once([HELP_BEGIN],
  841. [These options are only used when the X libraries cannot be found by the
  842. pkg-config utility.])
  843. dnl We need X for xlib and dri, so bomb now if it's not found
  844. if test "x$enable_glx" = xyes -a "x$no_x" = xyes; then
  845. AC_MSG_ERROR([X11 development libraries needed for GLX])
  846. fi
  847. if test "x$enable_glx" = xyes; then
  848. DEFINES="$DEFINES -DUSE_XCB"
  849. fi
  850. dnl Direct rendering or just indirect rendering
  851. case "$host_os" in
  852. gnu*)
  853. dnl Disable by default on GNU/Hurd
  854. driglx_direct_default="no"
  855. ;;
  856. cygwin*)
  857. dnl Disable by default on cygwin
  858. driglx_direct_default="no"
  859. ;;
  860. *)
  861. driglx_direct_default="yes"
  862. ;;
  863. esac
  864. AC_ARG_ENABLE([driglx-direct],
  865. [AS_HELP_STRING([--disable-driglx-direct],
  866. [enable direct rendering in GLX and EGL for DRI \
  867. @<:@default=auto@:>@])],
  868. [driglx_direct="$enableval"],
  869. [driglx_direct="$driglx_direct_default"])
  870. dnl
  871. dnl libGL configuration per driver
  872. dnl
  873. case "x$enable_glx$enable_xlib_glx" in
  874. xyesyes)
  875. # Xlib-based GLX
  876. if test "$x11_pkgconfig" = yes; then
  877. PKG_CHECK_MODULES([XLIBGL], [x11 xext])
  878. GL_PC_REQ_PRIV="x11 xext"
  879. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  880. GL_LIB_DEPS="$XLIBGL_LIBS"
  881. else
  882. # should check these...
  883. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  884. GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
  885. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  886. GL_PC_CFLAGS="$X11_INCLUDES"
  887. fi
  888. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $DLOPEN_LIBS"
  889. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
  890. ;;
  891. xyesno)
  892. # DRI-based GLX
  893. PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
  894. GL_PC_REQ_PRIV="glproto >= $GLPROTO_REQUIRED"
  895. if test x"$driglx_direct" = xyes; then
  896. if test "x$have_libdrm" != xyes; then
  897. AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
  898. fi
  899. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  900. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
  901. fi
  902. # find the DRI deps for libGL
  903. if test "$x11_pkgconfig" = yes; then
  904. dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx"
  905. # add xf86vidmode if available
  906. PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
  907. if test "$HAVE_XF86VIDMODE" = yes ; then
  908. dri_modules="$dri_modules xxf86vm"
  909. fi
  910. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  911. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  912. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  913. GL_LIB_DEPS="$DRIGL_LIBS"
  914. else
  915. # should check these...
  916. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  917. if test "x$HAVE_XF86VIDMODE" == xyes; then
  918. GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
  919. else
  920. GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXdamage -lXfixes"
  921. fi
  922. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  923. GL_PC_CFLAGS="$X11_INCLUDES"
  924. # XCB can only be used from pkg-config
  925. PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx >= 1.8.1])
  926. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
  927. X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
  928. GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
  929. fi
  930. # need DRM libs, -lpthread, etc.
  931. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  932. GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  933. ;;
  934. esac
  935. # This is outside the case (above) so that it is invoked even for non-GLX
  936. # builds.
  937. AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
  938. GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  939. GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  940. GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  941. GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  942. AC_SUBST([GL_LIB_DEPS])
  943. AC_SUBST([GL_PC_REQ_PRIV])
  944. AC_SUBST([GL_PC_LIB_PRIV])
  945. AC_SUBST([GL_PC_CFLAGS])
  946. AC_SUBST([DRI_PC_REQ_PRIV])
  947. AC_SUBST([GLESv1_CM_LIB_DEPS])
  948. AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
  949. AC_SUBST([GLESv2_LIB_DEPS])
  950. AC_SUBST([GLESv2_PC_LIB_PRIV])
  951. GLAPI_LIB_DEPS="-lpthread $SELINUX_LIBS"
  952. AC_SUBST([GLAPI_LIB_DEPS])
  953. dnl Setup default DRI CFLAGS
  954. DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.a'
  955. if test "x$enable_dri" = xyes && test "x$driglx_direct" = xyes ; then
  956. DRI_LIB_DEPS="-L\$(TOP)/\$(LIB_DIR) -ldricore$VERSION"
  957. HAVE_DRICORE=yes
  958. fi
  959. AM_CONDITIONAL(HAVE_DRICORE, test x$HAVE_DRICORE = xyes)
  960. AC_SUBST([HAVE_XF86VIDMODE])
  961. dnl
  962. dnl More GLX setup
  963. dnl
  964. case "x$enable_glx$enable_xlib_glx" in
  965. xyesyes)
  966. DEFINES="$DEFINES -DUSE_XSHM"
  967. ;;
  968. xyesno)
  969. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  970. if test "x$driglx_direct" = xyes; then
  971. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  972. fi
  973. ;;
  974. esac
  975. dnl
  976. dnl TLS detection
  977. dnl
  978. AC_ARG_ENABLE([glx-tls],
  979. [AS_HELP_STRING([--enable-glx-tls],
  980. [enable TLS support in GLX @<:@default=disabled@:>@])],
  981. [GLX_USE_TLS="$enableval"],
  982. [GLX_USE_TLS=no])
  983. AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
  984. AS_IF([test "x$GLX_USE_TLS" = xyes],
  985. [DEFINES="${DEFINES} -DGLX_USE_TLS -DPTHREADS"])
  986. dnl
  987. dnl More DRI setup
  988. dnl
  989. dnl Directory for DRI drivers
  990. AC_ARG_WITH([dri-driverdir],
  991. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  992. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  993. [DRI_DRIVER_INSTALL_DIR="$withval"],
  994. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  995. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  996. dnl Extra search path for DRI drivers
  997. AC_ARG_WITH([dri-searchpath],
  998. [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
  999. [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
  1000. [DRI_DRIVER_SEARCH_DIR="$withval"],
  1001. [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
  1002. AC_SUBST([DRI_DRIVER_SEARCH_DIR])
  1003. dnl Which drivers to build - default is chosen by platform
  1004. AC_ARG_WITH([dri-drivers],
  1005. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  1006. [comma delimited DRI drivers list, e.g.
  1007. "swrast,i965,radeon" @<:@default=auto@:>@])],
  1008. [with_dri_drivers="$withval"],
  1009. [with_dri_drivers=yes])
  1010. if test "x$with_dri_drivers" = x; then
  1011. with_dri_drivers=no
  1012. fi
  1013. dnl If $with_dri_drivers is yes, directories will be added through
  1014. dnl platform checks
  1015. DRI_DIRS=""
  1016. case "$with_dri_drivers" in
  1017. no) ;;
  1018. yes)
  1019. # classic DRI drivers require FEATURE_GL to build
  1020. if test "x$enable_opengl" = xyes; then
  1021. DRI_DIRS="yes"
  1022. fi
  1023. ;;
  1024. *)
  1025. # verify the requested driver directories exist
  1026. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  1027. for driver in $dri_drivers; do
  1028. test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
  1029. AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
  1030. done
  1031. DRI_DIRS="$dri_drivers"
  1032. if test -n "$DRI_DIRS" -a "x$enable_opengl" != xyes; then
  1033. AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
  1034. fi
  1035. ;;
  1036. esac
  1037. dnl Set DRI_DIRS, DEFINES and LIB_DEPS
  1038. if test "x$enable_dri" = xyes; then
  1039. # Platform specific settings and drivers to build
  1040. case "$host_os" in
  1041. linux*)
  1042. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  1043. DEFINES="$DEFINES -DHAVE_ALIAS"
  1044. case "$host_cpu" in
  1045. x86_64)
  1046. if test "x$DRI_DIRS" = "xyes"; then
  1047. DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
  1048. fi
  1049. ;;
  1050. powerpc*)
  1051. # Build only the drivers for cards that exist on PowerPC.
  1052. if test "x$DRI_DIRS" = "xyes"; then
  1053. DRI_DIRS="r200 radeon swrast"
  1054. fi
  1055. ;;
  1056. sparc*)
  1057. # Build only the drivers for cards that exist on sparc
  1058. if test "x$DRI_DIRS" = "xyes"; then
  1059. DRI_DIRS="r200 radeon swrast"
  1060. fi
  1061. ;;
  1062. esac
  1063. ;;
  1064. freebsd* | dragonfly* | *netbsd*)
  1065. DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
  1066. DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
  1067. if test "x$DRI_DIRS" = "xyes"; then
  1068. DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
  1069. fi
  1070. ;;
  1071. gnu*)
  1072. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  1073. DEFINES="$DEFINES -DHAVE_ALIAS"
  1074. ;;
  1075. solaris*)
  1076. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  1077. ;;
  1078. cygwin*)
  1079. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  1080. if test "x$DRI_DIRS" = "xyes"; then
  1081. DRI_DIRS="swrast"
  1082. fi
  1083. ;;
  1084. esac
  1085. # default drivers
  1086. if test "x$DRI_DIRS" = "xyes"; then
  1087. DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
  1088. fi
  1089. DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
  1090. # Check for expat
  1091. if test "x$enable_dri" = xyes; then
  1092. EXPAT_INCLUDES=""
  1093. EXPAT_LIB=-lexpat
  1094. AC_ARG_WITH([expat],
  1095. [AS_HELP_STRING([--with-expat=DIR],
  1096. [expat install directory])],[
  1097. EXPAT_INCLUDES="-I$withval/include"
  1098. CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
  1099. LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
  1100. EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
  1101. ])
  1102. AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
  1103. save_LIBS="$LIBS"
  1104. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  1105. [AC_MSG_ERROR([Expat required for DRI.])])
  1106. LIBS="$save_LIBS"
  1107. fi
  1108. # if we are building any dri driver other than swrast ...
  1109. if test -n "$DRI_DIRS" -a x"$DRI_DIRS" != xswrast; then
  1110. # ... libdrm is required
  1111. if test "x$have_libdrm" != xyes; then
  1112. AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED])
  1113. fi
  1114. # ... and build dricommon
  1115. HAVE_COMMON_DRI=yes
  1116. fi
  1117. # put all the necessary libs together
  1118. DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
  1119. fi
  1120. AC_SUBST([DRI_DIRS])
  1121. AC_SUBST([EXPAT_INCLUDES])
  1122. AC_SUBST([DRI_LIB_DEPS])
  1123. case $DRI_DIRS in
  1124. *i915*|*i965*)
  1125. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1126. for d in $(echo $DRI_DIRS | sed 's/,/ /g'); do
  1127. case $d in
  1128. i915)
  1129. HAVE_I915_DRI=yes;
  1130. ;;
  1131. i965)
  1132. HAVE_I965_DRI=yes;
  1133. ;;
  1134. esac
  1135. done
  1136. ;;
  1137. esac
  1138. case $DRI_DIRS in
  1139. *nouveau*)
  1140. PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NVVIEUX_REQUIRED])
  1141. HAVE_NOUVEAU_DRI=yes;
  1142. ;;
  1143. esac
  1144. case $DRI_DIRS in
  1145. *radeon*|*r200*)
  1146. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1147. for d in $(echo $DRI_DIRS | sed 's/,/ /g'); do
  1148. case $d in
  1149. radeon)
  1150. HAVE_RADEON_DRI=yes;
  1151. ;;
  1152. r200)
  1153. HAVE_R200_DRI=yes;
  1154. ;;
  1155. esac
  1156. done
  1157. ;;
  1158. esac
  1159. case $DRI_DIRS in
  1160. *swrast*)
  1161. HAVE_SWRAST_DRI=yes;
  1162. ;;
  1163. esac
  1164. AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
  1165. AM_CONDITIONAL(HAVE_I965_DRI, test x$HAVE_I965_DRI = xyes)
  1166. AM_CONDITIONAL(HAVE_NOUVEAU_DRI, test x$HAVE_NOUVEAU_DRI = xyes)
  1167. AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
  1168. AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
  1169. AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
  1170. AM_CONDITIONAL(HAVE_COMMON_DRI, test x$HAVE_COMMON_DRI = xyes)
  1171. dnl
  1172. dnl OSMesa configuration
  1173. dnl
  1174. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  1175. AC_ARG_WITH([osmesa-bits],
  1176. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  1177. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  1178. [osmesa_bits="$withval"],
  1179. [osmesa_bits=8])
  1180. if test "x$osmesa_bits" != x8; then
  1181. if test "x$enable_dri" = xyes -o "x$enable_glx" = xyes; then
  1182. AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa driver])
  1183. osmesa_bits=8
  1184. fi
  1185. fi
  1186. case "x$osmesa_bits" in
  1187. x8)
  1188. OSMESA_LIB="${OSMESA_LIB}"
  1189. ;;
  1190. x16|x32)
  1191. OSMESA_LIB="${OSMESA_LIB}$osmesa_bits"
  1192. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  1193. ;;
  1194. *)
  1195. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  1196. ;;
  1197. esac
  1198. if test "x$enable_osmesa" = xyes; then
  1199. # only link libraries with osmesa if shared
  1200. if test "$enable_static" = no; then
  1201. OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  1202. else
  1203. OSMESA_LIB_DEPS=""
  1204. fi
  1205. OSMESA_MESA_DEPS=""
  1206. OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  1207. fi
  1208. OSMESA_VERSION=`echo "$VERSION" | $SED 's/\./:/g'`
  1209. AC_SUBST([OSMESA_LIB_DEPS])
  1210. AC_SUBST([OSMESA_MESA_DEPS])
  1211. AC_SUBST([OSMESA_PC_REQ])
  1212. AC_SUBST([OSMESA_PC_LIB_PRIV])
  1213. AC_SUBST([OSMESA_VERSION])
  1214. dnl
  1215. dnl gbm configuration
  1216. dnl
  1217. if test "x$enable_gbm" = xauto; then
  1218. case "$with_egl_platforms" in
  1219. *drm*)
  1220. enable_gbm=yes ;;
  1221. *)
  1222. enable_gbm=no ;;
  1223. esac
  1224. fi
  1225. if test "x$enable_gbm" = xyes; then
  1226. SRC_DIRS="$SRC_DIRS gbm"
  1227. PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
  1228. AC_MSG_ERROR([gbm needs udev]))
  1229. if test "x$enable_dri" = xyes; then
  1230. GBM_BACKEND_DIRS="$GBM_BACKEND_DIRS dri"
  1231. if test "$SHARED_GLAPI" -eq 0; then
  1232. AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
  1233. fi
  1234. fi
  1235. fi
  1236. GBM_PC_REQ_PRIV="libudev"
  1237. GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
  1238. AC_SUBST([GBM_PC_REQ_PRIV])
  1239. AC_SUBST([GBM_PC_LIB_PRIV])
  1240. dnl
  1241. dnl EGL configuration
  1242. dnl
  1243. EGL_CLIENT_APIS=""
  1244. if test "x$enable_egl" = xyes; then
  1245. SRC_DIRS="$SRC_DIRS egl"
  1246. EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS -lpthread"
  1247. AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
  1248. if test "$enable_static" != yes; then
  1249. # build egl_glx when libGL is built
  1250. if test "x$enable_glx" = xyes; then
  1251. HAVE_EGL_DRIVER_GLX=1
  1252. fi
  1253. PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
  1254. [have_libudev=yes],[have_libudev=no])
  1255. if test "$have_libudev" = yes; then
  1256. DEFINES="$DEFINES -DHAVE_LIBUDEV"
  1257. fi
  1258. if test "x$enable_dri" = xyes; then
  1259. HAVE_EGL_DRIVER_DRI2=1
  1260. fi
  1261. fi
  1262. fi
  1263. AC_SUBST([EGL_LIB_DEPS])
  1264. dnl
  1265. dnl EGL Gallium configuration
  1266. dnl
  1267. if test "x$enable_gallium_egl" = xyes; then
  1268. if test "x$with_gallium_drivers" = x; then
  1269. AC_MSG_ERROR([cannot enable egl_gallium without Gallium])
  1270. fi
  1271. if test "x$enable_egl" = xno; then
  1272. AC_MSG_ERROR([cannot enable egl_gallium without EGL])
  1273. fi
  1274. if test "x$have_libdrm" != xyes; then
  1275. AC_MSG_ERROR([egl_gallium requires libdrm >= $LIBDRM_REQUIRED])
  1276. fi
  1277. GALLIUM_STATE_TRACKERS_DIRS="egl $GALLIUM_STATE_TRACKERS_DIRS"
  1278. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-static"
  1279. HAVE_ST_EGL="yes"
  1280. fi
  1281. dnl
  1282. dnl gbm Gallium configuration
  1283. dnl
  1284. if test "x$enable_gallium_gbm" = xauto; then
  1285. case "$enable_gbm$HAVE_ST_EGL$enable_dri$with_egl_platforms" in
  1286. yesyesyes*drm*)
  1287. enable_gallium_gbm=yes ;;
  1288. *)
  1289. enable_gallium_gbm=no ;;
  1290. esac
  1291. fi
  1292. if test "x$enable_gallium_gbm" = xyes; then
  1293. if test "x$with_gallium_drivers" = x; then
  1294. AC_MSG_ERROR([cannot enable gbm_gallium without Gallium])
  1295. fi
  1296. if test "x$enable_gbm" = xno; then
  1297. AC_MSG_ERROR([cannot enable gbm_gallium without gbm])
  1298. fi
  1299. # gbm_gallium abuses DRI_LIB_DEPS to link. Make sure it is set.
  1300. if test "x$enable_dri" = xno; then
  1301. AC_MSG_ERROR([gbm_gallium requires --enable-dri to build])
  1302. fi
  1303. GALLIUM_STATE_TRACKERS_DIRS="gbm $GALLIUM_STATE_TRACKERS_DIRS"
  1304. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS gbm"
  1305. HAVE_ST_GBM="yes"
  1306. enable_gallium_loader=yes
  1307. fi
  1308. dnl
  1309. dnl X.Org DDX configuration
  1310. dnl
  1311. if test "x$enable_xorg" = xyes; then
  1312. PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
  1313. PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
  1314. PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
  1315. PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
  1316. HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
  1317. HAVE_XEXTPROTO_71="no")
  1318. GALLIUM_STATE_TRACKERS_DIRS="xorg $GALLIUM_STATE_TRACKERS_DIRS"
  1319. HAVE_ST_XORG=yes
  1320. fi
  1321. dnl
  1322. dnl XA configuration
  1323. dnl
  1324. if test "x$enable_xa" = xyes; then
  1325. AC_PROG_AWK
  1326. AC_PROG_GREP
  1327. AC_CHECK_PROG(NM, nm, "nm")
  1328. if test "x$AWK" = x || test "x$GREP" = x || test "x$NM" = x; then
  1329. AC_MSG_WARN([Missing one of nm, grep or awk. Disabling xa.])
  1330. enable_xa=no
  1331. fi
  1332. fi
  1333. if test "x$enable_xa" = xyes; then
  1334. GALLIUM_STATE_TRACKERS_DIRS="xa $GALLIUM_STATE_TRACKERS_DIRS"
  1335. HAVE_ST_XA=yes
  1336. AC_SUBST(AWK)
  1337. AC_SUBST(GREP)
  1338. AC_SUBST(NM)
  1339. fi
  1340. dnl
  1341. dnl OpenVG configuration
  1342. dnl
  1343. VG_LIB_DEPS=""
  1344. if test "x$enable_openvg" = xyes; then
  1345. if test "x$enable_egl" = xno; then
  1346. AC_MSG_ERROR([cannot enable OpenVG without EGL])
  1347. fi
  1348. if test "x$with_gallium_drivers" = x; then
  1349. AC_MSG_ERROR([cannot enable OpenVG without Gallium])
  1350. fi
  1351. if test "x$enable_gallium_egl" = xno; then
  1352. AC_MSG_ERROR([cannot enable OpenVG without egl_gallium])
  1353. fi
  1354. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
  1355. VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS -lpthread"
  1356. CORE_DIRS="$CORE_DIRS mapi/vgapi"
  1357. GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS"
  1358. HAVE_ST_VEGA=yes
  1359. fi
  1360. dnl
  1361. dnl D3D1X configuration
  1362. dnl
  1363. if test "x$enable_d3d1x" = xyes; then
  1364. if test "x$with_gallium_drivers" = x; then
  1365. AC_MSG_ERROR([cannot enable D3D1X without Gallium])
  1366. fi
  1367. GALLIUM_STATE_TRACKERS_DIRS="d3d1x $GALLIUM_STATE_TRACKERS_DIRS"
  1368. HAVE_ST_D3D1X=yes
  1369. fi
  1370. dnl
  1371. dnl Gallium G3DVL configuration
  1372. dnl
  1373. AC_ARG_ENABLE([gallium-g3dvl],
  1374. [AS_HELP_STRING([--enable-gallium-g3dvl],
  1375. [build gallium g3dvl @<:@default=disabled@:>@])],
  1376. [enable_gallium_g3dvl="$enableval"],
  1377. [enable_gallium_g3dvl=no])
  1378. if test "x$enable_gallium_g3dvl" = xyes; then
  1379. if test "x$with_gallium_drivers" = x; then
  1380. AC_MSG_ERROR([cannot enable G3DVL without Gallium])
  1381. fi
  1382. if test "x$enable_xvmc" = xauto; then
  1383. PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no])
  1384. fi
  1385. if test "x$enable_vdpau" = xauto; then
  1386. PKG_CHECK_EXISTS([vdpau], [enable_vdpau=yes], [enable_vdpau=no])
  1387. fi
  1388. if test "x$enable_va" = xauto; then
  1389. #don't enable vaapi state tracker even if package exists
  1390. #PKG_CHECK_EXISTS([libva], [enable_vdpau=yes], [enable_vdpau=no])
  1391. enable_va=no
  1392. fi
  1393. fi
  1394. if test "x$enable_xvmc" = xyes; then
  1395. PKG_CHECK_MODULES([XVMC], [xvmc >= 1.0.6 x11-xcb xcb-dri2 >= 1.8])
  1396. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xvmc"
  1397. HAVE_ST_XVMC="yes"
  1398. fi
  1399. if test "x$enable_vdpau" = xyes; then
  1400. PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.4.1 x11-xcb xcb-dri2 >= 1.8])
  1401. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vdpau"
  1402. HAVE_ST_VDPAU="yes"
  1403. fi
  1404. if test "x$enable_va" = xyes; then
  1405. PKG_CHECK_MODULES([LIBVA], [libva = 0.31.1 x11-xcb xcb-dri2 >= 1.8])
  1406. AC_MSG_WARN([vaapi state tracker currently unmaintained])
  1407. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS va"
  1408. HAVE_ST_VA="yes"
  1409. fi
  1410. dnl
  1411. dnl OpenCL configuration
  1412. dnl
  1413. AC_ARG_WITH([libclc-path],
  1414. [AS_HELP_STRING([--with-libclc-path],
  1415. [Path to libclc builtins library. Example: --with-libclc-path=\$HOME/libclc/])],
  1416. [LIBCLC_PATH="$withval"],
  1417. [LIBCLC_PATH=""])
  1418. AC_ARG_WITH([clang-libdir],
  1419. [AS_HELP_STRING([--with-clang-libdir],
  1420. [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
  1421. [CLANG_LIBDIR="$withval"],
  1422. [CLANG_LIBDIR=""])
  1423. AC_SUBST([LIBCLC_PATH])
  1424. if test "x$enable_opencl" = xyes; then
  1425. if test "x$with_gallium_drivers" = x; then
  1426. AC_MSG_ERROR([cannot enable OpenCL without Gallium])
  1427. fi
  1428. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 6; then
  1429. AC_MSG_ERROR([gcc >= 4.6 is required to build clover])
  1430. fi
  1431. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS clover"
  1432. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS opencl"
  1433. enable_gallium_loader=yes
  1434. fi
  1435. dnl
  1436. dnl GLU configuration
  1437. dnl
  1438. AC_ARG_ENABLE([glu],
  1439. [AS_HELP_STRING([--disable-glu],
  1440. [enable OpenGL Utility library @<:@default=enabled@:>@])],
  1441. [enable_glu="$enableval"],
  1442. [enable_glu=yes])
  1443. if test "x$enable_glu" = xyes; then
  1444. if test "x$enable_glx" = xno -a "x$enable_osmesa" = xno; then
  1445. AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver])
  1446. enable_glu=no
  1447. fi
  1448. fi
  1449. if test "x$enable_glu" = xyes; then
  1450. SRC_DIRS="$SRC_DIRS glu"
  1451. if test "x$enable_glx" = xno; then
  1452. # Link libGLU to libOSMesa instead of libGL
  1453. GLU_LIB_DEPS=""
  1454. GLU_PC_REQ="osmesa"
  1455. if test "$enable_static" = no; then
  1456. GLU_MESA_DEPS='-l$(OSMESA_LIB)'
  1457. else
  1458. GLU_MESA_DEPS=""
  1459. fi
  1460. else
  1461. # If static, empty GLU_LIB_DEPS and add libs for programs to link
  1462. GLU_PC_REQ="gl"
  1463. GLU_PC_LIB_PRIV="-lm"
  1464. if test "$enable_static" = no; then
  1465. GLU_LIB_DEPS="-lm"
  1466. GLU_MESA_DEPS='-l$(GL_LIB)'
  1467. else
  1468. GLU_LIB_DEPS=""
  1469. GLU_MESA_DEPS=""
  1470. fi
  1471. fi
  1472. fi
  1473. if test "$enable_static" = no; then
  1474. GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
  1475. fi
  1476. GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
  1477. AC_SUBST([GLU_LIB_DEPS])
  1478. AC_SUBST([GLU_MESA_DEPS])
  1479. AC_SUBST([GLU_PC_REQ])
  1480. AC_SUBST([GLU_PC_REQ_PRIV])
  1481. AC_SUBST([GLU_PC_LIB_PRIV])
  1482. AC_SUBST([GLU_PC_CFLAGS])
  1483. AC_SUBST([PROGRAM_DIRS])
  1484. dnl
  1485. dnl Gallium configuration
  1486. dnl
  1487. if test "x$with_gallium_drivers" != x; then
  1488. SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
  1489. fi
  1490. AC_SUBST([LLVM_BINDIR])
  1491. AC_SUBST([LLVM_CFLAGS])
  1492. AC_SUBST([LLVM_CPPFLAGS])
  1493. AC_SUBST([LLVM_CXXFLAGS])
  1494. AC_SUBST([LLVM_LIBDIR])
  1495. AC_SUBST([LLVM_LIBS])
  1496. AC_SUBST([LLVM_LDFLAGS])
  1497. AC_SUBST([LLVM_INCLUDEDIR])
  1498. AC_SUBST([LLVM_VERSION])
  1499. AC_SUBST([CLANG_RESOURCE_DIR])
  1500. case "x$enable_opengl$enable_gles1$enable_gles2" in
  1501. x*yes*)
  1502. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
  1503. ;;
  1504. esac
  1505. AC_SUBST([VG_LIB_DEPS])
  1506. AC_SUBST([EGL_CLIENT_APIS])
  1507. dnl
  1508. dnl EGL Platforms configuration
  1509. dnl
  1510. AC_ARG_WITH([egl-platforms],
  1511. [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
  1512. [comma delimited native platforms libEGL supports, e.g.
  1513. "x11,drm" @<:@default=auto@:>@])],
  1514. [with_egl_platforms="$withval"],
  1515. [if test "x$enable_egl" = xyes; then
  1516. with_egl_platforms="x11"
  1517. else
  1518. with_egl_platforms=""
  1519. fi])
  1520. EGL_PLATFORMS=""
  1521. if test "x$with_egl_platforms" != "x" -a "x$enable_egl" != xyes; then
  1522. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1523. fi
  1524. # Do per-EGL platform setups and checks
  1525. egl_platforms=`IFS=', '; echo $with_egl_platforms`
  1526. for plat in $egl_platforms; do
  1527. case "$plat" in
  1528. fbdev|null)
  1529. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/$plat"
  1530. ;;
  1531. wayland)
  1532. PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server],, \
  1533. [AC_MSG_ERROR([cannot find libwayland-client])])
  1534. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
  1535. m4_ifdef([WAYLAND_SCANNER_RULES],
  1536. [WAYLAND_SCANNER_RULES(['$(top_srcdir)/src/egl/wayland/wayland-drm/protocol'])])
  1537. ;;
  1538. x11)
  1539. PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes])
  1540. # workaround a bug in xcb-dri2 generated by xcb-proto 1.6
  1541. save_LIBS="$LIBS"
  1542. AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [],
  1543. [DEFINES="$DEFINES -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN"])
  1544. LIBS="$save_LIBS"
  1545. ;;
  1546. drm)
  1547. test "x$enable_gbm" = "xno" &&
  1548. AC_MSG_ERROR([EGL platform drm needs gbm])
  1549. ;;
  1550. android|gdi)
  1551. ;;
  1552. *)
  1553. AC_MSG_ERROR([EGL platform '$plat' does not exist])
  1554. ;;
  1555. esac
  1556. case "$plat$have_libudev" in
  1557. waylandno|drmno)
  1558. AC_MSG_ERROR([cannot build $plat platfrom without udev]) ;;
  1559. esac
  1560. done
  1561. # libEGL wants to default to the first platform specified in
  1562. # ./configure. parse that here.
  1563. if test "x$egl_platforms" != "x"; then
  1564. FIRST_PLATFORM_CAPS=`echo $egl_platforms | sed 's| .*||' | tr 'a-z' 'A-Z'`
  1565. EGL_NATIVE_PLATFORM="_EGL_PLATFORM_$FIRST_PLATFORM_CAPS"
  1566. else
  1567. EGL_NATIVE_PLATFORM="_EGL_INVALID_PLATFORM"
  1568. fi
  1569. EGL_PLATFORMS="$egl_platforms"
  1570. AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep 'x11' >/dev/null 2>&1)
  1571. AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep 'wayland' >/dev/null 2>&1)
  1572. AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep 'drm' >/dev/null 2>&1)
  1573. AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo "$egl_platforms" | grep 'fbdev' >/dev/null 2>&1)
  1574. AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep 'null' >/dev/null 2>&1)
  1575. AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
  1576. AM_CONDITIONAL(HAVE_EGL_DRIVER_GLX, test "x$HAVE_EGL_DRIVER_GLX" != "x")
  1577. AC_SUBST([EGL_NATIVE_PLATFORM])
  1578. AC_SUBST([EGL_PLATFORMS])
  1579. AC_SUBST([EGL_CFLAGS])
  1580. AC_ARG_WITH([egl-driver-dir],
  1581. [AS_HELP_STRING([--with-egl-driver-dir=DIR],
  1582. [directory for EGL drivers [[default=${libdir}/egl]]])],
  1583. [EGL_DRIVER_INSTALL_DIR="$withval"],
  1584. [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
  1585. AC_SUBST([EGL_DRIVER_INSTALL_DIR])
  1586. AC_ARG_WITH([xorg-driver-dir],
  1587. [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
  1588. [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
  1589. [XORG_DRIVER_INSTALL_DIR="$withval"],
  1590. [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
  1591. AC_SUBST([XORG_DRIVER_INSTALL_DIR])
  1592. AC_ARG_WITH([max-width],
  1593. [AS_HELP_STRING([--with-max-width=N],
  1594. [Maximum framebuffer width (4096)])],
  1595. [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
  1596. AS_IF([test "${withval}" -gt "4096"],
  1597. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1598. )
  1599. AC_ARG_WITH([max-height],
  1600. [AS_HELP_STRING([--with-max-height=N],
  1601. [Maximum framebuffer height (4096)])],
  1602. [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
  1603. AS_IF([test "${withval}" -gt "4096"],
  1604. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1605. )
  1606. dnl
  1607. dnl Gallium LLVM
  1608. dnl
  1609. AC_ARG_ENABLE([gallium-llvm],
  1610. [AS_HELP_STRING([--enable-gallium-llvm],
  1611. [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
  1612. [enable_gallium_llvm="$enableval"],
  1613. [enable_gallium_llvm=auto])
  1614. AC_ARG_WITH([llvm-shared-libs],
  1615. [AS_HELP_STRING([--with-llvm-shared-libs],
  1616. [link with LLVM shared libraries @<:@default=disabled@:>@])],
  1617. [with_llvm_shared_libs=yes],
  1618. [with_llvm_shared_libs=no])
  1619. if test "x$with_gallium_drivers" = x; then
  1620. enable_gallium_llvm=no
  1621. fi
  1622. if test "x$enable_gallium_llvm" = xauto; then
  1623. case "$host_cpu" in
  1624. i*86|x86_64) enable_gallium_llvm=yes;;
  1625. esac
  1626. fi
  1627. if test "x$enable_gallium_llvm" = xyes; then
  1628. AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
  1629. if test "x$LLVM_CONFIG" != xno; then
  1630. LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'`
  1631. LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e 's/-pedantic//g' -e 's/-Wcovered-switch-default//g'`
  1632. if test "x$with_llvm_shared_libs" = xyes; then
  1633. dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
  1634. LLVM_LIBS="-lLLVM-`$LLVM_CONFIG --version`"
  1635. else
  1636. LLVM_LIBS="`$LLVM_CONFIG --libs engine bitwriter`"
  1637. if test "x$enable_opencl" = xyes; then
  1638. LLVM_LIBS="${LLVM_LIBS} `llvm-config --libs ipo linker instrumentation`"
  1639. fi
  1640. fi
  1641. LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
  1642. LLVM_BINDIR=`$LLVM_CONFIG --bindir`
  1643. LLVM_CXXFLAGS=`$LLVM_CONFIG --cxxflags`
  1644. LLVM_CPPFLAGS=`$LLVM_CONFIG --cppflags`
  1645. LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
  1646. LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
  1647. DEFINES="${DEFINES} -DHAVE_LLVM=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/0x0\10\2/g'`"
  1648. MESA_LLVM=1
  1649. dnl Check for Clang interanl headers
  1650. if test "x$enable_opencl" = xyes; then
  1651. if test "x$CLANG_LIBDIR" = x; then
  1652. CLANG_LIBDIR=${LLVM_LIBDIR}
  1653. fi
  1654. CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
  1655. AC_CHECK_FILE("$CLANG_RESOURCE_DIR/include/stddef.h",,
  1656. AC_MSG_ERROR([Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries.]))
  1657. fi
  1658. else
  1659. MESA_LLVM=0
  1660. fi
  1661. else
  1662. MESA_LLVM=0
  1663. fi
  1664. dnl Directory for XVMC libs
  1665. AC_ARG_WITH([xvmc-libdir],
  1666. [AS_HELP_STRING([--with-xvmc-libdir=DIR],
  1667. [directory for the XVMC libraries @<:@default=${libdir}@:>@])],
  1668. [XVMC_LIB_INSTALL_DIR="$withval"],
  1669. [XVMC_LIB_INSTALL_DIR='${libdir}'])
  1670. AC_SUBST([XVMC_LIB_INSTALL_DIR])
  1671. dnl
  1672. dnl Gallium Tests
  1673. dnl
  1674. if test "x$enable_gallium_tests" = xyes; then
  1675. SRC_DIRS="$SRC_DIRS gallium/tests/trivial"
  1676. enable_gallium_loader=yes
  1677. fi
  1678. dnl Directory for VDPAU libs
  1679. AC_ARG_WITH([vdpau-libdir],
  1680. [AS_HELP_STRING([--with-vdpau-libdir=DIR],
  1681. [directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
  1682. [VDPAU_LIB_INSTALL_DIR="$withval"],
  1683. [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
  1684. AC_SUBST([VDPAU_LIB_INSTALL_DIR])
  1685. dnl Directory for VA libs
  1686. AC_ARG_WITH([va-libdir],
  1687. [AS_HELP_STRING([--with-va-libdir=DIR],
  1688. [directory for the VA libraries @<:@default=${libdir}/va@:>@])],
  1689. [VA_LIB_INSTALL_DIR="$withval"],
  1690. [VA_LIB_INSTALL_DIR='${libdir}/va'])
  1691. AC_SUBST([VA_LIB_INSTALL_DIR])
  1692. dnl Directory for OpenCL libs
  1693. AC_ARG_WITH([opencl-libdir],
  1694. [AS_HELP_STRING([--with-opencl-libdir=DIR],
  1695. [directory for the OpenCL libraries @<:@default=${libdir}/opencl@:>@])],
  1696. [OPENCL_LIB_INSTALL_DIR="$withval"],
  1697. [OPENCL_LIB_INSTALL_DIR='${libdir}/opencl'])
  1698. AC_SUBST([OPENCL_LIB_INSTALL_DIR])
  1699. dnl
  1700. dnl Gallium helper functions
  1701. dnl
  1702. gallium_check_st() {
  1703. if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes ||
  1704. test "x$HAVE_ST_XA" = xyes || test "x$HAVE_ST_XVMC" = xyes ||
  1705. test "x$HAVE_ST_VDPAU" = xyes || test "x$HAVE_ST_VA" = xyes; then
  1706. if test "x$have_libdrm" != xyes; then
  1707. AC_MSG_ERROR([DRI or Xorg DDX requires libdrm >= $LIBDRM_REQUIRED])
  1708. fi
  1709. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
  1710. fi
  1711. if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
  1712. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
  1713. fi
  1714. if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
  1715. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
  1716. fi
  1717. if test "x$HAVE_ST_XA" = xyes && test "x$4" != x; then
  1718. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
  1719. fi
  1720. if test "x$HAVE_ST_XVMC" = xyes && test "x$5" != x; then
  1721. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $5"
  1722. fi
  1723. if test "x$HAVE_ST_VDPAU" = xyes && test "x$6" != x; then
  1724. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $6"
  1725. fi
  1726. if test "x$HAVE_ST_VA" = xyes && test "x$7" != x; then
  1727. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $7"
  1728. fi
  1729. }
  1730. gallium_require_llvm() {
  1731. if test "x$MESA_LLVM" = x0; then
  1732. case "$host_cpu" in
  1733. i*86|x86_64) AC_MSG_ERROR([LLVM is required to build $1 on x86 and x86_64]);;
  1734. esac
  1735. fi
  1736. }
  1737. gallium_require_drm_loader() {
  1738. if test "x$enable_gallium_loader" = xyes; then
  1739. PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
  1740. AC_MSG_ERROR([Gallium drm loader requrires libudev]))
  1741. if test "x$have_libdrm" != xyes; then
  1742. AC_MSG_ERROR([Gallium drm loader requires libdrm >= $LIBDRM_REQUIRED])
  1743. fi
  1744. enable_gallium_drm_loader=yes
  1745. fi
  1746. }
  1747. dnl Gallium drivers
  1748. dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
  1749. if test "x$with_gallium_drivers" != x; then
  1750. gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
  1751. for driver in $gallium_drivers; do
  1752. case "x$driver" in
  1753. xsvga)
  1754. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
  1755. gallium_check_st "svga/drm" "dri-vmwgfx" "" "xa-vmwgfx"
  1756. ;;
  1757. xi915)
  1758. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1759. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 softpipe"
  1760. if test "x$MESA_LLVM" = x1; then
  1761. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
  1762. fi
  1763. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
  1764. gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
  1765. ;;
  1766. xr300)
  1767. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1768. gallium_require_llvm "Gallium R300"
  1769. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1770. gallium_check_st "radeon/drm" "dri-r300" "xorg-r300" "" "xvmc-r300" "vdpau-r300" "va-r300"
  1771. ;;
  1772. xr600)
  1773. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1774. gallium_require_drm_loader
  1775. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
  1776. if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes; then
  1777. if test "x$LLVM_VERSION" != "x3.1"; then
  1778. AC_MSG_ERROR([LLVM 3.1 is required for the r600 llvm compiler.])
  1779. fi
  1780. NEED_RADEON_GALLIUM=yes;
  1781. fi
  1782. if test "x$enable_r600_llvm" = xyes; then
  1783. USE_R600_LLVM_COMPILER=yes;
  1784. fi
  1785. if test "x$enable_opencl" = xyes -a "x$with_llvm_shared_libs" = xno; then
  1786. LLVM_LIBS="${LLVM_LIBS} `llvm-config --libs bitreader asmparser`"
  1787. fi
  1788. gallium_check_st "radeon/drm" "dri-r600" "xorg-r600" "" "xvmc-r600" "vdpau-r600" "va-r600"
  1789. ;;
  1790. xradeonsi)
  1791. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1792. gallium_require_drm_loader
  1793. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
  1794. if test "x$LLVM_VERSION" != "x3.1"; then
  1795. AC_MSG_ERROR([LLVM 3.1 is required to build the radeonsi driver.])
  1796. fi
  1797. NEED_RADEON_GALLIUM=yes;
  1798. gallium_check_st "radeon/drm" "dri-radeonsi" "xorg-radeonsi"
  1799. ;;
  1800. xnouveau)
  1801. PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
  1802. gallium_require_drm_loader
  1803. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv30 nv50 nvc0"
  1804. gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" "" "xvmc-nouveau" "vdpau-nouveau"
  1805. ;;
  1806. xswrast)
  1807. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS softpipe"
  1808. if test "x$MESA_LLVM" = x1; then
  1809. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
  1810. fi
  1811. if test "x$HAVE_ST_DRI" = xyes; then
  1812. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
  1813. fi
  1814. if test "x$HAVE_ST_VDPAU" = xyes; then
  1815. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS vdpau-softpipe"
  1816. fi
  1817. if test "x$HAVE_ST_XVMC" = xyes; then
  1818. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS xvmc-softpipe"
  1819. fi
  1820. if test "x$HAVE_ST_VA" = xyes; then
  1821. GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS va-softpipe"
  1822. fi
  1823. if test "x$HAVE_ST_VDPAU" = xyes ||
  1824. test "x$HAVE_ST_XVMC" = xyes ||
  1825. test "x$HAVE_ST_VA" = xyes; then
  1826. if test "x$HAVE_WINSYS_XLIB" != xyes; then
  1827. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
  1828. fi
  1829. fi
  1830. ;;
  1831. *)
  1832. AC_MSG_ERROR([Unknown Gallium driver: $driver])
  1833. ;;
  1834. esac
  1835. done
  1836. fi
  1837. if test "x$enable_gallium_loader" = xyes; then
  1838. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null"
  1839. GALLIUM_PIPE_LOADER_DEFINES="-DHAVE_PIPE_LOADER_SW"
  1840. GALLIUM_PIPE_LOADER_LIBS="\$(TOP)/src/gallium/auxiliary/pipe-loader/libpipe_loader.a"
  1841. GALLIUM_PIPE_LOADER_LIBS="$GALLIUM_PIPE_LOADER_LIBS \$(TOP)/src/gallium/winsys/sw/null/libws_null.a"
  1842. if test "x$HAVE_WINSYS_XLIB" = xyes; then
  1843. GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_XLIB"
  1844. GALLIUM_PIPE_LOADER_LIBS="$GALLIUM_PIPE_LOADER_LIBS \$(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a"
  1845. fi
  1846. if test "x$enable_gallium_drm_loader" = xyes; then
  1847. GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRM"
  1848. fi
  1849. AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
  1850. AC_SUBST([GALLIUM_PIPE_LOADER_LIBS])
  1851. fi
  1852. dnl Tell Automake which drivers to build
  1853. for driver in $GALLIUM_DRIVERS_DIRS; do
  1854. case "x$driver" in
  1855. xgalahad)
  1856. HAVE_GALAHAD_GALLIUM=yes;
  1857. ;;
  1858. xidentity)
  1859. HAVE_IDENTITY_GALLIUM=yes;
  1860. ;;
  1861. xnoop)
  1862. HAVE_NOOP_GALLIUM=yes;
  1863. ;;
  1864. *)
  1865. GALLIUM_MAKE_DIRS="$GALLIUM_MAKE_DIRS $driver"
  1866. ;;
  1867. esac
  1868. done
  1869. AM_CONDITIONAL(HAVE_GALAHAD_GALLIUM, test x$HAVE_GALAHAD_GALLIUM = xyes)
  1870. AM_CONDITIONAL(HAVE_IDENTITY_GALLIUM, test x$HAVE_IDENTITY_GALLIUM = xyes)
  1871. AM_CONDITIONAL(HAVE_NOOP_GALLIUM, test x$HAVE_NOOP_GALLIUM = xyes)
  1872. AM_CONDITIONAL(NEED_RADEON_GALLIUM, test x$NEED_RADEON_GALLIUM = xyes)
  1873. AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
  1874. AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
  1875. AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes)
  1876. AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
  1877. AC_SUBST([GALLIUM_MAKE_DIRS])
  1878. AM_CONDITIONAL(HAVE_X11_DRIVER, echo "$DRIVER_DIRS" | grep 'x11' >/dev/null 2>&1)
  1879. AM_CONDITIONAL(HAVE_DRI_DRIVER, echo "$DRIVER_DIRS" | grep 'dri' >/dev/null 2>&1)
  1880. AM_CONDITIONAL(HAVE_OSMESA_DRIVER, echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1)
  1881. AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 'X86_ASM' >/dev/null 2>&1)
  1882. AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 2>&1)
  1883. AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$DEFINES" | grep 'SPARC_ASM' >/dev/null 2>&1)
  1884. dnl prepend CORE_DIRS to SRC_DIRS
  1885. SRC_DIRS="$CORE_DIRS $SRC_DIRS"
  1886. dnl Restore LDFLAGS and CPPFLAGS
  1887. LDFLAGS="$_SAVE_LDFLAGS"
  1888. CPPFLAGS="$_SAVE_CPPFLAGS"
  1889. dnl Add user CFLAGS and CXXFLAGS
  1890. CFLAGS="$CFLAGS $USER_CFLAGS"
  1891. CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
  1892. dnl Substitute the config
  1893. AC_CONFIG_FILES([configs/current
  1894. Makefile
  1895. src/Makefile
  1896. src/gallium/Makefile
  1897. src/gallium/auxiliary/pipe-loader/Makefile
  1898. src/gallium/state_trackers/clover/Makefile
  1899. src/gallium/drivers/Makefile
  1900. src/gallium/drivers/r300/Makefile
  1901. src/gallium/drivers/r600/Makefile
  1902. src/gallium/targets/opencl/Makefile
  1903. src/gbm/Makefile
  1904. src/gbm/main/gbm.pc
  1905. src/egl/drivers/Makefile
  1906. src/egl/drivers/dri2/Makefile
  1907. src/egl/drivers/glx/Makefile
  1908. src/egl/Makefile
  1909. src/egl/main/Makefile
  1910. src/egl/main/egl.pc
  1911. src/egl/wayland/Makefile
  1912. src/egl/wayland/wayland-egl/Makefile
  1913. src/egl/wayland/wayland-egl/wayland-egl.pc
  1914. src/egl/wayland/wayland-drm/Makefile
  1915. src/glsl/Makefile
  1916. src/glsl/glcpp/Makefile
  1917. src/glsl/tests/Makefile
  1918. src/glx/Makefile
  1919. src/glx/tests/Makefile
  1920. src/mapi/glapi/gen/Makefile
  1921. src/mapi/shared-glapi/Makefile
  1922. src/mapi/glapi/tests/Makefile
  1923. src/gtest/Makefile
  1924. src/mesa/Makefile
  1925. src/mesa/libdricore/Makefile
  1926. src/mesa/main/tests/Makefile
  1927. src/mesa/x86/Makefile
  1928. src/mesa/x86-64/Makefile
  1929. src/mesa/drivers/Makefile
  1930. src/mesa/drivers/dri/dri.pc
  1931. src/mesa/drivers/dri/Makefile
  1932. src/mesa/drivers/dri/common/Makefile
  1933. src/mesa/drivers/dri/i915/Makefile
  1934. src/mesa/drivers/dri/i965/Makefile
  1935. src/mesa/drivers/dri/nouveau/Makefile
  1936. src/mesa/drivers/dri/r200/Makefile
  1937. src/mesa/drivers/dri/radeon/Makefile
  1938. src/mesa/drivers/dri/swrast/Makefile
  1939. src/mesa/drivers/osmesa/Makefile
  1940. src/mesa/drivers/x11/Makefile
  1941. src/mesa/gl.pc
  1942. src/mesa/osmesa.pc])
  1943. dnl Sort the dirs alphabetically
  1944. GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
  1945. GALLIUM_WINSYS_DIRS=`echo $GALLIUM_WINSYS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
  1946. GALLIUM_DRIVERS_DIRS=`echo $GALLIUM_DRIVERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
  1947. GALLIUM_MAKE_DIRS=`echo $GALLIUM_MAKE_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
  1948. GALLIUM_STATE_TRACKERS_DIRS=`echo $GALLIUM_STATE_TRACKERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
  1949. AC_OUTPUT
  1950. dnl
  1951. dnl Output some configuration info for the user
  1952. dnl
  1953. echo ""
  1954. echo " prefix: $prefix"
  1955. echo " exec_prefix: $exec_prefix"
  1956. echo " libdir: $libdir"
  1957. echo " includedir: $includedir"
  1958. dnl API info
  1959. echo ""
  1960. echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
  1961. echo " OpenVG: $enable_openvg"
  1962. dnl Driver info
  1963. echo ""
  1964. if test "x$enable_osmesa" != xno; then
  1965. echo " OSMesa: lib$OSMESA_LIB"
  1966. else
  1967. echo " OSMesa: no"
  1968. fi
  1969. if test "x$enable_dri" != xno; then
  1970. # cleanup the drivers var
  1971. dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1972. if test "x$DRI_DIRS" = x; then
  1973. echo " DRI drivers: no"
  1974. else
  1975. echo " DRI drivers: $dri_dirs"
  1976. fi
  1977. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  1978. fi
  1979. case "x$enable_glx$enable_xlib_glx" in
  1980. xyesyes)
  1981. echo " GLX: Xlib-based"
  1982. ;;
  1983. xyesno)
  1984. echo " GLX: DRI-based"
  1985. ;;
  1986. *)
  1987. echo " GLX: $enable_glx"
  1988. ;;
  1989. esac
  1990. echo ""
  1991. echo " GLU: $enable_glu"
  1992. dnl EGL
  1993. echo ""
  1994. echo " EGL: $enable_egl"
  1995. if test "$enable_egl" = yes; then
  1996. echo " EGL platforms: $EGL_PLATFORMS"
  1997. egl_drivers=""
  1998. if test "x$HAVE_EGL_DRIVER_GLX" != "x"; then
  1999. egl_drivers="$egl_drivers builtin:egl_glx"
  2000. fi
  2001. if test "x$HAVE_EGL_DRIVER_DRI2" != "x"; then
  2002. egl_drivers="$egl_drivers builtin:egl_dri2"
  2003. fi
  2004. if test "x$HAVE_ST_EGL" = xyes; then
  2005. echo " EGL drivers: ${egl_drivers} egl_gallium"
  2006. echo " EGL Gallium STs:$EGL_CLIENT_APIS"
  2007. else
  2008. echo " EGL drivers: $egl_drivers"
  2009. fi
  2010. fi
  2011. echo ""
  2012. if test "x$MESA_LLVM" = x1; then
  2013. echo " llvm: yes"
  2014. echo " llvm-config: $LLVM_CONFIG"
  2015. echo " llvm-version: $LLVM_VERSION"
  2016. else
  2017. echo " llvm: no"
  2018. fi
  2019. echo ""
  2020. if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
  2021. echo " Gallium: yes"
  2022. echo " Gallium dirs: $GALLIUM_DIRS"
  2023. echo " Target dirs: $GALLIUM_TARGET_DIRS"
  2024. echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
  2025. echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
  2026. echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
  2027. else
  2028. echo " Gallium: no"
  2029. fi
  2030. dnl Libraries
  2031. echo ""
  2032. echo " Shared libs: $enable_shared"
  2033. echo " Static libs: $enable_static"
  2034. dnl Compiler options
  2035. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  2036. cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  2037. $SED 's/^ *//;s/ */ /;s/ *$//'`
  2038. cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  2039. $SED 's/^ *//;s/ */ /;s/ *$//'`
  2040. defines=`echo $DEFINES | $SED 's/^ *//;s/ */ /;s/ *$//'`
  2041. echo ""
  2042. echo " CFLAGS: $cflags"
  2043. echo " CXXFLAGS: $cxxflags"
  2044. echo " Macros: $defines"
  2045. echo ""
  2046. echo " PYTHON2: $PYTHON2"
  2047. echo ""
  2048. echo " Run '${MAKE-make}' to build Mesa"
  2049. echo ""