autoconf: Consistently use xlib for the driver name
[mesa.git] / configure.ac
1 dnl Process this file with autoconf to create configure.
2
3 AC_PREREQ(2.59)
4
5 dnl Versioning
6 dnl Make version number available to autoconf and configure
7 m4_define(mesa_major, 7)
8 m4_define(mesa_minor, 1)
9 m4_define(mesa_tiny, 0)
10 m4_define(mesa_version, [mesa_major().mesa_minor().mesa_tiny()])
11
12 AC_INIT(Mesa, mesa_version(), mesa3d@sourceforge.net)
13 AC_CONFIG_AUX_DIR(bin)
14 AC_CANONICAL_HOST
15
16 dnl Substitute the version number into shell variables
17 MESA_MAJOR=mesa_major()
18 MESA_MINOR=mesa_minor()
19 MESA_TINY=mesa_tiny()
20 AC_SUBST(MESA_MAJOR)
21 AC_SUBST(MESA_MINOR)
22 AC_SUBST(MESA_TINY)
23
24 dnl Check for progs
25 AC_PROG_CPP
26 AC_PROG_CC
27 AC_PROG_CXX
28 AC_PATH_PROG(MAKE, make)
29 AC_PATH_PROG(MKDEP, makedepend)
30 AC_PATH_PROG(SED, sed)
31
32 dnl Make sure the pkg-config macros are defined
33 m4_ifdef([PKG_PROG_PKG_CONFIG],,[
34 AC_MSG_ERROR([The pkg-config autoconf macros are not defined.
35 Did you run 'make configure'?])]
36 )
37 PKG_PROG_PKG_CONFIG()
38
39 dnl LIB_DIR - library basename
40 LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
41 AC_SUBST(LIB_DIR)
42
43 dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
44 _SAVE_LDFLAGS="$LDFLAGS"
45 AC_ARG_VAR(EXTRA_LIB_PATH,[Extra -L paths for the linker])
46 AC_SUBST(EXTRA_LIB_PATH)
47
48 dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
49 _SAVE_CPPFLAGS="$CPPFLAGS"
50 AC_ARG_VAR(X11_INCLUDES,[Extra -I paths for X11 headers])
51 AC_SUBST(X11_INCLUDES)
52
53 dnl Compiler macros
54 DEFINES=""
55 AC_SUBST(DEFINES)
56 if test "x$GCC" = xyes; then
57 DEFINES="-D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
58 fi
59 case "$host_os" in
60 linux*)
61 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
62 ;;
63 esac
64
65 dnl Add flags for gcc and g++
66 if test "x$GCC" = xyes; then
67 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
68 fi
69 if test "x$GXX" = xyes; then
70 CXXFLAGS="$CXXFLAGS -Wall"
71 fi
72
73 dnl These should be unnecessary, but let the user set them if they want
74 AC_ARG_VAR(OPT_FLAGS, [Additional optimization flags for the compiler.
75 Default is to use CFLAGS.])
76 AC_ARG_VAR(ARCH_FLAGS, [Additional architecture specific flags for the
77 compiler. Default is to use CFLAGS.])
78 AC_SUBST(OPT_FLAGS)
79 AC_SUBST(ARCH_FLAGS)
80
81 dnl
82 dnl shared/static libraries, mimic libtool options
83 dnl
84 AC_ARG_ENABLE(static,
85 [AS_HELP_STRING([--enable-static],
86 [build static libraries @<:@default=disabled@:>@])],
87 enable_static="$enableval",
88 enable_static=no
89 )
90 case "x$enable_static" in
91 xyes|xno ) ;;
92 x ) enable_static=no ;;
93 * )
94 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
95 ;;
96 esac
97 AC_ARG_ENABLE(shared,
98 [AS_HELP_STRING([--disable-shared],
99 [build shared libraries @<:@default=enabled@:>@])],
100 enable_shared="$enableval",
101 enable_shared=yes
102 )
103 case "x$enable_shared" in
104 xyes|xno ) ;;
105 x ) enable_shared=yes ;;
106 * )
107 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
108 ;;
109 esac
110
111 dnl Can't have static and shared libraries, default to static if user
112 dnl explicitly requested. If both disabled, set to static since shared
113 dnl was explicitly requirested.
114 case "x$enable_static$enable_shared" in
115 xyesyes )
116 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
117 enable_shared=no
118 ;;
119 xnono )
120 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
121 enable_static=yes
122 ;;
123 esac
124
125 dnl
126 dnl mklib options
127 dnl
128 AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib])
129 if test "$enable_static" = yes; then
130 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
131 fi
132 AC_SUBST(MKLIB_OPTIONS)
133
134 dnl
135 dnl other compiler options
136 dnl
137 AC_ARG_ENABLE(debug,
138 [AS_HELP_STRING([--enable-debug],
139 [use debug compiler flags and macros @<:@default=disabled@:>@])],
140 enable_debug="$enableval",
141 enable_debug=no
142 )
143 if test "x$enable_debug" = xyes; then
144 DEFINES="$DEFINES -DDEBUG"
145 if test "x$GCC" = xyes; then
146 CFLAGS="$CFLAGS -g"
147 fi
148 if test "x$GXX" = xyes; then
149 CXXFLAGS="$CXXFLAGS -g"
150 fi
151 fi
152 dnl These will be used near the end in the arch specific options
153 AC_ARG_ENABLE(asm,
154 [AS_HELP_STRING([--disable-asm],
155 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
156 enable_asm="$enableval",
157 enable_asm=yes
158 )
159
160 dnl
161 dnl library names
162 dnl
163 if test "$enable_static" = yes; then
164 GL_LIB_NAME='lib$(GL_LIB).a'
165 GLU_LIB_NAME='lib$(GLU_LIB).a'
166 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
167 GLW_LIB_NAME='lib$(GLW_LIB).a'
168 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
169 else
170 GL_LIB_NAME='lib$(GL_LIB).so'
171 GLU_LIB_NAME='lib$(GLU_LIB).so'
172 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
173 GLW_LIB_NAME='lib$(GLW_LIB).so'
174 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
175 fi
176 AC_SUBST(GL_LIB_NAME)
177 AC_SUBST(GLU_LIB_NAME)
178 AC_SUBST(GLUT_LIB_NAME)
179 AC_SUBST(GLW_LIB_NAME)
180 AC_SUBST(OSMESA_LIB_NAME)
181
182 dnl
183 dnl Driver configuration. Options are xlib, dri and osmesa right now.
184 dnl More later: directfb, fbdev, ...
185 dnl
186 AC_ARG_WITH(driver,
187 [AS_HELP_STRING([--with-driver=DRIVER],
188 [driver for Mesa: xlib,dri,osmesa @<:@default=xlib@:>@])],
189 mesa_driver="$withval",
190 mesa_driver="xlib")
191 dnl Check for valid option
192 case "x$mesa_driver" in
193 xxlib|xdri|xosmesa)
194 ;;
195 *)
196 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
197 ;;
198 esac
199
200 dnl
201 dnl Driver specific build directories
202 dnl
203 SRC_DIRS="mesa"
204 GLU_DIRS="sgi"
205 WINDOW_SYSTEM=""
206 case "$mesa_driver" in
207 xlib)
208 DRIVER_DIRS="x11"
209 ;;
210 dri)
211 SRC_DIRS="glx/x11 $SRC_DIRS"
212 DRIVER_DIRS="dri"
213 WINDOW_SYSTEM="dri"
214 ;;
215 osmesa)
216 DRIVER_DIRS="osmesa"
217 ;;
218 esac
219 AC_SUBST(SRC_DIRS)
220 AC_SUBST(GLU_DIRS)
221 AC_SUBST(DRIVER_DIRS)
222 AC_SUBST(WINDOW_SYSTEM)
223
224 dnl
225 dnl User supplied program configuration
226 dnl
227 if test -d "$srcdir/progs/demos"; then
228 default_demos=yes
229 else
230 default_demos=no
231 fi
232 AC_ARG_WITH(demos,
233 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
234 [optional comma delimited demo directories to build
235 @<:@default=yes if source available@:>@])],
236 with_demos="$withval",
237 with_demos="$default_demos")
238 if test "x$with_demos" = x; then
239 with_demos=no
240 fi
241
242 dnl If $with_demos is yes, directories will be added as libs available
243 PROGRAM_DIRS=""
244 case "$with_demos" in
245 no|yes) ;;
246 *)
247 # verify the requested demos directories exist
248 demos=`IFS=,; echo $with_demos`
249 for demo in $demos; do
250 test -d "$srcdir/progs/$demo" || \
251 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
252 done
253 PROGRAM_DIRS="$demos"
254 ;;
255 esac
256
257 dnl
258 dnl Find out if X is available. The variables have_x or no_x will be
259 dnl set and used later in the driver setups
260 dnl
261 if test -n "$PKG_CONFIG"; then
262 AC_MSG_CHECKING([pkg-config files for X11 are available])
263 if $PKG_CONFIG --exists x11; then
264 x11_pkgconfig=yes
265 have_x=yes
266 AC_MSG_RESULT(yes)
267 else
268 x11_pkgconfig=no
269 no_x=yes
270 AC_MSG_RESULT(no)
271 fi
272 else
273 x11_pkgconfig=no
274 fi
275 dnl Use the autoconf macro if no pkg-config files
276 if test "$x11_pkgconfig" = no; then
277 AC_PATH_XTRA
278 fi
279
280 dnl We need X for xlib and dri, so bomb now if it's not found
281 case "$mesa_driver" in
282 xlib|dri)
283 if test "$no_x" = yes; then
284 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
285 fi
286 ;;
287 esac
288
289 dnl
290 dnl libGL configuration per driver
291 dnl
292 case "$mesa_driver" in
293 xlib)
294 if test "$x11_pkgconfig" = yes; then
295 PKG_CHECK_MODULES(XLIBGL, x11 xext)
296 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
297 GL_LIB_DEPS="$XLIBGL_LIBS"
298 else
299 # should check these...
300 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
301 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
302 fi
303 GL_LIB_DEPS="$GL_LIB_DEPS -lm -lpthread"
304
305 # if static, move the external libraries to the programs
306 # and empty the libraries for libGL
307 if test "$enable_static" = yes; then
308 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
309 GL_LIB_DEPS=""
310 fi
311 ;;
312 dri)
313 # DRI must be shared, I think
314 if test "$enable_static" = yes; then
315 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
316 fi
317
318 # Check for libdrm
319 PKG_CHECK_MODULES(LIBDRM, libdrm)
320
321 # find the DRI deps for libGL
322 if test "$x11_pkgconfig" = yes; then
323 PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
324 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
325 GL_LIB_DEPS="$DRIGL_LIBS"
326 else
327 # should check these...
328 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
329 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
330 fi
331
332 # need DRM libs, -lpthread, etc.
333 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread -ldl"
334 ;;
335 osmesa)
336 # No libGL for osmesa
337 GL_LIB_DEPS=""
338 ;;
339 esac
340 AC_SUBST(GL_LIB_DEPS)
341
342 dnl
343 dnl More X11 setup
344 dnl
345 if test "$mesa_driver" = xlib; then
346 DEFINES="$DEFINES -DUSE_XSHM"
347 fi
348
349 dnl
350 dnl More DRI setup
351 dnl
352 AC_ARG_ENABLE(glx-tls,
353 [AS_HELP_STRING([--enable-glx-tls],
354 [enable TLS support in GLX @<:@default=disabled@:>@])],
355 GLX_USE_TLS="$enableval",
356 GLX_USE_TLS=no)
357 dnl Directory for DRI drivers
358 AC_ARG_WITH(dri-driverdir,
359 [AS_HELP_STRING([--with-dri-driverdir=DIR],
360 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
361 DRI_DRIVER_INSTALL_DIR="$withval",
362 DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
363 AC_SUBST(DRI_DRIVER_INSTALL_DIR)
364 dnl Direct rendering or just indirect rendering
365 AC_ARG_ENABLE(driglx-direct,
366 [AS_HELP_STRING([--disable-driglx-direct],
367 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
368 driglx_direct="$enableval",
369 driglx_direct="yes")
370
371 dnl Which drivers to build - default is chosen by platform
372 AC_ARG_WITH(dri-drivers,
373 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
374 [comma delimited DRI drivers to build @<:@default=auto by platform@:>@])],
375 with_dri_drivers="$withval",
376 with_dri_drivers=yes)
377 if test "x$with_dri_drivers" = x; then
378 with_dri_drivers=no
379 fi
380
381 dnl If $with_dri_drivers is yes, directories will be added through
382 dnl platform checks
383 DRI_DIRS=""
384 case "$with_dri_drivers" in
385 no|yes) ;;
386 *)
387 # verify the requested driver directories exist
388 dri_drivers=`IFS=,; echo $with_dri_drivers`
389 for driver in $dri_drivers; do
390 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
391 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
392 done
393 DRI_DIRS="$dri_drivers"
394 ;;
395 esac
396
397 dnl Just default to no EGL for now
398 USING_EGL=0
399 AC_SUBST(USING_EGL)
400
401 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
402 if test "$mesa_driver" = dri; then
403 # Use TLS in GLX?
404 if test "x$GLX_USE_TLS" = xyes; then
405 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
406 fi
407
408 if test "x$USING_EGL" = x1; then
409 PROGRAM_DIRS="egl"
410 fi
411
412 # default drivers
413 if test "x$DRI_DIRS" = x; then
414 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
415 savage sis tdfx trident unichrome ffb"
416 fi
417
418 # Platform specific settings and drivers to build
419 case "$host_os" in
420 linux*)
421 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
422 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
423 if test "x$driglx_direct" = xyes; then
424 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
425 fi
426
427 case "$host_cpu" in
428 x86_64)
429 # ffb, gamma, and sis are missing because they have not be
430 # converted to use the new interface. i810 are missing
431 # because there is no x86-64 system where they could *ever*
432 # be used.
433 if test "x$DRI_DIRS" = x; then
434 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
435 savage tdfx unichrome"
436 fi
437 ;;
438 powerpc*)
439 # Build only the drivers for cards that exist on PowerPC.
440 # At some point MGA will be added, but not yet.
441 if test "x$DRI_DIRS" = x; then
442 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
443 fi
444 ;;
445 esac
446 ;;
447 freebsd*)
448 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
449 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
450 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
451 if test "x$driglx_direct" = xyes; then
452 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
453 fi
454 if test "x$GXX" = xyes; then
455 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
456 fi
457
458 # ffb and gamma are missing because they have not been converted
459 # to use the new interface.
460 if test "x$DRI_DIRS" = x; then
461 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
462 unichrome savage sis"
463 fi
464 ;;
465 esac
466 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
467
468 # Check for expat
469 EXPAT_INCLUDES=""
470 EXPAT_LIB=-lexpat
471 AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
472 [expat install directory]),[
473 EXPAT_INCLUDES="-I$withval/include"
474 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
475 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
476 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
477 ])
478 AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
479 AC_CHECK_LIB(expat, XML_ParserCreate,,
480 AC_MSG_ERROR([Expat required for DRI.]))
481
482 # put all the necessary libs together
483 DRI_LIB_DEPS="$LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl"
484 fi
485 AC_SUBST(DRI_DIRS)
486 AC_SUBST(EXPAT_INCLUDES)
487 AC_SUBST(DRI_LIB_DEPS)
488
489 dnl
490 dnl OSMesa configuration
491 dnl
492 if test "$mesa_driver" = xlib; then
493 default_xlib_osmesa=yes
494 else
495 default_xlib_osmesa=no
496 fi
497 AC_ARG_ENABLE(xlib-osmesa,
498 [AS_HELP_STRING([--disable-xlib-osmesa],
499 [enable OSMesa on Xlib libGL @<:@default=enabled for xlib driver@:>@])],
500 xlib_osmesa="$enableval",
501 xlib_osmesa="$default_xlib_osmesa")
502 if test "x$xlib_osmesa" = xyes; then
503 if test "$mesa_driver" = xlib; then
504 DRIVER_DIRS="$DRIVER_DIRS osmesa"
505 else
506 AC_MSG_ERROR([Can only enable OSMesa on libGL for Xlib])
507 fi
508 fi
509
510 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
511 AC_ARG_WITH(osmesa-bits,
512 [AS_HELP_STRING([--with-osmesa-bits=BITS],
513 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
514 osmesa_bits="$withval",
515 osmesa_bits=8)
516 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
517 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
518 osmesa_bits=8
519 fi
520 case "x$osmesa_bits" in
521 x8)
522 OSMESA_LIB=OSMesa
523 ;;
524 x16|x32)
525 OSMESA_LIB="OSMesa$osmesa_bits"
526 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
527 ;;
528 *)
529 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
530 ;;
531 esac
532 AC_SUBST(OSMESA_LIB)
533
534 case "$mesa_driver" in
535 osmesa)
536 # only link librararies with osmesa if shared
537 if test "$enable_static" = no; then
538 OSMESA_LIB_DEPS="-lm -lpthread"
539 else
540 OSMESA_LIB_DEPS=""
541 fi
542 OSMESA_MESA_DEPS=""
543 ;;
544 *)
545 # Link OSMesa to libGL otherwise
546 OSMESA_LIB_DEPS=""
547 # only link librararies with osmesa if shared
548 if test "$enable_static" = no; then
549 OSMESA_MESA_DEPS='-l$(GL_LIB)'
550 else
551 OSMESA_MESA_DEPS=""
552 fi
553 ;;
554 esac
555 AC_SUBST(OSMESA_LIB_DEPS)
556 AC_SUBST(OSMESA_MESA_DEPS)
557
558 dnl
559 dnl GLU configuration
560 dnl
561 AC_ARG_ENABLE(glu,
562 [AS_HELP_STRING([--disable-glu],
563 [enable OpenGL Utility library @<:@default=enabled@:>@])],
564 enable_glu="$enableval",
565 enable_glu=yes)
566 if test "x$enable_glu" = xyes; then
567 SRC_DIRS="$SRC_DIRS glu"
568
569 case "$mesa_driver" in
570 osmesa)
571 # If GLU is available and we have libOSMesa (not 16 or 32),
572 # we can build the osdemos
573 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
574 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
575 fi
576
577 # Link libGLU to libOSMesa instead of libGL
578 GLU_LIB_DEPS=""
579 if test "$enable_static" = no; then
580 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
581 else
582 GLU_MESA_DEPS=""
583 fi
584 ;;
585 *)
586 # If GLU is available, we can build the xdemos
587 if test "$with_demos" = yes; then
588 PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
589 fi
590
591 # If static, empty GLU_LIB_DEPS and add libs for programs to link
592 if test "$enable_static" = no; then
593 GLU_LIB_DEPS="-lm"
594 GLU_MESA_DEPS='-l$(GL_LIB)'
595 else
596 GLU_LIB_DEPS=""
597 GLU_MESA_DEPS=""
598 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
599 fi
600 ;;
601 esac
602 fi
603 AC_SUBST(GLU_LIB_DEPS)
604 AC_SUBST(GLU_MESA_DEPS)
605
606 dnl
607 dnl GLw configuration
608 dnl
609 AC_ARG_ENABLE(glw,
610 [AS_HELP_STRING([--disable-glw],
611 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
612 enable_glw="$enableval",
613 enable_glw=yes)
614 dnl Don't build GLw on osmesa
615 if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
616 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
617 enable_glw=no
618 fi
619 if test "x$enable_glw" = xyes; then
620 SRC_DIRS="$SRC_DIRS glw"
621 if test "$x11_pkgconfig" = yes; then
622 PKG_CHECK_MODULES(GLW, x11 xt)
623 GLW_LIB_DEPS="$GLW_LIBS"
624 else
625 # should check these...
626 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
627 fi
628
629 # If static, empty GLW_LIB_DEPS and add libs for programs to link
630 if test "$enable_static" = no; then
631 GLW_MESA_DEPS='-l$(GL_LIB)'
632 else
633 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
634 GLW_LIB_DEPS=""
635 GLW_MESA_DEPS=""
636 fi
637 fi
638 AC_SUBST(GLW_LIB_DEPS)
639 AC_SUBST(GLW_MESA_DEPS)
640
641 dnl
642 dnl GLUT configuration
643 dnl
644 if test -f "$srcdir/include/GL/glut.h"; then
645 default_glut=yes
646 else
647 default_glut=no
648 fi
649 AC_ARG_ENABLE(glut,
650 [AS_HELP_STRING([--disable-glut],
651 [enable GLUT library @<:@default=enabled if source available@:>@])],
652 enable_glut="$enableval",
653 enable_glut="$default_glut")
654
655 dnl Can't build glut if GLU not available
656 if test "x$enable_glu$enable_glut" = xnoyes; then
657 AC_MSG_WARN([Disabling glut since GLU is disabled])
658 enable_glut=no
659 fi
660 dnl Don't build glut on osmesa
661 if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
662 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
663 enable_glut=no
664 fi
665
666 if test "x$enable_glut" = xyes; then
667 SRC_DIRS="$SRC_DIRS glut/glx"
668 GLUT_CFLAGS=""
669 if test "x$GCC" = xyes; then
670 GLUT_CFLAGS="-fexceptions"
671 fi
672 if test "$x11_pkgconfig" = yes; then
673 PKG_CHECK_MODULES(GLUT, x11 xmu xi)
674 GLUT_LIB_DEPS="$GLUT_LIBS"
675 else
676 # should check these...
677 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
678 fi
679 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
680
681 # If glut is available, we can build most programs
682 if test "$with_demos" = yes; then
683 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
684 fi
685
686 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
687 if test "$enable_static" = no; then
688 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
689 else
690 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
691 GLUT_LIB_DEPS=""
692 GLUT_MESA_DEPS=""
693 fi
694 fi
695 AC_SUBST(GLUT_LIB_DEPS)
696 AC_SUBST(GLUT_MESA_DEPS)
697 AC_SUBST(GLUT_CFLAGS)
698
699 dnl
700 dnl Program library dependencies
701 dnl Only libm is added here if necessary as the libraries should
702 dnl be pulled in by the linker
703 dnl
704 if test "x$APP_LIB_DEPS" = x; then
705 APP_LIB_DEPS="-lm"
706 fi
707 AC_SUBST(APP_LIB_DEPS)
708 AC_SUBST(PROGRAM_DIRS)
709
710 dnl Arch/platform-specific settings
711 PIC_FLAGS=""
712 ASM_FLAGS=""
713 ASM_SOURCES=""
714 ASM_API=""
715 AC_SUBST(PIC_FLAGS)
716 AC_SUBST(ASM_FLAGS)
717 AC_SUBST(ASM_SOURCES)
718 AC_SUBST(ASM_API)
719 case "$host_os" in
720 linux*)
721 PIC_FLAGS="-fPIC"
722 case "$host_cpu" in
723 i*86)
724 if test "x$enable_asm" = xyes; then
725 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
726 ASM_SOURCES='$(X86_SOURCES)'
727 ASM_API='$(X86_API)'
728 fi
729 ;;
730 x86_64)
731 if test "x$enable_asm" = xyes; then
732 ASM_FLAGS="-DUSE_X86_64_ASM"
733 ASM_SOURCES='$(X86-64_SOURCES)'
734 ASM_API='$(X86-64_API)'
735 fi
736 ;;
737 powerpc)
738 if test "x$enable_asm" = xyes; then
739 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
740 ASM_SOURCES='$(PPC_SOURCES)'
741 fi
742 ;;
743 esac
744 ;;
745 freebsd*)
746 PIC_FLAGS="-fPIC"
747 case "$host_os" in
748 i*86)
749 PIC_FLAGS=""
750 if test "x$enable_asm" = xyes; then
751 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
752 ASM_SOURCES='$(X86_SOURCES)'
753 ASM_API='$(X86_API)'
754 fi
755 ;;
756 x86_64)
757 if test "x$enable_asm" = xyes; then
758 ASM_FLAGS="-DUSE_X86_64_ASM"
759 ASM_SOURCES='$(X86-64_SOURCES)'
760 ASM_API='$(X86-64_API)'
761 fi
762 ;;
763 esac
764 ;;
765 esac
766
767 dnl Restore LDFLAGS and CPPFLAGS
768 LDFLAGS="$_SAVE_LDFLAGS"
769 CPPFLAGS="$_SAVE_CPPFLAGS"
770
771 dnl Substitute the config
772 AC_OUTPUT([configs/autoconf])
773
774 dnl Replace the configs/current symlink
775 if test -f configs/current || test -L configs/current; then
776 rm -f configs/current
777 fi
778 ln -s autoconf configs/current
779
780 dnl
781 dnl Output some configuration info for the user
782 dnl
783 echo ""
784 echo " prefix: $prefix"
785 echo " exec_prefix: $exec_prefix"
786 echo " libdir: $libdir"
787
788 dnl Driver info
789 echo ""
790 echo " Driver: $mesa_driver"
791 case "$mesa_driver" in
792 xlib|osmesa)
793 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
794 echo " OSMesa: lib$OSMESA_LIB"
795 else
796 echo " OSMesa: no"
797 fi
798 ;;
799 dri)
800 # cleanup the drivers var
801 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
802 echo " DRI drivers: $dri_dirs"
803 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
804 ;;
805 esac
806
807 dnl Libraries
808 echo ""
809 echo " Shared libs: $enable_shared"
810 echo " Static libs: $enable_static"
811 echo " GLU: $enable_glu"
812 echo " GLw: $enable_glw"
813 echo " glut: $enable_glut"
814
815 dnl Programs
816 # cleanup the programs var for display
817 program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
818 if test "x$program_dirs" = x; then
819 echo " Demos: no"
820 else
821 echo " Demos: $program_dirs"
822 fi
823
824 dnl Compiler options
825 # cleanup the CFLAGS/CXXFLAGS/DEFINES vars
826 cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
827 $SED 's/^ *//;s/ */ /;s/ *$//'`
828 cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
829 $SED 's/^ *//;s/ */ /;s/ *$//'`
830 defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
831 echo ""
832 echo " CFLAGS: $cflags"
833 echo " CXXFLAGS: $cxxflags"
834 echo " Macros: $defines"
835
836 echo ""
837 echo " Run 'make' to build Mesa"
838 echo ""