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

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