blob: aa3895b9c7320e7497c43e0b1cfa6960f2b1d31a [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
Brian Paul483f5662011-01-11 09:42:52 -070021LIBDRM_REQUIRED=2.4.23
22LIBDRM_RADEON_REQUIRED=2.4.23
Tormod Volden903185b2011-01-25 13:25:18 -080023LIBDRM_INTEL_REQUIRED=2.4.23
Kristian Høgsbergaa0cd702010-02-15 10:44:05 -050024DRI2PROTO_REQUIRED=2.1
Jesse Barnesf2f83d92010-01-11 17:28:10 -050025GLPROTO_REQUIRED=1.4.11
Brian Paul483f5662011-01-11 09:42:52 -070026LIBDRM_XORG_REQUIRED=2.4.23
Jakob Bornecrantz683a0992010-03-11 19:23:15 +000027LIBKMS_XORG_REQUIRED=1.0.0
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -070028
Dan Nicholsondca1b792007-10-23 09:25:58 -070029dnl Check for progs
30AC_PROG_CPP
31AC_PROG_CC
32AC_PROG_CXX
Dan Nicholson297e16c2008-05-05 15:42:53 -070033AC_CHECK_PROGS([MAKE], [gmake make])
Kenneth Graunke3acc8262010-10-25 13:52:58 -070034AC_CHECK_PROGS([PYTHON2], [python2 python])
Dan Nicholson297e16c2008-05-05 15:42:53 -070035AC_PATH_PROG([MKDEP], [makedepend])
36AC_PATH_PROG([SED], [sed])
Dan Nicholson41b00702007-12-12 08:48:30 -080037
Luca Barbierif762f7b2010-09-24 10:10:09 +020038if test "x$MKDEP" = "x"; then
39 AC_MSG_ERROR([makedepend is required to build Mesa])
40fi
41
Dan Nicholsonbc302b22009-05-22 09:39:02 -070042dnl Our fallback install-sh is a symlink to minstall. Use the existing
43dnl configuration in that case.
44AC_PROG_INSTALL
45test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
46
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070047dnl We need a POSIX shell for parts of the build. Assume we have one
48dnl in most cases.
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070049case "$host_os" in
50solaris*)
51 # Solaris /bin/sh is too old/non-POSIX compliant
52 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070053 SHELL="$POSIX_SHELL"
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070054 ;;
55esac
56
nobled2a501872010-08-29 20:03:37 -040057dnl clang is mostly GCC-compatible, but its version is much lower,
58dnl so we have to check for it.
59AC_MSG_CHECKING([if compiling with clang])
60
61AC_COMPILE_IFELSE(
62[AC_LANG_PROGRAM([], [[
63#ifndef __clang__
64 not clang
65#endif
66]])],
67[CLANG=yes], [CLANG=no])
68
69AC_MSG_RESULT([$CLANG])
70
Ian Romanick9aa3aa72010-03-03 15:59:37 -080071dnl If we're using GCC, make sure that it is at least version 3.3.0. Older
72dnl versions are explictly not supported.
nobled2a501872010-08-29 20:03:37 -040073if test "x$GCC" = xyes -a "x$CLANG" = xno; then
Ian Romanick9aa3aa72010-03-03 15:59:37 -080074 AC_MSG_CHECKING([whether gcc version is sufficient])
75 major=0
76 minor=0
77
78 GCC_VERSION=`$CC -dumpversion`
79 if test $? -eq 0; then
80 major=`echo $GCC_VERSION | cut -d. -f1`
81 minor=`echo $GCC_VERSION | cut -d. -f1`
82 fi
83
84 if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
85 AC_MSG_RESULT([no])
86 AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
87 else
88 AC_MSG_RESULT([yes])
89 fi
90fi
91
92
Dan Nicholsondb7fc632008-03-07 11:48:09 -080093MKDEP_OPTIONS=-fdepend
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050094dnl Ask gcc where it's keeping its secret headers
95if test "x$GCC" = xyes; then
Dan Nicholsona3d223f2009-01-30 10:52:09 -080096 for dir in include include-fixed; do
97 GCC_INCLUDES=`$CC -print-file-name=$dir`
98 if test "x$GCC_INCLUDES" != x && \
99 test "$GCC_INCLUDES" != "$dir" && \
100 test -d "$GCC_INCLUDES"; then
101 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
102 fi
103 done
Kristian Høgsbergbcecea62008-02-25 18:50:26 -0500104fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700105AC_SUBST([MKDEP_OPTIONS])
Kristian Høgsbergbcecea62008-02-25 18:50:26 -0500106
Dan Nicholson41b00702007-12-12 08:48:30 -0800107dnl Make sure the pkg-config macros are defined
Dan Nicholson356f3112009-04-29 06:49:27 -0700108m4_ifndef([PKG_PROG_PKG_CONFIG],
109 [m4_fatal([Could not locate the pkg-config autoconf macros.
110 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
111 are in a different location, try setting the environment variable
112 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700113PKG_PROG_PKG_CONFIG()
114
115dnl LIB_DIR - library basename
116LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
Dan Nicholson297e16c2008-05-05 15:42:53 -0700117AC_SUBST([LIB_DIR])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700118
119dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
120_SAVE_LDFLAGS="$LDFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700121AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
122AC_SUBST([EXTRA_LIB_PATH])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700123
124dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
125_SAVE_CPPFLAGS="$CPPFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700126AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
127AC_SUBST([X11_INCLUDES])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700128
129dnl Compiler macros
130DEFINES=""
Dan Nicholson297e16c2008-05-05 15:42:53 -0700131AC_SUBST([DEFINES])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700132case "$host_os" in
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700133linux*|*-gnu*|gnu*)
Dan Nicholson29f603a2009-01-12 11:10:31 -0800134 DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700135 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700136solaris*)
137 DEFINES="$DEFINES -DPTHREADS -DSVR4"
138 ;;
Brian Paul97988902010-02-18 12:46:12 -0700139cygwin*)
140 DEFINES="$DEFINES -DPTHREADS"
141 ;;
Dan Nicholsondca1b792007-10-23 09:25:58 -0700142esac
143
144dnl Add flags for gcc and g++
145if test "x$GCC" = xyes; then
Eric Anholta3c2bd42010-08-30 14:19:23 -0700146 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99"
147 if test "x$CLANG" = "xno"; then
148 CFLAGS="$CFLAGS -ffast-math"
149 fi
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800150
151 # Enable -fvisibility=hidden if using a gcc that supports it
152 save_CFLAGS="$CFLAGS"
Alan Coopersmithf8107a42010-01-21 16:42:58 -0800153 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800154 CFLAGS="$CFLAGS -fvisibility=hidden"
155 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
156 [CFLAGS="$save_CFLAGS" ; AC_MSG_RESULT([no])]);
Dan Nicholson0c275b62008-01-15 22:52:25 -0800157
158 # Work around aliasing bugs - developers should comment this out
159 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700160fi
161if test "x$GXX" = xyes; then
162 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -0800163
Kristian Høgsberg7b34fcc2010-09-08 20:34:07 -0400164 # Enable -fvisibility=hidden if using a gcc that supports it
165 save_CXXFLAGS="$CXXFLAGS"
166 AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
167 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
168 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
169 [CXXFLAGS="$save_CXXFLAGS" ; AC_MSG_RESULT([no])]);
170
Dan Nicholson0c275b62008-01-15 22:52:25 -0800171 # Work around aliasing bugs - developers should comment this out
172 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700173fi
174
175dnl These should be unnecessary, but let the user set them if they want
Dan Nicholson297e16c2008-05-05 15:42:53 -0700176AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700177 Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700178AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
Dan Nicholsondca1b792007-10-23 09:25:58 -0700179 compiler. Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700180AC_SUBST([OPT_FLAGS])
181AC_SUBST([ARCH_FLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700182
183dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600184dnl Hacks to enable 32 or 64 bit build
185dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700186AC_ARG_ENABLE([32-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600187 [AS_HELP_STRING([--enable-32-bit],
188 [build 32-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700189 [enable_32bit="$enableval"],
190 [enable_32bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600191)
192if test "x$enable_32bit" = xyes; then
193 if test "x$GCC" = xyes; then
194 CFLAGS="$CFLAGS -m32"
Marc Dietrichc705e722009-08-31 08:56:33 -0700195 ARCH_FLAGS="$ARCH_FLAGS -m32"
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600196 fi
197 if test "x$GXX" = xyes; then
198 CXXFLAGS="$CXXFLAGS -m32"
199 fi
200fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700201AC_ARG_ENABLE([64-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600202 [AS_HELP_STRING([--enable-64-bit],
203 [build 64-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700204 [enable_64bit="$enableval"],
205 [enable_64bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600206)
207if test "x$enable_64bit" = xyes; then
208 if test "x$GCC" = xyes; then
209 CFLAGS="$CFLAGS -m64"
210 fi
211 if test "x$GXX" = xyes; then
212 CXXFLAGS="$CXXFLAGS -m64"
213 fi
214fi
215
216dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800217dnl shared/static libraries, mimic libtool options
218dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700219AC_ARG_ENABLE([static],
Dan Nicholson88586332007-11-15 08:59:57 -0800220 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800221 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700222 [enable_static="$enableval"],
223 [enable_static=no]
Dan Nicholson88586332007-11-15 08:59:57 -0800224)
225case "x$enable_static" in
226xyes|xno ) ;;
227x ) enable_static=no ;;
228* )
229 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
230 ;;
231esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700232AC_ARG_ENABLE([shared],
Dan Nicholson88586332007-11-15 08:59:57 -0800233 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800234 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700235 [enable_shared="$enableval"],
236 [enable_shared=yes]
Dan Nicholson88586332007-11-15 08:59:57 -0800237)
238case "x$enable_shared" in
239xyes|xno ) ;;
240x ) enable_shared=yes ;;
241* )
242 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
243 ;;
244esac
245
246dnl Can't have static and shared libraries, default to static if user
247dnl explicitly requested. If both disabled, set to static since shared
248dnl was explicitly requirested.
249case "x$enable_static$enable_shared" in
250xyesyes )
251 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
252 enable_shared=no
253 ;;
254xnono )
255 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
256 enable_static=yes
257 ;;
258esac
259
260dnl
261dnl mklib options
262dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700263AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
Dan Nicholson88586332007-11-15 08:59:57 -0800264if test "$enable_static" = yes; then
265 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
266fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700267AC_SUBST([MKLIB_OPTIONS])
Dan Nicholson88586332007-11-15 08:59:57 -0800268
Dan Nicholson23656c42007-12-12 09:02:31 -0800269dnl
270dnl other compiler options
271dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700272AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800273 [AS_HELP_STRING([--enable-debug],
274 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700275 [enable_debug="$enableval"],
276 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800277)
278if test "x$enable_debug" = xyes; then
279 DEFINES="$DEFINES -DDEBUG"
280 if test "x$GCC" = xyes; then
281 CFLAGS="$CFLAGS -g"
282 fi
283 if test "x$GXX" = xyes; then
284 CXXFLAGS="$CXXFLAGS -g"
285 fi
286fi
Dan Nicholson88586332007-11-15 08:59:57 -0800287
288dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700289dnl library names
290dnl
Jon TURNEYc55a8a72010-07-24 12:05:34 +0100291LIB_PREFIX_GLOB='lib'
292LIB_VERSION_SEPARATOR='.'
Dan Nicholson88586332007-11-15 08:59:57 -0800293if test "$enable_static" = yes; then
Dan Nicholson8217f242009-02-11 15:16:00 -0800294 LIB_EXTENSION='a'
Dan Nicholson88586332007-11-15 08:59:57 -0800295else
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700296 case "$host_os" in
297 darwin* )
298 LIB_EXTENSION='dylib' ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +0100299 cygwin* )
Jon TURNEYc55a8a72010-07-24 12:05:34 +0100300 dnl prefix can be 'cyg' or 'lib'
301 LIB_PREFIX_GLOB='???'
302 LIB_VERSION_SEPARATOR='-'
303 LIB_EXTENSION='dll' ;;
Tom Fogal9282edf2009-10-13 10:55:33 -0700304 aix* )
305 LIB_EXTENSION='a' ;;
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700306 * )
307 LIB_EXTENSION='so' ;;
308 esac
Dan Nicholson88586332007-11-15 08:59:57 -0800309fi
Dan Nicholson8217f242009-02-11 15:16:00 -0800310
311GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
312GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
313GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
314GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
315OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800316EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500317GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
318GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
Chia-I Wu874ccd52010-05-04 22:43:05 +0800319VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800320GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100321WAYLAND_EGL_LIB_NAME='lib$(WAYLAND_EGL_LIB).'${LIB_EXTENSION}
Dan Nicholson8217f242009-02-11 15:16:00 -0800322
Jon TURNEYc55a8a72010-07-24 12:05:34 +0100323GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
324GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
325GLUT_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLUT_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
326GLW_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLW_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
327OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
328EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
329EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
330GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
331GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
332VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800333GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100334WAYLAND_EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(WAYLAND_EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
Dan Nicholson8217f242009-02-11 15:16:00 -0800335
Dan Nicholson297e16c2008-05-05 15:42:53 -0700336AC_SUBST([GL_LIB_NAME])
337AC_SUBST([GLU_LIB_NAME])
338AC_SUBST([GLUT_LIB_NAME])
339AC_SUBST([GLW_LIB_NAME])
340AC_SUBST([OSMESA_LIB_NAME])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800341AC_SUBST([EGL_LIB_NAME])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500342AC_SUBST([GLESv1_CM_LIB_NAME])
343AC_SUBST([GLESv2_LIB_NAME])
Chia-I Wu874ccd52010-05-04 22:43:05 +0800344AC_SUBST([VG_LIB_NAME])
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800345AC_SUBST([GLAPI_LIB_NAME])
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100346AC_SUBST([WAYLAND_EGL_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700347
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700348AC_SUBST([GL_LIB_GLOB])
349AC_SUBST([GLU_LIB_GLOB])
350AC_SUBST([GLUT_LIB_GLOB])
351AC_SUBST([GLW_LIB_GLOB])
352AC_SUBST([OSMESA_LIB_GLOB])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800353AC_SUBST([EGL_LIB_GLOB])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500354AC_SUBST([GLESv1_CM_LIB_GLOB])
355AC_SUBST([GLESv2_LIB_GLOB])
Chia-I Wu874ccd52010-05-04 22:43:05 +0800356AC_SUBST([VG_LIB_GLOB])
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800357AC_SUBST([GLAPI_LIB_GLOB])
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100358AC_SUBST([WAYLAND_EGL_LIB_GLOB])
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700359
Dan Nicholsondca1b792007-10-23 09:25:58 -0700360dnl
Dan Nicholson871125a2008-06-04 13:00:35 -0700361dnl Arch/platform-specific settings
362dnl
363AC_ARG_ENABLE([asm],
364 [AS_HELP_STRING([--disable-asm],
365 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
366 [enable_asm="$enableval"],
367 [enable_asm=yes]
368)
369asm_arch=""
370ASM_FLAGS=""
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800371MESA_ASM_SOURCES=""
372GLAPI_ASM_SOURCES=""
Dan Nicholson871125a2008-06-04 13:00:35 -0700373AC_MSG_CHECKING([whether to enable assembly])
374test "x$enable_asm" = xno && AC_MSG_RESULT([no])
375# disable if cross compiling on x86/x86_64 since we must run gen_matypes
376if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
377 case "$host_cpu" in
378 i?86 | x86_64)
379 enable_asm=no
380 AC_MSG_RESULT([no, cross compiling])
381 ;;
382 esac
383fi
384# check for supported arches
385if test "x$enable_asm" = xyes; then
386 case "$host_cpu" in
387 i?86)
388 case "$host_os" in
Pierre Allegraud8fd8de32011-01-06 07:58:57 -0700389 linux* | *freebsd* | dragonfly* | *netbsd*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700390 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
391 ;;
392 esac
393 ;;
394 x86_64)
395 case "$host_os" in
Pierre Allegraud8fd8de32011-01-06 07:58:57 -0700396 linux* | *freebsd* | dragonfly* | *netbsd*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700397 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
398 ;;
399 esac
400 ;;
401 powerpc)
402 case "$host_os" in
403 linux*)
404 asm_arch=ppc
405 ;;
406 esac
407 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800408 sparc*)
409 case "$host_os" in
410 linux*)
411 asm_arch=sparc
412 ;;
413 esac
414 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700415 esac
416
417 case "$asm_arch" in
418 x86)
Dan Nicholson61e925f2009-02-11 10:42:34 -0800419 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800420 MESA_ASM_SOURCES='$(X86_SOURCES)'
421 GLAPI_ASM_SOURCES='$(X86_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700422 AC_MSG_RESULT([yes, x86])
423 ;;
424 x86_64)
425 ASM_FLAGS="-DUSE_X86_64_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800426 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
427 GLAPI_ASM_SOURCES='$(X86-64_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700428 AC_MSG_RESULT([yes, x86_64])
429 ;;
430 ppc)
431 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800432 MESA_ASM_SOURCES='$(PPC_SOURCES)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700433 AC_MSG_RESULT([yes, ppc])
434 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800435 sparc)
436 ASM_FLAGS="-DUSE_SPARC_ASM"
437 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
438 GLAPI_ASM_SOURCES='$(SPARC_API)'
439 AC_MSG_RESULT([yes, sparc])
440 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700441 *)
442 AC_MSG_RESULT([no, platform not supported])
443 ;;
444 esac
445fi
446AC_SUBST([ASM_FLAGS])
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800447AC_SUBST([MESA_ASM_SOURCES])
448AC_SUBST([GLAPI_ASM_SOURCES])
Dan Nicholson871125a2008-06-04 13:00:35 -0700449
450dnl PIC code macro
451MESA_PIC_FLAGS
452
453dnl Check to see if dlopen is in default libraries (like Solaris, which
454dnl has it in libc), or if libdl is needed to get it.
455AC_CHECK_FUNC([dlopen], [],
456 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
Chia-I Wu08f4bc02010-07-16 20:09:29 +0800457AC_SUBST([DLOPEN_LIBS])
Dan Nicholson871125a2008-06-04 13:00:35 -0700458
Dan Nicholson985e1cd2008-06-04 13:17:06 -0700459dnl See if posix_memalign is available
460AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
461
Dan Nicholson871125a2008-06-04 13:00:35 -0700462dnl SELinux awareness.
463AC_ARG_ENABLE([selinux],
464 [AS_HELP_STRING([--enable-selinux],
465 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
466 [MESA_SELINUX="$enableval"],
467 [MESA_SELINUX=no])
468if test "x$enable_selinux" = "xyes"; then
469 AC_CHECK_HEADER([selinux/selinux.h],[],
470 [AC_MSG_ERROR([SELinux headers not found])])
471 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
472 [AC_MSG_ERROR([SELinux library not found])])
473 SELINUX_LIBS="-lselinux"
474 DEFINES="$DEFINES -DMESA_SELINUX"
475fi
476
Chia-I Wube5f34a2010-10-27 16:14:27 +0800477dnl Determine which APIs to support
478AC_ARG_ENABLE([opengl],
479 [AS_HELP_STRING([--disable-opengl],
480 [disable support for standard OpenGL API @<:@default=no@:>@])],
481 [enable_opengl="$enableval"],
482 [enable_opengl=yes])
483AC_ARG_ENABLE([gles1],
484 [AS_HELP_STRING([--enable-gles1],
485 [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
486 [enable_gles1="$enableval"],
487 [enable_gles1=no])
488AC_ARG_ENABLE([gles2],
489 [AS_HELP_STRING([--enable-gles2],
490 [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
491 [enable_gles2="$enableval"],
492 [enable_gles2=no])
493AC_ARG_ENABLE([gles-overlay],
494 [AS_HELP_STRING([--enable-gles-overlay],
Chia-I Wu12583172011-01-07 17:24:16 +0800495 [DEPRECATED. Same as --enable-gles1 and --enable-gles2])],
496 [enable_gles1="$enableval"; enable_gles2="$enableval"],
497 [])
Chia-I Wube5f34a2010-10-27 16:14:27 +0800498
499AC_ARG_ENABLE([openvg],
500 [AS_HELP_STRING([--enable-openvg],
501 [enable support for OpenVG API @<:@default=no@:>@])],
502 [enable_openvg="$enableval"],
503 [enable_openvg=no])
504
Chia-I Wu156e9552010-10-30 14:26:01 +0800505dnl smooth the transition; should be removed eventually
506if test "x$enable_openvg" = xno; then
507 case "x$with_state_trackers" in
508 x*vega*)
509 AC_MSG_WARN([vega state tracker is enabled without --enable-openvg])
510 enable_openvg=yes
511 ;;
512 esac
513fi
514
Chia-I Wube5f34a2010-10-27 16:14:27 +0800515if test "x$enable_opengl" = xno -a \
516 "x$enable_gles1" = xno -a \
517 "x$enable_gles2" = xno -a \
Chia-I Wube5f34a2010-10-27 16:14:27 +0800518 "x$enable_openvg" = xno; then
519 AC_MSG_ERROR([at least one API should be enabled])
520fi
521
522API_DEFINES=""
Chia-I Wube5f34a2010-10-27 16:14:27 +0800523if test "x$enable_opengl" = xno; then
524 API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
525else
526 API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
527fi
528if test "x$enable_gles1" = xyes; then
529 API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
530fi
531if test "x$enable_gles2" = xyes; then
532 API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
533fi
Chia-I Wube5f34a2010-10-27 16:14:27 +0800534AC_SUBST([API_DEFINES])
Chia-I Wube5f34a2010-10-27 16:14:27 +0800535
Chia-I Wue8c7d752010-12-26 18:24:13 +0800536AC_ARG_ENABLE([shared-glapi],
537 [AS_HELP_STRING([--enable-shared-glapi],
538 [EXPERIMENTAL. Enable shared glapi for OpenGL @<:@default=no@:>@])],
539 [enable_shared_glapi="$enableval"],
540 [enable_shared_glapi=no])
541
542SHARED_GLAPI="0"
543if test "x$enable_shared_glapi" = xyes; then
544 SHARED_GLAPI="1"
545fi
546AC_SUBST([SHARED_GLAPI])
547
Dan Nicholson871125a2008-06-04 13:00:35 -0700548dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800549dnl Driver configuration. Options are xlib, dri and osmesa right now.
Kristian Høgsberg43875802010-02-25 15:49:18 -0500550dnl More later: fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800551dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700552default_driver="xlib"
553
554case "$host_os" in
555linux*)
556 case "$host_cpu" in
David S. Miller32dc28a2009-02-24 20:06:05 -0700557 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700558 esac
559 ;;
Pierre Allegraud8fd8de32011-01-06 07:58:57 -0700560*freebsd* | dragonfly* | *netbsd*)
Eric Anholt711222b2008-04-18 15:03:01 -0700561 case "$host_cpu" in
Robert Noland48f05432009-04-10 11:41:27 -0500562 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700563 esac
564 ;;
565esac
566
Chia-I Wube5f34a2010-10-27 16:14:27 +0800567if test "x$enable_opengl" = xno; then
568 default_driver="no"
569fi
570
Dan Nicholson297e16c2008-05-05 15:42:53 -0700571AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800572 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700573 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700574 [mesa_driver="$withval"],
575 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800576dnl Check for valid option
577case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800578xxlib|xdri|xosmesa)
Chia-I Wube5f34a2010-10-27 16:14:27 +0800579 if test "x$enable_opengl" = xno; then
580 AC_MSG_ERROR([Driver '$mesa_driver' requires OpenGL enabled])
581 fi
582 ;;
583xno)
Dan Nicholson44d99142007-12-05 18:47:01 -0800584 ;;
585*)
586 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
587 ;;
588esac
589
590dnl
591dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700592dnl
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800593
594dnl this variable will be prepended to SRC_DIRS and is not exported
Chia-I Wube5f34a2010-10-27 16:14:27 +0800595CORE_DIRS=""
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800596
Jakob Bornecrantz05281062010-06-05 13:33:58 +0200597SRC_DIRS=""
Dan Nicholsondca1b792007-10-23 09:25:58 -0700598GLU_DIRS="sgi"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100599GALLIUM_DIRS="auxiliary drivers state_trackers"
Keith Whitwell51bff092010-03-11 14:43:00 +0000600GALLIUM_TARGET_DIRS=""
Jakob Bornecrantzc9f98672010-03-16 13:54:18 +0000601GALLIUM_WINSYS_DIRS="sw"
Jerome Glisse33495172011-01-09 21:04:41 -0500602GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug noop identity"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100603GALLIUM_STATE_TRACKERS_DIRS=""
604
Chia-I Wue8c7d752010-12-26 18:24:13 +0800605# build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled
606case "x$enabled_shared_glapi$enable_gles1$enable_gles2" in
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800607x*yes*)
608 CORE_DIRS="$CORE_DIRS mapi/shared-glapi"
609 ;;
610esac
611
Chia-I Wube5f34a2010-10-27 16:14:27 +0800612# build glapi if OpenGL is enabled
613if test "x$enable_opengl" = xyes; then
614 CORE_DIRS="$CORE_DIRS mapi/glapi"
615fi
616
Chia-I Wu12583172011-01-07 17:24:16 +0800617# build es1api if OpenGL ES 1.x is enabled
618if test "x$enable_gles1" = xyes; then
619 CORE_DIRS="$CORE_DIRS mapi/es1api"
620fi
621
622# build es2api if OpenGL ES 2.x is enabled
623if test "x$enable_gles2" = xyes; then
624 CORE_DIRS="$CORE_DIRS mapi/es2api"
625fi
Chia-I Wube5f34a2010-10-27 16:14:27 +0800626
627# build vgapi if OpenVG is enabled
628if test "x$enable_openvg" = xyes; then
629 CORE_DIRS="$CORE_DIRS mapi/vgapi"
630fi
631
632# build glsl and mesa if OpenGL or OpenGL ES is enabled
Chia-I Wu12583172011-01-07 17:24:16 +0800633case "x$enable_opengl$enable_gles1$enable_gles2" in
Chia-I Wube5f34a2010-10-27 16:14:27 +0800634x*yes*)
635 CORE_DIRS="$CORE_DIRS glsl mesa"
636 ;;
637esac
638
Dan Nicholson44d99142007-12-05 18:47:01 -0800639case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800640xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800641 DRIVER_DIRS="x11"
Jakob Bornecrantzc9f98672010-03-16 13:54:18 +0000642 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
Keith Whitwell51bff092010-03-11 14:43:00 +0000643 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
Dan Nicholson44d99142007-12-05 18:47:01 -0800644 ;;
645dri)
Kristian Høgsberg6e8897f2010-02-09 09:58:36 -0500646 SRC_DIRS="$SRC_DIRS glx"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100647 DRIVER_DIRS="dri"
Jakob Bornecrantz23a915e2010-06-23 03:31:18 +0200648 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri"
Dan Nicholson44d99142007-12-05 18:47:01 -0800649 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800650osmesa)
651 DRIVER_DIRS="osmesa"
652 ;;
Chia-I Wube5f34a2010-10-27 16:14:27 +0800653no)
654 DRIVER_DRIS=""
655 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800656esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700657AC_SUBST([SRC_DIRS])
658AC_SUBST([GLU_DIRS])
659AC_SUBST([DRIVER_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100660AC_SUBST([GALLIUM_DIRS])
Keith Whitwell51bff092010-03-11 14:43:00 +0000661AC_SUBST([GALLIUM_TARGET_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100662AC_SUBST([GALLIUM_WINSYS_DIRS])
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +0000663AC_SUBST([GALLIUM_DRIVERS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100664AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
Dave Airlie81fe1982010-04-22 14:59:29 +1000665AC_SUBST([MESA_LLVM])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700666
667dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700668dnl Find out if X is available. The variable have_x is set if libX11 is
Dan Nicholson99803a42008-07-01 09:03:15 -0700669dnl found to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700670dnl
671if test -n "$PKG_CONFIG"; then
672 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700673 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700674 x11_pkgconfig=yes
675 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700676 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700677 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700678 ])
679 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700680else
681 x11_pkgconfig=no
682fi
683dnl Use the autoconf macro if no pkg-config files
Jeff Smith8d86d392010-03-12 18:55:09 -0600684if test "$x11_pkgconfig" = yes; then
Dan Nicholsone725ef12010-03-15 20:53:56 -0700685 PKG_CHECK_MODULES([X11], [x11])
Jeff Smith8d86d392010-03-12 18:55:09 -0600686else
Dan Nicholsondca1b792007-10-23 09:25:58 -0700687 AC_PATH_XTRA
Dan Nicholsone725ef12010-03-15 20:53:56 -0700688 test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
689 test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
690 AC_SUBST([X11_CFLAGS])
691 AC_SUBST([X11_LIBS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700692fi
693
Dan Nicholson99803a42008-07-01 09:03:15 -0700694dnl Try to tell the user that the --x-* options are only used when
695dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
696m4_divert_once([HELP_BEGIN],
697[These options are only used when the X libraries cannot be found by the
698pkg-config utility.])
699
Dan Nicholson44d99142007-12-05 18:47:01 -0800700dnl We need X for xlib and dri, so bomb now if it's not found
701case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800702xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800703 if test "$no_x" = yes; then
704 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
705 fi
706 ;;
707esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700708
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700709dnl XCB - this is only used for GLX right now
710AC_ARG_ENABLE([xcb],
711 [AS_HELP_STRING([--enable-xcb],
712 [use XCB for GLX @<:@default=disabled@:>@])],
713 [enable_xcb="$enableval"],
714 [enable_xcb=no])
715if test "x$enable_xcb" = xyes; then
716 DEFINES="$DEFINES -DUSE_XCB"
717else
718 enable_xcb=no
719fi
720
Dan Nicholson44d99142007-12-05 18:47:01 -0800721dnl
722dnl libGL configuration per driver
723dnl
724case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800725xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800726 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700727 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800728 GL_PC_REQ_PRIV="x11 xext"
Dan Nicholsona1307182007-12-12 17:49:49 -0800729 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
730 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800731 else
732 # should check these...
733 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
734 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800735 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
736 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson44d99142007-12-05 18:47:01 -0800737 fi
Kenneth Graunked1d812052011-01-16 16:01:54 -0800738 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
739 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800740
741 # if static, move the external libraries to the programs
742 # and empty the libraries for libGL
743 if test "$enable_static" = yes; then
744 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
745 GL_LIB_DEPS=""
746 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800747 ;;
Chia-I Wube5f34a2010-10-27 16:14:27 +0800748dri|no) # these checks are still desired when there is no mesa_driver
Dan Nicholson88586332007-11-15 08:59:57 -0800749 # DRI must be shared, I think
750 if test "$enable_static" = yes; then
751 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
752 fi
753
Dan Nicholson44d99142007-12-05 18:47:01 -0800754 # Check for libdrm
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -0700755 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
756 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
Jesse Barnesf2f83d92010-01-11 17:28:10 -0500757 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
Jesse Barnesed59b132010-01-13 15:48:14 -0500758 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
759 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
Dan Nicholson44d99142007-12-05 18:47:01 -0800760
761 # find the DRI deps for libGL
762 if test "$x11_pkgconfig" = yes; then
Jon TURNEY2b9dac32010-04-21 12:58:54 +0100763 dri_modules="x11 xext xdamage xfixes"
764
765 # add xf86vidmode if available
766 PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
767 if test "$HAVE_XF86VIDMODE" = yes ; then
768 dri_modules="$dri_modules xxf86vm"
769 fi
770
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700771 # add xcb modules if necessary
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700772 if test "$enable_xcb" = yes; then
773 dri_modules="$dri_modules x11-xcb xcb-glx"
774 fi
775
776 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800777 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Dan Nicholson44d99142007-12-05 18:47:01 -0800778 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
779 GL_LIB_DEPS="$DRIGL_LIBS"
780 else
781 # should check these...
782 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
783 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800784 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
785 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700786
787 # XCB can only be used from pkg-config
788 if test "$enable_xcb" = yes; then
789 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800790 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700791 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
792 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
793 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800794 fi
795
796 # need DRM libs, -lpthread, etc.
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700797 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
798 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500799 GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg74399d42010-05-02 09:51:13 -0400800 GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500801 GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg74399d42010-05-02 09:51:13 -0400802 GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800803 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800804osmesa)
805 # No libGL for osmesa
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700806 GL_LIB_DEPS=""
Dan Nicholson979ff512007-12-05 18:47:01 -0800807 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800808esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700809AC_SUBST([GL_LIB_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800810AC_SUBST([GL_PC_REQ_PRIV])
811AC_SUBST([GL_PC_LIB_PRIV])
812AC_SUBST([GL_PC_CFLAGS])
813AC_SUBST([DRI_PC_REQ_PRIV])
Li Pengc33c1912010-07-30 12:26:15 +0800814AC_SUBST([GLESv1_CM_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -0400815AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500816AC_SUBST([GLESv2_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -0400817AC_SUBST([GLESv2_PC_LIB_PRIV])
818
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800819GLAPI_LIB_DEPS="-lpthread"
820AC_SUBST([GLAPI_LIB_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700821
Jon TURNEY2b9dac32010-04-21 12:58:54 +0100822AC_SUBST([HAVE_XF86VIDMODE])
823
Marek Olšáka1aec2e2010-09-26 17:52:58 +0200824PKG_CHECK_MODULES([LIBDRM_RADEON],
Marek Olšákec96b0e2011-02-06 15:42:55 +0100825 [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED],
Marek Olšáka1aec2e2010-09-26 17:52:58 +0200826 HAVE_LIBDRM_RADEON=yes,
827 HAVE_LIBDRM_RADEON=no)
828
Dan Nicholsondca1b792007-10-23 09:25:58 -0700829dnl
830dnl More X11 setup
831dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800832if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700833 DEFINES="$DEFINES -DUSE_XSHM"
834fi
835
836dnl
Tom Fogal31351dc2010-12-05 17:58:32 -0700837dnl TLS detection
Dan Nicholson44d99142007-12-05 18:47:01 -0800838dnl
Tom Fogal31351dc2010-12-05 17:58:32 -0700839
Dan Nicholson297e16c2008-05-05 15:42:53 -0700840AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800841 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800842 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700843 [GLX_USE_TLS="$enableval"],
844 [GLX_USE_TLS=no])
Tom Fogal31351dc2010-12-05 17:58:32 -0700845AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
846
847dnl
848dnl More DRI setup
849dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800850dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700851AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800852 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700853 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700854 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700855 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700856AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Chow Loong Jin35506de2009-10-28 14:34:14 +0800857dnl Extra search path for DRI drivers
858AC_ARG_WITH([dri-searchpath],
859 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
860 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
861 [DRI_DRIVER_SEARCH_DIR="$withval"],
862 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
863AC_SUBST([DRI_DRIVER_SEARCH_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800864dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700865AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800866 [AS_HELP_STRING([--disable-driglx-direct],
Chia-I Wucf588ab2010-07-06 14:34:43 +0800867 [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700868 [driglx_direct="$enableval"],
869 [driglx_direct="yes"])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800870dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700871AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800872 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholson5cae1b72008-06-30 10:28:02 -0700873 [comma delimited DRI drivers list, e.g.
Michel Dänzercade0712009-07-10 14:49:46 +0200874 "swrast,i965,radeon" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700875 [with_dri_drivers="$withval"],
876 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800877if test "x$with_dri_drivers" = x; then
878 with_dri_drivers=no
879fi
880
881dnl If $with_dri_drivers is yes, directories will be added through
882dnl platform checks
883DRI_DIRS=""
884case "$with_dri_drivers" in
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100885no) ;;
886yes)
887 DRI_DIRS="yes"
888 ;;
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800889*)
890 # verify the requested driver directories exist
Dan Nicholsone6e4f252008-07-06 14:17:39 -0700891 dri_drivers=`IFS=', '; echo $with_dri_drivers`
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800892 for driver in $dri_drivers; do
893 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
894 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
895 done
896 DRI_DIRS="$dri_drivers"
897 ;;
898esac
899
Dan Nicholson44d99142007-12-05 18:47:01 -0800900dnl Set DRI_DIRS, DEFINES and LIB_DEPS
Chia-I Wube5f34a2010-10-27 16:14:27 +0800901if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
Dan Nicholson44d99142007-12-05 18:47:01 -0800902 # Use TLS in GLX?
903 if test "x$GLX_USE_TLS" = xyes; then
904 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
905 fi
906
Dan Nicholson44d99142007-12-05 18:47:01 -0800907 # Platform specific settings and drivers to build
908 case "$host_os" in
909 linux*)
910 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
Dan Nicholson44d99142007-12-05 18:47:01 -0800911 if test "x$driglx_direct" = xyes; then
912 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
913 fi
Jerome Glisse14f79d42008-12-18 13:36:07 +0100914 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800915
916 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800917 x86_64)
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -0500918 # sis is missing because they have not be converted to use
919 # the new interface. i810 are missing because there is no
920 # x86-64 system where they could *ever* be used.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100921 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400922 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +0300923 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800924 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800925 ;;
926 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800927 # Build only the drivers for cards that exist on PowerPC.
928 # At some point MGA will be added, but not yet.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100929 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400930 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800931 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800932 ;;
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000933 sparc*)
934 # Build only the drivers for cards that exist on sparc`
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100935 if test "x$DRI_DIRS" = "xyes"; then
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -0500936 DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000937 fi
938 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800939 esac
940 ;;
Pierre Allegraud8fd8de32011-01-06 07:58:57 -0700941 freebsd* | dragonfly* | *netbsd*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800942 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
943 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
944 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
945 if test "x$driglx_direct" = xyes; then
946 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
947 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800948
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100949 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400950 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +0300951 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800952 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800953 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700954 gnu*)
955 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
956 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
957 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700958 solaris*)
959 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
960 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
961 if test "x$driglx_direct" = xyes; then
962 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
963 fi
964 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800965 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800966
967 # default drivers
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100968 if test "x$DRI_DIRS" = "xyes"; then
Corbin Simpson8e4657a2009-10-22 12:29:30 -0700969 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -0500970 savage sis tdfx unichrome swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -0800971 fi
972
Dan Nicholson44d99142007-12-05 18:47:01 -0800973 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
974
975 # Check for expat
Chia-I Wube5f34a2010-10-27 16:14:27 +0800976 if test "$mesa_driver" = dri; then
977 EXPAT_INCLUDES=""
978 EXPAT_LIB=-lexpat
979 AC_ARG_WITH([expat],
980 [AS_HELP_STRING([--with-expat=DIR],
981 [expat install directory])],[
982 EXPAT_INCLUDES="-I$withval/include"
983 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
984 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
985 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
986 ])
987 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
988 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
989 [AC_MSG_ERROR([Expat required for DRI.])])
990 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800991
992 # put all the necessary libs together
Kenneth Graunked1d812052011-01-16 16:01:54 -0800993 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800994fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700995AC_SUBST([DRI_DIRS])
996AC_SUBST([EXPAT_INCLUDES])
997AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800998
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500999case $DRI_DIRS in
1000*i915*|*i965*)
Tormod Volden903185b2011-01-25 13:25:18 -08001001 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001002 ;;
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -05001003esac
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001004
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -05001005case $DRI_DIRS in
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001006*radeon*|*r200*|*r300*|*r600*)
Marek Olšáka1aec2e2010-09-26 17:52:58 +02001007 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001008 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
1009 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
1010 fi
1011 ;;
1012esac
1013AC_SUBST([RADEON_CFLAGS])
1014AC_SUBST([RADEON_LDFLAGS])
1015
1016
Dan Nicholson44d99142007-12-05 18:47:01 -08001017dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -07001018dnl OSMesa configuration
1019dnl
Dan Nicholsona1307182007-12-12 17:49:49 -08001020if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -08001021 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -08001022else
Dan Nicholson544ab202007-12-30 08:41:53 -08001023 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -08001024fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001025AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -08001026 [AS_HELP_STRING([--enable-gl-osmesa],
Dan Nicholsoncbf30fc2010-06-16 09:23:17 -07001027 [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001028 [gl_osmesa="$enableval"],
1029 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -08001030if test "x$gl_osmesa" = xyes; then
Chia-I Wube5f34a2010-10-27 16:14:27 +08001031 if test "x$enable_opengl" = xno; then
1032 AC_MSG_ERROR([OpenGL is not available for OSMesa driver])
1033 fi
Dan Nicholson544ab202007-12-30 08:41:53 -08001034 if test "$mesa_driver" = osmesa; then
1035 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -08001036 else
Dan Nicholson544ab202007-12-30 08:41:53 -08001037 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -08001038 fi
1039fi
1040
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001041dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -07001042AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001043 [AS_HELP_STRING([--with-osmesa-bits=BITS],
1044 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001045 [osmesa_bits="$withval"],
1046 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001047if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
1048 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
1049 osmesa_bits=8
1050fi
1051case "x$osmesa_bits" in
1052x8)
1053 OSMESA_LIB=OSMesa
1054 ;;
1055x16|x32)
1056 OSMESA_LIB="OSMesa$osmesa_bits"
1057 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
1058 ;;
1059*)
1060 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
1061 ;;
1062esac
Dan Nicholson297e16c2008-05-05 15:42:53 -07001063AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001064
Dan Nicholsoncbf30fc2010-06-16 09:23:17 -07001065case "$DRIVER_DIRS" in
1066*osmesa*)
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001067 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -08001068 if test "$enable_static" = no; then
Kenneth Graunked1d812052011-01-16 16:01:54 -08001069 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -08001070 else
1071 OSMESA_LIB_DEPS=""
1072 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001073 OSMESA_MESA_DEPS=""
Kenneth Graunked1d812052011-01-16 16:01:54 -08001074 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -08001075 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -08001076esac
Dan Nicholson297e16c2008-05-05 15:42:53 -07001077AC_SUBST([OSMESA_LIB_DEPS])
1078AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholson8be02fc2008-12-14 09:35:29 -08001079AC_SUBST([OSMESA_PC_REQ])
1080AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001081
1082dnl
Dan Nicholson53b37342009-02-25 17:45:34 -08001083dnl EGL configuration
1084dnl
Dan Nicholson66f97862009-04-29 12:11:43 -07001085AC_ARG_ENABLE([egl],
1086 [AS_HELP_STRING([--disable-egl],
1087 [disable EGL library @<:@default=enabled@:>@])],
1088 [enable_egl="$enableval"],
1089 [enable_egl=yes])
Chia-I Wube5f34a2010-10-27 16:14:27 +08001090if test "x$enable_egl" = xno; then
1091 if test "x$mesa_driver" = xno; then
1092 AC_MSG_ERROR([cannot disable EGL when there is no mesa driver])
1093 fi
1094 if test "x$enable_openvg" = xyes; then
1095 AC_MSG_ERROR([cannot enable OpenVG without EGL])
1096 fi
1097fi
Dan Nicholson66f97862009-04-29 12:11:43 -07001098if test "x$enable_egl" = xyes; then
1099 SRC_DIRS="$SRC_DIRS egl"
Chia-I Wud4c1ee02009-12-21 11:13:18 +08001100 EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
1101 EGL_DRIVERS_DIRS=""
Chia-I Wu2eb7a2f2010-02-05 10:46:11 +08001102 if test "$enable_static" != yes; then
Chia-I Wud4c1ee02009-12-21 11:13:18 +08001103 # build egl_glx when libGL is built
Chia-I Wube5f34a2010-10-27 16:14:27 +08001104 if test "$mesa_driver" = xlib -o "$mesa_driver" = dri; then
Chia-I Wu2eb7a2f2010-02-05 10:46:11 +08001105 EGL_DRIVERS_DIRS="glx"
1106 fi
1107
Chia-I Wu39ae9652010-07-16 19:48:52 +08001108 if test "$mesa_driver" = dri; then
1109 # build egl_dri2 when xcb-dri2 is available
1110 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
1111 [have_xcb_dri2=yes],[have_xcb_dri2=no])
1112 PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
1113 [have_libudev=yes],[have_libudev=no])
1114
1115 if test "$have_xcb_dri2" = yes; then
1116 EGL_DRIVER_DRI2=dri2
1117 DEFINES="$DEFINES -DHAVE_XCB_DRI2"
1118 if test "$have_libudev" = yes; then
1119 DEFINES="$DEFINES -DHAVE_LIBUDEV"
1120 fi
1121 fi
1122 fi
Kristian Høgsberg2168b872010-06-02 22:48:06 -04001123
1124 EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
Kristian Høgsberg42fa0092010-02-03 10:18:28 -05001125 fi
Dan Nicholson53b37342009-02-25 17:45:34 -08001126fi
Dan Nicholson53b37342009-02-25 17:45:34 -08001127AC_SUBST([EGL_LIB_DEPS])
Chia-I Wud4c1ee02009-12-21 11:13:18 +08001128AC_SUBST([EGL_DRIVERS_DIRS])
Dan Nicholson53b37342009-02-25 17:45:34 -08001129
1130dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -07001131dnl GLU configuration
1132dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -07001133AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001134 [AS_HELP_STRING([--disable-glu],
1135 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001136 [enable_glu="$enableval"],
1137 [enable_glu=yes])
Chia-I Wube5f34a2010-10-27 16:14:27 +08001138
1139if test "x$enable_glu" = xyes -a "x$mesa_driver" = xno; then
1140 AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver])
1141 enable_glu=no
1142fi
1143
Dan Nicholsondca1b792007-10-23 09:25:58 -07001144if test "x$enable_glu" = xyes; then
1145 SRC_DIRS="$SRC_DIRS glu"
1146
Dan Nicholson979ff512007-12-05 18:47:01 -08001147 case "$mesa_driver" in
1148 osmesa)
Dan Nicholson979ff512007-12-05 18:47:01 -08001149 # Link libGLU to libOSMesa instead of libGL
1150 GLU_LIB_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -08001151 GLU_PC_REQ="osmesa"
Dan Nicholson88586332007-11-15 08:59:57 -08001152 if test "$enable_static" = no; then
1153 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
1154 else
1155 GLU_MESA_DEPS=""
1156 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001157 ;;
1158 *)
Dan Nicholson88586332007-11-15 08:59:57 -08001159 # If static, empty GLU_LIB_DEPS and add libs for programs to link
Dan Nicholson71e208b2008-11-24 11:01:57 -08001160 GLU_PC_REQ="gl"
1161 GLU_PC_LIB_PRIV="-lm"
Dan Nicholson88586332007-11-15 08:59:57 -08001162 if test "$enable_static" = no; then
1163 GLU_LIB_DEPS="-lm"
1164 GLU_MESA_DEPS='-l$(GL_LIB)'
1165 else
1166 GLU_LIB_DEPS=""
1167 GLU_MESA_DEPS=""
1168 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
1169 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001170 ;;
1171 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001172fi
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001173if test "$enable_static" = no; then
1174 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
1175fi
Dan Nicholson71e208b2008-11-24 11:01:57 -08001176GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
Dan Nicholson297e16c2008-05-05 15:42:53 -07001177AC_SUBST([GLU_LIB_DEPS])
1178AC_SUBST([GLU_MESA_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001179AC_SUBST([GLU_PC_REQ])
1180AC_SUBST([GLU_PC_REQ_PRIV])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001181AC_SUBST([GLU_PC_LIB_PRIV])
1182AC_SUBST([GLU_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001183
1184dnl
1185dnl GLw configuration
1186dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -07001187AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001188 [AS_HELP_STRING([--disable-glw],
1189 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001190 [enable_glw="$enableval"],
1191 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -08001192dnl Don't build GLw on osmesa
Chia-I Wube5f34a2010-10-27 16:14:27 +08001193if test "x$enable_glw" = xyes; then
1194 case "$mesa_driver" in
1195 osmesa|no)
1196 AC_MSG_NOTICE([Disabling GLw since there is no OpenGL driver])
1197 enable_glw=no
1198 ;;
1199 esac
Dan Nicholson979ff512007-12-05 18:47:01 -08001200fi
Dan Nicholson776c60d2008-07-18 07:40:41 -07001201AC_ARG_ENABLE([motif],
1202 [AS_HELP_STRING([--enable-motif],
1203 [use Motif widgets in GLw @<:@default=disabled@:>@])],
1204 [enable_motif="$enableval"],
1205 [enable_motif=no])
1206
Dan Nicholsondca1b792007-10-23 09:25:58 -07001207if test "x$enable_glw" = xyes; then
1208 SRC_DIRS="$SRC_DIRS glw"
1209 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001210 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001211 GLW_PC_REQ_PRIV="x11 xt"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001212 GLW_LIB_DEPS="$GLW_LIBS"
1213 else
1214 # should check these...
Dan Nicholson776c60d2008-07-18 07:40:41 -07001215 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001216 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1217 GLW_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001218 fi
1219
1220 GLW_SOURCES="GLwDrawA.c"
1221 MOTIF_CFLAGS=
1222 if test "x$enable_motif" = xyes; then
1223 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1224 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1225 if test "x$MOTIF_CONFIG" != xno; then
1226 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1227 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1228 else
1229 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1230 [AC_MSG_ERROR([Can't locate Motif headers])])
1231 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1232 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1233 fi
1234 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1235 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001236 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1237 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001238 fi
1239
Dan Nicholson88586332007-11-15 08:59:57 -08001240 # If static, empty GLW_LIB_DEPS and add libs for programs to link
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001241 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
Dan Nicholson88586332007-11-15 08:59:57 -08001242 if test "$enable_static" = no; then
1243 GLW_MESA_DEPS='-l$(GL_LIB)'
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001244 GLW_LIB_DEPS="$GLW_LIB_DEPS"
Dan Nicholson88586332007-11-15 08:59:57 -08001245 else
1246 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1247 GLW_LIB_DEPS=""
1248 GLW_MESA_DEPS=""
1249 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001250fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001251AC_SUBST([GLW_LIB_DEPS])
1252AC_SUBST([GLW_MESA_DEPS])
Dan Nicholson776c60d2008-07-18 07:40:41 -07001253AC_SUBST([GLW_SOURCES])
1254AC_SUBST([MOTIF_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001255AC_SUBST([GLW_PC_REQ_PRIV])
1256AC_SUBST([GLW_PC_LIB_PRIV])
1257AC_SUBST([GLW_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001258
1259dnl
1260dnl GLUT configuration
1261dnl
1262if test -f "$srcdir/include/GL/glut.h"; then
1263 default_glut=yes
1264else
1265 default_glut=no
1266fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001267AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001268 [AS_HELP_STRING([--disable-glut],
1269 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001270 [enable_glut="$enableval"],
1271 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001272
Chia-I Wube5f34a2010-10-27 16:14:27 +08001273dnl Don't build glut on osmesa
1274if test "x$enable_glut" = xyes; then
1275 case "$mesa_driver" in
1276 osmesa|no)
1277 AC_MSG_NOTICE([Disabling glut since there is no OpenGL driver])
1278 enable_glut=no
1279 ;;
1280 esac
1281fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001282dnl Can't build glut if GLU not available
1283if test "x$enable_glu$enable_glut" = xnoyes; then
1284 AC_MSG_WARN([Disabling glut since GLU is disabled])
1285 enable_glut=no
1286fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001287
Dan Nicholsondca1b792007-10-23 09:25:58 -07001288if test "x$enable_glut" = xyes; then
1289 SRC_DIRS="$SRC_DIRS glut/glx"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001290 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001291 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001292 GLUT_PC_REQ_PRIV="x11 xmu xi"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001293 GLUT_LIB_DEPS="$GLUT_LIBS"
1294 else
1295 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -08001296 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001297 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1298 GLUT_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001299 fi
John Hein96172542010-07-01 12:53:28 -07001300 if test "x$GCC" = xyes; then
1301 GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
1302 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001303 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1304 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001305
Dan Nicholson88586332007-11-15 08:59:57 -08001306 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1307 if test "$enable_static" = no; then
1308 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1309 else
1310 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1311 GLUT_LIB_DEPS=""
1312 GLUT_MESA_DEPS=""
1313 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001314fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001315AC_SUBST([GLUT_LIB_DEPS])
1316AC_SUBST([GLUT_MESA_DEPS])
1317AC_SUBST([GLUT_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001318AC_SUBST([GLUT_PC_REQ_PRIV])
1319AC_SUBST([GLUT_PC_LIB_PRIV])
1320AC_SUBST([GLUT_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001321
1322dnl
1323dnl Program library dependencies
1324dnl Only libm is added here if necessary as the libraries should
1325dnl be pulled in by the linker
1326dnl
1327if test "x$APP_LIB_DEPS" = x; then
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001328 case "$host_os" in
1329 solaris*)
1330 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1331 ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +01001332 cygwin*)
1333 APP_LIB_DEPS="-lX11"
1334 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001335 *)
1336 APP_LIB_DEPS="-lm"
1337 ;;
1338 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001339fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001340AC_SUBST([APP_LIB_DEPS])
1341AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001342
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001343dnl
1344dnl Gallium configuration
1345dnl
1346AC_ARG_ENABLE([gallium],
1347 [AS_HELP_STRING([--disable-gallium],
1348 [build gallium @<:@default=enabled@:>@])],
1349 [enable_gallium="$enableval"],
1350 [enable_gallium=yes])
Chia-I Wube5f34a2010-10-27 16:14:27 +08001351if test "x$enable_gallium" = xno -a "x$enable_openvg" = xyes; then
1352 AC_MSG_ERROR([cannot enable OpenVG without Gallium])
1353fi
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001354if test "x$enable_gallium" = xyes; then
Jakob Bornecrantzbe38b322010-03-23 13:23:26 +00001355 SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
Dave Airlie81fe1982010-04-22 14:59:29 +10001356 AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
1357 [HAS_UDIS86="no"])
1358 AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001359fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001360
Dave Airlie81fe1982010-04-22 14:59:29 +10001361AC_SUBST([LLVM_CFLAGS])
1362AC_SUBST([LLVM_LIBS])
1363AC_SUBST([LLVM_LDFLAGS])
1364AC_SUBST([LLVM_VERSION])
1365
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001366dnl
1367dnl Gallium state trackers configuration
1368dnl
Chia-I Wudbacbb82010-11-02 02:00:36 +08001369
1370AC_ARG_ENABLE([gallium-egl],
1371 [AS_HELP_STRING([--enable-gallium-egl],
1372 [enable gallium EGL state tracker @<:@default=auto@:>@])],
1373 [enable_gallium_egl="$enableval"],
1374 [enable_gallium_egl=auto])
1375if test "x$enable_gallium_egl" = xauto; then
1376 case "$mesa_driver" in
1377 dri|no)
1378 enable_gallium_egl=$enable_egl
1379 ;;
1380 *)
Chia-I Wuada9c782011-01-04 01:05:22 +08001381 enable_gallium_egl=$enable_openvg
Chia-I Wudbacbb82010-11-02 02:00:36 +08001382 ;;
1383 esac
1384fi
1385case "x$enable_egl$enable_gallium_egl" in
1386xnoyes)
1387 AC_MSG_ERROR([cannot build Gallium EGL state tracker without EGL])
1388esac
1389
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001390AC_ARG_WITH([state-trackers],
1391 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1392 [comma delimited state_trackers list, e.g.
1393 "egl,glx" @<:@default=auto@:>@])],
1394 [with_state_trackers="$withval"],
1395 [with_state_trackers=yes])
1396
1397case "$with_state_trackers" in
1398no)
1399 GALLIUM_STATE_TRACKERS_DIRS=""
1400 ;;
1401yes)
1402 # look at what else is built
1403 case "$mesa_driver" in
Jakob Bornecrantz373e6712009-04-18 23:13:56 +01001404 xlib)
1405 GALLIUM_STATE_TRACKERS_DIRS=glx
1406 ;;
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001407 dri)
Jakob Bornecrantz5b1fc142010-03-25 18:29:51 +01001408 GALLIUM_STATE_TRACKERS_DIRS="dri"
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001409 HAVE_ST_DRI="yes"
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001410 # Have only tested st/xorg on 1.6.0 servers
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001411 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001412 HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1413 HAVE_ST_XORG="no")
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001414 ;;
1415 esac
Chia-I Wube5f34a2010-10-27 16:14:27 +08001416
1417 if test "x$enable_egl" = xyes; then
1418 if test "$enable_openvg" = yes; then
1419 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vega"
1420 st_egl="yes"
1421 fi
1422
Chia-I Wudbacbb82010-11-02 02:00:36 +08001423 if test "$enable_gallium_egl" = yes; then
Chia-I Wube5f34a2010-10-27 16:14:27 +08001424 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
1425 HAVE_ST_EGL="yes"
1426 fi
1427 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001428 ;;
1429*)
1430 # verify the requested state tracker exist
Chia-I Wu63ab2502010-05-05 15:38:02 +08001431 state_trackers=""
1432 _state_trackers=`IFS=', '; echo $with_state_trackers`
1433 for tracker in $_state_trackers; do
Chia-I Wue5d351d2009-12-23 11:18:00 +08001434 case "$tracker" in
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001435 dri)
1436 if test "x$mesa_driver" != xdri; then
1437 AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
1438 fi
1439 HAVE_ST_DRI="yes"
1440 ;;
Chia-I Wu3c967a92010-01-22 16:31:43 +08001441 egl)
Chia-I Wue5d351d2009-12-23 11:18:00 +08001442 if test "x$enable_egl" != xyes; then
Chia-I Wu3c967a92010-01-22 16:31:43 +08001443 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
Chia-I Wue5d351d2009-12-23 11:18:00 +08001444 fi
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001445 HAVE_ST_EGL="yes"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001446 ;;
1447 xorg)
Jakob Bornecrantz4f956882010-07-13 07:40:47 -07001448 PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001449 PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1450 PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001451 HAVE_ST_XORG="yes"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001452 ;;
Chia-I Wu156e9552010-10-30 14:26:01 +08001453 vega)
1454 if test "x$enable_openvg" != xyes; then
1455 AC_MSG_ERROR([cannot build vega state tracker without --enable-openvg])
1456 fi
Chia-I Wuc116a0e2011-01-20 14:19:13 +08001457 have_st_vega="yes"
Chia-I Wu156e9552010-10-30 14:26:01 +08001458 ;;
Chia-I Wue5d351d2009-12-23 11:18:00 +08001459 esac
Chia-I Wu63ab2502010-05-05 15:38:02 +08001460
1461 if test -n "$tracker"; then
1462 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1463 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
1464 if test -n "$state_trackers"; then
1465 state_trackers="$state_trackers $tracker"
1466 else
1467 state_trackers="$tracker"
1468 fi
1469 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001470 done
1471 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
Chia-I Wuc116a0e2011-01-20 14:19:13 +08001472
1473 # append --enable-openvg/--enable-gallium-egl to --with-state-trackers
1474 if test "x$have_st_vega" != xyes -a "x$enable_openvg" = xyes; then
1475 AC_MSG_ERROR([--with-state-trackers specified but vega is missing])
1476 fi
1477 if test "x$HAVE_ST_EGL" != xyes -a "x$enable_gallium_egl" = xyes; then
1478 AC_MSG_ERROR([--with-state-trackers specified but egl is missing])
1479 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001480 ;;
1481esac
1482
Chia-I Wube5f34a2010-10-27 16:14:27 +08001483
1484EGL_CLIENT_APIS=""
1485VG_LIB_DEPS=""
1486
1487case "x$enable_opengl$enable_gles1$enable_gles2" in
1488x*yes*)
1489 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
1490 ;;
1491esac
Chia-I Wube5f34a2010-10-27 16:14:27 +08001492if test "x$enable_openvg" = xyes; then
1493 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
1494 VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
1495fi
1496
Chia-I Wu874ccd52010-05-04 22:43:05 +08001497AC_SUBST([VG_LIB_DEPS])
Chia-I Wu63ab2502010-05-05 15:38:02 +08001498AC_SUBST([EGL_CLIENT_APIS])
1499
1500if test "x$HAVE_ST_EGL" = xyes; then
Chia-I Wud8e0e112010-06-29 14:04:27 +08001501 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
Chia-I Wu63ab2502010-05-05 15:38:02 +08001502fi
Chia-I Wu874ccd52010-05-04 22:43:05 +08001503
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001504if test "x$HAVE_ST_XORG" = xyes; then
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001505 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1506 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1507 HAVE_XEXTPROTO_71="no")
1508fi
1509
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001510AC_ARG_WITH([egl-platforms],
1511 [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1512 [comma delimited native platforms libEGL supports, e.g.
Chia-I Wue7424d72010-09-19 16:54:39 +08001513 "x11,drm" @<:@default=auto@:>@])],
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001514 [with_egl_platforms="$withval"],
1515 [with_egl_platforms=yes])
Chia-I Wu49381d62010-01-11 01:23:01 +08001516AC_ARG_WITH([egl-displays],
1517 [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001518 [DEPRECATED. Use --with-egl-platforms instead])],
1519 [with_egl_platforms="$withval"])
Chia-I Wu49381d62010-01-11 01:23:01 +08001520
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001521EGL_PLATFORMS=""
Benjamin Franzke214fc6e2011-02-04 12:24:08 +01001522WAYLAND_EGL_LIB_DEPS=""
1523
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001524case "$with_egl_platforms" in
Chia-I Wu49381d62010-01-11 01:23:01 +08001525yes)
1526 if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001527 EGL_PLATFORMS="x11"
Chia-I Wu2a910b32010-09-19 17:31:34 +08001528 if test "$mesa_driver" = dri; then
1529 EGL_PLATFORMS="$EGL_PLATFORMS drm"
1530 fi
Chia-I Wu49381d62010-01-11 01:23:01 +08001531 fi
1532 ;;
1533*)
1534 if test "x$enable_egl" != xyes; then
1535 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1536 fi
1537 # verify the requested driver directories exist
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001538 egl_platforms=`IFS=', '; echo $with_egl_platforms`
1539 for plat in $egl_platforms; do
1540 test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
1541 AC_MSG_ERROR([EGL platform '$plat' does't exist])
1542 if test "$plat" = "fbdev"; then
Chia-I Wu8f3e48e2010-06-17 14:10:53 +08001543 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
1544 fi
Benjamin Franzkee586c4b2011-02-04 12:22:58 +01001545 if test "$plat" = "wayland"; then
1546 PKG_CHECK_MODULES([WAYLAND], [wayland-client],, \
1547 [AC_MSG_ERROR([cannot find libwayland-client])])
Benjamin Franzke214fc6e2011-02-04 12:24:08 +01001548 WAYLAND_EGL_LIB_DEPS="$WAYLAND_LIBS $LIBDRM_LIBS"
Benjamin Franzkee586c4b2011-02-04 12:22:58 +01001549 fi
Chia-I Wu49381d62010-01-11 01:23:01 +08001550 done
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001551 EGL_PLATFORMS="$egl_platforms"
Chia-I Wu49381d62010-01-11 01:23:01 +08001552 ;;
1553esac
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001554AC_SUBST([EGL_PLATFORMS])
Chia-I Wu49381d62010-01-11 01:23:01 +08001555
Benjamin Franzke214fc6e2011-02-04 12:24:08 +01001556AC_SUBST([WAYLAND_EGL_LIB_DEPS])
1557WAYLAND_EGL_PC_REQ_PRIV="wayland-client libdrm"
1558WAYLAND_EGL_PC_LIB_PRIV=
1559WAYLAND_EGL_PC_CFLAGS=
1560
1561AC_SUBST([WAYLAND_EGL_PC_REQ_PRIV])
1562AC_SUBST([WAYLAND_EGL_PC_LIB_PRIV])
1563AC_SUBST([WAYLAND_EGL_PC_CFLAGS])
1564
1565
Chia-I Wu28c3e572010-01-23 20:18:43 +08001566AC_ARG_WITH([egl-driver-dir],
1567 [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1568 [directory for EGL drivers [[default=${libdir}/egl]]])],
1569 [EGL_DRIVER_INSTALL_DIR="$withval"],
1570 [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1571AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1572
Joel Bosveld8acca482009-03-06 08:46:08 +09001573AC_ARG_WITH([xorg-driver-dir],
1574 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1575 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1576 [XORG_DRIVER_INSTALL_DIR="$withval"],
1577 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1578AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1579
Tom Fogal7085dce2009-08-13 19:40:30 -06001580AC_ARG_WITH([max-width],
1581 [AS_HELP_STRING([--with-max-width=N],
1582 [Maximum framebuffer width (4096)])],
1583 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1584 AS_IF([test "${withval}" -gt "4096"],
1585 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1586)
1587AC_ARG_WITH([max-height],
1588 [AS_HELP_STRING([--with-max-height=N],
1589 [Maximum framebuffer height (4096)])],
1590 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1591 AS_IF([test "${withval}" -gt "4096"],
1592 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1593)
1594
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001595dnl
Dave Airlie81fe1982010-04-22 14:59:29 +10001596dnl Gallium LLVM
1597dnl
1598AC_ARG_ENABLE([gallium-llvm],
1599 [AS_HELP_STRING([--enable-gallium-llvm],
1600 [build gallium LLVM support @<:@default=disabled@:>@])],
1601 [enable_gallium_llvm="$enableval"],
1602 [enable_gallium_llvm=auto])
1603if test "x$enable_gallium_llvm" = xyes; then
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001604 if test "x$LLVM_CONFIG" != xno; then
1605 LLVM_VERSION=`$LLVM_CONFIG --version`
Brian Paul7da704e2010-12-08 06:44:42 -07001606 LLVM_CFLAGS=`$LLVM_CONFIG --cppflags`
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001607 LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
1608
1609 if test "x$HAS_UDIS86" != xno; then
1610 LLVM_LIBS="$LLVM_LIBS -ludis86"
1611 DEFINES="$DEFINES -DHAVE_UDIS86"
Dave Airlie81fe1982010-04-22 14:59:29 +10001612 fi
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001613 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1614 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
Chia-I Wu3ecb8c22010-05-11 12:36:49 +08001615 DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001616 MESA_LLVM=1
1617 else
Dave Airlie81fe1982010-04-22 14:59:29 +10001618 MESA_LLVM=0
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001619 fi
1620else
1621 MESA_LLVM=0
Dave Airlie81fe1982010-04-22 14:59:29 +10001622fi
1623
1624dnl
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001625dnl Gallium helper functions
1626dnl
1627gallium_check_st() {
Chia-I Wud8e0e112010-06-29 14:04:27 +08001628 if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001629 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1630 fi
1631 if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
1632 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1633 fi
Chia-I Wud8e0e112010-06-29 14:04:27 +08001634 if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001635 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1636 fi
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001637}
1638
1639
1640dnl
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001641dnl Gallium SVGA configuration
1642dnl
1643AC_ARG_ENABLE([gallium-svga],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001644 [AS_HELP_STRING([--enable-gallium-svga],
1645 [build gallium SVGA @<:@default=disabled@:>@])],
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001646 [enable_gallium_svga="$enableval"],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001647 [enable_gallium_svga=auto])
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001648if test "x$enable_gallium_svga" = xyes; then
Xavier Chantryff0987a2010-03-26 11:02:03 +01001649 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001650 gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001651elif test "x$enable_gallium_svga" = xauto; then
1652 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001653fi
1654
1655dnl
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001656dnl Gallium i915 configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001657dnl
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001658AC_ARG_ENABLE([gallium-i915],
1659 [AS_HELP_STRING([--enable-gallium-i915],
1660 [build gallium i915 @<:@default=disabled@:>@])],
1661 [enable_gallium_i915="$enableval"],
1662 [enable_gallium_i915=auto])
1663if test "x$enable_gallium_i915" = xyes; then
Jakob Bornecrantz44bafca2010-04-17 15:17:33 +01001664 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001665 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001666 gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001667elif test "x$enable_gallium_i915" = xauto; then
Jakob Bornecrantz44bafca2010-04-17 15:17:33 +01001668 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001669 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1670fi
1671
1672dnl
1673dnl Gallium i965 configuration
1674dnl
1675AC_ARG_ENABLE([gallium-i965],
1676 [AS_HELP_STRING([--enable-gallium-i965],
1677 [build gallium i965 @<:@default=disabled@:>@])],
1678 [enable_gallium_i965="$enableval"],
1679 [enable_gallium_i965=auto])
1680if test "x$enable_gallium_i965" = xyes; then
1681 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001682 gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001683elif test "x$enable_gallium_i965" = xauto; then
1684 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001685fi
1686
1687dnl
Marek Olšák85a45dc2010-09-23 21:50:43 +02001688dnl Gallium Radeon r300g configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001689dnl
1690AC_ARG_ENABLE([gallium-radeon],
1691 [AS_HELP_STRING([--enable-gallium-radeon],
1692 [build gallium radeon @<:@default=disabled@:>@])],
1693 [enable_gallium_radeon="$enableval"],
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001694 [enable_gallium_radeon=auto])
Marek Olšák11eb4222010-09-28 19:32:32 +02001695if test "x$enable_gallium_radeon" = xauto; then
1696 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
1697 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1698 gallium_check_st "radeon/drm" "dri-r300"
1699 else
1700 AC_MSG_WARN([libdrm_radeon is missing, not building gallium-radeon (r300)])
1701 fi
1702fi
1703if test "x$enable_gallium_radeon" = xyes; then
Marek Olšáka1aec2e2010-09-26 17:52:58 +02001704 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
1705 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1706 gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
1707 else
Marek Olšák11eb4222010-09-28 19:32:32 +02001708 AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-radeon (r300)])
Marek Olšáka1aec2e2010-09-26 17:52:58 +02001709 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001710fi
1711
1712dnl
Jakob Bornecrantzaeee5262010-05-13 20:29:18 +01001713dnl Gallium Radeon r600g configuration
1714dnl
1715AC_ARG_ENABLE([gallium-r600],
1716 [AS_HELP_STRING([--enable-gallium-r600],
1717 [build gallium radeon @<:@default=disabled@:>@])],
1718 [enable_gallium_r600="$enableval"],
1719 [enable_gallium_r600=auto])
1720if test "x$enable_gallium_r600" = xyes; then
Marek Olšáka1aec2e2010-09-26 17:52:58 +02001721 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
1722 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1723 gallium_check_st "r600/drm" "dri-r600"
1724 else
1725 AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-r600])
1726 fi
Jakob Bornecrantzaeee5262010-05-13 20:29:18 +01001727fi
1728
1729dnl
Thierry Vignaud1402ea82009-09-14 11:48:51 -06001730dnl Gallium Nouveau configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001731dnl
1732AC_ARG_ENABLE([gallium-nouveau],
1733 [AS_HELP_STRING([--enable-gallium-nouveau],
1734 [build gallium nouveau @<:@default=disabled@:>@])],
1735 [enable_gallium_nouveau="$enableval"],
1736 [enable_gallium_nouveau=no])
1737if test "x$enable_gallium_nouveau" = xyes; then
Christoph Bumiller4c224752010-11-12 15:17:40 +01001738 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001739 gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001740fi
1741
Chia-I Wua1306f42010-01-22 15:51:51 +08001742dnl
1743dnl Gallium swrast configuration
1744dnl
1745AC_ARG_ENABLE([gallium-swrast],
1746 [AS_HELP_STRING([--enable-gallium-swrast],
Jakob Bornecrantzf5ba2cd2010-03-24 10:58:45 +01001747 [build gallium swrast @<:@default=auto@:>@])],
Chia-I Wua1306f42010-01-22 15:51:51 +08001748 [enable_gallium_swrast="$enableval"],
1749 [enable_gallium_swrast=auto])
George Sapountzis7b333292010-03-25 17:01:54 +02001750if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
Jakob Bornecrantz5b1fc142010-03-25 18:29:51 +01001751 if test "x$HAVE_ST_DRI" = xyes; then
George Sapountzis7b333292010-03-25 17:01:54 +02001752 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
Jakob Bornecrantzf5ba2cd2010-03-24 10:58:45 +01001753 fi
Chia-I Wua1306f42010-01-22 15:51:51 +08001754fi
1755
Chia-I Wu99a37ed2010-01-05 17:39:05 +08001756dnl prepend CORE_DIRS to SRC_DIRS
1757SRC_DIRS="$CORE_DIRS $SRC_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001758
Dan Nicholsondca1b792007-10-23 09:25:58 -07001759dnl Restore LDFLAGS and CPPFLAGS
1760LDFLAGS="$_SAVE_LDFLAGS"
1761CPPFLAGS="$_SAVE_CPPFLAGS"
1762
1763dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -08001764AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001765
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001766dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001767AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001768if test -f configs/current || test -L configs/current; then
1769 rm -f configs/current
1770fi
1771ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001772])
1773
1774AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001775
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001776dnl
1777dnl Output some configuration info for the user
1778dnl
1779echo ""
1780echo " prefix: $prefix"
1781echo " exec_prefix: $exec_prefix"
1782echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07001783echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001784
Chia-I Wu815faa42010-10-29 12:34:44 +08001785dnl API info
1786echo ""
1787echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
Chia-I Wu815faa42010-10-29 12:34:44 +08001788echo " OpenVG: $enable_openvg"
1789
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001790dnl Driver info
1791echo ""
1792echo " Driver: $mesa_driver"
Chia-I Wu815faa42010-10-29 12:34:44 +08001793if test "$mesa_driver" != no; then
1794 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1795 echo " OSMesa: lib$OSMESA_LIB"
1796 else
1797 echo " OSMesa: no"
1798 fi
1799 if test "$mesa_driver" = dri; then
1800 # cleanup the drivers var
1801 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1802 if test "x$DRI_DIRS" = x; then
1803 echo " DRI drivers: no"
1804 else
1805 echo " DRI drivers: $dri_dirs"
1806 fi
1807 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
1808 echo " Use XCB: $enable_xcb"
1809 fi
Dan Nicholson544ab202007-12-30 08:41:53 -08001810fi
Chia-I Wu815faa42010-10-29 12:34:44 +08001811echo ""
1812echo " GLU: $enable_glu"
1813echo " GLw: $enable_glw (Motif: $enable_motif)"
1814echo " glut: $enable_glut"
1815
1816dnl EGL
1817echo ""
1818echo " EGL: $enable_egl"
1819if test "$enable_egl" = yes; then
1820 echo " EGL platforms: $EGL_PLATFORMS"
Chia-I Wu12300502010-10-31 21:01:54 +08001821
1822 egl_drivers=""
1823 for d in $EGL_DRIVERS_DIRS; do
Chia-I Wuc98ea262011-01-07 16:30:08 +08001824 egl_drivers="$egl_drivers builtin:egl_$d"
Chia-I Wu12300502010-10-31 21:01:54 +08001825 done
1826
Chia-I Wu815faa42010-10-29 12:34:44 +08001827 if test "$enable_gallium" = yes -a "$HAVE_ST_EGL" = yes; then
Chia-I Wu12300502010-10-31 21:01:54 +08001828 echo " EGL drivers: ${egl_drivers} egl_gallium"
1829 echo " EGL Gallium STs:$EGL_CLIENT_APIS"
Chia-I Wu815faa42010-10-29 12:34:44 +08001830 else
Chia-I Wu12300502010-10-31 21:01:54 +08001831 echo " EGL drivers: $egl_drivers"
Chia-I Wu815faa42010-10-29 12:34:44 +08001832 fi
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001833fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001834
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001835echo ""
Eric Anholt1a8b1272010-05-21 12:17:24 -07001836if test "x$MESA_LLVM" = x1; then
Jakob Bornecrantzfe0fe672010-04-28 13:38:58 +01001837 echo " llvm: yes"
1838 echo " llvm-config: $LLVM_CONFIG"
1839 echo " llvm-version: $LLVM_VERSION"
1840else
1841 echo " llvm: no"
1842fi
1843
1844echo ""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001845if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1846 echo " Gallium: yes"
1847 echo " Gallium dirs: $GALLIUM_DIRS"
Keith Whitwell51bff092010-03-11 14:43:00 +00001848 echo " Target dirs: $GALLIUM_TARGET_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001849 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001850 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001851 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1852else
1853 echo " Gallium: no"
1854fi
1855
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001856dnl Libraries
1857echo ""
1858echo " Shared libs: $enable_shared"
1859echo " Static libs: $enable_static"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001860
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001861dnl Compiler options
1862# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1863cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1864 $SED 's/^ *//;s/ */ /;s/ *$//'`
1865cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1866 $SED 's/^ *//;s/ */ /;s/ *$//'`
1867defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1868echo ""
1869echo " CFLAGS: $cflags"
1870echo " CXXFLAGS: $cxxflags"
1871echo " Macros: $defines"
Kenneth Graunke3acc8262010-10-25 13:52:58 -07001872echo ""
1873echo " PYTHON2: $PYTHON2"
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001874
Dan Nicholsondca1b792007-10-23 09:25:58 -07001875echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07001876echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001877echo ""