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

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