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 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. dnl Process this file with autoconf to create configure.
  2. AC_PREREQ(2.59)
  3. dnl Versioning
  4. dnl Make version number available to autoconf and configure
  5. m4_define(mesa_major, 7)
  6. m4_define(mesa_minor, 1)
  7. m4_define(mesa_tiny, 0)
  8. m4_define(mesa_version, [mesa_major().mesa_minor().mesa_tiny()])
  9. AC_INIT(Mesa, mesa_version(), mesa3d@sourceforge.net)
  10. AC_CONFIG_AUX_DIR(bin)
  11. AC_CANONICAL_HOST
  12. dnl Substitute the version number into shell variables
  13. MESA_MAJOR=mesa_major()
  14. MESA_MINOR=mesa_minor()
  15. MESA_TINY=mesa_tiny()
  16. AC_SUBST(MESA_MAJOR)
  17. AC_SUBST(MESA_MINOR)
  18. AC_SUBST(MESA_TINY)
  19. dnl Check for progs
  20. AC_PROG_CPP
  21. AC_PROG_CC
  22. AC_PROG_CXX
  23. AC_PATH_PROG(MAKE, make)
  24. AC_PATH_PROG(MKDEP, makedepend)
  25. AC_PATH_PROG(SED, sed)
  26. PKG_PROG_PKG_CONFIG()
  27. dnl LIB_DIR - library basename
  28. LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
  29. AC_SUBST(LIB_DIR)
  30. dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
  31. _SAVE_LDFLAGS="$LDFLAGS"
  32. AC_ARG_VAR(EXTRA_LIB_PATH,[Extra -L paths for the linker])
  33. AC_SUBST(EXTRA_LIB_PATH)
  34. dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
  35. _SAVE_CPPFLAGS="$CPPFLAGS"
  36. AC_ARG_VAR(X11_INCLUDES,[Extra -I paths for X11 headers])
  37. AC_SUBST(X11_INCLUDES)
  38. dnl Compiler macros
  39. DEFINES=""
  40. AC_SUBST(DEFINES)
  41. if test "x$GCC" = xyes; then
  42. DEFINES="-D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
  43. fi
  44. case "$host_os" in
  45. linux*)
  46. DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
  47. ;;
  48. esac
  49. dnl Add flags for gcc and g++
  50. if test "x$GCC" = xyes; then
  51. CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
  52. fi
  53. if test "x$GXX" = xyes; then
  54. CXXFLAGS="$CXXFLAGS -Wall"
  55. fi
  56. dnl These should be unnecessary, but let the user set them if they want
  57. AC_ARG_VAR(OPT_FLAGS, [Additional optimization flags for the compiler.
  58. Default is to use CFLAGS.])
  59. AC_ARG_VAR(ARCH_FLAGS, [Additional architecture specific flags for the
  60. compiler. Default is to use CFLAGS.])
  61. AC_SUBST(OPT_FLAGS)
  62. AC_SUBST(ARCH_FLAGS)
  63. dnl
  64. dnl shared/static libraries, mimic libtool options
  65. dnl
  66. AC_ARG_ENABLE(static,
  67. [AS_HELP_STRING([--enable-static],
  68. [build static libraries @<:@default=no@:>@])],
  69. enable_static="$enableval",
  70. enable_static=no
  71. )
  72. case "x$enable_static" in
  73. xyes|xno ) ;;
  74. x ) enable_static=no ;;
  75. * )
  76. AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
  77. ;;
  78. esac
  79. AC_ARG_ENABLE(shared,
  80. [AS_HELP_STRING([--disable-shared],
  81. [build shared libraries @<:@default=yes@:>@])],
  82. enable_shared="$enableval",
  83. enable_shared=yes
  84. )
  85. case "x$enable_shared" in
  86. xyes|xno ) ;;
  87. x ) enable_shared=yes ;;
  88. * )
  89. AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
  90. ;;
  91. esac
  92. dnl Can't have static and shared libraries, default to static if user
  93. dnl explicitly requested. If both disabled, set to static since shared
  94. dnl was explicitly requirested.
  95. case "x$enable_static$enable_shared" in
  96. xyesyes )
  97. AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
  98. enable_shared=no
  99. ;;
  100. xnono )
  101. AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
  102. enable_static=yes
  103. ;;
  104. esac
  105. dnl
  106. dnl mklib options
  107. dnl
  108. AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib])
  109. if test "$enable_static" = yes; then
  110. MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
  111. fi
  112. AC_SUBST(MKLIB_OPTIONS)
  113. dnl
  114. dnl library names
  115. dnl
  116. if test "$enable_static" = yes; then
  117. GL_LIB_NAME='lib$(GL_LIB).a'
  118. GLU_LIB_NAME='lib$(GLU_LIB).a'
  119. GLUT_LIB_NAME='lib$(GLUT_LIB).a'
  120. GLW_LIB_NAME='lib$(GLW_LIB).a'
  121. OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
  122. else
  123. GL_LIB_NAME='lib$(GL_LIB).so'
  124. GLU_LIB_NAME='lib$(GLU_LIB).so'
  125. GLUT_LIB_NAME='lib$(GLUT_LIB).so'
  126. GLW_LIB_NAME='lib$(GLW_LIB).so'
  127. OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
  128. fi
  129. AC_SUBST(GL_LIB_NAME)
  130. AC_SUBST(GLU_LIB_NAME)
  131. AC_SUBST(GLUT_LIB_NAME)
  132. AC_SUBST(GLW_LIB_NAME)
  133. AC_SUBST(OSMESA_LIB_NAME)
  134. dnl
  135. dnl Driver configuration. Options are x11 (Xlib), dri and osmesa right now.
  136. dnl More later: directfb, fbdev, ...
  137. dnl
  138. AC_ARG_WITH(driver,
  139. [AS_HELP_STRING([--with-driver=DRIVER],
  140. [driver for Mesa: x11,dri,osmesa @<:@default=x11@:>@])],
  141. mesa_driver="$withval",
  142. mesa_driver="x11")
  143. dnl Check for valid option
  144. case "x$mesa_driver" in
  145. xx11|xdri|xosmesa)
  146. ;;
  147. *)
  148. AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
  149. ;;
  150. esac
  151. dnl
  152. dnl Driver specific build directories
  153. dnl
  154. SRC_DIRS="mesa"
  155. GLU_DIRS="sgi"
  156. DRI_DIRS=""
  157. WINDOW_SYSTEM=""
  158. case "$mesa_driver" in
  159. x11)
  160. DRIVER_DIRS="x11"
  161. ;;
  162. dri)
  163. SRC_DIRS="glx/x11 $SRC_DIRS"
  164. DRIVER_DIRS="dri"
  165. WINDOW_SYSTEM="dri"
  166. ;;
  167. osmesa)
  168. DRIVER_DIRS="osmesa"
  169. ;;
  170. esac
  171. AC_SUBST(SRC_DIRS)
  172. AC_SUBST(GLU_DIRS)
  173. AC_SUBST(DRIVER_DIRS)
  174. AC_SUBST(WINDOW_SYSTEM)
  175. dnl
  176. dnl User supplied program configuration
  177. dnl
  178. if test -d "$srcdir/progs/demos"; then
  179. default_demos=yes
  180. else
  181. default_demos=no
  182. fi
  183. AC_ARG_WITH(demos,
  184. [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
  185. [optional comma delimited demo directories to build
  186. @<:@default=yes if source available@:>@])],
  187. with_demos="$withval",
  188. with_demos="$default_demos")
  189. if test "x$with_demos" = x; then
  190. with_demos=no
  191. fi
  192. dnl If $with_demos is yes, directories will be added as libs available
  193. PROGRAM_DIRS=""
  194. case "$with_demos" in
  195. no|yes) ;;
  196. *)
  197. # verify the requested demos directories exist
  198. demos=`IFS=,; echo $with_demos`
  199. for demo in $demos; do
  200. test -d "$srcdir/progs/$demo" || \
  201. AC_MSG_ERROR([Program directory '$demo' doesn't exist])
  202. done
  203. PROGRAM_DIRS="$demos"
  204. ;;
  205. esac
  206. dnl
  207. dnl Find out if X is available. The variables have_x or no_x will be
  208. dnl set and used later in the driver setups
  209. dnl
  210. if test -n "$PKG_CONFIG"; then
  211. AC_MSG_CHECKING([pkg-config files for X11 are available])
  212. if $PKG_CONFIG --exists x11; then
  213. x11_pkgconfig=yes
  214. have_x=yes
  215. AC_MSG_RESULT(yes)
  216. else
  217. x11_pkgconfig=no
  218. no_x=yes
  219. AC_MSG_RESULT(no)
  220. fi
  221. else
  222. x11_pkgconfig=no
  223. fi
  224. dnl Use the autoconf macro if no pkg-config files
  225. if test "$x11_pkgconfig" = no; then
  226. AC_PATH_XTRA
  227. fi
  228. dnl We need X for xlib and dri, so bomb now if it's not found
  229. case "$mesa_driver" in
  230. x11|dri)
  231. if test "$no_x" = yes; then
  232. AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
  233. fi
  234. ;;
  235. esac
  236. dnl
  237. dnl libGL configuration per driver
  238. dnl
  239. case "$mesa_driver" in
  240. x11)
  241. if test "$x11_pkgconfig" = yes; then
  242. PKG_CHECK_MODULES(X11GL, x11 xext)
  243. X11_INCLUDES="$X11_INCLUDES $X11GL_CFLAGS"
  244. GL_LIB_DEPS="$X11GL_LIBS"
  245. else
  246. # should check these...
  247. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  248. GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
  249. fi
  250. GL_LIB_DEPS="$GL_LIB_DEPS -lm -lpthread"
  251. # if static, move the external libraries to the programs
  252. # and empty the libraries for libGL
  253. if test "$enable_static" = yes; then
  254. APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
  255. GL_LIB_DEPS=""
  256. fi
  257. ;;
  258. dri)
  259. # DRI must be shared, I think
  260. if test "$enable_static" = yes; then
  261. AC_MSG_ERROR([Can't use static libraries for DRI drivers])
  262. fi
  263. # Check for libdrm
  264. PKG_CHECK_MODULES(LIBDRM, libdrm)
  265. # find the DRI deps for libGL
  266. if test "$x11_pkgconfig" = yes; then
  267. PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
  268. X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
  269. GL_LIB_DEPS="$DRIGL_LIBS"
  270. else
  271. # should check these...
  272. X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
  273. GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
  274. fi
  275. # need DRM libs, -lpthread, etc.
  276. GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread -ldl"
  277. ;;
  278. osmesa)
  279. # No libGL for osmesa
  280. GL_LIB_DEPS=""
  281. ;;
  282. esac
  283. AC_SUBST(GL_LIB_DEPS)
  284. dnl
  285. dnl More X11 setup
  286. dnl
  287. if test "$mesa_driver" = x11; then
  288. DEFINES="$DEFINES -DUSE_XSHM"
  289. fi
  290. dnl
  291. dnl More DRI setup
  292. dnl
  293. AC_ARG_ENABLE(glx-tls,
  294. [AS_HELP_STRING([--enable-glx-tls],
  295. [enable TLS support in GLX @<:@default=no@:>@])],
  296. GLX_USE_TLS="$enableval",
  297. GLX_USE_TLS=no)
  298. dnl Directory for DRI drivers
  299. AC_ARG_WITH(dridriverdir,
  300. [AS_HELP_STRING([--with-dridriverdir=DIR],
  301. [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
  302. DRI_DRIVER_INSTALL_DIR="$withval",
  303. DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
  304. AC_SUBST(DRI_DRIVER_INSTALL_DIR)
  305. dnl Direct rendering or just indirect rendering
  306. AC_ARG_ENABLE(driglx-direct,
  307. [AS_HELP_STRING([--enable-driglx-direct],
  308. [enable direct rendering in GLX for DRI @<:@default=yes@:>@])],
  309. driglx_direct="$enableval",
  310. driglx_direct="yes")
  311. dnl Just default to no EGL for now
  312. USING_EGL=0
  313. AC_SUBST(USING_EGL)
  314. dnl Set DRI_DIRS, DEFINES and LIB_DEPS
  315. if test "$mesa_driver" = dri; then
  316. # Use TLS in GLX?
  317. if test "x$GLX_USE_TLS" = xyes; then
  318. DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
  319. fi
  320. if test "x$USING_EGL" = x1; then
  321. PROGRAM_DIRS="egl"
  322. fi
  323. # Platform specific settings and drivers to build
  324. case "$host_os" in
  325. linux*)
  326. DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
  327. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
  328. if test "x$driglx_direct" = xyes; then
  329. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  330. fi
  331. case "$host_cpu" in
  332. i*86)
  333. DRI_DIRS="i810 i915tex i915 i965 mach64 mga r128 r200 r300 \
  334. radeon s3v savage sis tdfx trident unichrome ffb"
  335. ;;
  336. x86_64)
  337. DRI_DIRS="i915tex i915 i965 mach64 mga r128 r200 radeon tdfx \
  338. unichrome savage r300"
  339. ;;
  340. powerpc*)
  341. DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
  342. ;;
  343. esac
  344. ;;
  345. freebsd*)
  346. DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
  347. DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
  348. DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
  349. if test "x$driglx_direct" = xyes; then
  350. DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
  351. fi
  352. if test "x$GXX" = xyes; then
  353. CXXFLAGS="$CXXFLAGS -ansi -pedantic"
  354. fi
  355. DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
  356. unichrome savage sis"
  357. ;;
  358. esac
  359. DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
  360. # Check for expat
  361. EXPAT_INCLUDES=""
  362. EXPAT_LIB=-lexpat
  363. AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
  364. [expat install directory]),[
  365. EXPAT_INCLUDES="-I$withval/include"
  366. CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
  367. LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
  368. EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
  369. ])
  370. AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
  371. AC_CHECK_LIB(expat, XML_ParserCreate,,
  372. AC_MSG_ERROR([Expat required for DRI.]))
  373. # put all the necessary libs together
  374. DRI_LIB_DEPS="$LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl"
  375. fi
  376. AC_SUBST(DRI_DIRS)
  377. AC_SUBST(EXPAT_INCLUDES)
  378. AC_SUBST(DRI_LIB_DEPS)
  379. dnl
  380. dnl OSMesa configuration
  381. dnl
  382. if test "$mesa_driver" = x11; then
  383. default_x11_osmesa=yes
  384. else
  385. default_x11_osmesa=no
  386. fi
  387. AC_ARG_ENABLE(x11-osmesa,
  388. [AS_HELP_STRING([--enable-x11-osmesa],
  389. [enable OSMesa on X11 libGL @<:@default=yes for x11 driver@:>@])],
  390. x11_osmesa="$enableval",
  391. x11_osmesa="$default_x11_osmesa")
  392. if test "x$x11_osmesa" = xyes; then
  393. if test "$mesa_driver" = x11; then
  394. DRIVER_DIRS="$DRIVER_DIRS osmesa"
  395. else
  396. AC_MSG_ERROR([Can only enable OSMesa on libGL for X11])
  397. fi
  398. fi
  399. dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
  400. AC_ARG_WITH(osmesa-bits,
  401. [AS_HELP_STRING([--with-osmesa-bits=BITS],
  402. [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
  403. osmesa_bits="$withval",
  404. osmesa_bits=8)
  405. if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
  406. AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
  407. osmesa_bits=8
  408. fi
  409. case "x$osmesa_bits" in
  410. x8)
  411. OSMESA_LIB=OSMesa
  412. ;;
  413. x16|x32)
  414. OSMESA_LIB="OSMesa$osmesa_bits"
  415. DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
  416. ;;
  417. *)
  418. AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
  419. ;;
  420. esac
  421. AC_SUBST(OSMESA_LIB)
  422. case "$mesa_driver" in
  423. osmesa)
  424. # only link librararies with osmesa if shared
  425. if test "$enable_static" = no; then
  426. OSMESA_LIB_DEPS="-lm -lpthread"
  427. else
  428. OSMESA_LIB_DEPS=""
  429. fi
  430. OSMESA_MESA_DEPS=""
  431. ;;
  432. *)
  433. # Link OSMesa to libGL otherwise
  434. OSMESA_LIB_DEPS=""
  435. # only link librararies with osmesa if shared
  436. if test "$enable_static" = no; then
  437. OSMESA_MESA_DEPS='-l$(GL_LIB)'
  438. else
  439. OSMESA_MESA_DEPS=""
  440. fi
  441. ;;
  442. esac
  443. AC_SUBST(OSMESA_LIB_DEPS)
  444. AC_SUBST(OSMESA_MESA_DEPS)
  445. dnl
  446. dnl GLU configuration
  447. dnl
  448. AC_ARG_ENABLE(glu,
  449. [AS_HELP_STRING([--enable-glu],
  450. [enable OpenGL Utility library @<:@default=yes@:>@])],
  451. enable_glu="$enableval",
  452. enable_glu=yes)
  453. if test "x$enable_glu" = xyes; then
  454. SRC_DIRS="$SRC_DIRS glu"
  455. case "$mesa_driver" in
  456. osmesa)
  457. # If GLU is available and we have libOSMesa (not 16 or 32),
  458. # we can build the osdemos
  459. if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
  460. PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
  461. fi
  462. # Link libGLU to libOSMesa instead of libGL
  463. GLU_LIB_DEPS=""
  464. if test "$enable_static" = no; then
  465. GLU_MESA_DEPS='-l$(OSMESA_LIB)'
  466. else
  467. GLU_MESA_DEPS=""
  468. fi
  469. ;;
  470. *)
  471. # If GLU is available, we can build the xdemos
  472. if test "$with_demos" = yes; then
  473. PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
  474. fi
  475. # If static, empty GLU_LIB_DEPS and add libs for programs to link
  476. if test "$enable_static" = no; then
  477. GLU_LIB_DEPS="-lm"
  478. GLU_MESA_DEPS='-l$(GL_LIB)'
  479. else
  480. GLU_LIB_DEPS=""
  481. GLU_MESA_DEPS=""
  482. APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
  483. fi
  484. ;;
  485. esac
  486. fi
  487. AC_SUBST(GLU_LIB_DEPS)
  488. AC_SUBST(GLU_MESA_DEPS)
  489. dnl
  490. dnl GLw configuration
  491. dnl
  492. AC_ARG_ENABLE(glw,
  493. [AS_HELP_STRING([--enable-glw],
  494. [enable Xt/Motif widget library @<:@default=yes@:>@])],
  495. enable_glw="$enableval",
  496. enable_glw=yes)
  497. dnl Don't build GLw on osmesa
  498. if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
  499. AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
  500. enable_glw=no
  501. fi
  502. if test "x$enable_glw" = xyes; then
  503. SRC_DIRS="$SRC_DIRS glw"
  504. if test "$x11_pkgconfig" = yes; then
  505. PKG_CHECK_MODULES(GLW, x11 xt)
  506. GLW_LIB_DEPS="$GLW_LIBS"
  507. else
  508. # should check these...
  509. GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
  510. fi
  511. # If static, empty GLW_LIB_DEPS and add libs for programs to link
  512. if test "$enable_static" = no; then
  513. GLW_MESA_DEPS='-l$(GL_LIB)'
  514. else
  515. APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
  516. GLW_LIB_DEPS=""
  517. GLW_MESA_DEPS=""
  518. fi
  519. fi
  520. AC_SUBST(GLW_LIB_DEPS)
  521. AC_SUBST(GLW_MESA_DEPS)
  522. dnl
  523. dnl GLUT configuration
  524. dnl
  525. if test -f "$srcdir/include/GL/glut.h"; then
  526. default_glut=yes
  527. else
  528. default_glut=no
  529. fi
  530. AC_ARG_ENABLE(glut,
  531. [AS_HELP_STRING([--enable-glut],
  532. [enable GLUT library @<:@default=yes if source available@:>@])],
  533. enable_glut="$enableval",
  534. enable_glut="$default_glut")
  535. dnl Can't build glut if GLU not available
  536. if test "x$enable_glu$enable_glut" = xnoyes; then
  537. AC_MSG_WARN([Disabling glut since GLU is disabled])
  538. enable_glut=no
  539. fi
  540. dnl Don't build glut on osmesa
  541. if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
  542. AC_MSG_WARN([Disabling glut since the driver is OSMesa])
  543. enable_glut=no
  544. fi
  545. if test "x$enable_glut" = xyes; then
  546. SRC_DIRS="$SRC_DIRS glut/glx"
  547. GLUT_CFLAGS=""
  548. if test "x$GCC" = xyes; then
  549. GLUT_CFLAGS="-fexceptions"
  550. fi
  551. if test "$x11_pkgconfig" = yes; then
  552. PKG_CHECK_MODULES(GLUT, x11 xmu xt xi)
  553. GLUT_LIB_DEPS="$GLUT_LIBS"
  554. else
  555. # should check these...
  556. GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXt -lXi"
  557. fi
  558. GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
  559. # If glut is available, we can build most programs
  560. if test "$with_demos" = yes; then
  561. PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
  562. fi
  563. # If static, empty GLUT_LIB_DEPS and add libs for programs to link
  564. if test "$enable_static" = no; then
  565. GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
  566. else
  567. APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
  568. GLUT_LIB_DEPS=""
  569. GLUT_MESA_DEPS=""
  570. fi
  571. fi
  572. AC_SUBST(GLUT_LIB_DEPS)
  573. AC_SUBST(GLUT_MESA_DEPS)
  574. AC_SUBST(GLUT_CFLAGS)
  575. dnl
  576. dnl Program library dependencies
  577. dnl Only libm is added here if necessary as the libraries should
  578. dnl be pulled in by the linker
  579. dnl
  580. if test "x$APP_LIB_DEPS" = x; then
  581. APP_LIB_DEPS="-lm"
  582. fi
  583. AC_SUBST(APP_LIB_DEPS)
  584. AC_SUBST(PROGRAM_DIRS)
  585. dnl Arch/platform-specific settings
  586. PIC_FLAGS=""
  587. ASM_FLAGS=""
  588. ASM_SOURCES=""
  589. ASM_API=""
  590. AC_SUBST(PIC_FLAGS)
  591. AC_SUBST(ASM_FLAGS)
  592. AC_SUBST(ASM_SOURCES)
  593. AC_SUBST(ASM_API)
  594. case "$host_os" in
  595. linux*)
  596. PIC_FLAGS="-fPIC"
  597. case "$host_cpu" in
  598. i*86)
  599. ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
  600. ASM_SOURCES='$(X86_SOURCES)'
  601. ASM_API='$(X86_API)'
  602. ;;
  603. x86_64)
  604. ASM_FLAGS="-DUSE_X86_64_ASM"
  605. ASM_SOURCES='$(X86-64_SOURCES)'
  606. ASM_API='$(X86-64_API)'
  607. ;;
  608. powerpc)
  609. ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
  610. ASM_SOURCES='$(PPC_SOURCES)'
  611. ;;
  612. esac
  613. ;;
  614. freebsd*)
  615. PIC_FLAGS="-fPIC"
  616. case "$host_os" in
  617. i*86)
  618. PIC_FLAGS=""
  619. ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
  620. ASM_SOURCES='$(X86_SOURCES)'
  621. ASM_API='$(X86_API)'
  622. ;;
  623. x86_64)
  624. ASM_FLAGS="-DUSE_X86_64_ASM"
  625. ASM_SOURCES='$(X86-64_SOURCES)'
  626. ASM_API='$(X86-64_API)'
  627. ;;
  628. esac
  629. ;;
  630. esac
  631. dnl Restore LDFLAGS and CPPFLAGS
  632. LDFLAGS="$_SAVE_LDFLAGS"
  633. CPPFLAGS="$_SAVE_CPPFLAGS"
  634. dnl Substitute the config
  635. AC_OUTPUT([configs/autoconf])
  636. echo ""
  637. echo " Run 'make autoconf' to build Mesa"
  638. echo ""