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