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