autoconf: Optional debug build with --enable-debug
[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
153 dnl
154 dnl library names
155 dnl
156 if test "$enable_static" = yes; then
157 GL_LIB_NAME='lib$(GL_LIB).a'
158 GLU_LIB_NAME='lib$(GLU_LIB).a'
159 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
160 GLW_LIB_NAME='lib$(GLW_LIB).a'
161 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
162 else
163 GL_LIB_NAME='lib$(GL_LIB).so'
164 GLU_LIB_NAME='lib$(GLU_LIB).so'
165 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
166 GLW_LIB_NAME='lib$(GLW_LIB).so'
167 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
168 fi
169 AC_SUBST(GL_LIB_NAME)
170 AC_SUBST(GLU_LIB_NAME)
171 AC_SUBST(GLUT_LIB_NAME)
172 AC_SUBST(GLW_LIB_NAME)
173 AC_SUBST(OSMESA_LIB_NAME)
174
175 dnl
176 dnl Driver configuration. Options are x11 (Xlib), dri and osmesa right now.
177 dnl More later: directfb, fbdev, ...
178 dnl
179 AC_ARG_WITH(driver,
180 [AS_HELP_STRING([--with-driver=DRIVER],
181 [driver for Mesa: x11,dri,osmesa @<:@default=x11@:>@])],
182 mesa_driver="$withval",
183 mesa_driver="x11")
184 dnl Check for valid option
185 case "x$mesa_driver" in
186 xx11|xdri|xosmesa)
187 ;;
188 *)
189 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
190 ;;
191 esac
192
193 dnl
194 dnl Driver specific build directories
195 dnl
196 SRC_DIRS="mesa"
197 GLU_DIRS="sgi"
198 WINDOW_SYSTEM=""
199 case "$mesa_driver" in
200 x11)
201 DRIVER_DIRS="x11"
202 ;;
203 dri)
204 SRC_DIRS="glx/x11 $SRC_DIRS"
205 DRIVER_DIRS="dri"
206 WINDOW_SYSTEM="dri"
207 ;;
208 osmesa)
209 DRIVER_DIRS="osmesa"
210 ;;
211 esac
212 AC_SUBST(SRC_DIRS)
213 AC_SUBST(GLU_DIRS)
214 AC_SUBST(DRIVER_DIRS)
215 AC_SUBST(WINDOW_SYSTEM)
216
217 dnl
218 dnl User supplied program configuration
219 dnl
220 if test -d "$srcdir/progs/demos"; then
221 default_demos=yes
222 else
223 default_demos=no
224 fi
225 AC_ARG_WITH(demos,
226 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
227 [optional comma delimited demo directories to build
228 @<:@default=yes if source available@:>@])],
229 with_demos="$withval",
230 with_demos="$default_demos")
231 if test "x$with_demos" = x; then
232 with_demos=no
233 fi
234
235 dnl If $with_demos is yes, directories will be added as libs available
236 PROGRAM_DIRS=""
237 case "$with_demos" in
238 no|yes) ;;
239 *)
240 # verify the requested demos directories exist
241 demos=`IFS=,; echo $with_demos`
242 for demo in $demos; do
243 test -d "$srcdir/progs/$demo" || \
244 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
245 done
246 PROGRAM_DIRS="$demos"
247 ;;
248 esac
249
250 dnl
251 dnl Find out if X is available. The variables have_x or no_x will be
252 dnl set and used later in the driver setups
253 dnl
254 if test -n "$PKG_CONFIG"; then
255 AC_MSG_CHECKING([pkg-config files for X11 are available])
256 if $PKG_CONFIG --exists x11; then
257 x11_pkgconfig=yes
258 have_x=yes
259 AC_MSG_RESULT(yes)
260 else
261 x11_pkgconfig=no
262 no_x=yes
263 AC_MSG_RESULT(no)
264 fi
265 else
266 x11_pkgconfig=no
267 fi
268 dnl Use the autoconf macro if no pkg-config files
269 if test "$x11_pkgconfig" = no; then
270 AC_PATH_XTRA
271 fi
272
273 dnl We need X for xlib and dri, so bomb now if it's not found
274 case "$mesa_driver" in
275 x11|dri)
276 if test "$no_x" = yes; then
277 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
278 fi
279 ;;
280 esac
281
282 dnl
283 dnl libGL configuration per driver
284 dnl
285 case "$mesa_driver" in
286 x11)
287 if test "$x11_pkgconfig" = yes; then
288 PKG_CHECK_MODULES(X11GL, x11 xext)
289 X11_INCLUDES="$X11_INCLUDES $X11GL_CFLAGS"
290 GL_LIB_DEPS="$X11GL_LIBS"
291 else
292 # should check these...
293 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
294 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
295 fi
296 GL_LIB_DEPS="$GL_LIB_DEPS -lm -lpthread"
297
298 # if static, move the external libraries to the programs
299 # and empty the libraries for libGL
300 if test "$enable_static" = yes; then
301 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
302 GL_LIB_DEPS=""
303 fi
304 ;;
305 dri)
306 # DRI must be shared, I think
307 if test "$enable_static" = yes; then
308 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
309 fi
310
311 # Check for libdrm
312 PKG_CHECK_MODULES(LIBDRM, libdrm)
313
314 # find the DRI deps for libGL
315 if test "$x11_pkgconfig" = yes; then
316 PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
317 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
318 GL_LIB_DEPS="$DRIGL_LIBS"
319 else
320 # should check these...
321 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
322 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
323 fi
324
325 # need DRM libs, -lpthread, etc.
326 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread -ldl"
327 ;;
328 osmesa)
329 # No libGL for osmesa
330 GL_LIB_DEPS=""
331 ;;
332 esac
333 AC_SUBST(GL_LIB_DEPS)
334
335 dnl
336 dnl More X11 setup
337 dnl
338 if test "$mesa_driver" = x11; then
339 DEFINES="$DEFINES -DUSE_XSHM"
340 fi
341
342 dnl
343 dnl More DRI setup
344 dnl
345 AC_ARG_ENABLE(glx-tls,
346 [AS_HELP_STRING([--enable-glx-tls],
347 [enable TLS support in GLX @<:@default=disabled@:>@])],
348 GLX_USE_TLS="$enableval",
349 GLX_USE_TLS=no)
350 dnl Directory for DRI drivers
351 AC_ARG_WITH(dri-driverdir,
352 [AS_HELP_STRING([--with-dri-driverdir=DIR],
353 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
354 DRI_DRIVER_INSTALL_DIR="$withval",
355 DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
356 AC_SUBST(DRI_DRIVER_INSTALL_DIR)
357 dnl Direct rendering or just indirect rendering
358 AC_ARG_ENABLE(driglx-direct,
359 [AS_HELP_STRING([--disable-driglx-direct],
360 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
361 driglx_direct="$enableval",
362 driglx_direct="yes")
363
364 dnl Which drivers to build - default is chosen by platform
365 AC_ARG_WITH(dri-drivers,
366 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
367 [comma delimited DRI drivers to build @<:@default=auto by platform@:>@])],
368 with_dri_drivers="$withval",
369 with_dri_drivers=yes)
370 if test "x$with_dri_drivers" = x; then
371 with_dri_drivers=no
372 fi
373
374 dnl If $with_dri_drivers is yes, directories will be added through
375 dnl platform checks
376 DRI_DIRS=""
377 case "$with_dri_drivers" in
378 no|yes) ;;
379 *)
380 # verify the requested driver directories exist
381 dri_drivers=`IFS=,; echo $with_dri_drivers`
382 for driver in $dri_drivers; do
383 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
384 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
385 done
386 DRI_DIRS="$dri_drivers"
387 ;;
388 esac
389
390 dnl Just default to no EGL for now
391 USING_EGL=0
392 AC_SUBST(USING_EGL)
393
394 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
395 if test "$mesa_driver" = dri; then
396 # Use TLS in GLX?
397 if test "x$GLX_USE_TLS" = xyes; then
398 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
399 fi
400
401 if test "x$USING_EGL" = x1; then
402 PROGRAM_DIRS="egl"
403 fi
404
405 # default drivers
406 if test "x$DRI_DIRS" = x; then
407 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
408 savage sis tdfx trident unichrome ffb"
409 fi
410
411 # Platform specific settings and drivers to build
412 case "$host_os" in
413 linux*)
414 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
415 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
416 if test "x$driglx_direct" = xyes; then
417 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
418 fi
419
420 case "$host_cpu" in
421 x86_64)
422 # ffb, gamma, and sis are missing because they have not be
423 # converted to use the new interface. i810 are missing
424 # because there is no x86-64 system where they could *ever*
425 # be used.
426 if test "x$DRI_DIRS" = x; then
427 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
428 savage tdfx unichrome"
429 fi
430 ;;
431 powerpc*)
432 # Build only the drivers for cards that exist on PowerPC.
433 # At some point MGA will be added, but not yet.
434 if test "x$DRI_DIRS" = x; then
435 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
436 fi
437 ;;
438 esac
439 ;;
440 freebsd*)
441 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
442 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
443 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
444 if test "x$driglx_direct" = xyes; then
445 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
446 fi
447 if test "x$GXX" = xyes; then
448 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
449 fi
450
451 # ffb and gamma are missing because they have not been converted
452 # to use the new interface.
453 if test "x$DRI_DIRS" = x; then
454 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
455 unichrome savage sis"
456 fi
457 ;;
458 esac
459 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
460
461 # Check for expat
462 EXPAT_INCLUDES=""
463 EXPAT_LIB=-lexpat
464 AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
465 [expat install directory]),[
466 EXPAT_INCLUDES="-I$withval/include"
467 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
468 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
469 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
470 ])
471 AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
472 AC_CHECK_LIB(expat, XML_ParserCreate,,
473 AC_MSG_ERROR([Expat required for DRI.]))
474
475 # put all the necessary libs together
476 DRI_LIB_DEPS="$LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl"
477 fi
478 AC_SUBST(DRI_DIRS)
479 AC_SUBST(EXPAT_INCLUDES)
480 AC_SUBST(DRI_LIB_DEPS)
481
482 dnl
483 dnl OSMesa configuration
484 dnl
485 if test "$mesa_driver" = x11; then
486 default_x11_osmesa=yes
487 else
488 default_x11_osmesa=no
489 fi
490 AC_ARG_ENABLE(x11-osmesa,
491 [AS_HELP_STRING([--disable-x11-osmesa],
492 [enable OSMesa on X11 libGL @<:@default=enabled for x11 driver@:>@])],
493 x11_osmesa="$enableval",
494 x11_osmesa="$default_x11_osmesa")
495 if test "x$x11_osmesa" = xyes; then
496 if test "$mesa_driver" = x11; then
497 DRIVER_DIRS="$DRIVER_DIRS osmesa"
498 else
499 AC_MSG_ERROR([Can only enable OSMesa on libGL for X11])
500 fi
501 fi
502
503 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
504 AC_ARG_WITH(osmesa-bits,
505 [AS_HELP_STRING([--with-osmesa-bits=BITS],
506 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
507 osmesa_bits="$withval",
508 osmesa_bits=8)
509 if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
510 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
511 osmesa_bits=8
512 fi
513 case "x$osmesa_bits" in
514 x8)
515 OSMESA_LIB=OSMesa
516 ;;
517 x16|x32)
518 OSMESA_LIB="OSMesa$osmesa_bits"
519 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
520 ;;
521 *)
522 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
523 ;;
524 esac
525 AC_SUBST(OSMESA_LIB)
526
527 case "$mesa_driver" in
528 osmesa)
529 # only link librararies with osmesa if shared
530 if test "$enable_static" = no; then
531 OSMESA_LIB_DEPS="-lm -lpthread"
532 else
533 OSMESA_LIB_DEPS=""
534 fi
535 OSMESA_MESA_DEPS=""
536 ;;
537 *)
538 # Link OSMesa to libGL otherwise
539 OSMESA_LIB_DEPS=""
540 # only link librararies with osmesa if shared
541 if test "$enable_static" = no; then
542 OSMESA_MESA_DEPS='-l$(GL_LIB)'
543 else
544 OSMESA_MESA_DEPS=""
545 fi
546 ;;
547 esac
548 AC_SUBST(OSMESA_LIB_DEPS)
549 AC_SUBST(OSMESA_MESA_DEPS)
550
551 dnl
552 dnl GLU configuration
553 dnl
554 AC_ARG_ENABLE(glu,
555 [AS_HELP_STRING([--disable-glu],
556 [enable OpenGL Utility library @<:@default=enabled@:>@])],
557 enable_glu="$enableval",
558 enable_glu=yes)
559 if test "x$enable_glu" = xyes; then
560 SRC_DIRS="$SRC_DIRS glu"
561
562 case "$mesa_driver" in
563 osmesa)
564 # If GLU is available and we have libOSMesa (not 16 or 32),
565 # we can build the osdemos
566 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
567 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
568 fi
569
570 # Link libGLU to libOSMesa instead of libGL
571 GLU_LIB_DEPS=""
572 if test "$enable_static" = no; then
573 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
574 else
575 GLU_MESA_DEPS=""
576 fi
577 ;;
578 *)
579 # If GLU is available, we can build the xdemos
580 if test "$with_demos" = yes; then
581 PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
582 fi
583
584 # If static, empty GLU_LIB_DEPS and add libs for programs to link
585 if test "$enable_static" = no; then
586 GLU_LIB_DEPS="-lm"
587 GLU_MESA_DEPS='-l$(GL_LIB)'
588 else
589 GLU_LIB_DEPS=""
590 GLU_MESA_DEPS=""
591 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
592 fi
593 ;;
594 esac
595 fi
596 AC_SUBST(GLU_LIB_DEPS)
597 AC_SUBST(GLU_MESA_DEPS)
598
599 dnl
600 dnl GLw configuration
601 dnl
602 AC_ARG_ENABLE(glw,
603 [AS_HELP_STRING([--disable-glw],
604 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
605 enable_glw="$enableval",
606 enable_glw=yes)
607 dnl Don't build GLw on osmesa
608 if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
609 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
610 enable_glw=no
611 fi
612 if test "x$enable_glw" = xyes; then
613 SRC_DIRS="$SRC_DIRS glw"
614 if test "$x11_pkgconfig" = yes; then
615 PKG_CHECK_MODULES(GLW, x11 xt)
616 GLW_LIB_DEPS="$GLW_LIBS"
617 else
618 # should check these...
619 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
620 fi
621
622 # If static, empty GLW_LIB_DEPS and add libs for programs to link
623 if test "$enable_static" = no; then
624 GLW_MESA_DEPS='-l$(GL_LIB)'
625 else
626 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
627 GLW_LIB_DEPS=""
628 GLW_MESA_DEPS=""
629 fi
630 fi
631 AC_SUBST(GLW_LIB_DEPS)
632 AC_SUBST(GLW_MESA_DEPS)
633
634 dnl
635 dnl GLUT configuration
636 dnl
637 if test -f "$srcdir/include/GL/glut.h"; then
638 default_glut=yes
639 else
640 default_glut=no
641 fi
642 AC_ARG_ENABLE(glut,
643 [AS_HELP_STRING([--disable-glut],
644 [enable GLUT library @<:@default=enabled if source available@:>@])],
645 enable_glut="$enableval",
646 enable_glut="$default_glut")
647
648 dnl Can't build glut if GLU not available
649 if test "x$enable_glu$enable_glut" = xnoyes; then
650 AC_MSG_WARN([Disabling glut since GLU is disabled])
651 enable_glut=no
652 fi
653 dnl Don't build glut on osmesa
654 if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
655 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
656 enable_glut=no
657 fi
658
659 if test "x$enable_glut" = xyes; then
660 SRC_DIRS="$SRC_DIRS glut/glx"
661 GLUT_CFLAGS=""
662 if test "x$GCC" = xyes; then
663 GLUT_CFLAGS="-fexceptions"
664 fi
665 if test "$x11_pkgconfig" = yes; then
666 PKG_CHECK_MODULES(GLUT, x11 xmu xi)
667 GLUT_LIB_DEPS="$GLUT_LIBS"
668 else
669 # should check these...
670 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
671 fi
672 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
673
674 # If glut is available, we can build most programs
675 if test "$with_demos" = yes; then
676 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
677 fi
678
679 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
680 if test "$enable_static" = no; then
681 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
682 else
683 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
684 GLUT_LIB_DEPS=""
685 GLUT_MESA_DEPS=""
686 fi
687 fi
688 AC_SUBST(GLUT_LIB_DEPS)
689 AC_SUBST(GLUT_MESA_DEPS)
690 AC_SUBST(GLUT_CFLAGS)
691
692 dnl
693 dnl Program library dependencies
694 dnl Only libm is added here if necessary as the libraries should
695 dnl be pulled in by the linker
696 dnl
697 if test "x$APP_LIB_DEPS" = x; then
698 APP_LIB_DEPS="-lm"
699 fi
700 AC_SUBST(APP_LIB_DEPS)
701 AC_SUBST(PROGRAM_DIRS)
702
703 dnl Arch/platform-specific settings
704 PIC_FLAGS=""
705 ASM_FLAGS=""
706 ASM_SOURCES=""
707 ASM_API=""
708 AC_SUBST(PIC_FLAGS)
709 AC_SUBST(ASM_FLAGS)
710 AC_SUBST(ASM_SOURCES)
711 AC_SUBST(ASM_API)
712 case "$host_os" in
713 linux*)
714 PIC_FLAGS="-fPIC"
715 case "$host_cpu" in
716 i*86)
717 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
718 ASM_SOURCES='$(X86_SOURCES)'
719 ASM_API='$(X86_API)'
720 ;;
721 x86_64)
722 ASM_FLAGS="-DUSE_X86_64_ASM"
723 ASM_SOURCES='$(X86-64_SOURCES)'
724 ASM_API='$(X86-64_API)'
725 ;;
726 powerpc)
727 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
728 ASM_SOURCES='$(PPC_SOURCES)'
729 ;;
730 esac
731 ;;
732 freebsd*)
733 PIC_FLAGS="-fPIC"
734 case "$host_os" in
735 i*86)
736 PIC_FLAGS=""
737 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
738 ASM_SOURCES='$(X86_SOURCES)'
739 ASM_API='$(X86_API)'
740 ;;
741 x86_64)
742 ASM_FLAGS="-DUSE_X86_64_ASM"
743 ASM_SOURCES='$(X86-64_SOURCES)'
744 ASM_API='$(X86-64_API)'
745 ;;
746 esac
747 ;;
748 esac
749
750 dnl Restore LDFLAGS and CPPFLAGS
751 LDFLAGS="$_SAVE_LDFLAGS"
752 CPPFLAGS="$_SAVE_CPPFLAGS"
753
754 dnl Substitute the config
755 AC_OUTPUT([configs/autoconf])
756
757 dnl Replace the configs/current symlink
758 if test -f configs/current || test -L configs/current; then
759 rm -f configs/current
760 fi
761 ln -s autoconf configs/current
762
763 dnl
764 dnl Output some configuration info for the user
765 dnl
766 echo ""
767 echo " prefix: $prefix"
768 echo " exec_prefix: $exec_prefix"
769 echo " libdir: $libdir"
770
771 dnl Driver info
772 echo ""
773 echo " Driver: $mesa_driver"
774 case "$mesa_driver" in
775 x11|osmesa)
776 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
777 echo " OSMesa: lib$OSMESA_LIB"
778 else
779 echo " OSMesa: no"
780 fi
781 ;;
782 dri)
783 # cleanup the drivers var
784 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
785 echo " DRI drivers: $dri_dirs"
786 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
787 ;;
788 esac
789
790 dnl Libraries
791 echo ""
792 echo " Shared libs: $enable_shared"
793 echo " Static libs: $enable_static"
794 echo " GLU: $enable_glu"
795 echo " GLw: $enable_glw"
796 echo " glut: $enable_glut"
797
798 dnl Programs
799 # cleanup the programs var for display
800 program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
801 if test "x$program_dirs" = x; then
802 echo " Demos: no"
803 else
804 echo " Demos: $program_dirs"
805 fi
806
807 echo ""
808 echo " Run 'make' to build Mesa"
809 echo ""