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

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