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

configure.ac 68KB

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