blob: f121002d4bee2352a18592fa138bac088ea162ea [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"
103 AC_MSG_CHECKING([whether $(CC) supports -fvisibility=hidden])
104 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
Sedat Dilek2f127e52009-12-17 19:14:53 +0100429SRC_DIRS="glsl mesa glew"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700430GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800431WINDOW_SYSTEM=""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100432GALLIUM_DIRS="auxiliary drivers state_trackers"
Jerome Glisse14f79d42008-12-18 13:36:07 +0100433GALLIUM_WINSYS_DIRS=""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100434GALLIUM_WINSYS_DRM_DIRS=""
Jakob Bornecrantzd60b2c62009-06-24 02:42:41 +0200435GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100436GALLIUM_STATE_TRACKERS_DIRS=""
437
Dan Nicholson44d99142007-12-05 18:47:01 -0800438case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800439xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800440 DRIVER_DIRS="x11"
Jakob Bornecrantz373e6712009-04-18 23:13:56 +0100441 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
Dan Nicholson44d99142007-12-05 18:47:01 -0800442 ;;
443dri)
444 SRC_DIRS="glx/x11 $SRC_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100445 DRIVER_DIRS="dri"
Dan Nicholson44d99142007-12-05 18:47:01 -0800446 WINDOW_SYSTEM="dri"
Jakob Bornecrantz373e6712009-04-18 23:13:56 +0100447 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
Dan Nicholson44d99142007-12-05 18:47:01 -0800448 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800449osmesa)
450 DRIVER_DIRS="osmesa"
451 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800452esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700453AC_SUBST([SRC_DIRS])
454AC_SUBST([GLU_DIRS])
455AC_SUBST([DRIVER_DIRS])
456AC_SUBST([WINDOW_SYSTEM])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100457AC_SUBST([GALLIUM_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100458AC_SUBST([GALLIUM_WINSYS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100459AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +0000460AC_SUBST([GALLIUM_DRIVERS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100461AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700462
463dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800464dnl User supplied program configuration
465dnl
466if test -d "$srcdir/progs/demos"; then
467 default_demos=yes
468else
469 default_demos=no
470fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700471AC_ARG_WITH([demos],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800472 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
473 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800474 @<:@default=auto if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700475 [with_demos="$withval"],
476 [with_demos="$default_demos"])
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800477if test "x$with_demos" = x; then
478 with_demos=no
479fi
480
481dnl If $with_demos is yes, directories will be added as libs available
482PROGRAM_DIRS=""
483case "$with_demos" in
Dan Nicholsonb9576552008-03-10 14:05:46 -0700484no) ;;
485yes)
486 # If the driver isn't osmesa, we have libGL and can build xdemos
487 if test "$mesa_driver" != osmesa; then
488 PROGRAM_DIRS="xdemos"
489 fi
490 ;;
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800491*)
492 # verify the requested demos directories exist
493 demos=`IFS=,; echo $with_demos`
494 for demo in $demos; do
495 test -d "$srcdir/progs/$demo" || \
496 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
497 done
498 PROGRAM_DIRS="$demos"
499 ;;
500esac
501
502dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700503dnl Find out if X is available. The variable have_x is set if libX11 is
Dan Nicholson99803a42008-07-01 09:03:15 -0700504dnl found to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700505dnl
506if test -n "$PKG_CONFIG"; then
507 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700508 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700509 x11_pkgconfig=yes
510 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700511 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700512 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700513 ])
514 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700515else
516 x11_pkgconfig=no
517fi
518dnl Use the autoconf macro if no pkg-config files
519if test "$x11_pkgconfig" = no; then
520 AC_PATH_XTRA
521fi
522
Dan Nicholson99803a42008-07-01 09:03:15 -0700523dnl Try to tell the user that the --x-* options are only used when
524dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
525m4_divert_once([HELP_BEGIN],
526[These options are only used when the X libraries cannot be found by the
527pkg-config utility.])
528
Dan Nicholson44d99142007-12-05 18:47:01 -0800529dnl We need X for xlib and dri, so bomb now if it's not found
530case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800531xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800532 if test "$no_x" = yes; then
533 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
534 fi
535 ;;
536esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700537
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700538dnl XCB - this is only used for GLX right now
539AC_ARG_ENABLE([xcb],
540 [AS_HELP_STRING([--enable-xcb],
541 [use XCB for GLX @<:@default=disabled@:>@])],
542 [enable_xcb="$enableval"],
543 [enable_xcb=no])
544if test "x$enable_xcb" = xyes; then
545 DEFINES="$DEFINES -DUSE_XCB"
546else
547 enable_xcb=no
548fi
549
Dan Nicholson44d99142007-12-05 18:47:01 -0800550dnl
551dnl libGL configuration per driver
552dnl
553case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800554xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800555 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700556 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800557 GL_PC_REQ_PRIV="x11 xext"
Dan Nicholsona1307182007-12-12 17:49:49 -0800558 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
559 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800560 else
561 # should check these...
562 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
563 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800564 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
565 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson44d99142007-12-05 18:47:01 -0800566 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700567 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
568 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800569
570 # if static, move the external libraries to the programs
571 # and empty the libraries for libGL
572 if test "$enable_static" = yes; then
573 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
574 GL_LIB_DEPS=""
575 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800576 ;;
577dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800578 # DRI must be shared, I think
579 if test "$enable_static" = yes; then
580 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
581 fi
582
Dan Nicholson44d99142007-12-05 18:47:01 -0800583 # Check for libdrm
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -0700584 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
585 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
Jesse Barnesf2f83d92010-01-11 17:28:10 -0500586 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
Jesse Barnesed59b132010-01-13 15:48:14 -0500587 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
588 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
Dan Nicholson44d99142007-12-05 18:47:01 -0800589
590 # find the DRI deps for libGL
591 if test "$x11_pkgconfig" = yes; then
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700592 # add xcb modules if necessary
593 dri_modules="x11 xext xxf86vm xdamage xfixes"
594 if test "$enable_xcb" = yes; then
595 dri_modules="$dri_modules x11-xcb xcb-glx"
596 fi
597
598 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800599 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Dan Nicholson44d99142007-12-05 18:47:01 -0800600 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
601 GL_LIB_DEPS="$DRIGL_LIBS"
602 else
603 # should check these...
604 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
605 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800606 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
607 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700608
609 # XCB can only be used from pkg-config
610 if test "$enable_xcb" = yes; then
611 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800612 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700613 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
614 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
615 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800616 fi
617
618 # need DRM libs, -lpthread, etc.
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700619 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
620 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800621 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800622osmesa)
623 # No libGL for osmesa
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700624 GL_LIB_DEPS=""
Dan Nicholson979ff512007-12-05 18:47:01 -0800625 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800626esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700627AC_SUBST([GL_LIB_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800628AC_SUBST([GL_PC_REQ_PRIV])
629AC_SUBST([GL_PC_LIB_PRIV])
630AC_SUBST([GL_PC_CFLAGS])
631AC_SUBST([DRI_PC_REQ_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700632
633dnl
634dnl More X11 setup
635dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800636if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700637 DEFINES="$DEFINES -DUSE_XSHM"
638fi
639
640dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800641dnl More DRI setup
642dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700643AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800644 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800645 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700646 [GLX_USE_TLS="$enableval"],
647 [GLX_USE_TLS=no])
Dan Nicholson44d99142007-12-05 18:47:01 -0800648dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700649AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800650 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700651 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700652 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700653 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700654AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Chow Loong Jin35506de2009-10-28 14:34:14 +0800655dnl Extra search path for DRI drivers
656AC_ARG_WITH([dri-searchpath],
657 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
658 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
659 [DRI_DRIVER_SEARCH_DIR="$withval"],
660 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
661AC_SUBST([DRI_DRIVER_SEARCH_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800662dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700663AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800664 [AS_HELP_STRING([--disable-driglx-direct],
665 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700666 [driglx_direct="$enableval"],
667 [driglx_direct="yes"])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800668dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700669AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800670 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholson5cae1b72008-06-30 10:28:02 -0700671 [comma delimited DRI drivers list, e.g.
Michel Dänzercade0712009-07-10 14:49:46 +0200672 "swrast,i965,radeon" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700673 [with_dri_drivers="$withval"],
674 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800675if test "x$with_dri_drivers" = x; then
676 with_dri_drivers=no
677fi
678
679dnl If $with_dri_drivers is yes, directories will be added through
680dnl platform checks
681DRI_DIRS=""
682case "$with_dri_drivers" in
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100683no) ;;
684yes)
685 DRI_DIRS="yes"
686 ;;
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800687*)
688 # verify the requested driver directories exist
Dan Nicholsone6e4f252008-07-06 14:17:39 -0700689 dri_drivers=`IFS=', '; echo $with_dri_drivers`
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800690 for driver in $dri_drivers; do
691 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
692 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
693 done
694 DRI_DIRS="$dri_drivers"
695 ;;
696esac
697
Dan Nicholson44d99142007-12-05 18:47:01 -0800698dnl Just default to no EGL for now
699USING_EGL=0
Dan Nicholson297e16c2008-05-05 15:42:53 -0700700AC_SUBST([USING_EGL])
Dan Nicholson44d99142007-12-05 18:47:01 -0800701
702dnl 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
709 if test "x$USING_EGL" = x1; then
710 PROGRAM_DIRS="egl"
711 fi
712
713 # Platform specific settings and drivers to build
714 case "$host_os" in
715 linux*)
716 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
Dan Nicholson44d99142007-12-05 18:47:01 -0800717 if test "x$driglx_direct" = xyes; then
718 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
719 fi
Jerome Glisse14f79d42008-12-18 13:36:07 +0100720 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800721
722 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800723 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800724 # ffb, gamma, and sis are missing because they have not be
725 # converted to use the new interface. i810 are missing
726 # because there is no x86-64 system where they could *ever*
727 # be used.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100728 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400729 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +0300730 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800731 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800732 ;;
733 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800734 # Build only the drivers for cards that exist on PowerPC.
735 # At some point MGA will be added, but not yet.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100736 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400737 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800738 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800739 ;;
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000740 sparc*)
741 # Build only the drivers for cards that exist on sparc`
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100742 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400743 DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000744 fi
745 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800746 esac
747 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700748 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800749 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
750 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
751 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
752 if test "x$driglx_direct" = xyes; then
753 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
754 fi
755 if test "x$GXX" = xyes; then
756 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
757 fi
758
Dan Nicholsona76e2452007-12-07 11:25:08 -0800759 # ffb and gamma are missing because they have not been converted
760 # to use the new interface.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100761 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400762 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +0300763 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800764 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800765 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700766 gnu*)
767 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
768 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
769 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700770 solaris*)
771 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
772 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
773 if test "x$driglx_direct" = xyes; then
774 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
775 fi
776 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800777 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800778
779 # default drivers
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100780 if test "x$DRI_DIRS" = "xyes"; then
Corbin Simpson8e4657a2009-10-22 12:29:30 -0700781 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
Corbin Simpsonfd7ee2b2009-10-22 12:57:13 -0700782 savage sis tdfx unichrome ffb swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -0800783 fi
784
Dan Nicholson44d99142007-12-05 18:47:01 -0800785 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
786
787 # Check for expat
788 EXPAT_INCLUDES=""
789 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700790 AC_ARG_WITH([expat],
791 [AS_HELP_STRING([--with-expat=DIR],
792 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800793 EXPAT_INCLUDES="-I$withval/include"
794 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
795 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
796 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
797 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700798 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
799 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
800 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800801
802 # put all the necessary libs together
Eric Anholt050c5332008-03-20 17:28:58 -0700803 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800804fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700805AC_SUBST([DRI_DIRS])
806AC_SUBST([EXPAT_INCLUDES])
807AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800808
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500809case $DRI_DIRS in
810*i915*|*i965*)
811 PKG_CHECK_MODULES([INTEL], [libdrm_intel])
812 ;;
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -0500813esac
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500814
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -0500815case $DRI_DIRS in
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500816*radeon*|*r200*|*r300*|*r600*)
817 PKG_CHECK_MODULES([LIBDRM_RADEON],
818 [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
819 HAVE_LIBDRM_RADEON=yes,
820 HAVE_LIBDRM_RADEON=no)
821
822 if test "$HAVE_LIBDRM_RADEON" = yes; then
823 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
824 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
825 fi
826 ;;
827esac
828AC_SUBST([RADEON_CFLAGS])
829AC_SUBST([RADEON_LDFLAGS])
830
831
Dan Nicholson44d99142007-12-05 18:47:01 -0800832dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700833dnl OSMesa configuration
834dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800835if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800836 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800837else
Dan Nicholson544ab202007-12-30 08:41:53 -0800838 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800839fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700840AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800841 [AS_HELP_STRING([--enable-gl-osmesa],
842 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700843 [gl_osmesa="$enableval"],
844 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800845if test "x$gl_osmesa" = xyes; then
846 if test "$mesa_driver" = osmesa; then
847 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800848 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800849 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800850 fi
851fi
852
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800853dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700854AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800855 [AS_HELP_STRING([--with-osmesa-bits=BITS],
856 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700857 [osmesa_bits="$withval"],
858 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800859if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
860 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
861 osmesa_bits=8
862fi
863case "x$osmesa_bits" in
864x8)
865 OSMESA_LIB=OSMesa
866 ;;
867x16|x32)
868 OSMESA_LIB="OSMesa$osmesa_bits"
869 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
870 ;;
871*)
872 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
873 ;;
874esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700875AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800876
Dan Nicholson979ff512007-12-05 18:47:01 -0800877case "$mesa_driver" in
878osmesa)
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700879 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800880 if test "$enable_static" = no; then
Dan Nicholson4795dd52009-06-04 19:42:08 -0700881 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800882 else
883 OSMESA_LIB_DEPS=""
884 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800885 OSMESA_MESA_DEPS=""
Dan Nicholson4795dd52009-06-04 19:42:08 -0700886 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -0800887 ;;
888*)
889 # Link OSMesa to libGL otherwise
890 OSMESA_LIB_DEPS=""
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700891 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800892 if test "$enable_static" = no; then
893 OSMESA_MESA_DEPS='-l$(GL_LIB)'
894 else
895 OSMESA_MESA_DEPS=""
896 fi
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800897 OSMESA_PC_REQ="gl"
Dan Nicholson979ff512007-12-05 18:47:01 -0800898 ;;
899esac
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700900OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700901AC_SUBST([OSMESA_LIB_DEPS])
902AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800903AC_SUBST([OSMESA_PC_REQ])
904AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700905
906dnl
Dan Nicholson53b37342009-02-25 17:45:34 -0800907dnl EGL configuration
908dnl
Dan Nicholson66f97862009-04-29 12:11:43 -0700909AC_ARG_ENABLE([egl],
910 [AS_HELP_STRING([--disable-egl],
911 [disable EGL library @<:@default=enabled@:>@])],
912 [enable_egl="$enableval"],
913 [enable_egl=yes])
914if test "x$enable_egl" = xyes; then
915 SRC_DIRS="$SRC_DIRS egl"
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800916 EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
917 EGL_DRIVERS_DIRS=""
918 if test "$enable_static" != yes && test "$mesa_driver" != osmesa; then
919 # build egl_glx when libGL is built
920 EGL_DRIVERS_DIRS="glx"
Dan Nicholson66f97862009-04-29 12:11:43 -0700921 fi
Dan Nicholson53b37342009-02-25 17:45:34 -0800922fi
Dan Nicholson53b37342009-02-25 17:45:34 -0800923AC_SUBST([EGL_LIB_DEPS])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800924AC_SUBST([EGL_DRIVERS_DIRS])
Dan Nicholson53b37342009-02-25 17:45:34 -0800925
926dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700927dnl GLU configuration
928dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700929AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800930 [AS_HELP_STRING([--disable-glu],
931 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700932 [enable_glu="$enableval"],
933 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700934if test "x$enable_glu" = xyes; then
935 SRC_DIRS="$SRC_DIRS glu"
936
Dan Nicholson979ff512007-12-05 18:47:01 -0800937 case "$mesa_driver" in
938 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800939 # If GLU is available and we have libOSMesa (not 16 or 32),
940 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800941 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800942 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
943 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700944
Dan Nicholson979ff512007-12-05 18:47:01 -0800945 # Link libGLU to libOSMesa instead of libGL
946 GLU_LIB_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800947 GLU_PC_REQ="osmesa"
Dan Nicholson88586332007-11-15 08:59:57 -0800948 if test "$enable_static" = no; then
949 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
950 else
951 GLU_MESA_DEPS=""
952 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800953 ;;
954 *)
Dan Nicholson88586332007-11-15 08:59:57 -0800955 # If static, empty GLU_LIB_DEPS and add libs for programs to link
Dan Nicholson71e208b2008-11-24 11:01:57 -0800956 GLU_PC_REQ="gl"
957 GLU_PC_LIB_PRIV="-lm"
Dan Nicholson88586332007-11-15 08:59:57 -0800958 if test "$enable_static" = no; then
959 GLU_LIB_DEPS="-lm"
960 GLU_MESA_DEPS='-l$(GL_LIB)'
961 else
962 GLU_LIB_DEPS=""
963 GLU_MESA_DEPS=""
964 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
965 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800966 ;;
967 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700968fi
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700969if test "$enable_static" = no; then
970 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
971fi
Dan Nicholson71e208b2008-11-24 11:01:57 -0800972GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700973AC_SUBST([GLU_LIB_DEPS])
974AC_SUBST([GLU_MESA_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800975AC_SUBST([GLU_PC_REQ])
976AC_SUBST([GLU_PC_REQ_PRIV])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800977AC_SUBST([GLU_PC_LIB_PRIV])
978AC_SUBST([GLU_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700979
980dnl
981dnl GLw configuration
982dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700983AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800984 [AS_HELP_STRING([--disable-glw],
985 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700986 [enable_glw="$enableval"],
987 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -0800988dnl Don't build GLw on osmesa
989if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
990 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
991 enable_glw=no
992fi
Dan Nicholson776c60d2008-07-18 07:40:41 -0700993AC_ARG_ENABLE([motif],
994 [AS_HELP_STRING([--enable-motif],
995 [use Motif widgets in GLw @<:@default=disabled@:>@])],
996 [enable_motif="$enableval"],
997 [enable_motif=no])
998
Dan Nicholsondca1b792007-10-23 09:25:58 -0700999if test "x$enable_glw" = xyes; then
1000 SRC_DIRS="$SRC_DIRS glw"
1001 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001002 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001003 GLW_PC_REQ_PRIV="x11 xt"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001004 GLW_LIB_DEPS="$GLW_LIBS"
1005 else
1006 # should check these...
Dan Nicholson776c60d2008-07-18 07:40:41 -07001007 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001008 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1009 GLW_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001010 fi
1011
1012 GLW_SOURCES="GLwDrawA.c"
1013 MOTIF_CFLAGS=
1014 if test "x$enable_motif" = xyes; then
1015 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1016 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1017 if test "x$MOTIF_CONFIG" != xno; then
1018 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1019 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1020 else
1021 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1022 [AC_MSG_ERROR([Can't locate Motif headers])])
1023 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1024 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1025 fi
1026 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1027 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001028 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1029 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001030 fi
1031
Dan Nicholson88586332007-11-15 08:59:57 -08001032 # If static, empty GLW_LIB_DEPS and add libs for programs to link
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001033 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
Dan Nicholson88586332007-11-15 08:59:57 -08001034 if test "$enable_static" = no; then
1035 GLW_MESA_DEPS='-l$(GL_LIB)'
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001036 GLW_LIB_DEPS="$GLW_LIB_DEPS"
Dan Nicholson88586332007-11-15 08:59:57 -08001037 else
1038 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1039 GLW_LIB_DEPS=""
1040 GLW_MESA_DEPS=""
1041 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001042fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001043AC_SUBST([GLW_LIB_DEPS])
1044AC_SUBST([GLW_MESA_DEPS])
Dan Nicholson776c60d2008-07-18 07:40:41 -07001045AC_SUBST([GLW_SOURCES])
1046AC_SUBST([MOTIF_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001047AC_SUBST([GLW_PC_REQ_PRIV])
1048AC_SUBST([GLW_PC_LIB_PRIV])
1049AC_SUBST([GLW_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001050
1051dnl
1052dnl GLUT configuration
1053dnl
1054if test -f "$srcdir/include/GL/glut.h"; then
1055 default_glut=yes
1056else
1057 default_glut=no
1058fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001059AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001060 [AS_HELP_STRING([--disable-glut],
1061 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001062 [enable_glut="$enableval"],
1063 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001064
1065dnl Can't build glut if GLU not available
1066if test "x$enable_glu$enable_glut" = xnoyes; then
1067 AC_MSG_WARN([Disabling glut since GLU is disabled])
1068 enable_glut=no
1069fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001070dnl Don't build glut on osmesa
1071if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1072 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1073 enable_glut=no
1074fi
1075
Dan Nicholsondca1b792007-10-23 09:25:58 -07001076if test "x$enable_glut" = xyes; then
1077 SRC_DIRS="$SRC_DIRS glut/glx"
1078 GLUT_CFLAGS=""
1079 if test "x$GCC" = xyes; then
1080 GLUT_CFLAGS="-fexceptions"
1081 fi
1082 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001083 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001084 GLUT_PC_REQ_PRIV="x11 xmu xi"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001085 GLUT_LIB_DEPS="$GLUT_LIBS"
1086 else
1087 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -08001088 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001089 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1090 GLUT_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001091 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001092 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1093 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001094
1095 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -08001096 if test "$with_demos" = yes; then
1097 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
1098 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001099
Dan Nicholson88586332007-11-15 08:59:57 -08001100 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1101 if test "$enable_static" = no; then
1102 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1103 else
1104 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1105 GLUT_LIB_DEPS=""
1106 GLUT_MESA_DEPS=""
1107 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001108fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001109AC_SUBST([GLUT_LIB_DEPS])
1110AC_SUBST([GLUT_MESA_DEPS])
1111AC_SUBST([GLUT_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001112AC_SUBST([GLUT_PC_REQ_PRIV])
1113AC_SUBST([GLUT_PC_LIB_PRIV])
1114AC_SUBST([GLUT_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001115
1116dnl
1117dnl Program library dependencies
1118dnl Only libm is added here if necessary as the libraries should
1119dnl be pulled in by the linker
1120dnl
1121if test "x$APP_LIB_DEPS" = x; then
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001122 case "$host_os" in
1123 solaris*)
1124 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1125 ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +01001126 cygwin*)
1127 APP_LIB_DEPS="-lX11"
1128 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001129 *)
1130 APP_LIB_DEPS="-lm"
1131 ;;
1132 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001133fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001134AC_SUBST([APP_LIB_DEPS])
1135AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001136
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001137dnl
1138dnl Gallium configuration
1139dnl
1140AC_ARG_ENABLE([gallium],
1141 [AS_HELP_STRING([--disable-gallium],
1142 [build gallium @<:@default=enabled@:>@])],
1143 [enable_gallium="$enableval"],
1144 [enable_gallium=yes])
1145if test "x$enable_gallium" = xyes; then
1146 SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
1147fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001148
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001149dnl
1150dnl Gallium state trackers configuration
1151dnl
1152AC_ARG_WITH([state-trackers],
1153 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1154 [comma delimited state_trackers list, e.g.
1155 "egl,glx" @<:@default=auto@:>@])],
1156 [with_state_trackers="$withval"],
1157 [with_state_trackers=yes])
1158
1159case "$with_state_trackers" in
1160no)
1161 GALLIUM_STATE_TRACKERS_DIRS=""
1162 ;;
1163yes)
1164 # look at what else is built
1165 case "$mesa_driver" in
Jakob Bornecrantz373e6712009-04-18 23:13:56 +01001166 xlib)
1167 GALLIUM_STATE_TRACKERS_DIRS=glx
1168 ;;
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001169 dri)
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001170 GALLIUM_STATE_TRACKERS_DIRS="dri"
1171 if test "x$enable_egl" = xyes; then
Chia-I Wu077d6dd2010-01-10 23:08:39 +08001172 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl egl_g3d"
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001173 fi
1174 # Have only tested st/xorg on 1.6.0 servers
1175 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0],
1176 HAVE_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1177 HAVE_XORG="no")
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001178 ;;
1179 esac
1180 ;;
1181*)
1182 # verify the requested state tracker exist
1183 state_trackers=`IFS=', '; echo $with_state_trackers`
1184 for tracker in $state_trackers; do
1185 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1186 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
Dan Nicholson66f97862009-04-29 12:11:43 -07001187
1188 if test "$tracker" = egl && test "x$enable_egl" != xyes; then
1189 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1190 fi
Dave Airliee9d6ab72009-09-21 13:26:48 +10001191 if test "$tracker" = xorg; then
1192 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
Jakob Bornecrantz5c4bdbd2009-10-15 01:24:53 +01001193 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
Dave Airliee9d6ab72009-09-21 13:26:48 +10001194 HAVE_XEXTPROTO_71="no")
Jakob Bornecrantz5c4bdbd2009-10-15 01:24:53 +01001195 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001196 done
1197 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1198 ;;
1199esac
1200
Chia-I Wu49381d62010-01-11 01:23:01 +08001201AC_ARG_WITH([egl-displays],
1202 [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
1203 [comma delimited native displays libEGL supports, e.g.
Chia-I Wua68b51d2010-01-03 19:24:04 +08001204 "x11,kms" @<:@default=auto@:>@])],
Chia-I Wu49381d62010-01-11 01:23:01 +08001205 [with_egl_displays="$withval"],
1206 [with_egl_displays=yes])
1207
1208EGL_DISPLAYS=""
1209case "$with_egl_displays" in
1210yes)
1211 if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
1212 EGL_DISPLAYS="x11"
1213 fi
1214 ;;
1215*)
1216 if test "x$enable_egl" != xyes; then
1217 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1218 fi
1219 # verify the requested driver directories exist
1220 egl_displays=`IFS=', '; echo $with_egl_displays`
1221 for dpy in $egl_displays; do
1222 test -d "$srcdir/src/gallium/state_trackers/egl_g3d/$dpy" || \
1223 AC_MSG_ERROR([EGL display '$dpy' does't exist])
1224 done
1225 EGL_DISPLAYS="$egl_displays"
1226 ;;
1227esac
1228AC_SUBST([EGL_DISPLAYS])
1229
Joel Bosveld8acca482009-03-06 08:46:08 +09001230AC_ARG_WITH([xorg-driver-dir],
1231 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1232 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1233 [XORG_DRIVER_INSTALL_DIR="$withval"],
1234 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1235AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1236
Tom Fogal7085dce2009-08-13 19:40:30 -06001237AC_ARG_WITH([max-width],
1238 [AS_HELP_STRING([--with-max-width=N],
1239 [Maximum framebuffer width (4096)])],
1240 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1241 AS_IF([test "${withval}" -gt "4096"],
1242 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1243)
1244AC_ARG_WITH([max-height],
1245 [AS_HELP_STRING([--with-max-height=N],
1246 [Maximum framebuffer height (4096)])],
1247 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1248 AS_IF([test "${withval}" -gt "4096"],
1249 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1250)
1251
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001252dnl
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001253dnl Gallium SVGA configuration
1254dnl
1255AC_ARG_ENABLE([gallium-svga],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001256 [AS_HELP_STRING([--enable-gallium-svga],
1257 [build gallium SVGA @<:@default=disabled@:>@])],
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001258 [enable_gallium_svga="$enableval"],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001259 [enable_gallium_svga=auto])
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001260if test "x$enable_gallium_svga" = xyes; then
1261 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
1262 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001263elif test "x$enable_gallium_svga" = xauto; then
1264 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001265fi
1266
1267dnl
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001268dnl Gallium Intel configuration
1269dnl
1270AC_ARG_ENABLE([gallium-intel],
Jakob Bornecrantz8ac25032009-12-04 16:01:41 +00001271 [AS_HELP_STRING([--enable-gallium-intel],
1272 [build gallium intel @<:@default=disabled@:>@])],
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001273 [enable_gallium_intel="$enableval"],
Jakob Bornecrantz8ac25032009-12-04 16:01:41 +00001274 [enable_gallium_intel=auto])
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001275if test "x$enable_gallium_intel" = xyes; then
Jakob Bornecrantzce4f23a2009-11-04 23:02:13 +00001276 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel i965"
1277 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
Jakob Bornecrantz8ac25032009-12-04 16:01:41 +00001278elif test "x$enable_gallium_intel" = xauto; then
Keith Whitwellaa026832009-12-22 09:40:39 +00001279 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001280fi
1281
1282dnl
1283dnl Gallium Radeon configuration
1284dnl
1285AC_ARG_ENABLE([gallium-radeon],
1286 [AS_HELP_STRING([--enable-gallium-radeon],
1287 [build gallium radeon @<:@default=disabled@:>@])],
1288 [enable_gallium_radeon="$enableval"],
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001289 [enable_gallium_radeon=auto])
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001290if test "x$enable_gallium_radeon" = xyes; then
1291 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001292 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001293elif test "x$enable_gallium_radeon" = xauto; then
1294 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001295fi
1296
1297dnl
Thierry Vignaud1402ea82009-09-14 11:48:51 -06001298dnl Gallium Nouveau configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001299dnl
1300AC_ARG_ENABLE([gallium-nouveau],
1301 [AS_HELP_STRING([--enable-gallium-nouveau],
1302 [build gallium nouveau @<:@default=disabled@:>@])],
1303 [enable_gallium_nouveau="$enableval"],
1304 [enable_gallium_nouveau=no])
1305if test "x$enable_gallium_nouveau" = xyes; then
1306 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
Ben Skeggsbc466be2009-06-04 10:19:04 +10001307 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001308fi
1309
1310
Dan Nicholsondca1b792007-10-23 09:25:58 -07001311dnl Restore LDFLAGS and CPPFLAGS
1312LDFLAGS="$_SAVE_LDFLAGS"
1313CPPFLAGS="$_SAVE_CPPFLAGS"
1314
1315dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -08001316AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001317
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001318dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001319AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001320if test -f configs/current || test -L configs/current; then
1321 rm -f configs/current
1322fi
1323ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001324])
1325
1326AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001327
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001328dnl
1329dnl Output some configuration info for the user
1330dnl
1331echo ""
1332echo " prefix: $prefix"
1333echo " exec_prefix: $exec_prefix"
1334echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07001335echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001336
1337dnl Driver info
1338echo ""
1339echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -08001340if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1341 echo " OSMesa: lib$OSMESA_LIB"
1342else
1343 echo " OSMesa: no"
1344fi
1345if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001346 # cleanup the drivers var
1347 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001348if test "x$DRI_DIRS" = x; then
1349 echo " DRI drivers: no"
1350else
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001351 echo " DRI drivers: $dri_dirs"
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001352fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001353 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -08001354fi
RALOVICH, Kristóf5f19f5c2008-11-04 11:53:32 +01001355echo " Use XCB: $enable_xcb"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001356
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001357echo ""
1358if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1359 echo " Gallium: yes"
1360 echo " Gallium dirs: $GALLIUM_DIRS"
1361 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001362 echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001363 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001364 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1365else
1366 echo " Gallium: no"
1367fi
1368
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001369dnl Libraries
1370echo ""
1371echo " Shared libs: $enable_shared"
1372echo " Static libs: $enable_static"
Dan Nicholson66f97862009-04-29 12:11:43 -07001373echo " EGL: $enable_egl"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001374echo " GLU: $enable_glu"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001375echo " GLw: $enable_glw (Motif: $enable_motif)"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001376echo " glut: $enable_glut"
1377
1378dnl Programs
1379# cleanup the programs var for display
1380program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1381if test "x$program_dirs" = x; then
1382 echo " Demos: no"
1383else
1384 echo " Demos: $program_dirs"
1385fi
1386
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001387dnl Compiler options
1388# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1389cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1390 $SED 's/^ *//;s/ */ /;s/ *$//'`
1391cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1392 $SED 's/^ *//;s/ */ /;s/ *$//'`
1393defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1394echo ""
1395echo " CFLAGS: $cflags"
1396echo " CXXFLAGS: $cxxflags"
1397echo " Macros: $defines"
1398
Dan Nicholsondca1b792007-10-23 09:25:58 -07001399echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07001400echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001401echo ""