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.

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