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

configure.ac 39KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359
  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'])])
  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.15
  17. LIBDRM_RADEON_REQUIRED=2.4.17
  18. DRI2PROTO_REQUIRED=1.99.3
  19. dnl Check for progs
  20. AC_PROG_CPP
  21. AC_PROG_CC
  22. AC_PROG_CXX
  23. AC_CHECK_PROGS([MAKE], [gmake make])
  24. AC_PATH_PROG([MKDEP], [makedepend])
  25. AC_PATH_PROG([SED], [sed])
  26. dnl Our fallback install-sh is a symlink to minstall. Use the existing
  27. dnl configuration in that case.
  28. AC_PROG_INSTALL
  29. test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
  30. dnl We need a POSIX shell for parts of the build. Assume we have one
  31. dnl in most cases.
  32. case "$host_os" in
  33. solaris*)
  34. # Solaris /bin/sh is too old/non-POSIX compliant
  35. AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
  36. SHELL="$POSIX_SHELL"
  37. ;;
  38. esac
  39. MKDEP_OPTIONS=-fdepend
  40. dnl Ask gcc where it's keeping its secret headers
  41. if test "x$GCC" = xyes; then
  42. for dir in include include-fixed; do
  43. GCC_INCLUDES=`$CC -print-file-name=$dir`
  44. if test "x$GCC_INCLUDES" != x && \
  45. test "$GCC_INCLUDES" != "$dir" && \
  46. test -d "$GCC_INCLUDES"; then
  47. MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
  48. fi
  49. done
  50. fi
  51. AC_SUBST([MKDEP_OPTIONS])
  52. dnl Make sure the pkg-config macros are defined
  53. m4_ifndef([PKG_PROG_PKG_CONFIG],
  54. [m4_fatal([Could not locate the pkg-config autoconf macros.
  55. These are usually located in /usr/share/aclocal/pkg.m4. If your macros
  56. are in a different location, try setting the environment variable
  57. ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
  58. PKG_PROG_PKG_CONFIG()
  59. dnl LIB_DIR - library basename
  60. LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
  61. AC_SUBST([LIB_DIR])
  62. dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
  63. _SAVE_LDFLAGS="$LDFLAGS"
  64. AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
  65. AC_SUBST([EXTRA_LIB_PATH])
  66. dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
  67. _SAVE_CPPFLAGS="$CPPFLAGS"
  68. AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
  69. AC_SUBST([X11_INCLUDES])
  70. dnl Compiler macros
  71. DEFINES=""
  72. AC_SUBST([DEFINES])
  73. case "$host_os" in
  74. linux*|*-gnu*|gnu*)
  75. DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
  76. ;;
  77. solaris*)
  78. DEFINES="$DEFINES -DPTHREADS -DSVR4"
  79. ;;
  80. esac
  81. dnl Add flags for gcc and g++
  82. if test "x$GCC" = xyes; then
  83. CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math -fvisibility=hidden"
  84. # Work around aliasing bugs - developers should comment this out
  85. CFLAGS="$CFLAGS -fno-strict-aliasing"
  86. fi
  87. if test "x$GXX" = xyes; then
  88. CXXFLAGS="$CXXFLAGS -Wall"
  89. # Work around aliasing bugs - developers should comment this out
  90. CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
  91. fi
  92. dnl These should be unnecessary, but let the user set them if they want
  93. AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
  94. Default is to use CFLAGS.])
  95. AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
  96. compiler. Default is to use CFLAGS.])
  97. AC_SUBST([OPT_FLAGS])
  98. AC_SUBST([ARCH_FLAGS])
  99. dnl
  100. dnl Hacks to enable 32 or 64 bit build
  101. dnl
  102. AC_ARG_ENABLE([32-bit],
  103. [AS_HELP_STRING([--enable-32-bit],
  104. [build 32-bit libraries @<:@default=auto@:>@])],
  105. [enable_32bit="$enableval"],
  106. [enable_32bit=auto]
  107. )
  108. if test "x$enable_32bit" = xyes; then
  109. if test "x$GCC" = xyes; then
  110. CFLAGS="$CFLAGS -m32"
  111. ARCH_FLAGS="$ARCH_FLAGS -m32"
  112. fi
  113. if test "x$GXX" = xyes; then
  114. CXXFLAGS="$CXXFLAGS -m32"
  115. fi
  116. fi
  117. AC_ARG_ENABLE([64-bit],
  118. [AS_HELP_STRING([--enable-64-bit],
  119. [build 64-bit libraries @<:@default=auto@:>@])],
  120. [enable_64bit="$enableval"],
  121. [enable_64bit=auto]
  122. )
  123. if test "x$enable_64bit" = xyes; then
  124. if test "x$GCC" = xyes; then
  125. CFLAGS="$CFLAGS -m64"
  126. fi
  127. if test "x$GXX" = xyes; then
  128. CXXFLAGS="$CXXFLAGS -m64"
  129. fi
  130. fi
  131. dnl
  132. dnl shared/static libraries, mimic libtool options
  133. dnl
  134. AC_ARG_ENABLE([static],
  135. [AS_HELP_STRING([--enable-static],
  136. [build static libraries @<:@default=disabled@:>@])],
  137. [enable_static="$enableval"],
  138. [enable_static=no]
  139. )
  140. case "x$enable_static" in
  141. xyes|xno ) ;;
  142. x ) enable_static=no ;;
  143. * )
  144. AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
  145. ;;
  146. esac
  147. AC_ARG_ENABLE([shared],
  148. [AS_HELP_STRING([--disable-shared],
  149. [build shared libraries @<:@default=enabled@:>@])],
  150. [enable_shared="$enableval"],
  151. [enable_shared=yes]
  152. )
  153. case "x$enable_shared" in
  154. xyes|xno ) ;;
  155. x ) enable_shared=yes ;;
  156. * )
  157. AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
  158. ;;
  159. esac
  160. dnl Can't have static and shared libraries, default to static if user
  161. dnl explicitly requested. If both disabled, set to static since shared
  162. dnl was explicitly requirested.
  163. case "x$enable_static$enable_shared" in
  164. xyesyes )
  165. AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
  166. enable_shared=no
  167. ;;
  168. xnono )
  169. AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
  170. enable_static=yes
  171. ;;
  172. esac
  173. dnl
  174. dnl mklib options
  175. dnl
  176. AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
  177. if test "$enable_static" = yes; then
  178. MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
  179. fi
  180. AC_SUBST([MKLIB_OPTIONS])
  181. dnl
  182. dnl other compiler options
  183. dnl
  184. AC_ARG_ENABLE([debug],
  185. [AS_HELP_STRING([--enable-debug],
  186. [use debug compiler flags and macros @<:@default=disabled@:>@])],
  187. [enable_debug="$enableval"],
  188. [enable_debug=no]
  189. )
  190. if test "x$enable_debug" = xyes; then
  191. DEFINES="$DEFINES -DDEBUG"
  192. if test "x$GCC" = xyes; then
  193. CFLAGS="$CFLAGS -g"
  194. fi
  195. if test "x$GXX" = xyes; then
  196. CXXFLAGS="$CXXFLAGS -g"
  197. fi
  198. fi
  199. dnl
  200. dnl library names
  201. dnl
  202. if test "$enable_static" = yes; then
  203. LIB_EXTENSION='a'
  204. else
  205. case "$host_os" in
  206. darwin* )
  207. LIB_EXTENSION='dylib' ;;
  208. cygwin* )
  209. LIB_EXTENSION='dll' ;;
  210. aix* )
  211. LIB_EXTENSION='a' ;;
  212. * )
  213. LIB_EXTENSION='so' ;;
  214. esac
  215. fi
  216. GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
  217. GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
  218. GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
  219. GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
  220. OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
  221. GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
  222. GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
  223. GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
  224. GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
  225. OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
  226. AC_SUBST([GL_LIB_NAME])
  227. AC_SUBST([GLU_LIB_NAME])
  228. AC_SUBST([GLUT_LIB_NAME])
  229. AC_SUBST([GLW_LIB_NAME])
  230. AC_SUBST([OSMESA_LIB_NAME])
  231. AC_SUBST([GL_LIB_GLOB])
  232. AC_SUBST([GLU_LIB_GLOB])
  233. AC_SUBST([GLUT_LIB_GLOB])
  234. AC_SUBST([GLW_LIB_GLOB])
  235. AC_SUBST([OSMESA_LIB_GLOB])
  236. dnl
  237. dnl Arch/platform-specific settings
  238. dnl
  239. AC_ARG_ENABLE([asm],
  240. [AS_HELP_STRING([--disable-asm],
  241. [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
  242. [enable_asm="$enableval"],
  243. [enable_asm=yes]
  244. )
  245. asm_arch=""
  246. ASM_FLAGS=""
  247. MESA_ASM_SOURCES=""
  248. GLAPI_ASM_SOURCES=""
  249. AC_MSG_CHECKING([whether to enable assembly])
  250. test "x$enable_asm" = xno && AC_MSG_RESULT([no])
  251. # disable if cross compiling on x86/x86_64 since we must run gen_matypes
  252. if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
  253. case "$host_cpu" in
  254. i?86 | x86_64)
  255. enable_asm=no
  256. AC_MSG_RESULT([no, cross compiling])
  257. ;;
  258. esac
  259. fi
  260. # check for supported arches
  261. if test "x$enable_asm" = xyes; then
  262. case "$host_cpu" in
  263. i?86)
  264. case "$host_os" in
  265. linux* | *freebsd* | dragonfly*)
  266. test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
  267. ;;
  268. esac
  269. ;;
  270. x86_64)
  271. case "$host_os" in
  272. linux* | *freebsd* | dragonfly*)
  273. test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
  274. ;;
  275. esac
  276. ;;
  277. powerpc)
  278. case "$host_os" in
  279. linux*)
  280. asm_arch=ppc
  281. ;;
  282. esac
  283. ;;
  284. sparc*)
  285. case "$host_os" in
  286. linux*)
  287. asm_arch=sparc
  288. ;;
  289. esac
  290. ;;
  291. esac
  292. case "$asm_arch" in
  293. x86)
  294. ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
  295. MESA_ASM_SOURCES='$(X86_SOURCES)'
  296. GLAPI_ASM_SOURCES='$(X86_API)'
  297. AC_MSG_RESULT([yes, x86])
  298. ;;
  299. x86_64)
  300. ASM_FLAGS="-DUSE_X86_64_ASM"
  301. MESA_ASM_SOURCES='$(X86-64_SOURCES)'
  302. GLAPI_ASM_SOURCES='$(X86-64_API)'
  303. AC_MSG_RESULT([yes, x86_64])
  304. ;;
  305. ppc)
  306. ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
  307. MESA_ASM_SOURCES='$(PPC_SOURCES)'
  308. AC_MSG_RESULT([yes, ppc])
  309. ;;
  310. sparc)
  311. ASM_FLAGS="-DUSE_SPARC_ASM"
  312. MESA_ASM_SOURCES='$(SPARC_SOURCES)'
  313. GLAPI_ASM_SOURCES='$(SPARC_API)'
  314. AC_MSG_RESULT([yes, sparc])
  315. ;;
  316. *)
  317. AC_MSG_RESULT([no, platform not supported])
  318. ;;
  319. esac
  320. fi
  321. AC_SUBST([ASM_FLAGS])
  322. AC_SUBST([MESA_ASM_SOURCES])
  323. AC_SUBST([GLAPI_ASM_SOURCES])
  324. dnl PIC code macro
  325. MESA_PIC_FLAGS
  326. dnl Check to see if dlopen is in default libraries (like Solaris, which
  327. dnl has it in libc), or if libdl is needed to get it.
  328. AC_CHECK_FUNC([dlopen], [],
  329. [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
  330. dnl See if posix_memalign is available
  331. AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
  332. dnl SELinux awareness.
  333. AC_ARG_ENABLE([selinux],
  334. [AS_HELP_STRING([--enable-selinux],
  335. [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
  336. [MESA_SELINUX="$enableval"],
  337. [MESA_SELINUX=no])
  338. if test "x$enable_selinux" = "xyes"; then
  339. AC_CHECK_HEADER([selinux/selinux.h],[],
  340. [AC_MSG_ERROR([SELinux headers not found])])
  341. AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
  342. [AC_MSG_ERROR([SELinux library not found])])
  343. SELINUX_LIBS="-lselinux"
  344. DEFINES="$DEFINES -DMESA_SELINUX"
  345. fi
  346. dnl
  347. dnl Driver configuration. Options are xlib, dri and osmesa right now.
  348. dnl More later: directfb, fbdev, ...
  349. dnl
  350. default_driver="xlib"
  351. case "$host_os" in
  352. linux*)
  353. case "$host_cpu" in
  354. i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
  355. esac
  356. ;;
  357. *freebsd* | dragonfly*)
  358. case "$host_cpu" in
  359. i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
  360. esac
  361. ;;
  362. esac
  363. AC_ARG_WITH([driver],
  364. [AS_HELP_STRING([--with-driver=DRIVER],
  365. [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
  366. [mesa_driver="$withval"],
  367. [mesa_driver="$default_driver"])
  368. dnl Check for valid option
  369. case "x$mesa_driver" in
  370. xxlib|xdri|xosmesa)
  371. ;;
  372. *)
  373. AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
  374. ;;
  375. esac
  376. dnl
  377. dnl Driver specific build directories
  378. dnl
  379. SRC_DIRS="glsl mesa glew"
  380. GLU_DIRS="sgi"
  381. WINDOW_SYSTEM=""
  382. GALLIUM_DIRS="auxiliary drivers state_trackers"
  383. GALLIUM_WINSYS_DIRS=""
  384. GALLIUM_WINSYS_DRM_DIRS=""
  385. GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
  386. GALLIUM_STATE_TRACKERS_DIRS=""
  387. case "$mesa_driver" in
  388. xlib)
  389. DRIVER_DIRS="x11"
  390. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
  391. ;;
  392. dri)
  393. SRC_DIRS="glx/x11 $SRC_DIRS"
  394. DRIVER_DIRS="dri"
  395. WINDOW_SYSTEM="dri"
  396. GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
  397. ;;
  398. osmesa)
  399. DRIVER_DIRS="osmesa"
  400. ;;
  401. esac
  402. AC_SUBST([SRC_DIRS])
  403. AC_SUBST([GLU_DIRS])
  404. AC_SUBST([DRIVER_DIRS])
  405. AC_SUBST([WINDOW_SYSTEM])
  406. AC_SUBST([GALLIUM_DIRS])
  407. AC_SUBST([GALLIUM_WINSYS_DIRS])
  408. AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
  409. AC_SUBST([GALLIUM_DRIVERS_DIRS])
  410. AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
  411. dnl
  412. dnl User supplied program configuration
  413. dnl
  414. if test -d "$srcdir/progs/demos"; then
  415. default_demos=yes
  416. else
  417. default_demos=no
  418. fi
  419. AC_ARG_WITH([demos],
  420. [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
  421. [optional comma delimited demo directories to build
  422. @<:@default=auto if source available@:>@])],
  423. [with_demos="$withval"],
  424. [with_demos="$default_demos"])
  425. if test "x$with_demos" = x; then
  426. with_demos=no
  427. fi
  428. dnl If $with_demos is yes, directories will be added as libs available
  429. PROGRAM_DIRS=""
  430. case "$with_demos" in
  431. no) ;;
  432. yes)
  433. # If the driver isn't osmesa, we have libGL and can build xdemos
  434. if test "$mesa_driver" != osmesa; then
  435. PROGRAM_DIRS="xdemos"
  436. fi
  437. ;;
  438. *)
  439. # verify the requested demos directories exist
  440. demos=`IFS=,; echo $with_demos`
  441. for demo in $demos; do
  442. test -d "$srcdir/progs/$demo" || \
  443. AC_MSG_ERROR([Program directory '$demo' doesn't exist])
  444. done
  445. PROGRAM_DIRS="$demos"
  446. ;;
  447. esac
  448. dnl
  449. dnl Find out if X is available. The variable have_x is set if libX11 is
  450. dnl found to mimic AC_PATH_XTRA.
  451. dnl
  452. if test -n "$PKG_CONFIG"; then
  453. AC_MSG_CHECKING([pkg-config files for X11 are available])
  454. PKG_CHECK_EXISTS([x11],[
  455. x11_pkgconfig=yes
  456. have_x=yes
  457. ],[
  458. x11_pkgconfig=no
  459. ])
  460. AC_MSG_RESULT([$x11_pkgconfig])
  461. else
  462. x11_pkgconfig=no
  463. fi
  464. dnl Use the autoconf macro if no pkg-config files
  465. if test "$x11_pkgconfig" = no; then
  466. AC_PATH_XTRA
  467. fi
  468. dnl Try to tell the user that the --x-* options are only used when
  469. dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
  470. m4_divert_once([HELP_BEGIN],
  471. [These options are only used when the X libraries cannot be found by the
  472. pkg-config utility.])
  473. dnl We need X for xlib and dri, so bomb now if it's not found
  474. case "$mesa_driver" in
  475. xlib|dri)
  476. if test "$no_x" = yes; then
  477. AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
  478. fi
  479. ;;
  480. esac
  481. dnl XCB - this is only used for GLX right now
  482. AC_ARG_ENABLE([xcb],
  483. [AS_HELP_STRING([--enable-xcb],
  484. [use XCB for GLX @<:@default=disabled@:>@])],
  485. [enable_xcb="$enableval"],
  486. [enable_xcb=no])
  487. if test "x$enable_xcb" = xyes; then
  488. DEFINES="$DEFINES -DUSE_XCB"
  489. else
  490. enable_xcb=no
  491. fi
  492. dnl
  493. dnl libGL configuration per driver
  494. dnl
  495. case "$mesa_driver" in
  496. xlib)
  497. if test "$x11_pkgconfig" = yes; then
  498. PKG_CHECK_MODULES([XLIBGL], [x11 xext])
  499. GL_PC_REQ_PRIV="x11 xext"
  500. X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
  501. GL_LIB_DEPS="$XLIBGL_LIBS"
  502. else
  503. # should check these...
  504. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  505. GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
  506. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  507. GL_PC_CFLAGS="$X11_INCLUDES"
  508. fi
  509. GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
  510. GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
  511. # if static, move the external libraries to the programs
  512. # and empty the libraries for libGL
  513. if test "$enable_static" = yes; then
  514. APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
  515. GL_LIB_DEPS=""
  516. fi
  517. ;;
  518. dri)
  519. # DRI must be shared, I think
  520. if test "$enable_static" = yes; then
  521. AC_MSG_ERROR([Can't use static libraries for DRI drivers])
  522. fi
  523. # Check for libdrm
  524. PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
  525. PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
  526. GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
  527. DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
  528. # find the DRI deps for libGL
  529. if test "$x11_pkgconfig" = yes; then
  530. # add xcb modules if necessary
  531. dri_modules="x11 xext xxf86vm xdamage xfixes"
  532. if test "$enable_xcb" = yes; then
  533. dri_modules="$dri_modules x11-xcb xcb-glx"
  534. fi
  535. PKG_CHECK_MODULES([DRIGL], [$dri_modules])
  536. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
  537. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  538. GL_LIB_DEPS="$DRIGL_LIBS"
  539. else
  540. # should check these...
  541. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  542. GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
  543. GL_PC_LIB_PRIV="$GL_LIB_DEPS"
  544. GL_PC_CFLAGS="$X11_INCLUDES"
  545. # XCB can only be used from pkg-config
  546. if test "$enable_xcb" = yes; then
  547. PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
  548. GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
  549. X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
  550. GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
  551. fi
  552. fi
  553. # need DRM libs, -lpthread, etc.
  554. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
  555. GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
  556. ;;
  557. osmesa)
  558. # No libGL for osmesa
  559. GL_LIB_DEPS=""
  560. ;;
  561. esac
  562. AC_SUBST([GL_LIB_DEPS])
  563. AC_SUBST([GL_PC_REQ_PRIV])
  564. AC_SUBST([GL_PC_LIB_PRIV])
  565. AC_SUBST([GL_PC_CFLAGS])
  566. AC_SUBST([DRI_PC_REQ_PRIV])
  567. dnl
  568. dnl More X11 setup
  569. dnl
  570. if test "$mesa_driver" = xlib; then
  571. DEFINES="$DEFINES -DUSE_XSHM"
  572. fi
  573. dnl
  574. dnl More DRI setup
  575. dnl
  576. AC_ARG_ENABLE([glx-tls],
  577. [AS_HELP_STRING([--enable-glx-tls],
  578. [enable TLS support in GLX @<:@default=disabled@:>@])],
  579. [GLX_USE_TLS="$enableval"],
  580. [GLX_USE_TLS=no])
  581. dnl Directory for DRI drivers
  582. AC_ARG_WITH([dri-driverdir],
  583. [AS_HELP_STRING([--with-dri-driverdir=DIR],
  584. [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
  585. [DRI_DRIVER_INSTALL_DIR="$withval"],
  586. [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
  587. AC_SUBST([DRI_DRIVER_INSTALL_DIR])
  588. dnl Extra search path for DRI drivers
  589. AC_ARG_WITH([dri-searchpath],
  590. [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
  591. [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
  592. [DRI_DRIVER_SEARCH_DIR="$withval"],
  593. [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
  594. AC_SUBST([DRI_DRIVER_SEARCH_DIR])
  595. dnl Direct rendering or just indirect rendering
  596. AC_ARG_ENABLE([driglx-direct],
  597. [AS_HELP_STRING([--disable-driglx-direct],
  598. [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
  599. [driglx_direct="$enableval"],
  600. [driglx_direct="yes"])
  601. dnl Which drivers to build - default is chosen by platform
  602. AC_ARG_WITH([dri-drivers],
  603. [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
  604. [comma delimited DRI drivers list, e.g.
  605. "swrast,i965,radeon" @<:@default=auto@:>@])],
  606. [with_dri_drivers="$withval"],
  607. [with_dri_drivers=yes])
  608. if test "x$with_dri_drivers" = x; then
  609. with_dri_drivers=no
  610. fi
  611. dnl If $with_dri_drivers is yes, directories will be added through
  612. dnl platform checks
  613. DRI_DIRS=""
  614. case "$with_dri_drivers" in
  615. no) ;;
  616. yes)
  617. DRI_DIRS="yes"
  618. ;;
  619. *)
  620. # verify the requested driver directories exist
  621. dri_drivers=`IFS=', '; echo $with_dri_drivers`
  622. for driver in $dri_drivers; do
  623. test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
  624. AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
  625. done
  626. DRI_DIRS="$dri_drivers"
  627. ;;
  628. esac
  629. dnl Just default to no EGL for now
  630. USING_EGL=0
  631. AC_SUBST([USING_EGL])
  632. dnl Set DRI_DIRS, DEFINES and LIB_DEPS
  633. if test "$mesa_driver" = dri; then
  634. # Use TLS in GLX?
  635. if test "x$GLX_USE_TLS" = xyes; then
  636. DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
  637. fi
  638. if test "x$USING_EGL" = x1; then
  639. PROGRAM_DIRS="egl"
  640. fi
  641. # Platform specific settings and drivers to build
  642. case "$host_os" in
  643. linux*)
  644. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  645. if test "x$driglx_direct" = xyes; then
  646. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  647. fi
  648. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  649. case "$host_cpu" in
  650. x86_64)
  651. # ffb, gamma, and sis are missing because they have not be
  652. # converted to use the new interface. i810 are missing
  653. # because there is no x86-64 system where they could *ever*
  654. # be used.
  655. if test "x$DRI_DIRS" = "xyes"; then
  656. DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  657. savage tdfx unichrome swrast"
  658. fi
  659. ;;
  660. powerpc*)
  661. # Build only the drivers for cards that exist on PowerPC.
  662. # At some point MGA will be added, but not yet.
  663. if test "x$DRI_DIRS" = "xyes"; then
  664. DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
  665. fi
  666. ;;
  667. sparc*)
  668. # Build only the drivers for cards that exist on sparc`
  669. if test "x$DRI_DIRS" = "xyes"; then
  670. DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast"
  671. fi
  672. ;;
  673. esac
  674. ;;
  675. freebsd* | dragonfly*)
  676. DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
  677. DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
  678. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  679. if test "x$driglx_direct" = xyes; then
  680. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  681. fi
  682. if test "x$GXX" = xyes; then
  683. CXXFLAGS="$CXXFLAGS -ansi -pedantic"
  684. fi
  685. # ffb and gamma are missing because they have not been converted
  686. # to use the new interface.
  687. if test "x$DRI_DIRS" = "xyes"; then
  688. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
  689. unichrome savage sis swrast"
  690. fi
  691. ;;
  692. gnu*)
  693. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  694. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  695. ;;
  696. solaris*)
  697. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  698. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  699. if test "x$driglx_direct" = xyes; then
  700. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  701. fi
  702. ;;
  703. esac
  704. # default drivers
  705. if test "x$DRI_DIRS" = "xyes"; then
  706. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
  707. savage sis tdfx unichrome ffb swrast"
  708. fi
  709. DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
  710. # Check for expat
  711. EXPAT_INCLUDES=""
  712. EXPAT_LIB=-lexpat
  713. AC_ARG_WITH([expat],
  714. [AS_HELP_STRING([--with-expat=DIR],
  715. [expat install directory])],[
  716. EXPAT_INCLUDES="-I$withval/include"
  717. CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
  718. LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
  719. EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
  720. ])
  721. AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
  722. AC_CHECK_LIB([expat],[XML_ParserCreate],[],
  723. [AC_MSG_ERROR([Expat required for DRI.])])
  724. # put all the necessary libs together
  725. DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
  726. fi
  727. AC_SUBST([DRI_DIRS])
  728. AC_SUBST([EXPAT_INCLUDES])
  729. AC_SUBST([DRI_LIB_DEPS])
  730. case $DRI_DIRS in
  731. *i915*|*i965*)
  732. PKG_CHECK_MODULES([INTEL], [libdrm_intel])
  733. ;;
  734. esac
  735. case $DRI_DIRS in
  736. *radeon*|*r200*|*r300*|*r600*)
  737. PKG_CHECK_MODULES([LIBDRM_RADEON],
  738. [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
  739. HAVE_LIBDRM_RADEON=yes,
  740. HAVE_LIBDRM_RADEON=no)
  741. if test "$HAVE_LIBDRM_RADEON" = yes; then
  742. RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
  743. RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
  744. fi
  745. ;;
  746. esac
  747. AC_SUBST([RADEON_CFLAGS])
  748. AC_SUBST([RADEON_LDFLAGS])
  749. dnl
  750. dnl OSMesa configuration
  751. dnl
  752. if test "$mesa_driver" = xlib; then
  753. default_gl_osmesa=yes
  754. else
  755. default_gl_osmesa=no
  756. fi
  757. AC_ARG_ENABLE([gl-osmesa],
  758. [AS_HELP_STRING([--enable-gl-osmesa],
  759. [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
  760. [gl_osmesa="$enableval"],
  761. [gl_osmesa="$default_gl_osmesa"])
  762. if test "x$gl_osmesa" = xyes; then
  763. if test "$mesa_driver" = osmesa; then
  764. AC_MSG_ERROR([libGL is not available for OSMesa driver])
  765. else
  766. DRIVER_DIRS="$DRIVER_DIRS osmesa"
  767. fi
  768. fi
  769. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  770. AC_ARG_WITH([osmesa-bits],
  771. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  772. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  773. [osmesa_bits="$withval"],
  774. [osmesa_bits=8])
  775. if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
  776. AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
  777. osmesa_bits=8
  778. fi
  779. case "x$osmesa_bits" in
  780. x8)
  781. OSMESA_LIB=OSMesa
  782. ;;
  783. x16|x32)
  784. OSMESA_LIB="OSMesa$osmesa_bits"
  785. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  786. ;;
  787. *)
  788. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  789. ;;
  790. esac
  791. AC_SUBST([OSMESA_LIB])
  792. case "$mesa_driver" in
  793. osmesa)
  794. # only link libraries with osmesa if shared
  795. if test "$enable_static" = no; then
  796. OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  797. else
  798. OSMESA_LIB_DEPS=""
  799. fi
  800. OSMESA_MESA_DEPS=""
  801. OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
  802. ;;
  803. *)
  804. # Link OSMesa to libGL otherwise
  805. OSMESA_LIB_DEPS=""
  806. # only link libraries with osmesa if shared
  807. if test "$enable_static" = no; then
  808. OSMESA_MESA_DEPS='-l$(GL_LIB)'
  809. else
  810. OSMESA_MESA_DEPS=""
  811. fi
  812. OSMESA_PC_REQ="gl"
  813. ;;
  814. esac
  815. OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
  816. AC_SUBST([OSMESA_LIB_DEPS])
  817. AC_SUBST([OSMESA_MESA_DEPS])
  818. AC_SUBST([OSMESA_PC_REQ])
  819. AC_SUBST([OSMESA_PC_LIB_PRIV])
  820. dnl
  821. dnl EGL configuration
  822. dnl
  823. AC_ARG_ENABLE([egl],
  824. [AS_HELP_STRING([--disable-egl],
  825. [disable EGL library @<:@default=enabled@:>@])],
  826. [enable_egl="$enableval"],
  827. [enable_egl=yes])
  828. if test "x$enable_egl" = xyes; then
  829. SRC_DIRS="$SRC_DIRS egl"
  830. if test "$x11_pkgconfig" = yes; then
  831. PKG_CHECK_MODULES([EGL], [x11])
  832. EGL_LIB_DEPS="$EGL_LIBS"
  833. else
  834. # should check these...
  835. EGL_LIB_DEPS="$X_LIBS -lX11"
  836. fi
  837. EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
  838. fi
  839. AC_SUBST([EGL_LIB_DEPS])
  840. dnl
  841. dnl GLU configuration
  842. dnl
  843. AC_ARG_ENABLE([glu],
  844. [AS_HELP_STRING([--disable-glu],
  845. [enable OpenGL Utility library @<:@default=enabled@:>@])],
  846. [enable_glu="$enableval"],
  847. [enable_glu=yes])
  848. if test "x$enable_glu" = xyes; then
  849. SRC_DIRS="$SRC_DIRS glu"
  850. case "$mesa_driver" in
  851. osmesa)
  852. # If GLU is available and we have libOSMesa (not 16 or 32),
  853. # we can build the osdemos
  854. if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
  855. PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
  856. fi
  857. # Link libGLU to libOSMesa instead of libGL
  858. GLU_LIB_DEPS=""
  859. GLU_PC_REQ="osmesa"
  860. if test "$enable_static" = no; then
  861. GLU_MESA_DEPS='-l$(OSMESA_LIB)'
  862. else
  863. GLU_MESA_DEPS=""
  864. fi
  865. ;;
  866. *)
  867. # If static, empty GLU_LIB_DEPS and add libs for programs to link
  868. GLU_PC_REQ="gl"
  869. GLU_PC_LIB_PRIV="-lm"
  870. if test "$enable_static" = no; then
  871. GLU_LIB_DEPS="-lm"
  872. GLU_MESA_DEPS='-l$(GL_LIB)'
  873. else
  874. GLU_LIB_DEPS=""
  875. GLU_MESA_DEPS=""
  876. APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
  877. fi
  878. ;;
  879. esac
  880. fi
  881. if test "$enable_static" = no; then
  882. GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
  883. fi
  884. GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
  885. AC_SUBST([GLU_LIB_DEPS])
  886. AC_SUBST([GLU_MESA_DEPS])
  887. AC_SUBST([GLU_PC_REQ])
  888. AC_SUBST([GLU_PC_REQ_PRIV])
  889. AC_SUBST([GLU_PC_LIB_PRIV])
  890. AC_SUBST([GLU_PC_CFLAGS])
  891. dnl
  892. dnl GLw configuration
  893. dnl
  894. AC_ARG_ENABLE([glw],
  895. [AS_HELP_STRING([--disable-glw],
  896. [enable Xt/Motif widget library @<:@default=enabled@:>@])],
  897. [enable_glw="$enableval"],
  898. [enable_glw=yes])
  899. dnl Don't build GLw on osmesa
  900. if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
  901. AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
  902. enable_glw=no
  903. fi
  904. AC_ARG_ENABLE([motif],
  905. [AS_HELP_STRING([--enable-motif],
  906. [use Motif widgets in GLw @<:@default=disabled@:>@])],
  907. [enable_motif="$enableval"],
  908. [enable_motif=no])
  909. if test "x$enable_glw" = xyes; then
  910. SRC_DIRS="$SRC_DIRS glw"
  911. if test "$x11_pkgconfig" = yes; then
  912. PKG_CHECK_MODULES([GLW],[x11 xt])
  913. GLW_PC_REQ_PRIV="x11 xt"
  914. GLW_LIB_DEPS="$GLW_LIBS"
  915. else
  916. # should check these...
  917. GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
  918. GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
  919. GLW_PC_CFLAGS="$X11_INCLUDES"
  920. fi
  921. GLW_SOURCES="GLwDrawA.c"
  922. MOTIF_CFLAGS=
  923. if test "x$enable_motif" = xyes; then
  924. GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
  925. AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
  926. if test "x$MOTIF_CONFIG" != xno; then
  927. MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
  928. MOTIF_LIBS=`$MOTIF_CONFIG --libs`
  929. else
  930. AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
  931. [AC_MSG_ERROR([Can't locate Motif headers])])
  932. AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
  933. [AC_MSG_ERROR([Can't locate Motif Xm library])])
  934. fi
  935. # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
  936. GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
  937. GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
  938. GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
  939. fi
  940. # If static, empty GLW_LIB_DEPS and add libs for programs to link
  941. GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
  942. if test "$enable_static" = no; then
  943. GLW_MESA_DEPS='-l$(GL_LIB)'
  944. GLW_LIB_DEPS="$GLW_LIB_DEPS"
  945. else
  946. APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
  947. GLW_LIB_DEPS=""
  948. GLW_MESA_DEPS=""
  949. fi
  950. fi
  951. AC_SUBST([GLW_LIB_DEPS])
  952. AC_SUBST([GLW_MESA_DEPS])
  953. AC_SUBST([GLW_SOURCES])
  954. AC_SUBST([MOTIF_CFLAGS])
  955. AC_SUBST([GLW_PC_REQ_PRIV])
  956. AC_SUBST([GLW_PC_LIB_PRIV])
  957. AC_SUBST([GLW_PC_CFLAGS])
  958. dnl
  959. dnl GLUT configuration
  960. dnl
  961. if test -f "$srcdir/include/GL/glut.h"; then
  962. default_glut=yes
  963. else
  964. default_glut=no
  965. fi
  966. AC_ARG_ENABLE([glut],
  967. [AS_HELP_STRING([--disable-glut],
  968. [enable GLUT library @<:@default=enabled if source available@:>@])],
  969. [enable_glut="$enableval"],
  970. [enable_glut="$default_glut"])
  971. dnl Can't build glut if GLU not available
  972. if test "x$enable_glu$enable_glut" = xnoyes; then
  973. AC_MSG_WARN([Disabling glut since GLU is disabled])
  974. enable_glut=no
  975. fi
  976. dnl Don't build glut on osmesa
  977. if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
  978. AC_MSG_WARN([Disabling glut since the driver is OSMesa])
  979. enable_glut=no
  980. fi
  981. if test "x$enable_glut" = xyes; then
  982. SRC_DIRS="$SRC_DIRS glut/glx"
  983. GLUT_CFLAGS=""
  984. if test "x$GCC" = xyes; then
  985. GLUT_CFLAGS="-fexceptions"
  986. fi
  987. if test "$x11_pkgconfig" = yes; then
  988. PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
  989. GLUT_PC_REQ_PRIV="x11 xmu xi"
  990. GLUT_LIB_DEPS="$GLUT_LIBS"
  991. else
  992. # should check these...
  993. GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
  994. GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
  995. GLUT_PC_CFLAGS="$X11_INCLUDES"
  996. fi
  997. GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
  998. GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
  999. # If glut is available, we can build most programs
  1000. if test "$with_demos" = yes; then
  1001. PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
  1002. fi
  1003. # If static, empty GLUT_LIB_DEPS and add libs for programs to link
  1004. if test "$enable_static" = no; then
  1005. GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
  1006. else
  1007. APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
  1008. GLUT_LIB_DEPS=""
  1009. GLUT_MESA_DEPS=""
  1010. fi
  1011. fi
  1012. AC_SUBST([GLUT_LIB_DEPS])
  1013. AC_SUBST([GLUT_MESA_DEPS])
  1014. AC_SUBST([GLUT_CFLAGS])
  1015. AC_SUBST([GLUT_PC_REQ_PRIV])
  1016. AC_SUBST([GLUT_PC_LIB_PRIV])
  1017. AC_SUBST([GLUT_PC_CFLAGS])
  1018. dnl
  1019. dnl Program library dependencies
  1020. dnl Only libm is added here if necessary as the libraries should
  1021. dnl be pulled in by the linker
  1022. dnl
  1023. if test "x$APP_LIB_DEPS" = x; then
  1024. case "$host_os" in
  1025. solaris*)
  1026. APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
  1027. ;;
  1028. cygwin*)
  1029. APP_LIB_DEPS="-lX11"
  1030. ;;
  1031. *)
  1032. APP_LIB_DEPS="-lm"
  1033. ;;
  1034. esac
  1035. fi
  1036. AC_SUBST([APP_LIB_DEPS])
  1037. AC_SUBST([PROGRAM_DIRS])
  1038. dnl
  1039. dnl Gallium configuration
  1040. dnl
  1041. AC_ARG_ENABLE([gallium],
  1042. [AS_HELP_STRING([--disable-gallium],
  1043. [build gallium @<:@default=enabled@:>@])],
  1044. [enable_gallium="$enableval"],
  1045. [enable_gallium=yes])
  1046. if test "x$enable_gallium" = xyes; then
  1047. SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
  1048. fi
  1049. dnl
  1050. dnl Gallium state trackers configuration
  1051. dnl
  1052. AC_ARG_WITH([state-trackers],
  1053. [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
  1054. [comma delimited state_trackers list, e.g.
  1055. "egl,glx" @<:@default=auto@:>@])],
  1056. [with_state_trackers="$withval"],
  1057. [with_state_trackers=yes])
  1058. case "$with_state_trackers" in
  1059. no)
  1060. GALLIUM_STATE_TRACKERS_DIRS=""
  1061. ;;
  1062. yes)
  1063. # look at what else is built
  1064. case "$mesa_driver" in
  1065. xlib)
  1066. GALLIUM_STATE_TRACKERS_DIRS=glx
  1067. ;;
  1068. dri)
  1069. GALLIUM_STATE_TRACKERS_DIRS="dri"
  1070. if test "x$enable_egl" = xyes; then
  1071. GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
  1072. fi
  1073. # Have only tested st/xorg on 1.6.0 servers
  1074. PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0],
  1075. HAVE_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
  1076. HAVE_XORG="no")
  1077. ;;
  1078. esac
  1079. ;;
  1080. *)
  1081. # verify the requested state tracker exist
  1082. state_trackers=`IFS=', '; echo $with_state_trackers`
  1083. for tracker in $state_trackers; do
  1084. test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
  1085. AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
  1086. if test "$tracker" = egl && test "x$enable_egl" != xyes; then
  1087. AC_MSG_ERROR([cannot build egl state tracker without EGL library])
  1088. fi
  1089. if test "$tracker" = xorg; then
  1090. PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
  1091. HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
  1092. HAVE_XEXTPROTO_71="no")
  1093. fi
  1094. done
  1095. GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
  1096. ;;
  1097. esac
  1098. AC_ARG_WITH([xorg-driver-dir],
  1099. [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
  1100. [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
  1101. [XORG_DRIVER_INSTALL_DIR="$withval"],
  1102. [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
  1103. AC_SUBST([XORG_DRIVER_INSTALL_DIR])
  1104. AC_ARG_WITH([max-width],
  1105. [AS_HELP_STRING([--with-max-width=N],
  1106. [Maximum framebuffer width (4096)])],
  1107. [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
  1108. AS_IF([test "${withval}" -gt "4096"],
  1109. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1110. )
  1111. AC_ARG_WITH([max-height],
  1112. [AS_HELP_STRING([--with-max-height=N],
  1113. [Maximum framebuffer height (4096)])],
  1114. [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
  1115. AS_IF([test "${withval}" -gt "4096"],
  1116. [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
  1117. )
  1118. dnl
  1119. dnl Gallium SVGA configuration
  1120. dnl
  1121. AC_ARG_ENABLE([gallium-svga],
  1122. [AS_HELP_STRING([--enable-gallium-svga],
  1123. [build gallium SVGA @<:@default=disabled@:>@])],
  1124. [enable_gallium_svga="$enableval"],
  1125. [enable_gallium_svga=auto])
  1126. if test "x$enable_gallium_svga" = xyes; then
  1127. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
  1128. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
  1129. elif test "x$enable_gallium_svga" = xauto; then
  1130. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
  1131. fi
  1132. dnl
  1133. dnl Gallium Intel configuration
  1134. dnl
  1135. AC_ARG_ENABLE([gallium-intel],
  1136. [AS_HELP_STRING([--enable-gallium-intel],
  1137. [build gallium intel @<:@default=disabled@:>@])],
  1138. [enable_gallium_intel="$enableval"],
  1139. [enable_gallium_intel=auto])
  1140. if test "x$enable_gallium_intel" = xyes; then
  1141. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel i965"
  1142. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
  1143. elif test "x$enable_gallium_intel" = xauto; then
  1144. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
  1145. fi
  1146. dnl
  1147. dnl Gallium Radeon configuration
  1148. dnl
  1149. AC_ARG_ENABLE([gallium-radeon],
  1150. [AS_HELP_STRING([--enable-gallium-radeon],
  1151. [build gallium radeon @<:@default=disabled@:>@])],
  1152. [enable_gallium_radeon="$enableval"],
  1153. [enable_gallium_radeon=no])
  1154. if test "x$enable_gallium_radeon" = xyes; then
  1155. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
  1156. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
  1157. fi
  1158. dnl
  1159. dnl Gallium Nouveau configuration
  1160. dnl
  1161. AC_ARG_ENABLE([gallium-nouveau],
  1162. [AS_HELP_STRING([--enable-gallium-nouveau],
  1163. [build gallium nouveau @<:@default=disabled@:>@])],
  1164. [enable_gallium_nouveau="$enableval"],
  1165. [enable_gallium_nouveau=no])
  1166. if test "x$enable_gallium_nouveau" = xyes; then
  1167. GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
  1168. GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50"
  1169. fi
  1170. dnl Restore LDFLAGS and CPPFLAGS
  1171. LDFLAGS="$_SAVE_LDFLAGS"
  1172. CPPFLAGS="$_SAVE_CPPFLAGS"
  1173. dnl Substitute the config
  1174. AC_CONFIG_FILES([configs/autoconf])
  1175. dnl Replace the configs/current symlink
  1176. AC_CONFIG_COMMANDS([configs],[
  1177. if test -f configs/current || test -L configs/current; then
  1178. rm -f configs/current
  1179. fi
  1180. ln -s autoconf configs/current
  1181. ])
  1182. AC_OUTPUT
  1183. dnl
  1184. dnl Output some configuration info for the user
  1185. dnl
  1186. echo ""
  1187. echo " prefix: $prefix"
  1188. echo " exec_prefix: $exec_prefix"
  1189. echo " libdir: $libdir"
  1190. echo " includedir: $includedir"
  1191. dnl Driver info
  1192. echo ""
  1193. echo " Driver: $mesa_driver"
  1194. if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
  1195. echo " OSMesa: lib$OSMESA_LIB"
  1196. else
  1197. echo " OSMesa: no"
  1198. fi
  1199. if test "$mesa_driver" = dri; then
  1200. # cleanup the drivers var
  1201. dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1202. if test "x$DRI_DIRS" = x; then
  1203. echo " DRI drivers: no"
  1204. else
  1205. echo " DRI drivers: $dri_dirs"
  1206. fi
  1207. echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
  1208. fi
  1209. echo " Use XCB: $enable_xcb"
  1210. echo ""
  1211. if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
  1212. echo " Gallium: yes"
  1213. echo " Gallium dirs: $GALLIUM_DIRS"
  1214. echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
  1215. echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
  1216. echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
  1217. echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
  1218. else
  1219. echo " Gallium: no"
  1220. fi
  1221. dnl Libraries
  1222. echo ""
  1223. echo " Shared libs: $enable_shared"
  1224. echo " Static libs: $enable_static"
  1225. echo " EGL: $enable_egl"
  1226. echo " GLU: $enable_glu"
  1227. echo " GLw: $enable_glw (Motif: $enable_motif)"
  1228. echo " glut: $enable_glut"
  1229. dnl Programs
  1230. # cleanup the programs var for display
  1231. program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1232. if test "x$program_dirs" = x; then
  1233. echo " Demos: no"
  1234. else
  1235. echo " Demos: $program_dirs"
  1236. fi
  1237. dnl Compiler options
  1238. # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
  1239. cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1240. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1241. cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
  1242. $SED 's/^ *//;s/ */ /;s/ *$//'`
  1243. defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
  1244. echo ""
  1245. echo " CFLAGS: $cflags"
  1246. echo " CXXFLAGS: $cxxflags"
  1247. echo " Macros: $defines"
  1248. echo ""
  1249. echo " Run '${MAKE-make}' to build Mesa"
  1250. echo ""