blob: a7707f8a8e4567483990777189853ed3efe84418 [file] [log] [blame]
Dan Nicholsondca1b792007-10-23 09:25:58 -07001dnl Process this file with autoconf to create configure.
2
3AC_PREREQ(2.59)
4
5dnl Versioning
6dnl Make version number available to autoconf and configure
7m4_define(mesa_major, 7)
8m4_define(mesa_minor, 1)
9m4_define(mesa_tiny, 0)
10m4_define(mesa_version, [mesa_major().mesa_minor().mesa_tiny()])
11
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -080012AC_INIT([Mesa],[mesa_version()],
13 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
Dan Nicholsondca1b792007-10-23 09:25:58 -070014AC_CONFIG_AUX_DIR(bin)
15AC_CANONICAL_HOST
16
17dnl Substitute the version number into shell variables
18MESA_MAJOR=mesa_major()
19MESA_MINOR=mesa_minor()
20MESA_TINY=mesa_tiny()
21AC_SUBST(MESA_MAJOR)
22AC_SUBST(MESA_MINOR)
23AC_SUBST(MESA_TINY)
24
25dnl Check for progs
26AC_PROG_CPP
27AC_PROG_CC
28AC_PROG_CXX
29AC_PATH_PROG(MAKE, make)
30AC_PATH_PROG(MKDEP, makedepend)
31AC_PATH_PROG(SED, sed)
Dan Nicholson41b00702007-12-12 08:48:30 -080032
33dnl Make sure the pkg-config macros are defined
34m4_ifdef([PKG_PROG_PKG_CONFIG],,[
35 AC_MSG_ERROR([The pkg-config autoconf macros are not defined.
36 Did you run 'make configure'?])]
37)
Dan Nicholsondca1b792007-10-23 09:25:58 -070038PKG_PROG_PKG_CONFIG()
39
40dnl LIB_DIR - library basename
41LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
42AC_SUBST(LIB_DIR)
43
44dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
45_SAVE_LDFLAGS="$LDFLAGS"
46AC_ARG_VAR(EXTRA_LIB_PATH,[Extra -L paths for the linker])
47AC_SUBST(EXTRA_LIB_PATH)
48
49dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
50_SAVE_CPPFLAGS="$CPPFLAGS"
51AC_ARG_VAR(X11_INCLUDES,[Extra -I paths for X11 headers])
52AC_SUBST(X11_INCLUDES)
53
54dnl Compiler macros
55DEFINES=""
56AC_SUBST(DEFINES)
57if test "x$GCC" = xyes; then
58 DEFINES="-D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
59fi
60case "$host_os" in
61linux*)
62 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
63 ;;
64esac
65
66dnl Add flags for gcc and g++
67if test "x$GCC" = xyes; then
68 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
Dan Nicholson0c275b62008-01-15 22:52:25 -080069
70 # Work around aliasing bugs - developers should comment this out
71 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070072fi
73if test "x$GXX" = xyes; then
74 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -080075
76 # Work around aliasing bugs - developers should comment this out
77 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070078fi
79
80dnl These should be unnecessary, but let the user set them if they want
81AC_ARG_VAR(OPT_FLAGS, [Additional optimization flags for the compiler.
82 Default is to use CFLAGS.])
83AC_ARG_VAR(ARCH_FLAGS, [Additional architecture specific flags for the
84 compiler. Default is to use CFLAGS.])
85AC_SUBST(OPT_FLAGS)
86AC_SUBST(ARCH_FLAGS)
87
88dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -060089dnl Hacks to enable 32 or 64 bit build
90dnl
91AC_ARG_ENABLE(32-bit,
92 [AS_HELP_STRING([--enable-32-bit],
93 [build 32-bit libraries @<:@default=auto@:>@])],
94 enable_32bit="$enableval",
95 enable_32bit=auto
96)
97if test "x$enable_32bit" = xyes; then
98 if test "x$GCC" = xyes; then
99 CFLAGS="$CFLAGS -m32"
100 fi
101 if test "x$GXX" = xyes; then
102 CXXFLAGS="$CXXFLAGS -m32"
103 fi
104fi
105AC_ARG_ENABLE(64-bit,
106 [AS_HELP_STRING([--enable-64-bit],
107 [build 64-bit libraries @<:@default=auto@:>@])],
108 enable_64bit="$enableval",
109 enable_64bit=auto
110)
111if test "x$enable_64bit" = xyes; then
112 if test "x$GCC" = xyes; then
113 CFLAGS="$CFLAGS -m64"
114 fi
115 if test "x$GXX" = xyes; then
116 CXXFLAGS="$CXXFLAGS -m64"
117 fi
118fi
119
120dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800121dnl shared/static libraries, mimic libtool options
122dnl
123AC_ARG_ENABLE(static,
124 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800125 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -0800126 enable_static="$enableval",
127 enable_static=no
128)
129case "x$enable_static" in
130xyes|xno ) ;;
131x ) enable_static=no ;;
132* )
133 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
134 ;;
135esac
136AC_ARG_ENABLE(shared,
137 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800138 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -0800139 enable_shared="$enableval",
140 enable_shared=yes
141)
142case "x$enable_shared" in
143xyes|xno ) ;;
144x ) enable_shared=yes ;;
145* )
146 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
147 ;;
148esac
149
150dnl Can't have static and shared libraries, default to static if user
151dnl explicitly requested. If both disabled, set to static since shared
152dnl was explicitly requirested.
153case "x$enable_static$enable_shared" in
154xyesyes )
155 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
156 enable_shared=no
157 ;;
158xnono )
159 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
160 enable_static=yes
161 ;;
162esac
163
164dnl
165dnl mklib options
166dnl
167AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib])
168if test "$enable_static" = yes; then
169 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
170fi
171AC_SUBST(MKLIB_OPTIONS)
172
Dan Nicholson23656c42007-12-12 09:02:31 -0800173dnl
174dnl other compiler options
175dnl
176AC_ARG_ENABLE(debug,
177 [AS_HELP_STRING([--enable-debug],
178 [use debug compiler flags and macros @<:@default=disabled@:>@])],
179 enable_debug="$enableval",
180 enable_debug=no
181)
182if test "x$enable_debug" = xyes; then
183 DEFINES="$DEFINES -DDEBUG"
184 if test "x$GCC" = xyes; then
185 CFLAGS="$CFLAGS -g"
186 fi
187 if test "x$GXX" = xyes; then
188 CXXFLAGS="$CXXFLAGS -g"
189 fi
190fi
Dan Nicholson3e288622007-12-12 09:02:31 -0800191dnl These will be used near the end in the arch specific options
192AC_ARG_ENABLE(asm,
193 [AS_HELP_STRING([--disable-asm],
194 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
195 enable_asm="$enableval",
196 enable_asm=yes
197)
Dan Nicholson88586332007-11-15 08:59:57 -0800198
199dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700200dnl library names
201dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800202if test "$enable_static" = yes; then
203 GL_LIB_NAME='lib$(GL_LIB).a'
204 GLU_LIB_NAME='lib$(GLU_LIB).a'
205 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
206 GLW_LIB_NAME='lib$(GLW_LIB).a'
207 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
208else
209 GL_LIB_NAME='lib$(GL_LIB).so'
210 GLU_LIB_NAME='lib$(GLU_LIB).so'
211 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
212 GLW_LIB_NAME='lib$(GLW_LIB).so'
213 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
214fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700215AC_SUBST(GL_LIB_NAME)
216AC_SUBST(GLU_LIB_NAME)
217AC_SUBST(GLUT_LIB_NAME)
218AC_SUBST(GLW_LIB_NAME)
219AC_SUBST(OSMESA_LIB_NAME)
220
221dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800222dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800223dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800224dnl
225AC_ARG_WITH(driver,
226 [AS_HELP_STRING([--with-driver=DRIVER],
Dan Nicholsona1307182007-12-12 17:49:49 -0800227 [driver for Mesa: xlib,dri,osmesa @<:@default=xlib@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800228 mesa_driver="$withval",
Dan Nicholsona1307182007-12-12 17:49:49 -0800229 mesa_driver="xlib")
Dan Nicholson44d99142007-12-05 18:47:01 -0800230dnl Check for valid option
231case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800232xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800233 ;;
234*)
235 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
236 ;;
237esac
238
239dnl
240dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700241dnl
242SRC_DIRS="mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700243GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800244WINDOW_SYSTEM=""
245case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800246xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800247 DRIVER_DIRS="x11"
248 ;;
249dri)
250 SRC_DIRS="glx/x11 $SRC_DIRS"
251 DRIVER_DIRS="dri"
252 WINDOW_SYSTEM="dri"
253 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800254osmesa)
255 DRIVER_DIRS="osmesa"
256 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800257esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700258AC_SUBST(SRC_DIRS)
259AC_SUBST(GLU_DIRS)
260AC_SUBST(DRIVER_DIRS)
Dan Nicholson44d99142007-12-05 18:47:01 -0800261AC_SUBST(WINDOW_SYSTEM)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700262
263dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800264dnl User supplied program configuration
265dnl
266if test -d "$srcdir/progs/demos"; then
267 default_demos=yes
268else
269 default_demos=no
270fi
271AC_ARG_WITH(demos,
272 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
273 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800274 @<:@default=auto if source available@:>@])],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800275 with_demos="$withval",
276 with_demos="$default_demos")
277if test "x$with_demos" = x; then
278 with_demos=no
279fi
280
281dnl If $with_demos is yes, directories will be added as libs available
282PROGRAM_DIRS=""
283case "$with_demos" in
284no|yes) ;;
285*)
286 # verify the requested demos directories exist
287 demos=`IFS=,; echo $with_demos`
288 for demo in $demos; do
289 test -d "$srcdir/progs/$demo" || \
290 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
291 done
292 PROGRAM_DIRS="$demos"
293 ;;
294esac
295
296dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700297dnl Find out if X is available. The variables have_x or no_x will be
298dnl set and used later in the driver setups
299dnl
300if test -n "$PKG_CONFIG"; then
301 AC_MSG_CHECKING([pkg-config files for X11 are available])
302 if $PKG_CONFIG --exists x11; then
303 x11_pkgconfig=yes
304 have_x=yes
305 AC_MSG_RESULT(yes)
306 else
307 x11_pkgconfig=no
308 no_x=yes
309 AC_MSG_RESULT(no)
310 fi
311else
312 x11_pkgconfig=no
313fi
314dnl Use the autoconf macro if no pkg-config files
315if test "$x11_pkgconfig" = no; then
316 AC_PATH_XTRA
317fi
318
Dan Nicholson44d99142007-12-05 18:47:01 -0800319dnl We need X for xlib and dri, so bomb now if it's not found
320case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800321xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800322 if test "$no_x" = yes; then
323 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
324 fi
325 ;;
326esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700327
Adam Jackson66611f22008-02-15 13:49:12 -0500328# SELinux awareness.
329AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux], [Build SELinux-aware Mesa (default: disabled)]), [MESA_SELINUX=$enableval], [MESA_SELINUX=no])
330if test "x$enable_selinux" = "xyes"; then
331 AC_CHECK_HEADER(selinux/selinux.h,,
332 AC_MSG_ERROR([SELinux headers not found]))
333 AC_CHECK_LIB(selinux,is_selinux_enabled,,
334 AC_MSG_ERROR([SELinux library not found]))
335 SELINUX_LIBS="-lselinux"
336 DEFINES="$DEFINES -DMESA_SELINUX"
337fi
338
Dan Nicholson44d99142007-12-05 18:47:01 -0800339dnl
340dnl libGL configuration per driver
341dnl
342case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800343xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800344 if test "$x11_pkgconfig" = yes; then
Dan Nicholsona1307182007-12-12 17:49:49 -0800345 PKG_CHECK_MODULES(XLIBGL, x11 xext)
346 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
347 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800348 else
349 # should check these...
350 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
351 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
352 fi
Adam Jackson66611f22008-02-15 13:49:12 -0500353 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800354
355 # if static, move the external libraries to the programs
356 # and empty the libraries for libGL
357 if test "$enable_static" = yes; then
358 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
359 GL_LIB_DEPS=""
360 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800361 ;;
362dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800363 # DRI must be shared, I think
364 if test "$enable_static" = yes; then
365 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
366 fi
367
Dan Nicholson44d99142007-12-05 18:47:01 -0800368 # Check for libdrm
369 PKG_CHECK_MODULES(LIBDRM, libdrm)
370
371 # find the DRI deps for libGL
372 if test "$x11_pkgconfig" = yes; then
373 PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
374 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
375 GL_LIB_DEPS="$DRIGL_LIBS"
376 else
377 # should check these...
378 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
379 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
380 fi
381
382 # need DRM libs, -lpthread, etc.
383 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread -ldl"
384 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800385osmesa)
386 # No libGL for osmesa
387 GL_LIB_DEPS=""
388 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800389esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700390AC_SUBST(GL_LIB_DEPS)
391
392dnl
393dnl More X11 setup
394dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800395if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700396 DEFINES="$DEFINES -DUSE_XSHM"
397fi
398
399dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800400dnl More DRI setup
401dnl
402AC_ARG_ENABLE(glx-tls,
403 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800404 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800405 GLX_USE_TLS="$enableval",
406 GLX_USE_TLS=no)
407dnl Directory for DRI drivers
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800408AC_ARG_WITH(dri-driverdir,
409 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson44d99142007-12-05 18:47:01 -0800410 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
411 DRI_DRIVER_INSTALL_DIR="$withval",
412 DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
413AC_SUBST(DRI_DRIVER_INSTALL_DIR)
414dnl Direct rendering or just indirect rendering
415AC_ARG_ENABLE(driglx-direct,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800416 [AS_HELP_STRING([--disable-driglx-direct],
417 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800418 driglx_direct="$enableval",
419 driglx_direct="yes")
420
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800421dnl Which drivers to build - default is chosen by platform
422AC_ARG_WITH(dri-drivers,
423 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800424 [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800425 with_dri_drivers="$withval",
426 with_dri_drivers=yes)
427if test "x$with_dri_drivers" = x; then
428 with_dri_drivers=no
429fi
430
431dnl If $with_dri_drivers is yes, directories will be added through
432dnl platform checks
433DRI_DIRS=""
434case "$with_dri_drivers" in
435no|yes) ;;
436*)
437 # verify the requested driver directories exist
438 dri_drivers=`IFS=,; echo $with_dri_drivers`
439 for driver in $dri_drivers; do
440 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
441 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
442 done
443 DRI_DIRS="$dri_drivers"
444 ;;
445esac
446
Dan Nicholson44d99142007-12-05 18:47:01 -0800447dnl Just default to no EGL for now
448USING_EGL=0
449AC_SUBST(USING_EGL)
450
451dnl Set DRI_DIRS, DEFINES and LIB_DEPS
452if test "$mesa_driver" = dri; then
453 # Use TLS in GLX?
454 if test "x$GLX_USE_TLS" = xyes; then
455 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
456 fi
457
458 if test "x$USING_EGL" = x1; then
459 PROGRAM_DIRS="egl"
460 fi
461
462 # Platform specific settings and drivers to build
463 case "$host_os" in
464 linux*)
465 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
466 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
467 if test "x$driglx_direct" = xyes; then
468 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
469 fi
470
471 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800472 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800473 # ffb, gamma, and sis are missing because they have not be
474 # converted to use the new interface. i810 are missing
475 # because there is no x86-64 system where they could *ever*
476 # be used.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800477 if test "x$DRI_DIRS" = x; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800478 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
479 savage tdfx unichrome"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800480 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800481 ;;
482 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800483 # Build only the drivers for cards that exist on PowerPC.
484 # At some point MGA will be added, but not yet.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800485 if test "x$DRI_DIRS" = x; then
486 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
487 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800488 ;;
489 esac
490 ;;
491 freebsd*)
492 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
493 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
494 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
495 if test "x$driglx_direct" = xyes; then
496 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
497 fi
498 if test "x$GXX" = xyes; then
499 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
500 fi
501
Dan Nicholsona76e2452007-12-07 11:25:08 -0800502 # ffb and gamma are missing because they have not been converted
503 # to use the new interface.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800504 if test "x$DRI_DIRS" = x; then
505 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
506 unichrome savage sis"
507 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800508 ;;
509 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800510
511 # default drivers
512 if test "x$DRI_DIRS" = x; then
513 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
514 savage sis tdfx trident unichrome ffb"
515 fi
516
Dan Nicholson44d99142007-12-05 18:47:01 -0800517 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
518
519 # Check for expat
520 EXPAT_INCLUDES=""
521 EXPAT_LIB=-lexpat
522 AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
523 [expat install directory]),[
524 EXPAT_INCLUDES="-I$withval/include"
525 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
526 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
527 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
528 ])
529 AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
530 AC_CHECK_LIB(expat, XML_ParserCreate,,
531 AC_MSG_ERROR([Expat required for DRI.]))
532
533 # put all the necessary libs together
Adam Jackson66611f22008-02-15 13:49:12 -0500534 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl"
Dan Nicholson44d99142007-12-05 18:47:01 -0800535fi
536AC_SUBST(DRI_DIRS)
537AC_SUBST(EXPAT_INCLUDES)
538AC_SUBST(DRI_LIB_DEPS)
539
540dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700541dnl OSMesa configuration
542dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800543if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800544 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800545else
Dan Nicholson544ab202007-12-30 08:41:53 -0800546 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800547fi
Dan Nicholson544ab202007-12-30 08:41:53 -0800548AC_ARG_ENABLE(gl-osmesa,
549 [AS_HELP_STRING([--enable-gl-osmesa],
550 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
551 gl_osmesa="$enableval",
552 gl_osmesa="$default_gl_osmesa")
553if test "x$gl_osmesa" = xyes; then
554 if test "$mesa_driver" = osmesa; then
555 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800556 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800557 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800558 fi
559fi
560
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800561dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
562AC_ARG_WITH(osmesa-bits,
563 [AS_HELP_STRING([--with-osmesa-bits=BITS],
564 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
565 osmesa_bits="$withval",
566 osmesa_bits=8)
567if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
568 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
569 osmesa_bits=8
570fi
571case "x$osmesa_bits" in
572x8)
573 OSMESA_LIB=OSMesa
574 ;;
575x16|x32)
576 OSMESA_LIB="OSMesa$osmesa_bits"
577 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
578 ;;
579*)
580 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
581 ;;
582esac
583AC_SUBST(OSMESA_LIB)
584
Dan Nicholson979ff512007-12-05 18:47:01 -0800585case "$mesa_driver" in
586osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800587 # only link librararies with osmesa if shared
588 if test "$enable_static" = no; then
Adam Jackson66611f22008-02-15 13:49:12 -0500589 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800590 else
591 OSMESA_LIB_DEPS=""
592 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800593 OSMESA_MESA_DEPS=""
594 ;;
595*)
596 # Link OSMesa to libGL otherwise
597 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800598 # only link librararies with osmesa if shared
599 if test "$enable_static" = no; then
600 OSMESA_MESA_DEPS='-l$(GL_LIB)'
601 else
602 OSMESA_MESA_DEPS=""
603 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800604 ;;
605esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700606AC_SUBST(OSMESA_LIB_DEPS)
607AC_SUBST(OSMESA_MESA_DEPS)
608
609dnl
610dnl GLU configuration
611dnl
612AC_ARG_ENABLE(glu,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800613 [AS_HELP_STRING([--disable-glu],
614 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700615 enable_glu="$enableval",
616 enable_glu=yes)
617if test "x$enable_glu" = xyes; then
618 SRC_DIRS="$SRC_DIRS glu"
619
Dan Nicholson979ff512007-12-05 18:47:01 -0800620 case "$mesa_driver" in
621 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800622 # If GLU is available and we have libOSMesa (not 16 or 32),
623 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800624 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800625 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
626 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700627
Dan Nicholson979ff512007-12-05 18:47:01 -0800628 # Link libGLU to libOSMesa instead of libGL
629 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800630 if test "$enable_static" = no; then
631 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
632 else
633 GLU_MESA_DEPS=""
634 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800635 ;;
636 *)
637 # If GLU is available, we can build the xdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800638 if test "$with_demos" = yes; then
639 PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
640 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800641
Dan Nicholson88586332007-11-15 08:59:57 -0800642 # If static, empty GLU_LIB_DEPS and add libs for programs to link
643 if test "$enable_static" = no; then
644 GLU_LIB_DEPS="-lm"
645 GLU_MESA_DEPS='-l$(GL_LIB)'
646 else
647 GLU_LIB_DEPS=""
648 GLU_MESA_DEPS=""
649 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
650 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800651 ;;
652 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700653fi
654AC_SUBST(GLU_LIB_DEPS)
655AC_SUBST(GLU_MESA_DEPS)
656
657dnl
658dnl GLw configuration
659dnl
660AC_ARG_ENABLE(glw,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800661 [AS_HELP_STRING([--disable-glw],
662 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700663 enable_glw="$enableval",
664 enable_glw=yes)
Dan Nicholson979ff512007-12-05 18:47:01 -0800665dnl Don't build GLw on osmesa
666if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
667 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
668 enable_glw=no
669fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700670if test "x$enable_glw" = xyes; then
671 SRC_DIRS="$SRC_DIRS glw"
672 if test "$x11_pkgconfig" = yes; then
673 PKG_CHECK_MODULES(GLW, x11 xt)
674 GLW_LIB_DEPS="$GLW_LIBS"
675 else
676 # should check these...
677 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
678 fi
679
Dan Nicholson88586332007-11-15 08:59:57 -0800680 # If static, empty GLW_LIB_DEPS and add libs for programs to link
681 if test "$enable_static" = no; then
682 GLW_MESA_DEPS='-l$(GL_LIB)'
683 else
684 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
685 GLW_LIB_DEPS=""
686 GLW_MESA_DEPS=""
687 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700688fi
689AC_SUBST(GLW_LIB_DEPS)
690AC_SUBST(GLW_MESA_DEPS)
691
692dnl
693dnl GLUT configuration
694dnl
695if test -f "$srcdir/include/GL/glut.h"; then
696 default_glut=yes
697else
698 default_glut=no
699fi
700AC_ARG_ENABLE(glut,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800701 [AS_HELP_STRING([--disable-glut],
702 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700703 enable_glut="$enableval",
704 enable_glut="$default_glut")
705
706dnl Can't build glut if GLU not available
707if test "x$enable_glu$enable_glut" = xnoyes; then
708 AC_MSG_WARN([Disabling glut since GLU is disabled])
709 enable_glut=no
710fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800711dnl Don't build glut on osmesa
712if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
713 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
714 enable_glut=no
715fi
716
Dan Nicholsondca1b792007-10-23 09:25:58 -0700717if test "x$enable_glut" = xyes; then
718 SRC_DIRS="$SRC_DIRS glut/glx"
719 GLUT_CFLAGS=""
720 if test "x$GCC" = xyes; then
721 GLUT_CFLAGS="-fexceptions"
722 fi
723 if test "$x11_pkgconfig" = yes; then
Dan Nicholson70d0c832007-12-07 11:12:20 -0800724 PKG_CHECK_MODULES(GLUT, x11 xmu xi)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700725 GLUT_LIB_DEPS="$GLUT_LIBS"
726 else
727 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -0800728 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700729 fi
730 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
731
732 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800733 if test "$with_demos" = yes; then
734 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
735 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700736
Dan Nicholson88586332007-11-15 08:59:57 -0800737 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
738 if test "$enable_static" = no; then
739 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
740 else
741 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
742 GLUT_LIB_DEPS=""
743 GLUT_MESA_DEPS=""
744 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700745fi
746AC_SUBST(GLUT_LIB_DEPS)
747AC_SUBST(GLUT_MESA_DEPS)
748AC_SUBST(GLUT_CFLAGS)
749
750dnl
751dnl Program library dependencies
752dnl Only libm is added here if necessary as the libraries should
753dnl be pulled in by the linker
754dnl
755if test "x$APP_LIB_DEPS" = x; then
756 APP_LIB_DEPS="-lm"
757fi
758AC_SUBST(APP_LIB_DEPS)
759AC_SUBST(PROGRAM_DIRS)
760
761dnl Arch/platform-specific settings
762PIC_FLAGS=""
763ASM_FLAGS=""
764ASM_SOURCES=""
765ASM_API=""
766AC_SUBST(PIC_FLAGS)
767AC_SUBST(ASM_FLAGS)
768AC_SUBST(ASM_SOURCES)
769AC_SUBST(ASM_API)
770case "$host_os" in
771linux*)
772 PIC_FLAGS="-fPIC"
773 case "$host_cpu" in
774 i*86)
Dan Nicholson3e288622007-12-12 09:02:31 -0800775 if test "x$enable_asm" = xyes; then
776 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
777 ASM_SOURCES='$(X86_SOURCES)'
778 ASM_API='$(X86_API)'
779 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700780 ;;
781 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800782 if test "x$enable_asm" = xyes; then
783 ASM_FLAGS="-DUSE_X86_64_ASM"
784 ASM_SOURCES='$(X86-64_SOURCES)'
785 ASM_API='$(X86-64_API)'
786 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700787 ;;
788 powerpc)
Dan Nicholson3e288622007-12-12 09:02:31 -0800789 if test "x$enable_asm" = xyes; then
790 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
791 ASM_SOURCES='$(PPC_SOURCES)'
792 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700793 ;;
794 esac
795 ;;
796freebsd*)
797 PIC_FLAGS="-fPIC"
Dan Nicholson758b9982008-02-21 10:32:04 -0800798 case "$host_cpu" in
Dan Nicholsondca1b792007-10-23 09:25:58 -0700799 i*86)
800 PIC_FLAGS=""
Dan Nicholson3e288622007-12-12 09:02:31 -0800801 if test "x$enable_asm" = xyes; then
802 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
803 ASM_SOURCES='$(X86_SOURCES)'
804 ASM_API='$(X86_API)'
805 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700806 ;;
807 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800808 if test "x$enable_asm" = xyes; then
809 ASM_FLAGS="-DUSE_X86_64_ASM"
810 ASM_SOURCES='$(X86-64_SOURCES)'
811 ASM_API='$(X86-64_API)'
812 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700813 ;;
814 esac
815 ;;
816esac
817
818dnl Restore LDFLAGS and CPPFLAGS
819LDFLAGS="$_SAVE_LDFLAGS"
820CPPFLAGS="$_SAVE_CPPFLAGS"
821
822dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -0800823AC_CONFIG_FILES([configs/autoconf])
824AC_OUTPUT
Dan Nicholsondca1b792007-10-23 09:25:58 -0700825
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800826dnl Replace the configs/current symlink
827if test -f configs/current || test -L configs/current; then
828 rm -f configs/current
829fi
830ln -s autoconf configs/current
831
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800832dnl
833dnl Output some configuration info for the user
834dnl
835echo ""
836echo " prefix: $prefix"
837echo " exec_prefix: $exec_prefix"
838echo " libdir: $libdir"
839
840dnl Driver info
841echo ""
842echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -0800843if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
844 echo " OSMesa: lib$OSMESA_LIB"
845else
846 echo " OSMesa: no"
847fi
848if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800849 # cleanup the drivers var
850 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
851 echo " DRI drivers: $dri_dirs"
852 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -0800853fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800854
855dnl Libraries
856echo ""
857echo " Shared libs: $enable_shared"
858echo " Static libs: $enable_static"
859echo " GLU: $enable_glu"
860echo " GLw: $enable_glw"
861echo " glut: $enable_glut"
862
863dnl Programs
864# cleanup the programs var for display
865program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
866if test "x$program_dirs" = x; then
867 echo " Demos: no"
868else
869 echo " Demos: $program_dirs"
870fi
871
Dan Nicholson16a07fb2007-12-12 09:12:15 -0800872dnl Compiler options
873# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
874cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
875 $SED 's/^ *//;s/ */ /;s/ *$//'`
876cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
877 $SED 's/^ *//;s/ */ /;s/ *$//'`
878defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
879echo ""
880echo " CFLAGS: $cflags"
881echo " CXXFLAGS: $cxxflags"
882echo " Macros: $defines"
883
Dan Nicholsondca1b792007-10-23 09:25:58 -0700884echo ""
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800885echo " Run 'make' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700886echo ""