Clone of mesa.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

configure.ac 83KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583
  1. dnl Copyright © 2011-2014 Intel Corporation
  2. dnl Copyright © 2011-2014 Emil Velikov <emil.l.velikov@gmail.com>
  3. dnl Copyright © 2007-2010 Dan Nicholson
  4. dnl Copyright © 2010-2014 Marek Olšák <maraeo@gmail.com>
  5. dnl Copyright © 2010-2014 Christian König
  6. dnl Copyright © 2012-2014 Tom Stellard <tstellar@gmail.com>
  7. dnl Copyright © 2009-2012 Jakob Bornecrantz
  8. dnl Copyright © 2009-2014 Jon TURNEY
  9. dnl Copyright © 2011-2012 Benjamin Franzke
  10. dnl Copyright © 2008-2014 David Airlie
  11. dnl Copyright © 2009-2013 Brian Paul
  12. dnl Copyright © 2003-2007 Keith Packard, Daniel Stone
  13. dnl
  14. dnl Permission is hereby granted, free of charge, to any person obtaining a
  15. dnl copy of this software and associated documentation files (the "Software"),
  16. dnl to deal in the Software without restriction, including without limitation
  17. dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
  18. dnl and/or sell copies of the Software, and to permit persons to whom the
  19. dnl Software is furnished to do so, subject to the following conditions:
  20. dnl
  21. dnl The above copyright notice and this permission notice (including the next
  22. dnl paragraph) shall be included in all copies or substantial portions of the
  23. dnl Software.
  24. dnl
  25. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26. dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  27. dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  28. dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  29. dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  30. dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  31. dnl DEALINGS IN THE SOFTWARE.
  32. dnl
  33. dnl Process this file with autoconf to create configure.
  34. AC_PREREQ([2.60])
  35. dnl Tell the user about autoconf.html in the --help output
  36. m4_divert_once([HELP_END], [
  37. See docs/autoconf.html for more details on the options for Mesa.])
  38. m4_define(MESA_VERSION, m4_normalize(m4_include(VERSION)))
  39. AC_INIT([Mesa], [MESA_VERSION],
  40. [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
  41. AC_CONFIG_AUX_DIR([bin])
  42. AC_CONFIG_MACRO_DIR([m4])
  43. AC_CANONICAL_SYSTEM
  44. AM_INIT_AUTOMAKE([foreign tar-ustar dist-xz subdir-objects])
  45. dnl We only support native Windows builds (MinGW/MSVC) through SCons.
  46. case "$host_os" in
  47. mingw*)
  48. AC_MSG_ERROR([MinGW build not supported through autoconf/automake, use SCons instead])
  49. ;;
  50. esac
  51. # Support silent build rules, requires at least automake-1.11. Disable
  52. # by either passing --disable-silent-rules to configure or passing V=1
  53. # to make
  54. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
  55. [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
  56. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  57. dnl Set internal versions
  58. OSMESA_VERSION=8
  59. AC_SUBST([OSMESA_VERSION])
  60. OPENCL_VERSION=1
  61. AC_SUBST([OPENCL_VERSION])
  62. dnl Versions for external dependencies
  63. LIBDRM_REQUIRED=2.4.60
  64. LIBDRM_RADEON_REQUIRED=2.4.56
  65. LIBDRM_AMDGPU_REQUIRED=2.4.63
  66. LIBDRM_INTEL_REQUIRED=2.4.61
  67. LIBDRM_NVVIEUX_REQUIRED=2.4.33
  68. LIBDRM_NOUVEAU_REQUIRED=2.4.62
  69. LIBDRM_FREEDRENO_REQUIRED=2.4.65
  70. DRI2PROTO_REQUIRED=2.6
  71. DRI3PROTO_REQUIRED=1.0
  72. PRESENTPROTO_REQUIRED=1.0
  73. LIBUDEV_REQUIRED=151
  74. GLPROTO_REQUIRED=1.4.14
  75. LIBOMXIL_BELLAGIO_REQUIRED=0.0
  76. LIBVA_REQUIRED=0.38.0
  77. VDPAU_REQUIRED=1.1
  78. WAYLAND_REQUIRED=1.2.0
  79. XCB_REQUIRED=1.9.3
  80. XCBDRI2_REQUIRED=1.8
  81. XCBGLX_REQUIRED=1.8.1
  82. XSHMFENCE_REQUIRED=1.1
  83. XVMC_REQUIRED=1.0.6
  84. PYTHON_MAKO_REQUIRED=0.3.4
  85. dnl Check for progs
  86. AC_PROG_CPP
  87. AC_PROG_CC
  88. AC_PROG_CXX
  89. AM_PROG_CC_C_O
  90. AM_PROG_AS
  91. AX_CHECK_GNU_MAKE
  92. AC_CHECK_PROGS([PYTHON2], [python2.7 python2 python])
  93. AC_PROG_SED
  94. AC_PROG_MKDIR_P
  95. AC_SYS_LARGEFILE
  96. LT_PREREQ([2.2])
  97. LT_INIT([disable-static])
  98. AC_CHECK_PROG(RM, rm, [rm -f])
  99. AX_PROG_BISON([],
  100. AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"],
  101. [AC_MSG_ERROR([bison not found - unable to compile glcpp-parse.y])]))
  102. AX_PROG_FLEX([],
  103. AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-lex.c"],
  104. [AC_MSG_ERROR([flex not found - unable to compile glcpp-lex.l])]))
  105. AC_CHECK_PROG(INDENT, indent, indent, cat)
  106. if test "x$INDENT" != "xcat"; then
  107. # Only GNU indent is supported
  108. INDENT_VERSION=`indent --version | grep GNU`
  109. if test $? -eq 0; then
  110. AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte -TBool')
  111. else
  112. INDENT="cat"
  113. fi
  114. fi
  115. AX_CHECK_PYTHON_MAKO_MODULE($PYTHON_MAKO_REQUIRED)
  116. if test -z "$PYTHON2"; then
  117. if test ! -f "$srcdir/src/util/format_srgb.c"; then
  118. AC_MSG_ERROR([Python not found - unable to generate sources])
  119. fi
  120. else
  121. if test "x$acv_mako_found" = xno; then
  122. if test ! -f "$srcdir/src/mesa/main/format_unpack.c"; then
  123. AC_MSG_ERROR([Python mako module v$PYTHON_MAKO_REQUIRED or higher not found])
  124. fi
  125. fi
  126. fi
  127. AC_PROG_INSTALL
  128. dnl We need a POSIX shell for parts of the build. Assume we have one
  129. dnl in most cases.
  130. case "$host_os" in
  131. solaris*)
  132. # Solaris /bin/sh is too old/non-POSIX compliant
  133. AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
  134. SHELL="$POSIX_SHELL"
  135. ;;
  136. esac
  137. dnl clang is mostly GCC-compatible, but its version is much lower,
  138. dnl so we have to check for it.
  139. AC_MSG_CHECKING([if compiling with clang])
  140. AC_COMPILE_IFELSE(
  141. [AC_LANG_PROGRAM([], [[
  142. #ifndef __clang__
  143. not clang
  144. #endif
  145. ]])],
  146. [acv_mesa_CLANG=yes], [acv_mesa_CLANG=no])
  147. AC_MSG_RESULT([$acv_mesa_CLANG])
  148. dnl If we're using GCC, make sure that it is at least version 4.2.0. Older
  149. dnl versions are explictly not supported.
  150. GEN_ASM_OFFSETS=no
  151. USE_GNU99=no
  152. if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
  153. AC_MSG_CHECKING([whether gcc version is sufficient])
  154. major=0
  155. minor=0
  156. GCC_VERSION=`$CC -dumpversion`
  157. if test $? -eq 0; then
  158. GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
  159. GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
  160. fi
  161. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 2 ; then
  162. AC_MSG_RESULT([no])
  163. AC_MSG_ERROR([If using GCC, version 4.2.0 or later is required.])
  164. else
  165. AC_MSG_RESULT([yes])
  166. fi
  167. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 6 ; then
  168. USE_GNU99=yes
  169. fi
  170. if test "x$cross_compiling" = xyes; then
  171. GEN_ASM_OFFSETS=yes
  172. fi
  173. fi
  174. dnl We don't support building Mesa with Sun C compiler
  175. dnl https://bugs.freedesktop.org/show_bug.cgi?id=93189
  176. AC_CHECK_DECL([__SUNPRO_C], [SUNCC=yes], [SUNCC=no])
  177. if test "x$SUNCC" = xyes; then
  178. AC_MSG_ERROR([Building with Sun C compiler is not supported, use GCC instead.])
  179. fi
  180. dnl Check for compiler builtins
  181. AX_GCC_BUILTIN([__builtin_bswap32])
  182. AX_GCC_BUILTIN([__builtin_bswap64])
  183. AX_GCC_BUILTIN([__builtin_clz])
  184. AX_GCC_BUILTIN([__builtin_clzll])
  185. AX_GCC_BUILTIN([__builtin_ctz])
  186. AX_GCC_BUILTIN([__builtin_expect])
  187. AX_GCC_BUILTIN([__builtin_ffs])
  188. AX_GCC_BUILTIN([__builtin_ffsll])
  189. AX_GCC_BUILTIN([__builtin_popcount])
  190. AX_GCC_BUILTIN([__builtin_popcountll])
  191. AX_GCC_BUILTIN([__builtin_unreachable])
  192. AX_GCC_FUNC_ATTRIBUTE([const])
  193. AX_GCC_FUNC_ATTRIBUTE([flatten])
  194. AX_GCC_FUNC_ATTRIBUTE([format])
  195. AX_GCC_FUNC_ATTRIBUTE([malloc])
  196. AX_GCC_FUNC_ATTRIBUTE([packed])
  197. AX_GCC_FUNC_ATTRIBUTE([pure])
  198. AX_GCC_FUNC_ATTRIBUTE([unused])
  199. AX_GCC_FUNC_ATTRIBUTE([warn_unused_result])
  200. AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)
  201. dnl Make sure the pkg-config macros are defined
  202. m4_ifndef([PKG_PROG_PKG_CONFIG],
  203. [m4_fatal([Could not locate the pkg-config autoconf macros.
  204. These are usually located in /usr/share/aclocal/pkg.m4. If your macros
  205. are in a different location, try setting the environment variable
  206. ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
  207. PKG_PROG_PKG_CONFIG()
  208. dnl LIB_DIR - library basename
  209. LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
  210. AC_SUBST([LIB_DIR])
  211. dnl Cache LDFLAGS and CPPFLAGS so we can add to them and restore later
  212. _SAVE_LDFLAGS="$LDFLAGS"
  213. _SAVE_CPPFLAGS="$CPPFLAGS"
  214. dnl Compiler macros
  215. DEFINES="-D__STDC_LIMIT_MACROS"
  216. AC_SUBST([DEFINES])
  217. case "$host_os" in
  218. linux*|*-gnu*|gnu*)
  219. DEFINES="$DEFINES -D_GNU_SOURCE"
  220. ;;
  221. solaris*)
  222. DEFINES="$DEFINES -DSVR4"
  223. ;;
  224. cygwin*)
  225. DEFINES="$DEFINES -D_XOPEN_SOURCE=700"
  226. ;;
  227. esac
  228. dnl Add flags for gcc and g++
  229. if test "x$GCC" = xyes; then
  230. CFLAGS="$CFLAGS -Wall"
  231. if test "x$USE_GNU99" = xyes; then
  232. CFLAGS="$CFLAGS -std=gnu99"
  233. else
  234. CFLAGS="$CFLAGS -std=c99"
  235. fi
  236. # Enable -Werror=implicit-function-declaration and
  237. # -Werror=missing-prototypes, if available, or otherwise, just
  238. # -Wmissing-prototypes. This is particularly useful to avoid
  239. # generating a loadable driver module that has undefined symbols.
  240. save_CFLAGS="$CFLAGS"
  241. AC_MSG_CHECKING([whether $CC supports -Werror=missing-prototypes])
  242. CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
  243. CFLAGS="$CFLAGS -Werror=missing-prototypes"
  244. AC_LINK_IFELSE([AC_LANG_PROGRAM()],
  245. AC_MSG_RESULT([yes]),
  246. [CFLAGS="$save_CFLAGS -Wmissing-prototypes";
  247. AC_MSG_RESULT([no])]);
  248. # Enable -fvisibility=hidden if using a gcc that supports it
  249. save_CFLAGS="$CFLAGS"
  250. AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
  251. VISIBILITY_CFLAGS="-fvisibility=hidden"
  252. CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
  253. AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
  254. [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
  255. # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
  256. CFLAGS=$save_CFLAGS
  257. # Work around aliasing bugs - developers should comment this out
  258. CFLAGS="$CFLAGS -fno-strict-aliasing"
  259. # We don't want floating-point math functions to set errno or trap
  260. CFLAGS="$CFLAGS -fno-math-errno -fno-trapping-math"
  261. # gcc's builtin memcmp is slower than glibc's
  262. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
  263. CFLAGS="$CFLAGS -fno-builtin-memcmp"
  264. # Flags to help ensure that certain portions of the code -- and only those
  265. # portions -- can be built with MSVC:
  266. # - src/util, src/gallium/auxiliary, and src/gallium/drivers/llvmpipe needs
  267. # to build with Windows SDK 7.0.7600, which bundles MSVC 2008
  268. # - non-Linux/Posix OpenGL portions needs to build on MSVC 2013 (which
  269. # supports most of C99)
  270. # - the rest has no compiler compiler restrictions
  271. MSVC2013_COMPAT_CFLAGS="-Werror=pointer-arith"
  272. MSVC2013_COMPAT_CXXFLAGS="-Werror=pointer-arith"
  273. # Enable -Werror=vla if compiler supports it
  274. save_CFLAGS="$CFLAGS"
  275. AC_MSG_CHECKING([whether $CC supports -Werror=vla])
  276. CFLAGS="$CFLAGS -Werror=vla"
  277. AC_LINK_IFELSE([AC_LANG_PROGRAM()],
  278. [MSVC2013_COMPAT_CFLAGS="$MSVC2013_COMPAT_CFLAGS -Werror=vla";
  279. MSVC2013_COMPAT_CXXFLAGS="$MSVC2013_COMPAT_CXXFLAGS -Werror=vla";
  280. AC_MSG_RESULT([yes])],
  281. AC_MSG_RESULT([no]));
  282. CFLAGS="$save_CFLAGS"
  283. MSVC2008_COMPAT_CFLAGS="$MSVC2013_COMPAT_CFLAGS -Werror=declaration-after-statement"
  284. MSVC2008_COMPAT_CXXFLAGS="$MSVC2013_COMPAT_CXXFLAGS"
  285. fi
  286. if test "x$GXX" = xyes; then
  287. CXXFLAGS="$CXXFLAGS -Wall"
  288. # Enable -fvisibility=hidden if using a gcc that supports it
  289. save_CXXFLAGS="$CXXFLAGS"
  290. AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
  291. VISIBILITY_CXXFLAGS="-fvisibility=hidden"
  292. CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
  293. AC_LANG_PUSH([C++])
  294. AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
  295. [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
  296. AC_LANG_POP([C++])
  297. # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
  298. CXXFLAGS=$save_CXXFLAGS
  299. # Work around aliasing bugs - developers should comment this out
  300. CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
  301. # gcc's builtin memcmp is slower than glibc's
  302. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
  303. CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
  304. fi
  305. AC_SUBST([MSVC2013_COMPAT_CFLAGS])
  306. AC_SUBST([MSVC2013_COMPAT_CXXFLAGS])
  307. AC_SUBST([MSVC2008_COMPAT_CFLAGS])
  308. AC_SUBST([MSVC2008_COMPAT_CXXFLAGS])
  309. dnl even if the compiler appears to support it, using visibility attributes isn't
  310. dnl going to do anything useful currently on cygwin apart from emit lots of warnings
  311. case "$host_os" in
  312. cygwin*)
  313. VISIBILITY_CFLAGS=""
  314. VISIBILITY_CXXFLAGS=""
  315. ;;
  316. esac
  317. AC_SUBST([VISIBILITY_CFLAGS])
  318. AC_SUBST([VISIBILITY_CXXFLAGS])
  319. dnl
  320. dnl Optional flags, check for compiler support
  321. dnl
  322. SSE41_CFLAGS="-msse4.1"
  323. dnl Code compiled by GCC with -msse* assumes a 16 byte aligned
  324. dnl stack, but on x86-32 such alignment is not guaranteed.
  325. case "$target_cpu" in
  326. i?86)
  327. SSE41_CFLAGS="$SSE41_CFLAGS -mstackrealign"
  328. ;;
  329. esac
  330. save_CFLAGS="$CFLAGS"
  331. CFLAGS="$SSE41_CFLAGS $CFLAGS"
  332. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  333. #include <smmintrin.h>
  334. int param;
  335. int main () {
  336. __m128i a = _mm_set1_epi32 (param), b = _mm_set1_epi32 (param + 1), c;
  337. c = _mm_max_epu32(a, b);
  338. return _mm_cvtsi128_si32(c);
  339. }]])], SSE41_SUPPORTED=1)
  340. CFLAGS="$save_CFLAGS"
  341. if test "x$SSE41_SUPPORTED" = x1; then
  342. DEFINES="$DEFINES -DUSE_SSE41"
  343. fi
  344. AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1])
  345. AC_SUBST([SSE41_CFLAGS], $SSE41_CFLAGS)
  346. dnl Can't have static and shared libraries, default to static if user
  347. dnl explicitly requested. If both disabled, set to static since shared
  348. dnl was explicitly requested.
  349. case "x$enable_static$enable_shared" in
  350. xyesyes)
  351. AC_MSG_WARN([Cannot build static and shared libraries, disabling shared])
  352. enable_shared=no
  353. ;;
  354. xnono)
  355. AC_MSG_WARN([Cannot disable both static and shared libraries, enabling shared])
  356. enable_shared=yes
  357. ;;
  358. esac
  359. AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
  360. dnl
  361. dnl other compiler options
  362. dnl
  363. AC_ARG_ENABLE([debug],
  364. [AS_HELP_STRING([--enable-debug],
  365. [use debug compiler flags and macros @<:@default=disabled@:>@])],
  366. [enable_debug="$enableval"],
  367. [enable_debug=no]
  368. )
  369. if test "x$enable_debug" = xyes; then
  370. DEFINES="$DEFINES -DDEBUG"
  371. if test "x$GCC" = xyes; then
  372. if ! echo "$CFLAGS" | grep -q -e '-g'; then
  373. CFLAGS="$CFLAGS -g"
  374. fi
  375. if ! echo "$CFLAGS" | grep -q -e '-O'; then
  376. CFLAGS="$CFLAGS -O0"
  377. fi
  378. fi
  379. if test "x$GXX" = xyes; then
  380. if ! echo "$CXXFLAGS" | grep -q -e '-g'; then
  381. CXXFLAGS="$CXXFLAGS -g"
  382. fi
  383. if ! echo "$CXXFLAGS" | grep -q -e '-O'; then
  384. CXXFLAGS="$CXXFLAGS -O0"
  385. fi
  386. fi
  387. else
  388. DEFINES="$DEFINES -DNDEBUG"
  389. fi
  390. dnl
  391. dnl Check if linker supports -Bsymbolic
  392. dnl
  393. save_LDFLAGS=$LDFLAGS
  394. LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
  395. AC_MSG_CHECKING([if ld supports -Bsymbolic])
  396. AC_LINK_IFELSE(
  397. [AC_LANG_SOURCE([int main() { return 0;}])],
  398. [AC_MSG_RESULT([yes])
  399. BSYMBOLIC="-Wl,-Bsymbolic";],
  400. [AC_MSG_RESULT([no])
  401. BSYMBOLIC="";])
  402. LDFLAGS=$save_LDFLAGS
  403. AC_SUBST([BSYMBOLIC])
  404. dnl
  405. dnl Check if linker supports garbage collection
  406. dnl
  407. save_LDFLAGS=$LDFLAGS
  408. LDFLAGS="$LDFLAGS -Wl,--gc-sections"
  409. AC_MSG_CHECKING([whether ld supports --gc-sections])
  410. AC_LINK_IFELSE(
  411. [AC_LANG_SOURCE([static char UnusedFunc() { return 5; } int main() { return 0;}])],
  412. [AC_MSG_RESULT([yes])
  413. GC_SECTIONS="-Wl,--gc-sections";],
  414. [AC_MSG_RESULT([no])
  415. GC_SECTIONS="";])
  416. LDFLAGS=$save_LDFLAGS
  417. AC_SUBST([GC_SECTIONS])
  418. dnl
  419. dnl OpenBSD does not have DT_NEEDED entries for libc by design
  420. dnl so when these flags are passed to ld via libtool the checks will fail
  421. dnl
  422. case "$host_os" in
  423. openbsd* | darwin* )
  424. LD_NO_UNDEFINED="" ;;
  425. *)
  426. LD_NO_UNDEFINED="-Wl,--no-undefined" ;;
  427. esac
  428. AC_SUBST([LD_NO_UNDEFINED])
  429. dnl
  430. dnl Check if linker supports version scripts
  431. dnl
  432. AC_MSG_CHECKING([if the linker supports version-scripts])
  433. save_LDFLAGS=$LDFLAGS
  434. LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
  435. cat > conftest.map <<EOF
  436. VERSION_1 {
  437. global:
  438. main;
  439. local:
  440. *;
  441. };
  442. EOF
  443. AC_LINK_IFELSE(
  444. [AC_LANG_SOURCE([int main() { return 0;}])],
  445. [have_ld_version_script=yes;AC_MSG_RESULT(yes)],
  446. [have_ld_version_script=no; AC_MSG_RESULT(no)])
  447. LDFLAGS=$save_LDFLAGS
  448. AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
  449. dnl
  450. dnl Check if linker supports dynamic list files
  451. dnl
  452. AC_MSG_CHECKING([if the linker supports --dynamic-list])
  453. save_LDFLAGS=$LDFLAGS
  454. LDFLAGS="$LDFLAGS -Wl,--dynamic-list=conftest.dyn"
  455. cat > conftest.dyn <<EOF
  456. {
  457. radeon_drm_winsys_create;
  458. };
  459. EOF
  460. AC_LINK_IFELSE(
  461. [AC_LANG_SOURCE([int main() { return 0;}])],
  462. [have_ld_dynamic_list=yes;AC_MSG_RESULT(yes)],
  463. [have_ld_dynamic_list=no; AC_MSG_RESULT(no)])
  464. LDFLAGS=$save_LDFLAGS
  465. AM_CONDITIONAL(HAVE_LD_DYNAMIC_LIST, test "$have_ld_dynamic_list" = "yes")
  466. dnl
  467. dnl compatibility symlinks
  468. dnl
  469. case "$host_os" in
  470. linux* )
  471. HAVE_COMPAT_SYMLINKS=yes ;;
  472. * )
  473. HAVE_COMPAT_SYMLINKS=no ;;
  474. esac
  475. AM_CONDITIONAL(HAVE_COMPAT_SYMLINKS, test "x$HAVE_COMPAT_SYMLINKS" = xyes)
  476. dnl
  477. dnl library names
  478. dnl
  479. dnl Unfortunately we need to do a few things that libtool can't help us with,
  480. dnl so we need some knowledge of shared library filenames:
  481. dnl
  482. dnl LIB_EXT is the extension used when creating symlinks for alternate
  483. dnl filenames for a shared library which will be dynamically loaded
  484. dnl
  485. dnl IMP_LIB_EXT is the extension used when checking for the presence of a
  486. dnl the file for a shared library we wish to link with
  487. dnl
  488. case "$host_os" in
  489. darwin* )
  490. LIB_EXT='dylib'
  491. IMP_LIB_EXT=$LIB_EXT
  492. ;;
  493. cygwin* )
  494. LIB_EXT='dll'
  495. IMP_LIB_EXT='dll.a'
  496. ;;
  497. aix* )
  498. LIB_EXT='a'
  499. IMP_LIB_EXT=$LIB_EXT
  500. ;;
  501. * )
  502. LIB_EXT='so'
  503. IMP_LIB_EXT=$LIB_EXT
  504. ;;
  505. esac
  506. AC_SUBST([LIB_EXT])
  507. AC_ARG_WITH([gl-lib-name],
  508. [AS_HELP_STRING([--with-gl-lib-name@<:@=NAME@:>@],
  509. [specify GL library name @<:@default=GL@:>@])],
  510. [GL_LIB=$withval],
  511. [GL_LIB=GL])
  512. AC_ARG_WITH([osmesa-lib-name],
  513. [AS_HELP_STRING([--with-osmesa-lib-name@<:@=NAME@:>@],
  514. [specify OSMesa library name @<:@default=OSMesa@:>@])],
  515. [OSMESA_LIB=$withval],
  516. [OSMESA_LIB=OSMesa])
  517. AS_IF([test "x$GL_LIB" = xyes], [GL_LIB=GL])
  518. AS_IF([test "x$OSMESA_LIB" = xyes], [OSMESA_LIB=OSMesa])
  519. dnl
  520. dnl Mangled Mesa support
  521. dnl
  522. AC_ARG_ENABLE([mangling],
  523. [AS_HELP_STRING([--enable-mangling],
  524. [enable mangled symbols and library name @<:@default=disabled@:>@])],
  525. [enable_mangling="${enableval}"],
  526. [enable_mangling=no]
  527. )
  528. if test "x${enable_mangling}" = "xyes" ; then
  529. DEFINES="${DEFINES} -DUSE_MGL_NAMESPACE"
  530. GL_LIB="Mangled${GL_LIB}"
  531. OSMESA_LIB="Mangled${OSMESA_LIB}"
  532. fi
  533. AC_SUBST([GL_LIB])
  534. AC_SUBST([OSMESA_LIB])
  535. dnl
  536. dnl potentially-infringing-but-nobody-knows-for-sure stuff
  537. dnl
  538. AC_ARG_ENABLE([texture-float],
  539. [AS_HELP_STRING([--enable-texture-float],
  540. [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
  541. [enable_texture_float="$enableval"],
  542. [enable_texture_float=no]
  543. )
  544. if test "x$enable_texture_float" = xyes; then
  545. AC_MSG_WARN([Floating-point textures enabled.])
  546. AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
  547. DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
  548. fi
  549. dnl
  550. dnl Arch/platform-specific settings
  551. dnl
  552. AC_ARG_ENABLE([asm],
  553. [AS_HELP_STRING([--disable-asm],
  554. [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
  555. [enable_asm="$enableval"],
  556. [enable_asm=yes]
  557. )
  558. asm_arch=""
  559. AC_MSG_CHECKING([whether to enable assembly])
  560. test "x$enable_asm" = xno && AC_MSG_RESULT([no])
  561. # disable if cross compiling on x86/x86_64 since we must run gen_matypes
  562. if test "x$enable_asm" = xyes -a "x$cross_compiling" = xyes; then
  563. case "$host_cpu" in
  564. i?86 | x86_64 | amd64)
  565. enable_asm=no
  566. AC_MSG_RESULT([no, cross compiling])
  567. ;;
  568. esac
  569. fi
  570. # check for supported arches
  571. if test "x$enable_asm" = xyes; then
  572. case "$host_cpu" in
  573. i?86)
  574. case "$host_os" in
  575. linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | gnu*)
  576. asm_arch=x86
  577. ;;
  578. esac
  579. ;;
  580. x86_64|amd64)
  581. case "$host_os" in
  582. linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
  583. asm_arch=x86_64
  584. ;;
  585. esac
  586. ;;
  587. sparc*)
  588. case "$host_os" in
  589. linux*)
  590. asm_arch=sparc
  591. ;;
  592. esac
  593. ;;
  594. esac
  595. case "$asm_arch" in
  596. x86)
  597. DEFINES="$DEFINES -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
  598. AC_MSG_RESULT([yes, x86])
  599. ;;
  600. x86_64|amd64)
  601. DEFINES="$DEFINES -DUSE_X86_64_ASM"
  602. AC_MSG_RESULT([yes, x86_64])
  603. ;;
  604. sparc)
  605. DEFINES="$DEFINES -DUSE_SPARC_ASM"
  606. AC_MSG_RESULT([yes, sparc])
  607. ;;
  608. *)
  609. AC_MSG_RESULT([no, platform not supported])
  610. ;;
  611. esac
  612. fi
  613. AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
  614. AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
  615. AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
  616. AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"])
  617. dnl Check to see if dlopen is in default libraries (like Solaris, which
  618. dnl has it in libc), or if libdl is needed to get it.
  619. AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
  620. [AC_CHECK_LIB([dl], [dlopen],
  621. [DEFINES="$DEFINES -DHAVE_DLOPEN"; DLOPEN_LIBS="-ldl"])])
  622. AC_SUBST([DLOPEN_LIBS])
  623. dnl Check if that library also has dladdr
  624. save_LIBS="$LIBS"
  625. LIBS="$LIBS $DLOPEN_LIBS"
  626. AC_CHECK_FUNCS([dladdr])
  627. LIBS="$save_LIBS"
  628. case "$host_os" in
  629. darwin*)
  630. ;;
  631. *)
  632. AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
  633. [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
  634. [AC_MSG_ERROR([Could not find clock_gettime])])])
  635. AC_SUBST([CLOCK_LIB])
  636. ;;
  637. esac
  638. dnl See if posix_memalign is available
  639. AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
  640. dnl Check for pthreads
  641. AX_PTHREAD
  642. if test "x$ax_pthread_ok" = xno; then
  643. AC_MSG_ERROR([Building mesa on this platform requires pthreads])
  644. fi
  645. dnl AX_PTHREADS leaves PTHREAD_LIBS empty for gcc and sets PTHREAD_CFLAGS
  646. dnl to -pthread, which causes problems if we need -lpthread to appear in
  647. dnl pkgconfig files.
  648. test -z "$PTHREAD_LIBS" && PTHREAD_LIBS="-lpthread"
  649. dnl SELinux awareness.
  650. AC_ARG_ENABLE([selinux],
  651. [AS_HELP_STRING([--enable-selinux],
  652. [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
  653. [MESA_SELINUX="$enableval"],
  654. [MESA_SELINUX=no])
  655. if test "x$enable_selinux" = "xyes"; then
  656. PKG_CHECK_MODULES([SELINUX], [libselinux], [],
  657. [AC_CHECK_HEADER([selinux/selinux.h],[],
  658. [AC_MSG_ERROR([SELinux headers not found])])
  659. AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
  660. [AC_MSG_ERROR([SELinux library not found])])
  661. SELINUX_LIBS="-lselinux"])
  662. DEFINES="$DEFINES -DMESA_SELINUX"
  663. fi
  664. AC_SUBST([SELINUX_CFLAGS])
  665. AC_SUBST([SELINUX_LIBS])
  666. dnl Options for APIs
  667. AC_ARG_ENABLE([opengl],
  668. [AS_HELP_STRING([--disable-opengl],
  669. [disable support for standard OpenGL API @<:@default=enabled@:>@])],
  670. [enable_opengl="$enableval"],
  671. [enable_opengl=yes])
  672. AC_ARG_ENABLE([gles1],
  673. [AS_HELP_STRING([--disable-gles1],
  674. [disable support for OpenGL ES 1.x API @<:@default=enabled@:>@])],
  675. [enable_gles1="$enableval"],
  676. [enable_gles1=yes])
  677. AC_ARG_ENABLE([gles2],
  678. [AS_HELP_STRING([--disable-gles2],
  679. [disable support for OpenGL ES 2.x API @<:@default=enabled@:>@])],
  680. [enable_gles2="$enableval"],
  681. [enable_gles2=yes])
  682. AC_ARG_ENABLE([dri],
  683. [AS_HELP_STRING([--enable-dri],
  684. [enable DRI modules @<:@default=enabled@:>@])],
  685. [enable_dri="$enableval"],
  686. [enable_dri=yes])
  687. case "$host_os" in
  688. linux*)
  689. dri3_default=yes
  690. ;;
  691. *)
  692. dri3_default=no
  693. ;;
  694. esac
  695. if test "x$enable_dri" = xno; then
  696. dri3_default=no
  697. fi
  698. AC_ARG_ENABLE([dri3],
  699. [AS_HELP_STRING([--enable-dri3],
  700. [enable DRI3 @<:@default=auto@:>@])],
  701. [enable_dri3="$enableval"],
  702. [enable_dri3="$dri3_default"])
  703. AC_ARG_ENABLE([glx],
  704. [AS_HELP_STRING([--enable-glx],
  705. [enable GLX library @<:@default=enabled@:>@])],
  706. [enable_glx="$enableval"],
  707. [enable_glx=yes])
  708. AC_ARG_ENABLE([osmesa],
  709. [AS_HELP_STRING([--enable-osmesa],
  710. [enable OSMesa library @<:@default=disabled@:>@])],
  711. [enable_osmesa="$enableval"],
  712. [enable_osmesa=no])
  713. AC_ARG_ENABLE([gallium-osmesa],
  714. [AS_HELP_STRING([--enable-gallium-osmesa],
  715. [enable Gallium implementation of the OSMesa library @<:@default=disabled@:>@])],
  716. [enable_gallium_osmesa="$enableval"],
  717. [enable_gallium_osmesa=no])
  718. AC_ARG_ENABLE([egl],
  719. [AS_HELP_STRING([--disable-egl],
  720. [disable EGL library @<:@default=enabled@:>@])],
  721. [enable_egl="$enableval"],
  722. [enable_egl=yes])
  723. AC_ARG_ENABLE([xa],
  724. [AS_HELP_STRING([--enable-xa],
  725. [enable build of the XA X Acceleration API @<:@default=disabled@:>@])],
  726. [enable_xa="$enableval"],
  727. [enable_xa=no])
  728. AC_ARG_ENABLE([gbm],
  729. [AS_HELP_STRING([--enable-gbm],
  730. [enable gbm library @<:@default=auto@:>@])],
  731. [enable_gbm="$enableval"],
  732. [enable_gbm=auto])
  733. AC_ARG_ENABLE([nine],
  734. [AS_HELP_STRING([--enable-nine],
  735. [enable build of the nine Direct3D9 API @<:@default=no@:>@])],
  736. [enable_nine="$enableval"],
  737. [enable_nine=no])
  738. AC_ARG_ENABLE([xvmc],
  739. [AS_HELP_STRING([--enable-xvmc],
  740. [enable xvmc library @<:@default=auto@:>@])],
  741. [enable_xvmc="$enableval"],
  742. [enable_xvmc=auto])
  743. AC_ARG_ENABLE([vdpau],
  744. [AS_HELP_STRING([--enable-vdpau],
  745. [enable vdpau library @<:@default=auto@:>@])],
  746. [enable_vdpau="$enableval"],
  747. [enable_vdpau=auto])
  748. AC_ARG_ENABLE([omx],
  749. [AS_HELP_STRING([--enable-omx],
  750. [enable OpenMAX library @<:@default=disabled@:>@])],
  751. [enable_omx="$enableval"],
  752. [enable_omx=no])
  753. AC_ARG_ENABLE([va],
  754. [AS_HELP_STRING([--enable-va],
  755. [enable va library @<:@default=auto@:>@])],
  756. [enable_va="$enableval"],
  757. [enable_va=auto])
  758. AC_ARG_ENABLE([opencl],
  759. [AS_HELP_STRING([--enable-opencl],
  760. [enable OpenCL library @<:@default=disabled@:>@])],
  761. [enable_opencl="$enableval"],
  762. [enable_opencl=no])
  763. AC_ARG_ENABLE([opencl_icd],
  764. [AS_HELP_STRING([--enable-opencl-icd],
  765. [Build an OpenCL ICD library to be loaded by an ICD implementation
  766. @<:@default=disabled@:>@])],
  767. [enable_opencl_icd="$enableval"],
  768. [enable_opencl_icd=no])
  769. AC_ARG_ENABLE([xlib-glx],
  770. [AS_HELP_STRING([--enable-xlib-glx],
  771. [make GLX library Xlib-based instead of DRI-based @<:@default=disabled@:>@])],
  772. [enable_xlib_glx="$enableval"],
  773. [enable_xlib_glx=no])
  774. AC_ARG_ENABLE([r600-llvm-compiler],
  775. [AS_HELP_STRING([--enable-r600-llvm-compiler],
  776. [Enable experimental LLVM backend for graphics shaders @<:@default=disabled@:>@])],
  777. [enable_r600_llvm="$enableval"],
  778. [enable_r600_llvm=no])
  779. AC_ARG_ENABLE([gallium-tests],
  780. [AS_HELP_STRING([--enable-gallium-tests],
  781. [Enable optional Gallium tests) @<:@default=disabled@:>@])],
  782. [enable_gallium_tests="$enableval"],
  783. [enable_gallium_tests=no])
  784. # Option for Gallium drivers
  785. # Keep this in sync with the --with-gallium-drivers help string default value
  786. GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
  787. AC_ARG_WITH([gallium-drivers],
  788. [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
  789. [comma delimited Gallium drivers list, e.g.
  790. "i915,ilo,nouveau,r300,r600,radeonsi,freedreno,svga,swrast,vc4,virgl"
  791. @<:@default=r300,r600,svga,swrast@:>@])],
  792. [with_gallium_drivers="$withval"],
  793. [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
  794. # Doing '--without-gallium-drivers' will set this variable to 'no'. Clear it
  795. # here so that the script doesn't choke on an unknown driver name later.
  796. case "$with_gallium_drivers" in
  797. yes) with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT" ;;
  798. no) with_gallium_drivers='' ;;
  799. esac
  800. if test "x$enable_opengl" = xno -a \
  801. "x$enable_gles1" = xno -a \
  802. "x$enable_gles2" = xno -a \
  803. "x$enable_nine" = xno -a \
  804. "x$enable_xa" = xno -a \
  805. "x$enable_xvmc" = xno -a \
  806. "x$enable_vdpau" = xno -a \
  807. "x$enable_omx" = xno -a \
  808. "x$enable_va" = xno -a \
  809. "x$enable_opencl" = xno; then
  810. AC_MSG_ERROR([at least one API should be enabled])
  811. fi
  812. # Building OpenGL ES1 and/or ES2 without OpenGL is not supported on mesa 9.0.x
  813. if test "x$enable_opengl" = xno -a \
  814. "x$enable_gles1" = xyes; then
  815. AC_MSG_ERROR([Building OpenGL ES1 without OpenGL is not supported])
  816. fi
  817. if test "x$enable_opengl" = xno -a \
  818. "x$enable_gles2" = xyes; then
  819. AC_MSG_ERROR([Building OpenGL ES2 without OpenGL is not supported])
  820. fi
  821. AM_CONDITIONAL(HAVE_OPENGL, test "x$enable_opengl" = xyes)
  822. AM_CONDITIONAL(HAVE_OPENGL_ES1, test "x$enable_gles1" = xyes)
  823. AM_CONDITIONAL(HAVE_OPENGL_ES2, test "x$enable_gles2" = xyes)
  824. AM_CONDITIONAL(NEED_OPENGL_COMMON, test "x$enable_opengl" = xyes -o \
  825. "x$enable_gles1" = xyes -o \
  826. "x$enable_gles2" = xyes)
  827. if test "x$enable_glx" = xno; then
  828. AC_MSG_WARN([GLX disabled, disabling Xlib-GLX])
  829. enable_xlib_glx=no
  830. fi
  831. if test "x$enable_dri$enable_xlib_glx" = xyesyes; then
  832. AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])
  833. fi
  834. if test "x$enable_opengl$enable_xlib_glx" = xnoyes; then
  835. AC_MSG_ERROR([Xlib-GLX cannot be built without OpenGL])
  836. fi
  837. # Disable GLX if OpenGL is not enabled
  838. if test "x$enable_glx$enable_opengl" = xyesno; then
  839. AC_MSG_WARN([OpenGL not enabled, disabling GLX])
  840. enable_glx=no
  841. fi
  842. # Disable GLX if DRI and Xlib-GLX are not enabled
  843. if test "x$enable_glx" = xyes -a \
  844. "x$enable_dri" = xno -a \
  845. "x$enable_xlib_glx" = xno; then
  846. AC_MSG_WARN([Neither DRI nor Xlib-GLX enabled, disabling GLX])
  847. enable_glx=no
  848. fi
  849. AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes -a \
  850. "x$enable_dri" = xyes)
  851. # Check for libdrm
  852. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
  853. [have_libdrm=yes], [have_libdrm=no])
  854. if test "x$have_libdrm" = xyes; then
  855. DEFINES="$DEFINES -DHAVE_LIBDRM"
  856. fi
  857. # Select which platform-dependent DRI code gets built
  858. case "$host_os" in
  859. darwin*)
  860. dri_platform='apple' ;;
  861. gnu*|cygwin*)
  862. dri_platform='none' ;;
  863. *)
  864. dri_platform='drm' ;;
  865. esac
  866. if test "x$enable_dri" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes; then
  867. have_drisw_kms='yes'
  868. fi
  869. AM_CONDITIONAL(HAVE_DRICOMMON, test "x$enable_dri" = xyes )
  870. AM_CONDITIONAL(HAVE_DRISW, test "x$enable_dri" = xyes )
  871. AM_CONDITIONAL(HAVE_DRISW_KMS, test "x$have_drisw_kms" = xyes )
  872. AM_CONDITIONAL(HAVE_DRI2, test "x$enable_dri" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes )
  873. AM_CONDITIONAL(HAVE_DRI3, test "x$enable_dri3" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes )
  874. AM_CONDITIONAL(HAVE_APPLEDRI, test "x$enable_dri" = xyes -a "x$dri_platform" = xapple )
  875. AC_ARG_ENABLE([shared-glapi],
  876. [AS_HELP_STRING([--enable-shared-glapi],
  877. [Enable shared glapi for OpenGL @<:@default=enabled@:>@])],
  878. [enable_shared_glapi="$enableval"],
  879. [enable_shared_glapi=yes])
  880. case "x$enable_opengl$enable_gles1$enable_gles2" in
  881. x*yes*yes*)
  882. if test "x$enable_shared_glapi" = xno; then
  883. AC_MSG_ERROR([shared GLAPI required when building two or more of
  884. the following APIs - opengl, gles1 gles2])
  885. fi
  886. ;;
  887. esac
  888. AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
  889. # Build the pipe-drivers as separate libraries/modules.
  890. # Do not touch this unless you know what you are doing.
  891. # XXX: Expose via configure option ?
  892. enable_shared_pipe_drivers=no
  893. dnl
  894. dnl Driver specific build directories
  895. dnl
  896. if test -n "$with_gallium_drivers" -a "x$enable_glx$enable_xlib_glx" = xyesyes; then
  897. NEED_WINSYS_XLIB="yes"
  898. fi
  899. if test "x$enable_gallium_osmesa" = xyes; then
  900. if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
  901. AC_MSG_ERROR([gallium_osmesa requires the gallium swrast driver])
  902. fi
  903. if test "x$enable_osmesa" = xyes; then
  904. AC_MSG_ERROR([Cannot enable both classic and Gallium OSMesa implementations])
  905. fi
  906. fi
  907. AC_SUBST([MESA_LLVM])
  908. # SHA1 hashing
  909. AC_ARG_WITH([sha1],
  910. [AS_HELP_STRING([--with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
  911. [choose SHA1 implementation])])
  912. case "x$with_sha1" in
  913. x | xlibc | xlibmd | xlibnettle | xlibgcrypt | xlibcrypto | xlibsha1 | xCommonCrypto | xCryptoAPI)
  914. ;;
  915. *)
  916. AC_MSG_ERROR([Illegal value for --with-sha1: $with_sha1])
  917. esac
  918. AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
  919. if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
  920. with_sha1=libc
  921. fi
  922. if test "x$with_sha1" = xlibc && test "x$HAVE_SHA1_IN_LIBC" != xyes; then
  923. AC_MSG_ERROR([sha1 in libc requested but not found])
  924. fi
  925. if test "x$with_sha1" = xlibc; then
  926. AC_DEFINE([HAVE_SHA1_IN_LIBC], [1],
  927. [Use libc SHA1 functions])
  928. SHA1_LIBS=""
  929. fi
  930. AC_CHECK_FUNC([CC_SHA1_Init], [HAVE_SHA1_IN_COMMONCRYPTO=yes])
  931. if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_COMMONCRYPTO" = xyes; then
  932. with_sha1=CommonCrypto
  933. fi
  934. if test "x$with_sha1" = xCommonCrypto && test "x$HAVE_SHA1_IN_COMMONCRYPTO" != xyes; then
  935. AC_MSG_ERROR([CommonCrypto requested but not found])
  936. fi
  937. if test "x$with_sha1" = xCommonCrypto; then
  938. AC_DEFINE([HAVE_SHA1_IN_COMMONCRYPTO], [1],
  939. [Use CommonCrypto SHA1 functions])
  940. SHA1_LIBS=""
  941. fi
  942. dnl stdcall functions cannot be tested with AC_CHECK_LIB
  943. AC_CHECK_HEADER([wincrypt.h], [HAVE_SHA1_IN_CRYPTOAPI=yes], [], [#include <windows.h>])
  944. if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_CRYPTOAPI" = xyes; then
  945. with_sha1=CryptoAPI
  946. fi
  947. if test "x$with_sha1" = xCryptoAPI && test "x$HAVE_SHA1_IN_CRYPTOAPI" != xyes; then
  948. AC_MSG_ERROR([CryptoAPI requested but not found])
  949. fi
  950. if test "x$with_sha1" = xCryptoAPI; then
  951. AC_DEFINE([HAVE_SHA1_IN_CRYPTOAPI], [1],
  952. [Use CryptoAPI SHA1 functions])
  953. SHA1_LIBS=""
  954. fi
  955. AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes])
  956. if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then
  957. with_sha1=libmd
  958. fi
  959. if test "x$with_sha1" = xlibmd && test "x$HAVE_LIBMD" != xyes; then
  960. AC_MSG_ERROR([libmd requested but not found])
  961. fi
  962. if test "x$with_sha1" = xlibmd; then
  963. AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
  964. [Use libmd SHA1 functions])
  965. SHA1_LIBS=-lmd
  966. fi
  967. PKG_CHECK_MODULES([LIBSHA1], [libsha1], [HAVE_LIBSHA1=yes], [HAVE_LIBSHA1=no])
  968. if test "x$with_sha1" = x && test "x$HAVE_LIBSHA1" = xyes; then
  969. with_sha1=libsha1
  970. fi
  971. if test "x$with_sha1" = xlibsha1 && test "x$HAVE_LIBSHA1" != xyes; then
  972. AC_MSG_ERROR([libsha1 requested but not found])
  973. fi
  974. if test "x$with_sha1" = xlibsha1; then
  975. AC_DEFINE([HAVE_SHA1_IN_LIBSHA1], [1],
  976. [Use libsha1 for SHA1])
  977. SHA1_LIBS=-lsha1
  978. fi
  979. AC_CHECK_LIB([nettle], [nettle_sha1_init], [HAVE_LIBNETTLE=yes])
  980. if test "x$with_sha1" = x && test "x$HAVE_LIBNETTLE" = xyes; then
  981. with_sha1=libnettle
  982. fi
  983. if test "x$with_sha1" = xlibnettle && test "x$HAVE_LIBNETTLE" != xyes; then
  984. AC_MSG_ERROR([libnettle requested but not found])
  985. fi
  986. if test "x$with_sha1" = xlibnettle; then
  987. AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1],
  988. [Use libnettle SHA1 functions])
  989. SHA1_LIBS=-lnettle
  990. fi
  991. AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
  992. if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
  993. with_sha1=libgcrypt
  994. fi
  995. if test "x$with_sha1" = xlibgcrypt && test "x$HAVE_LIBGCRYPT" != xyes; then
  996. AC_MSG_ERROR([libgcrypt requested but not found])
  997. fi
  998. if test "x$with_sha1" = xlibgcrypt; then
  999. AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1],
  1000. [Use libgcrypt SHA1 functions])
  1001. SHA1_LIBS=-lgcrypt
  1002. fi
  1003. # We don't need all of the OpenSSL libraries, just libcrypto
  1004. AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes])
  1005. PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
  1006. [HAVE_OPENSSL_PKC=no])
  1007. if test "x$HAVE_LIBCRYPTO" = xyes || test "x$HAVE_OPENSSL_PKC" = xyes; then
  1008. if test "x$with_sha1" = x; then
  1009. with_sha1=libcrypto
  1010. fi
  1011. else
  1012. if test "x$with_sha1" = xlibcrypto; then
  1013. AC_MSG_ERROR([OpenSSL libcrypto requested but not found])
  1014. fi
  1015. fi
  1016. if test "x$with_sha1" = xlibcrypto; then
  1017. if test "x$HAVE_LIBCRYPTO" = xyes; then
  1018. SHA1_LIBS=-lcrypto
  1019. else
  1020. SHA1_LIBS="$OPENSSL_LIBS"
  1021. SHA1_CFLAGS="$OPENSSL_CFLAGS"
  1022. fi
  1023. fi
  1024. AC_MSG_CHECKING([for SHA1 implementation])
  1025. AC_MSG_RESULT([$with_sha1])
  1026. AC_SUBST(SHA1_LIBS)
  1027. AC_SUBST(SHA1_CFLAGS)
  1028. # Enable a define for SHA1
  1029. if test "x$with_sha1" != "x"; then
  1030. DEFINES="$DEFINES -DHAVE_SHA1"
  1031. fi
  1032. # Allow user to configure out the shader-cache feature
  1033. AC_ARG_ENABLE([shader-cache],
  1034. AS_HELP_STRING([--disable-shader-cache], [Disable binary shader cache]),
  1035. [enable_shader_cache="$enableval"],
  1036. [if test "x$with_sha1" != "x"; then
  1037. enable_shader_cache=yes
  1038. else
  1039. enable_shader_cache=no
  1040. fi])
  1041. if test "x$with_sha1" = "x"; then
  1042. if test "x$enable_shader_cache" = "xyes"; then
  1043. AC_MSG_ERROR([Cannot enable shader cache (no SHA-1 implementation found)])
  1044. fi
  1045. fi
  1046. AM_CONDITIONAL([ENABLE_SHADER_CACHE], [test x$enable_shader_cache = xyes])
  1047. case "$host_os" in
  1048. linux*)
  1049. need_pci_id=yes ;;
  1050. *)
  1051. need_pci_id=no ;;
  1052. esac
  1053. PKG_CHECK_MODULES([LIBUDEV], [libudev >= $LIBUDEV_REQUIRED],
  1054. have_libudev=yes, have_libudev=no)
  1055. AC_ARG_ENABLE([sysfs],
  1056. [AS_HELP_STRING([--enable-sysfs],
  1057. [enable /sys PCI identification @<:@default=disabled@:>@])],
  1058. [have_sysfs="$enableval"],
  1059. [have_sysfs=no]
  1060. )
  1061. if test "x$enable_dri" = xyes; then
  1062. if test "$enable_static" = yes; then
  1063. AC_MSG_ERROR([Cannot use static libraries for DRI drivers])
  1064. fi
  1065. # not a hard requirement as swrast does not depend on it
  1066. if test "x$have_libdrm" = xyes; then
  1067. DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
  1068. fi
  1069. fi
  1070. AC_ARG_ENABLE([driglx-direct],
  1071. [AS_HELP_STRING([--disable-driglx-direct],
  1072. [disable direct rendering in GLX and EGL for DRI \
  1073. @<:@default=auto@:>@])],
  1074. [driglx_direct="$enableval"],
  1075. [driglx_direct="yes"])
  1076. dnl
  1077. dnl libGL configuration per driver
  1078. dnl
  1079. case "x$enable_glx$enable_xlib_glx" in
  1080. xyesyes)
  1081. # Xlib-based GLX
  1082. dri_modules="x11 xext xcb"
  1083. PKG_CHECK_MODULES([XLIBGL], [$dri_modules])
  1084. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  1085. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  1086. GL_LIB_DEPS="$XLIBGL_LIBS"
  1087. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1088. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm $PTHREAD_LIBS"
  1089. ;;
  1090. xyesno)
  1091. # DRI-based GLX
  1092. PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
  1093. # find the DRI deps for libGL
  1094. dri_modules="x11 xext xdamage xfixes x11-xcb xcb xcb-glx >= $XCBGLX_REQUIRED"
  1095. if test x"$driglx_direct" = xyes; then
  1096. if test x"$dri_platform" = xdrm ; then
  1097. DEFINES="$DEFINES -DGLX_USE_DRM"
  1098. if test "x$have_libdrm" != xyes; then
  1099. AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
  1100. fi
  1101. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  1102. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
  1103. if test x"$enable_dri3" = xyes; then
  1104. PKG_CHECK_MODULES([DRI3PROTO], [dri3proto >= $DRI3PROTO_REQUIRED])
  1105. PKG_CHECK_MODULES([PRESENTPROTO], [presentproto >= $PRESENTPROTO_REQUIRED])
  1106. fi
  1107. if test x"$enable_dri" = xyes; then
  1108. dri_modules="$dri_modules xcb-dri2 >= $XCBDRI2_REQUIRED"
  1109. fi
  1110. if test x"$enable_dri3" = xyes; then
  1111. PKG_CHECK_EXISTS([xcb >= $XCB_REQUIRED], [], AC_MSG_ERROR([DRI3 requires xcb >= $XCB_REQUIRED]))
  1112. dri3_modules="xcb-dri3 xcb-present xcb-sync xshmfence >= $XSHMFENCE_REQUIRED"
  1113. PKG_CHECK_MODULES([XCB_DRI3], [$dri3_modules])
  1114. fi
  1115. fi
  1116. if test x"$dri_platform" = xapple ; then
  1117. DEFINES="$DEFINES -DGLX_USE_APPLEGL"
  1118. fi
  1119. fi
  1120. # add xf86vidmode if available
  1121. PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
  1122. if test "$HAVE_XF86VIDMODE" = yes ; then
  1123. dri_modules="$dri_modules xxf86vm"
  1124. fi
  1125. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  1126. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  1127. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  1128. GL_LIB_DEPS="$DRIGL_LIBS"
  1129. # need DRM libs, $PTHREAD_LIBS, etc.
  1130. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1131. GL_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1132. ;;
  1133. esac
  1134. have_pci_id=no
  1135. if test "$have_libudev" = yes; then
  1136. DEFINES="$DEFINES -DHAVE_LIBUDEV"
  1137. have_pci_id=yes
  1138. fi
  1139. if test "$have_sysfs" = yes; then
  1140. DEFINES="$DEFINES -DHAVE_SYSFS"
  1141. have_pci_id=yes
  1142. fi
  1143. # This is outside the case (above) so that it is invoked even for non-GLX
  1144. # builds.
  1145. AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
  1146. GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1147. GLESv1_CM_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1148. GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1149. GLESv2_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1150. AC_SUBST([X11_INCLUDES])
  1151. AC_SUBST([GL_LIB_DEPS])
  1152. AC_SUBST([GL_PC_REQ_PRIV])
  1153. AC_SUBST([GL_PC_LIB_PRIV])
  1154. AC_SUBST([GL_PC_CFLAGS])
  1155. AC_SUBST([DRI_PC_REQ_PRIV])
  1156. AC_SUBST([GLESv1_CM_LIB_DEPS])
  1157. AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
  1158. AC_SUBST([GLESv2_LIB_DEPS])
  1159. AC_SUBST([GLESv2_PC_LIB_PRIV])
  1160. AC_SUBST([HAVE_XF86VIDMODE])
  1161. dnl
  1162. dnl More GLX setup
  1163. dnl
  1164. case "x$enable_glx$enable_xlib_glx" in
  1165. xyesyes)
  1166. DEFINES="$DEFINES -DUSE_XSHM"
  1167. ;;
  1168. xyesno)
  1169. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  1170. if test "x$driglx_direct" = xyes; then
  1171. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  1172. fi
  1173. ;;
  1174. esac
  1175. dnl
  1176. dnl TLS detection
  1177. dnl
  1178. AC_ARG_ENABLE([glx-tls],
  1179. [AS_HELP_STRING([--enable-glx-tls],
  1180. [enable TLS support in GLX @<:@default=disabled@:>@])],
  1181. [GLX_USE_TLS="$enableval"],
  1182. [GLX_USE_TLS=no])
  1183. AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
  1184. AS_IF([test "x$GLX_USE_TLS" = xyes -a "x$ax_pthread_ok" = xyes],
  1185. [DEFINES="${DEFINES} -DGLX_USE_TLS"])
  1186. dnl Read-only text section on x86 hardened platforms
  1187. AC_ARG_ENABLE([glx-read-only-text],
  1188. [AS_HELP_STRING([--enable-glx-read-only-text],
  1189. [Disable writable .text section on x86 (decreases performance) @<:@default=disabled@:>@])],
  1190. [enable_glx_read_only_text="$enableval"],
  1191. [enable_glx_read_only_text=no])
  1192. if test "x$enable_glx_read_only_text" = xyes; then
  1193. DEFINES="$DEFINES -DGLX_X86_READONLY_TEXT"
  1194. fi
  1195. dnl
  1196. dnl More DRI setup
  1197. dnl
  1198. dnl Directory for DRI drivers
  1199. AC_ARG_WITH([dri-driverdir],
  1200. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  1201. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  1202. [DRI_DRIVER_INSTALL_DIR="$withval"],
  1203. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  1204. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  1205. dnl Extra search path for DRI drivers
  1206. AC_ARG_WITH([dri-searchpath],
  1207. [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
  1208. [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
  1209. [DRI_DRIVER_SEARCH_DIR="$withval"],
  1210. [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
  1211. AC_SUBST([DRI_DRIVER_SEARCH_DIR])
  1212. dnl Which drivers to build - default is chosen by platform
  1213. AC_ARG_WITH([dri-drivers],
  1214. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  1215. [comma delimited classic DRI drivers list, e.g.
  1216. "swrast,i965,radeon" @<:@default=auto@:>@])],
  1217. [with_dri_drivers="$withval"],
  1218. [with_dri_drivers=auto])
  1219. if test "x$with_dri_drivers" = xauto; then
  1220. if test "x$enable_opengl" = xyes -a "x$enable_dri" = xyes; then
  1221. with_dri_drivers="yes"
  1222. else
  1223. with_dri_drivers="no"
  1224. fi
  1225. fi
  1226. if test "x$with_dri_drivers" = xno; then
  1227. with_dri_drivers=''
  1228. fi
  1229. dnl If $with_dri_drivers is yes, drivers will be added through
  1230. dnl platform checks. Set DEFINES and LIB_DEPS
  1231. if test "x$enable_dri" = xyes; then
  1232. # Platform specific settings and drivers to build
  1233. case "$host_os" in
  1234. linux*)
  1235. DEFINES="$DEFINES -DHAVE_ALIAS"
  1236. if test "x$enable_dri3" = xyes; then
  1237. DEFINES="$DEFINES -DHAVE_DRI3"
  1238. fi
  1239. if test "x$have_pci_id" != xyes; then
  1240. AC_MSG_ERROR([libudev-dev or sysfs required for building DRI])
  1241. fi
  1242. case "$host_cpu" in
  1243. powerpc* | sparc*)
  1244. # Build only the drivers for cards that exist on PowerPC/sparc
  1245. if test "x$with_dri_drivers" = "xyes"; then
  1246. with_dri_drivers="r200 radeon swrast"
  1247. fi
  1248. ;;
  1249. esac
  1250. ;;
  1251. *freebsd* | dragonfly* | *netbsd* | openbsd*)
  1252. DEFINES="$DEFINES -DHAVE_ALIAS"
  1253. ;;
  1254. gnu*)
  1255. DEFINES="$DEFINES -DHAVE_ALIAS"
  1256. ;;
  1257. cygwin*)
  1258. if test "x$with_dri_drivers" = "xyes"; then
  1259. with_dri_drivers="swrast"
  1260. fi
  1261. ;;
  1262. darwin*)
  1263. DEFINES="$DEFINES -DGLX_ALIAS_UNSUPPORTED -DBUILDING_MESA"
  1264. if test "x$with_dri_drivers" = "xyes"; then
  1265. with_dri_drivers="swrast"
  1266. fi
  1267. ;;
  1268. esac
  1269. # default drivers
  1270. if test "x$with_dri_drivers" = "xyes"; then
  1271. with_dri_drivers="i915 i965 nouveau r200 radeon swrast"
  1272. fi
  1273. # Check for expat
  1274. PKG_CHECK_MODULES([EXPAT], [expat], [],
  1275. # expat version 2.0 and earlier do not provide expat.pc
  1276. [AC_CHECK_HEADER([expat.h],[],
  1277. [AC_MSG_ERROR([Expat headers required for DRI not found])])
  1278. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  1279. [AC_MSG_ERROR([Expat library required for DRI not found])])
  1280. EXPAT_LIBS="-lexpat"])
  1281. # put all the necessary libs together
  1282. DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
  1283. fi
  1284. AC_SUBST([DRI_LIB_DEPS])
  1285. DRI_DIRS=''
  1286. dnl Duplicates in DRI_DIRS are removed by sorting it at the end of this block
  1287. if test -n "$with_dri_drivers"; then
  1288. if test "x$enable_opengl" != xyes; then
  1289. AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
  1290. fi
  1291. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  1292. for driver in $dri_drivers; do
  1293. DRI_DIRS="$DRI_DIRS $driver"
  1294. case "x$driver" in
  1295. xi915)
  1296. HAVE_I915_DRI=yes;
  1297. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1298. ;;
  1299. xi965)
  1300. HAVE_I965_DRI=yes;
  1301. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1302. ;;
  1303. xnouveau)
  1304. HAVE_NOUVEAU_DRI=yes;
  1305. PKG_CHECK_MODULES([NVVIEUX], [libdrm_nouveau >= $LIBDRM_NVVIEUX_REQUIRED])
  1306. ;;
  1307. xradeon)
  1308. HAVE_RADEON_DRI=yes;
  1309. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1310. ;;
  1311. xr200)
  1312. HAVE_R200_DRI=yes;
  1313. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1314. ;;
  1315. xswrast)
  1316. HAVE_SWRAST_DRI=yes;
  1317. ;;
  1318. *)
  1319. AC_MSG_ERROR([classic DRI driver '$driver' does not exist])
  1320. ;;
  1321. esac
  1322. done
  1323. DRI_DIRS=`echo $DRI_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
  1324. fi
  1325. AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")
  1326. AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
  1327. "x$enable_osmesa" = xyes -o \
  1328. -n "$DRI_DIRS")
  1329. dnl
  1330. dnl OSMesa configuration
  1331. dnl
  1332. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  1333. AC_ARG_WITH([osmesa-bits],
  1334. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  1335. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  1336. [osmesa_bits="$withval"],
  1337. [osmesa_bits=8])
  1338. if test "x$osmesa_bits" != x8; then
  1339. if test "x$enable_dri" = xyes -o "x$enable_glx" = xyes; then
  1340. AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa driver])
  1341. osmesa_bits=8
  1342. fi
  1343. fi
  1344. case "x$osmesa_bits" in
  1345. x8)
  1346. OSMESA_LIB="${OSMESA_LIB}"
  1347. ;;
  1348. x16|x32)
  1349. OSMESA_LIB="${OSMESA_LIB}$osmesa_bits"
  1350. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  1351. ;;
  1352. *)
  1353. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  1354. ;;
  1355. esac
  1356. if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then
  1357. # only link libraries with osmesa if shared
  1358. if test "$enable_static" = no; then
  1359. OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
  1360. else
  1361. OSMESA_LIB_DEPS=""
  1362. fi
  1363. OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
  1364. fi
  1365. AC_SUBST([OSMESA_LIB_DEPS])
  1366. AC_SUBST([OSMESA_PC_REQ])
  1367. AC_SUBST([OSMESA_PC_LIB_PRIV])
  1368. dnl
  1369. dnl gbm configuration
  1370. dnl
  1371. if test "x$enable_gbm" = xauto; then
  1372. case "$with_egl_platforms" in
  1373. *drm*)
  1374. enable_gbm=yes ;;
  1375. *)
  1376. enable_gbm=no ;;
  1377. esac
  1378. fi
  1379. if test "x$enable_gbm" = xyes; then
  1380. if test "x$need_pci_id$have_pci_id" = xyesno; then
  1381. AC_MSG_ERROR([gbm requires udev >= $LIBUDEV_REQUIRED or sysfs])
  1382. fi
  1383. if test "x$enable_dri" = xyes; then
  1384. if test "x$enable_shared_glapi" = xno; then
  1385. AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
  1386. fi
  1387. else
  1388. # Strictly speaking libgbm does not require --enable-dri, although
  1389. # both of its backends do. Thus one can build libgbm without any
  1390. # backends if --disable-dri is set.
  1391. # To avoid unnecessary complexity of checking if at least one backend
  1392. # is available when building, just mandate --enable-dri.
  1393. AC_MSG_ERROR([gbm requires --enable-dri])
  1394. fi
  1395. fi
  1396. AM_CONDITIONAL(HAVE_GBM, test "x$enable_gbm" = xyes)
  1397. if test "x$need_pci_id$have_libudev" = xyesyes; then
  1398. GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED"
  1399. else
  1400. GBM_PC_REQ_PRIV=""
  1401. fi
  1402. GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
  1403. AC_SUBST([GBM_PC_REQ_PRIV])
  1404. AC_SUBST([GBM_PC_LIB_PRIV])
  1405. dnl
  1406. dnl EGL configuration
  1407. dnl
  1408. EGL_CLIENT_APIS=""
  1409. if test "x$enable_egl" = xyes; then
  1410. EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS $PTHREAD_LIBS"
  1411. AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
  1412. if test "$enable_static" != yes; then
  1413. if test "x$enable_dri" = xyes; then
  1414. HAVE_EGL_DRIVER_DRI2=1
  1415. if test "x$enable_shared_glapi" = xno; then
  1416. AC_MSG_ERROR([egl_dri2 requires --enable-shared-glapi])
  1417. fi
  1418. if test "x$enable_dri3" = xyes; then
  1419. HAVE_EGL_DRIVER_DRI3=1
  1420. if test "x$enable_shared_glapi" = xno; then
  1421. AC_MSG_ERROR([egl_dri3 requires --enable-shared-glapi])
  1422. fi
  1423. fi
  1424. else
  1425. # Avoid building an "empty" libEGL. Drop/update this
  1426. # when other backends (haiku?) come along.
  1427. AC_MSG_ERROR([egl requires --enable-dri])
  1428. fi
  1429. fi
  1430. fi
  1431. AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes)
  1432. AC_SUBST([EGL_LIB_DEPS])
  1433. gallium_st="mesa"
  1434. dnl
  1435. dnl XA configuration
  1436. dnl
  1437. if test "x$enable_xa" = xyes; then
  1438. if test "x$with_gallium_drivers" = xswrast; then
  1439. AC_MSG_ERROR([
  1440. Building xa requires at least one non swrast gallium driver.
  1441. If you are looking to use libxatracker.so with the VMware driver,
  1442. make sure to include svga in the gallium drivers list, apart from
  1443. enabling XA.
  1444. Example: ./configure --enable-xa --with-gallium-drivers=svga...])
  1445. fi
  1446. gallium_st="$gallium_st xa"
  1447. fi
  1448. AM_CONDITIONAL(HAVE_ST_XA, test "x$enable_xa" = xyes)
  1449. dnl
  1450. dnl Gallium G3DVL configuration
  1451. dnl
  1452. if test -n "$with_gallium_drivers" -a "x$with_gallium_drivers" != xswrast; then
  1453. if test "x$enable_xvmc" = xauto; then
  1454. PKG_CHECK_EXISTS([xvmc >= $XVMC_REQUIRED], [enable_xvmc=yes], [enable_xvmc=no])
  1455. fi
  1456. if test "x$enable_vdpau" = xauto; then
  1457. PKG_CHECK_EXISTS([vdpau >= $VDPAU_REQUIRED], [enable_vdpau=yes], [enable_vdpau=no])
  1458. fi
  1459. if test "x$enable_omx" = xauto; then
  1460. PKG_CHECK_EXISTS([libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED], [enable_omx=yes], [enable_omx=no])
  1461. fi
  1462. if test "x$enable_va" = xauto; then
  1463. PKG_CHECK_EXISTS([libva >= $LIBVA_REQUIRED], [enable_va=yes], [enable_va=no])
  1464. fi
  1465. fi
  1466. if test "x$enable_dri" = xyes -o \
  1467. "x$enable_xvmc" = xyes -o \
  1468. "x$enable_vdpau" = xyes -o \
  1469. "x$enable_omx" = xyes -o \
  1470. "x$enable_va" = xyes; then
  1471. need_gallium_vl=yes
  1472. fi
  1473. AM_CONDITIONAL(NEED_GALLIUM_VL, test "x$need_gallium_vl" = xyes)
  1474. if test "x$enable_xvmc" = xyes -o \
  1475. "x$enable_vdpau" = xyes -o \
  1476. "x$enable_omx" = xyes -o \
  1477. "x$enable_va" = xyes; then
  1478. PKG_CHECK_MODULES([VL], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED])
  1479. need_gallium_vl_winsys=yes
  1480. fi
  1481. AM_CONDITIONAL(NEED_GALLIUM_VL_WINSYS, test "x$need_gallium_vl_winsys" = xyes)
  1482. if test "x$enable_xvmc" = xyes; then
  1483. PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED])
  1484. gallium_st="$gallium_st xvmc"
  1485. fi
  1486. AM_CONDITIONAL(HAVE_ST_XVMC, test "x$enable_xvmc" = xyes)
  1487. if test "x$enable_vdpau" = xyes; then
  1488. PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED])
  1489. gallium_st="$gallium_st vdpau"
  1490. fi
  1491. AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes)
  1492. if test "x$enable_omx" = xyes; then
  1493. PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED])
  1494. gallium_st="$gallium_st omx"
  1495. fi
  1496. AM_CONDITIONAL(HAVE_ST_OMX, test "x$enable_omx" = xyes)
  1497. if test "x$enable_va" = xyes; then
  1498. PKG_CHECK_MODULES([VA], [libva >= $LIBVA_REQUIRED])
  1499. gallium_st="$gallium_st va"
  1500. fi
  1501. AM_CONDITIONAL(HAVE_ST_VA, test "x$enable_va" = xyes)
  1502. dnl
  1503. dnl Nine Direct3D9 configuration
  1504. dnl
  1505. if test "x$enable_nine" = xyes; then
  1506. if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
  1507. AC_MSG_ERROR([nine requires the gallium swrast driver])
  1508. fi
  1509. if test "x$with_gallium_drivers" = xswrast; then
  1510. AC_MSG_ERROR([nine requires at least one non-swrast gallium driver])
  1511. fi
  1512. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 6; then
  1513. AC_MSG_ERROR([gcc >= 4.6 is required to build nine])
  1514. fi
  1515. if test "x$enable_dri3" = xno; then
  1516. AC_MSG_WARN([using nine together with wine requires DRI3 enabled system])
  1517. fi
  1518. gallium_st="$gallium_st nine"
  1519. fi
  1520. AM_CONDITIONAL(HAVE_ST_NINE, test "x$enable_nine" = xyes)
  1521. dnl
  1522. dnl OpenCL configuration
  1523. dnl
  1524. AC_ARG_WITH([clang-libdir],
  1525. [AS_HELP_STRING([--with-clang-libdir],
  1526. [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
  1527. [CLANG_LIBDIR="$withval"],
  1528. [CLANG_LIBDIR=''])
  1529. PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
  1530. PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
  1531. if test "x$have_libelf" = xno; then
  1532. LIBELF_LIBS=''
  1533. LIBELF_CFLAGS=''
  1534. AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;LIBELF_LIBS=-lelf], [have_libelf=no])
  1535. AC_SUBST([LIBELF_LIBS])
  1536. AC_SUBST([LIBELF_CFLAGS])
  1537. fi
  1538. if test "x$enable_opencl" = xyes; then
  1539. if test -z "$with_gallium_drivers"; then
  1540. AC_MSG_ERROR([cannot enable OpenCL without Gallium])
  1541. fi
  1542. if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 7; then
  1543. AC_MSG_ERROR([gcc >= 4.7 is required to build clover])
  1544. fi
  1545. if test "x$have_libclc" = xno; then
  1546. AC_MSG_ERROR([pkg-config cannot find libclc.pc which is required to build clover.
  1547. Make sure the directory containing libclc.pc is specified in your
  1548. PKG_CONFIG_PATH environment variable.
  1549. By default libclc.pc is installed to /usr/local/share/pkgconfig/])
  1550. else
  1551. LIBCLC_INCLUDEDIR=`$PKG_CONFIG --variable=includedir libclc`
  1552. LIBCLC_LIBEXECDIR=`$PKG_CONFIG --variable=libexecdir libclc`
  1553. AC_SUBST([LIBCLC_INCLUDEDIR])
  1554. AC_SUBST([LIBCLC_LIBEXECDIR])
  1555. fi
  1556. gallium_st="$gallium_st clover"
  1557. if test "x$enable_opencl_icd" = xyes; then
  1558. OPENCL_LIBNAME="MesaOpenCL"
  1559. else
  1560. OPENCL_LIBNAME="OpenCL"
  1561. fi
  1562. if test "x$have_libelf" != xyes; then
  1563. AC_MSG_ERROR([Clover requires libelf])
  1564. fi
  1565. fi
  1566. AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
  1567. AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
  1568. AC_SUBST([OPENCL_LIBNAME])
  1569. dnl
  1570. dnl Gallium configuration
  1571. dnl
  1572. AM_CONDITIONAL(HAVE_GALLIUM, test -n "$with_gallium_drivers")
  1573. AC_SUBST([LLVM_BINDIR])
  1574. AC_SUBST([LLVM_CFLAGS])
  1575. AC_SUBST([LLVM_CPPFLAGS])
  1576. AC_SUBST([LLVM_CXXFLAGS])
  1577. AC_SUBST([LLVM_LIBDIR])
  1578. AC_SUBST([LLVM_LIBS])
  1579. AC_SUBST([LLVM_LDFLAGS])
  1580. AC_SUBST([LLVM_INCLUDEDIR])
  1581. AC_SUBST([LLVM_VERSION])
  1582. AC_SUBST([CLANG_RESOURCE_DIR])
  1583. case "x$enable_opengl$enable_gles1$enable_gles2" in
  1584. x*yes*)
  1585. EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
  1586. ;;
  1587. esac
  1588. AC_SUBST([VG_LIB_DEPS])
  1589. AC_SUBST([EGL_CLIENT_APIS])
  1590. dnl
  1591. dnl EGL Platforms configuration
  1592. dnl
  1593. AC_ARG_WITH([egl-platforms],
  1594. [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
  1595. [comma delimited native platforms libEGL supports, e.g.
  1596. "x11,drm" @<:@default=auto@:>@])],
  1597. [with_egl_platforms="$withval"],
  1598. [if test "x$enable_egl" = xyes; then
  1599. with_egl_platforms="x11"
  1600. else
  1601. with_egl_platforms=""
  1602. fi])
  1603. if test "x$with_egl_platforms" != "x" -a "x$enable_egl" != xyes; then
  1604. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1605. fi
  1606. PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland_scanner],
  1607. WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland_scanner`,
  1608. WAYLAND_SCANNER='')
  1609. if test "x$WAYLAND_SCANNER" = x; then
  1610. AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner])
  1611. fi
  1612. # Do per-EGL platform setups and checks
  1613. egl_platforms=`IFS=', '; echo $with_egl_platforms`
  1614. for plat in $egl_platforms; do
  1615. case "$plat" in
  1616. wayland)
  1617. test "x$have_libdrm" != xyes &&
  1618. AC_MSG_ERROR([EGL platform wayland requires libdrm >= $LIBDRM_REQUIRED])
  1619. PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED wayland-server >= $WAYLAND_REQUIRED])
  1620. if test "x$WAYLAND_SCANNER" = x; then
  1621. AC_MSG_ERROR([wayland-scanner is needed to compile the wayland egl platform])
  1622. fi
  1623. ;;
  1624. x11)
  1625. PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED xcb-xfixes])
  1626. ;;
  1627. drm)
  1628. test "x$enable_gbm" = "xno" &&
  1629. AC_MSG_ERROR([EGL platform drm needs gbm])
  1630. test "x$have_libdrm" != xyes &&
  1631. AC_MSG_ERROR([EGL platform drm requires libdrm >= $LIBDRM_REQUIRED])
  1632. ;;
  1633. surfaceless)
  1634. test "x$have_libdrm" != xyes &&
  1635. AC_MSG_ERROR([EGL platform surfaceless requires libdrm >= $LIBDRM_REQUIRED])
  1636. ;;
  1637. *)
  1638. AC_MSG_ERROR([EGL platform '$plat' does not exist])
  1639. ;;
  1640. esac
  1641. case "$plat$need_pci_id$have_pci_id" in
  1642. waylandyesno|drmyesno)
  1643. AC_MSG_ERROR([cannot build $plat platform without udev >= $LIBUDEV_REQUIRED or sysfs]) ;;
  1644. esac
  1645. done
  1646. # libEGL wants to default to the first platform specified in
  1647. # ./configure. parse that here.
  1648. if test "x$egl_platforms" != "x"; then
  1649. FIRST_PLATFORM_CAPS=`echo $egl_platforms | sed 's| .*||' | tr '[[a-z]]' '[[A-Z]]'`
  1650. EGL_NATIVE_PLATFORM="_EGL_PLATFORM_$FIRST_PLATFORM_CAPS"
  1651. else
  1652. EGL_NATIVE_PLATFORM="_EGL_INVALID_PLATFORM"
  1653. fi
  1654. AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep -q 'x11')
  1655. AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 'wayland')
  1656. AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm')
  1657. AM_CONDITIONAL(HAVE_EGL_PLATFORM_SURFACELESS, echo "$egl_platforms" | grep -q 'surfaceless')
  1658. AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep -q 'null')
  1659. AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
  1660. AC_SUBST([EGL_NATIVE_PLATFORM])
  1661. AC_SUBST([EGL_CFLAGS])
  1662. # If we don't have the X11 platform, set this define so we don't try to include
  1663. # the X11 headers.
  1664. if ! echo "$egl_platforms" | grep -q 'x11'; then
  1665. DEFINES="$DEFINES -DMESA_EGL_NO_X11_HEADERS"
  1666. GL_PC_CFLAGS="$GL_PC_CFLAGS -DMESA_EGL_NO_X11_HEADERS"
  1667. fi
  1668. dnl
  1669. dnl Gallium LLVM
  1670. dnl
  1671. AC_ARG_ENABLE([gallium-llvm],
  1672. [AS_HELP_STRING([--enable-gallium-llvm],
  1673. [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
  1674. [enable_gallium_llvm="$enableval"],
  1675. [enable_gallium_llvm=auto])
  1676. AC_ARG_ENABLE([llvm-shared-libs],
  1677. [AS_HELP_STRING([--enable-llvm-shared-libs],
  1678. [link with LLVM shared libraries @<:@default=enabled@:>@])],
  1679. [enable_llvm_shared_libs="$enableval"],
  1680. [enable_llvm_shared_libs=yes])
  1681. AC_ARG_WITH([llvm-prefix],
  1682. [AS_HELP_STRING([--with-llvm-prefix],
  1683. [Prefix for LLVM installations in non-standard locations])],
  1684. [llvm_prefix="$withval"],
  1685. [llvm_prefix=''])
  1686. # Call this inside ` ` to get the return value.
  1687. # $1 is the llvm-config command with arguments.
  1688. strip_unwanted_llvm_flags() {
  1689. # Use \> (marks the end of the word)
  1690. echo `$1` | sed \
  1691. -e 's/-DNDEBUG\>//g' \
  1692. -e 's/-D_GNU_SOURCE\>//g' \
  1693. -e 's/-pedantic\>//g' \
  1694. -e 's/-Wcovered-switch-default\>//g' \
  1695. -e 's/-O.\>//g' \
  1696. -e 's/-g\>//g' \
  1697. -e 's/-Wall\>//g' \
  1698. -e 's/-Wcast-qual\>//g' \
  1699. -e 's/-Woverloaded-virtual\>//g' \
  1700. -e 's/-fcolor-diagnostics\>//g' \
  1701. -e 's/-fdata-sections\>//g' \
  1702. -e 's/-ffunction-sections\>//g' \
  1703. -e 's/-fno-exceptions\>//g' \
  1704. -e 's/-fomit-frame-pointer\>//g' \
  1705. -e 's/-fvisibility-inlines-hidden\>//g' \
  1706. -e 's/-fPIC\>//g' \
  1707. -e 's/-fstack-protector-strong\>//g'
  1708. }
  1709. llvm_check_version_for() {
  1710. if test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${1}0${2}${3}"; then
  1711. AC_MSG_ERROR([LLVM $1.$2.$3 or newer is required for $4])
  1712. fi
  1713. }
  1714. if test -z "$with_gallium_drivers"; then
  1715. enable_gallium_llvm=no
  1716. fi
  1717. if test "x$enable_gallium_llvm" = xauto; then
  1718. case "$host_cpu" in
  1719. i*86|x86_64|amd64) enable_gallium_llvm=yes;;
  1720. esac
  1721. fi
  1722. if test "x$enable_gallium_llvm" = xyes; then
  1723. if test -n "$llvm_prefix"; then
  1724. AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
  1725. else
  1726. AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
  1727. fi
  1728. if test "x$LLVM_CONFIG" != xno; then
  1729. LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
  1730. LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
  1731. LLVM_BINDIR=`$LLVM_CONFIG --bindir`
  1732. LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
  1733. LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
  1734. LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
  1735. LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
  1736. LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
  1737. AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
  1738. [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
  1739. AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
  1740. [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
  1741. LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o '^[[0-9]]+'`
  1742. if test -z "$LLVM_VERSION_PATCH"; then
  1743. LLVM_VERSION_PATCH=0
  1744. fi
  1745. if test -n "${LLVM_VERSION_MAJOR}"; then
  1746. LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
  1747. else
  1748. LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
  1749. fi
  1750. LLVM_REQUIRED_VERSION_MAJOR="3"
  1751. LLVM_REQUIRED_VERSION_MINOR="3"
  1752. if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
  1753. AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
  1754. fi
  1755. LLVM_COMPONENTS="engine bitwriter mcjit mcdisassembler"
  1756. if test "x$enable_opencl" = xyes; then
  1757. llvm_check_version_for "3" "5" "0" "opencl"
  1758. LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker instrumentation"
  1759. LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader option objcarcopts profiledata"
  1760. fi
  1761. DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
  1762. MESA_LLVM=1
  1763. dnl Check for Clang internal headers
  1764. if test "x$enable_opencl" = xyes; then
  1765. if test -z "$CLANG_LIBDIR"; then
  1766. CLANG_LIBDIR=${LLVM_LIBDIR}
  1767. fi
  1768. CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
  1769. AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
  1770. [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.])])
  1771. fi
  1772. else
  1773. MESA_LLVM=0
  1774. LLVM_VERSION_INT=0
  1775. fi
  1776. else
  1777. MESA_LLVM=0
  1778. LLVM_VERSION_INT=0
  1779. if test "x$enable_opencl" = xyes; then
  1780. AC_MSG_ERROR([cannot enable OpenCL without LLVM])
  1781. fi
  1782. fi
  1783. dnl Directory for XVMC libs
  1784. AC_ARG_WITH([xvmc-libdir],
  1785. [AS_HELP_STRING([--with-xvmc-libdir=DIR],
  1786. [directory for the XVMC libraries @<:@default=${libdir}@:>@])],
  1787. [XVMC_LIB_INSTALL_DIR="$withval"],
  1788. [XVMC_LIB_INSTALL_DIR='${libdir}'])
  1789. AC_SUBST([XVMC_LIB_INSTALL_DIR])
  1790. dnl
  1791. dnl Gallium Tests
  1792. dnl
  1793. AM_CONDITIONAL(HAVE_GALLIUM_TESTS, test "x$enable_gallium_tests" = xyes)
  1794. dnl Directory for VDPAU libs
  1795. AC_ARG_WITH([vdpau-libdir],
  1796. [AS_HELP_STRING([--with-vdpau-libdir=DIR],
  1797. [directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
  1798. [VDPAU_LIB_INSTALL_DIR="$withval"],
  1799. [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
  1800. AC_SUBST([VDPAU_LIB_INSTALL_DIR])
  1801. dnl Directory for OMX libs
  1802. AC_ARG_WITH([omx-libdir],
  1803. [AS_HELP_STRING([--with-omx-libdir=DIR],
  1804. [directory for the OMX libraries])],
  1805. [OMX_LIB_INSTALL_DIR="$withval"],
  1806. [OMX_LIB_INSTALL_DIR=`$PKG_CONFIG --define-variable=libdir=\$libdir --variable=pluginsdir libomxil-bellagio`])
  1807. AC_SUBST([OMX_LIB_INSTALL_DIR])
  1808. dnl Directory for VA libs
  1809. AC_ARG_WITH([va-libdir],
  1810. [AS_HELP_STRING([--with-va-libdir=DIR],
  1811. [directory for the VA libraries @<:@${libdir}/dri@:>@])],
  1812. [VA_LIB_INSTALL_DIR="$withval"],
  1813. [VA_LIB_INSTALL_DIR="${libdir}/dri"])
  1814. AC_SUBST([VA_LIB_INSTALL_DIR])
  1815. AC_ARG_WITH([d3d-libdir],
  1816. [AS_HELP_STRING([--with-d3d-libdir=DIR],
  1817. [directory for the D3D modules @<:@${libdir}/d3d@:>@])],
  1818. [D3D_DRIVER_INSTALL_DIR="$withval"],
  1819. [D3D_DRIVER_INSTALL_DIR="${libdir}/d3d"])
  1820. AC_SUBST([D3D_DRIVER_INSTALL_DIR])
  1821. dnl
  1822. dnl Gallium helper functions
  1823. dnl
  1824. gallium_require_drm() {
  1825. if test "x$have_libdrm" != xyes; then
  1826. AC_MSG_ERROR([$1 requires libdrm >= $LIBDRM_REQUIRED])
  1827. fi
  1828. }
  1829. gallium_require_llvm() {
  1830. if test "x$MESA_LLVM" = x0; then
  1831. case "$host" in *gnux32) return;; esac
  1832. case "$host_cpu" in
  1833. i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on x86 and x86_64]);;
  1834. esac
  1835. fi
  1836. }
  1837. gallium_require_drm_loader() {
  1838. if test "x$need_pci_id$have_pci_id" = xyesno; then
  1839. AC_MSG_ERROR([Gallium drm loader requires libudev >= $LIBUDEV_REQUIRED or sysfs])
  1840. fi
  1841. }
  1842. require_egl_drm() {
  1843. case "$with_egl_platforms" in
  1844. *drm*)
  1845. ;;
  1846. *)
  1847. AC_MSG_ERROR([--with-egl-platforms=drm is required to build the $1 driver.])
  1848. ;;
  1849. esac
  1850. if test "x$enable_gbm" != xyes; then
  1851. AC_MSG_ERROR([--enable-gbm is required to build the $1 driver.])
  1852. fi
  1853. }
  1854. radeon_llvm_check() {
  1855. if test ${LLVM_VERSION_INT} -lt 307; then
  1856. amdgpu_llvm_target_name='r600'
  1857. else
  1858. amdgpu_llvm_target_name='amdgpu'
  1859. fi
  1860. if test "x$enable_gallium_llvm" != "xyes"; then
  1861. AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
  1862. fi
  1863. llvm_check_version_for "3" "5" "0" $1
  1864. if test true && $LLVM_CONFIG --targets-built | grep -iqvw $amdgpu_llvm_target_name ; then
  1865. AC_MSG_ERROR([LLVM $amdgpu_llvm_target_name not enabled in your LLVM build.])
  1866. fi
  1867. LLVM_COMPONENTS="${LLVM_COMPONENTS} $amdgpu_llvm_target_name bitreader ipo"
  1868. NEED_RADEON_LLVM=yes
  1869. if test "x$have_libelf" != xyes; then
  1870. AC_MSG_ERROR([$1 requires libelf when using llvm])
  1871. fi
  1872. }
  1873. dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
  1874. if test -n "$with_gallium_drivers"; then
  1875. gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
  1876. for driver in $gallium_drivers; do
  1877. case "x$driver" in
  1878. xsvga)
  1879. HAVE_GALLIUM_SVGA=yes
  1880. gallium_require_drm "svga"
  1881. gallium_require_drm_loader
  1882. ;;
  1883. xi915)
  1884. HAVE_GALLIUM_I915=yes
  1885. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1886. gallium_require_drm "Gallium i915"
  1887. gallium_require_drm_loader
  1888. ;;
  1889. xilo)
  1890. HAVE_GALLIUM_ILO=yes
  1891. PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
  1892. gallium_require_drm "Gallium i965/ilo"
  1893. gallium_require_drm_loader
  1894. ;;
  1895. xr300)
  1896. HAVE_GALLIUM_R300=yes
  1897. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1898. gallium_require_drm "Gallium R300"
  1899. gallium_require_drm_loader
  1900. gallium_require_llvm "Gallium R300"
  1901. ;;
  1902. xr600)
  1903. HAVE_GALLIUM_R600=yes
  1904. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1905. gallium_require_drm "Gallium R600"
  1906. gallium_require_drm_loader
  1907. if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes; then
  1908. radeon_llvm_check "r600g"
  1909. LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
  1910. fi
  1911. if test "x$enable_r600_llvm" = xyes; then
  1912. USE_R600_LLVM_COMPILER=yes;
  1913. fi
  1914. if test "x$enable_opencl" = xyes; then
  1915. LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
  1916. fi
  1917. ;;
  1918. xradeonsi)
  1919. HAVE_GALLIUM_RADEONSI=yes
  1920. PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
  1921. PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
  1922. gallium_require_drm "radeonsi"
  1923. gallium_require_drm_loader
  1924. radeon_llvm_check "radeonsi"
  1925. require_egl_drm "radeonsi"
  1926. ;;
  1927. xnouveau)
  1928. HAVE_GALLIUM_NOUVEAU=yes
  1929. PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
  1930. gallium_require_drm "nouveau"
  1931. gallium_require_drm_loader
  1932. ;;
  1933. xfreedreno)
  1934. HAVE_GALLIUM_FREEDRENO=yes
  1935. PKG_CHECK_MODULES([FREEDRENO], [libdrm_freedreno >= $LIBDRM_FREEDRENO_REQUIRED])
  1936. gallium_require_drm "freedreno"
  1937. gallium_require_drm_loader
  1938. ;;
  1939. xswrast)
  1940. HAVE_GALLIUM_SOFTPIPE=yes
  1941. if test "x$MESA_LLVM" = x1; then
  1942. HAVE_GALLIUM_LLVMPIPE=yes
  1943. fi
  1944. ;;
  1945. xvc4)
  1946. HAVE_GALLIUM_VC4=yes
  1947. gallium_require_drm "vc4"
  1948. gallium_require_drm_loader
  1949. PKG_CHECK_MODULES([SIMPENROSE], [simpenrose],
  1950. [USE_VC4_SIMULATOR=yes;
  1951. DEFINES="$DEFINES -DUSE_VC4_SIMULATOR"],
  1952. [USE_VC4_SIMULATOR=no])
  1953. ;;
  1954. xvirgl)
  1955. HAVE_GALLIUM_VIRGL=yes
  1956. gallium_require_drm "virgl"
  1957. gallium_require_drm_loader
  1958. require_egl_drm "virgl"
  1959. ;;
  1960. *)
  1961. AC_MSG_ERROR([Unknown Gallium driver: $driver])
  1962. ;;
  1963. esac
  1964. done
  1965. fi
  1966. dnl Set LLVM_LIBS - This is done after the driver configuration so
  1967. dnl that drivers can add additional components to LLVM_COMPONENTS.
  1968. dnl Previously, gallium drivers were updating LLVM_LIBS directly
  1969. dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
  1970. dnl this was causing the same libraries to be appear multiple times
  1971. dnl in LLVM_LIBS.
  1972. if test "x$MESA_LLVM" != x0; then
  1973. LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
  1974. dnl llvm-config may not give the right answer when llvm is a built as a
  1975. dnl single shared library, so we must work the library name out for
  1976. dnl ourselves.
  1977. dnl (See https://llvm.org/bugs/show_bug.cgi?id=6823)
  1978. if test "x$enable_llvm_shared_libs" = xyes; then
  1979. dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
  1980. LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
  1981. AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.$IMP_LIB_EXT"], [llvm_have_one_so=yes])
  1982. if test "x$llvm_have_one_so" = xyes; then
  1983. dnl LLVM was built using auto*, so there is only one shared object.
  1984. LLVM_LIBS="-l$LLVM_SO_NAME"
  1985. else
  1986. dnl If LLVM was built with CMake, there will be one shared object per
  1987. dnl component.
  1988. AS_IF([test ! -f "$LLVM_LIBDIR/libLLVMTarget.$IMP_LIB_EXT"],
  1989. [AC_MSG_ERROR([Could not find llvm shared libraries:
  1990. Please make sure you have built llvm with the --enable-shared option
  1991. and that your llvm libraries are installed in $LLVM_LIBDIR
  1992. If you have installed your llvm libraries to a different directory you
  1993. can use the --with-llvm-prefix= configure flag to specify this directory.
  1994. NOTE: Mesa is attempting to use llvm shared libraries by default.
  1995. If you do not want to build with llvm shared libraries and instead want to
  1996. use llvm static libraries then add --disable-llvm-shared-libs to your configure
  1997. invocation and rebuild.])])
  1998. dnl We don't need to update LLVM_LIBS in this case because the LLVM
  1999. dnl install uses a shared object for each component and we have
  2000. dnl already added all of these objects to LLVM_LIBS.
  2001. fi
  2002. else
  2003. AC_MSG_WARN([Building mesa with statically linked LLVM may cause compilation issues])
  2004. dnl We need to link to llvm system libs when using static libs
  2005. dnl However, only llvm 3.5+ provides --system-libs
  2006. if test $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5; then
  2007. LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --system-libs`"
  2008. fi
  2009. fi
  2010. fi
  2011. AM_CONDITIONAL(HAVE_GALLIUM_SVGA, test "x$HAVE_GALLIUM_SVGA" = xyes)
  2012. AM_CONDITIONAL(HAVE_GALLIUM_I915, test "x$HAVE_GALLIUM_I915" = xyes)
  2013. AM_CONDITIONAL(HAVE_GALLIUM_ILO, test "x$HAVE_GALLIUM_ILO" = xyes)
  2014. AM_CONDITIONAL(HAVE_GALLIUM_R300, test "x$HAVE_GALLIUM_R300" = xyes)
  2015. AM_CONDITIONAL(HAVE_GALLIUM_R600, test "x$HAVE_GALLIUM_R600" = xyes)
  2016. AM_CONDITIONAL(HAVE_GALLIUM_RADEONSI, test "x$HAVE_GALLIUM_RADEONSI" = xyes)
  2017. AM_CONDITIONAL(HAVE_GALLIUM_RADEON_COMMON, test "x$HAVE_GALLIUM_R600" = xyes -o \
  2018. "x$HAVE_GALLIUM_RADEONSI" = xyes)
  2019. AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
  2020. AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes)
  2021. AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
  2022. AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes)
  2023. AM_CONDITIONAL(HAVE_GALLIUM_VC4, test "x$HAVE_GALLIUM_VC4" = xyes)
  2024. AM_CONDITIONAL(HAVE_GALLIUM_VIRGL, test "x$HAVE_GALLIUM_VIRGL" = xyes)
  2025. AM_CONDITIONAL(HAVE_GALLIUM_STATIC_TARGETS, test "x$enable_shared_pipe_drivers" = xno)
  2026. if test "x$enable_dri" = xyes; then
  2027. GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRI"
  2028. fi
  2029. if test "x$have_drisw_kms" = xyes; then
  2030. GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_KMS"
  2031. fi
  2032. AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
  2033. AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
  2034. AM_CONDITIONAL(HAVE_I965_DRI, test x$HAVE_I965_DRI = xyes)
  2035. AM_CONDITIONAL(HAVE_NOUVEAU_DRI, test x$HAVE_NOUVEAU_DRI = xyes)
  2036. AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
  2037. AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
  2038. AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
  2039. AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test "x$HAVE_GALLIUM_R300" = xyes -o \
  2040. "x$HAVE_GALLIUM_R600" = xyes -o \
  2041. "x$HAVE_GALLIUM_RADEONSI" = xyes)
  2042. AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes)
  2043. AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
  2044. AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
  2045. AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
  2046. AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
  2047. AM_CONDITIONAL(USE_VC4_SIMULATOR, test x$USE_VC4_SIMULATOR = xyes)
  2048. if test "x$USE_VC4_SIMULATOR" = xyes -a "x$HAVE_GALLIUM_ILO" = xyes; then
  2049. AC_MSG_ERROR([VC4 simulator on x86 replaces i965 driver build, so ilo must be disabled.])
  2050. fi
  2051. AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)
  2052. AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" = xyes)
  2053. AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
  2054. AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)
  2055. AM_CONDITIONAL(HAVE_X86_ASM, test "x$asm_arch" = xx86 -o "x$asm_arch" = xx86_64)
  2056. AM_CONDITIONAL(HAVE_X86_64_ASM, test "x$asm_arch" = xx86_64)
  2057. AM_CONDITIONAL(HAVE_SPARC_ASM, test "x$asm_arch" = xsparc)
  2058. AC_SUBST([NINE_MAJOR], 1)
  2059. AC_SUBST([NINE_MINOR], 0)
  2060. AC_SUBST([NINE_TINY], 0)
  2061. AC_SUBST([NINE_VERSION], "$NINE_MAJOR.$NINE_MINOR.$NINE_TINY")
  2062. AC_SUBST([VDPAU_MAJOR], 1)
  2063. AC_SUBST([VDPAU_MINOR], 0)
  2064. VA_MAJOR=`$PKG_CONFIG --modversion libva | $SED -n 's/\([[^\.]]*\)\..*$/\1/p'`
  2065. VA_MINOR=`$PKG_CONFIG --modversion libva | $SED -n 's/.*\.\(.*\)\..*$/\1/p'`
  2066. AC_SUBST([VA_MAJOR], $VA_MAJOR)
  2067. AC_SUBST([VA_MINOR], $VA_MINOR)
  2068. AC_SUBST([XVMC_MAJOR], 1)
  2069. AC_SUBST([XVMC_MINOR], 0)
  2070. XA_HEADER="$srcdir/src/gallium/state_trackers/xa/xa_tracker.h"
  2071. XA_MAJOR=`grep "#define XA_TRACKER_VERSION_MAJOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MAJOR //'`
  2072. XA_MINOR=`grep "#define XA_TRACKER_VERSION_MINOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MINOR //'`
  2073. XA_TINY=`grep "#define XA_TRACKER_VERSION_PATCH" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_PATCH //'`
  2074. AC_SUBST([XA_MAJOR], $XA_MAJOR)
  2075. AC_SUBST([XA_MINOR], $XA_MINOR)
  2076. AC_SUBST([XA_TINY], $XA_TINY)
  2077. AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
  2078. dnl Restore LDFLAGS and CPPFLAGS
  2079. LDFLAGS="$_SAVE_LDFLAGS"
  2080. CPPFLAGS="$_SAVE_CPPFLAGS"
  2081. dnl Suppress clang's warnings about unused CFLAGS and CXXFLAGS
  2082. if test "x$acv_mesa_CLANG" = xyes; then
  2083. CFLAGS="$CFLAGS -Qunused-arguments"
  2084. CXXFLAGS="$CXXFLAGS -Qunused-arguments"
  2085. fi
  2086. dnl Add user CFLAGS and CXXFLAGS
  2087. CFLAGS="$CFLAGS $USER_CFLAGS"
  2088. CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
  2089. dnl Substitute the config
  2090. AC_CONFIG_FILES([Makefile
  2091. src/Makefile
  2092. src/egl/Makefile
  2093. src/egl/main/egl.pc
  2094. src/egl/wayland/wayland-drm/Makefile
  2095. src/egl/wayland/wayland-egl/Makefile
  2096. src/egl/wayland/wayland-egl/wayland-egl.pc
  2097. src/gallium/Makefile
  2098. src/gallium/auxiliary/Makefile
  2099. src/gallium/auxiliary/pipe-loader/Makefile
  2100. src/gallium/drivers/freedreno/Makefile
  2101. src/gallium/drivers/ddebug/Makefile
  2102. src/gallium/drivers/i915/Makefile
  2103. src/gallium/drivers/ilo/Makefile
  2104. src/gallium/drivers/llvmpipe/Makefile
  2105. src/gallium/drivers/noop/Makefile
  2106. src/gallium/drivers/nouveau/Makefile
  2107. src/gallium/drivers/r300/Makefile
  2108. src/gallium/drivers/r600/Makefile
  2109. src/gallium/drivers/radeon/Makefile
  2110. src/gallium/drivers/radeonsi/Makefile
  2111. src/gallium/drivers/rbug/Makefile
  2112. src/gallium/drivers/softpipe/Makefile
  2113. src/gallium/drivers/svga/Makefile
  2114. src/gallium/drivers/trace/Makefile
  2115. src/gallium/drivers/vc4/Makefile
  2116. src/gallium/drivers/virgl/Makefile
  2117. src/gallium/state_trackers/clover/Makefile
  2118. src/gallium/state_trackers/dri/Makefile
  2119. src/gallium/state_trackers/glx/xlib/Makefile
  2120. src/gallium/state_trackers/nine/Makefile
  2121. src/gallium/state_trackers/omx/Makefile
  2122. src/gallium/state_trackers/osmesa/Makefile
  2123. src/gallium/state_trackers/va/Makefile
  2124. src/gallium/state_trackers/vdpau/Makefile
  2125. src/gallium/state_trackers/xa/Makefile
  2126. src/gallium/state_trackers/xvmc/Makefile
  2127. src/gallium/targets/d3dadapter9/Makefile
  2128. src/gallium/targets/d3dadapter9/d3d.pc
  2129. src/gallium/targets/dri/Makefile
  2130. src/gallium/targets/libgl-xlib/Makefile
  2131. src/gallium/targets/omx/Makefile
  2132. src/gallium/targets/opencl/Makefile
  2133. src/gallium/targets/opencl/mesa.icd
  2134. src/gallium/targets/osmesa/Makefile
  2135. src/gallium/targets/osmesa/osmesa.pc
  2136. src/gallium/targets/pipe-loader/Makefile
  2137. src/gallium/targets/va/Makefile
  2138. src/gallium/targets/vdpau/Makefile
  2139. src/gallium/targets/xa/Makefile
  2140. src/gallium/targets/xa/xatracker.pc
  2141. src/gallium/targets/xvmc/Makefile
  2142. src/gallium/tests/trivial/Makefile
  2143. src/gallium/tests/unit/Makefile
  2144. src/gallium/winsys/freedreno/drm/Makefile
  2145. src/gallium/winsys/i915/drm/Makefile
  2146. src/gallium/winsys/intel/drm/Makefile
  2147. src/gallium/winsys/nouveau/drm/Makefile
  2148. src/gallium/winsys/radeon/drm/Makefile
  2149. src/gallium/winsys/amdgpu/drm/Makefile
  2150. src/gallium/winsys/svga/drm/Makefile
  2151. src/gallium/winsys/sw/dri/Makefile
  2152. src/gallium/winsys/sw/kms-dri/Makefile
  2153. src/gallium/winsys/sw/null/Makefile
  2154. src/gallium/winsys/sw/wrapper/Makefile
  2155. src/gallium/winsys/sw/xlib/Makefile
  2156. src/gallium/winsys/vc4/drm/Makefile
  2157. src/gallium/winsys/virgl/drm/Makefile
  2158. src/gallium/winsys/virgl/vtest/Makefile
  2159. src/gbm/Makefile
  2160. src/gbm/main/gbm.pc
  2161. src/glsl/Makefile
  2162. src/glx/Makefile
  2163. src/glx/apple/Makefile
  2164. src/glx/tests/Makefile
  2165. src/gtest/Makefile
  2166. src/loader/Makefile
  2167. src/mapi/Makefile
  2168. src/mapi/es1api/glesv1_cm.pc
  2169. src/mapi/es2api/glesv2.pc
  2170. src/mapi/glapi/gen/Makefile
  2171. src/mesa/Makefile
  2172. src/mesa/gl.pc
  2173. src/mesa/drivers/dri/dri.pc
  2174. src/mesa/drivers/dri/common/Makefile
  2175. src/mesa/drivers/dri/common/xmlpool/Makefile
  2176. src/mesa/drivers/dri/i915/Makefile
  2177. src/mesa/drivers/dri/i965/Makefile
  2178. src/mesa/drivers/dri/Makefile
  2179. src/mesa/drivers/dri/nouveau/Makefile
  2180. src/mesa/drivers/dri/r200/Makefile
  2181. src/mesa/drivers/dri/radeon/Makefile
  2182. src/mesa/drivers/dri/swrast/Makefile
  2183. src/mesa/drivers/osmesa/Makefile
  2184. src/mesa/drivers/osmesa/osmesa.pc
  2185. src/mesa/drivers/x11/Makefile
  2186. src/mesa/main/tests/Makefile
  2187. src/util/Makefile
  2188. src/util/tests/hash_table/Makefile])
  2189. AC_OUTPUT
  2190. dnl
  2191. dnl Output some configuration info for the user
  2192. dnl
  2193. echo ""
  2194. echo " prefix: $prefix"
  2195. echo " exec_prefix: $exec_prefix"
  2196. echo " libdir: $libdir"
  2197. echo " includedir: $includedir"
  2198. dnl API info
  2199. echo ""
  2200. echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
  2201. dnl Driver info
  2202. echo ""
  2203. case "x$enable_osmesa$enable_gallium_osmesa" in
  2204. xnoyes)
  2205. echo " OSMesa: lib$OSMESA_LIB (Gallium)"
  2206. ;;
  2207. xyesno)
  2208. echo " OSMesa: lib$OSMESA_LIB"
  2209. ;;
  2210. xnono)
  2211. echo " OSMesa: no"
  2212. ;;
  2213. esac
  2214. echo ""
  2215. if test "x$enable_dri" != xno; then
  2216. echo " DRI platform: $dri_platform"
  2217. if test -z "$DRI_DIRS"; then
  2218. echo " DRI drivers: no"
  2219. else
  2220. echo " DRI drivers: $DRI_DIRS"
  2221. fi
  2222. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  2223. fi
  2224. case "x$enable_glx$enable_xlib_glx" in
  2225. xyesyes)
  2226. echo " GLX: Xlib-based"
  2227. ;;
  2228. xyesno)
  2229. echo " GLX: DRI-based"
  2230. ;;
  2231. *)
  2232. echo " GLX: $enable_glx"
  2233. ;;
  2234. esac
  2235. dnl EGL
  2236. echo ""
  2237. echo " EGL: $enable_egl"
  2238. if test "$enable_egl" = yes; then
  2239. echo " EGL platforms: $egl_platforms"
  2240. egl_drivers=""
  2241. if test "x$HAVE_EGL_DRIVER_DRI2" != "x"; then
  2242. egl_drivers="$egl_drivers builtin:egl_dri2"
  2243. fi
  2244. if test "x$HAVE_EGL_DRIVER_DRI3" != "x"; then
  2245. egl_drivers="$egl_drivers builtin:egl_dri3"
  2246. fi
  2247. echo " EGL drivers: $egl_drivers"
  2248. fi
  2249. echo ""
  2250. if test "x$MESA_LLVM" = x1; then
  2251. echo " llvm: yes"
  2252. echo " llvm-config: $LLVM_CONFIG"
  2253. echo " llvm-version: $LLVM_VERSION"
  2254. else
  2255. echo " llvm: no"
  2256. fi
  2257. echo ""
  2258. if test -n "$with_gallium_drivers"; then
  2259. echo " Gallium drivers: $gallium_drivers"
  2260. echo " Gallium st: $gallium_st"
  2261. else
  2262. echo " Gallium: no"
  2263. fi
  2264. dnl Shader cache
  2265. echo ""
  2266. echo " Shader cache: $enable_shader_cache"
  2267. if test "x$enable_shader_cache" = "xyes"; then
  2268. echo " With SHA1 from: $with_sha1"
  2269. fi
  2270. dnl Libraries
  2271. echo ""
  2272. echo " Shared libs: $enable_shared"
  2273. echo " Static libs: $enable_static"
  2274. echo " Shared-glapi: $enable_shared_glapi"
  2275. dnl Compiler options
  2276. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  2277. cflags=`echo $CFLAGS | \
  2278. $SED 's/^ *//;s/ */ /;s/ *$//'`
  2279. cxxflags=`echo $CXXFLAGS | \
  2280. $SED 's/^ *//;s/ */ /;s/ *$//'`
  2281. defines=`echo $DEFINES | $SED 's/^ *//;s/ */ /;s/ *$//'`
  2282. echo ""
  2283. echo " CFLAGS: $cflags"
  2284. echo " CXXFLAGS: $cxxflags"
  2285. echo " Macros: $defines"
  2286. echo ""
  2287. if test "x$MESA_LLVM" = x1; then
  2288. echo " LLVM_CFLAGS: $LLVM_CFLAGS"
  2289. echo " LLVM_CXXFLAGS: $LLVM_CXXFLAGS"
  2290. echo " LLVM_CPPFLAGS: $LLVM_CPPFLAGS"
  2291. echo " LLVM_LDFLAGS: $LLVM_LDFLAGS"
  2292. echo ""
  2293. fi
  2294. echo " PYTHON2: $PYTHON2"
  2295. echo ""
  2296. echo " Run '${MAKE-make}' to build Mesa"
  2297. echo ""