Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 64KB

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