blob: 40c39b9912209b7a6f52cfec5aa646514b9228d8 [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
134
135dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700136dnl library names
137dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800138if test "$enable_static" = yes; then
139 GL_LIB_NAME='lib$(GL_LIB).a'
140 GLU_LIB_NAME='lib$(GLU_LIB).a'
141 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
142 GLW_LIB_NAME='lib$(GLW_LIB).a'
143 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
144else
145 GL_LIB_NAME='lib$(GL_LIB).so'
146 GLU_LIB_NAME='lib$(GLU_LIB).so'
147 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
148 GLW_LIB_NAME='lib$(GLW_LIB).so'
149 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
150fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700151AC_SUBST(GL_LIB_NAME)
152AC_SUBST(GLU_LIB_NAME)
153AC_SUBST(GLUT_LIB_NAME)
154AC_SUBST(GLW_LIB_NAME)
155AC_SUBST(OSMESA_LIB_NAME)
156
157dnl
Dan Nicholson979ff512007-12-05 18:47:01 -0800158dnl Driver configuration. Options are x11 (Xlib), dri and osmesa right now.
159dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800160dnl
161AC_ARG_WITH(driver,
162 [AS_HELP_STRING([--with-driver=DRIVER],
Dan Nicholson979ff512007-12-05 18:47:01 -0800163 [driver for Mesa: x11,dri,osmesa @<:@default=x11@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800164 mesa_driver="$withval",
165 mesa_driver="x11")
166dnl Check for valid option
167case "x$mesa_driver" in
Dan Nicholson979ff512007-12-05 18:47:01 -0800168xx11|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800169 ;;
170*)
171 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
172 ;;
173esac
174
175dnl
176dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700177dnl
178SRC_DIRS="mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700179GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800180WINDOW_SYSTEM=""
181case "$mesa_driver" in
182x11)
183 DRIVER_DIRS="x11"
184 ;;
185dri)
186 SRC_DIRS="glx/x11 $SRC_DIRS"
187 DRIVER_DIRS="dri"
188 WINDOW_SYSTEM="dri"
189 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800190osmesa)
191 DRIVER_DIRS="osmesa"
192 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800193esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700194AC_SUBST(SRC_DIRS)
195AC_SUBST(GLU_DIRS)
196AC_SUBST(DRIVER_DIRS)
Dan Nicholson44d99142007-12-05 18:47:01 -0800197AC_SUBST(WINDOW_SYSTEM)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700198
199dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800200dnl User supplied program configuration
201dnl
202if test -d "$srcdir/progs/demos"; then
203 default_demos=yes
204else
205 default_demos=no
206fi
207AC_ARG_WITH(demos,
208 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
209 [optional comma delimited demo directories to build
210 @<:@default=yes if source available@:>@])],
211 with_demos="$withval",
212 with_demos="$default_demos")
213if test "x$with_demos" = x; then
214 with_demos=no
215fi
216
217dnl If $with_demos is yes, directories will be added as libs available
218PROGRAM_DIRS=""
219case "$with_demos" in
220no|yes) ;;
221*)
222 # verify the requested demos directories exist
223 demos=`IFS=,; echo $with_demos`
224 for demo in $demos; do
225 test -d "$srcdir/progs/$demo" || \
226 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
227 done
228 PROGRAM_DIRS="$demos"
229 ;;
230esac
231
232dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700233dnl Find out if X is available. The variables have_x or no_x will be
234dnl set and used later in the driver setups
235dnl
236if test -n "$PKG_CONFIG"; then
237 AC_MSG_CHECKING([pkg-config files for X11 are available])
238 if $PKG_CONFIG --exists x11; then
239 x11_pkgconfig=yes
240 have_x=yes
241 AC_MSG_RESULT(yes)
242 else
243 x11_pkgconfig=no
244 no_x=yes
245 AC_MSG_RESULT(no)
246 fi
247else
248 x11_pkgconfig=no
249fi
250dnl Use the autoconf macro if no pkg-config files
251if test "$x11_pkgconfig" = no; then
252 AC_PATH_XTRA
253fi
254
Dan Nicholson44d99142007-12-05 18:47:01 -0800255dnl We need X for xlib and dri, so bomb now if it's not found
256case "$mesa_driver" in
257x11|dri)
258 if test "$no_x" = yes; then
259 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
260 fi
261 ;;
262esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700263
Dan Nicholson44d99142007-12-05 18:47:01 -0800264dnl
265dnl libGL configuration per driver
266dnl
267case "$mesa_driver" in
268x11)
269 if test "$x11_pkgconfig" = yes; then
270 PKG_CHECK_MODULES(X11GL, x11 xext)
271 X11_INCLUDES="$X11_INCLUDES $X11GL_CFLAGS"
272 GL_LIB_DEPS="$X11GL_LIBS"
273 else
274 # should check these...
275 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
276 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
277 fi
278 GL_LIB_DEPS="$GL_LIB_DEPS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800279
280 # if static, move the external libraries to the programs
281 # and empty the libraries for libGL
282 if test "$enable_static" = yes; then
283 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
284 GL_LIB_DEPS=""
285 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800286 ;;
287dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800288 # DRI must be shared, I think
289 if test "$enable_static" = yes; then
290 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
291 fi
292
Dan Nicholson44d99142007-12-05 18:47:01 -0800293 # Check for libdrm
294 PKG_CHECK_MODULES(LIBDRM, libdrm)
295
296 # find the DRI deps for libGL
297 if test "$x11_pkgconfig" = yes; then
298 PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
299 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
300 GL_LIB_DEPS="$DRIGL_LIBS"
301 else
302 # should check these...
303 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
304 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
305 fi
306
307 # need DRM libs, -lpthread, etc.
308 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread -ldl"
309 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800310osmesa)
311 # No libGL for osmesa
312 GL_LIB_DEPS=""
313 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800314esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700315AC_SUBST(GL_LIB_DEPS)
316
317dnl
318dnl More X11 setup
319dnl
320if test "$mesa_driver" = x11; then
321 DEFINES="$DEFINES -DUSE_XSHM"
322fi
323
324dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800325dnl More DRI setup
326dnl
327AC_ARG_ENABLE(glx-tls,
328 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800329 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800330 GLX_USE_TLS="$enableval",
331 GLX_USE_TLS=no)
332dnl Directory for DRI drivers
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800333AC_ARG_WITH(dri-driverdir,
334 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson44d99142007-12-05 18:47:01 -0800335 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
336 DRI_DRIVER_INSTALL_DIR="$withval",
337 DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
338AC_SUBST(DRI_DRIVER_INSTALL_DIR)
339dnl Direct rendering or just indirect rendering
340AC_ARG_ENABLE(driglx-direct,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800341 [AS_HELP_STRING([--disable-driglx-direct],
342 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800343 driglx_direct="$enableval",
344 driglx_direct="yes")
345
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800346dnl Which drivers to build - default is chosen by platform
347AC_ARG_WITH(dri-drivers,
348 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
349 [comma delimited DRI drivers to build @<:@default=auto by platform@:>@])],
350 with_dri_drivers="$withval",
351 with_dri_drivers=yes)
352if test "x$with_dri_drivers" = x; then
353 with_dri_drivers=no
354fi
355
356dnl If $with_dri_drivers is yes, directories will be added through
357dnl platform checks
358DRI_DIRS=""
359case "$with_dri_drivers" in
360no|yes) ;;
361*)
362 # verify the requested driver directories exist
363 dri_drivers=`IFS=,; echo $with_dri_drivers`
364 for driver in $dri_drivers; do
365 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
366 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
367 done
368 DRI_DIRS="$dri_drivers"
369 ;;
370esac
371
Dan Nicholson44d99142007-12-05 18:47:01 -0800372dnl Just default to no EGL for now
373USING_EGL=0
374AC_SUBST(USING_EGL)
375
376dnl Set DRI_DIRS, DEFINES and LIB_DEPS
377if test "$mesa_driver" = dri; then
378 # Use TLS in GLX?
379 if test "x$GLX_USE_TLS" = xyes; then
380 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
381 fi
382
383 if test "x$USING_EGL" = x1; then
384 PROGRAM_DIRS="egl"
385 fi
386
Dan Nicholsona76e2452007-12-07 11:25:08 -0800387 # default drivers
388 if test "x$DRI_DIRS" = x; then
389 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
390 savage sis tdfx trident unichrome ffb"
391 fi
392
Dan Nicholson44d99142007-12-05 18:47:01 -0800393 # Platform specific settings and drivers to build
394 case "$host_os" in
395 linux*)
396 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
397 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
398 if test "x$driglx_direct" = xyes; then
399 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
400 fi
401
402 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800403 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800404 # ffb, gamma, and sis are missing because they have not be
405 # converted to use the new interface. i810 are missing
406 # because there is no x86-64 system where they could *ever*
407 # be used.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800408 if test "x$DRI_DIRS" = x; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800409 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
410 savage tdfx unichrome"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800411 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800412 ;;
413 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800414 # Build only the drivers for cards that exist on PowerPC.
415 # At some point MGA will be added, but not yet.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800416 if test "x$DRI_DIRS" = x; then
417 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
418 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800419 ;;
420 esac
421 ;;
422 freebsd*)
423 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
424 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
425 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
426 if test "x$driglx_direct" = xyes; then
427 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
428 fi
429 if test "x$GXX" = xyes; then
430 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
431 fi
432
Dan Nicholsona76e2452007-12-07 11:25:08 -0800433 # ffb and gamma are missing because they have not been converted
434 # to use the new interface.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800435 if test "x$DRI_DIRS" = x; then
436 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
437 unichrome savage sis"
438 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800439 ;;
440 esac
441 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
442
443 # Check for expat
444 EXPAT_INCLUDES=""
445 EXPAT_LIB=-lexpat
446 AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
447 [expat install directory]),[
448 EXPAT_INCLUDES="-I$withval/include"
449 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
450 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
451 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
452 ])
453 AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
454 AC_CHECK_LIB(expat, XML_ParserCreate,,
455 AC_MSG_ERROR([Expat required for DRI.]))
456
457 # put all the necessary libs together
458 DRI_LIB_DEPS="$LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl"
459fi
460AC_SUBST(DRI_DIRS)
461AC_SUBST(EXPAT_INCLUDES)
462AC_SUBST(DRI_LIB_DEPS)
463
464dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700465dnl OSMesa configuration
466dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800467if test "$mesa_driver" = x11; then
Dan Nicholson979ff512007-12-05 18:47:01 -0800468 default_x11_osmesa=yes
469else
470 default_x11_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800471fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800472AC_ARG_ENABLE(x11-osmesa,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800473 [AS_HELP_STRING([--disable-x11-osmesa],
474 [enable OSMesa on X11 libGL @<:@default=enabled for x11 driver@:>@])],
Dan Nicholson979ff512007-12-05 18:47:01 -0800475 x11_osmesa="$enableval",
476 x11_osmesa="$default_x11_osmesa")
477if test "x$x11_osmesa" = xyes; then
478 if test "$mesa_driver" = x11; then
479 DRIVER_DIRS="$DRIVER_DIRS osmesa"
480 else
481 AC_MSG_ERROR([Can only enable OSMesa on libGL for X11])
482 fi
483fi
484
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800485dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
486AC_ARG_WITH(osmesa-bits,
487 [AS_HELP_STRING([--with-osmesa-bits=BITS],
488 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
489 osmesa_bits="$withval",
490 osmesa_bits=8)
491if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
492 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
493 osmesa_bits=8
494fi
495case "x$osmesa_bits" in
496x8)
497 OSMESA_LIB=OSMesa
498 ;;
499x16|x32)
500 OSMESA_LIB="OSMesa$osmesa_bits"
501 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
502 ;;
503*)
504 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
505 ;;
506esac
507AC_SUBST(OSMESA_LIB)
508
Dan Nicholson979ff512007-12-05 18:47:01 -0800509case "$mesa_driver" in
510osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800511 # only link librararies with osmesa if shared
512 if test "$enable_static" = no; then
513 OSMESA_LIB_DEPS="-lm -lpthread"
514 else
515 OSMESA_LIB_DEPS=""
516 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800517 OSMESA_MESA_DEPS=""
518 ;;
519*)
520 # Link OSMesa to libGL otherwise
521 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800522 # only link librararies with osmesa if shared
523 if test "$enable_static" = no; then
524 OSMESA_MESA_DEPS='-l$(GL_LIB)'
525 else
526 OSMESA_MESA_DEPS=""
527 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800528 ;;
529esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700530AC_SUBST(OSMESA_LIB_DEPS)
531AC_SUBST(OSMESA_MESA_DEPS)
532
533dnl
534dnl GLU configuration
535dnl
536AC_ARG_ENABLE(glu,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800537 [AS_HELP_STRING([--disable-glu],
538 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700539 enable_glu="$enableval",
540 enable_glu=yes)
541if test "x$enable_glu" = xyes; then
542 SRC_DIRS="$SRC_DIRS glu"
543
Dan Nicholson979ff512007-12-05 18:47:01 -0800544 case "$mesa_driver" in
545 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800546 # If GLU is available and we have libOSMesa (not 16 or 32),
547 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800548 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800549 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
550 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700551
Dan Nicholson979ff512007-12-05 18:47:01 -0800552 # Link libGLU to libOSMesa instead of libGL
553 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800554 if test "$enable_static" = no; then
555 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
556 else
557 GLU_MESA_DEPS=""
558 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800559 ;;
560 *)
561 # If GLU is available, we can build the xdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800562 if test "$with_demos" = yes; then
563 PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
564 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800565
Dan Nicholson88586332007-11-15 08:59:57 -0800566 # If static, empty GLU_LIB_DEPS and add libs for programs to link
567 if test "$enable_static" = no; then
568 GLU_LIB_DEPS="-lm"
569 GLU_MESA_DEPS='-l$(GL_LIB)'
570 else
571 GLU_LIB_DEPS=""
572 GLU_MESA_DEPS=""
573 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
574 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800575 ;;
576 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700577fi
578AC_SUBST(GLU_LIB_DEPS)
579AC_SUBST(GLU_MESA_DEPS)
580
581dnl
582dnl GLw configuration
583dnl
584AC_ARG_ENABLE(glw,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800585 [AS_HELP_STRING([--disable-glw],
586 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700587 enable_glw="$enableval",
588 enable_glw=yes)
Dan Nicholson979ff512007-12-05 18:47:01 -0800589dnl Don't build GLw on osmesa
590if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
591 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
592 enable_glw=no
593fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700594if test "x$enable_glw" = xyes; then
595 SRC_DIRS="$SRC_DIRS glw"
596 if test "$x11_pkgconfig" = yes; then
597 PKG_CHECK_MODULES(GLW, x11 xt)
598 GLW_LIB_DEPS="$GLW_LIBS"
599 else
600 # should check these...
601 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
602 fi
603
Dan Nicholson88586332007-11-15 08:59:57 -0800604 # If static, empty GLW_LIB_DEPS and add libs for programs to link
605 if test "$enable_static" = no; then
606 GLW_MESA_DEPS='-l$(GL_LIB)'
607 else
608 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
609 GLW_LIB_DEPS=""
610 GLW_MESA_DEPS=""
611 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700612fi
613AC_SUBST(GLW_LIB_DEPS)
614AC_SUBST(GLW_MESA_DEPS)
615
616dnl
617dnl GLUT configuration
618dnl
619if test -f "$srcdir/include/GL/glut.h"; then
620 default_glut=yes
621else
622 default_glut=no
623fi
624AC_ARG_ENABLE(glut,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800625 [AS_HELP_STRING([--disable-glut],
626 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700627 enable_glut="$enableval",
628 enable_glut="$default_glut")
629
630dnl Can't build glut if GLU not available
631if test "x$enable_glu$enable_glut" = xnoyes; then
632 AC_MSG_WARN([Disabling glut since GLU is disabled])
633 enable_glut=no
634fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800635dnl Don't build glut on osmesa
636if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
637 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
638 enable_glut=no
639fi
640
Dan Nicholsondca1b792007-10-23 09:25:58 -0700641if test "x$enable_glut" = xyes; then
642 SRC_DIRS="$SRC_DIRS glut/glx"
643 GLUT_CFLAGS=""
644 if test "x$GCC" = xyes; then
645 GLUT_CFLAGS="-fexceptions"
646 fi
647 if test "$x11_pkgconfig" = yes; then
Dan Nicholson70d0c832007-12-07 11:12:20 -0800648 PKG_CHECK_MODULES(GLUT, x11 xmu xi)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700649 GLUT_LIB_DEPS="$GLUT_LIBS"
650 else
651 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -0800652 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700653 fi
654 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
655
656 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800657 if test "$with_demos" = yes; then
658 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
659 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700660
Dan Nicholson88586332007-11-15 08:59:57 -0800661 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
662 if test "$enable_static" = no; then
663 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
664 else
665 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
666 GLUT_LIB_DEPS=""
667 GLUT_MESA_DEPS=""
668 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700669fi
670AC_SUBST(GLUT_LIB_DEPS)
671AC_SUBST(GLUT_MESA_DEPS)
672AC_SUBST(GLUT_CFLAGS)
673
674dnl
675dnl Program library dependencies
676dnl Only libm is added here if necessary as the libraries should
677dnl be pulled in by the linker
678dnl
679if test "x$APP_LIB_DEPS" = x; then
680 APP_LIB_DEPS="-lm"
681fi
682AC_SUBST(APP_LIB_DEPS)
683AC_SUBST(PROGRAM_DIRS)
684
685dnl Arch/platform-specific settings
686PIC_FLAGS=""
687ASM_FLAGS=""
688ASM_SOURCES=""
689ASM_API=""
690AC_SUBST(PIC_FLAGS)
691AC_SUBST(ASM_FLAGS)
692AC_SUBST(ASM_SOURCES)
693AC_SUBST(ASM_API)
694case "$host_os" in
695linux*)
696 PIC_FLAGS="-fPIC"
697 case "$host_cpu" in
698 i*86)
699 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
700 ASM_SOURCES='$(X86_SOURCES)'
701 ASM_API='$(X86_API)'
702 ;;
703 x86_64)
704 ASM_FLAGS="-DUSE_X86_64_ASM"
705 ASM_SOURCES='$(X86-64_SOURCES)'
706 ASM_API='$(X86-64_API)'
707 ;;
708 powerpc)
709 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
710 ASM_SOURCES='$(PPC_SOURCES)'
711 ;;
712 esac
713 ;;
714freebsd*)
715 PIC_FLAGS="-fPIC"
716 case "$host_os" in
717 i*86)
718 PIC_FLAGS=""
719 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
720 ASM_SOURCES='$(X86_SOURCES)'
721 ASM_API='$(X86_API)'
722 ;;
723 x86_64)
724 ASM_FLAGS="-DUSE_X86_64_ASM"
725 ASM_SOURCES='$(X86-64_SOURCES)'
726 ASM_API='$(X86-64_API)'
727 ;;
728 esac
729 ;;
730esac
731
732dnl Restore LDFLAGS and CPPFLAGS
733LDFLAGS="$_SAVE_LDFLAGS"
734CPPFLAGS="$_SAVE_CPPFLAGS"
735
736dnl Substitute the config
737AC_OUTPUT([configs/autoconf])
738
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800739dnl Replace the configs/current symlink
740if test -f configs/current || test -L configs/current; then
741 rm -f configs/current
742fi
743ln -s autoconf configs/current
744
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800745dnl
746dnl Output some configuration info for the user
747dnl
748echo ""
749echo " prefix: $prefix"
750echo " exec_prefix: $exec_prefix"
751echo " libdir: $libdir"
752
753dnl Driver info
754echo ""
755echo " Driver: $mesa_driver"
756case "$mesa_driver" in
757x11|osmesa)
758 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
759 echo " OSMesa: lib$OSMESA_LIB"
760 else
761 echo " OSMesa: no"
762 fi
763 ;;
764dri)
765 # cleanup the drivers var
766 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
767 echo " DRI drivers: $dri_dirs"
768 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
769 ;;
770esac
771
772dnl Libraries
773echo ""
774echo " Shared libs: $enable_shared"
775echo " Static libs: $enable_static"
776echo " GLU: $enable_glu"
777echo " GLw: $enable_glw"
778echo " glut: $enable_glut"
779
780dnl Programs
781# cleanup the programs var for display
782program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
783if test "x$program_dirs" = x; then
784 echo " Demos: no"
785else
786 echo " Demos: $program_dirs"
787fi
788
Dan Nicholsondca1b792007-10-23 09:25:58 -0700789echo ""
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800790echo " Run 'make' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700791echo ""