blob: 3d86decadaf5aab34478bb519f1d0fa6cbfd445d [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],
Vinson Lee48f8a762010-05-11 12:33:30 -07007 [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n' | tr -d '\r'])])
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
Kristian Høgsbergaa0cd702010-02-15 10:44:05 -050023DRI2PROTO_REQUIRED=2.1
Jesse Barnesf2f83d92010-01-11 17:28:10 -050024GLPROTO_REQUIRED=1.4.11
Jakob Bornecrantz683a0992010-03-11 19:23:15 +000025LIBDRM_XORG_REQUIRED=2.4.17
26LIBKMS_XORG_REQUIRED=1.0.0
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -070027
Dan Nicholsondca1b792007-10-23 09:25:58 -070028dnl Check for progs
29AC_PROG_CPP
30AC_PROG_CC
31AC_PROG_CXX
Dan Nicholson297e16c2008-05-05 15:42:53 -070032AC_CHECK_PROGS([MAKE], [gmake make])
33AC_PATH_PROG([MKDEP], [makedepend])
34AC_PATH_PROG([SED], [sed])
Dan Nicholson41b00702007-12-12 08:48:30 -080035
Dan Nicholsonbc302b22009-05-22 09:39:02 -070036dnl Our fallback install-sh is a symlink to minstall. Use the existing
37dnl configuration in that case.
38AC_PROG_INSTALL
39test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
40
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070041dnl We need a POSIX shell for parts of the build. Assume we have one
42dnl in most cases.
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070043case "$host_os" in
44solaris*)
45 # Solaris /bin/sh is too old/non-POSIX compliant
46 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070047 SHELL="$POSIX_SHELL"
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070048 ;;
49esac
50
Ian Romanick9aa3aa72010-03-03 15:59:37 -080051dnl If we're using GCC, make sure that it is at least version 3.3.0. Older
52dnl versions are explictly not supported.
53if test "x$GCC" = xyes; then
54 AC_MSG_CHECKING([whether gcc version is sufficient])
55 major=0
56 minor=0
57
58 GCC_VERSION=`$CC -dumpversion`
59 if test $? -eq 0; then
60 major=`echo $GCC_VERSION | cut -d. -f1`
61 minor=`echo $GCC_VERSION | cut -d. -f1`
62 fi
63
64 if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
65 AC_MSG_RESULT([no])
66 AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
67 else
68 AC_MSG_RESULT([yes])
69 fi
70fi
71
72
Dan Nicholsondb7fc632008-03-07 11:48:09 -080073MKDEP_OPTIONS=-fdepend
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050074dnl Ask gcc where it's keeping its secret headers
75if test "x$GCC" = xyes; then
Dan Nicholsona3d223f2009-01-30 10:52:09 -080076 for dir in include include-fixed; do
77 GCC_INCLUDES=`$CC -print-file-name=$dir`
78 if test "x$GCC_INCLUDES" != x && \
79 test "$GCC_INCLUDES" != "$dir" && \
80 test -d "$GCC_INCLUDES"; then
81 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
82 fi
83 done
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050084fi
Dan Nicholson297e16c2008-05-05 15:42:53 -070085AC_SUBST([MKDEP_OPTIONS])
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050086
Dan Nicholson41b00702007-12-12 08:48:30 -080087dnl Make sure the pkg-config macros are defined
Dan Nicholson356f3112009-04-29 06:49:27 -070088m4_ifndef([PKG_PROG_PKG_CONFIG],
89 [m4_fatal([Could not locate the pkg-config autoconf macros.
90 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
91 are in a different location, try setting the environment variable
92 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
Dan Nicholsondca1b792007-10-23 09:25:58 -070093PKG_PROG_PKG_CONFIG()
94
95dnl LIB_DIR - library basename
96LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
Dan Nicholson297e16c2008-05-05 15:42:53 -070097AC_SUBST([LIB_DIR])
Dan Nicholsondca1b792007-10-23 09:25:58 -070098
99dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
100_SAVE_LDFLAGS="$LDFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700101AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
102AC_SUBST([EXTRA_LIB_PATH])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700103
104dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
105_SAVE_CPPFLAGS="$CPPFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700106AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
107AC_SUBST([X11_INCLUDES])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700108
109dnl Compiler macros
110DEFINES=""
Dan Nicholson297e16c2008-05-05 15:42:53 -0700111AC_SUBST([DEFINES])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700112case "$host_os" in
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700113linux*|*-gnu*|gnu*)
Dan Nicholson29f603a2009-01-12 11:10:31 -0800114 DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700115 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700116solaris*)
117 DEFINES="$DEFINES -DPTHREADS -DSVR4"
118 ;;
Brian Paul97988902010-02-18 12:46:12 -0700119cygwin*)
120 DEFINES="$DEFINES -DPTHREADS"
121 ;;
Dan Nicholsondca1b792007-10-23 09:25:58 -0700122esac
123
124dnl Add flags for gcc and g++
125if test "x$GCC" = xyes; then
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800126 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
127
128 # Enable -fvisibility=hidden if using a gcc that supports it
129 save_CFLAGS="$CFLAGS"
Alan Coopersmithf8107a42010-01-21 16:42:58 -0800130 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800131 CFLAGS="$CFLAGS -fvisibility=hidden"
132 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
133 [CFLAGS="$save_CFLAGS" ; AC_MSG_RESULT([no])]);
Dan Nicholson0c275b62008-01-15 22:52:25 -0800134
135 # Work around aliasing bugs - developers should comment this out
136 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700137fi
138if test "x$GXX" = xyes; then
139 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -0800140
141 # Work around aliasing bugs - developers should comment this out
142 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700143fi
144
145dnl These should be unnecessary, but let the user set them if they want
Dan Nicholson297e16c2008-05-05 15:42:53 -0700146AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700147 Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700148AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
Dan Nicholsondca1b792007-10-23 09:25:58 -0700149 compiler. Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700150AC_SUBST([OPT_FLAGS])
151AC_SUBST([ARCH_FLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700152
153dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600154dnl Hacks to enable 32 or 64 bit build
155dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700156AC_ARG_ENABLE([32-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600157 [AS_HELP_STRING([--enable-32-bit],
158 [build 32-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700159 [enable_32bit="$enableval"],
160 [enable_32bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600161)
162if test "x$enable_32bit" = xyes; then
163 if test "x$GCC" = xyes; then
164 CFLAGS="$CFLAGS -m32"
Marc Dietrichc705e722009-08-31 08:56:33 -0700165 ARCH_FLAGS="$ARCH_FLAGS -m32"
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600166 fi
167 if test "x$GXX" = xyes; then
168 CXXFLAGS="$CXXFLAGS -m32"
169 fi
170fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700171AC_ARG_ENABLE([64-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600172 [AS_HELP_STRING([--enable-64-bit],
173 [build 64-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700174 [enable_64bit="$enableval"],
175 [enable_64bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600176)
177if test "x$enable_64bit" = xyes; then
178 if test "x$GCC" = xyes; then
179 CFLAGS="$CFLAGS -m64"
180 fi
181 if test "x$GXX" = xyes; then
182 CXXFLAGS="$CXXFLAGS -m64"
183 fi
184fi
185
186dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800187dnl shared/static libraries, mimic libtool options
188dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700189AC_ARG_ENABLE([static],
Dan Nicholson88586332007-11-15 08:59:57 -0800190 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800191 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700192 [enable_static="$enableval"],
193 [enable_static=no]
Dan Nicholson88586332007-11-15 08:59:57 -0800194)
195case "x$enable_static" in
196xyes|xno ) ;;
197x ) enable_static=no ;;
198* )
199 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
200 ;;
201esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700202AC_ARG_ENABLE([shared],
Dan Nicholson88586332007-11-15 08:59:57 -0800203 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800204 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700205 [enable_shared="$enableval"],
206 [enable_shared=yes]
Dan Nicholson88586332007-11-15 08:59:57 -0800207)
208case "x$enable_shared" in
209xyes|xno ) ;;
210x ) enable_shared=yes ;;
211* )
212 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
213 ;;
214esac
215
216dnl Can't have static and shared libraries, default to static if user
217dnl explicitly requested. If both disabled, set to static since shared
218dnl was explicitly requirested.
219case "x$enable_static$enable_shared" in
220xyesyes )
221 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
222 enable_shared=no
223 ;;
224xnono )
225 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
226 enable_static=yes
227 ;;
228esac
229
230dnl
231dnl mklib options
232dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700233AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
Dan Nicholson88586332007-11-15 08:59:57 -0800234if test "$enable_static" = yes; then
235 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
236fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700237AC_SUBST([MKLIB_OPTIONS])
Dan Nicholson88586332007-11-15 08:59:57 -0800238
Dan Nicholson23656c42007-12-12 09:02:31 -0800239dnl
240dnl other compiler options
241dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700242AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800243 [AS_HELP_STRING([--enable-debug],
244 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700245 [enable_debug="$enableval"],
246 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800247)
248if test "x$enable_debug" = xyes; then
249 DEFINES="$DEFINES -DDEBUG"
250 if test "x$GCC" = xyes; then
251 CFLAGS="$CFLAGS -g"
252 fi
253 if test "x$GXX" = xyes; then
254 CXXFLAGS="$CXXFLAGS -g"
255 fi
256fi
Dan Nicholson88586332007-11-15 08:59:57 -0800257
258dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700259dnl library names
260dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800261if test "$enable_static" = yes; then
Dan Nicholson8217f242009-02-11 15:16:00 -0800262 LIB_EXTENSION='a'
Dan Nicholson88586332007-11-15 08:59:57 -0800263else
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700264 case "$host_os" in
265 darwin* )
266 LIB_EXTENSION='dylib' ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +0100267 cygwin* )
Chia-I Wu70ae8bf2010-05-18 10:22:57 -0600268 LIB_EXTENSION='dll.a' ;;
Tom Fogal9282edf2009-10-13 10:55:33 -0700269 aix* )
270 LIB_EXTENSION='a' ;;
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700271 * )
272 LIB_EXTENSION='so' ;;
273 esac
Dan Nicholson88586332007-11-15 08:59:57 -0800274fi
Dan Nicholson8217f242009-02-11 15:16:00 -0800275
276GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
277GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
278GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
279GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
280OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800281EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500282GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
283GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
Chia-I Wu874ccd52010-05-04 22:43:05 +0800284VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
Dan Nicholson8217f242009-02-11 15:16:00 -0800285
286GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
287GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
288GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
289GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
290OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800291EGL_LIB_GLOB='lib$(EGL_LIB).*'${LIB_EXTENSION}'*'
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500292GLESv1_CM_LIB_GLOB='lib$(GLESv1_CM_LIB).*'${LIB_EXTENSION}'*'
293GLESv2_LIB_GLOB='lib$(GLESv2_LIB).*'${LIB_EXTENSION}'*'
Chia-I Wu874ccd52010-05-04 22:43:05 +0800294VG_LIB_GLOB='lib$(VG_LIB).*'${LIB_EXTENSION}'*'
Dan Nicholson8217f242009-02-11 15:16:00 -0800295
Dan Nicholson297e16c2008-05-05 15:42:53 -0700296AC_SUBST([GL_LIB_NAME])
297AC_SUBST([GLU_LIB_NAME])
298AC_SUBST([GLUT_LIB_NAME])
299AC_SUBST([GLW_LIB_NAME])
300AC_SUBST([OSMESA_LIB_NAME])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800301AC_SUBST([EGL_LIB_NAME])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500302AC_SUBST([GLESv1_CM_LIB_NAME])
303AC_SUBST([GLESv2_LIB_NAME])
Chia-I Wu874ccd52010-05-04 22:43:05 +0800304AC_SUBST([VG_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700305
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700306AC_SUBST([GL_LIB_GLOB])
307AC_SUBST([GLU_LIB_GLOB])
308AC_SUBST([GLUT_LIB_GLOB])
309AC_SUBST([GLW_LIB_GLOB])
310AC_SUBST([OSMESA_LIB_GLOB])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800311AC_SUBST([EGL_LIB_GLOB])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500312AC_SUBST([GLESv1_CM_LIB_GLOB])
313AC_SUBST([GLESv2_LIB_GLOB])
Chia-I Wu874ccd52010-05-04 22:43:05 +0800314AC_SUBST([VG_LIB_GLOB])
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700315
Dan Nicholsondca1b792007-10-23 09:25:58 -0700316dnl
Dan Nicholson871125a2008-06-04 13:00:35 -0700317dnl Arch/platform-specific settings
318dnl
319AC_ARG_ENABLE([asm],
320 [AS_HELP_STRING([--disable-asm],
321 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
322 [enable_asm="$enableval"],
323 [enable_asm=yes]
324)
325asm_arch=""
326ASM_FLAGS=""
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800327MESA_ASM_SOURCES=""
328GLAPI_ASM_SOURCES=""
Dan Nicholson871125a2008-06-04 13:00:35 -0700329AC_MSG_CHECKING([whether to enable assembly])
330test "x$enable_asm" = xno && AC_MSG_RESULT([no])
331# disable if cross compiling on x86/x86_64 since we must run gen_matypes
332if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
333 case "$host_cpu" in
334 i?86 | x86_64)
335 enable_asm=no
336 AC_MSG_RESULT([no, cross compiling])
337 ;;
338 esac
339fi
340# check for supported arches
341if test "x$enable_asm" = xyes; then
342 case "$host_cpu" in
343 i?86)
344 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100345 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700346 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
347 ;;
348 esac
349 ;;
350 x86_64)
351 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100352 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700353 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
354 ;;
355 esac
356 ;;
357 powerpc)
358 case "$host_os" in
359 linux*)
360 asm_arch=ppc
361 ;;
362 esac
363 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800364 sparc*)
365 case "$host_os" in
366 linux*)
367 asm_arch=sparc
368 ;;
369 esac
370 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700371 esac
372
373 case "$asm_arch" in
374 x86)
Dan Nicholson61e925f2009-02-11 10:42:34 -0800375 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800376 MESA_ASM_SOURCES='$(X86_SOURCES)'
377 GLAPI_ASM_SOURCES='$(X86_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700378 AC_MSG_RESULT([yes, x86])
379 ;;
380 x86_64)
381 ASM_FLAGS="-DUSE_X86_64_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800382 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
383 GLAPI_ASM_SOURCES='$(X86-64_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700384 AC_MSG_RESULT([yes, x86_64])
385 ;;
386 ppc)
387 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800388 MESA_ASM_SOURCES='$(PPC_SOURCES)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700389 AC_MSG_RESULT([yes, ppc])
390 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800391 sparc)
392 ASM_FLAGS="-DUSE_SPARC_ASM"
393 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
394 GLAPI_ASM_SOURCES='$(SPARC_API)'
395 AC_MSG_RESULT([yes, sparc])
396 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700397 *)
398 AC_MSG_RESULT([no, platform not supported])
399 ;;
400 esac
401fi
402AC_SUBST([ASM_FLAGS])
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800403AC_SUBST([MESA_ASM_SOURCES])
404AC_SUBST([GLAPI_ASM_SOURCES])
Dan Nicholson871125a2008-06-04 13:00:35 -0700405
406dnl PIC code macro
407MESA_PIC_FLAGS
408
409dnl Check to see if dlopen is in default libraries (like Solaris, which
410dnl has it in libc), or if libdl is needed to get it.
411AC_CHECK_FUNC([dlopen], [],
412 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
Chia-I Wu08f4bc02010-07-16 20:09:29 +0800413AC_SUBST([DLOPEN_LIBS])
Dan Nicholson871125a2008-06-04 13:00:35 -0700414
Dan Nicholson985e1cd2008-06-04 13:17:06 -0700415dnl See if posix_memalign is available
416AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
417
Dan Nicholson871125a2008-06-04 13:00:35 -0700418dnl SELinux awareness.
419AC_ARG_ENABLE([selinux],
420 [AS_HELP_STRING([--enable-selinux],
421 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
422 [MESA_SELINUX="$enableval"],
423 [MESA_SELINUX=no])
424if test "x$enable_selinux" = "xyes"; then
425 AC_CHECK_HEADER([selinux/selinux.h],[],
426 [AC_MSG_ERROR([SELinux headers not found])])
427 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
428 [AC_MSG_ERROR([SELinux library not found])])
429 SELINUX_LIBS="-lselinux"
430 DEFINES="$DEFINES -DMESA_SELINUX"
431fi
432
Dan Nicholson871125a2008-06-04 13:00:35 -0700433dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800434dnl Driver configuration. Options are xlib, dri and osmesa right now.
Kristian Høgsberg43875802010-02-25 15:49:18 -0500435dnl More later: fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800436dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700437default_driver="xlib"
438
439case "$host_os" in
440linux*)
441 case "$host_cpu" in
David S. Miller32dc28a2009-02-24 20:06:05 -0700442 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700443 esac
444 ;;
Julien Cristau98fcdf32008-10-28 18:56:05 +0100445*freebsd* | dragonfly*)
Eric Anholt711222b2008-04-18 15:03:01 -0700446 case "$host_cpu" in
Robert Noland48f05432009-04-10 11:41:27 -0500447 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700448 esac
449 ;;
450esac
451
Dan Nicholson297e16c2008-05-05 15:42:53 -0700452AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800453 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700454 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700455 [mesa_driver="$withval"],
456 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800457dnl Check for valid option
458case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800459xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800460 ;;
461*)
462 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
463 ;;
464esac
465
Eric Anholt0a1b54d2010-06-21 11:29:15 -0700466PKG_CHECK_MODULES([TALLOC], [talloc])
467
Dan Nicholson44d99142007-12-05 18:47:01 -0800468dnl
469dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700470dnl
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800471
472dnl this variable will be prepended to SRC_DIRS and is not exported
Chia-I Wu296adbd2010-04-26 12:56:44 +0800473CORE_DIRS="mapi/glapi glsl mesa"
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800474
Jakob Bornecrantz05281062010-06-05 13:33:58 +0200475SRC_DIRS=""
Dan Nicholsondca1b792007-10-23 09:25:58 -0700476GLU_DIRS="sgi"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100477GALLIUM_DIRS="auxiliary drivers state_trackers"
Keith Whitwell51bff092010-03-11 14:43:00 +0000478GALLIUM_TARGET_DIRS=""
Jakob Bornecrantzc9f98672010-03-16 13:54:18 +0000479GALLIUM_WINSYS_DIRS="sw"
Corbin Simpson25609782010-06-22 22:00:43 -0700480GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug identity"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100481GALLIUM_STATE_TRACKERS_DIRS=""
482
Dan Nicholson44d99142007-12-05 18:47:01 -0800483case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800484xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800485 DRIVER_DIRS="x11"
Jakob Bornecrantzc9f98672010-03-16 13:54:18 +0000486 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
Keith Whitwell51bff092010-03-11 14:43:00 +0000487 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
Dan Nicholson44d99142007-12-05 18:47:01 -0800488 ;;
489dri)
Kristian Høgsberg6e8897f2010-02-09 09:58:36 -0500490 SRC_DIRS="$SRC_DIRS glx"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100491 DRIVER_DIRS="dri"
Jakob Bornecrantz23a915e2010-06-23 03:31:18 +0200492 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri"
Dan Nicholson44d99142007-12-05 18:47:01 -0800493 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800494osmesa)
495 DRIVER_DIRS="osmesa"
496 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800497esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700498AC_SUBST([SRC_DIRS])
499AC_SUBST([GLU_DIRS])
500AC_SUBST([DRIVER_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100501AC_SUBST([GALLIUM_DIRS])
Keith Whitwell51bff092010-03-11 14:43:00 +0000502AC_SUBST([GALLIUM_TARGET_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100503AC_SUBST([GALLIUM_WINSYS_DIRS])
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +0000504AC_SUBST([GALLIUM_DRIVERS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100505AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
Dave Airlie81fe1982010-04-22 14:59:29 +1000506AC_SUBST([MESA_LLVM])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700507
508dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700509dnl Find out if X is available. The variable have_x is set if libX11 is
Dan Nicholson99803a42008-07-01 09:03:15 -0700510dnl found to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700511dnl
512if test -n "$PKG_CONFIG"; then
513 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700514 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700515 x11_pkgconfig=yes
516 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700517 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700518 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700519 ])
520 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700521else
522 x11_pkgconfig=no
523fi
524dnl Use the autoconf macro if no pkg-config files
Jeff Smith8d86d392010-03-12 18:55:09 -0600525if test "$x11_pkgconfig" = yes; then
Dan Nicholsone725ef12010-03-15 20:53:56 -0700526 PKG_CHECK_MODULES([X11], [x11])
Jeff Smith8d86d392010-03-12 18:55:09 -0600527else
Dan Nicholsondca1b792007-10-23 09:25:58 -0700528 AC_PATH_XTRA
Dan Nicholsone725ef12010-03-15 20:53:56 -0700529 test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
530 test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
531 AC_SUBST([X11_CFLAGS])
532 AC_SUBST([X11_LIBS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700533fi
534
Dan Nicholson99803a42008-07-01 09:03:15 -0700535dnl Try to tell the user that the --x-* options are only used when
536dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
537m4_divert_once([HELP_BEGIN],
538[These options are only used when the X libraries cannot be found by the
539pkg-config utility.])
540
Dan Nicholson44d99142007-12-05 18:47:01 -0800541dnl We need X for xlib and dri, so bomb now if it's not found
542case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800543xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800544 if test "$no_x" = yes; then
545 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
546 fi
547 ;;
548esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700549
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700550dnl XCB - this is only used for GLX right now
551AC_ARG_ENABLE([xcb],
552 [AS_HELP_STRING([--enable-xcb],
553 [use XCB for GLX @<:@default=disabled@:>@])],
554 [enable_xcb="$enableval"],
555 [enable_xcb=no])
556if test "x$enable_xcb" = xyes; then
557 DEFINES="$DEFINES -DUSE_XCB"
558else
559 enable_xcb=no
560fi
561
Dan Nicholson44d99142007-12-05 18:47:01 -0800562dnl
563dnl libGL configuration per driver
564dnl
565case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800566xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800567 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700568 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800569 GL_PC_REQ_PRIV="x11 xext"
Dan Nicholsona1307182007-12-12 17:49:49 -0800570 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
571 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800572 else
573 # should check these...
574 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
575 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800576 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
577 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson44d99142007-12-05 18:47:01 -0800578 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700579 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
580 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800581
582 # if static, move the external libraries to the programs
583 # and empty the libraries for libGL
584 if test "$enable_static" = yes; then
585 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
586 GL_LIB_DEPS=""
587 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800588 ;;
589dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800590 # DRI must be shared, I think
591 if test "$enable_static" = yes; then
592 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
593 fi
594
Dan Nicholson44d99142007-12-05 18:47:01 -0800595 # Check for libdrm
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -0700596 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
597 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
Jesse Barnesf2f83d92010-01-11 17:28:10 -0500598 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
Jesse Barnesed59b132010-01-13 15:48:14 -0500599 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
600 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
Dan Nicholson44d99142007-12-05 18:47:01 -0800601
602 # find the DRI deps for libGL
603 if test "$x11_pkgconfig" = yes; then
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700604 # add xcb modules if necessary
605 dri_modules="x11 xext xxf86vm xdamage xfixes"
606 if test "$enable_xcb" = yes; then
607 dri_modules="$dri_modules x11-xcb xcb-glx"
608 fi
609
610 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800611 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Dan Nicholson44d99142007-12-05 18:47:01 -0800612 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
613 GL_LIB_DEPS="$DRIGL_LIBS"
614 else
615 # should check these...
616 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
617 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800618 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
619 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700620
621 # XCB can only be used from pkg-config
622 if test "$enable_xcb" = yes; then
623 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800624 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700625 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
626 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
627 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800628 fi
629
630 # need DRM libs, -lpthread, etc.
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700631 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
632 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500633 GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg74399d42010-05-02 09:51:13 -0400634 GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500635 GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg74399d42010-05-02 09:51:13 -0400636 GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800637 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800638osmesa)
639 # No libGL for osmesa
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700640 GL_LIB_DEPS=""
Dan Nicholson979ff512007-12-05 18:47:01 -0800641 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800642esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700643AC_SUBST([GL_LIB_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800644AC_SUBST([GL_PC_REQ_PRIV])
645AC_SUBST([GL_PC_LIB_PRIV])
646AC_SUBST([GL_PC_CFLAGS])
647AC_SUBST([DRI_PC_REQ_PRIV])
Li Pengc33c1912010-07-30 12:26:15 +0800648AC_SUBST([GLESv1_CM_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -0400649AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500650AC_SUBST([GLESv2_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -0400651AC_SUBST([GLESv2_PC_LIB_PRIV])
652
Dan Nicholsondca1b792007-10-23 09:25:58 -0700653
654dnl
655dnl More X11 setup
656dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800657if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700658 DEFINES="$DEFINES -DUSE_XSHM"
659fi
660
661dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800662dnl More DRI setup
663dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700664AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800665 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800666 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700667 [GLX_USE_TLS="$enableval"],
668 [GLX_USE_TLS=no])
Dan Nicholson44d99142007-12-05 18:47:01 -0800669dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700670AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800671 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700672 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700673 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700674 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700675AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Chow Loong Jin35506de2009-10-28 14:34:14 +0800676dnl Extra search path for DRI drivers
677AC_ARG_WITH([dri-searchpath],
678 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
679 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
680 [DRI_DRIVER_SEARCH_DIR="$withval"],
681 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
682AC_SUBST([DRI_DRIVER_SEARCH_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800683dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700684AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800685 [AS_HELP_STRING([--disable-driglx-direct],
Chia-I Wucf588ab2010-07-06 14:34:43 +0800686 [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700687 [driglx_direct="$enableval"],
688 [driglx_direct="yes"])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800689dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700690AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800691 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholson5cae1b72008-06-30 10:28:02 -0700692 [comma delimited DRI drivers list, e.g.
Michel Dänzercade0712009-07-10 14:49:46 +0200693 "swrast,i965,radeon" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700694 [with_dri_drivers="$withval"],
695 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800696if test "x$with_dri_drivers" = x; then
697 with_dri_drivers=no
698fi
699
Kristian Høgsberg0f680322010-04-27 13:42:33 -0400700dnl Determine which APIs to support
701AC_ARG_ENABLE([opengl],
702 [AS_HELP_STRING([--disable-opengl],
703 [disable support for standard OpenGL API @<:@default=no@:>@])],
704 [enable_opengl="$enableval"],
705 [enable_opengl=yes])
706AC_ARG_ENABLE([gles1],
707 [AS_HELP_STRING([--enable-gles1],
708 [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
709 [enable_gles1="$enableval"],
710 [enable_gles1=no])
711AC_ARG_ENABLE([gles2],
712 [AS_HELP_STRING([--enable-gles2],
713 [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
714 [enable_gles2="$enableval"],
715 [enable_gles2=no])
Chia-I Wu63ab2502010-05-05 15:38:02 +0800716AC_ARG_ENABLE([gles-overlay],
717 [AS_HELP_STRING([--enable-gles-overlay],
718 [build separate OpenGL ES only libraries @<:@default=no@:>@])],
719 [enable_gles_overlay="$enableval"],
720 [enable_gles_overlay=no])
Kristian Høgsberg0f680322010-04-27 13:42:33 -0400721
722API_DEFINES=""
Chia-I Wu87cc2da2010-05-12 14:17:17 +0800723GLES_OVERLAY=0
Kristian Høgsberg0f680322010-04-27 13:42:33 -0400724if test "x$enable_opengl" = xno; then
725 API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
726else
727 API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
728fi
729if test "x$enable_gles1" = xyes; then
730 API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
731fi
732if test "x$enable_gles2" = xyes; then
733 API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
734fi
Chia-I Wu63ab2502010-05-05 15:38:02 +0800735if test "x$enable_gles_overlay" = xyes -o \
736 "x$enable_gles1" = xyes -o "x$enable_gles2" = xyes; then
Chia-I Wu296adbd2010-04-26 12:56:44 +0800737 CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
Chia-I Wu63ab2502010-05-05 15:38:02 +0800738 if test "x$enable_gles_overlay" = xyes; then
Chia-I Wu87cc2da2010-05-12 14:17:17 +0800739 GLES_OVERLAY=1
Chia-I Wu63ab2502010-05-05 15:38:02 +0800740 fi
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500741fi
Kristian Høgsberg0f680322010-04-27 13:42:33 -0400742AC_SUBST([API_DEFINES])
Chia-I Wu87cc2da2010-05-12 14:17:17 +0800743AC_SUBST([GLES_OVERLAY])
Kristian Høgsberg0f680322010-04-27 13:42:33 -0400744
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800745dnl If $with_dri_drivers is yes, directories will be added through
746dnl platform checks
747DRI_DIRS=""
748case "$with_dri_drivers" in
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100749no) ;;
750yes)
751 DRI_DIRS="yes"
752 ;;
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800753*)
754 # verify the requested driver directories exist
Dan Nicholsone6e4f252008-07-06 14:17:39 -0700755 dri_drivers=`IFS=', '; echo $with_dri_drivers`
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800756 for driver in $dri_drivers; do
757 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
758 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
759 done
760 DRI_DIRS="$dri_drivers"
761 ;;
762esac
763
Dan Nicholson44d99142007-12-05 18:47:01 -0800764dnl Set DRI_DIRS, DEFINES and LIB_DEPS
765if test "$mesa_driver" = dri; then
766 # Use TLS in GLX?
767 if test "x$GLX_USE_TLS" = xyes; then
768 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
769 fi
770
Dan Nicholson44d99142007-12-05 18:47:01 -0800771 # Platform specific settings and drivers to build
772 case "$host_os" in
773 linux*)
774 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
Dan Nicholson44d99142007-12-05 18:47:01 -0800775 if test "x$driglx_direct" = xyes; then
776 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
777 fi
Jerome Glisse14f79d42008-12-18 13:36:07 +0100778 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800779
780 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800781 x86_64)
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -0500782 # sis is missing because they have not be converted to use
783 # the new interface. i810 are missing because there is no
784 # x86-64 system where they could *ever* be used.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100785 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400786 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +0300787 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800788 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800789 ;;
790 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800791 # Build only the drivers for cards that exist on PowerPC.
792 # At some point MGA will be added, but not yet.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100793 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400794 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800795 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800796 ;;
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000797 sparc*)
798 # Build only the drivers for cards that exist on sparc`
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100799 if test "x$DRI_DIRS" = "xyes"; then
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -0500800 DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000801 fi
802 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800803 esac
804 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700805 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800806 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
807 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
808 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
809 if test "x$driglx_direct" = xyes; then
810 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
811 fi
812 if test "x$GXX" = xyes; then
813 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
814 fi
815
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100816 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400817 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +0300818 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800819 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800820 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700821 gnu*)
822 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
823 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
824 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700825 solaris*)
826 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
827 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
828 if test "x$driglx_direct" = xyes; then
829 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
830 fi
831 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800832 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800833
834 # default drivers
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100835 if test "x$DRI_DIRS" = "xyes"; then
Corbin Simpson8e4657a2009-10-22 12:29:30 -0700836 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -0500837 savage sis tdfx unichrome swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -0800838 fi
839
Dan Nicholson44d99142007-12-05 18:47:01 -0800840 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
841
842 # Check for expat
843 EXPAT_INCLUDES=""
844 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700845 AC_ARG_WITH([expat],
846 [AS_HELP_STRING([--with-expat=DIR],
847 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800848 EXPAT_INCLUDES="-I$withval/include"
849 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
850 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
851 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
852 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700853 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
854 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
855 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800856
857 # put all the necessary libs together
Eric Anholt0a1b54d2010-06-21 11:29:15 -0700858 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS $TALLOC_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800859fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700860AC_SUBST([DRI_DIRS])
861AC_SUBST([EXPAT_INCLUDES])
862AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800863
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500864case $DRI_DIRS in
865*i915*|*i965*)
Eric Anholt73de09f2010-06-07 09:25:10 -0700866 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= 2.4.21])
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500867 ;;
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -0500868esac
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500869
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -0500870case $DRI_DIRS in
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500871*radeon*|*r200*|*r300*|*r600*)
872 PKG_CHECK_MODULES([LIBDRM_RADEON],
873 [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
874 HAVE_LIBDRM_RADEON=yes,
875 HAVE_LIBDRM_RADEON=no)
876
877 if test "$HAVE_LIBDRM_RADEON" = yes; then
878 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
879 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
880 fi
881 ;;
882esac
883AC_SUBST([RADEON_CFLAGS])
884AC_SUBST([RADEON_LDFLAGS])
885
886
Dan Nicholson44d99142007-12-05 18:47:01 -0800887dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700888dnl OSMesa configuration
889dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800890if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800891 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800892else
Dan Nicholson544ab202007-12-30 08:41:53 -0800893 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800894fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700895AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800896 [AS_HELP_STRING([--enable-gl-osmesa],
Dan Nicholsoncbf30fc2010-06-16 09:23:17 -0700897 [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700898 [gl_osmesa="$enableval"],
899 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800900if test "x$gl_osmesa" = xyes; then
901 if test "$mesa_driver" = osmesa; then
902 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800903 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800904 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800905 fi
906fi
907
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800908dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700909AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800910 [AS_HELP_STRING([--with-osmesa-bits=BITS],
911 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700912 [osmesa_bits="$withval"],
913 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800914if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
915 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
916 osmesa_bits=8
917fi
918case "x$osmesa_bits" in
919x8)
920 OSMESA_LIB=OSMesa
921 ;;
922x16|x32)
923 OSMESA_LIB="OSMesa$osmesa_bits"
924 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
925 ;;
926*)
927 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
928 ;;
929esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700930AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800931
Dan Nicholsoncbf30fc2010-06-16 09:23:17 -0700932case "$DRIVER_DIRS" in
933*osmesa*)
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700934 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800935 if test "$enable_static" = no; then
Dan Nicholson4795dd52009-06-04 19:42:08 -0700936 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800937 else
938 OSMESA_LIB_DEPS=""
939 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800940 OSMESA_MESA_DEPS=""
Dan Nicholson4795dd52009-06-04 19:42:08 -0700941 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -0800942 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800943esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700944AC_SUBST([OSMESA_LIB_DEPS])
945AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800946AC_SUBST([OSMESA_PC_REQ])
947AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700948
949dnl
Dan Nicholson53b37342009-02-25 17:45:34 -0800950dnl EGL configuration
951dnl
Dan Nicholson66f97862009-04-29 12:11:43 -0700952AC_ARG_ENABLE([egl],
953 [AS_HELP_STRING([--disable-egl],
954 [disable EGL library @<:@default=enabled@:>@])],
955 [enable_egl="$enableval"],
956 [enable_egl=yes])
957if test "x$enable_egl" = xyes; then
958 SRC_DIRS="$SRC_DIRS egl"
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800959 EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
960 EGL_DRIVERS_DIRS=""
Chia-I Wu2eb7a2f2010-02-05 10:46:11 +0800961 if test "$enable_static" != yes; then
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800962 # build egl_glx when libGL is built
Chia-I Wu2eb7a2f2010-02-05 10:46:11 +0800963 if test "$mesa_driver" != osmesa; then
964 EGL_DRIVERS_DIRS="glx"
965 fi
966
Chia-I Wu39ae9652010-07-16 19:48:52 +0800967 if test "$mesa_driver" = dri; then
968 # build egl_dri2 when xcb-dri2 is available
969 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
970 [have_xcb_dri2=yes],[have_xcb_dri2=no])
971 PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
972 [have_libudev=yes],[have_libudev=no])
973
974 if test "$have_xcb_dri2" = yes; then
975 EGL_DRIVER_DRI2=dri2
976 DEFINES="$DEFINES -DHAVE_XCB_DRI2"
977 if test "$have_libudev" = yes; then
978 DEFINES="$DEFINES -DHAVE_LIBUDEV"
979 fi
980 fi
981 fi
Kristian Høgsberg2168b872010-06-02 22:48:06 -0400982
983 EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
Kristian Høgsberg42fa0092010-02-03 10:18:28 -0500984 fi
Dan Nicholson53b37342009-02-25 17:45:34 -0800985fi
Dan Nicholson53b37342009-02-25 17:45:34 -0800986AC_SUBST([EGL_LIB_DEPS])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800987AC_SUBST([EGL_DRIVERS_DIRS])
Dan Nicholson53b37342009-02-25 17:45:34 -0800988
989dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700990dnl GLU configuration
991dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700992AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800993 [AS_HELP_STRING([--disable-glu],
994 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700995 [enable_glu="$enableval"],
996 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700997if test "x$enable_glu" = xyes; then
998 SRC_DIRS="$SRC_DIRS glu"
999
Dan Nicholson979ff512007-12-05 18:47:01 -08001000 case "$mesa_driver" in
1001 osmesa)
Dan Nicholson979ff512007-12-05 18:47:01 -08001002 # Link libGLU to libOSMesa instead of libGL
1003 GLU_LIB_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -08001004 GLU_PC_REQ="osmesa"
Dan Nicholson88586332007-11-15 08:59:57 -08001005 if test "$enable_static" = no; then
1006 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
1007 else
1008 GLU_MESA_DEPS=""
1009 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001010 ;;
1011 *)
Dan Nicholson88586332007-11-15 08:59:57 -08001012 # If static, empty GLU_LIB_DEPS and add libs for programs to link
Dan Nicholson71e208b2008-11-24 11:01:57 -08001013 GLU_PC_REQ="gl"
1014 GLU_PC_LIB_PRIV="-lm"
Dan Nicholson88586332007-11-15 08:59:57 -08001015 if test "$enable_static" = no; then
1016 GLU_LIB_DEPS="-lm"
1017 GLU_MESA_DEPS='-l$(GL_LIB)'
1018 else
1019 GLU_LIB_DEPS=""
1020 GLU_MESA_DEPS=""
1021 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
1022 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001023 ;;
1024 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001025fi
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001026if test "$enable_static" = no; then
1027 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
1028fi
Dan Nicholson71e208b2008-11-24 11:01:57 -08001029GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
Dan Nicholson297e16c2008-05-05 15:42:53 -07001030AC_SUBST([GLU_LIB_DEPS])
1031AC_SUBST([GLU_MESA_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001032AC_SUBST([GLU_PC_REQ])
1033AC_SUBST([GLU_PC_REQ_PRIV])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001034AC_SUBST([GLU_PC_LIB_PRIV])
1035AC_SUBST([GLU_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001036
1037dnl
1038dnl GLw configuration
1039dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -07001040AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001041 [AS_HELP_STRING([--disable-glw],
1042 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001043 [enable_glw="$enableval"],
1044 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -08001045dnl Don't build GLw on osmesa
1046if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
1047 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
1048 enable_glw=no
1049fi
Dan Nicholson776c60d2008-07-18 07:40:41 -07001050AC_ARG_ENABLE([motif],
1051 [AS_HELP_STRING([--enable-motif],
1052 [use Motif widgets in GLw @<:@default=disabled@:>@])],
1053 [enable_motif="$enableval"],
1054 [enable_motif=no])
1055
Dan Nicholsondca1b792007-10-23 09:25:58 -07001056if test "x$enable_glw" = xyes; then
1057 SRC_DIRS="$SRC_DIRS glw"
1058 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001059 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001060 GLW_PC_REQ_PRIV="x11 xt"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001061 GLW_LIB_DEPS="$GLW_LIBS"
1062 else
1063 # should check these...
Dan Nicholson776c60d2008-07-18 07:40:41 -07001064 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001065 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1066 GLW_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001067 fi
1068
1069 GLW_SOURCES="GLwDrawA.c"
1070 MOTIF_CFLAGS=
1071 if test "x$enable_motif" = xyes; then
1072 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1073 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1074 if test "x$MOTIF_CONFIG" != xno; then
1075 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1076 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1077 else
1078 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1079 [AC_MSG_ERROR([Can't locate Motif headers])])
1080 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1081 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1082 fi
1083 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1084 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001085 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1086 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001087 fi
1088
Dan Nicholson88586332007-11-15 08:59:57 -08001089 # If static, empty GLW_LIB_DEPS and add libs for programs to link
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001090 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
Dan Nicholson88586332007-11-15 08:59:57 -08001091 if test "$enable_static" = no; then
1092 GLW_MESA_DEPS='-l$(GL_LIB)'
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001093 GLW_LIB_DEPS="$GLW_LIB_DEPS"
Dan Nicholson88586332007-11-15 08:59:57 -08001094 else
1095 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1096 GLW_LIB_DEPS=""
1097 GLW_MESA_DEPS=""
1098 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001099fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001100AC_SUBST([GLW_LIB_DEPS])
1101AC_SUBST([GLW_MESA_DEPS])
Dan Nicholson776c60d2008-07-18 07:40:41 -07001102AC_SUBST([GLW_SOURCES])
1103AC_SUBST([MOTIF_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001104AC_SUBST([GLW_PC_REQ_PRIV])
1105AC_SUBST([GLW_PC_LIB_PRIV])
1106AC_SUBST([GLW_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001107
1108dnl
1109dnl GLUT configuration
1110dnl
1111if test -f "$srcdir/include/GL/glut.h"; then
1112 default_glut=yes
1113else
1114 default_glut=no
1115fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001116AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001117 [AS_HELP_STRING([--disable-glut],
1118 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001119 [enable_glut="$enableval"],
1120 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001121
1122dnl Can't build glut if GLU not available
1123if test "x$enable_glu$enable_glut" = xnoyes; then
1124 AC_MSG_WARN([Disabling glut since GLU is disabled])
1125 enable_glut=no
1126fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001127dnl Don't build glut on osmesa
1128if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1129 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1130 enable_glut=no
1131fi
1132
Dan Nicholsondca1b792007-10-23 09:25:58 -07001133if test "x$enable_glut" = xyes; then
1134 SRC_DIRS="$SRC_DIRS glut/glx"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001135 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001136 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001137 GLUT_PC_REQ_PRIV="x11 xmu xi"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001138 GLUT_LIB_DEPS="$GLUT_LIBS"
1139 else
1140 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -08001141 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001142 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1143 GLUT_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001144 fi
John Hein96172542010-07-01 12:53:28 -07001145 if test "x$GCC" = xyes; then
1146 GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
1147 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001148 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1149 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001150
Dan Nicholson88586332007-11-15 08:59:57 -08001151 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1152 if test "$enable_static" = no; then
1153 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1154 else
1155 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1156 GLUT_LIB_DEPS=""
1157 GLUT_MESA_DEPS=""
1158 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001159fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001160AC_SUBST([GLUT_LIB_DEPS])
1161AC_SUBST([GLUT_MESA_DEPS])
1162AC_SUBST([GLUT_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001163AC_SUBST([GLUT_PC_REQ_PRIV])
1164AC_SUBST([GLUT_PC_LIB_PRIV])
1165AC_SUBST([GLUT_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001166
1167dnl
1168dnl Program library dependencies
1169dnl Only libm is added here if necessary as the libraries should
1170dnl be pulled in by the linker
1171dnl
1172if test "x$APP_LIB_DEPS" = x; then
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001173 case "$host_os" in
1174 solaris*)
1175 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1176 ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +01001177 cygwin*)
1178 APP_LIB_DEPS="-lX11"
1179 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001180 *)
1181 APP_LIB_DEPS="-lm"
1182 ;;
1183 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001184fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001185AC_SUBST([APP_LIB_DEPS])
1186AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001187
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001188dnl
1189dnl Gallium configuration
1190dnl
1191AC_ARG_ENABLE([gallium],
1192 [AS_HELP_STRING([--disable-gallium],
1193 [build gallium @<:@default=enabled@:>@])],
1194 [enable_gallium="$enableval"],
1195 [enable_gallium=yes])
1196if test "x$enable_gallium" = xyes; then
Jakob Bornecrantzbe38b322010-03-23 13:23:26 +00001197 SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
Dave Airlie81fe1982010-04-22 14:59:29 +10001198 AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
1199 [HAS_UDIS86="no"])
1200 AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001201fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001202
Dave Airlie81fe1982010-04-22 14:59:29 +10001203AC_SUBST([LLVM_CFLAGS])
1204AC_SUBST([LLVM_LIBS])
1205AC_SUBST([LLVM_LDFLAGS])
1206AC_SUBST([LLVM_VERSION])
1207
Chia-I Wu874ccd52010-05-04 22:43:05 +08001208VG_LIB_DEPS=""
Chia-I Wu63ab2502010-05-05 15:38:02 +08001209EGL_CLIENT_APIS='$(GL_LIB)'
1210if test "x$enable_gles_overlay" = xyes; then
1211 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
1212fi
Chia-I Wu874ccd52010-05-04 22:43:05 +08001213
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001214dnl
1215dnl Gallium state trackers configuration
1216dnl
1217AC_ARG_WITH([state-trackers],
1218 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1219 [comma delimited state_trackers list, e.g.
1220 "egl,glx" @<:@default=auto@:>@])],
1221 [with_state_trackers="$withval"],
1222 [with_state_trackers=yes])
1223
1224case "$with_state_trackers" in
1225no)
1226 GALLIUM_STATE_TRACKERS_DIRS=""
1227 ;;
1228yes)
1229 # look at what else is built
1230 case "$mesa_driver" in
Jakob Bornecrantz373e6712009-04-18 23:13:56 +01001231 xlib)
1232 GALLIUM_STATE_TRACKERS_DIRS=glx
1233 ;;
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001234 dri)
Jakob Bornecrantz5b1fc142010-03-25 18:29:51 +01001235 GALLIUM_STATE_TRACKERS_DIRS="dri"
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001236 HAVE_ST_DRI="yes"
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001237 if test "x$enable_egl" = xyes; then
Chia-I Wu3c967a92010-01-22 16:31:43 +08001238 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001239 HAVE_ST_EGL="yes"
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001240 fi
1241 # Have only tested st/xorg on 1.6.0 servers
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001242 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001243 HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1244 HAVE_ST_XORG="no")
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001245 ;;
1246 esac
1247 ;;
1248*)
1249 # verify the requested state tracker exist
Chia-I Wu63ab2502010-05-05 15:38:02 +08001250 state_trackers=""
1251 _state_trackers=`IFS=', '; echo $with_state_trackers`
1252 for tracker in $_state_trackers; do
Chia-I Wue5d351d2009-12-23 11:18:00 +08001253 case "$tracker" in
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001254 dri)
1255 if test "x$mesa_driver" != xdri; then
1256 AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
1257 fi
1258 HAVE_ST_DRI="yes"
1259 ;;
Chia-I Wu3c967a92010-01-22 16:31:43 +08001260 egl)
Chia-I Wue5d351d2009-12-23 11:18:00 +08001261 if test "x$enable_egl" != xyes; then
Chia-I Wu3c967a92010-01-22 16:31:43 +08001262 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
Chia-I Wue5d351d2009-12-23 11:18:00 +08001263 fi
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001264 HAVE_ST_EGL="yes"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001265 ;;
1266 xorg)
Jakob Bornecrantz4f956882010-07-13 07:40:47 -07001267 PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001268 PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1269 PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001270 HAVE_ST_XORG="yes"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001271 ;;
1272 es)
Chia-I Wu63ab2502010-05-05 15:38:02 +08001273 AC_MSG_WARN([state tracker 'es' has been replaced by --enable-gles-overlay])
1274
1275 if test "x$enable_gles_overlay" != xyes; then
1276 if test "x$enable_gles1" != xyes -a "x$enable_gles2" != xyes; then
1277 CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
1278 fi
Chia-I Wu87cc2da2010-05-12 14:17:17 +08001279 GLES_OVERLAY=1
Chia-I Wu63ab2502010-05-05 15:38:02 +08001280 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
Chia-I Wu296adbd2010-04-26 12:56:44 +08001281 fi
Chia-I Wu63ab2502010-05-05 15:38:02 +08001282 tracker=""
Chia-I Wue5d351d2009-12-23 11:18:00 +08001283 ;;
Chia-I Wu75143ef2010-04-16 18:12:37 +08001284 vega)
1285 CORE_DIRS="$CORE_DIRS mapi/vgapi"
Chia-I Wu874ccd52010-05-04 22:43:05 +08001286 VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
Chia-I Wu63ab2502010-05-05 15:38:02 +08001287 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
Chia-I Wu75143ef2010-04-16 18:12:37 +08001288 ;;
Chia-I Wue5d351d2009-12-23 11:18:00 +08001289 esac
Chia-I Wu63ab2502010-05-05 15:38:02 +08001290
1291 if test -n "$tracker"; then
1292 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1293 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
1294 if test -n "$state_trackers"; then
1295 state_trackers="$state_trackers $tracker"
1296 else
1297 state_trackers="$tracker"
1298 fi
1299 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001300 done
1301 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1302 ;;
1303esac
1304
Chia-I Wu874ccd52010-05-04 22:43:05 +08001305AC_SUBST([VG_LIB_DEPS])
Chia-I Wu63ab2502010-05-05 15:38:02 +08001306AC_SUBST([EGL_CLIENT_APIS])
1307
1308if test "x$HAVE_ST_EGL" = xyes; then
Chia-I Wud8e0e112010-06-29 14:04:27 +08001309 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
Chia-I Wucf588ab2010-07-06 14:34:43 +08001310 # define GLX_DIRECT_RENDERING even when the driver is not dri
1311 if test "x$mesa_driver" != xdri -a "x$driglx_direct" = xyes; then
1312 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1313 fi
Chia-I Wu63ab2502010-05-05 15:38:02 +08001314fi
Chia-I Wu874ccd52010-05-04 22:43:05 +08001315
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001316if test "x$HAVE_ST_XORG" = xyes; then
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001317 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1318 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1319 HAVE_XEXTPROTO_71="no")
1320fi
1321
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001322AC_ARG_WITH([egl-platforms],
1323 [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1324 [comma delimited native platforms libEGL supports, e.g.
1325 "x11,kms" @<:@default=auto@:>@])],
1326 [with_egl_platforms="$withval"],
1327 [with_egl_platforms=yes])
Chia-I Wu49381d62010-01-11 01:23:01 +08001328AC_ARG_WITH([egl-displays],
1329 [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001330 [DEPRECATED. Use --with-egl-platforms instead])],
1331 [with_egl_platforms="$withval"])
Chia-I Wu49381d62010-01-11 01:23:01 +08001332
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001333EGL_PLATFORMS=""
1334case "$with_egl_platforms" in
Chia-I Wu49381d62010-01-11 01:23:01 +08001335yes)
1336 if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001337 EGL_PLATFORMS="x11"
Chia-I Wu49381d62010-01-11 01:23:01 +08001338 fi
1339 ;;
1340*)
1341 if test "x$enable_egl" != xyes; then
1342 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1343 fi
1344 # verify the requested driver directories exist
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001345 egl_platforms=`IFS=', '; echo $with_egl_platforms`
1346 for plat in $egl_platforms; do
1347 test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
1348 AC_MSG_ERROR([EGL platform '$plat' does't exist])
1349 if test "$plat" = "fbdev"; then
Chia-I Wu8f3e48e2010-06-17 14:10:53 +08001350 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
1351 fi
Chia-I Wu49381d62010-01-11 01:23:01 +08001352 done
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001353 EGL_PLATFORMS="$egl_platforms"
Chia-I Wu49381d62010-01-11 01:23:01 +08001354 ;;
1355esac
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001356AC_SUBST([EGL_PLATFORMS])
Chia-I Wu49381d62010-01-11 01:23:01 +08001357
Chia-I Wu28c3e572010-01-23 20:18:43 +08001358AC_ARG_WITH([egl-driver-dir],
1359 [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1360 [directory for EGL drivers [[default=${libdir}/egl]]])],
1361 [EGL_DRIVER_INSTALL_DIR="$withval"],
1362 [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1363AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1364
Joel Bosveld8acca482009-03-06 08:46:08 +09001365AC_ARG_WITH([xorg-driver-dir],
1366 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1367 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1368 [XORG_DRIVER_INSTALL_DIR="$withval"],
1369 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1370AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1371
Tom Fogal7085dce2009-08-13 19:40:30 -06001372AC_ARG_WITH([max-width],
1373 [AS_HELP_STRING([--with-max-width=N],
1374 [Maximum framebuffer width (4096)])],
1375 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1376 AS_IF([test "${withval}" -gt "4096"],
1377 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1378)
1379AC_ARG_WITH([max-height],
1380 [AS_HELP_STRING([--with-max-height=N],
1381 [Maximum framebuffer height (4096)])],
1382 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1383 AS_IF([test "${withval}" -gt "4096"],
1384 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1385)
1386
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001387dnl
Dave Airlie81fe1982010-04-22 14:59:29 +10001388dnl Gallium LLVM
1389dnl
1390AC_ARG_ENABLE([gallium-llvm],
1391 [AS_HELP_STRING([--enable-gallium-llvm],
1392 [build gallium LLVM support @<:@default=disabled@:>@])],
1393 [enable_gallium_llvm="$enableval"],
1394 [enable_gallium_llvm=auto])
1395if test "x$enable_gallium_llvm" = xyes; then
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001396 if test "x$LLVM_CONFIG" != xno; then
1397 LLVM_VERSION=`$LLVM_CONFIG --version`
1398 LLVM_CFLAGS=`$LLVM_CONFIG --cflags`
1399 LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
1400
1401 if test "x$HAS_UDIS86" != xno; then
1402 LLVM_LIBS="$LLVM_LIBS -ludis86"
1403 DEFINES="$DEFINES -DHAVE_UDIS86"
Dave Airlie81fe1982010-04-22 14:59:29 +10001404 fi
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001405 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1406 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
Chia-I Wu3ecb8c22010-05-11 12:36:49 +08001407 DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001408 MESA_LLVM=1
1409 else
Dave Airlie81fe1982010-04-22 14:59:29 +10001410 MESA_LLVM=0
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001411 fi
1412else
1413 MESA_LLVM=0
Dave Airlie81fe1982010-04-22 14:59:29 +10001414fi
1415
1416dnl
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001417dnl Gallium helper functions
1418dnl
1419gallium_check_st() {
Chia-I Wud8e0e112010-06-29 14:04:27 +08001420 if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001421 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1422 fi
1423 if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
1424 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1425 fi
Chia-I Wud8e0e112010-06-29 14:04:27 +08001426 if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001427 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1428 fi
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001429}
1430
1431
1432dnl
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001433dnl Gallium SVGA configuration
1434dnl
1435AC_ARG_ENABLE([gallium-svga],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001436 [AS_HELP_STRING([--enable-gallium-svga],
1437 [build gallium SVGA @<:@default=disabled@:>@])],
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001438 [enable_gallium_svga="$enableval"],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001439 [enable_gallium_svga=auto])
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001440if test "x$enable_gallium_svga" = xyes; then
Xavier Chantryff0987a2010-03-26 11:02:03 +01001441 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001442 gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001443elif test "x$enable_gallium_svga" = xauto; then
1444 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001445fi
1446
1447dnl
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001448dnl Gallium i915 configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001449dnl
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001450AC_ARG_ENABLE([gallium-i915],
1451 [AS_HELP_STRING([--enable-gallium-i915],
1452 [build gallium i915 @<:@default=disabled@:>@])],
1453 [enable_gallium_i915="$enableval"],
1454 [enable_gallium_i915=auto])
1455if test "x$enable_gallium_i915" = xyes; then
Jakob Bornecrantz44bafca2010-04-17 15:17:33 +01001456 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001457 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001458 gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001459elif test "x$enable_gallium_i915" = xauto; then
Jakob Bornecrantz44bafca2010-04-17 15:17:33 +01001460 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001461 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1462fi
1463
1464dnl
1465dnl Gallium i965 configuration
1466dnl
1467AC_ARG_ENABLE([gallium-i965],
1468 [AS_HELP_STRING([--enable-gallium-i965],
1469 [build gallium i965 @<:@default=disabled@:>@])],
1470 [enable_gallium_i965="$enableval"],
1471 [enable_gallium_i965=auto])
1472if test "x$enable_gallium_i965" = xyes; then
1473 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001474 gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001475elif test "x$enable_gallium_i965" = xauto; then
1476 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001477fi
1478
1479dnl
1480dnl Gallium Radeon configuration
1481dnl
1482AC_ARG_ENABLE([gallium-radeon],
1483 [AS_HELP_STRING([--enable-gallium-radeon],
1484 [build gallium radeon @<:@default=disabled@:>@])],
1485 [enable_gallium_radeon="$enableval"],
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001486 [enable_gallium_radeon=auto])
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001487if test "x$enable_gallium_radeon" = xyes; then
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001488 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001489 gallium_check_st "radeon/drm" "dri-radeong" "xorg-radeon"
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001490elif test "x$enable_gallium_radeon" = xauto; then
1491 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001492fi
1493
1494dnl
Jakob Bornecrantzaeee5262010-05-13 20:29:18 +01001495dnl Gallium Radeon r600g configuration
1496dnl
1497AC_ARG_ENABLE([gallium-r600],
1498 [AS_HELP_STRING([--enable-gallium-r600],
1499 [build gallium radeon @<:@default=disabled@:>@])],
1500 [enable_gallium_r600="$enableval"],
1501 [enable_gallium_r600=auto])
1502if test "x$enable_gallium_r600" = xyes; then
1503 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1504 gallium_check_st "r600/drm" "dri-r600"
1505fi
1506
1507dnl
Thierry Vignaud1402ea82009-09-14 11:48:51 -06001508dnl Gallium Nouveau configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001509dnl
1510AC_ARG_ENABLE([gallium-nouveau],
1511 [AS_HELP_STRING([--enable-gallium-nouveau],
1512 [build gallium nouveau @<:@default=disabled@:>@])],
1513 [enable_gallium_nouveau="$enableval"],
1514 [enable_gallium_nouveau=no])
1515if test "x$enable_gallium_nouveau" = xyes; then
Luca Barbierif9d09a22010-02-21 15:13:12 +01001516 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001517 gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001518fi
1519
Chia-I Wua1306f42010-01-22 15:51:51 +08001520dnl
1521dnl Gallium swrast configuration
1522dnl
1523AC_ARG_ENABLE([gallium-swrast],
1524 [AS_HELP_STRING([--enable-gallium-swrast],
Jakob Bornecrantzf5ba2cd2010-03-24 10:58:45 +01001525 [build gallium swrast @<:@default=auto@:>@])],
Chia-I Wua1306f42010-01-22 15:51:51 +08001526 [enable_gallium_swrast="$enableval"],
1527 [enable_gallium_swrast=auto])
George Sapountzis7b333292010-03-25 17:01:54 +02001528if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
Jakob Bornecrantz5b1fc142010-03-25 18:29:51 +01001529 if test "x$HAVE_ST_DRI" = xyes; then
George Sapountzis7b333292010-03-25 17:01:54 +02001530 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
Jakob Bornecrantzf5ba2cd2010-03-24 10:58:45 +01001531 fi
Chia-I Wua1306f42010-01-22 15:51:51 +08001532fi
1533
Chia-I Wu99a37ed2010-01-05 17:39:05 +08001534dnl prepend CORE_DIRS to SRC_DIRS
1535SRC_DIRS="$CORE_DIRS $SRC_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001536
Dan Nicholsondca1b792007-10-23 09:25:58 -07001537dnl Restore LDFLAGS and CPPFLAGS
1538LDFLAGS="$_SAVE_LDFLAGS"
1539CPPFLAGS="$_SAVE_CPPFLAGS"
1540
1541dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -08001542AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001543
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001544dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001545AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001546if test -f configs/current || test -L configs/current; then
1547 rm -f configs/current
1548fi
1549ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001550])
1551
1552AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001553
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001554dnl
1555dnl Output some configuration info for the user
1556dnl
1557echo ""
1558echo " prefix: $prefix"
1559echo " exec_prefix: $exec_prefix"
1560echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07001561echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001562
1563dnl Driver info
1564echo ""
1565echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -08001566if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1567 echo " OSMesa: lib$OSMESA_LIB"
1568else
1569 echo " OSMesa: no"
1570fi
1571if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001572 # cleanup the drivers var
1573 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001574if test "x$DRI_DIRS" = x; then
1575 echo " DRI drivers: no"
1576else
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001577 echo " DRI drivers: $dri_dirs"
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001578fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001579 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -08001580fi
RALOVICH, Kristóf5f19f5c2008-11-04 11:53:32 +01001581echo " Use XCB: $enable_xcb"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001582
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001583echo ""
Eric Anholt1a8b1272010-05-21 12:17:24 -07001584if test "x$MESA_LLVM" = x1; then
Jakob Bornecrantzfe0fe672010-04-28 13:38:58 +01001585 echo " llvm: yes"
1586 echo " llvm-config: $LLVM_CONFIG"
1587 echo " llvm-version: $LLVM_VERSION"
1588else
1589 echo " llvm: no"
1590fi
1591
1592echo ""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001593if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1594 echo " Gallium: yes"
1595 echo " Gallium dirs: $GALLIUM_DIRS"
Keith Whitwell51bff092010-03-11 14:43:00 +00001596 echo " Target dirs: $GALLIUM_TARGET_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001597 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001598 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001599 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
Chia-I Wu63ab2502010-05-05 15:38:02 +08001600 if test "x$HAVE_ST_EGL" = xyes; then
1601 echo " EGL client APIs: $EGL_CLIENT_APIS"
1602 fi
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001603else
1604 echo " Gallium: no"
1605fi
1606
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001607dnl Libraries
1608echo ""
1609echo " Shared libs: $enable_shared"
1610echo " Static libs: $enable_static"
Kristian Høgsberg42fa0092010-02-03 10:18:28 -05001611if test "$enable_egl" = yes; then
1612 echo " EGL: $EGL_DRIVERS_DIRS"
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001613 echo " EGL platforms: $EGL_PLATFORMS"
Kristian Høgsberg42fa0092010-02-03 10:18:28 -05001614else
1615 echo " EGL: no"
1616fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001617echo " GLU: $enable_glu"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001618echo " GLw: $enable_glw (Motif: $enable_motif)"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001619echo " glut: $enable_glut"
1620
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001621dnl Compiler options
1622# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1623cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1624 $SED 's/^ *//;s/ */ /;s/ *$//'`
1625cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1626 $SED 's/^ *//;s/ */ /;s/ *$//'`
1627defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1628echo ""
1629echo " CFLAGS: $cflags"
1630echo " CXXFLAGS: $cxxflags"
1631echo " Macros: $defines"
1632
Dan Nicholsondca1b792007-10-23 09:25:58 -07001633echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07001634echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001635echo ""