blob: 619ed47bcbd62f5ff45b644e8726f404506a8c17 [file] [log] [blame]
Dan Nicholsondca1b792007-10-23 09:25:58 -07001dnl Process this file with autoconf to create configure.
2
Dan Nicholson297e16c2008-05-05 15:42:53 -07003AC_PREREQ([2.59])
Dan Nicholsondca1b792007-10-23 09:25:58 -07004
Dan Nicholson00994ac2008-04-30 15:06:00 -07005dnl Versioning - scrape the version from configs/default
6m4_define([mesa_version],
7 [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n'])])
Dan Nicholson356f3112009-04-29 06:49:27 -07008m4_ifval(mesa_version,,
9 [m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])])
Dan Nicholsondca1b792007-10-23 09:25:58 -070010
Dan Nicholsone97ab722008-07-01 08:55:42 -070011dnl Tell the user about autoconf.html in the --help output
12m4_divert_once([HELP_END], [
13See docs/autoconf.html for more details on the options for Mesa.])
14
Dan Nicholson00994ac2008-04-30 15:06:00 -070015AC_INIT([Mesa],[mesa_version],
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -080016 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
Dan Nicholson297e16c2008-05-05 15:42:53 -070017AC_CONFIG_AUX_DIR([bin])
Dan Nicholsondca1b792007-10-23 09:25:58 -070018AC_CANONICAL_HOST
19
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -070020dnl Versions for external dependencies
Eric Anholt859828c2009-10-08 17:18:12 -070021LIBDRM_REQUIRED=2.4.15
Fabio Pedrettiae1c0a02009-12-22 10:43:35 +100022LIBDRM_RADEON_REQUIRED=2.4.17
Jesse Barnesa35f6bb2009-07-17 03:30:29 -040023DRI2PROTO_REQUIRED=2.2
Jesse Barnesf2f83d92010-01-11 17:28:10 -050024GLPROTO_REQUIRED=1.4.11
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -070025
Dan Nicholsondca1b792007-10-23 09:25:58 -070026dnl Check for progs
27AC_PROG_CPP
28AC_PROG_CC
29AC_PROG_CXX
Dan Nicholson297e16c2008-05-05 15:42:53 -070030AC_CHECK_PROGS([MAKE], [gmake make])
31AC_PATH_PROG([MKDEP], [makedepend])
32AC_PATH_PROG([SED], [sed])
Dan Nicholson41b00702007-12-12 08:48:30 -080033
Dan Nicholsonbc302b22009-05-22 09:39:02 -070034dnl Our fallback install-sh is a symlink to minstall. Use the existing
35dnl configuration in that case.
36AC_PROG_INSTALL
37test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
38
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070039dnl We need a POSIX shell for parts of the build. Assume we have one
40dnl in most cases.
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070041case "$host_os" in
42solaris*)
43 # Solaris /bin/sh is too old/non-POSIX compliant
44 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070045 SHELL="$POSIX_SHELL"
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070046 ;;
47esac
48
Dan Nicholsondb7fc632008-03-07 11:48:09 -080049MKDEP_OPTIONS=-fdepend
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050050dnl Ask gcc where it's keeping its secret headers
51if test "x$GCC" = xyes; then
Dan Nicholsona3d223f2009-01-30 10:52:09 -080052 for dir in include include-fixed; do
53 GCC_INCLUDES=`$CC -print-file-name=$dir`
54 if test "x$GCC_INCLUDES" != x && \
55 test "$GCC_INCLUDES" != "$dir" && \
56 test -d "$GCC_INCLUDES"; then
57 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
58 fi
59 done
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050060fi
Dan Nicholson297e16c2008-05-05 15:42:53 -070061AC_SUBST([MKDEP_OPTIONS])
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050062
Dan Nicholson41b00702007-12-12 08:48:30 -080063dnl Make sure the pkg-config macros are defined
Dan Nicholson356f3112009-04-29 06:49:27 -070064m4_ifndef([PKG_PROG_PKG_CONFIG],
65 [m4_fatal([Could not locate the pkg-config autoconf macros.
66 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
67 are in a different location, try setting the environment variable
68 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
Dan Nicholsondca1b792007-10-23 09:25:58 -070069PKG_PROG_PKG_CONFIG()
70
71dnl LIB_DIR - library basename
72LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
Dan Nicholson297e16c2008-05-05 15:42:53 -070073AC_SUBST([LIB_DIR])
Dan Nicholsondca1b792007-10-23 09:25:58 -070074
75dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
76_SAVE_LDFLAGS="$LDFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -070077AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
78AC_SUBST([EXTRA_LIB_PATH])
Dan Nicholsondca1b792007-10-23 09:25:58 -070079
80dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
81_SAVE_CPPFLAGS="$CPPFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -070082AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
83AC_SUBST([X11_INCLUDES])
Dan Nicholsondca1b792007-10-23 09:25:58 -070084
85dnl Compiler macros
86DEFINES=""
Dan Nicholson297e16c2008-05-05 15:42:53 -070087AC_SUBST([DEFINES])
Dan Nicholsondca1b792007-10-23 09:25:58 -070088case "$host_os" in
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -070089linux*|*-gnu*|gnu*)
Dan Nicholson29f603a2009-01-12 11:10:31 -080090 DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
Dan Nicholsondca1b792007-10-23 09:25:58 -070091 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070092solaris*)
93 DEFINES="$DEFINES -DPTHREADS -DSVR4"
94 ;;
Dan Nicholsondca1b792007-10-23 09:25:58 -070095esac
96
97dnl Add flags for gcc and g++
98if test "x$GCC" = xyes; then
Alan Coopersmithadda7f32010-01-16 18:34:23 -080099 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
100
101 # Enable -fvisibility=hidden if using a gcc that supports it
102 save_CFLAGS="$CFLAGS"
Alan Coopersmithf8107a42010-01-21 16:42:58 -0800103 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800104 CFLAGS="$CFLAGS -fvisibility=hidden"
105 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
106 [CFLAGS="$save_CFLAGS" ; AC_MSG_RESULT([no])]);
Dan Nicholson0c275b62008-01-15 22:52:25 -0800107
108 # Work around aliasing bugs - developers should comment this out
109 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700110fi
111if test "x$GXX" = xyes; then
112 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -0800113
114 # Work around aliasing bugs - developers should comment this out
115 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700116fi
117
118dnl These should be unnecessary, but let the user set them if they want
Dan Nicholson297e16c2008-05-05 15:42:53 -0700119AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700120 Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700121AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
Dan Nicholsondca1b792007-10-23 09:25:58 -0700122 compiler. Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700123AC_SUBST([OPT_FLAGS])
124AC_SUBST([ARCH_FLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700125
126dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600127dnl Hacks to enable 32 or 64 bit build
128dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700129AC_ARG_ENABLE([32-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600130 [AS_HELP_STRING([--enable-32-bit],
131 [build 32-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700132 [enable_32bit="$enableval"],
133 [enable_32bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600134)
135if test "x$enable_32bit" = xyes; then
136 if test "x$GCC" = xyes; then
137 CFLAGS="$CFLAGS -m32"
Marc Dietrichc705e722009-08-31 08:56:33 -0700138 ARCH_FLAGS="$ARCH_FLAGS -m32"
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600139 fi
140 if test "x$GXX" = xyes; then
141 CXXFLAGS="$CXXFLAGS -m32"
142 fi
143fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700144AC_ARG_ENABLE([64-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600145 [AS_HELP_STRING([--enable-64-bit],
146 [build 64-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700147 [enable_64bit="$enableval"],
148 [enable_64bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600149)
150if test "x$enable_64bit" = xyes; then
151 if test "x$GCC" = xyes; then
152 CFLAGS="$CFLAGS -m64"
153 fi
154 if test "x$GXX" = xyes; then
155 CXXFLAGS="$CXXFLAGS -m64"
156 fi
157fi
158
159dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800160dnl shared/static libraries, mimic libtool options
161dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700162AC_ARG_ENABLE([static],
Dan Nicholson88586332007-11-15 08:59:57 -0800163 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800164 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700165 [enable_static="$enableval"],
166 [enable_static=no]
Dan Nicholson88586332007-11-15 08:59:57 -0800167)
168case "x$enable_static" in
169xyes|xno ) ;;
170x ) enable_static=no ;;
171* )
172 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
173 ;;
174esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700175AC_ARG_ENABLE([shared],
Dan Nicholson88586332007-11-15 08:59:57 -0800176 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800177 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700178 [enable_shared="$enableval"],
179 [enable_shared=yes]
Dan Nicholson88586332007-11-15 08:59:57 -0800180)
181case "x$enable_shared" in
182xyes|xno ) ;;
183x ) enable_shared=yes ;;
184* )
185 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
186 ;;
187esac
188
189dnl Can't have static and shared libraries, default to static if user
190dnl explicitly requested. If both disabled, set to static since shared
191dnl was explicitly requirested.
192case "x$enable_static$enable_shared" in
193xyesyes )
194 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
195 enable_shared=no
196 ;;
197xnono )
198 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
199 enable_static=yes
200 ;;
201esac
202
203dnl
204dnl mklib options
205dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700206AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
Dan Nicholson88586332007-11-15 08:59:57 -0800207if test "$enable_static" = yes; then
208 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
209fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700210AC_SUBST([MKLIB_OPTIONS])
Dan Nicholson88586332007-11-15 08:59:57 -0800211
Dan Nicholson23656c42007-12-12 09:02:31 -0800212dnl
213dnl other compiler options
214dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700215AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800216 [AS_HELP_STRING([--enable-debug],
217 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700218 [enable_debug="$enableval"],
219 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800220)
221if test "x$enable_debug" = xyes; then
222 DEFINES="$DEFINES -DDEBUG"
223 if test "x$GCC" = xyes; then
224 CFLAGS="$CFLAGS -g"
225 fi
226 if test "x$GXX" = xyes; then
227 CXXFLAGS="$CXXFLAGS -g"
228 fi
229fi
Dan Nicholson88586332007-11-15 08:59:57 -0800230
231dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700232dnl library names
233dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800234if test "$enable_static" = yes; then
Dan Nicholson8217f242009-02-11 15:16:00 -0800235 LIB_EXTENSION='a'
Dan Nicholson88586332007-11-15 08:59:57 -0800236else
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700237 case "$host_os" in
238 darwin* )
239 LIB_EXTENSION='dylib' ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +0100240 cygwin* )
241 LIB_EXTENSION='dll' ;;
Tom Fogal9282edf2009-10-13 10:55:33 -0700242 aix* )
243 LIB_EXTENSION='a' ;;
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700244 * )
245 LIB_EXTENSION='so' ;;
246 esac
Dan Nicholson88586332007-11-15 08:59:57 -0800247fi
Dan Nicholson8217f242009-02-11 15:16:00 -0800248
249GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
250GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
251GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
252GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
253OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800254EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
Dan Nicholson8217f242009-02-11 15:16:00 -0800255
256GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
257GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
258GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
259GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
260OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800261EGL_LIB_GLOB='lib$(EGL_LIB).*'${LIB_EXTENSION}'*'
Dan Nicholson8217f242009-02-11 15:16:00 -0800262
Dan Nicholson297e16c2008-05-05 15:42:53 -0700263AC_SUBST([GL_LIB_NAME])
264AC_SUBST([GLU_LIB_NAME])
265AC_SUBST([GLUT_LIB_NAME])
266AC_SUBST([GLW_LIB_NAME])
267AC_SUBST([OSMESA_LIB_NAME])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800268AC_SUBST([EGL_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700269
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700270AC_SUBST([GL_LIB_GLOB])
271AC_SUBST([GLU_LIB_GLOB])
272AC_SUBST([GLUT_LIB_GLOB])
273AC_SUBST([GLW_LIB_GLOB])
274AC_SUBST([OSMESA_LIB_GLOB])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800275AC_SUBST([EGL_LIB_GLOB])
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700276
Dan Nicholsondca1b792007-10-23 09:25:58 -0700277dnl
Dan Nicholson871125a2008-06-04 13:00:35 -0700278dnl Arch/platform-specific settings
279dnl
280AC_ARG_ENABLE([asm],
281 [AS_HELP_STRING([--disable-asm],
282 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
283 [enable_asm="$enableval"],
284 [enable_asm=yes]
285)
286asm_arch=""
287ASM_FLAGS=""
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800288MESA_ASM_SOURCES=""
289GLAPI_ASM_SOURCES=""
Dan Nicholson871125a2008-06-04 13:00:35 -0700290AC_MSG_CHECKING([whether to enable assembly])
291test "x$enable_asm" = xno && AC_MSG_RESULT([no])
292# disable if cross compiling on x86/x86_64 since we must run gen_matypes
293if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
294 case "$host_cpu" in
295 i?86 | x86_64)
296 enable_asm=no
297 AC_MSG_RESULT([no, cross compiling])
298 ;;
299 esac
300fi
301# check for supported arches
302if test "x$enable_asm" = xyes; then
303 case "$host_cpu" in
304 i?86)
305 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100306 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700307 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
308 ;;
309 esac
310 ;;
311 x86_64)
312 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100313 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700314 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
315 ;;
316 esac
317 ;;
318 powerpc)
319 case "$host_os" in
320 linux*)
321 asm_arch=ppc
322 ;;
323 esac
324 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800325 sparc*)
326 case "$host_os" in
327 linux*)
328 asm_arch=sparc
329 ;;
330 esac
331 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700332 esac
333
334 case "$asm_arch" in
335 x86)
Dan Nicholson61e925f2009-02-11 10:42:34 -0800336 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800337 MESA_ASM_SOURCES='$(X86_SOURCES)'
338 GLAPI_ASM_SOURCES='$(X86_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700339 AC_MSG_RESULT([yes, x86])
340 ;;
341 x86_64)
342 ASM_FLAGS="-DUSE_X86_64_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800343 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
344 GLAPI_ASM_SOURCES='$(X86-64_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700345 AC_MSG_RESULT([yes, x86_64])
346 ;;
347 ppc)
348 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800349 MESA_ASM_SOURCES='$(PPC_SOURCES)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700350 AC_MSG_RESULT([yes, ppc])
351 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800352 sparc)
353 ASM_FLAGS="-DUSE_SPARC_ASM"
354 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
355 GLAPI_ASM_SOURCES='$(SPARC_API)'
356 AC_MSG_RESULT([yes, sparc])
357 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700358 *)
359 AC_MSG_RESULT([no, platform not supported])
360 ;;
361 esac
362fi
363AC_SUBST([ASM_FLAGS])
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800364AC_SUBST([MESA_ASM_SOURCES])
365AC_SUBST([GLAPI_ASM_SOURCES])
Dan Nicholson871125a2008-06-04 13:00:35 -0700366
367dnl PIC code macro
368MESA_PIC_FLAGS
369
370dnl Check to see if dlopen is in default libraries (like Solaris, which
371dnl has it in libc), or if libdl is needed to get it.
372AC_CHECK_FUNC([dlopen], [],
373 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
374
Dan Nicholson985e1cd2008-06-04 13:17:06 -0700375dnl See if posix_memalign is available
376AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
377
Dan Nicholson871125a2008-06-04 13:00:35 -0700378dnl SELinux awareness.
379AC_ARG_ENABLE([selinux],
380 [AS_HELP_STRING([--enable-selinux],
381 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
382 [MESA_SELINUX="$enableval"],
383 [MESA_SELINUX=no])
384if test "x$enable_selinux" = "xyes"; then
385 AC_CHECK_HEADER([selinux/selinux.h],[],
386 [AC_MSG_ERROR([SELinux headers not found])])
387 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
388 [AC_MSG_ERROR([SELinux library not found])])
389 SELINUX_LIBS="-lselinux"
390 DEFINES="$DEFINES -DMESA_SELINUX"
391fi
392
Dan Nicholson871125a2008-06-04 13:00:35 -0700393dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800394dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800395dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800396dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700397default_driver="xlib"
398
399case "$host_os" in
400linux*)
401 case "$host_cpu" in
David S. Miller32dc28a2009-02-24 20:06:05 -0700402 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700403 esac
404 ;;
Julien Cristau98fcdf32008-10-28 18:56:05 +0100405*freebsd* | dragonfly*)
Eric Anholt711222b2008-04-18 15:03:01 -0700406 case "$host_cpu" in
Robert Noland48f05432009-04-10 11:41:27 -0500407 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700408 esac
409 ;;
410esac
411
Dan Nicholson297e16c2008-05-05 15:42:53 -0700412AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800413 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700414 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700415 [mesa_driver="$withval"],
416 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800417dnl Check for valid option
418case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800419xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800420 ;;
421*)
422 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
423 ;;
424esac
425
426dnl
427dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700428dnl
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800429
430dnl this variable will be prepended to SRC_DIRS and is not exported
431CORE_DIRS="glsl mesa"
432
433SRC_DIRS="glew"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700434GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800435WINDOW_SYSTEM=""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100436GALLIUM_DIRS="auxiliary drivers state_trackers"
Jerome Glisse14f79d42008-12-18 13:36:07 +0100437GALLIUM_WINSYS_DIRS=""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100438GALLIUM_WINSYS_DRM_DIRS=""
Jakob Bornecrantzd60b2c62009-06-24 02:42:41 +0200439GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100440GALLIUM_STATE_TRACKERS_DIRS=""
441
Dan Nicholson44d99142007-12-05 18:47:01 -0800442case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800443xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800444 DRIVER_DIRS="x11"
Jakob Bornecrantz373e6712009-04-18 23:13:56 +0100445 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
Dan Nicholson44d99142007-12-05 18:47:01 -0800446 ;;
447dri)
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800448 CORE_DIRS="glx/x11 $CORE_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100449 DRIVER_DIRS="dri"
Dan Nicholson44d99142007-12-05 18:47:01 -0800450 WINDOW_SYSTEM="dri"
Jakob Bornecrantz373e6712009-04-18 23:13:56 +0100451 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
Dan Nicholson44d99142007-12-05 18:47:01 -0800452 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800453osmesa)
454 DRIVER_DIRS="osmesa"
455 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800456esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700457AC_SUBST([SRC_DIRS])
458AC_SUBST([GLU_DIRS])
459AC_SUBST([DRIVER_DIRS])
460AC_SUBST([WINDOW_SYSTEM])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100461AC_SUBST([GALLIUM_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100462AC_SUBST([GALLIUM_WINSYS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100463AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +0000464AC_SUBST([GALLIUM_DRIVERS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100465AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700466
467dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800468dnl User supplied program configuration
469dnl
470if test -d "$srcdir/progs/demos"; then
471 default_demos=yes
472else
473 default_demos=no
474fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700475AC_ARG_WITH([demos],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800476 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
477 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800478 @<:@default=auto if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700479 [with_demos="$withval"],
480 [with_demos="$default_demos"])
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800481if test "x$with_demos" = x; then
482 with_demos=no
483fi
484
485dnl If $with_demos is yes, directories will be added as libs available
486PROGRAM_DIRS=""
487case "$with_demos" in
Dan Nicholsonb9576552008-03-10 14:05:46 -0700488no) ;;
489yes)
490 # If the driver isn't osmesa, we have libGL and can build xdemos
491 if test "$mesa_driver" != osmesa; then
492 PROGRAM_DIRS="xdemos"
493 fi
494 ;;
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800495*)
496 # verify the requested demos directories exist
497 demos=`IFS=,; echo $with_demos`
498 for demo in $demos; do
499 test -d "$srcdir/progs/$demo" || \
500 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
501 done
502 PROGRAM_DIRS="$demos"
503 ;;
504esac
505
506dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700507dnl Find out if X is available. The variable have_x is set if libX11 is
Dan Nicholson99803a42008-07-01 09:03:15 -0700508dnl found to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700509dnl
510if test -n "$PKG_CONFIG"; then
511 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700512 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700513 x11_pkgconfig=yes
514 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700515 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700516 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700517 ])
518 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700519else
520 x11_pkgconfig=no
521fi
522dnl Use the autoconf macro if no pkg-config files
523if test "$x11_pkgconfig" = no; then
524 AC_PATH_XTRA
525fi
526
Dan Nicholson99803a42008-07-01 09:03:15 -0700527dnl Try to tell the user that the --x-* options are only used when
528dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
529m4_divert_once([HELP_BEGIN],
530[These options are only used when the X libraries cannot be found by the
531pkg-config utility.])
532
Dan Nicholson44d99142007-12-05 18:47:01 -0800533dnl We need X for xlib and dri, so bomb now if it's not found
534case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800535xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800536 if test "$no_x" = yes; then
537 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
538 fi
539 ;;
540esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700541
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700542dnl XCB - this is only used for GLX right now
543AC_ARG_ENABLE([xcb],
544 [AS_HELP_STRING([--enable-xcb],
545 [use XCB for GLX @<:@default=disabled@:>@])],
546 [enable_xcb="$enableval"],
547 [enable_xcb=no])
548if test "x$enable_xcb" = xyes; then
549 DEFINES="$DEFINES -DUSE_XCB"
550else
551 enable_xcb=no
552fi
553
Dan Nicholson44d99142007-12-05 18:47:01 -0800554dnl
555dnl libGL configuration per driver
556dnl
557case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800558xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800559 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700560 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800561 GL_PC_REQ_PRIV="x11 xext"
Dan Nicholsona1307182007-12-12 17:49:49 -0800562 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
563 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800564 else
565 # should check these...
566 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
567 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800568 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
569 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson44d99142007-12-05 18:47:01 -0800570 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700571 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
572 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800573
574 # if static, move the external libraries to the programs
575 # and empty the libraries for libGL
576 if test "$enable_static" = yes; then
577 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
578 GL_LIB_DEPS=""
579 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800580 ;;
581dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800582 # DRI must be shared, I think
583 if test "$enable_static" = yes; then
584 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
585 fi
586
Dan Nicholson44d99142007-12-05 18:47:01 -0800587 # Check for libdrm
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -0700588 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
589 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
Jesse Barnesf2f83d92010-01-11 17:28:10 -0500590 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
Jesse Barnesed59b132010-01-13 15:48:14 -0500591 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
592 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
Dan Nicholson44d99142007-12-05 18:47:01 -0800593
594 # find the DRI deps for libGL
595 if test "$x11_pkgconfig" = yes; then
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700596 # add xcb modules if necessary
597 dri_modules="x11 xext xxf86vm xdamage xfixes"
598 if test "$enable_xcb" = yes; then
599 dri_modules="$dri_modules x11-xcb xcb-glx"
600 fi
601
602 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800603 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Dan Nicholson44d99142007-12-05 18:47:01 -0800604 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
605 GL_LIB_DEPS="$DRIGL_LIBS"
606 else
607 # should check these...
608 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
609 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800610 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
611 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700612
613 # XCB can only be used from pkg-config
614 if test "$enable_xcb" = yes; then
615 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800616 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700617 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
618 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
619 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800620 fi
621
622 # need DRM libs, -lpthread, etc.
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700623 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
624 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800625 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800626osmesa)
627 # No libGL for osmesa
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700628 GL_LIB_DEPS=""
Dan Nicholson979ff512007-12-05 18:47:01 -0800629 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800630esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700631AC_SUBST([GL_LIB_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800632AC_SUBST([GL_PC_REQ_PRIV])
633AC_SUBST([GL_PC_LIB_PRIV])
634AC_SUBST([GL_PC_CFLAGS])
635AC_SUBST([DRI_PC_REQ_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700636
637dnl
638dnl More X11 setup
639dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800640if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700641 DEFINES="$DEFINES -DUSE_XSHM"
642fi
643
644dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800645dnl More DRI setup
646dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700647AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800648 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800649 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700650 [GLX_USE_TLS="$enableval"],
651 [GLX_USE_TLS=no])
Dan Nicholson44d99142007-12-05 18:47:01 -0800652dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700653AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800654 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700655 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700656 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700657 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700658AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Chow Loong Jin35506de2009-10-28 14:34:14 +0800659dnl Extra search path for DRI drivers
660AC_ARG_WITH([dri-searchpath],
661 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
662 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
663 [DRI_DRIVER_SEARCH_DIR="$withval"],
664 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
665AC_SUBST([DRI_DRIVER_SEARCH_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800666dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700667AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800668 [AS_HELP_STRING([--disable-driglx-direct],
669 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700670 [driglx_direct="$enableval"],
671 [driglx_direct="yes"])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800672dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700673AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800674 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholson5cae1b72008-06-30 10:28:02 -0700675 [comma delimited DRI drivers list, e.g.
Michel Dänzercade0712009-07-10 14:49:46 +0200676 "swrast,i965,radeon" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700677 [with_dri_drivers="$withval"],
678 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800679if test "x$with_dri_drivers" = x; then
680 with_dri_drivers=no
681fi
682
683dnl If $with_dri_drivers is yes, directories will be added through
684dnl platform checks
685DRI_DIRS=""
686case "$with_dri_drivers" in
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100687no) ;;
688yes)
689 DRI_DIRS="yes"
690 ;;
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800691*)
692 # verify the requested driver directories exist
Dan Nicholsone6e4f252008-07-06 14:17:39 -0700693 dri_drivers=`IFS=', '; echo $with_dri_drivers`
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800694 for driver in $dri_drivers; do
695 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
696 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
697 done
698 DRI_DIRS="$dri_drivers"
699 ;;
700esac
701
Dan Nicholson44d99142007-12-05 18:47:01 -0800702dnl Just default to no EGL for now
703USING_EGL=0
Dan Nicholson297e16c2008-05-05 15:42:53 -0700704AC_SUBST([USING_EGL])
Dan Nicholson44d99142007-12-05 18:47:01 -0800705
706dnl Set DRI_DIRS, DEFINES and LIB_DEPS
707if test "$mesa_driver" = dri; then
708 # Use TLS in GLX?
709 if test "x$GLX_USE_TLS" = xyes; then
710 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
711 fi
712
713 if test "x$USING_EGL" = x1; then
714 PROGRAM_DIRS="egl"
715 fi
716
717 # Platform specific settings and drivers to build
718 case "$host_os" in
719 linux*)
720 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
Dan Nicholson44d99142007-12-05 18:47:01 -0800721 if test "x$driglx_direct" = xyes; then
722 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
723 fi
Jerome Glisse14f79d42008-12-18 13:36:07 +0100724 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800725
726 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800727 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800728 # ffb, gamma, and sis are missing because they have not be
729 # converted to use the new interface. i810 are missing
730 # because there is no x86-64 system where they could *ever*
731 # be used.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100732 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400733 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +0300734 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800735 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800736 ;;
737 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800738 # Build only the drivers for cards that exist on PowerPC.
739 # At some point MGA will be added, but not yet.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100740 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400741 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800742 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800743 ;;
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000744 sparc*)
745 # Build only the drivers for cards that exist on sparc`
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100746 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400747 DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000748 fi
749 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800750 esac
751 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700752 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800753 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
754 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
755 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
756 if test "x$driglx_direct" = xyes; then
757 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
758 fi
759 if test "x$GXX" = xyes; then
760 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
761 fi
762
Dan Nicholsona76e2452007-12-07 11:25:08 -0800763 # ffb and gamma are missing because they have not been converted
764 # to use the new interface.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100765 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400766 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +0300767 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800768 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800769 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700770 gnu*)
771 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
772 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
773 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700774 solaris*)
775 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
776 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
777 if test "x$driglx_direct" = xyes; then
778 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
779 fi
780 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800781 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800782
783 # default drivers
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100784 if test "x$DRI_DIRS" = "xyes"; then
Corbin Simpson8e4657a2009-10-22 12:29:30 -0700785 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
Corbin Simpsonfd7ee2b2009-10-22 12:57:13 -0700786 savage sis tdfx unichrome ffb swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -0800787 fi
788
Dan Nicholson44d99142007-12-05 18:47:01 -0800789 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
790
791 # Check for expat
792 EXPAT_INCLUDES=""
793 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700794 AC_ARG_WITH([expat],
795 [AS_HELP_STRING([--with-expat=DIR],
796 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800797 EXPAT_INCLUDES="-I$withval/include"
798 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
799 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
800 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
801 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700802 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
803 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
804 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800805
806 # put all the necessary libs together
Eric Anholt050c5332008-03-20 17:28:58 -0700807 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800808fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700809AC_SUBST([DRI_DIRS])
810AC_SUBST([EXPAT_INCLUDES])
811AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800812
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500813case $DRI_DIRS in
814*i915*|*i965*)
815 PKG_CHECK_MODULES([INTEL], [libdrm_intel])
816 ;;
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -0500817esac
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500818
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -0500819case $DRI_DIRS in
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500820*radeon*|*r200*|*r300*|*r600*)
821 PKG_CHECK_MODULES([LIBDRM_RADEON],
822 [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
823 HAVE_LIBDRM_RADEON=yes,
824 HAVE_LIBDRM_RADEON=no)
825
826 if test "$HAVE_LIBDRM_RADEON" = yes; then
827 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
828 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
829 fi
830 ;;
831esac
832AC_SUBST([RADEON_CFLAGS])
833AC_SUBST([RADEON_LDFLAGS])
834
835
Dan Nicholson44d99142007-12-05 18:47:01 -0800836dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700837dnl OSMesa configuration
838dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800839if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800840 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800841else
Dan Nicholson544ab202007-12-30 08:41:53 -0800842 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800843fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700844AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800845 [AS_HELP_STRING([--enable-gl-osmesa],
846 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700847 [gl_osmesa="$enableval"],
848 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800849if test "x$gl_osmesa" = xyes; then
850 if test "$mesa_driver" = osmesa; then
851 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800852 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800853 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800854 fi
855fi
856
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800857dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700858AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800859 [AS_HELP_STRING([--with-osmesa-bits=BITS],
860 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700861 [osmesa_bits="$withval"],
862 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800863if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
864 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
865 osmesa_bits=8
866fi
867case "x$osmesa_bits" in
868x8)
869 OSMESA_LIB=OSMesa
870 ;;
871x16|x32)
872 OSMESA_LIB="OSMesa$osmesa_bits"
873 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
874 ;;
875*)
876 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
877 ;;
878esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700879AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800880
Dan Nicholson979ff512007-12-05 18:47:01 -0800881case "$mesa_driver" in
882osmesa)
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700883 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800884 if test "$enable_static" = no; then
Dan Nicholson4795dd52009-06-04 19:42:08 -0700885 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800886 else
887 OSMESA_LIB_DEPS=""
888 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800889 OSMESA_MESA_DEPS=""
Dan Nicholson4795dd52009-06-04 19:42:08 -0700890 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -0800891 ;;
892*)
893 # Link OSMesa to libGL otherwise
894 OSMESA_LIB_DEPS=""
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700895 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800896 if test "$enable_static" = no; then
897 OSMESA_MESA_DEPS='-l$(GL_LIB)'
898 else
899 OSMESA_MESA_DEPS=""
900 fi
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800901 OSMESA_PC_REQ="gl"
Dan Nicholson979ff512007-12-05 18:47:01 -0800902 ;;
903esac
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700904OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700905AC_SUBST([OSMESA_LIB_DEPS])
906AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800907AC_SUBST([OSMESA_PC_REQ])
908AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700909
910dnl
Dan Nicholson53b37342009-02-25 17:45:34 -0800911dnl EGL configuration
912dnl
Dan Nicholson66f97862009-04-29 12:11:43 -0700913AC_ARG_ENABLE([egl],
914 [AS_HELP_STRING([--disable-egl],
915 [disable EGL library @<:@default=enabled@:>@])],
916 [enable_egl="$enableval"],
917 [enable_egl=yes])
918if test "x$enable_egl" = xyes; then
919 SRC_DIRS="$SRC_DIRS egl"
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800920 EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
921 EGL_DRIVERS_DIRS=""
922 if test "$enable_static" != yes && test "$mesa_driver" != osmesa; then
923 # build egl_glx when libGL is built
924 EGL_DRIVERS_DIRS="glx"
Dan Nicholson66f97862009-04-29 12:11:43 -0700925 fi
Dan Nicholson53b37342009-02-25 17:45:34 -0800926fi
Dan Nicholson53b37342009-02-25 17:45:34 -0800927AC_SUBST([EGL_LIB_DEPS])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800928AC_SUBST([EGL_DRIVERS_DIRS])
Dan Nicholson53b37342009-02-25 17:45:34 -0800929
930dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700931dnl GLU configuration
932dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700933AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800934 [AS_HELP_STRING([--disable-glu],
935 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700936 [enable_glu="$enableval"],
937 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700938if test "x$enable_glu" = xyes; then
939 SRC_DIRS="$SRC_DIRS glu"
940
Dan Nicholson979ff512007-12-05 18:47:01 -0800941 case "$mesa_driver" in
942 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800943 # If GLU is available and we have libOSMesa (not 16 or 32),
944 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800945 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800946 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
947 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700948
Dan Nicholson979ff512007-12-05 18:47:01 -0800949 # Link libGLU to libOSMesa instead of libGL
950 GLU_LIB_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800951 GLU_PC_REQ="osmesa"
Dan Nicholson88586332007-11-15 08:59:57 -0800952 if test "$enable_static" = no; then
953 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
954 else
955 GLU_MESA_DEPS=""
956 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800957 ;;
958 *)
Dan Nicholson88586332007-11-15 08:59:57 -0800959 # If static, empty GLU_LIB_DEPS and add libs for programs to link
Dan Nicholson71e208b2008-11-24 11:01:57 -0800960 GLU_PC_REQ="gl"
961 GLU_PC_LIB_PRIV="-lm"
Dan Nicholson88586332007-11-15 08:59:57 -0800962 if test "$enable_static" = no; then
963 GLU_LIB_DEPS="-lm"
964 GLU_MESA_DEPS='-l$(GL_LIB)'
965 else
966 GLU_LIB_DEPS=""
967 GLU_MESA_DEPS=""
968 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
969 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800970 ;;
971 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700972fi
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700973if test "$enable_static" = no; then
974 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
975fi
Dan Nicholson71e208b2008-11-24 11:01:57 -0800976GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700977AC_SUBST([GLU_LIB_DEPS])
978AC_SUBST([GLU_MESA_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800979AC_SUBST([GLU_PC_REQ])
980AC_SUBST([GLU_PC_REQ_PRIV])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800981AC_SUBST([GLU_PC_LIB_PRIV])
982AC_SUBST([GLU_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700983
984dnl
985dnl GLw configuration
986dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700987AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800988 [AS_HELP_STRING([--disable-glw],
989 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700990 [enable_glw="$enableval"],
991 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -0800992dnl Don't build GLw on osmesa
993if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
994 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
995 enable_glw=no
996fi
Dan Nicholson776c60d2008-07-18 07:40:41 -0700997AC_ARG_ENABLE([motif],
998 [AS_HELP_STRING([--enable-motif],
999 [use Motif widgets in GLw @<:@default=disabled@:>@])],
1000 [enable_motif="$enableval"],
1001 [enable_motif=no])
1002
Dan Nicholsondca1b792007-10-23 09:25:58 -07001003if test "x$enable_glw" = xyes; then
1004 SRC_DIRS="$SRC_DIRS glw"
1005 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001006 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001007 GLW_PC_REQ_PRIV="x11 xt"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001008 GLW_LIB_DEPS="$GLW_LIBS"
1009 else
1010 # should check these...
Dan Nicholson776c60d2008-07-18 07:40:41 -07001011 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001012 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1013 GLW_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001014 fi
1015
1016 GLW_SOURCES="GLwDrawA.c"
1017 MOTIF_CFLAGS=
1018 if test "x$enable_motif" = xyes; then
1019 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1020 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1021 if test "x$MOTIF_CONFIG" != xno; then
1022 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1023 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1024 else
1025 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1026 [AC_MSG_ERROR([Can't locate Motif headers])])
1027 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1028 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1029 fi
1030 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1031 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001032 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1033 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001034 fi
1035
Dan Nicholson88586332007-11-15 08:59:57 -08001036 # If static, empty GLW_LIB_DEPS and add libs for programs to link
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001037 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
Dan Nicholson88586332007-11-15 08:59:57 -08001038 if test "$enable_static" = no; then
1039 GLW_MESA_DEPS='-l$(GL_LIB)'
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001040 GLW_LIB_DEPS="$GLW_LIB_DEPS"
Dan Nicholson88586332007-11-15 08:59:57 -08001041 else
1042 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1043 GLW_LIB_DEPS=""
1044 GLW_MESA_DEPS=""
1045 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001046fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001047AC_SUBST([GLW_LIB_DEPS])
1048AC_SUBST([GLW_MESA_DEPS])
Dan Nicholson776c60d2008-07-18 07:40:41 -07001049AC_SUBST([GLW_SOURCES])
1050AC_SUBST([MOTIF_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001051AC_SUBST([GLW_PC_REQ_PRIV])
1052AC_SUBST([GLW_PC_LIB_PRIV])
1053AC_SUBST([GLW_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001054
1055dnl
1056dnl GLUT configuration
1057dnl
1058if test -f "$srcdir/include/GL/glut.h"; then
1059 default_glut=yes
1060else
1061 default_glut=no
1062fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001063AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001064 [AS_HELP_STRING([--disable-glut],
1065 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001066 [enable_glut="$enableval"],
1067 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001068
1069dnl Can't build glut if GLU not available
1070if test "x$enable_glu$enable_glut" = xnoyes; then
1071 AC_MSG_WARN([Disabling glut since GLU is disabled])
1072 enable_glut=no
1073fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001074dnl Don't build glut on osmesa
1075if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1076 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1077 enable_glut=no
1078fi
1079
Dan Nicholsondca1b792007-10-23 09:25:58 -07001080if test "x$enable_glut" = xyes; then
1081 SRC_DIRS="$SRC_DIRS glut/glx"
1082 GLUT_CFLAGS=""
1083 if test "x$GCC" = xyes; then
1084 GLUT_CFLAGS="-fexceptions"
1085 fi
1086 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001087 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001088 GLUT_PC_REQ_PRIV="x11 xmu xi"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001089 GLUT_LIB_DEPS="$GLUT_LIBS"
1090 else
1091 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -08001092 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001093 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1094 GLUT_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001095 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001096 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1097 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001098
1099 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -08001100 if test "$with_demos" = yes; then
1101 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
1102 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001103
Dan Nicholson88586332007-11-15 08:59:57 -08001104 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1105 if test "$enable_static" = no; then
1106 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1107 else
1108 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1109 GLUT_LIB_DEPS=""
1110 GLUT_MESA_DEPS=""
1111 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001112fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001113AC_SUBST([GLUT_LIB_DEPS])
1114AC_SUBST([GLUT_MESA_DEPS])
1115AC_SUBST([GLUT_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001116AC_SUBST([GLUT_PC_REQ_PRIV])
1117AC_SUBST([GLUT_PC_LIB_PRIV])
1118AC_SUBST([GLUT_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001119
1120dnl
1121dnl Program library dependencies
1122dnl Only libm is added here if necessary as the libraries should
1123dnl be pulled in by the linker
1124dnl
1125if test "x$APP_LIB_DEPS" = x; then
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001126 case "$host_os" in
1127 solaris*)
1128 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1129 ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +01001130 cygwin*)
1131 APP_LIB_DEPS="-lX11"
1132 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001133 *)
1134 APP_LIB_DEPS="-lm"
1135 ;;
1136 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001137fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001138AC_SUBST([APP_LIB_DEPS])
1139AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001140
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001141dnl
1142dnl Gallium configuration
1143dnl
1144AC_ARG_ENABLE([gallium],
1145 [AS_HELP_STRING([--disable-gallium],
1146 [build gallium @<:@default=enabled@:>@])],
1147 [enable_gallium="$enableval"],
1148 [enable_gallium=yes])
1149if test "x$enable_gallium" = xyes; then
1150 SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
1151fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001152
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001153dnl
1154dnl Gallium state trackers configuration
1155dnl
1156AC_ARG_WITH([state-trackers],
1157 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1158 [comma delimited state_trackers list, e.g.
1159 "egl,glx" @<:@default=auto@:>@])],
1160 [with_state_trackers="$withval"],
1161 [with_state_trackers=yes])
1162
1163case "$with_state_trackers" in
1164no)
1165 GALLIUM_STATE_TRACKERS_DIRS=""
1166 ;;
1167yes)
1168 # look at what else is built
1169 case "$mesa_driver" in
Jakob Bornecrantz373e6712009-04-18 23:13:56 +01001170 xlib)
1171 GALLIUM_STATE_TRACKERS_DIRS=glx
1172 ;;
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001173 dri)
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001174 GALLIUM_STATE_TRACKERS_DIRS="dri"
1175 if test "x$enable_egl" = xyes; then
Chia-I Wu077d6dd2010-01-10 23:08:39 +08001176 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl egl_g3d"
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001177 fi
1178 # Have only tested st/xorg on 1.6.0 servers
1179 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0],
1180 HAVE_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1181 HAVE_XORG="no")
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001182 ;;
1183 esac
1184 ;;
1185*)
1186 # verify the requested state tracker exist
1187 state_trackers=`IFS=', '; echo $with_state_trackers`
1188 for tracker in $state_trackers; do
1189 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1190 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
Dan Nicholson66f97862009-04-29 12:11:43 -07001191
Chia-I Wue5d351d2009-12-23 11:18:00 +08001192 case "$tracker" in
1193 egl)
1194 if test "x$enable_egl" != xyes; then
1195 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1196 fi
1197 ;;
1198 xorg)
Dave Airliee9d6ab72009-09-21 13:26:48 +10001199 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
Jakob Bornecrantz5c4bdbd2009-10-15 01:24:53 +01001200 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
Dave Airliee9d6ab72009-09-21 13:26:48 +10001201 HAVE_XEXTPROTO_71="no")
Chia-I Wue5d351d2009-12-23 11:18:00 +08001202 ;;
1203 es)
1204 # mesa/es is required to build es state tracker
Chia-I Wu99a37ed2010-01-05 17:39:05 +08001205 CORE_DIRS="$CORE_DIRS mesa/es"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001206 ;;
1207 esac
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001208 done
1209 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1210 ;;
1211esac
1212
Chia-I Wu49381d62010-01-11 01:23:01 +08001213AC_ARG_WITH([egl-displays],
1214 [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
1215 [comma delimited native displays libEGL supports, e.g.
Chia-I Wua68b51d2010-01-03 19:24:04 +08001216 "x11,kms" @<:@default=auto@:>@])],
Chia-I Wu49381d62010-01-11 01:23:01 +08001217 [with_egl_displays="$withval"],
1218 [with_egl_displays=yes])
1219
1220EGL_DISPLAYS=""
1221case "$with_egl_displays" in
1222yes)
1223 if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
1224 EGL_DISPLAYS="x11"
1225 fi
1226 ;;
1227*)
1228 if test "x$enable_egl" != xyes; then
1229 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1230 fi
1231 # verify the requested driver directories exist
1232 egl_displays=`IFS=', '; echo $with_egl_displays`
1233 for dpy in $egl_displays; do
1234 test -d "$srcdir/src/gallium/state_trackers/egl_g3d/$dpy" || \
1235 AC_MSG_ERROR([EGL display '$dpy' does't exist])
1236 done
1237 EGL_DISPLAYS="$egl_displays"
1238 ;;
1239esac
1240AC_SUBST([EGL_DISPLAYS])
1241
Joel Bosveld8acca482009-03-06 08:46:08 +09001242AC_ARG_WITH([xorg-driver-dir],
1243 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1244 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1245 [XORG_DRIVER_INSTALL_DIR="$withval"],
1246 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1247AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1248
Tom Fogal7085dce2009-08-13 19:40:30 -06001249AC_ARG_WITH([max-width],
1250 [AS_HELP_STRING([--with-max-width=N],
1251 [Maximum framebuffer width (4096)])],
1252 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1253 AS_IF([test "${withval}" -gt "4096"],
1254 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1255)
1256AC_ARG_WITH([max-height],
1257 [AS_HELP_STRING([--with-max-height=N],
1258 [Maximum framebuffer height (4096)])],
1259 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1260 AS_IF([test "${withval}" -gt "4096"],
1261 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1262)
1263
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001264dnl
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001265dnl Gallium SVGA configuration
1266dnl
1267AC_ARG_ENABLE([gallium-svga],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001268 [AS_HELP_STRING([--enable-gallium-svga],
1269 [build gallium SVGA @<:@default=disabled@:>@])],
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001270 [enable_gallium_svga="$enableval"],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001271 [enable_gallium_svga=auto])
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001272if test "x$enable_gallium_svga" = xyes; then
1273 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
1274 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001275elif test "x$enable_gallium_svga" = xauto; then
1276 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001277fi
1278
1279dnl
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001280dnl Gallium Intel configuration
1281dnl
1282AC_ARG_ENABLE([gallium-intel],
Jakob Bornecrantz8ac25032009-12-04 16:01:41 +00001283 [AS_HELP_STRING([--enable-gallium-intel],
1284 [build gallium intel @<:@default=disabled@:>@])],
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001285 [enable_gallium_intel="$enableval"],
Jakob Bornecrantz8ac25032009-12-04 16:01:41 +00001286 [enable_gallium_intel=auto])
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001287if test "x$enable_gallium_intel" = xyes; then
Jakob Bornecrantzce4f23a2009-11-04 23:02:13 +00001288 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel i965"
1289 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
Jakob Bornecrantz8ac25032009-12-04 16:01:41 +00001290elif test "x$enable_gallium_intel" = xauto; then
Keith Whitwellaa026832009-12-22 09:40:39 +00001291 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001292fi
1293
1294dnl
1295dnl Gallium Radeon configuration
1296dnl
1297AC_ARG_ENABLE([gallium-radeon],
1298 [AS_HELP_STRING([--enable-gallium-radeon],
1299 [build gallium radeon @<:@default=disabled@:>@])],
1300 [enable_gallium_radeon="$enableval"],
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001301 [enable_gallium_radeon=auto])
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001302if test "x$enable_gallium_radeon" = xyes; then
1303 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001304 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001305elif test "x$enable_gallium_radeon" = xauto; then
1306 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001307fi
1308
1309dnl
Thierry Vignaud1402ea82009-09-14 11:48:51 -06001310dnl Gallium Nouveau configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001311dnl
1312AC_ARG_ENABLE([gallium-nouveau],
1313 [AS_HELP_STRING([--enable-gallium-nouveau],
1314 [build gallium nouveau @<:@default=disabled@:>@])],
1315 [enable_gallium_nouveau="$enableval"],
1316 [enable_gallium_nouveau=no])
1317if test "x$enable_gallium_nouveau" = xyes; then
1318 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
Ben Skeggsbc466be2009-06-04 10:19:04 +10001319 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001320fi
1321
Chia-I Wu99a37ed2010-01-05 17:39:05 +08001322dnl prepend CORE_DIRS to SRC_DIRS
1323SRC_DIRS="$CORE_DIRS $SRC_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001324
Dan Nicholsondca1b792007-10-23 09:25:58 -07001325dnl Restore LDFLAGS and CPPFLAGS
1326LDFLAGS="$_SAVE_LDFLAGS"
1327CPPFLAGS="$_SAVE_CPPFLAGS"
1328
1329dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -08001330AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001331
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001332dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001333AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001334if test -f configs/current || test -L configs/current; then
1335 rm -f configs/current
1336fi
1337ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001338])
1339
1340AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001341
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001342dnl
1343dnl Output some configuration info for the user
1344dnl
1345echo ""
1346echo " prefix: $prefix"
1347echo " exec_prefix: $exec_prefix"
1348echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07001349echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001350
1351dnl Driver info
1352echo ""
1353echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -08001354if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1355 echo " OSMesa: lib$OSMESA_LIB"
1356else
1357 echo " OSMesa: no"
1358fi
1359if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001360 # cleanup the drivers var
1361 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001362if test "x$DRI_DIRS" = x; then
1363 echo " DRI drivers: no"
1364else
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001365 echo " DRI drivers: $dri_dirs"
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001366fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001367 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -08001368fi
RALOVICH, Kristóf5f19f5c2008-11-04 11:53:32 +01001369echo " Use XCB: $enable_xcb"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001370
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001371echo ""
1372if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1373 echo " Gallium: yes"
1374 echo " Gallium dirs: $GALLIUM_DIRS"
1375 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001376 echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001377 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001378 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1379else
1380 echo " Gallium: no"
1381fi
1382
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001383dnl Libraries
1384echo ""
1385echo " Shared libs: $enable_shared"
1386echo " Static libs: $enable_static"
Dan Nicholson66f97862009-04-29 12:11:43 -07001387echo " EGL: $enable_egl"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001388echo " GLU: $enable_glu"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001389echo " GLw: $enable_glw (Motif: $enable_motif)"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001390echo " glut: $enable_glut"
1391
1392dnl Programs
1393# cleanup the programs var for display
1394program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1395if test "x$program_dirs" = x; then
1396 echo " Demos: no"
1397else
1398 echo " Demos: $program_dirs"
1399fi
1400
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001401dnl Compiler options
1402# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1403cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1404 $SED 's/^ *//;s/ */ /;s/ *$//'`
1405cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1406 $SED 's/^ *//;s/ */ /;s/ *$//'`
1407defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1408echo ""
1409echo " CFLAGS: $cflags"
1410echo " CXXFLAGS: $cxxflags"
1411echo " Macros: $defines"
1412
Dan Nicholsondca1b792007-10-23 09:25:58 -07001413echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07001414echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001415echo ""