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