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.

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