blob: 1a2a2cb46a9defa7e6086eb29cc11206237ce610 [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"
69fi
70if test "x$GXX" = xyes; then
71 CXXFLAGS="$CXXFLAGS -Wall"
72fi
73
74dnl These should be unnecessary, but let the user set them if they want
75AC_ARG_VAR(OPT_FLAGS, [Additional optimization flags for the compiler.
76 Default is to use CFLAGS.])
77AC_ARG_VAR(ARCH_FLAGS, [Additional architecture specific flags for the
78 compiler. Default is to use CFLAGS.])
79AC_SUBST(OPT_FLAGS)
80AC_SUBST(ARCH_FLAGS)
81
82dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -060083dnl Hacks to enable 32 or 64 bit build
84dnl
85AC_ARG_ENABLE(32-bit,
86 [AS_HELP_STRING([--enable-32-bit],
87 [build 32-bit libraries @<:@default=auto@:>@])],
88 enable_32bit="$enableval",
89 enable_32bit=auto
90)
91if test "x$enable_32bit" = xyes; then
92 if test "x$GCC" = xyes; then
93 CFLAGS="$CFLAGS -m32"
94 fi
95 if test "x$GXX" = xyes; then
96 CXXFLAGS="$CXXFLAGS -m32"
97 fi
98fi
99AC_ARG_ENABLE(64-bit,
100 [AS_HELP_STRING([--enable-64-bit],
101 [build 64-bit libraries @<:@default=auto@:>@])],
102 enable_64bit="$enableval",
103 enable_64bit=auto
104)
105if test "x$enable_64bit" = xyes; then
106 if test "x$GCC" = xyes; then
107 CFLAGS="$CFLAGS -m64"
108 fi
109 if test "x$GXX" = xyes; then
110 CXXFLAGS="$CXXFLAGS -m64"
111 fi
112fi
113
114dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800115dnl shared/static libraries, mimic libtool options
116dnl
117AC_ARG_ENABLE(static,
118 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800119 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -0800120 enable_static="$enableval",
121 enable_static=no
122)
123case "x$enable_static" in
124xyes|xno ) ;;
125x ) enable_static=no ;;
126* )
127 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
128 ;;
129esac
130AC_ARG_ENABLE(shared,
131 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800132 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -0800133 enable_shared="$enableval",
134 enable_shared=yes
135)
136case "x$enable_shared" in
137xyes|xno ) ;;
138x ) enable_shared=yes ;;
139* )
140 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
141 ;;
142esac
143
144dnl Can't have static and shared libraries, default to static if user
145dnl explicitly requested. If both disabled, set to static since shared
146dnl was explicitly requirested.
147case "x$enable_static$enable_shared" in
148xyesyes )
149 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
150 enable_shared=no
151 ;;
152xnono )
153 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
154 enable_static=yes
155 ;;
156esac
157
158dnl
159dnl mklib options
160dnl
161AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib])
162if test "$enable_static" = yes; then
163 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
164fi
165AC_SUBST(MKLIB_OPTIONS)
166
Dan Nicholson23656c42007-12-12 09:02:31 -0800167dnl
168dnl other compiler options
169dnl
170AC_ARG_ENABLE(debug,
171 [AS_HELP_STRING([--enable-debug],
172 [use debug compiler flags and macros @<:@default=disabled@:>@])],
173 enable_debug="$enableval",
174 enable_debug=no
175)
176if test "x$enable_debug" = xyes; then
177 DEFINES="$DEFINES -DDEBUG"
178 if test "x$GCC" = xyes; then
179 CFLAGS="$CFLAGS -g"
180 fi
181 if test "x$GXX" = xyes; then
182 CXXFLAGS="$CXXFLAGS -g"
183 fi
184fi
Dan Nicholson3e288622007-12-12 09:02:31 -0800185dnl These will be used near the end in the arch specific options
186AC_ARG_ENABLE(asm,
187 [AS_HELP_STRING([--disable-asm],
188 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
189 enable_asm="$enableval",
190 enable_asm=yes
191)
Dan Nicholson88586332007-11-15 08:59:57 -0800192
193dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700194dnl library names
195dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800196if test "$enable_static" = yes; then
197 GL_LIB_NAME='lib$(GL_LIB).a'
198 GLU_LIB_NAME='lib$(GLU_LIB).a'
199 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
200 GLW_LIB_NAME='lib$(GLW_LIB).a'
201 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
202else
203 GL_LIB_NAME='lib$(GL_LIB).so'
204 GLU_LIB_NAME='lib$(GLU_LIB).so'
205 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
206 GLW_LIB_NAME='lib$(GLW_LIB).so'
207 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
208fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700209AC_SUBST(GL_LIB_NAME)
210AC_SUBST(GLU_LIB_NAME)
211AC_SUBST(GLUT_LIB_NAME)
212AC_SUBST(GLW_LIB_NAME)
213AC_SUBST(OSMESA_LIB_NAME)
214
215dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800216dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800217dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800218dnl
219AC_ARG_WITH(driver,
220 [AS_HELP_STRING([--with-driver=DRIVER],
Dan Nicholsona1307182007-12-12 17:49:49 -0800221 [driver for Mesa: xlib,dri,osmesa @<:@default=xlib@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800222 mesa_driver="$withval",
Dan Nicholsona1307182007-12-12 17:49:49 -0800223 mesa_driver="xlib")
Dan Nicholson44d99142007-12-05 18:47:01 -0800224dnl Check for valid option
225case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800226xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800227 ;;
228*)
229 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
230 ;;
231esac
232
233dnl
234dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700235dnl
236SRC_DIRS="mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700237GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800238WINDOW_SYSTEM=""
239case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800240xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800241 DRIVER_DIRS="x11"
242 ;;
243dri)
244 SRC_DIRS="glx/x11 $SRC_DIRS"
245 DRIVER_DIRS="dri"
246 WINDOW_SYSTEM="dri"
247 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800248osmesa)
249 DRIVER_DIRS="osmesa"
250 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800251esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700252AC_SUBST(SRC_DIRS)
253AC_SUBST(GLU_DIRS)
254AC_SUBST(DRIVER_DIRS)
Dan Nicholson44d99142007-12-05 18:47:01 -0800255AC_SUBST(WINDOW_SYSTEM)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700256
257dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800258dnl User supplied program configuration
259dnl
260if test -d "$srcdir/progs/demos"; then
261 default_demos=yes
262else
263 default_demos=no
264fi
265AC_ARG_WITH(demos,
266 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
267 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800268 @<:@default=auto if source available@:>@])],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800269 with_demos="$withval",
270 with_demos="$default_demos")
271if test "x$with_demos" = x; then
272 with_demos=no
273fi
274
275dnl If $with_demos is yes, directories will be added as libs available
276PROGRAM_DIRS=""
277case "$with_demos" in
278no|yes) ;;
279*)
280 # verify the requested demos directories exist
281 demos=`IFS=,; echo $with_demos`
282 for demo in $demos; do
283 test -d "$srcdir/progs/$demo" || \
284 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
285 done
286 PROGRAM_DIRS="$demos"
287 ;;
288esac
289
290dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700291dnl Find out if X is available. The variables have_x or no_x will be
292dnl set and used later in the driver setups
293dnl
294if test -n "$PKG_CONFIG"; then
295 AC_MSG_CHECKING([pkg-config files for X11 are available])
296 if $PKG_CONFIG --exists x11; then
297 x11_pkgconfig=yes
298 have_x=yes
299 AC_MSG_RESULT(yes)
300 else
301 x11_pkgconfig=no
302 no_x=yes
303 AC_MSG_RESULT(no)
304 fi
305else
306 x11_pkgconfig=no
307fi
308dnl Use the autoconf macro if no pkg-config files
309if test "$x11_pkgconfig" = no; then
310 AC_PATH_XTRA
311fi
312
Dan Nicholson44d99142007-12-05 18:47:01 -0800313dnl We need X for xlib and dri, so bomb now if it's not found
314case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800315xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800316 if test "$no_x" = yes; then
317 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
318 fi
319 ;;
320esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700321
Dan Nicholson44d99142007-12-05 18:47:01 -0800322dnl
323dnl libGL configuration per driver
324dnl
325case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800326xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800327 if test "$x11_pkgconfig" = yes; then
Dan Nicholsona1307182007-12-12 17:49:49 -0800328 PKG_CHECK_MODULES(XLIBGL, x11 xext)
329 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
330 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800331 else
332 # should check these...
333 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
334 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
335 fi
336 GL_LIB_DEPS="$GL_LIB_DEPS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800337
338 # if static, move the external libraries to the programs
339 # and empty the libraries for libGL
340 if test "$enable_static" = yes; then
341 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
342 GL_LIB_DEPS=""
343 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800344 ;;
345dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800346 # DRI must be shared, I think
347 if test "$enable_static" = yes; then
348 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
349 fi
350
Dan Nicholson44d99142007-12-05 18:47:01 -0800351 # Check for libdrm
352 PKG_CHECK_MODULES(LIBDRM, libdrm)
353
354 # find the DRI deps for libGL
355 if test "$x11_pkgconfig" = yes; then
356 PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
357 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
358 GL_LIB_DEPS="$DRIGL_LIBS"
359 else
360 # should check these...
361 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
362 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
363 fi
364
365 # need DRM libs, -lpthread, etc.
366 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread -ldl"
367 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800368osmesa)
369 # No libGL for osmesa
370 GL_LIB_DEPS=""
371 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800372esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700373AC_SUBST(GL_LIB_DEPS)
374
375dnl
376dnl More X11 setup
377dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800378if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700379 DEFINES="$DEFINES -DUSE_XSHM"
380fi
381
382dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800383dnl More DRI setup
384dnl
385AC_ARG_ENABLE(glx-tls,
386 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800387 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800388 GLX_USE_TLS="$enableval",
389 GLX_USE_TLS=no)
390dnl Directory for DRI drivers
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800391AC_ARG_WITH(dri-driverdir,
392 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson44d99142007-12-05 18:47:01 -0800393 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
394 DRI_DRIVER_INSTALL_DIR="$withval",
395 DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
396AC_SUBST(DRI_DRIVER_INSTALL_DIR)
397dnl Direct rendering or just indirect rendering
398AC_ARG_ENABLE(driglx-direct,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800399 [AS_HELP_STRING([--disable-driglx-direct],
400 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800401 driglx_direct="$enableval",
402 driglx_direct="yes")
403
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800404dnl Which drivers to build - default is chosen by platform
405AC_ARG_WITH(dri-drivers,
406 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800407 [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800408 with_dri_drivers="$withval",
409 with_dri_drivers=yes)
410if test "x$with_dri_drivers" = x; then
411 with_dri_drivers=no
412fi
413
414dnl If $with_dri_drivers is yes, directories will be added through
415dnl platform checks
416DRI_DIRS=""
417case "$with_dri_drivers" in
418no|yes) ;;
419*)
420 # verify the requested driver directories exist
421 dri_drivers=`IFS=,; echo $with_dri_drivers`
422 for driver in $dri_drivers; do
423 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
424 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
425 done
426 DRI_DIRS="$dri_drivers"
427 ;;
428esac
429
Dan Nicholson44d99142007-12-05 18:47:01 -0800430dnl Just default to no EGL for now
431USING_EGL=0
432AC_SUBST(USING_EGL)
433
434dnl Set DRI_DIRS, DEFINES and LIB_DEPS
435if test "$mesa_driver" = dri; then
436 # Use TLS in GLX?
437 if test "x$GLX_USE_TLS" = xyes; then
438 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
439 fi
440
441 if test "x$USING_EGL" = x1; then
442 PROGRAM_DIRS="egl"
443 fi
444
Dan Nicholsona76e2452007-12-07 11:25:08 -0800445 # default drivers
446 if test "x$DRI_DIRS" = x; then
447 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
448 savage sis tdfx trident unichrome ffb"
449 fi
450
Dan Nicholson44d99142007-12-05 18:47:01 -0800451 # Platform specific settings and drivers to build
452 case "$host_os" in
453 linux*)
454 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
455 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
456 if test "x$driglx_direct" = xyes; then
457 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
458 fi
459
460 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800461 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800462 # ffb, gamma, and sis are missing because they have not be
463 # converted to use the new interface. i810 are missing
464 # because there is no x86-64 system where they could *ever*
465 # be used.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800466 if test "x$DRI_DIRS" = x; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800467 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
468 savage tdfx unichrome"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800469 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800470 ;;
471 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800472 # Build only the drivers for cards that exist on PowerPC.
473 # At some point MGA will be added, but not yet.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800474 if test "x$DRI_DIRS" = x; then
475 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
476 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800477 ;;
478 esac
479 ;;
480 freebsd*)
481 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
482 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
483 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
484 if test "x$driglx_direct" = xyes; then
485 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
486 fi
487 if test "x$GXX" = xyes; then
488 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
489 fi
490
Dan Nicholsona76e2452007-12-07 11:25:08 -0800491 # ffb and gamma are missing because they have not been converted
492 # to use the new interface.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800493 if test "x$DRI_DIRS" = x; then
494 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
495 unichrome savage sis"
496 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800497 ;;
498 esac
499 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
500
501 # Check for expat
502 EXPAT_INCLUDES=""
503 EXPAT_LIB=-lexpat
504 AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
505 [expat install directory]),[
506 EXPAT_INCLUDES="-I$withval/include"
507 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
508 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
509 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
510 ])
511 AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
512 AC_CHECK_LIB(expat, XML_ParserCreate,,
513 AC_MSG_ERROR([Expat required for DRI.]))
514
515 # put all the necessary libs together
516 DRI_LIB_DEPS="$LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl"
517fi
518AC_SUBST(DRI_DIRS)
519AC_SUBST(EXPAT_INCLUDES)
520AC_SUBST(DRI_LIB_DEPS)
521
522dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700523dnl OSMesa configuration
524dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800525if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800526 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800527else
Dan Nicholson544ab202007-12-30 08:41:53 -0800528 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800529fi
Dan Nicholson544ab202007-12-30 08:41:53 -0800530AC_ARG_ENABLE(gl-osmesa,
531 [AS_HELP_STRING([--enable-gl-osmesa],
532 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
533 gl_osmesa="$enableval",
534 gl_osmesa="$default_gl_osmesa")
535if test "x$gl_osmesa" = xyes; then
536 if test "$mesa_driver" = osmesa; then
537 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800538 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800539 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800540 fi
541fi
542
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800543dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
544AC_ARG_WITH(osmesa-bits,
545 [AS_HELP_STRING([--with-osmesa-bits=BITS],
546 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
547 osmesa_bits="$withval",
548 osmesa_bits=8)
549if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
550 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
551 osmesa_bits=8
552fi
553case "x$osmesa_bits" in
554x8)
555 OSMESA_LIB=OSMesa
556 ;;
557x16|x32)
558 OSMESA_LIB="OSMesa$osmesa_bits"
559 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
560 ;;
561*)
562 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
563 ;;
564esac
565AC_SUBST(OSMESA_LIB)
566
Dan Nicholson979ff512007-12-05 18:47:01 -0800567case "$mesa_driver" in
568osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800569 # only link librararies with osmesa if shared
570 if test "$enable_static" = no; then
571 OSMESA_LIB_DEPS="-lm -lpthread"
572 else
573 OSMESA_LIB_DEPS=""
574 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800575 OSMESA_MESA_DEPS=""
576 ;;
577*)
578 # Link OSMesa to libGL otherwise
579 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800580 # only link librararies with osmesa if shared
581 if test "$enable_static" = no; then
582 OSMESA_MESA_DEPS='-l$(GL_LIB)'
583 else
584 OSMESA_MESA_DEPS=""
585 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800586 ;;
587esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700588AC_SUBST(OSMESA_LIB_DEPS)
589AC_SUBST(OSMESA_MESA_DEPS)
590
591dnl
592dnl GLU configuration
593dnl
594AC_ARG_ENABLE(glu,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800595 [AS_HELP_STRING([--disable-glu],
596 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700597 enable_glu="$enableval",
598 enable_glu=yes)
599if test "x$enable_glu" = xyes; then
600 SRC_DIRS="$SRC_DIRS glu"
601
Dan Nicholson979ff512007-12-05 18:47:01 -0800602 case "$mesa_driver" in
603 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800604 # If GLU is available and we have libOSMesa (not 16 or 32),
605 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800606 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800607 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
608 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700609
Dan Nicholson979ff512007-12-05 18:47:01 -0800610 # Link libGLU to libOSMesa instead of libGL
611 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800612 if test "$enable_static" = no; then
613 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
614 else
615 GLU_MESA_DEPS=""
616 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800617 ;;
618 *)
619 # If GLU is available, we can build the xdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800620 if test "$with_demos" = yes; then
621 PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
622 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800623
Dan Nicholson88586332007-11-15 08:59:57 -0800624 # If static, empty GLU_LIB_DEPS and add libs for programs to link
625 if test "$enable_static" = no; then
626 GLU_LIB_DEPS="-lm"
627 GLU_MESA_DEPS='-l$(GL_LIB)'
628 else
629 GLU_LIB_DEPS=""
630 GLU_MESA_DEPS=""
631 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
632 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800633 ;;
634 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700635fi
636AC_SUBST(GLU_LIB_DEPS)
637AC_SUBST(GLU_MESA_DEPS)
638
639dnl
640dnl GLw configuration
641dnl
642AC_ARG_ENABLE(glw,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800643 [AS_HELP_STRING([--disable-glw],
644 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700645 enable_glw="$enableval",
646 enable_glw=yes)
Dan Nicholson979ff512007-12-05 18:47:01 -0800647dnl Don't build GLw on osmesa
648if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
649 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
650 enable_glw=no
651fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700652if test "x$enable_glw" = xyes; then
653 SRC_DIRS="$SRC_DIRS glw"
654 if test "$x11_pkgconfig" = yes; then
655 PKG_CHECK_MODULES(GLW, x11 xt)
656 GLW_LIB_DEPS="$GLW_LIBS"
657 else
658 # should check these...
659 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
660 fi
661
Dan Nicholson88586332007-11-15 08:59:57 -0800662 # If static, empty GLW_LIB_DEPS and add libs for programs to link
663 if test "$enable_static" = no; then
664 GLW_MESA_DEPS='-l$(GL_LIB)'
665 else
666 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
667 GLW_LIB_DEPS=""
668 GLW_MESA_DEPS=""
669 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700670fi
671AC_SUBST(GLW_LIB_DEPS)
672AC_SUBST(GLW_MESA_DEPS)
673
674dnl
675dnl GLUT configuration
676dnl
677if test -f "$srcdir/include/GL/glut.h"; then
678 default_glut=yes
679else
680 default_glut=no
681fi
682AC_ARG_ENABLE(glut,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800683 [AS_HELP_STRING([--disable-glut],
684 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700685 enable_glut="$enableval",
686 enable_glut="$default_glut")
687
688dnl Can't build glut if GLU not available
689if test "x$enable_glu$enable_glut" = xnoyes; then
690 AC_MSG_WARN([Disabling glut since GLU is disabled])
691 enable_glut=no
692fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800693dnl Don't build glut on osmesa
694if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
695 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
696 enable_glut=no
697fi
698
Dan Nicholsondca1b792007-10-23 09:25:58 -0700699if test "x$enable_glut" = xyes; then
700 SRC_DIRS="$SRC_DIRS glut/glx"
701 GLUT_CFLAGS=""
702 if test "x$GCC" = xyes; then
703 GLUT_CFLAGS="-fexceptions"
704 fi
705 if test "$x11_pkgconfig" = yes; then
Dan Nicholson70d0c832007-12-07 11:12:20 -0800706 PKG_CHECK_MODULES(GLUT, x11 xmu xi)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700707 GLUT_LIB_DEPS="$GLUT_LIBS"
708 else
709 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -0800710 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700711 fi
712 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
713
714 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800715 if test "$with_demos" = yes; then
716 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
717 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700718
Dan Nicholson88586332007-11-15 08:59:57 -0800719 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
720 if test "$enable_static" = no; then
721 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
722 else
723 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
724 GLUT_LIB_DEPS=""
725 GLUT_MESA_DEPS=""
726 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700727fi
728AC_SUBST(GLUT_LIB_DEPS)
729AC_SUBST(GLUT_MESA_DEPS)
730AC_SUBST(GLUT_CFLAGS)
731
732dnl
733dnl Program library dependencies
734dnl Only libm is added here if necessary as the libraries should
735dnl be pulled in by the linker
736dnl
737if test "x$APP_LIB_DEPS" = x; then
738 APP_LIB_DEPS="-lm"
739fi
740AC_SUBST(APP_LIB_DEPS)
741AC_SUBST(PROGRAM_DIRS)
742
743dnl Arch/platform-specific settings
744PIC_FLAGS=""
745ASM_FLAGS=""
746ASM_SOURCES=""
747ASM_API=""
748AC_SUBST(PIC_FLAGS)
749AC_SUBST(ASM_FLAGS)
750AC_SUBST(ASM_SOURCES)
751AC_SUBST(ASM_API)
752case "$host_os" in
753linux*)
754 PIC_FLAGS="-fPIC"
755 case "$host_cpu" in
756 i*86)
Dan Nicholson3e288622007-12-12 09:02:31 -0800757 if test "x$enable_asm" = xyes; then
758 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
759 ASM_SOURCES='$(X86_SOURCES)'
760 ASM_API='$(X86_API)'
761 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700762 ;;
763 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800764 if test "x$enable_asm" = xyes; then
765 ASM_FLAGS="-DUSE_X86_64_ASM"
766 ASM_SOURCES='$(X86-64_SOURCES)'
767 ASM_API='$(X86-64_API)'
768 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700769 ;;
770 powerpc)
Dan Nicholson3e288622007-12-12 09:02:31 -0800771 if test "x$enable_asm" = xyes; then
772 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
773 ASM_SOURCES='$(PPC_SOURCES)'
774 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700775 ;;
776 esac
777 ;;
778freebsd*)
779 PIC_FLAGS="-fPIC"
780 case "$host_os" in
781 i*86)
782 PIC_FLAGS=""
Dan Nicholson3e288622007-12-12 09:02:31 -0800783 if test "x$enable_asm" = xyes; then
784 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
785 ASM_SOURCES='$(X86_SOURCES)'
786 ASM_API='$(X86_API)'
787 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700788 ;;
789 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800790 if test "x$enable_asm" = xyes; then
791 ASM_FLAGS="-DUSE_X86_64_ASM"
792 ASM_SOURCES='$(X86-64_SOURCES)'
793 ASM_API='$(X86-64_API)'
794 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700795 ;;
796 esac
797 ;;
798esac
799
800dnl Restore LDFLAGS and CPPFLAGS
801LDFLAGS="$_SAVE_LDFLAGS"
802CPPFLAGS="$_SAVE_CPPFLAGS"
803
804dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -0800805AC_CONFIG_FILES([configs/autoconf])
806AC_OUTPUT
Dan Nicholsondca1b792007-10-23 09:25:58 -0700807
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800808dnl Replace the configs/current symlink
809if test -f configs/current || test -L configs/current; then
810 rm -f configs/current
811fi
812ln -s autoconf configs/current
813
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800814dnl
815dnl Output some configuration info for the user
816dnl
817echo ""
818echo " prefix: $prefix"
819echo " exec_prefix: $exec_prefix"
820echo " libdir: $libdir"
821
822dnl Driver info
823echo ""
824echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -0800825if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
826 echo " OSMesa: lib$OSMESA_LIB"
827else
828 echo " OSMesa: no"
829fi
830if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800831 # cleanup the drivers var
832 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
833 echo " DRI drivers: $dri_dirs"
834 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -0800835fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800836
837dnl Libraries
838echo ""
839echo " Shared libs: $enable_shared"
840echo " Static libs: $enable_static"
841echo " GLU: $enable_glu"
842echo " GLw: $enable_glw"
843echo " glut: $enable_glut"
844
845dnl Programs
846# cleanup the programs var for display
847program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
848if test "x$program_dirs" = x; then
849 echo " Demos: no"
850else
851 echo " Demos: $program_dirs"
852fi
853
Dan Nicholson16a07fb2007-12-12 09:12:15 -0800854dnl Compiler options
855# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
856cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
857 $SED 's/^ *//;s/ */ /;s/ *$//'`
858cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
859 $SED 's/^ *//;s/ */ /;s/ *$//'`
860defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
861echo ""
862echo " CFLAGS: $cflags"
863echo " CXXFLAGS: $cxxflags"
864echo " Macros: $defines"
865
Dan Nicholsondca1b792007-10-23 09:25:58 -0700866echo ""
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800867echo " Run 'make' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700868echo ""