blob: 814fb2e364fb4b216f20189c9fbc7b067a2449f5 [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
328AC_ARG_WITH(dridriverdir,
329 [AS_HELP_STRING([--with-dridriverdir=DIR],
330 [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
341dnl Just default to no EGL for now
342USING_EGL=0
343AC_SUBST(USING_EGL)
344
345dnl Set DRI_DIRS, DEFINES and LIB_DEPS
346if test "$mesa_driver" = dri; then
347 # Use TLS in GLX?
348 if test "x$GLX_USE_TLS" = xyes; then
349 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
350 fi
351
352 if test "x$USING_EGL" = x1; then
353 PROGRAM_DIRS="egl"
354 fi
355
356 # Platform specific settings and drivers to build
357 case "$host_os" in
358 linux*)
359 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
360 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
361 if test "x$driglx_direct" = xyes; then
362 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
363 fi
364
365 case "$host_cpu" in
366 i*86)
367 DRI_DIRS="i810 i915tex i915 i965 mach64 mga r128 r200 r300 \
368 radeon s3v savage sis tdfx trident unichrome ffb"
369 ;;
370 x86_64)
371 DRI_DIRS="i915tex i915 i965 mach64 mga r128 r200 radeon tdfx \
372 unichrome savage r300"
373 ;;
374 powerpc*)
375 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
376 ;;
377 esac
378 ;;
379 freebsd*)
380 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
381 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
382 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
383 if test "x$driglx_direct" = xyes; then
384 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
385 fi
386 if test "x$GXX" = xyes; then
387 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
388 fi
389
390 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
391 unichrome savage sis"
392 ;;
393 esac
394 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
395
396 # Check for expat
397 EXPAT_INCLUDES=""
398 EXPAT_LIB=-lexpat
399 AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
400 [expat install directory]),[
401 EXPAT_INCLUDES="-I$withval/include"
402 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
403 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
404 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
405 ])
406 AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
407 AC_CHECK_LIB(expat, XML_ParserCreate,,
408 AC_MSG_ERROR([Expat required for DRI.]))
409
410 # put all the necessary libs together
411 DRI_LIB_DEPS="$LIBDRM_LIBS $EXPAT_LIB -lm -lpthread -ldl"
412fi
413AC_SUBST(DRI_DIRS)
414AC_SUBST(EXPAT_INCLUDES)
415AC_SUBST(DRI_LIB_DEPS)
416
417dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700418dnl OSMesa configuration
419dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800420if test "$mesa_driver" = x11; then
Dan Nicholson979ff512007-12-05 18:47:01 -0800421 default_x11_osmesa=yes
422else
423 default_x11_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800424fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800425AC_ARG_ENABLE(x11-osmesa,
426 [AS_HELP_STRING([--enable-x11-osmesa],
427 [enable OSMesa on X11 libGL @<:@default=yes for x11 driver@:>@])],
428 x11_osmesa="$enableval",
429 x11_osmesa="$default_x11_osmesa")
430if test "x$x11_osmesa" = xyes; then
431 if test "$mesa_driver" = x11; then
432 DRIVER_DIRS="$DRIVER_DIRS osmesa"
433 else
434 AC_MSG_ERROR([Can only enable OSMesa on libGL for X11])
435 fi
436fi
437
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800438dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
439AC_ARG_WITH(osmesa-bits,
440 [AS_HELP_STRING([--with-osmesa-bits=BITS],
441 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
442 osmesa_bits="$withval",
443 osmesa_bits=8)
444if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
445 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
446 osmesa_bits=8
447fi
448case "x$osmesa_bits" in
449x8)
450 OSMESA_LIB=OSMesa
451 ;;
452x16|x32)
453 OSMESA_LIB="OSMesa$osmesa_bits"
454 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
455 ;;
456*)
457 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
458 ;;
459esac
460AC_SUBST(OSMESA_LIB)
461
Dan Nicholson979ff512007-12-05 18:47:01 -0800462case "$mesa_driver" in
463osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800464 # only link librararies with osmesa if shared
465 if test "$enable_static" = no; then
466 OSMESA_LIB_DEPS="-lm -lpthread"
467 else
468 OSMESA_LIB_DEPS=""
469 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800470 OSMESA_MESA_DEPS=""
471 ;;
472*)
473 # Link OSMesa to libGL otherwise
474 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800475 # only link librararies with osmesa if shared
476 if test "$enable_static" = no; then
477 OSMESA_MESA_DEPS='-l$(GL_LIB)'
478 else
479 OSMESA_MESA_DEPS=""
480 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800481 ;;
482esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700483AC_SUBST(OSMESA_LIB_DEPS)
484AC_SUBST(OSMESA_MESA_DEPS)
485
486dnl
487dnl GLU configuration
488dnl
489AC_ARG_ENABLE(glu,
490 [AS_HELP_STRING([--enable-glu],
491 [enable OpenGL Utility library @<:@default=yes@:>@])],
492 enable_glu="$enableval",
493 enable_glu=yes)
494if test "x$enable_glu" = xyes; then
495 SRC_DIRS="$SRC_DIRS glu"
496
Dan Nicholson979ff512007-12-05 18:47:01 -0800497 case "$mesa_driver" in
498 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800499 # If GLU is available and we have libOSMesa (not 16 or 32),
500 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800501 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800502 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
503 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700504
Dan Nicholson979ff512007-12-05 18:47:01 -0800505 # Link libGLU to libOSMesa instead of libGL
506 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800507 if test "$enable_static" = no; then
508 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
509 else
510 GLU_MESA_DEPS=""
511 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800512 ;;
513 *)
514 # If GLU is available, we can build the xdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800515 if test "$with_demos" = yes; then
516 PROGRAM_DIRS="$PROGRAM_DIRS xdemos"
517 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800518
Dan Nicholson88586332007-11-15 08:59:57 -0800519 # If static, empty GLU_LIB_DEPS and add libs for programs to link
520 if test "$enable_static" = no; then
521 GLU_LIB_DEPS="-lm"
522 GLU_MESA_DEPS='-l$(GL_LIB)'
523 else
524 GLU_LIB_DEPS=""
525 GLU_MESA_DEPS=""
526 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
527 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800528 ;;
529 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700530fi
531AC_SUBST(GLU_LIB_DEPS)
532AC_SUBST(GLU_MESA_DEPS)
533
534dnl
535dnl GLw configuration
536dnl
537AC_ARG_ENABLE(glw,
538 [AS_HELP_STRING([--enable-glw],
539 [enable Xt/Motif widget library @<:@default=yes@:>@])],
540 enable_glw="$enableval",
541 enable_glw=yes)
Dan Nicholson979ff512007-12-05 18:47:01 -0800542dnl Don't build GLw on osmesa
543if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
544 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
545 enable_glw=no
546fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700547if test "x$enable_glw" = xyes; then
548 SRC_DIRS="$SRC_DIRS glw"
549 if test "$x11_pkgconfig" = yes; then
550 PKG_CHECK_MODULES(GLW, x11 xt)
551 GLW_LIB_DEPS="$GLW_LIBS"
552 else
553 # should check these...
554 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
555 fi
556
Dan Nicholson88586332007-11-15 08:59:57 -0800557 # If static, empty GLW_LIB_DEPS and add libs for programs to link
558 if test "$enable_static" = no; then
559 GLW_MESA_DEPS='-l$(GL_LIB)'
560 else
561 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
562 GLW_LIB_DEPS=""
563 GLW_MESA_DEPS=""
564 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700565fi
566AC_SUBST(GLW_LIB_DEPS)
567AC_SUBST(GLW_MESA_DEPS)
568
569dnl
570dnl GLUT configuration
571dnl
572if test -f "$srcdir/include/GL/glut.h"; then
573 default_glut=yes
574else
575 default_glut=no
576fi
577AC_ARG_ENABLE(glut,
578 [AS_HELP_STRING([--enable-glut],
579 [enable GLUT library @<:@default=yes if source available@:>@])],
580 enable_glut="$enableval",
581 enable_glut="$default_glut")
582
583dnl Can't build glut if GLU not available
584if test "x$enable_glu$enable_glut" = xnoyes; then
585 AC_MSG_WARN([Disabling glut since GLU is disabled])
586 enable_glut=no
587fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800588dnl Don't build glut on osmesa
589if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
590 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
591 enable_glut=no
592fi
593
Dan Nicholsondca1b792007-10-23 09:25:58 -0700594if test "x$enable_glut" = xyes; then
595 SRC_DIRS="$SRC_DIRS glut/glx"
596 GLUT_CFLAGS=""
597 if test "x$GCC" = xyes; then
598 GLUT_CFLAGS="-fexceptions"
599 fi
600 if test "$x11_pkgconfig" = yes; then
601 PKG_CHECK_MODULES(GLUT, x11 xmu xt xi)
602 GLUT_LIB_DEPS="$GLUT_LIBS"
603 else
604 # should check these...
605 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXt -lXi"
606 fi
607 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
608
609 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800610 if test "$with_demos" = yes; then
611 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
612 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700613
Dan Nicholson88586332007-11-15 08:59:57 -0800614 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
615 if test "$enable_static" = no; then
616 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
617 else
618 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
619 GLUT_LIB_DEPS=""
620 GLUT_MESA_DEPS=""
621 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700622fi
623AC_SUBST(GLUT_LIB_DEPS)
624AC_SUBST(GLUT_MESA_DEPS)
625AC_SUBST(GLUT_CFLAGS)
626
627dnl
628dnl Program library dependencies
629dnl Only libm is added here if necessary as the libraries should
630dnl be pulled in by the linker
631dnl
632if test "x$APP_LIB_DEPS" = x; then
633 APP_LIB_DEPS="-lm"
634fi
635AC_SUBST(APP_LIB_DEPS)
636AC_SUBST(PROGRAM_DIRS)
637
638dnl Arch/platform-specific settings
639PIC_FLAGS=""
640ASM_FLAGS=""
641ASM_SOURCES=""
642ASM_API=""
643AC_SUBST(PIC_FLAGS)
644AC_SUBST(ASM_FLAGS)
645AC_SUBST(ASM_SOURCES)
646AC_SUBST(ASM_API)
647case "$host_os" in
648linux*)
649 PIC_FLAGS="-fPIC"
650 case "$host_cpu" in
651 i*86)
652 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
653 ASM_SOURCES='$(X86_SOURCES)'
654 ASM_API='$(X86_API)'
655 ;;
656 x86_64)
657 ASM_FLAGS="-DUSE_X86_64_ASM"
658 ASM_SOURCES='$(X86-64_SOURCES)'
659 ASM_API='$(X86-64_API)'
660 ;;
661 powerpc)
662 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
663 ASM_SOURCES='$(PPC_SOURCES)'
664 ;;
665 esac
666 ;;
667freebsd*)
668 PIC_FLAGS="-fPIC"
669 case "$host_os" in
670 i*86)
671 PIC_FLAGS=""
672 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
673 ASM_SOURCES='$(X86_SOURCES)'
674 ASM_API='$(X86_API)'
675 ;;
676 x86_64)
677 ASM_FLAGS="-DUSE_X86_64_ASM"
678 ASM_SOURCES='$(X86-64_SOURCES)'
679 ASM_API='$(X86-64_API)'
680 ;;
681 esac
682 ;;
683esac
684
685dnl Restore LDFLAGS and CPPFLAGS
686LDFLAGS="$_SAVE_LDFLAGS"
687CPPFLAGS="$_SAVE_CPPFLAGS"
688
689dnl Substitute the config
690AC_OUTPUT([configs/autoconf])
691
692echo ""
693echo " Run 'make autoconf' to build Mesa"
694echo ""