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

configure.ac 35KB

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