blob: ca3f917196986a92c59209caf60da7d443790657 [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
Dan Nicholsondb7fc632008-03-07 11:48:09 -080033MKDEP_OPTIONS=-fdepend
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050034dnl Ask gcc where it's keeping its secret headers
35if test "x$GCC" = xyes; then
Dan Nicholsondb7fc632008-03-07 11:48:09 -080036 GCC_INCLUDES=`$CC -print-file-name=include`
37 if test "x$GCC_INCLUDES" != x; then
38 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
39 fi
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050040fi
41AC_SUBST(MKDEP_OPTIONS)
42
Dan Nicholson41b00702007-12-12 08:48:30 -080043dnl Make sure the pkg-config macros are defined
44m4_ifdef([PKG_PROG_PKG_CONFIG],,[
45 AC_MSG_ERROR([The pkg-config autoconf macros are not defined.
46 Did you run 'make configure'?])]
47)
Dan Nicholsondca1b792007-10-23 09:25:58 -070048PKG_PROG_PKG_CONFIG()
49
50dnl LIB_DIR - library basename
51LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
52AC_SUBST(LIB_DIR)
53
54dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
55_SAVE_LDFLAGS="$LDFLAGS"
56AC_ARG_VAR(EXTRA_LIB_PATH,[Extra -L paths for the linker])
57AC_SUBST(EXTRA_LIB_PATH)
58
59dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
60_SAVE_CPPFLAGS="$CPPFLAGS"
61AC_ARG_VAR(X11_INCLUDES,[Extra -I paths for X11 headers])
62AC_SUBST(X11_INCLUDES)
63
64dnl Compiler macros
65DEFINES=""
66AC_SUBST(DEFINES)
67if test "x$GCC" = xyes; then
68 DEFINES="-D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
69fi
70case "$host_os" in
71linux*)
72 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
73 ;;
74esac
75
76dnl Add flags for gcc and g++
77if test "x$GCC" = xyes; then
78 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
Dan Nicholson0c275b62008-01-15 22:52:25 -080079
80 # Work around aliasing bugs - developers should comment this out
81 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070082fi
83if test "x$GXX" = xyes; then
84 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -080085
86 # Work around aliasing bugs - developers should comment this out
87 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070088fi
89
90dnl These should be unnecessary, but let the user set them if they want
91AC_ARG_VAR(OPT_FLAGS, [Additional optimization flags for the compiler.
92 Default is to use CFLAGS.])
93AC_ARG_VAR(ARCH_FLAGS, [Additional architecture specific flags for the
94 compiler. Default is to use CFLAGS.])
95AC_SUBST(OPT_FLAGS)
96AC_SUBST(ARCH_FLAGS)
97
98dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -060099dnl Hacks to enable 32 or 64 bit build
100dnl
101AC_ARG_ENABLE(32-bit,
102 [AS_HELP_STRING([--enable-32-bit],
103 [build 32-bit libraries @<:@default=auto@:>@])],
104 enable_32bit="$enableval",
105 enable_32bit=auto
106)
107if test "x$enable_32bit" = xyes; then
108 if test "x$GCC" = xyes; then
109 CFLAGS="$CFLAGS -m32"
110 fi
111 if test "x$GXX" = xyes; then
112 CXXFLAGS="$CXXFLAGS -m32"
113 fi
114fi
115AC_ARG_ENABLE(64-bit,
116 [AS_HELP_STRING([--enable-64-bit],
117 [build 64-bit libraries @<:@default=auto@:>@])],
118 enable_64bit="$enableval",
119 enable_64bit=auto
120)
121if test "x$enable_64bit" = xyes; then
122 if test "x$GCC" = xyes; then
123 CFLAGS="$CFLAGS -m64"
124 fi
125 if test "x$GXX" = xyes; then
126 CXXFLAGS="$CXXFLAGS -m64"
127 fi
128fi
129
130dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800131dnl shared/static libraries, mimic libtool options
132dnl
133AC_ARG_ENABLE(static,
134 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800135 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -0800136 enable_static="$enableval",
137 enable_static=no
138)
139case "x$enable_static" in
140xyes|xno ) ;;
141x ) enable_static=no ;;
142* )
143 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
144 ;;
145esac
146AC_ARG_ENABLE(shared,
147 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800148 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -0800149 enable_shared="$enableval",
150 enable_shared=yes
151)
152case "x$enable_shared" in
153xyes|xno ) ;;
154x ) enable_shared=yes ;;
155* )
156 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
157 ;;
158esac
159
160dnl Can't have static and shared libraries, default to static if user
161dnl explicitly requested. If both disabled, set to static since shared
162dnl was explicitly requirested.
163case "x$enable_static$enable_shared" in
164xyesyes )
165 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
166 enable_shared=no
167 ;;
168xnono )
169 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
170 enable_static=yes
171 ;;
172esac
173
174dnl
175dnl mklib options
176dnl
177AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib])
178if test "$enable_static" = yes; then
179 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
180fi
181AC_SUBST(MKLIB_OPTIONS)
182
Dan Nicholson23656c42007-12-12 09:02:31 -0800183dnl
184dnl other compiler options
185dnl
186AC_ARG_ENABLE(debug,
187 [AS_HELP_STRING([--enable-debug],
188 [use debug compiler flags and macros @<:@default=disabled@:>@])],
189 enable_debug="$enableval",
190 enable_debug=no
191)
192if test "x$enable_debug" = xyes; then
193 DEFINES="$DEFINES -DDEBUG"
194 if test "x$GCC" = xyes; then
195 CFLAGS="$CFLAGS -g"
196 fi
197 if test "x$GXX" = xyes; then
198 CXXFLAGS="$CXXFLAGS -g"
199 fi
200fi
Dan Nicholson3e288622007-12-12 09:02:31 -0800201dnl These will be used near the end in the arch specific options
202AC_ARG_ENABLE(asm,
203 [AS_HELP_STRING([--disable-asm],
204 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
205 enable_asm="$enableval",
206 enable_asm=yes
207)
Dan Nicholson88586332007-11-15 08:59:57 -0800208
209dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700210dnl library names
211dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800212if test "$enable_static" = yes; then
213 GL_LIB_NAME='lib$(GL_LIB).a'
214 GLU_LIB_NAME='lib$(GLU_LIB).a'
215 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
216 GLW_LIB_NAME='lib$(GLW_LIB).a'
217 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
218else
219 GL_LIB_NAME='lib$(GL_LIB).so'
220 GLU_LIB_NAME='lib$(GLU_LIB).so'
221 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
222 GLW_LIB_NAME='lib$(GLW_LIB).so'
223 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
224fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700225AC_SUBST(GL_LIB_NAME)
226AC_SUBST(GLU_LIB_NAME)
227AC_SUBST(GLUT_LIB_NAME)
228AC_SUBST(GLW_LIB_NAME)
229AC_SUBST(OSMESA_LIB_NAME)
230
231dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800232dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800233dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800234dnl
235AC_ARG_WITH(driver,
236 [AS_HELP_STRING([--with-driver=DRIVER],
Dan Nicholsona1307182007-12-12 17:49:49 -0800237 [driver for Mesa: xlib,dri,osmesa @<:@default=xlib@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800238 mesa_driver="$withval",
Dan Nicholsona1307182007-12-12 17:49:49 -0800239 mesa_driver="xlib")
Dan Nicholson44d99142007-12-05 18:47:01 -0800240dnl Check for valid option
241case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800242xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800243 ;;
244*)
245 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
246 ;;
247esac
248
249dnl
250dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700251dnl
252SRC_DIRS="mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700253GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800254WINDOW_SYSTEM=""
255case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800256xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800257 DRIVER_DIRS="x11"
258 ;;
259dri)
260 SRC_DIRS="glx/x11 $SRC_DIRS"
261 DRIVER_DIRS="dri"
262 WINDOW_SYSTEM="dri"
263 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800264osmesa)
265 DRIVER_DIRS="osmesa"
266 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800267esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700268AC_SUBST(SRC_DIRS)
269AC_SUBST(GLU_DIRS)
270AC_SUBST(DRIVER_DIRS)
Dan Nicholson44d99142007-12-05 18:47:01 -0800271AC_SUBST(WINDOW_SYSTEM)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700272
273dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800274dnl User supplied program configuration
275dnl
276if test -d "$srcdir/progs/demos"; then
277 default_demos=yes
278else
279 default_demos=no
280fi
281AC_ARG_WITH(demos,
282 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
283 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800284 @<:@default=auto if source available@:>@])],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800285 with_demos="$withval",
286 with_demos="$default_demos")
287if test "x$with_demos" = x; then
288 with_demos=no
289fi
290
291dnl If $with_demos is yes, directories will be added as libs available
292PROGRAM_DIRS=""
293case "$with_demos" in
294no|yes) ;;
295*)
296 # verify the requested demos directories exist
297 demos=`IFS=,; echo $with_demos`
298 for demo in $demos; do
299 test -d "$srcdir/progs/$demo" || \
300 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
301 done
302 PROGRAM_DIRS="$demos"
303 ;;
304esac
305
306dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700307dnl Find out if X is available. The variables have_x or no_x will be
308dnl set and used later in the driver setups
309dnl
310if test -n "$PKG_CONFIG"; then
311 AC_MSG_CHECKING([pkg-config files for X11 are available])
312 if $PKG_CONFIG --exists x11; then
313 x11_pkgconfig=yes
314 have_x=yes
315 AC_MSG_RESULT(yes)
316 else
317 x11_pkgconfig=no
318 no_x=yes
319 AC_MSG_RESULT(no)
320 fi
321else
322 x11_pkgconfig=no
323fi
324dnl Use the autoconf macro if no pkg-config files
325if test "$x11_pkgconfig" = no; then
326 AC_PATH_XTRA
327fi
328
Dan Nicholson44d99142007-12-05 18:47:01 -0800329dnl We need X for xlib and dri, so bomb now if it's not found
330case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800331xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800332 if test "$no_x" = yes; then
333 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
334 fi
335 ;;
336esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700337
Adam Jackson66611f22008-02-15 13:49:12 -0500338# SELinux awareness.
339AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux], [Build SELinux-aware Mesa (default: disabled)]), [MESA_SELINUX=$enableval], [MESA_SELINUX=no])
340if test "x$enable_selinux" = "xyes"; then
341 AC_CHECK_HEADER(selinux/selinux.h,,
342 AC_MSG_ERROR([SELinux headers not found]))
343 AC_CHECK_LIB(selinux,is_selinux_enabled,,
344 AC_MSG_ERROR([SELinux library not found]))
345 SELINUX_LIBS="-lselinux"
346 DEFINES="$DEFINES -DMESA_SELINUX"
347fi
348
Dan Nicholson44d99142007-12-05 18:47:01 -0800349dnl
350dnl libGL configuration per driver
351dnl
352case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800353xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800354 if test "$x11_pkgconfig" = yes; then
Dan Nicholsona1307182007-12-12 17:49:49 -0800355 PKG_CHECK_MODULES(XLIBGL, x11 xext)
356 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
357 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800358 else
359 # should check these...
360 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
361 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
362 fi
Adam Jackson66611f22008-02-15 13:49:12 -0500363 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800364
365 # if static, move the external libraries to the programs
366 # and empty the libraries for libGL
367 if test "$enable_static" = yes; then
368 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
369 GL_LIB_DEPS=""
370 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800371 ;;
372dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800373 # DRI must be shared, I think
374 if test "$enable_static" = yes; then
375 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
376 fi
377
Dan Nicholson44d99142007-12-05 18:47:01 -0800378 # Check for libdrm
379 PKG_CHECK_MODULES(LIBDRM, libdrm)
380
381 # find the DRI deps for libGL
382 if test "$x11_pkgconfig" = yes; then
383 PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
384 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
385 GL_LIB_DEPS="$DRIGL_LIBS"
386 else
387 # should check these...
388 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
389 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
390 fi
391
392 # need DRM libs, -lpthread, etc.
393 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread -ldl"
394 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800395osmesa)
396 # No libGL for osmesa
397 GL_LIB_DEPS=""
398 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800399esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700400AC_SUBST(GL_LIB_DEPS)
401
402dnl
403dnl More X11 setup
404dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800405if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700406 DEFINES="$DEFINES -DUSE_XSHM"
407fi
408
409dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800410dnl More DRI setup
411dnl
412AC_ARG_ENABLE(glx-tls,
413 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800414 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800415 GLX_USE_TLS="$enableval",
416 GLX_USE_TLS=no)
417dnl Directory for DRI drivers
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800418AC_ARG_WITH(dri-driverdir,
419 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson44d99142007-12-05 18:47:01 -0800420 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
421 DRI_DRIVER_INSTALL_DIR="$withval",
422 DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
423AC_SUBST(DRI_DRIVER_INSTALL_DIR)
424dnl Direct rendering or just indirect rendering
425AC_ARG_ENABLE(driglx-direct,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800426 [AS_HELP_STRING([--disable-driglx-direct],
427 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800428 driglx_direct="$enableval",
429 driglx_direct="yes")
430
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800431dnl Which drivers to build - default is chosen by platform
432AC_ARG_WITH(dri-drivers,
433 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800434 [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800435 with_dri_drivers="$withval",
436 with_dri_drivers=yes)
437if test "x$with_dri_drivers" = x; then
438 with_dri_drivers=no
439fi
440
441dnl If $with_dri_drivers is yes, directories will be added through
442dnl platform checks
443DRI_DIRS=""
444case "$with_dri_drivers" in
445no|yes) ;;
446*)
447 # verify the requested driver directories exist
448 dri_drivers=`IFS=,; echo $with_dri_drivers`
449 for driver in $dri_drivers; do
450 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
451 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
452 done
453 DRI_DIRS="$dri_drivers"
454 ;;
455esac
456
Dan Nicholson44d99142007-12-05 18:47:01 -0800457dnl Just default to no EGL for now
458USING_EGL=0
459AC_SUBST(USING_EGL)
460
461dnl Set DRI_DIRS, DEFINES and LIB_DEPS
462if test "$mesa_driver" = dri; then
463 # Use TLS in GLX?
464 if test "x$GLX_USE_TLS" = xyes; then
465 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
466 fi
467
468 if test "x$USING_EGL" = x1; then
469 PROGRAM_DIRS="egl"
470 fi
471
472 # Platform specific settings and drivers to build
473 case "$host_os" in
474 linux*)
475 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
476 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
477 if test "x$driglx_direct" = xyes; then
478 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
479 fi
480
481 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800482 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800483 # ffb, gamma, and sis are missing because they have not be
484 # converted to use the new interface. i810 are missing
485 # because there is no x86-64 system where they could *ever*
486 # be used.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800487 if test "x$DRI_DIRS" = x; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800488 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
489 savage tdfx unichrome"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800490 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800491 ;;
492 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800493 # Build only the drivers for cards that exist on PowerPC.
494 # At some point MGA will be added, but not yet.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800495 if test "x$DRI_DIRS" = x; then
496 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
497 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800498 ;;
499 esac
500 ;;
501 freebsd*)
502 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
503 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
504 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
505 if test "x$driglx_direct" = xyes; then
506 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
507 fi
508 if test "x$GXX" = xyes; then
509 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
510 fi
511
Dan Nicholsona76e2452007-12-07 11:25:08 -0800512 # ffb and gamma are missing because they have not been converted
513 # to use the new interface.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800514 if test "x$DRI_DIRS" = x; then
515 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
516 unichrome savage sis"
517 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800518 ;;
519 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800520
521 # default drivers
522 if test "x$DRI_DIRS" = x; then
523 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
524 savage sis tdfx trident unichrome ffb"
525 fi
526
Dan Nicholson44d99142007-12-05 18:47:01 -0800527 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
528
529 # Check for expat
530 EXPAT_INCLUDES=""
531 EXPAT_LIB=-lexpat
532 AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
533 [expat install directory]),[
534 EXPAT_INCLUDES="-I$withval/include"
535 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
536 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
537 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
538 ])
539 AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
540 AC_CHECK_LIB(expat, XML_ParserCreate,,
541 AC_MSG_ERROR([Expat required for DRI.]))
542
543 # put all the necessary libs together
Adam Jackson66611f22008-02-15 13:49:12 -0500544 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl"
Dan Nicholson44d99142007-12-05 18:47:01 -0800545fi
546AC_SUBST(DRI_DIRS)
547AC_SUBST(EXPAT_INCLUDES)
548AC_SUBST(DRI_LIB_DEPS)
549
550dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700551dnl OSMesa configuration
552dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800553if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800554 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800555else
Dan Nicholson544ab202007-12-30 08:41:53 -0800556 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800557fi
Dan Nicholson544ab202007-12-30 08:41:53 -0800558AC_ARG_ENABLE(gl-osmesa,
559 [AS_HELP_STRING([--enable-gl-osmesa],
560 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
561 gl_osmesa="$enableval",
562 gl_osmesa="$default_gl_osmesa")
563if test "x$gl_osmesa" = xyes; then
564 if test "$mesa_driver" = osmesa; then
565 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800566 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800567 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800568 fi
569fi
570
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800571dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
572AC_ARG_WITH(osmesa-bits,
573 [AS_HELP_STRING([--with-osmesa-bits=BITS],
574 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
575 osmesa_bits="$withval",
576 osmesa_bits=8)
577if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
578 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
579 osmesa_bits=8
580fi
581case "x$osmesa_bits" in
582x8)
583 OSMESA_LIB=OSMesa
584 ;;
585x16|x32)
586 OSMESA_LIB="OSMesa$osmesa_bits"
587 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
588 ;;
589*)
590 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
591 ;;
592esac
593AC_SUBST(OSMESA_LIB)
594
Dan Nicholson979ff512007-12-05 18:47:01 -0800595case "$mesa_driver" in
596osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800597 # only link librararies with osmesa if shared
598 if test "$enable_static" = no; then
Adam Jackson66611f22008-02-15 13:49:12 -0500599 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800600 else
601 OSMESA_LIB_DEPS=""
602 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800603 OSMESA_MESA_DEPS=""
604 ;;
605*)
606 # Link OSMesa to libGL otherwise
607 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800608 # only link librararies with osmesa if shared
609 if test "$enable_static" = no; then
610 OSMESA_MESA_DEPS='-l$(GL_LIB)'
611 else
612 OSMESA_MESA_DEPS=""
613 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800614 ;;
615esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700616AC_SUBST(OSMESA_LIB_DEPS)
617AC_SUBST(OSMESA_MESA_DEPS)
618
619dnl
620dnl GLU configuration
621dnl
622AC_ARG_ENABLE(glu,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800623 [AS_HELP_STRING([--disable-glu],
624 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700625 enable_glu="$enableval",
626 enable_glu=yes)
627if test "x$enable_glu" = xyes; then
628 SRC_DIRS="$SRC_DIRS glu"
629
Dan Nicholson979ff512007-12-05 18:47:01 -0800630 case "$mesa_driver" in
631 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800632 # If GLU is available and we have libOSMesa (not 16 or 32),
633 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800634 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800635 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
636 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700637
Dan Nicholson979ff512007-12-05 18:47:01 -0800638 # Link libGLU to libOSMesa instead of libGL
639 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800640 if test "$enable_static" = no; then
641 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
642 else
643 GLU_MESA_DEPS=""
644 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800645 ;;
646 *)
647 # If GLU is available, we can build the xdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800648 if test "$with_demos" = yes; then
649 PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
650 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800651
Dan Nicholson88586332007-11-15 08:59:57 -0800652 # If static, empty GLU_LIB_DEPS and add libs for programs to link
653 if test "$enable_static" = no; then
654 GLU_LIB_DEPS="-lm"
655 GLU_MESA_DEPS='-l$(GL_LIB)'
656 else
657 GLU_LIB_DEPS=""
658 GLU_MESA_DEPS=""
659 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
660 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800661 ;;
662 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700663fi
664AC_SUBST(GLU_LIB_DEPS)
665AC_SUBST(GLU_MESA_DEPS)
666
667dnl
668dnl GLw configuration
669dnl
670AC_ARG_ENABLE(glw,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800671 [AS_HELP_STRING([--disable-glw],
672 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700673 enable_glw="$enableval",
674 enable_glw=yes)
Dan Nicholson979ff512007-12-05 18:47:01 -0800675dnl Don't build GLw on osmesa
676if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
677 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
678 enable_glw=no
679fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700680if test "x$enable_glw" = xyes; then
681 SRC_DIRS="$SRC_DIRS glw"
682 if test "$x11_pkgconfig" = yes; then
683 PKG_CHECK_MODULES(GLW, x11 xt)
684 GLW_LIB_DEPS="$GLW_LIBS"
685 else
686 # should check these...
687 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
688 fi
689
Dan Nicholson88586332007-11-15 08:59:57 -0800690 # If static, empty GLW_LIB_DEPS and add libs for programs to link
691 if test "$enable_static" = no; then
692 GLW_MESA_DEPS='-l$(GL_LIB)'
693 else
694 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
695 GLW_LIB_DEPS=""
696 GLW_MESA_DEPS=""
697 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700698fi
699AC_SUBST(GLW_LIB_DEPS)
700AC_SUBST(GLW_MESA_DEPS)
701
702dnl
703dnl GLUT configuration
704dnl
705if test -f "$srcdir/include/GL/glut.h"; then
706 default_glut=yes
707else
708 default_glut=no
709fi
710AC_ARG_ENABLE(glut,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800711 [AS_HELP_STRING([--disable-glut],
712 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700713 enable_glut="$enableval",
714 enable_glut="$default_glut")
715
716dnl Can't build glut if GLU not available
717if test "x$enable_glu$enable_glut" = xnoyes; then
718 AC_MSG_WARN([Disabling glut since GLU is disabled])
719 enable_glut=no
720fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800721dnl Don't build glut on osmesa
722if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
723 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
724 enable_glut=no
725fi
726
Dan Nicholsondca1b792007-10-23 09:25:58 -0700727if test "x$enable_glut" = xyes; then
728 SRC_DIRS="$SRC_DIRS glut/glx"
729 GLUT_CFLAGS=""
730 if test "x$GCC" = xyes; then
731 GLUT_CFLAGS="-fexceptions"
732 fi
733 if test "$x11_pkgconfig" = yes; then
Dan Nicholson70d0c832007-12-07 11:12:20 -0800734 PKG_CHECK_MODULES(GLUT, x11 xmu xi)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700735 GLUT_LIB_DEPS="$GLUT_LIBS"
736 else
737 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -0800738 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700739 fi
740 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
741
742 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800743 if test "$with_demos" = yes; then
744 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
745 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700746
Dan Nicholson88586332007-11-15 08:59:57 -0800747 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
748 if test "$enable_static" = no; then
749 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
750 else
751 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
752 GLUT_LIB_DEPS=""
753 GLUT_MESA_DEPS=""
754 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700755fi
756AC_SUBST(GLUT_LIB_DEPS)
757AC_SUBST(GLUT_MESA_DEPS)
758AC_SUBST(GLUT_CFLAGS)
759
760dnl
761dnl Program library dependencies
762dnl Only libm is added here if necessary as the libraries should
763dnl be pulled in by the linker
764dnl
765if test "x$APP_LIB_DEPS" = x; then
766 APP_LIB_DEPS="-lm"
767fi
768AC_SUBST(APP_LIB_DEPS)
769AC_SUBST(PROGRAM_DIRS)
770
771dnl Arch/platform-specific settings
772PIC_FLAGS=""
773ASM_FLAGS=""
774ASM_SOURCES=""
775ASM_API=""
776AC_SUBST(PIC_FLAGS)
777AC_SUBST(ASM_FLAGS)
778AC_SUBST(ASM_SOURCES)
779AC_SUBST(ASM_API)
780case "$host_os" in
781linux*)
782 PIC_FLAGS="-fPIC"
783 case "$host_cpu" in
784 i*86)
Dan Nicholson3e288622007-12-12 09:02:31 -0800785 if test "x$enable_asm" = xyes; then
786 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
787 ASM_SOURCES='$(X86_SOURCES)'
788 ASM_API='$(X86_API)'
789 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700790 ;;
791 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800792 if test "x$enable_asm" = xyes; then
793 ASM_FLAGS="-DUSE_X86_64_ASM"
794 ASM_SOURCES='$(X86-64_SOURCES)'
795 ASM_API='$(X86-64_API)'
796 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700797 ;;
798 powerpc)
Dan Nicholson3e288622007-12-12 09:02:31 -0800799 if test "x$enable_asm" = xyes; then
800 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
801 ASM_SOURCES='$(PPC_SOURCES)'
802 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700803 ;;
804 esac
805 ;;
806freebsd*)
807 PIC_FLAGS="-fPIC"
Dan Nicholson758b9982008-02-21 10:32:04 -0800808 case "$host_cpu" in
Dan Nicholsondca1b792007-10-23 09:25:58 -0700809 i*86)
810 PIC_FLAGS=""
Dan Nicholson3e288622007-12-12 09:02:31 -0800811 if test "x$enable_asm" = xyes; then
812 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
813 ASM_SOURCES='$(X86_SOURCES)'
814 ASM_API='$(X86_API)'
815 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700816 ;;
817 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800818 if test "x$enable_asm" = xyes; then
819 ASM_FLAGS="-DUSE_X86_64_ASM"
820 ASM_SOURCES='$(X86-64_SOURCES)'
821 ASM_API='$(X86-64_API)'
822 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700823 ;;
824 esac
825 ;;
826esac
827
828dnl Restore LDFLAGS and CPPFLAGS
829LDFLAGS="$_SAVE_LDFLAGS"
830CPPFLAGS="$_SAVE_CPPFLAGS"
831
832dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -0800833AC_CONFIG_FILES([configs/autoconf])
834AC_OUTPUT
Dan Nicholsondca1b792007-10-23 09:25:58 -0700835
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800836dnl Replace the configs/current symlink
837if test -f configs/current || test -L configs/current; then
838 rm -f configs/current
839fi
840ln -s autoconf configs/current
841
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800842dnl
843dnl Output some configuration info for the user
844dnl
845echo ""
846echo " prefix: $prefix"
847echo " exec_prefix: $exec_prefix"
848echo " libdir: $libdir"
849
850dnl Driver info
851echo ""
852echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -0800853if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
854 echo " OSMesa: lib$OSMESA_LIB"
855else
856 echo " OSMesa: no"
857fi
858if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800859 # cleanup the drivers var
860 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
861 echo " DRI drivers: $dri_dirs"
862 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -0800863fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800864
865dnl Libraries
866echo ""
867echo " Shared libs: $enable_shared"
868echo " Static libs: $enable_static"
869echo " GLU: $enable_glu"
870echo " GLw: $enable_glw"
871echo " glut: $enable_glut"
872
873dnl Programs
874# cleanup the programs var for display
875program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
876if test "x$program_dirs" = x; then
877 echo " Demos: no"
878else
879 echo " Demos: $program_dirs"
880fi
881
Dan Nicholson16a07fb2007-12-12 09:12:15 -0800882dnl Compiler options
883# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
884cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
885 $SED 's/^ *//;s/ */ /;s/ *$//'`
886cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
887 $SED 's/^ *//;s/ */ /;s/ *$//'`
888defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
889echo ""
890echo " CFLAGS: $cflags"
891echo " CXXFLAGS: $cxxflags"
892echo " Macros: $defines"
893
Dan Nicholsondca1b792007-10-23 09:25:58 -0700894echo ""
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800895echo " Run 'make' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700896echo ""