blob: 94fb9e3ba70598537d783b76e68bc7719f17bda2 [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)
31PKG_PROG_PKG_CONFIG()
32
33dnl LIB_DIR - library basename
34LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
35AC_SUBST(LIB_DIR)
36
37dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
38_SAVE_LDFLAGS="$LDFLAGS"
39AC_ARG_VAR(EXTRA_LIB_PATH,[Extra -L paths for the linker])
40AC_SUBST(EXTRA_LIB_PATH)
41
42dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
43_SAVE_CPPFLAGS="$CPPFLAGS"
44AC_ARG_VAR(X11_INCLUDES,[Extra -I paths for X11 headers])
45AC_SUBST(X11_INCLUDES)
46
47dnl Compiler macros
48DEFINES=""
49AC_SUBST(DEFINES)
50if test "x$GCC" = xyes; then
51 DEFINES="-D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
52fi
53case "$host_os" in
54linux*)
55 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
56 ;;
57esac
58
59dnl Add flags for gcc and g++
60if test "x$GCC" = xyes; then
61 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
62fi
63if test "x$GXX" = xyes; then
64 CXXFLAGS="$CXXFLAGS -Wall"
65fi
66
67dnl These should be unnecessary, but let the user set them if they want
68AC_ARG_VAR(OPT_FLAGS, [Additional optimization flags for the compiler.
69 Default is to use CFLAGS.])
70AC_ARG_VAR(ARCH_FLAGS, [Additional architecture specific flags for the
71 compiler. Default is to use CFLAGS.])
72AC_SUBST(OPT_FLAGS)
73AC_SUBST(ARCH_FLAGS)
74
75dnl
Dan Nicholson88586332007-11-15 08:59:57 -080076dnl shared/static libraries, mimic libtool options
77dnl
78AC_ARG_ENABLE(static,
79 [AS_HELP_STRING([--enable-static],
80 [build static libraries @<:@default=no@:>@])],
81 enable_static="$enableval",
82 enable_static=no
83)
84case "x$enable_static" in
85xyes|xno ) ;;
86x ) enable_static=no ;;
87* )
88 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
89 ;;
90esac
91AC_ARG_ENABLE(shared,
92 [AS_HELP_STRING([--disable-shared],
93 [build shared libraries @<:@default=yes@:>@])],
94 enable_shared="$enableval",
95 enable_shared=yes
96)
97case "x$enable_shared" in
98xyes|xno ) ;;
99x ) enable_shared=yes ;;
100* )
101 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
102 ;;
103esac
104
105dnl Can't have static and shared libraries, default to static if user
106dnl explicitly requested. If both disabled, set to static since shared
107dnl was explicitly requirested.
108case "x$enable_static$enable_shared" in
109xyesyes )
110 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
111 enable_shared=no
112 ;;
113xnono )
114 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
115 enable_static=yes
116 ;;
117esac
118
119dnl
120dnl mklib options
121dnl
122AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib])
123if test "$enable_static" = yes; then
124 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
125fi
126AC_SUBST(MKLIB_OPTIONS)
127
128
129dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700130dnl library names
131dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800132if test "$enable_static" = yes; then
133 GL_LIB_NAME='lib$(GL_LIB).a'
134 GLU_LIB_NAME='lib$(GLU_LIB).a'
135 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
136 GLW_LIB_NAME='lib$(GLW_LIB).a'
137 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
138else
139 GL_LIB_NAME='lib$(GL_LIB).so'
140 GLU_LIB_NAME='lib$(GLU_LIB).so'
141 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
142 GLW_LIB_NAME='lib$(GLW_LIB).so'
143 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
144fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700145AC_SUBST(GL_LIB_NAME)
146AC_SUBST(GLU_LIB_NAME)
147AC_SUBST(GLUT_LIB_NAME)
148AC_SUBST(GLW_LIB_NAME)
149AC_SUBST(OSMESA_LIB_NAME)
150
151dnl
Dan Nicholson979ff512007-12-05 18:47:01 -0800152dnl Driver configuration. Options are x11 (Xlib), dri and osmesa right now.
153dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800154dnl
155AC_ARG_WITH(driver,
156 [AS_HELP_STRING([--with-driver=DRIVER],
Dan Nicholson979ff512007-12-05 18:47:01 -0800157 [driver for Mesa: x11,dri,osmesa @<:@default=x11@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800158 mesa_driver="$withval",
159 mesa_driver="x11")
160dnl Check for valid option
161case "x$mesa_driver" in
Dan Nicholson979ff512007-12-05 18:47:01 -0800162xx11|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800163 ;;
164*)
165 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
166 ;;
167esac
168
169dnl
170dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700171dnl
172SRC_DIRS="mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700173GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800174DRI_DIRS=""
175WINDOW_SYSTEM=""
176case "$mesa_driver" in
177x11)
178 DRIVER_DIRS="x11"
179 ;;
180dri)
181 SRC_DIRS="glx/x11 $SRC_DIRS"
182 DRIVER_DIRS="dri"
183 WINDOW_SYSTEM="dri"
184 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800185osmesa)
186 DRIVER_DIRS="osmesa"
187 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800188esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700189AC_SUBST(SRC_DIRS)
190AC_SUBST(GLU_DIRS)
191AC_SUBST(DRIVER_DIRS)
Dan Nicholson44d99142007-12-05 18:47:01 -0800192AC_SUBST(WINDOW_SYSTEM)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700193
194dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800195dnl User supplied program configuration
196dnl
197if test -d "$srcdir/progs/demos"; then
198 default_demos=yes
199else
200 default_demos=no
201fi
202AC_ARG_WITH(demos,
203 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
204 [optional comma delimited demo directories to build
205 @<:@default=yes if source available@:>@])],
206 with_demos="$withval",
207 with_demos="$default_demos")
208if test "x$with_demos" = x; then
209 with_demos=no
210fi
211
212dnl If $with_demos is yes, directories will be added as libs available
213PROGRAM_DIRS=""
214case "$with_demos" in
215no|yes) ;;
216*)
217 # verify the requested demos directories exist
218 demos=`IFS=,; echo $with_demos`
219 for demo in $demos; do
220 test -d "$srcdir/progs/$demo" || \
221 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
222 done
223 PROGRAM_DIRS="$demos"
224 ;;
225esac
226
227dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700228dnl Find out if X is available. The variables have_x or no_x will be
229dnl set and used later in the driver setups
230dnl
231if test -n "$PKG_CONFIG"; then
232 AC_MSG_CHECKING([pkg-config files for X11 are available])
233 if $PKG_CONFIG --exists x11; then
234 x11_pkgconfig=yes
235 have_x=yes
236 AC_MSG_RESULT(yes)
237 else
238 x11_pkgconfig=no
239 no_x=yes
240 AC_MSG_RESULT(no)
241 fi
242else
243 x11_pkgconfig=no
244fi
245dnl Use the autoconf macro if no pkg-config files
246if test "$x11_pkgconfig" = no; then
247 AC_PATH_XTRA
248fi
249
Dan Nicholson44d99142007-12-05 18:47:01 -0800250dnl We need X for xlib and dri, so bomb now if it's not found
251case "$mesa_driver" in
252x11|dri)
253 if test "$no_x" = yes; then
254 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
255 fi
256 ;;
257esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700258
Dan Nicholson44d99142007-12-05 18:47:01 -0800259dnl
260dnl libGL configuration per driver
261dnl
262case "$mesa_driver" in
263x11)
264 if test "$x11_pkgconfig" = yes; then
265 PKG_CHECK_MODULES(X11GL, x11 xext)
266 X11_INCLUDES="$X11_INCLUDES $X11GL_CFLAGS"
267 GL_LIB_DEPS="$X11GL_LIBS"
268 else
269 # should check these...
270 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
271 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
272 fi
273 GL_LIB_DEPS="$GL_LIB_DEPS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800274
275 # if static, move the external libraries to the programs
276 # and empty the libraries for libGL
277 if test "$enable_static" = yes; then
278 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
279 GL_LIB_DEPS=""
280 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800281 ;;
282dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800283 # DRI must be shared, I think
284 if test "$enable_static" = yes; then
285 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
286 fi
287
Dan Nicholson44d99142007-12-05 18:47:01 -0800288 # Check for libdrm
289 PKG_CHECK_MODULES(LIBDRM, libdrm)
290
291 # find the DRI deps for libGL
292 if test "$x11_pkgconfig" = yes; then
293 PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
294 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
295 GL_LIB_DEPS="$DRIGL_LIBS"
296 else
297 # should check these...
298 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
299 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
300 fi
301
302 # need DRM libs, -lpthread, etc.
303 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread -ldl"
304 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800305osmesa)
306 # No libGL for osmesa
307 GL_LIB_DEPS=""
308 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800309esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700310AC_SUBST(GL_LIB_DEPS)
311
312dnl
313dnl More X11 setup
314dnl
315if test "$mesa_driver" = x11; then
316 DEFINES="$DEFINES -DUSE_XSHM"
317fi
318
319dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800320dnl More DRI setup
321dnl
322AC_ARG_ENABLE(glx-tls,
323 [AS_HELP_STRING([--enable-glx-tls],
324 [enable TLS support in GLX @<:@default=no@:>@])],
325 GLX_USE_TLS="$enableval",
326 GLX_USE_TLS=no)
327dnl Directory for DRI drivers
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800328AC_ARG_WITH(dri-driverdir,
329 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson44d99142007-12-05 18:47:01 -0800330 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
331 DRI_DRIVER_INSTALL_DIR="$withval",
332 DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
333AC_SUBST(DRI_DRIVER_INSTALL_DIR)
334dnl Direct rendering or just indirect rendering
335AC_ARG_ENABLE(driglx-direct,
336 [AS_HELP_STRING([--enable-driglx-direct],
337 [enable direct rendering in GLX for DRI @<:@default=yes@:>@])],
338 driglx_direct="$enableval",
339 driglx_direct="yes")
340
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800341dnl Which drivers to build - default is chosen by platform
342AC_ARG_WITH(dri-drivers,
343 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
344 [comma delimited DRI drivers to build @<:@default=auto by platform@:>@])],
345 with_dri_drivers="$withval",
346 with_dri_drivers=yes)
347if test "x$with_dri_drivers" = x; then
348 with_dri_drivers=no
349fi
350
351dnl If $with_dri_drivers is yes, directories will be added through
352dnl platform checks
353DRI_DIRS=""
354case "$with_dri_drivers" in
355no|yes) ;;
356*)
357 # verify the requested driver directories exist
358 dri_drivers=`IFS=,; echo $with_dri_drivers`
359 for driver in $dri_drivers; do
360 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
361 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
362 done
363 DRI_DIRS="$dri_drivers"
364 ;;
365esac
366
Dan Nicholson44d99142007-12-05 18:47:01 -0800367dnl Just default to no EGL for now
368USING_EGL=0
369AC_SUBST(USING_EGL)
370
371dnl Set DRI_DIRS, DEFINES and LIB_DEPS
372if test "$mesa_driver" = dri; then
373 # Use TLS in GLX?
374 if test "x$GLX_USE_TLS" = xyes; then
375 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
376 fi
377
378 if test "x$USING_EGL" = x1; then
379 PROGRAM_DIRS="egl"
380 fi
381
382 # Platform specific settings and drivers to build
383 case "$host_os" in
384 linux*)
385 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
386 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
387 if test "x$driglx_direct" = xyes; then
388 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
389 fi
390
391 case "$host_cpu" in
392 i*86)
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800393 if test "x$DRI_DIRS" = x; then
394 DRI_DIRS="i810 i915tex i915 i965 mach64 mga r128 r200 r300 \
395 radeon s3v savage sis tdfx trident unichrome ffb"
396 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800397 ;;
398 x86_64)
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800399 if test "x$DRI_DIRS" = x; then
400 DRI_DIRS="i915tex i915 i965 mach64 mga r128 r200 radeon tdfx \
401 unichrome savage r300"
402 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800403 ;;
404 powerpc*)
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800405 if test "x$DRI_DIRS" = x; then
406 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
407 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800408 ;;
409 esac
410 ;;
411 freebsd*)
412 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
413 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
414 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
415 if test "x$driglx_direct" = xyes; then
416 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
417 fi
418 if test "x$GXX" = xyes; then
419 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
420 fi
421
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800422 if test "x$DRI_DIRS" = x; then
423 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
424 unichrome savage sis"
425 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800426 ;;
427 esac
428 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
429
430 # Check for expat
431 EXPAT_INCLUDES=""
432 EXPAT_LIB=-lexpat
433 AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
434 [expat install directory]),[
435 EXPAT_INCLUDES="-I$withval/include"
436 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
437 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
438 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
439 ])
440 AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
441 AC_CHECK_LIB(expat, XML_ParserCreate,,
442 AC_MSG_ERROR([Expat required for DRI.]))
443
444 # put all the necessary libs together
445 DRI_LIB_DEPS="$LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl"
446fi
447AC_SUBST(DRI_DIRS)
448AC_SUBST(EXPAT_INCLUDES)
449AC_SUBST(DRI_LIB_DEPS)
450
451dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700452dnl OSMesa configuration
453dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800454if test "$mesa_driver" = x11; then
Dan Nicholson979ff512007-12-05 18:47:01 -0800455 default_x11_osmesa=yes
456else
457 default_x11_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800458fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800459AC_ARG_ENABLE(x11-osmesa,
460 [AS_HELP_STRING([--enable-x11-osmesa],
461 [enable OSMesa on X11 libGL @<:@default=yes for x11 driver@:>@])],
462 x11_osmesa="$enableval",
463 x11_osmesa="$default_x11_osmesa")
464if test "x$x11_osmesa" = xyes; then
465 if test "$mesa_driver" = x11; then
466 DRIVER_DIRS="$DRIVER_DIRS osmesa"
467 else
468 AC_MSG_ERROR([Can only enable OSMesa on libGL for X11])
469 fi
470fi
471
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800472dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
473AC_ARG_WITH(osmesa-bits,
474 [AS_HELP_STRING([--with-osmesa-bits=BITS],
475 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
476 osmesa_bits="$withval",
477 osmesa_bits=8)
478if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
479 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
480 osmesa_bits=8
481fi
482case "x$osmesa_bits" in
483x8)
484 OSMESA_LIB=OSMesa
485 ;;
486x16|x32)
487 OSMESA_LIB="OSMesa$osmesa_bits"
488 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
489 ;;
490*)
491 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
492 ;;
493esac
494AC_SUBST(OSMESA_LIB)
495
Dan Nicholson979ff512007-12-05 18:47:01 -0800496case "$mesa_driver" in
497osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800498 # only link librararies with osmesa if shared
499 if test "$enable_static" = no; then
500 OSMESA_LIB_DEPS="-lm -lpthread"
501 else
502 OSMESA_LIB_DEPS=""
503 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800504 OSMESA_MESA_DEPS=""
505 ;;
506*)
507 # Link OSMesa to libGL otherwise
508 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800509 # only link librararies with osmesa if shared
510 if test "$enable_static" = no; then
511 OSMESA_MESA_DEPS='-l$(GL_LIB)'
512 else
513 OSMESA_MESA_DEPS=""
514 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800515 ;;
516esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700517AC_SUBST(OSMESA_LIB_DEPS)
518AC_SUBST(OSMESA_MESA_DEPS)
519
520dnl
521dnl GLU configuration
522dnl
523AC_ARG_ENABLE(glu,
524 [AS_HELP_STRING([--enable-glu],
525 [enable OpenGL Utility library @<:@default=yes@:>@])],
526 enable_glu="$enableval",
527 enable_glu=yes)
528if test "x$enable_glu" = xyes; then
529 SRC_DIRS="$SRC_DIRS glu"
530
Dan Nicholson979ff512007-12-05 18:47:01 -0800531 case "$mesa_driver" in
532 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800533 # If GLU is available and we have libOSMesa (not 16 or 32),
534 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800535 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800536 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
537 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700538
Dan Nicholson979ff512007-12-05 18:47:01 -0800539 # Link libGLU to libOSMesa instead of libGL
540 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800541 if test "$enable_static" = no; then
542 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
543 else
544 GLU_MESA_DEPS=""
545 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800546 ;;
547 *)
548 # If GLU is available, we can build the xdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800549 if test "$with_demos" = yes; then
550 PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
551 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800552
Dan Nicholson88586332007-11-15 08:59:57 -0800553 # If static, empty GLU_LIB_DEPS and add libs for programs to link
554 if test "$enable_static" = no; then
555 GLU_LIB_DEPS="-lm"
556 GLU_MESA_DEPS='-l$(GL_LIB)'
557 else
558 GLU_LIB_DEPS=""
559 GLU_MESA_DEPS=""
560 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
561 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800562 ;;
563 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700564fi
565AC_SUBST(GLU_LIB_DEPS)
566AC_SUBST(GLU_MESA_DEPS)
567
568dnl
569dnl GLw configuration
570dnl
571AC_ARG_ENABLE(glw,
572 [AS_HELP_STRING([--enable-glw],
573 [enable Xt/Motif widget library @<:@default=yes@:>@])],
574 enable_glw="$enableval",
575 enable_glw=yes)
Dan Nicholson979ff512007-12-05 18:47:01 -0800576dnl Don't build GLw on osmesa
577if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
578 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
579 enable_glw=no
580fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700581if test "x$enable_glw" = xyes; then
582 SRC_DIRS="$SRC_DIRS glw"
583 if test "$x11_pkgconfig" = yes; then
584 PKG_CHECK_MODULES(GLW, x11 xt)
585 GLW_LIB_DEPS="$GLW_LIBS"
586 else
587 # should check these...
588 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
589 fi
590
Dan Nicholson88586332007-11-15 08:59:57 -0800591 # If static, empty GLW_LIB_DEPS and add libs for programs to link
592 if test "$enable_static" = no; then
593 GLW_MESA_DEPS='-l$(GL_LIB)'
594 else
595 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
596 GLW_LIB_DEPS=""
597 GLW_MESA_DEPS=""
598 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700599fi
600AC_SUBST(GLW_LIB_DEPS)
601AC_SUBST(GLW_MESA_DEPS)
602
603dnl
604dnl GLUT configuration
605dnl
606if test -f "$srcdir/include/GL/glut.h"; then
607 default_glut=yes
608else
609 default_glut=no
610fi
611AC_ARG_ENABLE(glut,
612 [AS_HELP_STRING([--enable-glut],
613 [enable GLUT library @<:@default=yes if source available@:>@])],
614 enable_glut="$enableval",
615 enable_glut="$default_glut")
616
617dnl Can't build glut if GLU not available
618if test "x$enable_glu$enable_glut" = xnoyes; then
619 AC_MSG_WARN([Disabling glut since GLU is disabled])
620 enable_glut=no
621fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800622dnl Don't build glut on osmesa
623if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
624 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
625 enable_glut=no
626fi
627
Dan Nicholsondca1b792007-10-23 09:25:58 -0700628if test "x$enable_glut" = xyes; then
629 SRC_DIRS="$SRC_DIRS glut/glx"
630 GLUT_CFLAGS=""
631 if test "x$GCC" = xyes; then
632 GLUT_CFLAGS="-fexceptions"
633 fi
634 if test "$x11_pkgconfig" = yes; then
635 PKG_CHECK_MODULES(GLUT, x11 xmu xt xi)
636 GLUT_LIB_DEPS="$GLUT_LIBS"
637 else
638 # should check these...
639 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXt -lXi"
640 fi
641 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
642
643 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800644 if test "$with_demos" = yes; then
645 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
646 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700647
Dan Nicholson88586332007-11-15 08:59:57 -0800648 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
649 if test "$enable_static" = no; then
650 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
651 else
652 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
653 GLUT_LIB_DEPS=""
654 GLUT_MESA_DEPS=""
655 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700656fi
657AC_SUBST(GLUT_LIB_DEPS)
658AC_SUBST(GLUT_MESA_DEPS)
659AC_SUBST(GLUT_CFLAGS)
660
661dnl
662dnl Program library dependencies
663dnl Only libm is added here if necessary as the libraries should
664dnl be pulled in by the linker
665dnl
666if test "x$APP_LIB_DEPS" = x; then
667 APP_LIB_DEPS="-lm"
668fi
669AC_SUBST(APP_LIB_DEPS)
670AC_SUBST(PROGRAM_DIRS)
671
672dnl Arch/platform-specific settings
673PIC_FLAGS=""
674ASM_FLAGS=""
675ASM_SOURCES=""
676ASM_API=""
677AC_SUBST(PIC_FLAGS)
678AC_SUBST(ASM_FLAGS)
679AC_SUBST(ASM_SOURCES)
680AC_SUBST(ASM_API)
681case "$host_os" in
682linux*)
683 PIC_FLAGS="-fPIC"
684 case "$host_cpu" in
685 i*86)
686 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
687 ASM_SOURCES='$(X86_SOURCES)'
688 ASM_API='$(X86_API)'
689 ;;
690 x86_64)
691 ASM_FLAGS="-DUSE_X86_64_ASM"
692 ASM_SOURCES='$(X86-64_SOURCES)'
693 ASM_API='$(X86-64_API)'
694 ;;
695 powerpc)
696 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
697 ASM_SOURCES='$(PPC_SOURCES)'
698 ;;
699 esac
700 ;;
701freebsd*)
702 PIC_FLAGS="-fPIC"
703 case "$host_os" in
704 i*86)
705 PIC_FLAGS=""
706 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
707 ASM_SOURCES='$(X86_SOURCES)'
708 ASM_API='$(X86_API)'
709 ;;
710 x86_64)
711 ASM_FLAGS="-DUSE_X86_64_ASM"
712 ASM_SOURCES='$(X86-64_SOURCES)'
713 ASM_API='$(X86-64_API)'
714 ;;
715 esac
716 ;;
717esac
718
719dnl Restore LDFLAGS and CPPFLAGS
720LDFLAGS="$_SAVE_LDFLAGS"
721CPPFLAGS="$_SAVE_CPPFLAGS"
722
723dnl Substitute the config
724AC_OUTPUT([configs/autoconf])
725
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800726dnl
727dnl Output some configuration info for the user
728dnl
729echo ""
730echo " prefix: $prefix"
731echo " exec_prefix: $exec_prefix"
732echo " libdir: $libdir"
733
734dnl Driver info
735echo ""
736echo " Driver: $mesa_driver"
737case "$mesa_driver" in
738x11|osmesa)
739 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
740 echo " OSMesa: lib$OSMESA_LIB"
741 else
742 echo " OSMesa: no"
743 fi
744 ;;
745dri)
746 # cleanup the drivers var
747 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
748 echo " DRI drivers: $dri_dirs"
749 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
750 ;;
751esac
752
753dnl Libraries
754echo ""
755echo " Shared libs: $enable_shared"
756echo " Static libs: $enable_static"
757echo " GLU: $enable_glu"
758echo " GLw: $enable_glw"
759echo " glut: $enable_glut"
760
761dnl Programs
762# cleanup the programs var for display
763program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
764if test "x$program_dirs" = x; then
765 echo " Demos: no"
766else
767 echo " Demos: $program_dirs"
768fi
769
Dan Nicholsondca1b792007-10-23 09:25:58 -0700770echo ""
771echo " Run 'make autoconf' to build Mesa"
772echo ""