blob: d6e32f590aada750d108aea824f647c9e6fb4478 [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 Set DRI_DIRS, DEFINES and LIB_DEPS
703if test "$mesa_driver" = dri; then
704 # Use TLS in GLX?
705 if test "x$GLX_USE_TLS" = xyes; then
706 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
707 fi
708
Dan Nicholson44d99142007-12-05 18:47:01 -0800709 # Platform specific settings and drivers to build
710 case "$host_os" in
711 linux*)
712 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
Dan Nicholson44d99142007-12-05 18:47:01 -0800713 if test "x$driglx_direct" = xyes; then
714 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
715 fi
Jerome Glisse14f79d42008-12-18 13:36:07 +0100716 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800717
718 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800719 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800720 # ffb, gamma, and sis are missing because they have not be
721 # converted to use the new interface. i810 are missing
722 # because there is no x86-64 system where they could *ever*
723 # be used.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100724 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400725 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +0300726 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800727 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800728 ;;
729 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800730 # Build only the drivers for cards that exist on PowerPC.
731 # At some point MGA will be added, but not yet.
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="mach64 r128 r200 r300 r600 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800734 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800735 ;;
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000736 sparc*)
737 # Build only the drivers for cards that exist on sparc`
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100738 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400739 DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000740 fi
741 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800742 esac
743 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700744 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800745 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
746 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
747 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
748 if test "x$driglx_direct" = xyes; then
749 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
750 fi
751 if test "x$GXX" = xyes; then
752 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
753 fi
754
Dan Nicholsona76e2452007-12-07 11:25:08 -0800755 # ffb and gamma are missing because they have not been converted
756 # to use the new interface.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100757 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400758 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +0300759 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800760 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800761 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700762 gnu*)
763 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
764 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
765 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700766 solaris*)
767 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
768 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
769 if test "x$driglx_direct" = xyes; then
770 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
771 fi
772 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800773 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800774
775 # default drivers
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100776 if test "x$DRI_DIRS" = "xyes"; then
Corbin Simpson8e4657a2009-10-22 12:29:30 -0700777 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
Corbin Simpsonfd7ee2b2009-10-22 12:57:13 -0700778 savage sis tdfx unichrome ffb swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -0800779 fi
780
Dan Nicholson44d99142007-12-05 18:47:01 -0800781 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
782
783 # Check for expat
784 EXPAT_INCLUDES=""
785 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700786 AC_ARG_WITH([expat],
787 [AS_HELP_STRING([--with-expat=DIR],
788 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800789 EXPAT_INCLUDES="-I$withval/include"
790 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
791 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
792 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
793 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700794 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
795 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
796 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800797
798 # put all the necessary libs together
Eric Anholt050c5332008-03-20 17:28:58 -0700799 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800800fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700801AC_SUBST([DRI_DIRS])
802AC_SUBST([EXPAT_INCLUDES])
803AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800804
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500805case $DRI_DIRS in
806*i915*|*i965*)
807 PKG_CHECK_MODULES([INTEL], [libdrm_intel])
808 ;;
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -0500809esac
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500810
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -0500811case $DRI_DIRS in
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500812*radeon*|*r200*|*r300*|*r600*)
813 PKG_CHECK_MODULES([LIBDRM_RADEON],
814 [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
815 HAVE_LIBDRM_RADEON=yes,
816 HAVE_LIBDRM_RADEON=no)
817
818 if test "$HAVE_LIBDRM_RADEON" = yes; then
819 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
820 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
821 fi
822 ;;
823esac
824AC_SUBST([RADEON_CFLAGS])
825AC_SUBST([RADEON_LDFLAGS])
826
827
Dan Nicholson44d99142007-12-05 18:47:01 -0800828dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700829dnl OSMesa configuration
830dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800831if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800832 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800833else
Dan Nicholson544ab202007-12-30 08:41:53 -0800834 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800835fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700836AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800837 [AS_HELP_STRING([--enable-gl-osmesa],
838 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700839 [gl_osmesa="$enableval"],
840 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800841if test "x$gl_osmesa" = xyes; then
842 if test "$mesa_driver" = osmesa; then
843 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800844 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800845 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800846 fi
847fi
848
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800849dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700850AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800851 [AS_HELP_STRING([--with-osmesa-bits=BITS],
852 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700853 [osmesa_bits="$withval"],
854 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800855if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
856 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
857 osmesa_bits=8
858fi
859case "x$osmesa_bits" in
860x8)
861 OSMESA_LIB=OSMesa
862 ;;
863x16|x32)
864 OSMESA_LIB="OSMesa$osmesa_bits"
865 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
866 ;;
867*)
868 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
869 ;;
870esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700871AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800872
Dan Nicholson979ff512007-12-05 18:47:01 -0800873case "$mesa_driver" in
874osmesa)
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700875 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800876 if test "$enable_static" = no; then
Dan Nicholson4795dd52009-06-04 19:42:08 -0700877 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800878 else
879 OSMESA_LIB_DEPS=""
880 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800881 OSMESA_MESA_DEPS=""
Dan Nicholson4795dd52009-06-04 19:42:08 -0700882 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -0800883 ;;
884*)
885 # Link OSMesa to libGL otherwise
886 OSMESA_LIB_DEPS=""
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700887 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800888 if test "$enable_static" = no; then
889 OSMESA_MESA_DEPS='-l$(GL_LIB)'
890 else
891 OSMESA_MESA_DEPS=""
892 fi
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800893 OSMESA_PC_REQ="gl"
Dan Nicholson979ff512007-12-05 18:47:01 -0800894 ;;
895esac
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700896OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700897AC_SUBST([OSMESA_LIB_DEPS])
898AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800899AC_SUBST([OSMESA_PC_REQ])
900AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700901
902dnl
Dan Nicholson53b37342009-02-25 17:45:34 -0800903dnl EGL configuration
904dnl
Dan Nicholson66f97862009-04-29 12:11:43 -0700905AC_ARG_ENABLE([egl],
906 [AS_HELP_STRING([--disable-egl],
907 [disable EGL library @<:@default=enabled@:>@])],
908 [enable_egl="$enableval"],
909 [enable_egl=yes])
910if test "x$enable_egl" = xyes; then
911 SRC_DIRS="$SRC_DIRS egl"
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800912 EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
913 EGL_DRIVERS_DIRS=""
914 if test "$enable_static" != yes && test "$mesa_driver" != osmesa; then
915 # build egl_glx when libGL is built
916 EGL_DRIVERS_DIRS="glx"
Dan Nicholson66f97862009-04-29 12:11:43 -0700917 fi
Dan Nicholson53b37342009-02-25 17:45:34 -0800918fi
Dan Nicholson53b37342009-02-25 17:45:34 -0800919AC_SUBST([EGL_LIB_DEPS])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800920AC_SUBST([EGL_DRIVERS_DIRS])
Dan Nicholson53b37342009-02-25 17:45:34 -0800921
922dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700923dnl GLU configuration
924dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700925AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800926 [AS_HELP_STRING([--disable-glu],
927 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700928 [enable_glu="$enableval"],
929 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700930if test "x$enable_glu" = xyes; then
931 SRC_DIRS="$SRC_DIRS glu"
932
Dan Nicholson979ff512007-12-05 18:47:01 -0800933 case "$mesa_driver" in
934 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800935 # If GLU is available and we have libOSMesa (not 16 or 32),
936 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800937 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800938 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
939 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700940
Dan Nicholson979ff512007-12-05 18:47:01 -0800941 # Link libGLU to libOSMesa instead of libGL
942 GLU_LIB_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800943 GLU_PC_REQ="osmesa"
Dan Nicholson88586332007-11-15 08:59:57 -0800944 if test "$enable_static" = no; then
945 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
946 else
947 GLU_MESA_DEPS=""
948 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800949 ;;
950 *)
Dan Nicholson88586332007-11-15 08:59:57 -0800951 # If static, empty GLU_LIB_DEPS and add libs for programs to link
Dan Nicholson71e208b2008-11-24 11:01:57 -0800952 GLU_PC_REQ="gl"
953 GLU_PC_LIB_PRIV="-lm"
Dan Nicholson88586332007-11-15 08:59:57 -0800954 if test "$enable_static" = no; then
955 GLU_LIB_DEPS="-lm"
956 GLU_MESA_DEPS='-l$(GL_LIB)'
957 else
958 GLU_LIB_DEPS=""
959 GLU_MESA_DEPS=""
960 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
961 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800962 ;;
963 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700964fi
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700965if test "$enable_static" = no; then
966 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
967fi
Dan Nicholson71e208b2008-11-24 11:01:57 -0800968GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700969AC_SUBST([GLU_LIB_DEPS])
970AC_SUBST([GLU_MESA_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800971AC_SUBST([GLU_PC_REQ])
972AC_SUBST([GLU_PC_REQ_PRIV])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800973AC_SUBST([GLU_PC_LIB_PRIV])
974AC_SUBST([GLU_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700975
976dnl
977dnl GLw configuration
978dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700979AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800980 [AS_HELP_STRING([--disable-glw],
981 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700982 [enable_glw="$enableval"],
983 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -0800984dnl Don't build GLw on osmesa
985if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
986 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
987 enable_glw=no
988fi
Dan Nicholson776c60d2008-07-18 07:40:41 -0700989AC_ARG_ENABLE([motif],
990 [AS_HELP_STRING([--enable-motif],
991 [use Motif widgets in GLw @<:@default=disabled@:>@])],
992 [enable_motif="$enableval"],
993 [enable_motif=no])
994
Dan Nicholsondca1b792007-10-23 09:25:58 -0700995if test "x$enable_glw" = xyes; then
996 SRC_DIRS="$SRC_DIRS glw"
997 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700998 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800999 GLW_PC_REQ_PRIV="x11 xt"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001000 GLW_LIB_DEPS="$GLW_LIBS"
1001 else
1002 # should check these...
Dan Nicholson776c60d2008-07-18 07:40:41 -07001003 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001004 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1005 GLW_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001006 fi
1007
1008 GLW_SOURCES="GLwDrawA.c"
1009 MOTIF_CFLAGS=
1010 if test "x$enable_motif" = xyes; then
1011 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1012 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1013 if test "x$MOTIF_CONFIG" != xno; then
1014 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1015 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1016 else
1017 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1018 [AC_MSG_ERROR([Can't locate Motif headers])])
1019 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1020 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1021 fi
1022 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1023 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001024 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1025 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001026 fi
1027
Dan Nicholson88586332007-11-15 08:59:57 -08001028 # If static, empty GLW_LIB_DEPS and add libs for programs to link
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001029 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
Dan Nicholson88586332007-11-15 08:59:57 -08001030 if test "$enable_static" = no; then
1031 GLW_MESA_DEPS='-l$(GL_LIB)'
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001032 GLW_LIB_DEPS="$GLW_LIB_DEPS"
Dan Nicholson88586332007-11-15 08:59:57 -08001033 else
1034 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1035 GLW_LIB_DEPS=""
1036 GLW_MESA_DEPS=""
1037 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001038fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001039AC_SUBST([GLW_LIB_DEPS])
1040AC_SUBST([GLW_MESA_DEPS])
Dan Nicholson776c60d2008-07-18 07:40:41 -07001041AC_SUBST([GLW_SOURCES])
1042AC_SUBST([MOTIF_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001043AC_SUBST([GLW_PC_REQ_PRIV])
1044AC_SUBST([GLW_PC_LIB_PRIV])
1045AC_SUBST([GLW_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001046
1047dnl
1048dnl GLUT configuration
1049dnl
1050if test -f "$srcdir/include/GL/glut.h"; then
1051 default_glut=yes
1052else
1053 default_glut=no
1054fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001055AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001056 [AS_HELP_STRING([--disable-glut],
1057 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001058 [enable_glut="$enableval"],
1059 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001060
1061dnl Can't build glut if GLU not available
1062if test "x$enable_glu$enable_glut" = xnoyes; then
1063 AC_MSG_WARN([Disabling glut since GLU is disabled])
1064 enable_glut=no
1065fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001066dnl Don't build glut on osmesa
1067if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1068 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1069 enable_glut=no
1070fi
1071
Dan Nicholsondca1b792007-10-23 09:25:58 -07001072if test "x$enable_glut" = xyes; then
1073 SRC_DIRS="$SRC_DIRS glut/glx"
1074 GLUT_CFLAGS=""
1075 if test "x$GCC" = xyes; then
1076 GLUT_CFLAGS="-fexceptions"
1077 fi
1078 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001079 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001080 GLUT_PC_REQ_PRIV="x11 xmu xi"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001081 GLUT_LIB_DEPS="$GLUT_LIBS"
1082 else
1083 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -08001084 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001085 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1086 GLUT_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001087 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001088 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1089 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001090
1091 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -08001092 if test "$with_demos" = yes; then
1093 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
1094 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001095
Dan Nicholson88586332007-11-15 08:59:57 -08001096 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1097 if test "$enable_static" = no; then
1098 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1099 else
1100 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1101 GLUT_LIB_DEPS=""
1102 GLUT_MESA_DEPS=""
1103 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001104fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001105AC_SUBST([GLUT_LIB_DEPS])
1106AC_SUBST([GLUT_MESA_DEPS])
1107AC_SUBST([GLUT_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001108AC_SUBST([GLUT_PC_REQ_PRIV])
1109AC_SUBST([GLUT_PC_LIB_PRIV])
1110AC_SUBST([GLUT_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001111
1112dnl
1113dnl Program library dependencies
1114dnl Only libm is added here if necessary as the libraries should
1115dnl be pulled in by the linker
1116dnl
1117if test "x$APP_LIB_DEPS" = x; then
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001118 case "$host_os" in
1119 solaris*)
1120 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1121 ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +01001122 cygwin*)
1123 APP_LIB_DEPS="-lX11"
1124 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001125 *)
1126 APP_LIB_DEPS="-lm"
1127 ;;
1128 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001129fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001130AC_SUBST([APP_LIB_DEPS])
1131AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001132
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001133dnl
1134dnl Gallium configuration
1135dnl
1136AC_ARG_ENABLE([gallium],
1137 [AS_HELP_STRING([--disable-gallium],
1138 [build gallium @<:@default=enabled@:>@])],
1139 [enable_gallium="$enableval"],
1140 [enable_gallium=yes])
1141if test "x$enable_gallium" = xyes; then
1142 SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
1143fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001144
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001145dnl
1146dnl Gallium state trackers configuration
1147dnl
1148AC_ARG_WITH([state-trackers],
1149 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1150 [comma delimited state_trackers list, e.g.
1151 "egl,glx" @<:@default=auto@:>@])],
1152 [with_state_trackers="$withval"],
1153 [with_state_trackers=yes])
1154
1155case "$with_state_trackers" in
1156no)
1157 GALLIUM_STATE_TRACKERS_DIRS=""
1158 ;;
1159yes)
1160 # look at what else is built
1161 case "$mesa_driver" in
Jakob Bornecrantz373e6712009-04-18 23:13:56 +01001162 xlib)
1163 GALLIUM_STATE_TRACKERS_DIRS=glx
1164 ;;
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001165 dri)
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001166 GALLIUM_STATE_TRACKERS_DIRS="dri"
1167 if test "x$enable_egl" = xyes; then
Chia-I Wu52d7b2c2010-01-22 15:18:45 +08001168 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl_g3d"
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001169 fi
1170 # Have only tested st/xorg on 1.6.0 servers
1171 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0],
1172 HAVE_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1173 HAVE_XORG="no")
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001174 ;;
1175 esac
1176 ;;
1177*)
1178 # verify the requested state tracker exist
1179 state_trackers=`IFS=', '; echo $with_state_trackers`
1180 for tracker in $state_trackers; do
1181 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1182 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
Dan Nicholson66f97862009-04-29 12:11:43 -07001183
Chia-I Wue5d351d2009-12-23 11:18:00 +08001184 case "$tracker" in
Chia-I Wu52d7b2c2010-01-22 15:18:45 +08001185 egl_g3d)
Chia-I Wue5d351d2009-12-23 11:18:00 +08001186 if test "x$enable_egl" != xyes; then
Chia-I Wu52d7b2c2010-01-22 15:18:45 +08001187 AC_MSG_ERROR([cannot build egl_g3d state tracker without EGL library])
Chia-I Wue5d351d2009-12-23 11:18:00 +08001188 fi
1189 ;;
1190 xorg)
Dave Airliee9d6ab72009-09-21 13:26:48 +10001191 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
Jakob Bornecrantz5c4bdbd2009-10-15 01:24:53 +01001192 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
Dave Airliee9d6ab72009-09-21 13:26:48 +10001193 HAVE_XEXTPROTO_71="no")
Chia-I Wue5d351d2009-12-23 11:18:00 +08001194 ;;
1195 es)
1196 # mesa/es is required to build es state tracker
Chia-I Wu99a37ed2010-01-05 17:39:05 +08001197 CORE_DIRS="$CORE_DIRS mesa/es"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001198 ;;
1199 esac
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001200 done
1201 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1202 ;;
1203esac
1204
Chia-I Wu49381d62010-01-11 01:23:01 +08001205AC_ARG_WITH([egl-displays],
1206 [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
1207 [comma delimited native displays libEGL supports, e.g.
Chia-I Wua68b51d2010-01-03 19:24:04 +08001208 "x11,kms" @<:@default=auto@:>@])],
Chia-I Wu49381d62010-01-11 01:23:01 +08001209 [with_egl_displays="$withval"],
1210 [with_egl_displays=yes])
1211
1212EGL_DISPLAYS=""
1213case "$with_egl_displays" in
1214yes)
1215 if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
1216 EGL_DISPLAYS="x11"
1217 fi
1218 ;;
1219*)
1220 if test "x$enable_egl" != xyes; then
1221 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1222 fi
1223 # verify the requested driver directories exist
1224 egl_displays=`IFS=', '; echo $with_egl_displays`
1225 for dpy in $egl_displays; do
1226 test -d "$srcdir/src/gallium/state_trackers/egl_g3d/$dpy" || \
1227 AC_MSG_ERROR([EGL display '$dpy' does't exist])
1228 done
1229 EGL_DISPLAYS="$egl_displays"
1230 ;;
1231esac
1232AC_SUBST([EGL_DISPLAYS])
1233
Joel Bosveld8acca482009-03-06 08:46:08 +09001234AC_ARG_WITH([xorg-driver-dir],
1235 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1236 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1237 [XORG_DRIVER_INSTALL_DIR="$withval"],
1238 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1239AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1240
Tom Fogal7085dce2009-08-13 19:40:30 -06001241AC_ARG_WITH([max-width],
1242 [AS_HELP_STRING([--with-max-width=N],
1243 [Maximum framebuffer width (4096)])],
1244 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1245 AS_IF([test "${withval}" -gt "4096"],
1246 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1247)
1248AC_ARG_WITH([max-height],
1249 [AS_HELP_STRING([--with-max-height=N],
1250 [Maximum framebuffer height (4096)])],
1251 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1252 AS_IF([test "${withval}" -gt "4096"],
1253 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1254)
1255
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001256dnl
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001257dnl Gallium SVGA configuration
1258dnl
1259AC_ARG_ENABLE([gallium-svga],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001260 [AS_HELP_STRING([--enable-gallium-svga],
1261 [build gallium SVGA @<:@default=disabled@:>@])],
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001262 [enable_gallium_svga="$enableval"],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001263 [enable_gallium_svga=auto])
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001264if test "x$enable_gallium_svga" = xyes; then
1265 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
1266 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001267elif test "x$enable_gallium_svga" = xauto; then
1268 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001269fi
1270
1271dnl
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001272dnl Gallium Intel configuration
1273dnl
1274AC_ARG_ENABLE([gallium-intel],
Jakob Bornecrantz8ac25032009-12-04 16:01:41 +00001275 [AS_HELP_STRING([--enable-gallium-intel],
1276 [build gallium intel @<:@default=disabled@:>@])],
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001277 [enable_gallium_intel="$enableval"],
Jakob Bornecrantz8ac25032009-12-04 16:01:41 +00001278 [enable_gallium_intel=auto])
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001279if test "x$enable_gallium_intel" = xyes; then
Jakob Bornecrantzce4f23a2009-11-04 23:02:13 +00001280 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel i965"
1281 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
Jakob Bornecrantz8ac25032009-12-04 16:01:41 +00001282elif test "x$enable_gallium_intel" = xauto; then
Keith Whitwellaa026832009-12-22 09:40:39 +00001283 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001284fi
1285
1286dnl
1287dnl Gallium Radeon configuration
1288dnl
1289AC_ARG_ENABLE([gallium-radeon],
1290 [AS_HELP_STRING([--enable-gallium-radeon],
1291 [build gallium radeon @<:@default=disabled@:>@])],
1292 [enable_gallium_radeon="$enableval"],
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001293 [enable_gallium_radeon=auto])
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001294if test "x$enable_gallium_radeon" = xyes; then
1295 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001296 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001297elif test "x$enable_gallium_radeon" = xauto; then
1298 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001299fi
1300
1301dnl
Thierry Vignaud1402ea82009-09-14 11:48:51 -06001302dnl Gallium Nouveau configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001303dnl
1304AC_ARG_ENABLE([gallium-nouveau],
1305 [AS_HELP_STRING([--enable-gallium-nouveau],
1306 [build gallium nouveau @<:@default=disabled@:>@])],
1307 [enable_gallium_nouveau="$enableval"],
1308 [enable_gallium_nouveau=no])
1309if test "x$enable_gallium_nouveau" = xyes; then
1310 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
Ben Skeggsbc466be2009-06-04 10:19:04 +10001311 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001312fi
1313
Chia-I Wua1306f42010-01-22 15:51:51 +08001314dnl
1315dnl Gallium swrast configuration
1316dnl
1317AC_ARG_ENABLE([gallium-swrast],
1318 [AS_HELP_STRING([--enable-gallium-swrast],
1319 [build gallium swrast @<:@default=disabled@:>@])],
1320 [enable_gallium_swrast="$enableval"],
1321 [enable_gallium_swrast=auto])
1322if test "x$enable_gallium_swrast" = xyes; then
1323 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS swrast"
1324fi
1325
Chia-I Wu99a37ed2010-01-05 17:39:05 +08001326dnl prepend CORE_DIRS to SRC_DIRS
1327SRC_DIRS="$CORE_DIRS $SRC_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001328
Dan Nicholsondca1b792007-10-23 09:25:58 -07001329dnl Restore LDFLAGS and CPPFLAGS
1330LDFLAGS="$_SAVE_LDFLAGS"
1331CPPFLAGS="$_SAVE_CPPFLAGS"
1332
1333dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -08001334AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001335
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001336dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001337AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001338if test -f configs/current || test -L configs/current; then
1339 rm -f configs/current
1340fi
1341ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001342])
1343
1344AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001345
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001346dnl
1347dnl Output some configuration info for the user
1348dnl
1349echo ""
1350echo " prefix: $prefix"
1351echo " exec_prefix: $exec_prefix"
1352echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07001353echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001354
1355dnl Driver info
1356echo ""
1357echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -08001358if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1359 echo " OSMesa: lib$OSMESA_LIB"
1360else
1361 echo " OSMesa: no"
1362fi
1363if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001364 # cleanup the drivers var
1365 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001366if test "x$DRI_DIRS" = x; then
1367 echo " DRI drivers: no"
1368else
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001369 echo " DRI drivers: $dri_dirs"
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001370fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001371 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -08001372fi
RALOVICH, Kristóf5f19f5c2008-11-04 11:53:32 +01001373echo " Use XCB: $enable_xcb"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001374
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001375echo ""
1376if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1377 echo " Gallium: yes"
1378 echo " Gallium dirs: $GALLIUM_DIRS"
1379 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001380 echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001381 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001382 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1383else
1384 echo " Gallium: no"
1385fi
1386
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001387dnl Libraries
1388echo ""
1389echo " Shared libs: $enable_shared"
1390echo " Static libs: $enable_static"
Dan Nicholson66f97862009-04-29 12:11:43 -07001391echo " EGL: $enable_egl"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001392echo " GLU: $enable_glu"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001393echo " GLw: $enable_glw (Motif: $enable_motif)"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001394echo " glut: $enable_glut"
1395
1396dnl Programs
1397# cleanup the programs var for display
1398program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1399if test "x$program_dirs" = x; then
1400 echo " Demos: no"
1401else
1402 echo " Demos: $program_dirs"
1403fi
1404
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001405dnl Compiler options
1406# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1407cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1408 $SED 's/^ *//;s/ */ /;s/ *$//'`
1409cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1410 $SED 's/^ *//;s/ */ /;s/ *$//'`
1411defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1412echo ""
1413echo " CFLAGS: $cflags"
1414echo " CXXFLAGS: $cxxflags"
1415echo " Macros: $defines"
1416
Dan Nicholsondca1b792007-10-23 09:25:58 -07001417echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07001418echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001419echo ""