blob: 6330cf85e0a62bdac792236d91c00dfd171ae765 [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
12AC_INIT(Mesa, mesa_version(), mesa3d@sourceforge.net)
13AC_CONFIG_AUX_DIR(bin)
14AC_CANONICAL_HOST
15
16dnl Substitute the version number into shell variables
17MESA_MAJOR=mesa_major()
18MESA_MINOR=mesa_minor()
19MESA_TINY=mesa_tiny()
20AC_SUBST(MESA_MAJOR)
21AC_SUBST(MESA_MINOR)
22AC_SUBST(MESA_TINY)
23
24dnl Check for progs
25AC_PROG_CPP
26AC_PROG_CC
27AC_PROG_CXX
28AC_PATH_PROG(MAKE, make)
29AC_PATH_PROG(MKDEP, makedepend)
30AC_PATH_PROG(SED, sed)
Dan Nicholson41b00702007-12-12 08:48:30 -080031
32dnl Make sure the pkg-config macros are defined
33m4_ifdef([PKG_PROG_PKG_CONFIG],,[
34 AC_MSG_ERROR([The pkg-config autoconf macros are not defined.
35 Did you run 'make configure'?])]
36)
Dan Nicholsondca1b792007-10-23 09:25:58 -070037PKG_PROG_PKG_CONFIG()
38
39dnl LIB_DIR - library basename
40LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
41AC_SUBST(LIB_DIR)
42
43dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
44_SAVE_LDFLAGS="$LDFLAGS"
45AC_ARG_VAR(EXTRA_LIB_PATH,[Extra -L paths for the linker])
46AC_SUBST(EXTRA_LIB_PATH)
47
48dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
49_SAVE_CPPFLAGS="$CPPFLAGS"
50AC_ARG_VAR(X11_INCLUDES,[Extra -I paths for X11 headers])
51AC_SUBST(X11_INCLUDES)
52
53dnl Compiler macros
54DEFINES=""
55AC_SUBST(DEFINES)
56if test "x$GCC" = xyes; then
57 DEFINES="-D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
58fi
59case "$host_os" in
60linux*)
61 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
62 ;;
63esac
64
65dnl Add flags for gcc and g++
66if test "x$GCC" = xyes; then
67 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
68fi
69if test "x$GXX" = xyes; then
70 CXXFLAGS="$CXXFLAGS -Wall"
71fi
72
73dnl These should be unnecessary, but let the user set them if they want
74AC_ARG_VAR(OPT_FLAGS, [Additional optimization flags for the compiler.
75 Default is to use CFLAGS.])
76AC_ARG_VAR(ARCH_FLAGS, [Additional architecture specific flags for the
77 compiler. Default is to use CFLAGS.])
78AC_SUBST(OPT_FLAGS)
79AC_SUBST(ARCH_FLAGS)
80
81dnl
Dan Nicholson88586332007-11-15 08:59:57 -080082dnl shared/static libraries, mimic libtool options
83dnl
84AC_ARG_ENABLE(static,
85 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -080086 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -080087 enable_static="$enableval",
88 enable_static=no
89)
90case "x$enable_static" in
91xyes|xno ) ;;
92x ) enable_static=no ;;
93* )
94 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
95 ;;
96esac
97AC_ARG_ENABLE(shared,
98 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -080099 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -0800100 enable_shared="$enableval",
101 enable_shared=yes
102)
103case "x$enable_shared" in
104xyes|xno ) ;;
105x ) enable_shared=yes ;;
106* )
107 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
108 ;;
109esac
110
111dnl Can't have static and shared libraries, default to static if user
112dnl explicitly requested. If both disabled, set to static since shared
113dnl was explicitly requirested.
114case "x$enable_static$enable_shared" in
115xyesyes )
116 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
117 enable_shared=no
118 ;;
119xnono )
120 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
121 enable_static=yes
122 ;;
123esac
124
125dnl
126dnl mklib options
127dnl
128AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib])
129if test "$enable_static" = yes; then
130 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
131fi
132AC_SUBST(MKLIB_OPTIONS)
133
Dan Nicholson23656c42007-12-12 09:02:31 -0800134dnl
135dnl other compiler options
136dnl
137AC_ARG_ENABLE(debug,
138 [AS_HELP_STRING([--enable-debug],
139 [use debug compiler flags and macros @<:@default=disabled@:>@])],
140 enable_debug="$enableval",
141 enable_debug=no
142)
143if test "x$enable_debug" = xyes; then
144 DEFINES="$DEFINES -DDEBUG"
145 if test "x$GCC" = xyes; then
146 CFLAGS="$CFLAGS -g"
147 fi
148 if test "x$GXX" = xyes; then
149 CXXFLAGS="$CXXFLAGS -g"
150 fi
151fi
Dan Nicholson88586332007-11-15 08:59:57 -0800152
153dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700154dnl library names
155dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800156if test "$enable_static" = yes; then
157 GL_LIB_NAME='lib$(GL_LIB).a'
158 GLU_LIB_NAME='lib$(GLU_LIB).a'
159 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
160 GLW_LIB_NAME='lib$(GLW_LIB).a'
161 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
162else
163 GL_LIB_NAME='lib$(GL_LIB).so'
164 GLU_LIB_NAME='lib$(GLU_LIB).so'
165 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
166 GLW_LIB_NAME='lib$(GLW_LIB).so'
167 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
168fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700169AC_SUBST(GL_LIB_NAME)
170AC_SUBST(GLU_LIB_NAME)
171AC_SUBST(GLUT_LIB_NAME)
172AC_SUBST(GLW_LIB_NAME)
173AC_SUBST(OSMESA_LIB_NAME)
174
175dnl
Dan Nicholson979ff512007-12-05 18:47:01 -0800176dnl Driver configuration. Options are x11 (Xlib), dri and osmesa right now.
177dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800178dnl
179AC_ARG_WITH(driver,
180 [AS_HELP_STRING([--with-driver=DRIVER],
Dan Nicholson979ff512007-12-05 18:47:01 -0800181 [driver for Mesa: x11,dri,osmesa @<:@default=x11@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800182 mesa_driver="$withval",
183 mesa_driver="x11")
184dnl Check for valid option
185case "x$mesa_driver" in
Dan Nicholson979ff512007-12-05 18:47:01 -0800186xx11|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800187 ;;
188*)
189 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
190 ;;
191esac
192
193dnl
194dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700195dnl
196SRC_DIRS="mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700197GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800198WINDOW_SYSTEM=""
199case "$mesa_driver" in
200x11)
201 DRIVER_DIRS="x11"
202 ;;
203dri)
204 SRC_DIRS="glx/x11 $SRC_DIRS"
205 DRIVER_DIRS="dri"
206 WINDOW_SYSTEM="dri"
207 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800208osmesa)
209 DRIVER_DIRS="osmesa"
210 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800211esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700212AC_SUBST(SRC_DIRS)
213AC_SUBST(GLU_DIRS)
214AC_SUBST(DRIVER_DIRS)
Dan Nicholson44d99142007-12-05 18:47:01 -0800215AC_SUBST(WINDOW_SYSTEM)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700216
217dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800218dnl User supplied program configuration
219dnl
220if test -d "$srcdir/progs/demos"; then
221 default_demos=yes
222else
223 default_demos=no
224fi
225AC_ARG_WITH(demos,
226 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
227 [optional comma delimited demo directories to build
228 @<:@default=yes if source available@:>@])],
229 with_demos="$withval",
230 with_demos="$default_demos")
231if test "x$with_demos" = x; then
232 with_demos=no
233fi
234
235dnl If $with_demos is yes, directories will be added as libs available
236PROGRAM_DIRS=""
237case "$with_demos" in
238no|yes) ;;
239*)
240 # verify the requested demos directories exist
241 demos=`IFS=,; echo $with_demos`
242 for demo in $demos; do
243 test -d "$srcdir/progs/$demo" || \
244 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
245 done
246 PROGRAM_DIRS="$demos"
247 ;;
248esac
249
250dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700251dnl Find out if X is available. The variables have_x or no_x will be
252dnl set and used later in the driver setups
253dnl
254if test -n "$PKG_CONFIG"; then
255 AC_MSG_CHECKING([pkg-config files for X11 are available])
256 if $PKG_CONFIG --exists x11; then
257 x11_pkgconfig=yes
258 have_x=yes
259 AC_MSG_RESULT(yes)
260 else
261 x11_pkgconfig=no
262 no_x=yes
263 AC_MSG_RESULT(no)
264 fi
265else
266 x11_pkgconfig=no
267fi
268dnl Use the autoconf macro if no pkg-config files
269if test "$x11_pkgconfig" = no; then
270 AC_PATH_XTRA
271fi
272
Dan Nicholson44d99142007-12-05 18:47:01 -0800273dnl We need X for xlib and dri, so bomb now if it's not found
274case "$mesa_driver" in
275x11|dri)
276 if test "$no_x" = yes; then
277 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
278 fi
279 ;;
280esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700281
Dan Nicholson44d99142007-12-05 18:47:01 -0800282dnl
283dnl libGL configuration per driver
284dnl
285case "$mesa_driver" in
286x11)
287 if test "$x11_pkgconfig" = yes; then
288 PKG_CHECK_MODULES(X11GL, x11 xext)
289 X11_INCLUDES="$X11_INCLUDES $X11GL_CFLAGS"
290 GL_LIB_DEPS="$X11GL_LIBS"
291 else
292 # should check these...
293 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
294 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
295 fi
296 GL_LIB_DEPS="$GL_LIB_DEPS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800297
298 # if static, move the external libraries to the programs
299 # and empty the libraries for libGL
300 if test "$enable_static" = yes; then
301 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
302 GL_LIB_DEPS=""
303 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800304 ;;
305dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800306 # DRI must be shared, I think
307 if test "$enable_static" = yes; then
308 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
309 fi
310
Dan Nicholson44d99142007-12-05 18:47:01 -0800311 # Check for libdrm
312 PKG_CHECK_MODULES(LIBDRM, libdrm)
313
314 # find the DRI deps for libGL
315 if test "$x11_pkgconfig" = yes; then
316 PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
317 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
318 GL_LIB_DEPS="$DRIGL_LIBS"
319 else
320 # should check these...
321 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
322 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
323 fi
324
325 # need DRM libs, -lpthread, etc.
326 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread -ldl"
327 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800328osmesa)
329 # No libGL for osmesa
330 GL_LIB_DEPS=""
331 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800332esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700333AC_SUBST(GL_LIB_DEPS)
334
335dnl
336dnl More X11 setup
337dnl
338if test "$mesa_driver" = x11; then
339 DEFINES="$DEFINES -DUSE_XSHM"
340fi
341
342dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800343dnl More DRI setup
344dnl
345AC_ARG_ENABLE(glx-tls,
346 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800347 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800348 GLX_USE_TLS="$enableval",
349 GLX_USE_TLS=no)
350dnl Directory for DRI drivers
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800351AC_ARG_WITH(dri-driverdir,
352 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson44d99142007-12-05 18:47:01 -0800353 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
354 DRI_DRIVER_INSTALL_DIR="$withval",
355 DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
356AC_SUBST(DRI_DRIVER_INSTALL_DIR)
357dnl Direct rendering or just indirect rendering
358AC_ARG_ENABLE(driglx-direct,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800359 [AS_HELP_STRING([--disable-driglx-direct],
360 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800361 driglx_direct="$enableval",
362 driglx_direct="yes")
363
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800364dnl Which drivers to build - default is chosen by platform
365AC_ARG_WITH(dri-drivers,
366 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
367 [comma delimited DRI drivers to build @<:@default=auto by platform@:>@])],
368 with_dri_drivers="$withval",
369 with_dri_drivers=yes)
370if test "x$with_dri_drivers" = x; then
371 with_dri_drivers=no
372fi
373
374dnl If $with_dri_drivers is yes, directories will be added through
375dnl platform checks
376DRI_DIRS=""
377case "$with_dri_drivers" in
378no|yes) ;;
379*)
380 # verify the requested driver directories exist
381 dri_drivers=`IFS=,; echo $with_dri_drivers`
382 for driver in $dri_drivers; do
383 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
384 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
385 done
386 DRI_DIRS="$dri_drivers"
387 ;;
388esac
389
Dan Nicholson44d99142007-12-05 18:47:01 -0800390dnl Just default to no EGL for now
391USING_EGL=0
392AC_SUBST(USING_EGL)
393
394dnl Set DRI_DIRS, DEFINES and LIB_DEPS
395if test "$mesa_driver" = dri; then
396 # Use TLS in GLX?
397 if test "x$GLX_USE_TLS" = xyes; then
398 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
399 fi
400
401 if test "x$USING_EGL" = x1; then
402 PROGRAM_DIRS="egl"
403 fi
404
Dan Nicholsona76e2452007-12-07 11:25:08 -0800405 # default drivers
406 if test "x$DRI_DIRS" = x; then
407 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
408 savage sis tdfx trident unichrome ffb"
409 fi
410
Dan Nicholson44d99142007-12-05 18:47:01 -0800411 # Platform specific settings and drivers to build
412 case "$host_os" in
413 linux*)
414 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
415 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
416 if test "x$driglx_direct" = xyes; then
417 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
418 fi
419
420 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800421 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800422 # ffb, gamma, and sis are missing because they have not be
423 # converted to use the new interface. i810 are missing
424 # because there is no x86-64 system where they could *ever*
425 # be used.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800426 if test "x$DRI_DIRS" = x; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800427 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
428 savage tdfx unichrome"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800429 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800430 ;;
431 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800432 # Build only the drivers for cards that exist on PowerPC.
433 # At some point MGA will be added, but not yet.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800434 if test "x$DRI_DIRS" = x; then
435 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
436 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800437 ;;
438 esac
439 ;;
440 freebsd*)
441 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
442 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
443 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
444 if test "x$driglx_direct" = xyes; then
445 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
446 fi
447 if test "x$GXX" = xyes; then
448 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
449 fi
450
Dan Nicholsona76e2452007-12-07 11:25:08 -0800451 # ffb and gamma are missing because they have not been converted
452 # to use the new interface.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800453 if test "x$DRI_DIRS" = x; then
454 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
455 unichrome savage sis"
456 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800457 ;;
458 esac
459 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
460
461 # Check for expat
462 EXPAT_INCLUDES=""
463 EXPAT_LIB=-lexpat
464 AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
465 [expat install directory]),[
466 EXPAT_INCLUDES="-I$withval/include"
467 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
468 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
469 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
470 ])
471 AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
472 AC_CHECK_LIB(expat, XML_ParserCreate,,
473 AC_MSG_ERROR([Expat required for DRI.]))
474
475 # put all the necessary libs together
476 DRI_LIB_DEPS="$LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl"
477fi
478AC_SUBST(DRI_DIRS)
479AC_SUBST(EXPAT_INCLUDES)
480AC_SUBST(DRI_LIB_DEPS)
481
482dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700483dnl OSMesa configuration
484dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800485if test "$mesa_driver" = x11; then
Dan Nicholson979ff512007-12-05 18:47:01 -0800486 default_x11_osmesa=yes
487else
488 default_x11_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800489fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800490AC_ARG_ENABLE(x11-osmesa,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800491 [AS_HELP_STRING([--disable-x11-osmesa],
492 [enable OSMesa on X11 libGL @<:@default=enabled for x11 driver@:>@])],
Dan Nicholson979ff512007-12-05 18:47:01 -0800493 x11_osmesa="$enableval",
494 x11_osmesa="$default_x11_osmesa")
495if test "x$x11_osmesa" = xyes; then
496 if test "$mesa_driver" = x11; then
497 DRIVER_DIRS="$DRIVER_DIRS osmesa"
498 else
499 AC_MSG_ERROR([Can only enable OSMesa on libGL for X11])
500 fi
501fi
502
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800503dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
504AC_ARG_WITH(osmesa-bits,
505 [AS_HELP_STRING([--with-osmesa-bits=BITS],
506 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
507 osmesa_bits="$withval",
508 osmesa_bits=8)
509if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
510 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
511 osmesa_bits=8
512fi
513case "x$osmesa_bits" in
514x8)
515 OSMESA_LIB=OSMesa
516 ;;
517x16|x32)
518 OSMESA_LIB="OSMesa$osmesa_bits"
519 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
520 ;;
521*)
522 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
523 ;;
524esac
525AC_SUBST(OSMESA_LIB)
526
Dan Nicholson979ff512007-12-05 18:47:01 -0800527case "$mesa_driver" in
528osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800529 # only link librararies with osmesa if shared
530 if test "$enable_static" = no; then
531 OSMESA_LIB_DEPS="-lm -lpthread"
532 else
533 OSMESA_LIB_DEPS=""
534 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800535 OSMESA_MESA_DEPS=""
536 ;;
537*)
538 # Link OSMesa to libGL otherwise
539 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800540 # only link librararies with osmesa if shared
541 if test "$enable_static" = no; then
542 OSMESA_MESA_DEPS='-l$(GL_LIB)'
543 else
544 OSMESA_MESA_DEPS=""
545 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800546 ;;
547esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700548AC_SUBST(OSMESA_LIB_DEPS)
549AC_SUBST(OSMESA_MESA_DEPS)
550
551dnl
552dnl GLU configuration
553dnl
554AC_ARG_ENABLE(glu,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800555 [AS_HELP_STRING([--disable-glu],
556 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700557 enable_glu="$enableval",
558 enable_glu=yes)
559if test "x$enable_glu" = xyes; then
560 SRC_DIRS="$SRC_DIRS glu"
561
Dan Nicholson979ff512007-12-05 18:47:01 -0800562 case "$mesa_driver" in
563 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800564 # If GLU is available and we have libOSMesa (not 16 or 32),
565 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800566 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800567 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
568 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700569
Dan Nicholson979ff512007-12-05 18:47:01 -0800570 # Link libGLU to libOSMesa instead of libGL
571 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800572 if test "$enable_static" = no; then
573 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
574 else
575 GLU_MESA_DEPS=""
576 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800577 ;;
578 *)
579 # If GLU is available, we can build the xdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800580 if test "$with_demos" = yes; then
581 PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
582 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800583
Dan Nicholson88586332007-11-15 08:59:57 -0800584 # If static, empty GLU_LIB_DEPS and add libs for programs to link
585 if test "$enable_static" = no; then
586 GLU_LIB_DEPS="-lm"
587 GLU_MESA_DEPS='-l$(GL_LIB)'
588 else
589 GLU_LIB_DEPS=""
590 GLU_MESA_DEPS=""
591 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
592 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800593 ;;
594 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700595fi
596AC_SUBST(GLU_LIB_DEPS)
597AC_SUBST(GLU_MESA_DEPS)
598
599dnl
600dnl GLw configuration
601dnl
602AC_ARG_ENABLE(glw,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800603 [AS_HELP_STRING([--disable-glw],
604 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700605 enable_glw="$enableval",
606 enable_glw=yes)
Dan Nicholson979ff512007-12-05 18:47:01 -0800607dnl Don't build GLw on osmesa
608if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
609 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
610 enable_glw=no
611fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700612if test "x$enable_glw" = xyes; then
613 SRC_DIRS="$SRC_DIRS glw"
614 if test "$x11_pkgconfig" = yes; then
615 PKG_CHECK_MODULES(GLW, x11 xt)
616 GLW_LIB_DEPS="$GLW_LIBS"
617 else
618 # should check these...
619 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
620 fi
621
Dan Nicholson88586332007-11-15 08:59:57 -0800622 # If static, empty GLW_LIB_DEPS and add libs for programs to link
623 if test "$enable_static" = no; then
624 GLW_MESA_DEPS='-l$(GL_LIB)'
625 else
626 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
627 GLW_LIB_DEPS=""
628 GLW_MESA_DEPS=""
629 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700630fi
631AC_SUBST(GLW_LIB_DEPS)
632AC_SUBST(GLW_MESA_DEPS)
633
634dnl
635dnl GLUT configuration
636dnl
637if test -f "$srcdir/include/GL/glut.h"; then
638 default_glut=yes
639else
640 default_glut=no
641fi
642AC_ARG_ENABLE(glut,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800643 [AS_HELP_STRING([--disable-glut],
644 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700645 enable_glut="$enableval",
646 enable_glut="$default_glut")
647
648dnl Can't build glut if GLU not available
649if test "x$enable_glu$enable_glut" = xnoyes; then
650 AC_MSG_WARN([Disabling glut since GLU is disabled])
651 enable_glut=no
652fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800653dnl Don't build glut on osmesa
654if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
655 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
656 enable_glut=no
657fi
658
Dan Nicholsondca1b792007-10-23 09:25:58 -0700659if test "x$enable_glut" = xyes; then
660 SRC_DIRS="$SRC_DIRS glut/glx"
661 GLUT_CFLAGS=""
662 if test "x$GCC" = xyes; then
663 GLUT_CFLAGS="-fexceptions"
664 fi
665 if test "$x11_pkgconfig" = yes; then
Dan Nicholson70d0c832007-12-07 11:12:20 -0800666 PKG_CHECK_MODULES(GLUT, x11 xmu xi)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700667 GLUT_LIB_DEPS="$GLUT_LIBS"
668 else
669 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -0800670 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700671 fi
672 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
673
674 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800675 if test "$with_demos" = yes; then
676 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
677 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700678
Dan Nicholson88586332007-11-15 08:59:57 -0800679 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
680 if test "$enable_static" = no; then
681 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
682 else
683 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
684 GLUT_LIB_DEPS=""
685 GLUT_MESA_DEPS=""
686 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700687fi
688AC_SUBST(GLUT_LIB_DEPS)
689AC_SUBST(GLUT_MESA_DEPS)
690AC_SUBST(GLUT_CFLAGS)
691
692dnl
693dnl Program library dependencies
694dnl Only libm is added here if necessary as the libraries should
695dnl be pulled in by the linker
696dnl
697if test "x$APP_LIB_DEPS" = x; then
698 APP_LIB_DEPS="-lm"
699fi
700AC_SUBST(APP_LIB_DEPS)
701AC_SUBST(PROGRAM_DIRS)
702
703dnl Arch/platform-specific settings
704PIC_FLAGS=""
705ASM_FLAGS=""
706ASM_SOURCES=""
707ASM_API=""
708AC_SUBST(PIC_FLAGS)
709AC_SUBST(ASM_FLAGS)
710AC_SUBST(ASM_SOURCES)
711AC_SUBST(ASM_API)
712case "$host_os" in
713linux*)
714 PIC_FLAGS="-fPIC"
715 case "$host_cpu" in
716 i*86)
717 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
718 ASM_SOURCES='$(X86_SOURCES)'
719 ASM_API='$(X86_API)'
720 ;;
721 x86_64)
722 ASM_FLAGS="-DUSE_X86_64_ASM"
723 ASM_SOURCES='$(X86-64_SOURCES)'
724 ASM_API='$(X86-64_API)'
725 ;;
726 powerpc)
727 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
728 ASM_SOURCES='$(PPC_SOURCES)'
729 ;;
730 esac
731 ;;
732freebsd*)
733 PIC_FLAGS="-fPIC"
734 case "$host_os" in
735 i*86)
736 PIC_FLAGS=""
737 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
738 ASM_SOURCES='$(X86_SOURCES)'
739 ASM_API='$(X86_API)'
740 ;;
741 x86_64)
742 ASM_FLAGS="-DUSE_X86_64_ASM"
743 ASM_SOURCES='$(X86-64_SOURCES)'
744 ASM_API='$(X86-64_API)'
745 ;;
746 esac
747 ;;
748esac
749
750dnl Restore LDFLAGS and CPPFLAGS
751LDFLAGS="$_SAVE_LDFLAGS"
752CPPFLAGS="$_SAVE_CPPFLAGS"
753
754dnl Substitute the config
755AC_OUTPUT([configs/autoconf])
756
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800757dnl Replace the configs/current symlink
758if test -f configs/current || test -L configs/current; then
759 rm -f configs/current
760fi
761ln -s autoconf configs/current
762
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800763dnl
764dnl Output some configuration info for the user
765dnl
766echo ""
767echo " prefix: $prefix"
768echo " exec_prefix: $exec_prefix"
769echo " libdir: $libdir"
770
771dnl Driver info
772echo ""
773echo " Driver: $mesa_driver"
774case "$mesa_driver" in
775x11|osmesa)
776 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
777 echo " OSMesa: lib$OSMESA_LIB"
778 else
779 echo " OSMesa: no"
780 fi
781 ;;
782dri)
783 # cleanup the drivers var
784 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
785 echo " DRI drivers: $dri_dirs"
786 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
787 ;;
788esac
789
790dnl Libraries
791echo ""
792echo " Shared libs: $enable_shared"
793echo " Static libs: $enable_static"
794echo " GLU: $enable_glu"
795echo " GLw: $enable_glw"
796echo " glut: $enable_glut"
797
798dnl Programs
799# cleanup the programs var for display
800program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
801if test "x$program_dirs" = x; then
802 echo " Demos: no"
803else
804 echo " Demos: $program_dirs"
805fi
806
Dan Nicholsondca1b792007-10-23 09:25:58 -0700807echo ""
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800808echo " Run 'make' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700809echo ""