blob: 8598a0d2d8035558cc2f8d66551dddba2615173c [file] [log] [blame]
Dan Nicholsondca1b792007-10-23 09:25:58 -07001dnl Process this file with autoconf to create configure.
2
3AC_PREREQ(2.59)
4
5dnl Versioning
6dnl Make version number available to autoconf and configure
7m4_define(mesa_major, 7)
8m4_define(mesa_minor, 1)
9m4_define(mesa_tiny, 0)
10m4_define(mesa_version, [mesa_major().mesa_minor().mesa_tiny()])
11
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -080012AC_INIT([Mesa],[mesa_version()],
13 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
Dan Nicholsondca1b792007-10-23 09:25:58 -070014AC_CONFIG_AUX_DIR(bin)
15AC_CANONICAL_HOST
16
17dnl Substitute the version number into shell variables
18MESA_MAJOR=mesa_major()
19MESA_MINOR=mesa_minor()
20MESA_TINY=mesa_tiny()
21AC_SUBST(MESA_MAJOR)
22AC_SUBST(MESA_MINOR)
23AC_SUBST(MESA_TINY)
24
25dnl Check for progs
26AC_PROG_CPP
27AC_PROG_CC
28AC_PROG_CXX
Dan Nicholsonb6459422008-03-24 10:01:50 -070029AC_CHECK_PROGS(MAKE, [gmake make])
Dan Nicholsondca1b792007-10-23 09:25:58 -070030AC_PATH_PROG(MKDEP, makedepend)
31AC_PATH_PROG(SED, sed)
Dan Nicholson41b00702007-12-12 08:48:30 -080032
Dan Nicholsondb7fc632008-03-07 11:48:09 -080033MKDEP_OPTIONS=-fdepend
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050034dnl Ask gcc where it's keeping its secret headers
35if test "x$GCC" = xyes; then
Dan Nicholsondb7fc632008-03-07 11:48:09 -080036 GCC_INCLUDES=`$CC -print-file-name=include`
37 if test "x$GCC_INCLUDES" != x; then
38 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
39 fi
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050040fi
41AC_SUBST(MKDEP_OPTIONS)
42
Eric Anholt050c5332008-03-20 17:28:58 -070043dnl Check to see if dlopen is in default libraries (like Solaris, which
44dnl has it in libc), or if libdl is needed to get it.
45AC_CHECK_FUNC([dlopen], [],
46 AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
47
Dan Nicholson41b00702007-12-12 08:48:30 -080048dnl Make sure the pkg-config macros are defined
49m4_ifdef([PKG_PROG_PKG_CONFIG],,[
50 AC_MSG_ERROR([The pkg-config autoconf macros are not defined.
51 Did you run 'make configure'?])]
52)
Dan Nicholsondca1b792007-10-23 09:25:58 -070053PKG_PROG_PKG_CONFIG()
54
55dnl LIB_DIR - library basename
56LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
57AC_SUBST(LIB_DIR)
58
59dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
60_SAVE_LDFLAGS="$LDFLAGS"
61AC_ARG_VAR(EXTRA_LIB_PATH,[Extra -L paths for the linker])
62AC_SUBST(EXTRA_LIB_PATH)
63
64dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
65_SAVE_CPPFLAGS="$CPPFLAGS"
66AC_ARG_VAR(X11_INCLUDES,[Extra -I paths for X11 headers])
67AC_SUBST(X11_INCLUDES)
68
69dnl Compiler macros
70DEFINES=""
71AC_SUBST(DEFINES)
Dan Nicholsondca1b792007-10-23 09:25:58 -070072case "$host_os" in
73linux*)
Eric Anholt5ad06152008-03-20 17:14:20 -070074if test "x$GCC" = xyes; then
75 DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
76fi
Dan Nicholsondca1b792007-10-23 09:25:58 -070077 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
78 ;;
79esac
80
81dnl Add flags for gcc and g++
82if test "x$GCC" = xyes; then
83 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
Dan Nicholson0c275b62008-01-15 22:52:25 -080084
85 # Work around aliasing bugs - developers should comment this out
86 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070087fi
88if test "x$GXX" = xyes; then
89 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -080090
91 # Work around aliasing bugs - developers should comment this out
92 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070093fi
94
95dnl These should be unnecessary, but let the user set them if they want
96AC_ARG_VAR(OPT_FLAGS, [Additional optimization flags for the compiler.
97 Default is to use CFLAGS.])
98AC_ARG_VAR(ARCH_FLAGS, [Additional architecture specific flags for the
99 compiler. Default is to use CFLAGS.])
100AC_SUBST(OPT_FLAGS)
101AC_SUBST(ARCH_FLAGS)
102
103dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600104dnl Hacks to enable 32 or 64 bit build
105dnl
106AC_ARG_ENABLE(32-bit,
107 [AS_HELP_STRING([--enable-32-bit],
108 [build 32-bit libraries @<:@default=auto@:>@])],
109 enable_32bit="$enableval",
110 enable_32bit=auto
111)
112if test "x$enable_32bit" = xyes; then
113 if test "x$GCC" = xyes; then
114 CFLAGS="$CFLAGS -m32"
115 fi
116 if test "x$GXX" = xyes; then
117 CXXFLAGS="$CXXFLAGS -m32"
118 fi
119fi
120AC_ARG_ENABLE(64-bit,
121 [AS_HELP_STRING([--enable-64-bit],
122 [build 64-bit libraries @<:@default=auto@:>@])],
123 enable_64bit="$enableval",
124 enable_64bit=auto
125)
126if test "x$enable_64bit" = xyes; then
127 if test "x$GCC" = xyes; then
128 CFLAGS="$CFLAGS -m64"
129 fi
130 if test "x$GXX" = xyes; then
131 CXXFLAGS="$CXXFLAGS -m64"
132 fi
133fi
134
135dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800136dnl shared/static libraries, mimic libtool options
137dnl
138AC_ARG_ENABLE(static,
139 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800140 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -0800141 enable_static="$enableval",
142 enable_static=no
143)
144case "x$enable_static" in
145xyes|xno ) ;;
146x ) enable_static=no ;;
147* )
148 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
149 ;;
150esac
151AC_ARG_ENABLE(shared,
152 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800153 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson88586332007-11-15 08:59:57 -0800154 enable_shared="$enableval",
155 enable_shared=yes
156)
157case "x$enable_shared" in
158xyes|xno ) ;;
159x ) enable_shared=yes ;;
160* )
161 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
162 ;;
163esac
164
165dnl Can't have static and shared libraries, default to static if user
166dnl explicitly requested. If both disabled, set to static since shared
167dnl was explicitly requirested.
168case "x$enable_static$enable_shared" in
169xyesyes )
170 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
171 enable_shared=no
172 ;;
173xnono )
174 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
175 enable_static=yes
176 ;;
177esac
178
179dnl
180dnl mklib options
181dnl
182AC_ARG_VAR(MKLIB_OPTIONS,[Options for the Mesa library script, mklib])
183if test "$enable_static" = yes; then
184 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
185fi
186AC_SUBST(MKLIB_OPTIONS)
187
Dan Nicholson23656c42007-12-12 09:02:31 -0800188dnl
189dnl other compiler options
190dnl
191AC_ARG_ENABLE(debug,
192 [AS_HELP_STRING([--enable-debug],
193 [use debug compiler flags and macros @<:@default=disabled@:>@])],
194 enable_debug="$enableval",
195 enable_debug=no
196)
197if test "x$enable_debug" = xyes; then
198 DEFINES="$DEFINES -DDEBUG"
199 if test "x$GCC" = xyes; then
200 CFLAGS="$CFLAGS -g"
201 fi
202 if test "x$GXX" = xyes; then
203 CXXFLAGS="$CXXFLAGS -g"
204 fi
205fi
Dan Nicholson3e288622007-12-12 09:02:31 -0800206dnl These will be used near the end in the arch specific options
207AC_ARG_ENABLE(asm,
208 [AS_HELP_STRING([--disable-asm],
209 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
210 enable_asm="$enableval",
211 enable_asm=yes
212)
Dan Nicholson88586332007-11-15 08:59:57 -0800213
214dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700215dnl library names
216dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800217if test "$enable_static" = yes; then
218 GL_LIB_NAME='lib$(GL_LIB).a'
219 GLU_LIB_NAME='lib$(GLU_LIB).a'
220 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
221 GLW_LIB_NAME='lib$(GLW_LIB).a'
222 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
223else
224 GL_LIB_NAME='lib$(GL_LIB).so'
225 GLU_LIB_NAME='lib$(GLU_LIB).so'
226 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
227 GLW_LIB_NAME='lib$(GLW_LIB).so'
228 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
229fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700230AC_SUBST(GL_LIB_NAME)
231AC_SUBST(GLU_LIB_NAME)
232AC_SUBST(GLUT_LIB_NAME)
233AC_SUBST(GLW_LIB_NAME)
234AC_SUBST(OSMESA_LIB_NAME)
235
236dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800237dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800238dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800239dnl
240AC_ARG_WITH(driver,
241 [AS_HELP_STRING([--with-driver=DRIVER],
Dan Nicholsona1307182007-12-12 17:49:49 -0800242 [driver for Mesa: xlib,dri,osmesa @<:@default=xlib@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800243 mesa_driver="$withval",
Dan Nicholsona1307182007-12-12 17:49:49 -0800244 mesa_driver="xlib")
Dan Nicholson44d99142007-12-05 18:47:01 -0800245dnl Check for valid option
246case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800247xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800248 ;;
249*)
250 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
251 ;;
252esac
253
254dnl
255dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700256dnl
257SRC_DIRS="mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700258GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800259WINDOW_SYSTEM=""
260case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800261xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800262 DRIVER_DIRS="x11"
263 ;;
264dri)
265 SRC_DIRS="glx/x11 $SRC_DIRS"
266 DRIVER_DIRS="dri"
267 WINDOW_SYSTEM="dri"
268 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800269osmesa)
270 DRIVER_DIRS="osmesa"
271 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800272esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700273AC_SUBST(SRC_DIRS)
274AC_SUBST(GLU_DIRS)
275AC_SUBST(DRIVER_DIRS)
Dan Nicholson44d99142007-12-05 18:47:01 -0800276AC_SUBST(WINDOW_SYSTEM)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700277
278dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800279dnl User supplied program configuration
280dnl
281if test -d "$srcdir/progs/demos"; then
282 default_demos=yes
283else
284 default_demos=no
285fi
286AC_ARG_WITH(demos,
287 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
288 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800289 @<:@default=auto if source available@:>@])],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800290 with_demos="$withval",
291 with_demos="$default_demos")
292if test "x$with_demos" = x; then
293 with_demos=no
294fi
295
296dnl If $with_demos is yes, directories will be added as libs available
297PROGRAM_DIRS=""
298case "$with_demos" in
Dan Nicholsonb9576552008-03-10 14:05:46 -0700299no) ;;
300yes)
301 # If the driver isn't osmesa, we have libGL and can build xdemos
302 if test "$mesa_driver" != osmesa; then
303 PROGRAM_DIRS="xdemos"
304 fi
305 ;;
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800306*)
307 # verify the requested demos directories exist
308 demos=`IFS=,; echo $with_demos`
309 for demo in $demos; do
310 test -d "$srcdir/progs/$demo" || \
311 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
312 done
313 PROGRAM_DIRS="$demos"
314 ;;
315esac
316
317dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700318dnl Find out if X is available. The variables have_x or no_x will be
319dnl set and used later in the driver setups
320dnl
321if test -n "$PKG_CONFIG"; then
322 AC_MSG_CHECKING([pkg-config files for X11 are available])
323 if $PKG_CONFIG --exists x11; then
324 x11_pkgconfig=yes
325 have_x=yes
326 AC_MSG_RESULT(yes)
327 else
328 x11_pkgconfig=no
329 no_x=yes
330 AC_MSG_RESULT(no)
331 fi
332else
333 x11_pkgconfig=no
334fi
335dnl Use the autoconf macro if no pkg-config files
336if test "$x11_pkgconfig" = no; then
337 AC_PATH_XTRA
338fi
339
Dan Nicholson44d99142007-12-05 18:47:01 -0800340dnl We need X for xlib and dri, so bomb now if it's not found
341case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800342xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800343 if test "$no_x" = yes; then
344 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
345 fi
346 ;;
347esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700348
Adam Jackson66611f22008-02-15 13:49:12 -0500349# SELinux awareness.
350AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux], [Build SELinux-aware Mesa (default: disabled)]), [MESA_SELINUX=$enableval], [MESA_SELINUX=no])
351if test "x$enable_selinux" = "xyes"; then
352 AC_CHECK_HEADER(selinux/selinux.h,,
353 AC_MSG_ERROR([SELinux headers not found]))
354 AC_CHECK_LIB(selinux,is_selinux_enabled,,
355 AC_MSG_ERROR([SELinux library not found]))
356 SELINUX_LIBS="-lselinux"
357 DEFINES="$DEFINES -DMESA_SELINUX"
358fi
359
Dan Nicholson44d99142007-12-05 18:47:01 -0800360dnl
361dnl libGL configuration per driver
362dnl
363case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800364xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800365 if test "$x11_pkgconfig" = yes; then
Dan Nicholsona1307182007-12-12 17:49:49 -0800366 PKG_CHECK_MODULES(XLIBGL, x11 xext)
367 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
368 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800369 else
370 # should check these...
371 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
372 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
373 fi
Adam Jackson66611f22008-02-15 13:49:12 -0500374 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800375
376 # if static, move the external libraries to the programs
377 # and empty the libraries for libGL
378 if test "$enable_static" = yes; then
379 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
380 GL_LIB_DEPS=""
381 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800382 ;;
383dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800384 # DRI must be shared, I think
385 if test "$enable_static" = yes; then
386 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
387 fi
388
Dan Nicholson44d99142007-12-05 18:47:01 -0800389 # Check for libdrm
390 PKG_CHECK_MODULES(LIBDRM, libdrm)
Kristian Høgsberge82dd8c2008-03-26 19:26:59 -0400391 PKG_CHECK_MODULES(DRI2PROTO, dri2proto)
Dan Nicholson44d99142007-12-05 18:47:01 -0800392
393 # find the DRI deps for libGL
394 if test "$x11_pkgconfig" = yes; then
395 PKG_CHECK_MODULES(DRIGL, x11 xext xxf86vm xdamage xfixes)
396 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
397 GL_LIB_DEPS="$DRIGL_LIBS"
398 else
399 # should check these...
400 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
401 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
402 fi
403
404 # need DRM libs, -lpthread, etc.
Eric Anholt050c5332008-03-20 17:28:58 -0700405 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800406 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800407osmesa)
408 # No libGL for osmesa
409 GL_LIB_DEPS=""
410 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800411esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700412AC_SUBST(GL_LIB_DEPS)
413
414dnl
415dnl More X11 setup
416dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800417if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700418 DEFINES="$DEFINES -DUSE_XSHM"
419fi
420
421dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800422dnl More DRI setup
423dnl
424AC_ARG_ENABLE(glx-tls,
425 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800426 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800427 GLX_USE_TLS="$enableval",
428 GLX_USE_TLS=no)
429dnl Directory for DRI drivers
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800430AC_ARG_WITH(dri-driverdir,
431 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson44d99142007-12-05 18:47:01 -0800432 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
433 DRI_DRIVER_INSTALL_DIR="$withval",
434 DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri')
435AC_SUBST(DRI_DRIVER_INSTALL_DIR)
436dnl Direct rendering or just indirect rendering
437AC_ARG_ENABLE(driglx-direct,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800438 [AS_HELP_STRING([--disable-driglx-direct],
439 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson44d99142007-12-05 18:47:01 -0800440 driglx_direct="$enableval",
441 driglx_direct="yes")
442
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800443dnl Which drivers to build - default is chosen by platform
444AC_ARG_WITH(dri-drivers,
445 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800446 [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800447 with_dri_drivers="$withval",
448 with_dri_drivers=yes)
449if test "x$with_dri_drivers" = x; then
450 with_dri_drivers=no
451fi
452
453dnl If $with_dri_drivers is yes, directories will be added through
454dnl platform checks
455DRI_DIRS=""
456case "$with_dri_drivers" in
457no|yes) ;;
458*)
459 # verify the requested driver directories exist
460 dri_drivers=`IFS=,; echo $with_dri_drivers`
461 for driver in $dri_drivers; do
462 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
463 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
464 done
465 DRI_DIRS="$dri_drivers"
466 ;;
467esac
468
Dan Nicholson44d99142007-12-05 18:47:01 -0800469dnl Just default to no EGL for now
470USING_EGL=0
471AC_SUBST(USING_EGL)
472
473dnl Set DRI_DIRS, DEFINES and LIB_DEPS
474if test "$mesa_driver" = dri; then
475 # Use TLS in GLX?
476 if test "x$GLX_USE_TLS" = xyes; then
477 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
478 fi
479
480 if test "x$USING_EGL" = x1; then
481 PROGRAM_DIRS="egl"
482 fi
483
484 # Platform specific settings and drivers to build
485 case "$host_os" in
486 linux*)
487 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
488 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
489 if test "x$driglx_direct" = xyes; then
490 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
491 fi
492
493 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800494 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800495 # ffb, gamma, and sis are missing because they have not be
496 # converted to use the new interface. i810 are missing
497 # because there is no x86-64 system where they could *ever*
498 # be used.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800499 if test "x$DRI_DIRS" = x; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800500 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
501 savage tdfx unichrome"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800502 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800503 ;;
504 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800505 # Build only the drivers for cards that exist on PowerPC.
506 # At some point MGA will be added, but not yet.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800507 if test "x$DRI_DIRS" = x; then
508 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
509 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800510 ;;
511 esac
512 ;;
513 freebsd*)
514 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
515 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
516 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
517 if test "x$driglx_direct" = xyes; then
518 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
519 fi
520 if test "x$GXX" = xyes; then
521 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
522 fi
523
Dan Nicholsona76e2452007-12-07 11:25:08 -0800524 # ffb and gamma are missing because they have not been converted
525 # to use the new interface.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800526 if test "x$DRI_DIRS" = x; then
527 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
528 unichrome savage sis"
529 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800530 ;;
531 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800532
533 # default drivers
534 if test "x$DRI_DIRS" = x; then
535 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
536 savage sis tdfx trident unichrome ffb"
537 fi
538
Dan Nicholson44d99142007-12-05 18:47:01 -0800539 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
540
541 # Check for expat
542 EXPAT_INCLUDES=""
543 EXPAT_LIB=-lexpat
544 AC_ARG_WITH(expat, AS_HELP_STRING([--with-expat=DIR],
545 [expat install directory]),[
546 EXPAT_INCLUDES="-I$withval/include"
547 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
548 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
549 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
550 ])
551 AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([Expat required for DRI.]))
552 AC_CHECK_LIB(expat, XML_ParserCreate,,
553 AC_MSG_ERROR([Expat required for DRI.]))
554
555 # put all the necessary libs together
Eric Anholt050c5332008-03-20 17:28:58 -0700556 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800557fi
558AC_SUBST(DRI_DIRS)
559AC_SUBST(EXPAT_INCLUDES)
560AC_SUBST(DRI_LIB_DEPS)
561
562dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700563dnl OSMesa configuration
564dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800565if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800566 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800567else
Dan Nicholson544ab202007-12-30 08:41:53 -0800568 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800569fi
Dan Nicholson544ab202007-12-30 08:41:53 -0800570AC_ARG_ENABLE(gl-osmesa,
571 [AS_HELP_STRING([--enable-gl-osmesa],
572 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
573 gl_osmesa="$enableval",
574 gl_osmesa="$default_gl_osmesa")
575if test "x$gl_osmesa" = xyes; then
576 if test "$mesa_driver" = osmesa; then
577 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800578 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800579 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800580 fi
581fi
582
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800583dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
584AC_ARG_WITH(osmesa-bits,
585 [AS_HELP_STRING([--with-osmesa-bits=BITS],
586 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
587 osmesa_bits="$withval",
588 osmesa_bits=8)
589if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
590 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
591 osmesa_bits=8
592fi
593case "x$osmesa_bits" in
594x8)
595 OSMESA_LIB=OSMesa
596 ;;
597x16|x32)
598 OSMESA_LIB="OSMesa$osmesa_bits"
599 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
600 ;;
601*)
602 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
603 ;;
604esac
605AC_SUBST(OSMESA_LIB)
606
Dan Nicholson979ff512007-12-05 18:47:01 -0800607case "$mesa_driver" in
608osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800609 # only link librararies with osmesa if shared
610 if test "$enable_static" = no; then
Adam Jackson66611f22008-02-15 13:49:12 -0500611 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800612 else
613 OSMESA_LIB_DEPS=""
614 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800615 OSMESA_MESA_DEPS=""
616 ;;
617*)
618 # Link OSMesa to libGL otherwise
619 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800620 # only link librararies with osmesa if shared
621 if test "$enable_static" = no; then
622 OSMESA_MESA_DEPS='-l$(GL_LIB)'
623 else
624 OSMESA_MESA_DEPS=""
625 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800626 ;;
627esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700628AC_SUBST(OSMESA_LIB_DEPS)
629AC_SUBST(OSMESA_MESA_DEPS)
630
631dnl
632dnl GLU configuration
633dnl
634AC_ARG_ENABLE(glu,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800635 [AS_HELP_STRING([--disable-glu],
636 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700637 enable_glu="$enableval",
638 enable_glu=yes)
639if test "x$enable_glu" = xyes; then
640 SRC_DIRS="$SRC_DIRS glu"
641
Dan Nicholson979ff512007-12-05 18:47:01 -0800642 case "$mesa_driver" in
643 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800644 # If GLU is available and we have libOSMesa (not 16 or 32),
645 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800646 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800647 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
648 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700649
Dan Nicholson979ff512007-12-05 18:47:01 -0800650 # Link libGLU to libOSMesa instead of libGL
651 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800652 if test "$enable_static" = no; then
653 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
654 else
655 GLU_MESA_DEPS=""
656 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800657 ;;
658 *)
Dan Nicholson88586332007-11-15 08:59:57 -0800659 # If static, empty GLU_LIB_DEPS and add libs for programs to link
660 if test "$enable_static" = no; then
661 GLU_LIB_DEPS="-lm"
662 GLU_MESA_DEPS='-l$(GL_LIB)'
663 else
664 GLU_LIB_DEPS=""
665 GLU_MESA_DEPS=""
666 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
667 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800668 ;;
669 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700670fi
671AC_SUBST(GLU_LIB_DEPS)
672AC_SUBST(GLU_MESA_DEPS)
673
674dnl
675dnl GLw configuration
676dnl
677AC_ARG_ENABLE(glw,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800678 [AS_HELP_STRING([--disable-glw],
679 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700680 enable_glw="$enableval",
681 enable_glw=yes)
Dan Nicholson979ff512007-12-05 18:47:01 -0800682dnl Don't build GLw on osmesa
683if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
684 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
685 enable_glw=no
686fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700687if test "x$enable_glw" = xyes; then
688 SRC_DIRS="$SRC_DIRS glw"
689 if test "$x11_pkgconfig" = yes; then
690 PKG_CHECK_MODULES(GLW, x11 xt)
691 GLW_LIB_DEPS="$GLW_LIBS"
692 else
693 # should check these...
694 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
695 fi
696
Dan Nicholson88586332007-11-15 08:59:57 -0800697 # If static, empty GLW_LIB_DEPS and add libs for programs to link
698 if test "$enable_static" = no; then
699 GLW_MESA_DEPS='-l$(GL_LIB)'
700 else
701 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
702 GLW_LIB_DEPS=""
703 GLW_MESA_DEPS=""
704 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700705fi
706AC_SUBST(GLW_LIB_DEPS)
707AC_SUBST(GLW_MESA_DEPS)
708
709dnl
710dnl GLUT configuration
711dnl
712if test -f "$srcdir/include/GL/glut.h"; then
713 default_glut=yes
714else
715 default_glut=no
716fi
717AC_ARG_ENABLE(glut,
Dan Nicholson79ad4582007-12-07 19:11:01 -0800718 [AS_HELP_STRING([--disable-glut],
719 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholsondca1b792007-10-23 09:25:58 -0700720 enable_glut="$enableval",
721 enable_glut="$default_glut")
722
723dnl Can't build glut if GLU not available
724if test "x$enable_glu$enable_glut" = xnoyes; then
725 AC_MSG_WARN([Disabling glut since GLU is disabled])
726 enable_glut=no
727fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800728dnl Don't build glut on osmesa
729if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
730 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
731 enable_glut=no
732fi
733
Dan Nicholsondca1b792007-10-23 09:25:58 -0700734if test "x$enable_glut" = xyes; then
735 SRC_DIRS="$SRC_DIRS glut/glx"
736 GLUT_CFLAGS=""
737 if test "x$GCC" = xyes; then
738 GLUT_CFLAGS="-fexceptions"
739 fi
740 if test "$x11_pkgconfig" = yes; then
Dan Nicholson70d0c832007-12-07 11:12:20 -0800741 PKG_CHECK_MODULES(GLUT, x11 xmu xi)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700742 GLUT_LIB_DEPS="$GLUT_LIBS"
743 else
744 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -0800745 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700746 fi
747 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
748
749 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800750 if test "$with_demos" = yes; then
751 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
752 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700753
Dan Nicholson88586332007-11-15 08:59:57 -0800754 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
755 if test "$enable_static" = no; then
756 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
757 else
758 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
759 GLUT_LIB_DEPS=""
760 GLUT_MESA_DEPS=""
761 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700762fi
763AC_SUBST(GLUT_LIB_DEPS)
764AC_SUBST(GLUT_MESA_DEPS)
765AC_SUBST(GLUT_CFLAGS)
766
767dnl
768dnl Program library dependencies
769dnl Only libm is added here if necessary as the libraries should
770dnl be pulled in by the linker
771dnl
772if test "x$APP_LIB_DEPS" = x; then
773 APP_LIB_DEPS="-lm"
774fi
775AC_SUBST(APP_LIB_DEPS)
776AC_SUBST(PROGRAM_DIRS)
777
778dnl Arch/platform-specific settings
779PIC_FLAGS=""
780ASM_FLAGS=""
781ASM_SOURCES=""
782ASM_API=""
783AC_SUBST(PIC_FLAGS)
784AC_SUBST(ASM_FLAGS)
785AC_SUBST(ASM_SOURCES)
786AC_SUBST(ASM_API)
787case "$host_os" in
788linux*)
789 PIC_FLAGS="-fPIC"
790 case "$host_cpu" in
791 i*86)
Dan Nicholson3e288622007-12-12 09:02:31 -0800792 if test "x$enable_asm" = xyes; then
793 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
794 ASM_SOURCES='$(X86_SOURCES)'
795 ASM_API='$(X86_API)'
796 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700797 ;;
798 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800799 if test "x$enable_asm" = xyes; then
800 ASM_FLAGS="-DUSE_X86_64_ASM"
801 ASM_SOURCES='$(X86-64_SOURCES)'
802 ASM_API='$(X86-64_API)'
803 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700804 ;;
805 powerpc)
Dan Nicholson3e288622007-12-12 09:02:31 -0800806 if test "x$enable_asm" = xyes; then
807 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
808 ASM_SOURCES='$(PPC_SOURCES)'
809 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700810 ;;
811 esac
812 ;;
813freebsd*)
814 PIC_FLAGS="-fPIC"
Dan Nicholson758b9982008-02-21 10:32:04 -0800815 case "$host_cpu" in
Dan Nicholsondca1b792007-10-23 09:25:58 -0700816 i*86)
817 PIC_FLAGS=""
Dan Nicholson3e288622007-12-12 09:02:31 -0800818 if test "x$enable_asm" = xyes; then
819 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
820 ASM_SOURCES='$(X86_SOURCES)'
821 ASM_API='$(X86_API)'
822 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700823 ;;
824 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800825 if test "x$enable_asm" = xyes; then
826 ASM_FLAGS="-DUSE_X86_64_ASM"
827 ASM_SOURCES='$(X86-64_SOURCES)'
828 ASM_API='$(X86-64_API)'
829 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700830 ;;
831 esac
832 ;;
833esac
834
835dnl Restore LDFLAGS and CPPFLAGS
836LDFLAGS="$_SAVE_LDFLAGS"
837CPPFLAGS="$_SAVE_CPPFLAGS"
838
839dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -0800840AC_CONFIG_FILES([configs/autoconf])
841AC_OUTPUT
Dan Nicholsondca1b792007-10-23 09:25:58 -0700842
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800843dnl Replace the configs/current symlink
844if test -f configs/current || test -L configs/current; then
845 rm -f configs/current
846fi
847ln -s autoconf configs/current
848
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800849dnl
850dnl Output some configuration info for the user
851dnl
852echo ""
853echo " prefix: $prefix"
854echo " exec_prefix: $exec_prefix"
855echo " libdir: $libdir"
856
857dnl Driver info
858echo ""
859echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -0800860if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
861 echo " OSMesa: lib$OSMESA_LIB"
862else
863 echo " OSMesa: no"
864fi
865if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800866 # cleanup the drivers var
867 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
868 echo " DRI drivers: $dri_dirs"
869 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -0800870fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800871
872dnl Libraries
873echo ""
874echo " Shared libs: $enable_shared"
875echo " Static libs: $enable_static"
876echo " GLU: $enable_glu"
877echo " GLw: $enable_glw"
878echo " glut: $enable_glut"
879
880dnl Programs
881# cleanup the programs var for display
882program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
883if test "x$program_dirs" = x; then
884 echo " Demos: no"
885else
886 echo " Demos: $program_dirs"
887fi
888
Dan Nicholson16a07fb2007-12-12 09:12:15 -0800889dnl Compiler options
890# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
891cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
892 $SED 's/^ *//;s/ */ /;s/ *$//'`
893cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
894 $SED 's/^ *//;s/ */ /;s/ *$//'`
895defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
896echo ""
897echo " CFLAGS: $cflags"
898echo " CXXFLAGS: $cxxflags"
899echo " Macros: $defines"
900
Dan Nicholsondca1b792007-10-23 09:25:58 -0700901echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -0700902echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700903echo ""