blob: 4cd641b136be4ff40cfa2fae5c89fa9f56e32f9e [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],
Dan Nicholson79ad4582007-12-07 19:11:01 -080080 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -080081 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],
Dan Nicholson79ad4582007-12-07 19:11:01 -080093 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -080094 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 -0800174WINDOW_SYSTEM=""
175case "$mesa_driver" in
176x11)
177 DRIVER_DIRS="x11"
178 ;;
179dri)
180 SRC_DIRS="glx/x11 $SRC_DIRS"
181 DRIVER_DIRS="dri"
182 WINDOW_SYSTEM="dri"
183 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800184osmesa)
185 DRIVER_DIRS="osmesa"
186 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800187esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700188AC_SUBST(SRC_DIRS)
189AC_SUBST(GLU_DIRS)
190AC_SUBST(DRIVER_DIRS)
Dan Nicholson44d99142007-12-05 18:47:01 -0800191AC_SUBST(WINDOW_SYSTEM)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700192
193dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800194dnl User supplied program configuration
195dnl
196if test -d "$srcdir/progs/demos"; then
197 default_demos=yes
198else
199 default_demos=no
200fi
201AC_ARG_WITH(demos,
202 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
203 [optional comma delimited demo directories to build
204 @<:@default=yes if source available@:>@])],
205 with_demos="$withval",
206 with_demos="$default_demos")
207if test "x$with_demos" = x; then
208 with_demos=no
209fi
210
211dnl If $with_demos is yes, directories will be added as libs available
212PROGRAM_DIRS=""
213case "$with_demos" in
214no|yes) ;;
215*)
216 # verify the requested demos directories exist
217 demos=`IFS=,; echo $with_demos`
218 for demo in $demos; do
219 test -d "$srcdir/progs/$demo" || \
220 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
221 done
222 PROGRAM_DIRS="$demos"
223 ;;
224esac
225
226dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700227dnl Find out if X is available. The variables have_x or no_x will be
228dnl set and used later in the driver setups
229dnl
230if test -n "$PKG_CONFIG"; then
231 AC_MSG_CHECKING([pkg-config files for X11 are available])
232 if $PKG_CONFIG --exists x11; then
233 x11_pkgconfig=yes
234 have_x=yes
235 AC_MSG_RESULT(yes)
236 else
237 x11_pkgconfig=no
238 no_x=yes
239 AC_MSG_RESULT(no)
240 fi
241else
242 x11_pkgconfig=no
243fi
244dnl Use the autoconf macro if no pkg-config files
245if test "$x11_pkgconfig" = no; then
246 AC_PATH_XTRA
247fi
248
Dan Nicholson44d99142007-12-05 18:47:01 -0800249dnl We need X for xlib and dri, so bomb now if it's not found
250case "$mesa_driver" in
251x11|dri)
252 if test "$no_x" = yes; then
253 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
254 fi
255 ;;
256esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700257
Dan Nicholson44d99142007-12-05 18:47:01 -0800258dnl
259dnl libGL configuration per driver
260dnl
261case "$mesa_driver" in
262x11)
263 if test "$x11_pkgconfig" = yes; then
264 PKG_CHECK_MODULES(X11GL, x11 xext)
265 X11_INCLUDES="$X11_INCLUDES $X11GL_CFLAGS"
266 GL_LIB_DEPS="$X11GL_LIBS"
267 else
268 # should check these...
269 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
270 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
271 fi
272 GL_LIB_DEPS="$GL_LIB_DEPS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800273
274 # if static, move the external libraries to the programs
275 # and empty the libraries for libGL
276 if test "$enable_static" = yes; then
277 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
278 GL_LIB_DEPS=""
279 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800280 ;;
281dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800282 # DRI must be shared, I think
283 if test "$enable_static" = yes; then
284 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
285 fi
286
Dan Nicholson44d99142007-12-05 18:47:01 -0800287 # Check for libdrm
288 PKG_CHECK_MODULES(LIBDRM, libdrm)
289
290 # find the DRI deps for libGL
291 if test "$x11_pkgconfig" = yes; then
292 PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
293 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
294 GL_LIB_DEPS="$DRIGL_LIBS"
295 else
296 # should check these...
297 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
298 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
299 fi
300
301 # need DRM libs, -lpthread, etc.
302 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread -ldl"
303 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800304osmesa)
305 # No libGL for osmesa
306 GL_LIB_DEPS=""
307 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800308esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700309AC_SUBST(GL_LIB_DEPS)
310
311dnl
312dnl More X11 setup
313dnl
314if test "$mesa_driver" = x11; then
315 DEFINES="$DEFINES -DUSE_XSHM"
316fi
317
318dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800319dnl More DRI setup
320dnl
321AC_ARG_ENABLE(glx-tls,
322 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800323 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800324 GLX_USE_TLS="$enableval",
325 GLX_USE_TLS=no)
326dnl Directory for DRI drivers
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800327AC_ARG_WITH(dri-driverdir,
328 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson44d99142007-12-05 18:47:01 -0800329 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
330 DRI_DRIVER_INSTALL_DIR="$withval",
331 DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
332AC_SUBST(DRI_DRIVER_INSTALL_DIR)
333dnl Direct rendering or just indirect rendering
334AC_ARG_ENABLE(driglx-direct,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800335 [AS_HELP_STRING([--disable-driglx-direct],
336 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800337 driglx_direct="$enableval",
338 driglx_direct="yes")
339
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800340dnl Which drivers to build - default is chosen by platform
341AC_ARG_WITH(dri-drivers,
342 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
343 [comma delimited DRI drivers to build @<:@default=auto by platform@:>@])],
344 with_dri_drivers="$withval",
345 with_dri_drivers=yes)
346if test "x$with_dri_drivers" = x; then
347 with_dri_drivers=no
348fi
349
350dnl If $with_dri_drivers is yes, directories will be added through
351dnl platform checks
352DRI_DIRS=""
353case "$with_dri_drivers" in
354no|yes) ;;
355*)
356 # verify the requested driver directories exist
357 dri_drivers=`IFS=,; echo $with_dri_drivers`
358 for driver in $dri_drivers; do
359 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
360 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
361 done
362 DRI_DIRS="$dri_drivers"
363 ;;
364esac
365
Dan Nicholson44d99142007-12-05 18:47:01 -0800366dnl Just default to no EGL for now
367USING_EGL=0
368AC_SUBST(USING_EGL)
369
370dnl Set DRI_DIRS, DEFINES and LIB_DEPS
371if test "$mesa_driver" = dri; then
372 # Use TLS in GLX?
373 if test "x$GLX_USE_TLS" = xyes; then
374 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
375 fi
376
377 if test "x$USING_EGL" = x1; then
378 PROGRAM_DIRS="egl"
379 fi
380
Dan Nicholsona76e2452007-12-07 11:25:08 -0800381 # default drivers
382 if test "x$DRI_DIRS" = x; then
383 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
384 savage sis tdfx trident unichrome ffb"
385 fi
386
Dan Nicholson44d99142007-12-05 18:47:01 -0800387 # Platform specific settings and drivers to build
388 case "$host_os" in
389 linux*)
390 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
391 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
392 if test "x$driglx_direct" = xyes; then
393 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
394 fi
395
396 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800397 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800398 # ffb, gamma, and sis are missing because they have not be
399 # converted to use the new interface. i810 are missing
400 # because there is no x86-64 system where they could *ever*
401 # be used.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800402 if test "x$DRI_DIRS" = x; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800403 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
404 savage tdfx unichrome"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800405 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800406 ;;
407 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800408 # Build only the drivers for cards that exist on PowerPC.
409 # At some point MGA will be added, but not yet.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800410 if test "x$DRI_DIRS" = x; then
411 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
412 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800413 ;;
414 esac
415 ;;
416 freebsd*)
417 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
418 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
419 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
420 if test "x$driglx_direct" = xyes; then
421 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
422 fi
423 if test "x$GXX" = xyes; then
424 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
425 fi
426
Dan Nicholsona76e2452007-12-07 11:25:08 -0800427 # ffb and gamma are missing because they have not been converted
428 # to use the new interface.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800429 if test "x$DRI_DIRS" = x; then
430 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
431 unichrome savage sis"
432 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800433 ;;
434 esac
435 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
436
437 # Check for expat
438 EXPAT_INCLUDES=""
439 EXPAT_LIB=-lexpat
440 AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
441 [expat install directory]),[
442 EXPAT_INCLUDES="-I$withval/include"
443 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
444 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
445 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
446 ])
447 AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
448 AC_CHECK_LIB(expat, XML_ParserCreate,,
449 AC_MSG_ERROR([Expat required for DRI.]))
450
451 # put all the necessary libs together
452 DRI_LIB_DEPS="$LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl"
453fi
454AC_SUBST(DRI_DIRS)
455AC_SUBST(EXPAT_INCLUDES)
456AC_SUBST(DRI_LIB_DEPS)
457
458dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700459dnl OSMesa configuration
460dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800461if test "$mesa_driver" = x11; then
Dan Nicholson979ff512007-12-05 18:47:01 -0800462 default_x11_osmesa=yes
463else
464 default_x11_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800465fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800466AC_ARG_ENABLE(x11-osmesa,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800467 [AS_HELP_STRING([--disable-x11-osmesa],
468 [enable OSMesa on X11 libGL @<:@default=enabled for x11 driver@:>@])],
Dan Nicholson979ff512007-12-05 18:47:01 -0800469 x11_osmesa="$enableval",
470 x11_osmesa="$default_x11_osmesa")
471if test "x$x11_osmesa" = xyes; then
472 if test "$mesa_driver" = x11; then
473 DRIVER_DIRS="$DRIVER_DIRS osmesa"
474 else
475 AC_MSG_ERROR([Can only enable OSMesa on libGL for X11])
476 fi
477fi
478
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800479dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
480AC_ARG_WITH(osmesa-bits,
481 [AS_HELP_STRING([--with-osmesa-bits=BITS],
482 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
483 osmesa_bits="$withval",
484 osmesa_bits=8)
485if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
486 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
487 osmesa_bits=8
488fi
489case "x$osmesa_bits" in
490x8)
491 OSMESA_LIB=OSMesa
492 ;;
493x16|x32)
494 OSMESA_LIB="OSMesa$osmesa_bits"
495 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
496 ;;
497*)
498 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
499 ;;
500esac
501AC_SUBST(OSMESA_LIB)
502
Dan Nicholson979ff512007-12-05 18:47:01 -0800503case "$mesa_driver" in
504osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800505 # only link librararies with osmesa if shared
506 if test "$enable_static" = no; then
507 OSMESA_LIB_DEPS="-lm -lpthread"
508 else
509 OSMESA_LIB_DEPS=""
510 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800511 OSMESA_MESA_DEPS=""
512 ;;
513*)
514 # Link OSMesa to libGL otherwise
515 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800516 # only link librararies with osmesa if shared
517 if test "$enable_static" = no; then
518 OSMESA_MESA_DEPS='-l$(GL_LIB)'
519 else
520 OSMESA_MESA_DEPS=""
521 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800522 ;;
523esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700524AC_SUBST(OSMESA_LIB_DEPS)
525AC_SUBST(OSMESA_MESA_DEPS)
526
527dnl
528dnl GLU configuration
529dnl
530AC_ARG_ENABLE(glu,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800531 [AS_HELP_STRING([--disable-glu],
532 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700533 enable_glu="$enableval",
534 enable_glu=yes)
535if test "x$enable_glu" = xyes; then
536 SRC_DIRS="$SRC_DIRS glu"
537
Dan Nicholson979ff512007-12-05 18:47:01 -0800538 case "$mesa_driver" in
539 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800540 # If GLU is available and we have libOSMesa (not 16 or 32),
541 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800542 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800543 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
544 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700545
Dan Nicholson979ff512007-12-05 18:47:01 -0800546 # Link libGLU to libOSMesa instead of libGL
547 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800548 if test "$enable_static" = no; then
549 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
550 else
551 GLU_MESA_DEPS=""
552 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800553 ;;
554 *)
555 # If GLU is available, we can build the xdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800556 if test "$with_demos" = yes; then
557 PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
558 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800559
Dan Nicholson88586332007-11-15 08:59:57 -0800560 # If static, empty GLU_LIB_DEPS and add libs for programs to link
561 if test "$enable_static" = no; then
562 GLU_LIB_DEPS="-lm"
563 GLU_MESA_DEPS='-l$(GL_LIB)'
564 else
565 GLU_LIB_DEPS=""
566 GLU_MESA_DEPS=""
567 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
568 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800569 ;;
570 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700571fi
572AC_SUBST(GLU_LIB_DEPS)
573AC_SUBST(GLU_MESA_DEPS)
574
575dnl
576dnl GLw configuration
577dnl
578AC_ARG_ENABLE(glw,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800579 [AS_HELP_STRING([--disable-glw],
580 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700581 enable_glw="$enableval",
582 enable_glw=yes)
Dan Nicholson979ff512007-12-05 18:47:01 -0800583dnl Don't build GLw on osmesa
584if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
585 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
586 enable_glw=no
587fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700588if test "x$enable_glw" = xyes; then
589 SRC_DIRS="$SRC_DIRS glw"
590 if test "$x11_pkgconfig" = yes; then
591 PKG_CHECK_MODULES(GLW, x11 xt)
592 GLW_LIB_DEPS="$GLW_LIBS"
593 else
594 # should check these...
595 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
596 fi
597
Dan Nicholson88586332007-11-15 08:59:57 -0800598 # If static, empty GLW_LIB_DEPS and add libs for programs to link
599 if test "$enable_static" = no; then
600 GLW_MESA_DEPS='-l$(GL_LIB)'
601 else
602 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
603 GLW_LIB_DEPS=""
604 GLW_MESA_DEPS=""
605 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700606fi
607AC_SUBST(GLW_LIB_DEPS)
608AC_SUBST(GLW_MESA_DEPS)
609
610dnl
611dnl GLUT configuration
612dnl
613if test -f "$srcdir/include/GL/glut.h"; then
614 default_glut=yes
615else
616 default_glut=no
617fi
618AC_ARG_ENABLE(glut,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800619 [AS_HELP_STRING([--disable-glut],
620 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700621 enable_glut="$enableval",
622 enable_glut="$default_glut")
623
624dnl Can't build glut if GLU not available
625if test "x$enable_glu$enable_glut" = xnoyes; then
626 AC_MSG_WARN([Disabling glut since GLU is disabled])
627 enable_glut=no
628fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800629dnl Don't build glut on osmesa
630if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
631 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
632 enable_glut=no
633fi
634
Dan Nicholsondca1b792007-10-23 09:25:58 -0700635if test "x$enable_glut" = xyes; then
636 SRC_DIRS="$SRC_DIRS glut/glx"
637 GLUT_CFLAGS=""
638 if test "x$GCC" = xyes; then
639 GLUT_CFLAGS="-fexceptions"
640 fi
641 if test "$x11_pkgconfig" = yes; then
Dan Nicholson70d0c832007-12-07 11:12:20 -0800642 PKG_CHECK_MODULES(GLUT, x11 xmu xi)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700643 GLUT_LIB_DEPS="$GLUT_LIBS"
644 else
645 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -0800646 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700647 fi
648 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
649
650 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800651 if test "$with_demos" = yes; then
652 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
653 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700654
Dan Nicholson88586332007-11-15 08:59:57 -0800655 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
656 if test "$enable_static" = no; then
657 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
658 else
659 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
660 GLUT_LIB_DEPS=""
661 GLUT_MESA_DEPS=""
662 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700663fi
664AC_SUBST(GLUT_LIB_DEPS)
665AC_SUBST(GLUT_MESA_DEPS)
666AC_SUBST(GLUT_CFLAGS)
667
668dnl
669dnl Program library dependencies
670dnl Only libm is added here if necessary as the libraries should
671dnl be pulled in by the linker
672dnl
673if test "x$APP_LIB_DEPS" = x; then
674 APP_LIB_DEPS="-lm"
675fi
676AC_SUBST(APP_LIB_DEPS)
677AC_SUBST(PROGRAM_DIRS)
678
679dnl Arch/platform-specific settings
680PIC_FLAGS=""
681ASM_FLAGS=""
682ASM_SOURCES=""
683ASM_API=""
684AC_SUBST(PIC_FLAGS)
685AC_SUBST(ASM_FLAGS)
686AC_SUBST(ASM_SOURCES)
687AC_SUBST(ASM_API)
688case "$host_os" in
689linux*)
690 PIC_FLAGS="-fPIC"
691 case "$host_cpu" in
692 i*86)
693 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
694 ASM_SOURCES='$(X86_SOURCES)'
695 ASM_API='$(X86_API)'
696 ;;
697 x86_64)
698 ASM_FLAGS="-DUSE_X86_64_ASM"
699 ASM_SOURCES='$(X86-64_SOURCES)'
700 ASM_API='$(X86-64_API)'
701 ;;
702 powerpc)
703 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
704 ASM_SOURCES='$(PPC_SOURCES)'
705 ;;
706 esac
707 ;;
708freebsd*)
709 PIC_FLAGS="-fPIC"
710 case "$host_os" in
711 i*86)
712 PIC_FLAGS=""
713 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
714 ASM_SOURCES='$(X86_SOURCES)'
715 ASM_API='$(X86_API)'
716 ;;
717 x86_64)
718 ASM_FLAGS="-DUSE_X86_64_ASM"
719 ASM_SOURCES='$(X86-64_SOURCES)'
720 ASM_API='$(X86-64_API)'
721 ;;
722 esac
723 ;;
724esac
725
726dnl Restore LDFLAGS and CPPFLAGS
727LDFLAGS="$_SAVE_LDFLAGS"
728CPPFLAGS="$_SAVE_CPPFLAGS"
729
730dnl Substitute the config
731AC_OUTPUT([configs/autoconf])
732
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800733dnl Replace the configs/current symlink
734if test -f configs/current || test -L configs/current; then
735 rm -f configs/current
736fi
737ln -s autoconf configs/current
738
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800739dnl
740dnl Output some configuration info for the user
741dnl
742echo ""
743echo " prefix: $prefix"
744echo " exec_prefix: $exec_prefix"
745echo " libdir: $libdir"
746
747dnl Driver info
748echo ""
749echo " Driver: $mesa_driver"
750case "$mesa_driver" in
751x11|osmesa)
752 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
753 echo " OSMesa: lib$OSMESA_LIB"
754 else
755 echo " OSMesa: no"
756 fi
757 ;;
758dri)
759 # cleanup the drivers var
760 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
761 echo " DRI drivers: $dri_dirs"
762 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
763 ;;
764esac
765
766dnl Libraries
767echo ""
768echo " Shared libs: $enable_shared"
769echo " Static libs: $enable_static"
770echo " GLU: $enable_glu"
771echo " GLw: $enable_glw"
772echo " glut: $enable_glut"
773
774dnl Programs
775# cleanup the programs var for display
776program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
777if test "x$program_dirs" = x; then
778 echo " Demos: no"
779else
780 echo " Demos: $program_dirs"
781fi
782
Dan Nicholsondca1b792007-10-23 09:25:58 -0700783echo ""
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800784echo " Run 'make' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700785echo ""