blob: ddd860813bbef477707c3dcdababa94ccaa58c9e [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
Chris Wilsonfaf1dda2011-03-01 18:39:15 +000021LIBDRM_REQUIRED=2.4.24
22LIBDRM_RADEON_REQUIRED=2.4.24
23LIBDRM_INTEL_REQUIRED=2.4.24
Kristian Høgsbergaa0cd702010-02-15 10:44:05 -050024DRI2PROTO_REQUIRED=2.1
Jesse Barnesf2f83d92010-01-11 17:28:10 -050025GLPROTO_REQUIRED=1.4.11
Chris Wilsonfaf1dda2011-03-01 18:39:15 +000026LIBDRM_XORG_REQUIRED=2.4.24
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])
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100154 VISIBILITY_CFLAGS="-fvisibility=hidden"
155 CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800156 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100157 [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
158
159 # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
160 CFLAGS=$save_CFLAGS
Dan Nicholson0c275b62008-01-15 22:52:25 -0800161
162 # Work around aliasing bugs - developers should comment this out
163 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700164fi
165if test "x$GXX" = xyes; then
166 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -0800167
Kristian Høgsberg7b34fcc2010-09-08 20:34:07 -0400168 # Enable -fvisibility=hidden if using a gcc that supports it
169 save_CXXFLAGS="$CXXFLAGS"
170 AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100171 VISIBILITY_CXXFLAGS="-fvisibility=hidden"
172 CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
Kristian Høgsberg7b34fcc2010-09-08 20:34:07 -0400173 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100174 [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
175
176 # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
177 CXXFLAGS=$save_CXXFLAGS
Kristian Høgsberg7b34fcc2010-09-08 20:34:07 -0400178
Dan Nicholson0c275b62008-01-15 22:52:25 -0800179 # Work around aliasing bugs - developers should comment this out
180 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700181fi
182
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100183AC_SUBST([VISIBILITY_CFLAGS])
184AC_SUBST([VISIBILITY_CXXFLAGS])
185
Dan Nicholsondca1b792007-10-23 09:25:58 -0700186dnl These should be unnecessary, but let the user set them if they want
Dan Nicholson297e16c2008-05-05 15:42:53 -0700187AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700188 Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700189AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
Dan Nicholsondca1b792007-10-23 09:25:58 -0700190 compiler. Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700191AC_SUBST([OPT_FLAGS])
192AC_SUBST([ARCH_FLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700193
194dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600195dnl Hacks to enable 32 or 64 bit build
196dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700197AC_ARG_ENABLE([32-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600198 [AS_HELP_STRING([--enable-32-bit],
199 [build 32-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700200 [enable_32bit="$enableval"],
201 [enable_32bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600202)
203if test "x$enable_32bit" = xyes; then
204 if test "x$GCC" = xyes; then
205 CFLAGS="$CFLAGS -m32"
Marc Dietrichc705e722009-08-31 08:56:33 -0700206 ARCH_FLAGS="$ARCH_FLAGS -m32"
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600207 fi
208 if test "x$GXX" = xyes; then
209 CXXFLAGS="$CXXFLAGS -m32"
210 fi
211fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700212AC_ARG_ENABLE([64-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600213 [AS_HELP_STRING([--enable-64-bit],
214 [build 64-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700215 [enable_64bit="$enableval"],
216 [enable_64bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600217)
218if test "x$enable_64bit" = xyes; then
219 if test "x$GCC" = xyes; then
220 CFLAGS="$CFLAGS -m64"
221 fi
222 if test "x$GXX" = xyes; then
223 CXXFLAGS="$CXXFLAGS -m64"
224 fi
225fi
226
227dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800228dnl shared/static libraries, mimic libtool options
229dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700230AC_ARG_ENABLE([static],
Dan Nicholson88586332007-11-15 08:59:57 -0800231 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800232 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700233 [enable_static="$enableval"],
234 [enable_static=no]
Dan Nicholson88586332007-11-15 08:59:57 -0800235)
236case "x$enable_static" in
237xyes|xno ) ;;
238x ) enable_static=no ;;
239* )
240 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
241 ;;
242esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700243AC_ARG_ENABLE([shared],
Dan Nicholson88586332007-11-15 08:59:57 -0800244 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800245 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700246 [enable_shared="$enableval"],
247 [enable_shared=yes]
Dan Nicholson88586332007-11-15 08:59:57 -0800248)
249case "x$enable_shared" in
250xyes|xno ) ;;
251x ) enable_shared=yes ;;
252* )
253 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
254 ;;
255esac
256
257dnl Can't have static and shared libraries, default to static if user
258dnl explicitly requested. If both disabled, set to static since shared
259dnl was explicitly requirested.
260case "x$enable_static$enable_shared" in
261xyesyes )
262 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
263 enable_shared=no
264 ;;
265xnono )
266 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
267 enable_static=yes
268 ;;
269esac
270
271dnl
272dnl mklib options
273dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700274AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
Dan Nicholson88586332007-11-15 08:59:57 -0800275if test "$enable_static" = yes; then
276 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
277fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700278AC_SUBST([MKLIB_OPTIONS])
Dan Nicholson88586332007-11-15 08:59:57 -0800279
Dan Nicholson23656c42007-12-12 09:02:31 -0800280dnl
281dnl other compiler options
282dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700283AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800284 [AS_HELP_STRING([--enable-debug],
285 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700286 [enable_debug="$enableval"],
287 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800288)
289if test "x$enable_debug" = xyes; then
290 DEFINES="$DEFINES -DDEBUG"
291 if test "x$GCC" = xyes; then
292 CFLAGS="$CFLAGS -g"
293 fi
294 if test "x$GXX" = xyes; then
295 CXXFLAGS="$CXXFLAGS -g"
296 fi
297fi
Dan Nicholson88586332007-11-15 08:59:57 -0800298
299dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700300dnl library names
301dnl
Jon TURNEYc55a8a72010-07-24 12:05:34 +0100302LIB_PREFIX_GLOB='lib'
303LIB_VERSION_SEPARATOR='.'
Dan Nicholson88586332007-11-15 08:59:57 -0800304if test "$enable_static" = yes; then
Dan Nicholson8217f242009-02-11 15:16:00 -0800305 LIB_EXTENSION='a'
Dan Nicholson88586332007-11-15 08:59:57 -0800306else
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700307 case "$host_os" in
308 darwin* )
309 LIB_EXTENSION='dylib' ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +0100310 cygwin* )
Jon TURNEYc55a8a72010-07-24 12:05:34 +0100311 dnl prefix can be 'cyg' or 'lib'
312 LIB_PREFIX_GLOB='???'
313 LIB_VERSION_SEPARATOR='-'
314 LIB_EXTENSION='dll' ;;
Tom Fogal9282edf2009-10-13 10:55:33 -0700315 aix* )
316 LIB_EXTENSION='a' ;;
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700317 * )
318 LIB_EXTENSION='so' ;;
319 esac
Dan Nicholson88586332007-11-15 08:59:57 -0800320fi
Dan Nicholson8217f242009-02-11 15:16:00 -0800321
Marek Olšák848f7d32011-04-01 01:12:41 +0200322dnl
323dnl potentially-infringing-but-nobody-knows-for-sure stuff
324dnl
325AC_ARG_ENABLE([texture-float],
326 [AS_HELP_STRING([--enable-texture-float],
327 [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
328 [enable_texture_float="$enableval"],
329 [enable_texture_float=no]
330)
331if test "x$enable_texture_float" = xyes; then
332 AC_MSG_WARN([Floating-point textures enabled.])
333 AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
334 DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
335fi
336
Dan Nicholson8217f242009-02-11 15:16:00 -0800337GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
338GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
339GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
340GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
341OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800342EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500343GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
344GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
Chia-I Wu874ccd52010-05-04 22:43:05 +0800345VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800346GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100347WAYLAND_EGL_LIB_NAME='lib$(WAYLAND_EGL_LIB).'${LIB_EXTENSION}
Dan Nicholson8217f242009-02-11 15:16:00 -0800348
Jon TURNEYc55a8a72010-07-24 12:05:34 +0100349GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
350GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
351GLUT_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLUT_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
352GLW_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLW_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
353OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
354EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
355EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
356GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
357GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
358VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800359GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100360WAYLAND_EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(WAYLAND_EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
Dan Nicholson8217f242009-02-11 15:16:00 -0800361
Dan Nicholson297e16c2008-05-05 15:42:53 -0700362AC_SUBST([GL_LIB_NAME])
363AC_SUBST([GLU_LIB_NAME])
364AC_SUBST([GLUT_LIB_NAME])
365AC_SUBST([GLW_LIB_NAME])
366AC_SUBST([OSMESA_LIB_NAME])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800367AC_SUBST([EGL_LIB_NAME])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500368AC_SUBST([GLESv1_CM_LIB_NAME])
369AC_SUBST([GLESv2_LIB_NAME])
Chia-I Wu874ccd52010-05-04 22:43:05 +0800370AC_SUBST([VG_LIB_NAME])
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800371AC_SUBST([GLAPI_LIB_NAME])
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100372AC_SUBST([WAYLAND_EGL_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700373
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700374AC_SUBST([GL_LIB_GLOB])
375AC_SUBST([GLU_LIB_GLOB])
376AC_SUBST([GLUT_LIB_GLOB])
377AC_SUBST([GLW_LIB_GLOB])
378AC_SUBST([OSMESA_LIB_GLOB])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800379AC_SUBST([EGL_LIB_GLOB])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500380AC_SUBST([GLESv1_CM_LIB_GLOB])
381AC_SUBST([GLESv2_LIB_GLOB])
Chia-I Wu874ccd52010-05-04 22:43:05 +0800382AC_SUBST([VG_LIB_GLOB])
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800383AC_SUBST([GLAPI_LIB_GLOB])
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100384AC_SUBST([WAYLAND_EGL_LIB_GLOB])
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700385
Dan Nicholsondca1b792007-10-23 09:25:58 -0700386dnl
Dan Nicholson871125a2008-06-04 13:00:35 -0700387dnl Arch/platform-specific settings
388dnl
389AC_ARG_ENABLE([asm],
390 [AS_HELP_STRING([--disable-asm],
391 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
392 [enable_asm="$enableval"],
393 [enable_asm=yes]
394)
395asm_arch=""
396ASM_FLAGS=""
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800397MESA_ASM_SOURCES=""
398GLAPI_ASM_SOURCES=""
Dan Nicholson871125a2008-06-04 13:00:35 -0700399AC_MSG_CHECKING([whether to enable assembly])
400test "x$enable_asm" = xno && AC_MSG_RESULT([no])
401# disable if cross compiling on x86/x86_64 since we must run gen_matypes
402if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
403 case "$host_cpu" in
404 i?86 | x86_64)
405 enable_asm=no
406 AC_MSG_RESULT([no, cross compiling])
407 ;;
408 esac
409fi
410# check for supported arches
411if test "x$enable_asm" = xyes; then
412 case "$host_cpu" in
413 i?86)
414 case "$host_os" in
Pierre Allegraud8fd8de32011-01-06 07:58:57 -0700415 linux* | *freebsd* | dragonfly* | *netbsd*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700416 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
417 ;;
418 esac
419 ;;
420 x86_64)
421 case "$host_os" in
Pierre Allegraud8fd8de32011-01-06 07:58:57 -0700422 linux* | *freebsd* | dragonfly* | *netbsd*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700423 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
424 ;;
425 esac
426 ;;
427 powerpc)
428 case "$host_os" in
429 linux*)
430 asm_arch=ppc
431 ;;
432 esac
433 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800434 sparc*)
435 case "$host_os" in
436 linux*)
437 asm_arch=sparc
438 ;;
439 esac
440 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700441 esac
442
443 case "$asm_arch" in
444 x86)
Dan Nicholson61e925f2009-02-11 10:42:34 -0800445 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800446 MESA_ASM_SOURCES='$(X86_SOURCES)'
447 GLAPI_ASM_SOURCES='$(X86_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700448 AC_MSG_RESULT([yes, x86])
449 ;;
450 x86_64)
451 ASM_FLAGS="-DUSE_X86_64_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800452 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
453 GLAPI_ASM_SOURCES='$(X86-64_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700454 AC_MSG_RESULT([yes, x86_64])
455 ;;
456 ppc)
457 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800458 MESA_ASM_SOURCES='$(PPC_SOURCES)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700459 AC_MSG_RESULT([yes, ppc])
460 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800461 sparc)
462 ASM_FLAGS="-DUSE_SPARC_ASM"
463 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
464 GLAPI_ASM_SOURCES='$(SPARC_API)'
465 AC_MSG_RESULT([yes, sparc])
466 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700467 *)
468 AC_MSG_RESULT([no, platform not supported])
469 ;;
470 esac
471fi
472AC_SUBST([ASM_FLAGS])
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800473AC_SUBST([MESA_ASM_SOURCES])
474AC_SUBST([GLAPI_ASM_SOURCES])
Dan Nicholson871125a2008-06-04 13:00:35 -0700475
476dnl PIC code macro
477MESA_PIC_FLAGS
478
479dnl Check to see if dlopen is in default libraries (like Solaris, which
480dnl has it in libc), or if libdl is needed to get it.
481AC_CHECK_FUNC([dlopen], [],
482 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
Chia-I Wu08f4bc02010-07-16 20:09:29 +0800483AC_SUBST([DLOPEN_LIBS])
Dan Nicholson871125a2008-06-04 13:00:35 -0700484
Dan Nicholson985e1cd2008-06-04 13:17:06 -0700485dnl See if posix_memalign is available
486AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
487
Dan Nicholson871125a2008-06-04 13:00:35 -0700488dnl SELinux awareness.
489AC_ARG_ENABLE([selinux],
490 [AS_HELP_STRING([--enable-selinux],
491 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
492 [MESA_SELINUX="$enableval"],
493 [MESA_SELINUX=no])
494if test "x$enable_selinux" = "xyes"; then
495 AC_CHECK_HEADER([selinux/selinux.h],[],
496 [AC_MSG_ERROR([SELinux headers not found])])
497 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
498 [AC_MSG_ERROR([SELinux library not found])])
499 SELINUX_LIBS="-lselinux"
500 DEFINES="$DEFINES -DMESA_SELINUX"
501fi
502
Chia-I Wube5f34a2010-10-27 16:14:27 +0800503dnl Determine which APIs to support
504AC_ARG_ENABLE([opengl],
505 [AS_HELP_STRING([--disable-opengl],
506 [disable support for standard OpenGL API @<:@default=no@:>@])],
507 [enable_opengl="$enableval"],
508 [enable_opengl=yes])
509AC_ARG_ENABLE([gles1],
510 [AS_HELP_STRING([--enable-gles1],
511 [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
512 [enable_gles1="$enableval"],
513 [enable_gles1=no])
514AC_ARG_ENABLE([gles2],
515 [AS_HELP_STRING([--enable-gles2],
516 [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
517 [enable_gles2="$enableval"],
518 [enable_gles2=no])
519AC_ARG_ENABLE([gles-overlay],
520 [AS_HELP_STRING([--enable-gles-overlay],
Chia-I Wu12583172011-01-07 17:24:16 +0800521 [DEPRECATED. Same as --enable-gles1 and --enable-gles2])],
522 [enable_gles1="$enableval"; enable_gles2="$enableval"],
523 [])
Chia-I Wube5f34a2010-10-27 16:14:27 +0800524
525AC_ARG_ENABLE([openvg],
526 [AS_HELP_STRING([--enable-openvg],
527 [enable support for OpenVG API @<:@default=no@:>@])],
528 [enable_openvg="$enableval"],
529 [enable_openvg=no])
530
Chia-I Wu156e9552010-10-30 14:26:01 +0800531dnl smooth the transition; should be removed eventually
532if test "x$enable_openvg" = xno; then
533 case "x$with_state_trackers" in
534 x*vega*)
535 AC_MSG_WARN([vega state tracker is enabled without --enable-openvg])
536 enable_openvg=yes
537 ;;
538 esac
539fi
540
Chia-I Wube5f34a2010-10-27 16:14:27 +0800541if test "x$enable_opengl" = xno -a \
542 "x$enable_gles1" = xno -a \
543 "x$enable_gles2" = xno -a \
Chia-I Wube5f34a2010-10-27 16:14:27 +0800544 "x$enable_openvg" = xno; then
545 AC_MSG_ERROR([at least one API should be enabled])
546fi
547
548API_DEFINES=""
Chia-I Wube5f34a2010-10-27 16:14:27 +0800549if test "x$enable_opengl" = xno; then
550 API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
551else
552 API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
553fi
554if test "x$enable_gles1" = xyes; then
555 API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
556fi
557if test "x$enable_gles2" = xyes; then
558 API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
559fi
Chia-I Wube5f34a2010-10-27 16:14:27 +0800560AC_SUBST([API_DEFINES])
Chia-I Wube5f34a2010-10-27 16:14:27 +0800561
Chia-I Wue8c7d752010-12-26 18:24:13 +0800562AC_ARG_ENABLE([shared-glapi],
563 [AS_HELP_STRING([--enable-shared-glapi],
564 [EXPERIMENTAL. Enable shared glapi for OpenGL @<:@default=no@:>@])],
565 [enable_shared_glapi="$enableval"],
566 [enable_shared_glapi=no])
567
568SHARED_GLAPI="0"
569if test "x$enable_shared_glapi" = xyes; then
570 SHARED_GLAPI="1"
571fi
572AC_SUBST([SHARED_GLAPI])
573
Dan Nicholson871125a2008-06-04 13:00:35 -0700574dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800575dnl Driver configuration. Options are xlib, dri and osmesa right now.
Kristian Høgsberg43875802010-02-25 15:49:18 -0500576dnl More later: fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800577dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700578default_driver="xlib"
579
580case "$host_os" in
581linux*)
582 case "$host_cpu" in
David S. Miller32dc28a2009-02-24 20:06:05 -0700583 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700584 esac
585 ;;
Pierre Allegraud8fd8de32011-01-06 07:58:57 -0700586*freebsd* | dragonfly* | *netbsd*)
Eric Anholt711222b2008-04-18 15:03:01 -0700587 case "$host_cpu" in
Robert Noland48f05432009-04-10 11:41:27 -0500588 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700589 esac
590 ;;
591esac
592
Chia-I Wube5f34a2010-10-27 16:14:27 +0800593if test "x$enable_opengl" = xno; then
594 default_driver="no"
595fi
596
Dan Nicholson297e16c2008-05-05 15:42:53 -0700597AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800598 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700599 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700600 [mesa_driver="$withval"],
601 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800602dnl Check for valid option
603case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800604xxlib|xdri|xosmesa)
Chia-I Wube5f34a2010-10-27 16:14:27 +0800605 if test "x$enable_opengl" = xno; then
606 AC_MSG_ERROR([Driver '$mesa_driver' requires OpenGL enabled])
607 fi
608 ;;
609xno)
Dan Nicholson44d99142007-12-05 18:47:01 -0800610 ;;
611*)
612 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
613 ;;
614esac
615
616dnl
617dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700618dnl
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800619
620dnl this variable will be prepended to SRC_DIRS and is not exported
Chia-I Wube5f34a2010-10-27 16:14:27 +0800621CORE_DIRS=""
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800622
Jakob Bornecrantz05281062010-06-05 13:33:58 +0200623SRC_DIRS=""
Dan Nicholsondca1b792007-10-23 09:25:58 -0700624GLU_DIRS="sgi"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100625GALLIUM_DIRS="auxiliary drivers state_trackers"
Keith Whitwell51bff092010-03-11 14:43:00 +0000626GALLIUM_TARGET_DIRS=""
Jakob Bornecrantzc9f98672010-03-16 13:54:18 +0000627GALLIUM_WINSYS_DIRS="sw"
Jerome Glisse33495172011-01-09 21:04:41 -0500628GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug noop identity"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100629GALLIUM_STATE_TRACKERS_DIRS=""
630
Chia-I Wue8c7d752010-12-26 18:24:13 +0800631# build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled
Jon TURNEYaa6a5cf2011-02-16 13:37:57 +0000632case "x$enable_shared_glapi$enable_gles1$enable_gles2" in
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800633x*yes*)
634 CORE_DIRS="$CORE_DIRS mapi/shared-glapi"
635 ;;
636esac
637
Chia-I Wube5f34a2010-10-27 16:14:27 +0800638# build glapi if OpenGL is enabled
639if test "x$enable_opengl" = xyes; then
640 CORE_DIRS="$CORE_DIRS mapi/glapi"
641fi
642
Chia-I Wu12583172011-01-07 17:24:16 +0800643# build es1api if OpenGL ES 1.x is enabled
644if test "x$enable_gles1" = xyes; then
645 CORE_DIRS="$CORE_DIRS mapi/es1api"
646fi
647
648# build es2api if OpenGL ES 2.x is enabled
649if test "x$enable_gles2" = xyes; then
650 CORE_DIRS="$CORE_DIRS mapi/es2api"
651fi
Chia-I Wube5f34a2010-10-27 16:14:27 +0800652
653# build vgapi if OpenVG is enabled
654if test "x$enable_openvg" = xyes; then
655 CORE_DIRS="$CORE_DIRS mapi/vgapi"
656fi
657
658# build glsl and mesa if OpenGL or OpenGL ES is enabled
Chia-I Wu12583172011-01-07 17:24:16 +0800659case "x$enable_opengl$enable_gles1$enable_gles2" in
Chia-I Wube5f34a2010-10-27 16:14:27 +0800660x*yes*)
661 CORE_DIRS="$CORE_DIRS glsl mesa"
662 ;;
663esac
664
Dan Nicholson44d99142007-12-05 18:47:01 -0800665case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800666xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800667 DRIVER_DIRS="x11"
Jakob Bornecrantzc9f98672010-03-16 13:54:18 +0000668 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
Keith Whitwell51bff092010-03-11 14:43:00 +0000669 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
Dan Nicholson44d99142007-12-05 18:47:01 -0800670 ;;
671dri)
Kristian Høgsberg6e8897f2010-02-09 09:58:36 -0500672 SRC_DIRS="$SRC_DIRS glx"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100673 DRIVER_DIRS="dri"
Jakob Bornecrantz23a915e2010-06-23 03:31:18 +0200674 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri"
Dan Nicholson44d99142007-12-05 18:47:01 -0800675 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800676osmesa)
677 DRIVER_DIRS="osmesa"
678 ;;
Chia-I Wube5f34a2010-10-27 16:14:27 +0800679no)
680 DRIVER_DRIS=""
681 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800682esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700683AC_SUBST([SRC_DIRS])
684AC_SUBST([GLU_DIRS])
685AC_SUBST([DRIVER_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100686AC_SUBST([GALLIUM_DIRS])
Keith Whitwell51bff092010-03-11 14:43:00 +0000687AC_SUBST([GALLIUM_TARGET_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100688AC_SUBST([GALLIUM_WINSYS_DIRS])
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +0000689AC_SUBST([GALLIUM_DRIVERS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100690AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
Dave Airlie81fe1982010-04-22 14:59:29 +1000691AC_SUBST([MESA_LLVM])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700692
693dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700694dnl Find out if X is available. The variable have_x is set if libX11 is
Dan Nicholson99803a42008-07-01 09:03:15 -0700695dnl found to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700696dnl
697if test -n "$PKG_CONFIG"; then
698 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700699 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700700 x11_pkgconfig=yes
701 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700702 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700703 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700704 ])
705 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700706else
707 x11_pkgconfig=no
708fi
709dnl Use the autoconf macro if no pkg-config files
Jeff Smith8d86d392010-03-12 18:55:09 -0600710if test "$x11_pkgconfig" = yes; then
Dan Nicholsone725ef12010-03-15 20:53:56 -0700711 PKG_CHECK_MODULES([X11], [x11])
Jeff Smith8d86d392010-03-12 18:55:09 -0600712else
Dan Nicholsondca1b792007-10-23 09:25:58 -0700713 AC_PATH_XTRA
Dan Nicholsone725ef12010-03-15 20:53:56 -0700714 test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
715 test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
716 AC_SUBST([X11_CFLAGS])
717 AC_SUBST([X11_LIBS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700718fi
719
Dan Nicholson99803a42008-07-01 09:03:15 -0700720dnl Try to tell the user that the --x-* options are only used when
721dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
722m4_divert_once([HELP_BEGIN],
723[These options are only used when the X libraries cannot be found by the
724pkg-config utility.])
725
Dan Nicholson44d99142007-12-05 18:47:01 -0800726dnl We need X for xlib and dri, so bomb now if it's not found
727case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800728xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800729 if test "$no_x" = yes; then
730 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
731 fi
732 ;;
733esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700734
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700735dnl XCB - this is only used for GLX right now
736AC_ARG_ENABLE([xcb],
737 [AS_HELP_STRING([--enable-xcb],
738 [use XCB for GLX @<:@default=disabled@:>@])],
739 [enable_xcb="$enableval"],
740 [enable_xcb=no])
741if test "x$enable_xcb" = xyes; then
742 DEFINES="$DEFINES -DUSE_XCB"
743else
744 enable_xcb=no
745fi
746
Samuel Thibault75856172011-03-14 22:08:21 +0000747dnl Direct rendering or just indirect rendering
noblede7d18ed2011-03-14 22:08:22 +0000748case "$host_os" in
749gnu*)
750 dnl Disable by default on GNU/Hurd
751 driglx_direct_default="no"
752 ;;
Jon TURNEYc6e33ca2011-03-14 22:08:23 +0000753cygwin*)
754 dnl Disable by default on cygwin
755 driglx_direct_default="no"
756 ;;
noblede7d18ed2011-03-14 22:08:22 +0000757*)
758 driglx_direct_default="yes"
759 ;;
760esac
Samuel Thibault75856172011-03-14 22:08:21 +0000761AC_ARG_ENABLE([driglx-direct],
762 [AS_HELP_STRING([--disable-driglx-direct],
763 [enable direct rendering in GLX and EGL for DRI \
noblede7d18ed2011-03-14 22:08:22 +0000764 @<:@default=auto@:>@])],
Samuel Thibault75856172011-03-14 22:08:21 +0000765 [driglx_direct="$enableval"],
noblede7d18ed2011-03-14 22:08:22 +0000766 [driglx_direct="$driglx_direct_default"])
Samuel Thibault75856172011-03-14 22:08:21 +0000767
Dan Nicholson44d99142007-12-05 18:47:01 -0800768dnl
769dnl libGL configuration per driver
770dnl
771case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800772xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800773 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700774 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800775 GL_PC_REQ_PRIV="x11 xext"
Dan Nicholsona1307182007-12-12 17:49:49 -0800776 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
777 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800778 else
779 # should check these...
780 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
781 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800782 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
783 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson44d99142007-12-05 18:47:01 -0800784 fi
Kenneth Graunked1d812052011-01-16 16:01:54 -0800785 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
786 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800787
788 # if static, move the external libraries to the programs
789 # and empty the libraries for libGL
790 if test "$enable_static" = yes; then
791 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
792 GL_LIB_DEPS=""
793 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800794 ;;
Chia-I Wube5f34a2010-10-27 16:14:27 +0800795dri|no) # these checks are still desired when there is no mesa_driver
Dan Nicholson88586332007-11-15 08:59:57 -0800796 # DRI must be shared, I think
797 if test "$enable_static" = yes; then
798 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
799 fi
800
Jesse Barnesf2f83d92010-01-11 17:28:10 -0500801 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
Samuel Thibault75856172011-03-14 22:08:21 +0000802 GL_PC_REQ_PRIV="glproto >= $GLPROTO_REQUIRED"
803 DRI_PC_REQ_PRIV=""
804
805 if test x"$driglx_direct" = xyes; then
806 # Check for libdrm
807 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
808 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
809 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
810 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
811 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800812
813 # find the DRI deps for libGL
814 if test "$x11_pkgconfig" = yes; then
Jon TURNEY2b9dac32010-04-21 12:58:54 +0100815 dri_modules="x11 xext xdamage xfixes"
816
817 # add xf86vidmode if available
818 PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
819 if test "$HAVE_XF86VIDMODE" = yes ; then
820 dri_modules="$dri_modules xxf86vm"
821 fi
822
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700823 # add xcb modules if necessary
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700824 if test "$enable_xcb" = yes; then
825 dri_modules="$dri_modules x11-xcb xcb-glx"
826 fi
827
828 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800829 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Dan Nicholson44d99142007-12-05 18:47:01 -0800830 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
831 GL_LIB_DEPS="$DRIGL_LIBS"
832 else
833 # should check these...
834 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
835 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800836 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
837 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700838
839 # XCB can only be used from pkg-config
840 if test "$enable_xcb" = yes; then
841 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800842 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700843 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
844 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
845 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800846 fi
847
848 # need DRM libs, -lpthread, etc.
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700849 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
850 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500851 GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg74399d42010-05-02 09:51:13 -0400852 GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500853 GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg74399d42010-05-02 09:51:13 -0400854 GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800855 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800856osmesa)
857 # No libGL for osmesa
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700858 GL_LIB_DEPS=""
Dan Nicholson979ff512007-12-05 18:47:01 -0800859 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800860esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700861AC_SUBST([GL_LIB_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800862AC_SUBST([GL_PC_REQ_PRIV])
863AC_SUBST([GL_PC_LIB_PRIV])
864AC_SUBST([GL_PC_CFLAGS])
865AC_SUBST([DRI_PC_REQ_PRIV])
Li Pengc33c1912010-07-30 12:26:15 +0800866AC_SUBST([GLESv1_CM_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -0400867AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500868AC_SUBST([GLESv2_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -0400869AC_SUBST([GLESv2_PC_LIB_PRIV])
870
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800871GLAPI_LIB_DEPS="-lpthread"
872AC_SUBST([GLAPI_LIB_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700873
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100874
875dnl Setup default DRI CFLAGS
876DRI_CFLAGS='$(CFLAGS)'
877DRI_CXXFLAGS='$(CXXFLAGS)'
878DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.a'
879MESA_MODULES='$(TOP)/src/mesa/libmesa.a'
880
881AC_ARG_ENABLE([shared-dricore],
882 [AS_HELP_STRING([--enable-shared-dricore],
883 [link DRI modules with shared core DRI routines @<:@default=disabled@:>@])],
884 [enable_dricore="$enableval"],
885 [enable_dricore=no])
886if test "$mesa_driver" = dri ; then
887 if test "$enable_dricore" = yes ; then
888 if test "$GCC$GXX" != yesyes ; then
889 AC_MSG_WARN([Shared dricore requires GCC-compatible rpath handling. Disabling shared dricore])
890 enable_dricore=no
891 else
892 DRICORE_GLSL_LIBS='$(TOP)/$(LIB_DIR)/libglsl.so'
893 DRICORE_LIBS='$(TOP)/$(LIB_DIR)/libdricore.so'
894 DRICORE_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) -lglsl'
895 DRI_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) -ldricore -lglsl'
896 DRI_CFLAGS='$(CFLAGS_NOVISIBILITY) -DUSE_DRICORE'
897 DRI_CXXFLAGS='$(CXXFLAGS_NOVISIBILITY) -DUSE_DRICORE'
898 MESA_MODULES='$(DRICORE_LIBS) $(DRICORE_GLSL_LIBS)'
899 fi
900 fi
901fi
902AC_SUBST([DRICORE_LIBS])
903AC_SUBST([DRICORE_GLSL_LIBS])
904AC_SUBST([DRICORE_LIB_DEPS])
905AC_SUBST([DRI_CXXFLAGS])
906AC_SUBST([DRI_CFLAGS])
907AC_SUBST([MESA_MODULES])
908
Jon TURNEY2b9dac32010-04-21 12:58:54 +0100909AC_SUBST([HAVE_XF86VIDMODE])
910
Marek Olšáka1aec2e2010-09-26 17:52:58 +0200911PKG_CHECK_MODULES([LIBDRM_RADEON],
Marek Olšákec96b0e2011-02-06 15:42:55 +0100912 [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED],
Marek Olšáka1aec2e2010-09-26 17:52:58 +0200913 HAVE_LIBDRM_RADEON=yes,
914 HAVE_LIBDRM_RADEON=no)
915
Dan Nicholsondca1b792007-10-23 09:25:58 -0700916dnl
917dnl More X11 setup
918dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800919if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700920 DEFINES="$DEFINES -DUSE_XSHM"
921fi
922
923dnl
Tom Fogal31351dc2010-12-05 17:58:32 -0700924dnl TLS detection
Dan Nicholson44d99142007-12-05 18:47:01 -0800925dnl
Tom Fogal31351dc2010-12-05 17:58:32 -0700926
Dan Nicholson297e16c2008-05-05 15:42:53 -0700927AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800928 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800929 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700930 [GLX_USE_TLS="$enableval"],
931 [GLX_USE_TLS=no])
Tom Fogal31351dc2010-12-05 17:58:32 -0700932AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
933
Tom Fogal44842972011-02-21 22:32:18 -0700934AS_IF([test "x$GLX_USE_TLS" = xyes],
935 [DEFINES="${DEFINES} -DGLX_USE_TLS -DPTHREADS"])
936
Tom Fogal31351dc2010-12-05 17:58:32 -0700937dnl
938dnl More DRI setup
939dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800940dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700941AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800942 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700943 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700944 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700945 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700946AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Chow Loong Jin35506de2009-10-28 14:34:14 +0800947dnl Extra search path for DRI drivers
948AC_ARG_WITH([dri-searchpath],
949 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
950 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
951 [DRI_DRIVER_SEARCH_DIR="$withval"],
952 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
953AC_SUBST([DRI_DRIVER_SEARCH_DIR])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800954dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700955AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800956 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholson5cae1b72008-06-30 10:28:02 -0700957 [comma delimited DRI drivers list, e.g.
Michel Dänzercade0712009-07-10 14:49:46 +0200958 "swrast,i965,radeon" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700959 [with_dri_drivers="$withval"],
960 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800961if test "x$with_dri_drivers" = x; then
962 with_dri_drivers=no
963fi
964
965dnl If $with_dri_drivers is yes, directories will be added through
966dnl platform checks
967DRI_DIRS=""
968case "$with_dri_drivers" in
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100969no) ;;
970yes)
971 DRI_DIRS="yes"
972 ;;
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800973*)
974 # verify the requested driver directories exist
Dan Nicholsone6e4f252008-07-06 14:17:39 -0700975 dri_drivers=`IFS=', '; echo $with_dri_drivers`
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800976 for driver in $dri_drivers; do
977 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
978 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
979 done
980 DRI_DIRS="$dri_drivers"
981 ;;
982esac
983
Dan Nicholson44d99142007-12-05 18:47:01 -0800984dnl Set DRI_DIRS, DEFINES and LIB_DEPS
Chia-I Wube5f34a2010-10-27 16:14:27 +0800985if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
Dan Nicholson44d99142007-12-05 18:47:01 -0800986 # Platform specific settings and drivers to build
987 case "$host_os" in
988 linux*)
989 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
Dan Nicholson44d99142007-12-05 18:47:01 -0800990 if test "x$driglx_direct" = xyes; then
991 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
992 fi
Jerome Glisse14f79d42008-12-18 13:36:07 +0100993 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800994
995 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800996 x86_64)
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -0500997 # sis is missing because they have not be converted to use
998 # the new interface. i810 are missing because there is no
999 # x86-64 system where they could *ever* be used.
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001000 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -04001001 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +03001002 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -08001003 fi
Dan Nicholson44d99142007-12-05 18:47:01 -08001004 ;;
1005 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -08001006 # Build only the drivers for cards that exist on PowerPC.
1007 # At some point MGA will be added, but not yet.
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001008 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -04001009 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -08001010 fi
Dan Nicholson44d99142007-12-05 18:47:01 -08001011 ;;
Dave Airlie2b0e75e2008-06-12 12:06:50 +10001012 sparc*)
1013 # Build only the drivers for cards that exist on sparc`
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001014 if test "x$DRI_DIRS" = "xyes"; then
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -05001015 DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +10001016 fi
1017 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -08001018 esac
1019 ;;
Pierre Allegraud8fd8de32011-01-06 07:58:57 -07001020 freebsd* | dragonfly* | *netbsd*)
Dan Nicholson44d99142007-12-05 18:47:01 -08001021 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
1022 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
1023 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
1024 if test "x$driglx_direct" = xyes; then
1025 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1026 fi
Dan Nicholson44d99142007-12-05 18:47:01 -08001027
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001028 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -04001029 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +03001030 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -08001031 fi
Dan Nicholson44d99142007-12-05 18:47:01 -08001032 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -07001033 gnu*)
1034 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
1035 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
1036 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001037 solaris*)
1038 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
1039 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
1040 if test "x$driglx_direct" = xyes; then
1041 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1042 fi
1043 ;;
Jon TURNEYc6e33ca2011-03-14 22:08:23 +00001044 cygwin*)
1045 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
1046 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
1047 if test "x$driglx_direct" = xyes; then
1048 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1049 fi
1050 if test "x$DRI_DIRS" = "xyes"; then
1051 DRI_DIRS="swrast"
1052 fi
1053 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -08001054 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -08001055
1056 # default drivers
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001057 if test "x$DRI_DIRS" = "xyes"; then
Corbin Simpson8e4657a2009-10-22 12:29:30 -07001058 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -05001059 savage sis tdfx unichrome swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -08001060 fi
1061
Dan Nicholson44d99142007-12-05 18:47:01 -08001062 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
1063
1064 # Check for expat
Chia-I Wube5f34a2010-10-27 16:14:27 +08001065 if test "$mesa_driver" = dri; then
1066 EXPAT_INCLUDES=""
1067 EXPAT_LIB=-lexpat
1068 AC_ARG_WITH([expat],
1069 [AS_HELP_STRING([--with-expat=DIR],
1070 [expat install directory])],[
1071 EXPAT_INCLUDES="-I$withval/include"
1072 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
1073 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
1074 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
1075 ])
1076 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
1077 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
1078 [AC_MSG_ERROR([Expat required for DRI.])])
1079 fi
Dan Nicholson44d99142007-12-05 18:47:01 -08001080
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +11001081 # put all the necessary libs together, including possibly libdricore
1082 DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -08001083fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001084AC_SUBST([DRI_DIRS])
1085AC_SUBST([EXPAT_INCLUDES])
1086AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -08001087
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001088case $DRI_DIRS in
1089*i915*|*i965*)
Tormod Volden903185b2011-01-25 13:25:18 -08001090 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001091 ;;
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -05001092esac
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001093
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -05001094case $DRI_DIRS in
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001095*radeon*|*r200*|*r300*|*r600*)
Marek Olšáka1aec2e2010-09-26 17:52:58 +02001096 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001097 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
1098 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
1099 fi
1100 ;;
1101esac
1102AC_SUBST([RADEON_CFLAGS])
1103AC_SUBST([RADEON_LDFLAGS])
1104
1105
Dan Nicholson44d99142007-12-05 18:47:01 -08001106dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -07001107dnl OSMesa configuration
1108dnl
Dan Nicholsona1307182007-12-12 17:49:49 -08001109if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -08001110 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -08001111else
Dan Nicholson544ab202007-12-30 08:41:53 -08001112 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -08001113fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001114AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -08001115 [AS_HELP_STRING([--enable-gl-osmesa],
Dan Nicholsoncbf30fc2010-06-16 09:23:17 -07001116 [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001117 [gl_osmesa="$enableval"],
1118 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -08001119if test "x$gl_osmesa" = xyes; then
Chia-I Wube5f34a2010-10-27 16:14:27 +08001120 if test "x$enable_opengl" = xno; then
1121 AC_MSG_ERROR([OpenGL is not available for OSMesa driver])
1122 fi
Dan Nicholson544ab202007-12-30 08:41:53 -08001123 if test "$mesa_driver" = osmesa; then
1124 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -08001125 else
Dan Nicholson544ab202007-12-30 08:41:53 -08001126 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -08001127 fi
1128fi
1129
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001130dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -07001131AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001132 [AS_HELP_STRING([--with-osmesa-bits=BITS],
1133 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001134 [osmesa_bits="$withval"],
1135 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001136if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
1137 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
1138 osmesa_bits=8
1139fi
1140case "x$osmesa_bits" in
1141x8)
1142 OSMESA_LIB=OSMesa
1143 ;;
1144x16|x32)
1145 OSMESA_LIB="OSMesa$osmesa_bits"
1146 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
1147 ;;
1148*)
1149 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
1150 ;;
1151esac
Dan Nicholson297e16c2008-05-05 15:42:53 -07001152AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001153
Dan Nicholsoncbf30fc2010-06-16 09:23:17 -07001154case "$DRIVER_DIRS" in
1155*osmesa*)
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001156 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -08001157 if test "$enable_static" = no; then
Kenneth Graunked1d812052011-01-16 16:01:54 -08001158 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -08001159 else
1160 OSMESA_LIB_DEPS=""
1161 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001162 OSMESA_MESA_DEPS=""
Kenneth Graunked1d812052011-01-16 16:01:54 -08001163 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -08001164 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -08001165esac
Dan Nicholson297e16c2008-05-05 15:42:53 -07001166AC_SUBST([OSMESA_LIB_DEPS])
1167AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholson8be02fc2008-12-14 09:35:29 -08001168AC_SUBST([OSMESA_PC_REQ])
1169AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001170
1171dnl
Dan Nicholson53b37342009-02-25 17:45:34 -08001172dnl EGL configuration
1173dnl
Dan Nicholson66f97862009-04-29 12:11:43 -07001174AC_ARG_ENABLE([egl],
1175 [AS_HELP_STRING([--disable-egl],
1176 [disable EGL library @<:@default=enabled@:>@])],
1177 [enable_egl="$enableval"],
1178 [enable_egl=yes])
Chia-I Wube5f34a2010-10-27 16:14:27 +08001179if test "x$enable_egl" = xno; then
1180 if test "x$mesa_driver" = xno; then
1181 AC_MSG_ERROR([cannot disable EGL when there is no mesa driver])
1182 fi
1183 if test "x$enable_openvg" = xyes; then
1184 AC_MSG_ERROR([cannot enable OpenVG without EGL])
1185 fi
1186fi
Dan Nicholson66f97862009-04-29 12:11:43 -07001187if test "x$enable_egl" = xyes; then
1188 SRC_DIRS="$SRC_DIRS egl"
Chia-I Wud4c1ee02009-12-21 11:13:18 +08001189 EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
1190 EGL_DRIVERS_DIRS=""
Chia-I Wu2eb7a2f2010-02-05 10:46:11 +08001191 if test "$enable_static" != yes; then
Chia-I Wud4c1ee02009-12-21 11:13:18 +08001192 # build egl_glx when libGL is built
Chia-I Wube5f34a2010-10-27 16:14:27 +08001193 if test "$mesa_driver" = xlib -o "$mesa_driver" = dri; then
Chia-I Wu2eb7a2f2010-02-05 10:46:11 +08001194 EGL_DRIVERS_DIRS="glx"
1195 fi
1196
Chia-I Wu39ae9652010-07-16 19:48:52 +08001197 if test "$mesa_driver" = dri; then
1198 # build egl_dri2 when xcb-dri2 is available
1199 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
1200 [have_xcb_dri2=yes],[have_xcb_dri2=no])
1201 PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
1202 [have_libudev=yes],[have_libudev=no])
1203
1204 if test "$have_xcb_dri2" = yes; then
1205 EGL_DRIVER_DRI2=dri2
1206 DEFINES="$DEFINES -DHAVE_XCB_DRI2"
1207 if test "$have_libudev" = yes; then
1208 DEFINES="$DEFINES -DHAVE_LIBUDEV"
1209 fi
Benjamin Franzke4ca075a2011-03-02 21:23:04 +01001210 # workaround a bug in xcb-dri2 generated by xcb-proto 1.6
1211 AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [],
1212 [DEFINES="$DEFINES -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN"])
Chia-I Wu39ae9652010-07-16 19:48:52 +08001213 fi
1214 fi
Kristian Høgsberg2168b872010-06-02 22:48:06 -04001215
1216 EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
Kristian Høgsberg42fa0092010-02-03 10:18:28 -05001217 fi
Dan Nicholson53b37342009-02-25 17:45:34 -08001218fi
Dan Nicholson53b37342009-02-25 17:45:34 -08001219AC_SUBST([EGL_LIB_DEPS])
Chia-I Wud4c1ee02009-12-21 11:13:18 +08001220AC_SUBST([EGL_DRIVERS_DIRS])
Dan Nicholson53b37342009-02-25 17:45:34 -08001221
1222dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -07001223dnl GLU configuration
1224dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -07001225AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001226 [AS_HELP_STRING([--disable-glu],
1227 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001228 [enable_glu="$enableval"],
1229 [enable_glu=yes])
Chia-I Wube5f34a2010-10-27 16:14:27 +08001230
1231if test "x$enable_glu" = xyes -a "x$mesa_driver" = xno; then
1232 AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver])
1233 enable_glu=no
1234fi
1235
Dan Nicholsondca1b792007-10-23 09:25:58 -07001236if test "x$enable_glu" = xyes; then
1237 SRC_DIRS="$SRC_DIRS glu"
1238
Dan Nicholson979ff512007-12-05 18:47:01 -08001239 case "$mesa_driver" in
1240 osmesa)
Dan Nicholson979ff512007-12-05 18:47:01 -08001241 # Link libGLU to libOSMesa instead of libGL
1242 GLU_LIB_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -08001243 GLU_PC_REQ="osmesa"
Dan Nicholson88586332007-11-15 08:59:57 -08001244 if test "$enable_static" = no; then
1245 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
1246 else
1247 GLU_MESA_DEPS=""
1248 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001249 ;;
1250 *)
Dan Nicholson88586332007-11-15 08:59:57 -08001251 # If static, empty GLU_LIB_DEPS and add libs for programs to link
Dan Nicholson71e208b2008-11-24 11:01:57 -08001252 GLU_PC_REQ="gl"
1253 GLU_PC_LIB_PRIV="-lm"
Dan Nicholson88586332007-11-15 08:59:57 -08001254 if test "$enable_static" = no; then
1255 GLU_LIB_DEPS="-lm"
1256 GLU_MESA_DEPS='-l$(GL_LIB)'
1257 else
1258 GLU_LIB_DEPS=""
1259 GLU_MESA_DEPS=""
1260 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
1261 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001262 ;;
1263 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001264fi
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001265if test "$enable_static" = no; then
1266 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
1267fi
Dan Nicholson71e208b2008-11-24 11:01:57 -08001268GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
Dan Nicholson297e16c2008-05-05 15:42:53 -07001269AC_SUBST([GLU_LIB_DEPS])
1270AC_SUBST([GLU_MESA_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001271AC_SUBST([GLU_PC_REQ])
1272AC_SUBST([GLU_PC_REQ_PRIV])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001273AC_SUBST([GLU_PC_LIB_PRIV])
1274AC_SUBST([GLU_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001275
1276dnl
1277dnl GLw configuration
1278dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -07001279AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001280 [AS_HELP_STRING([--disable-glw],
1281 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001282 [enable_glw="$enableval"],
1283 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -08001284dnl Don't build GLw on osmesa
Chia-I Wube5f34a2010-10-27 16:14:27 +08001285if test "x$enable_glw" = xyes; then
1286 case "$mesa_driver" in
1287 osmesa|no)
1288 AC_MSG_NOTICE([Disabling GLw since there is no OpenGL driver])
1289 enable_glw=no
1290 ;;
1291 esac
Dan Nicholson979ff512007-12-05 18:47:01 -08001292fi
Dan Nicholson776c60d2008-07-18 07:40:41 -07001293AC_ARG_ENABLE([motif],
1294 [AS_HELP_STRING([--enable-motif],
1295 [use Motif widgets in GLw @<:@default=disabled@:>@])],
1296 [enable_motif="$enableval"],
1297 [enable_motif=no])
1298
Dan Nicholsondca1b792007-10-23 09:25:58 -07001299if test "x$enable_glw" = xyes; then
1300 SRC_DIRS="$SRC_DIRS glw"
1301 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001302 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001303 GLW_PC_REQ_PRIV="x11 xt"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001304 GLW_LIB_DEPS="$GLW_LIBS"
1305 else
1306 # should check these...
Dan Nicholson776c60d2008-07-18 07:40:41 -07001307 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001308 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1309 GLW_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001310 fi
1311
1312 GLW_SOURCES="GLwDrawA.c"
1313 MOTIF_CFLAGS=
1314 if test "x$enable_motif" = xyes; then
1315 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1316 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1317 if test "x$MOTIF_CONFIG" != xno; then
1318 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1319 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1320 else
1321 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1322 [AC_MSG_ERROR([Can't locate Motif headers])])
1323 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1324 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1325 fi
1326 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1327 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001328 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1329 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001330 fi
1331
Dan Nicholson88586332007-11-15 08:59:57 -08001332 # If static, empty GLW_LIB_DEPS and add libs for programs to link
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001333 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
Dan Nicholson88586332007-11-15 08:59:57 -08001334 if test "$enable_static" = no; then
1335 GLW_MESA_DEPS='-l$(GL_LIB)'
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001336 GLW_LIB_DEPS="$GLW_LIB_DEPS"
Dan Nicholson88586332007-11-15 08:59:57 -08001337 else
1338 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1339 GLW_LIB_DEPS=""
1340 GLW_MESA_DEPS=""
1341 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001342fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001343AC_SUBST([GLW_LIB_DEPS])
1344AC_SUBST([GLW_MESA_DEPS])
Dan Nicholson776c60d2008-07-18 07:40:41 -07001345AC_SUBST([GLW_SOURCES])
1346AC_SUBST([MOTIF_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001347AC_SUBST([GLW_PC_REQ_PRIV])
1348AC_SUBST([GLW_PC_LIB_PRIV])
1349AC_SUBST([GLW_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001350
1351dnl
1352dnl GLUT configuration
1353dnl
1354if test -f "$srcdir/include/GL/glut.h"; then
1355 default_glut=yes
1356else
1357 default_glut=no
1358fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001359AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001360 [AS_HELP_STRING([--disable-glut],
1361 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001362 [enable_glut="$enableval"],
1363 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001364
Chia-I Wube5f34a2010-10-27 16:14:27 +08001365dnl Don't build glut on osmesa
1366if test "x$enable_glut" = xyes; then
1367 case "$mesa_driver" in
1368 osmesa|no)
1369 AC_MSG_NOTICE([Disabling glut since there is no OpenGL driver])
1370 enable_glut=no
1371 ;;
1372 esac
1373fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001374dnl Can't build glut if GLU not available
1375if test "x$enable_glu$enable_glut" = xnoyes; then
1376 AC_MSG_WARN([Disabling glut since GLU is disabled])
1377 enable_glut=no
1378fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001379
Dan Nicholsondca1b792007-10-23 09:25:58 -07001380if test "x$enable_glut" = xyes; then
1381 SRC_DIRS="$SRC_DIRS glut/glx"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001382 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001383 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001384 GLUT_PC_REQ_PRIV="x11 xmu xi"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001385 GLUT_LIB_DEPS="$GLUT_LIBS"
1386 else
1387 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -08001388 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001389 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1390 GLUT_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001391 fi
John Hein96172542010-07-01 12:53:28 -07001392 if test "x$GCC" = xyes; then
1393 GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
1394 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001395 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1396 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001397
Dan Nicholson88586332007-11-15 08:59:57 -08001398 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1399 if test "$enable_static" = no; then
1400 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1401 else
1402 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1403 GLUT_LIB_DEPS=""
1404 GLUT_MESA_DEPS=""
1405 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001406fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001407AC_SUBST([GLUT_LIB_DEPS])
1408AC_SUBST([GLUT_MESA_DEPS])
1409AC_SUBST([GLUT_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001410AC_SUBST([GLUT_PC_REQ_PRIV])
1411AC_SUBST([GLUT_PC_LIB_PRIV])
1412AC_SUBST([GLUT_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001413
1414dnl
1415dnl Program library dependencies
1416dnl Only libm is added here if necessary as the libraries should
1417dnl be pulled in by the linker
1418dnl
1419if test "x$APP_LIB_DEPS" = x; then
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001420 case "$host_os" in
1421 solaris*)
1422 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1423 ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +01001424 cygwin*)
1425 APP_LIB_DEPS="-lX11"
1426 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001427 *)
1428 APP_LIB_DEPS="-lm"
1429 ;;
1430 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001431fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001432AC_SUBST([APP_LIB_DEPS])
1433AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001434
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001435dnl
1436dnl Gallium configuration
1437dnl
1438AC_ARG_ENABLE([gallium],
1439 [AS_HELP_STRING([--disable-gallium],
1440 [build gallium @<:@default=enabled@:>@])],
1441 [enable_gallium="$enableval"],
1442 [enable_gallium=yes])
Chia-I Wube5f34a2010-10-27 16:14:27 +08001443if test "x$enable_gallium" = xno -a "x$enable_openvg" = xyes; then
1444 AC_MSG_ERROR([cannot enable OpenVG without Gallium])
1445fi
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001446if test "x$enable_gallium" = xyes; then
Jakob Bornecrantzbe38b322010-03-23 13:23:26 +00001447 SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
Dave Airlie81fe1982010-04-22 14:59:29 +10001448 AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001449fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001450
Dave Airlie81fe1982010-04-22 14:59:29 +10001451AC_SUBST([LLVM_CFLAGS])
1452AC_SUBST([LLVM_LIBS])
1453AC_SUBST([LLVM_LDFLAGS])
1454AC_SUBST([LLVM_VERSION])
1455
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001456dnl
1457dnl Gallium state trackers configuration
1458dnl
Chia-I Wudbacbb82010-11-02 02:00:36 +08001459
1460AC_ARG_ENABLE([gallium-egl],
1461 [AS_HELP_STRING([--enable-gallium-egl],
1462 [enable gallium EGL state tracker @<:@default=auto@:>@])],
1463 [enable_gallium_egl="$enableval"],
1464 [enable_gallium_egl=auto])
1465if test "x$enable_gallium_egl" = xauto; then
1466 case "$mesa_driver" in
1467 dri|no)
1468 enable_gallium_egl=$enable_egl
1469 ;;
1470 *)
Chia-I Wuada9c782011-01-04 01:05:22 +08001471 enable_gallium_egl=$enable_openvg
Chia-I Wudbacbb82010-11-02 02:00:36 +08001472 ;;
1473 esac
1474fi
1475case "x$enable_egl$enable_gallium_egl" in
1476xnoyes)
1477 AC_MSG_ERROR([cannot build Gallium EGL state tracker without EGL])
1478esac
1479
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001480AC_ARG_WITH([state-trackers],
1481 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1482 [comma delimited state_trackers list, e.g.
1483 "egl,glx" @<:@default=auto@:>@])],
1484 [with_state_trackers="$withval"],
1485 [with_state_trackers=yes])
1486
1487case "$with_state_trackers" in
1488no)
1489 GALLIUM_STATE_TRACKERS_DIRS=""
1490 ;;
1491yes)
1492 # look at what else is built
1493 case "$mesa_driver" in
Jakob Bornecrantz373e6712009-04-18 23:13:56 +01001494 xlib)
1495 GALLIUM_STATE_TRACKERS_DIRS=glx
1496 ;;
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001497 dri)
Jakob Bornecrantz5b1fc142010-03-25 18:29:51 +01001498 GALLIUM_STATE_TRACKERS_DIRS="dri"
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001499 HAVE_ST_DRI="yes"
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001500 # Have only tested st/xorg on 1.6.0 servers
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001501 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001502 HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1503 HAVE_ST_XORG="no")
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001504 ;;
1505 esac
Chia-I Wube5f34a2010-10-27 16:14:27 +08001506
1507 if test "x$enable_egl" = xyes; then
1508 if test "$enable_openvg" = yes; then
1509 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vega"
1510 st_egl="yes"
1511 fi
1512
Chia-I Wudbacbb82010-11-02 02:00:36 +08001513 if test "$enable_gallium_egl" = yes; then
Chia-I Wube5f34a2010-10-27 16:14:27 +08001514 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
1515 HAVE_ST_EGL="yes"
1516 fi
1517 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001518 ;;
1519*)
1520 # verify the requested state tracker exist
Chia-I Wu63ab2502010-05-05 15:38:02 +08001521 state_trackers=""
1522 _state_trackers=`IFS=', '; echo $with_state_trackers`
1523 for tracker in $_state_trackers; do
Chia-I Wue5d351d2009-12-23 11:18:00 +08001524 case "$tracker" in
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001525 dri)
1526 if test "x$mesa_driver" != xdri; then
1527 AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
1528 fi
1529 HAVE_ST_DRI="yes"
1530 ;;
Chia-I Wu3c967a92010-01-22 16:31:43 +08001531 egl)
Chia-I Wue5d351d2009-12-23 11:18:00 +08001532 if test "x$enable_egl" != xyes; then
Chia-I Wu3c967a92010-01-22 16:31:43 +08001533 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
Chia-I Wue5d351d2009-12-23 11:18:00 +08001534 fi
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001535 HAVE_ST_EGL="yes"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001536 ;;
1537 xorg)
Jakob Bornecrantz4f956882010-07-13 07:40:47 -07001538 PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001539 PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1540 PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001541 HAVE_ST_XORG="yes"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001542 ;;
Chia-I Wu156e9552010-10-30 14:26:01 +08001543 vega)
1544 if test "x$enable_openvg" != xyes; then
1545 AC_MSG_ERROR([cannot build vega state tracker without --enable-openvg])
1546 fi
Chia-I Wuc116a0e2011-01-20 14:19:13 +08001547 have_st_vega="yes"
Chia-I Wu156e9552010-10-30 14:26:01 +08001548 ;;
Chia-I Wue5d351d2009-12-23 11:18:00 +08001549 esac
Chia-I Wu63ab2502010-05-05 15:38:02 +08001550
1551 if test -n "$tracker"; then
1552 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1553 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
1554 if test -n "$state_trackers"; then
1555 state_trackers="$state_trackers $tracker"
1556 else
1557 state_trackers="$tracker"
1558 fi
1559 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001560 done
1561 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
Chia-I Wuc116a0e2011-01-20 14:19:13 +08001562
1563 # append --enable-openvg/--enable-gallium-egl to --with-state-trackers
1564 if test "x$have_st_vega" != xyes -a "x$enable_openvg" = xyes; then
1565 AC_MSG_ERROR([--with-state-trackers specified but vega is missing])
1566 fi
1567 if test "x$HAVE_ST_EGL" != xyes -a "x$enable_gallium_egl" = xyes; then
1568 AC_MSG_ERROR([--with-state-trackers specified but egl is missing])
1569 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001570 ;;
1571esac
1572
Chia-I Wube5f34a2010-10-27 16:14:27 +08001573
1574EGL_CLIENT_APIS=""
1575VG_LIB_DEPS=""
1576
1577case "x$enable_opengl$enable_gles1$enable_gles2" in
1578x*yes*)
1579 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
1580 ;;
1581esac
Chia-I Wube5f34a2010-10-27 16:14:27 +08001582if test "x$enable_openvg" = xyes; then
1583 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
1584 VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
1585fi
1586
Chia-I Wu874ccd52010-05-04 22:43:05 +08001587AC_SUBST([VG_LIB_DEPS])
Chia-I Wu63ab2502010-05-05 15:38:02 +08001588AC_SUBST([EGL_CLIENT_APIS])
1589
1590if test "x$HAVE_ST_EGL" = xyes; then
Chia-I Wud8e0e112010-06-29 14:04:27 +08001591 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
Chia-I Wu63ab2502010-05-05 15:38:02 +08001592fi
Chia-I Wu874ccd52010-05-04 22:43:05 +08001593
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001594if test "x$HAVE_ST_XORG" = xyes; then
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001595 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1596 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1597 HAVE_XEXTPROTO_71="no")
1598fi
1599
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001600AC_ARG_WITH([egl-platforms],
1601 [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1602 [comma delimited native platforms libEGL supports, e.g.
Chia-I Wue7424d72010-09-19 16:54:39 +08001603 "x11,drm" @<:@default=auto@:>@])],
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001604 [with_egl_platforms="$withval"],
1605 [with_egl_platforms=yes])
Chia-I Wu49381d62010-01-11 01:23:01 +08001606AC_ARG_WITH([egl-displays],
1607 [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001608 [DEPRECATED. Use --with-egl-platforms instead])],
1609 [with_egl_platforms="$withval"])
Chia-I Wu49381d62010-01-11 01:23:01 +08001610
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001611EGL_PLATFORMS=""
Benjamin Franzke214fc6e2011-02-04 12:24:08 +01001612WAYLAND_EGL_LIB_DEPS=""
1613
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001614case "$with_egl_platforms" in
Chia-I Wu49381d62010-01-11 01:23:01 +08001615yes)
1616 if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001617 EGL_PLATFORMS="x11"
Chia-I Wu2a910b32010-09-19 17:31:34 +08001618 if test "$mesa_driver" = dri; then
1619 EGL_PLATFORMS="$EGL_PLATFORMS drm"
1620 fi
Chia-I Wu49381d62010-01-11 01:23:01 +08001621 fi
1622 ;;
1623*)
1624 if test "x$enable_egl" != xyes; then
1625 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1626 fi
1627 # verify the requested driver directories exist
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001628 egl_platforms=`IFS=', '; echo $with_egl_platforms`
1629 for plat in $egl_platforms; do
1630 test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
Kristian Høgsberg1a8899d2011-02-10 10:45:06 -05001631 AC_MSG_ERROR([EGL platform '$plat' doesn't exist])
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001632 if test "$plat" = "fbdev"; then
Chia-I Wu8f3e48e2010-06-17 14:10:53 +08001633 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
1634 fi
Benjamin Franzkee586c4b2011-02-04 12:22:58 +01001635 if test "$plat" = "wayland"; then
Benjamin Franzke6b369c42011-02-21 16:22:34 +01001636 PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server],, \
Benjamin Franzkee586c4b2011-02-04 12:22:58 +01001637 [AC_MSG_ERROR([cannot find libwayland-client])])
Benjamin Franzke214fc6e2011-02-04 12:24:08 +01001638 WAYLAND_EGL_LIB_DEPS="$WAYLAND_LIBS $LIBDRM_LIBS"
Benjamin Franzkee586c4b2011-02-04 12:22:58 +01001639 fi
Chia-I Wu49381d62010-01-11 01:23:01 +08001640 done
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001641 EGL_PLATFORMS="$egl_platforms"
Chia-I Wu49381d62010-01-11 01:23:01 +08001642 ;;
1643esac
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001644AC_SUBST([EGL_PLATFORMS])
Chia-I Wu49381d62010-01-11 01:23:01 +08001645
Benjamin Franzke214fc6e2011-02-04 12:24:08 +01001646AC_SUBST([WAYLAND_EGL_LIB_DEPS])
1647WAYLAND_EGL_PC_REQ_PRIV="wayland-client libdrm"
1648WAYLAND_EGL_PC_LIB_PRIV=
1649WAYLAND_EGL_PC_CFLAGS=
1650
1651AC_SUBST([WAYLAND_EGL_PC_REQ_PRIV])
1652AC_SUBST([WAYLAND_EGL_PC_LIB_PRIV])
1653AC_SUBST([WAYLAND_EGL_PC_CFLAGS])
1654
1655
Chia-I Wu28c3e572010-01-23 20:18:43 +08001656AC_ARG_WITH([egl-driver-dir],
1657 [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1658 [directory for EGL drivers [[default=${libdir}/egl]]])],
1659 [EGL_DRIVER_INSTALL_DIR="$withval"],
1660 [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1661AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1662
Joel Bosveld8acca482009-03-06 08:46:08 +09001663AC_ARG_WITH([xorg-driver-dir],
1664 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1665 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1666 [XORG_DRIVER_INSTALL_DIR="$withval"],
1667 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1668AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1669
Tom Fogal7085dce2009-08-13 19:40:30 -06001670AC_ARG_WITH([max-width],
1671 [AS_HELP_STRING([--with-max-width=N],
1672 [Maximum framebuffer width (4096)])],
1673 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1674 AS_IF([test "${withval}" -gt "4096"],
1675 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1676)
1677AC_ARG_WITH([max-height],
1678 [AS_HELP_STRING([--with-max-height=N],
1679 [Maximum framebuffer height (4096)])],
1680 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1681 AS_IF([test "${withval}" -gt "4096"],
1682 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1683)
1684
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001685dnl
Dave Airlie81fe1982010-04-22 14:59:29 +10001686dnl Gallium LLVM
1687dnl
1688AC_ARG_ENABLE([gallium-llvm],
1689 [AS_HELP_STRING([--enable-gallium-llvm],
1690 [build gallium LLVM support @<:@default=disabled@:>@])],
1691 [enable_gallium_llvm="$enableval"],
1692 [enable_gallium_llvm=auto])
1693if test "x$enable_gallium_llvm" = xyes; then
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001694 if test "x$LLVM_CONFIG" != xno; then
1695 LLVM_VERSION=`$LLVM_CONFIG --version`
Brian Paul7da704e2010-12-08 06:44:42 -07001696 LLVM_CFLAGS=`$LLVM_CONFIG --cppflags`
José Fonseca202c3452011-03-14 19:58:22 +00001697 LLVM_LIBS="`$LLVM_CONFIG --libs` -lstdc++"
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001698
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001699 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1700 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
Chia-I Wu3ecb8c22010-05-11 12:36:49 +08001701 DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001702 MESA_LLVM=1
1703 else
Dave Airlie81fe1982010-04-22 14:59:29 +10001704 MESA_LLVM=0
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001705 fi
1706else
1707 MESA_LLVM=0
Dave Airlie81fe1982010-04-22 14:59:29 +10001708fi
1709
1710dnl
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001711dnl Gallium helper functions
1712dnl
1713gallium_check_st() {
Chia-I Wud8e0e112010-06-29 14:04:27 +08001714 if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001715 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1716 fi
1717 if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
1718 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1719 fi
Chia-I Wud8e0e112010-06-29 14:04:27 +08001720 if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001721 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1722 fi
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001723}
1724
1725
1726dnl
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001727dnl Gallium SVGA configuration
1728dnl
1729AC_ARG_ENABLE([gallium-svga],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001730 [AS_HELP_STRING([--enable-gallium-svga],
1731 [build gallium SVGA @<:@default=disabled@:>@])],
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001732 [enable_gallium_svga="$enableval"],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001733 [enable_gallium_svga=auto])
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001734if test "x$enable_gallium_svga" = xyes; then
Xavier Chantryff0987a2010-03-26 11:02:03 +01001735 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001736 gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001737elif test "x$enable_gallium_svga" = xauto; then
1738 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001739fi
1740
1741dnl
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001742dnl Gallium i915 configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001743dnl
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001744AC_ARG_ENABLE([gallium-i915],
1745 [AS_HELP_STRING([--enable-gallium-i915],
1746 [build gallium i915 @<:@default=disabled@:>@])],
1747 [enable_gallium_i915="$enableval"],
1748 [enable_gallium_i915=auto])
1749if test "x$enable_gallium_i915" = xyes; then
Jakob Bornecrantz44bafca2010-04-17 15:17:33 +01001750 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001751 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001752 gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001753elif test "x$enable_gallium_i915" = xauto; then
Jakob Bornecrantz44bafca2010-04-17 15:17:33 +01001754 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001755 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1756fi
1757
1758dnl
1759dnl Gallium i965 configuration
1760dnl
1761AC_ARG_ENABLE([gallium-i965],
1762 [AS_HELP_STRING([--enable-gallium-i965],
1763 [build gallium i965 @<:@default=disabled@:>@])],
1764 [enable_gallium_i965="$enableval"],
1765 [enable_gallium_i965=auto])
1766if test "x$enable_gallium_i965" = xyes; then
1767 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001768 gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001769elif test "x$enable_gallium_i965" = xauto; then
1770 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001771fi
1772
1773dnl
Marek Olšák85a45dc2010-09-23 21:50:43 +02001774dnl Gallium Radeon r300g configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001775dnl
1776AC_ARG_ENABLE([gallium-radeon],
1777 [AS_HELP_STRING([--enable-gallium-radeon],
1778 [build gallium radeon @<:@default=disabled@:>@])],
1779 [enable_gallium_radeon="$enableval"],
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001780 [enable_gallium_radeon=auto])
Marek Olšák11eb4222010-09-28 19:32:32 +02001781if test "x$enable_gallium_radeon" = xauto; then
Marek Olšák7da51052011-02-11 01:16:06 +01001782 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1783 gallium_check_st "radeon/drm" "dri-r300"
Marek Olšák11eb4222010-09-28 19:32:32 +02001784fi
1785if test "x$enable_gallium_radeon" = xyes; then
Marek Olšák7da51052011-02-11 01:16:06 +01001786 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1787 gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001788fi
1789
1790dnl
Jakob Bornecrantzaeee5262010-05-13 20:29:18 +01001791dnl Gallium Radeon r600g configuration
1792dnl
1793AC_ARG_ENABLE([gallium-r600],
1794 [AS_HELP_STRING([--enable-gallium-r600],
1795 [build gallium radeon @<:@default=disabled@:>@])],
1796 [enable_gallium_r600="$enableval"],
1797 [enable_gallium_r600=auto])
1798if test "x$enable_gallium_r600" = xyes; then
Marek Olšák7da51052011-02-11 01:16:06 +01001799 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1800 gallium_check_st "r600/drm" "dri-r600"
Jakob Bornecrantzaeee5262010-05-13 20:29:18 +01001801fi
1802
1803dnl
Thierry Vignaud1402ea82009-09-14 11:48:51 -06001804dnl Gallium Nouveau configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001805dnl
1806AC_ARG_ENABLE([gallium-nouveau],
1807 [AS_HELP_STRING([--enable-gallium-nouveau],
1808 [build gallium nouveau @<:@default=disabled@:>@])],
1809 [enable_gallium_nouveau="$enableval"],
1810 [enable_gallium_nouveau=no])
1811if test "x$enable_gallium_nouveau" = xyes; then
Christoph Bumiller4c224752010-11-12 15:17:40 +01001812 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001813 gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001814fi
1815
Chia-I Wua1306f42010-01-22 15:51:51 +08001816dnl
1817dnl Gallium swrast configuration
1818dnl
1819AC_ARG_ENABLE([gallium-swrast],
1820 [AS_HELP_STRING([--enable-gallium-swrast],
Jakob Bornecrantzf5ba2cd2010-03-24 10:58:45 +01001821 [build gallium swrast @<:@default=auto@:>@])],
Chia-I Wua1306f42010-01-22 15:51:51 +08001822 [enable_gallium_swrast="$enableval"],
1823 [enable_gallium_swrast=auto])
George Sapountzis7b333292010-03-25 17:01:54 +02001824if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
Jakob Bornecrantz5b1fc142010-03-25 18:29:51 +01001825 if test "x$HAVE_ST_DRI" = xyes; then
George Sapountzis7b333292010-03-25 17:01:54 +02001826 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
Jakob Bornecrantzf5ba2cd2010-03-24 10:58:45 +01001827 fi
Chia-I Wua1306f42010-01-22 15:51:51 +08001828fi
1829
Chia-I Wu99a37ed2010-01-05 17:39:05 +08001830dnl prepend CORE_DIRS to SRC_DIRS
1831SRC_DIRS="$CORE_DIRS $SRC_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001832
Dan Nicholsondca1b792007-10-23 09:25:58 -07001833dnl Restore LDFLAGS and CPPFLAGS
1834LDFLAGS="$_SAVE_LDFLAGS"
1835CPPFLAGS="$_SAVE_CPPFLAGS"
1836
1837dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -08001838AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001839
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001840dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001841AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001842if test -f configs/current || test -L configs/current; then
1843 rm -f configs/current
1844fi
1845ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001846])
1847
1848AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001849
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001850dnl
1851dnl Output some configuration info for the user
1852dnl
1853echo ""
1854echo " prefix: $prefix"
1855echo " exec_prefix: $exec_prefix"
1856echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07001857echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001858
Chia-I Wu815faa42010-10-29 12:34:44 +08001859dnl API info
1860echo ""
1861echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
Chia-I Wu815faa42010-10-29 12:34:44 +08001862echo " OpenVG: $enable_openvg"
1863
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001864dnl Driver info
1865echo ""
1866echo " Driver: $mesa_driver"
Chia-I Wu815faa42010-10-29 12:34:44 +08001867if test "$mesa_driver" != no; then
1868 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1869 echo " OSMesa: lib$OSMESA_LIB"
1870 else
1871 echo " OSMesa: no"
1872 fi
1873 if test "$mesa_driver" = dri; then
1874 # cleanup the drivers var
1875 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1876 if test "x$DRI_DIRS" = x; then
1877 echo " DRI drivers: no"
1878 else
1879 echo " DRI drivers: $dri_dirs"
1880 fi
1881 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
1882 echo " Use XCB: $enable_xcb"
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +11001883 echo " Shared dricore: $enable_dricore"
Chia-I Wu815faa42010-10-29 12:34:44 +08001884 fi
Dan Nicholson544ab202007-12-30 08:41:53 -08001885fi
Chia-I Wu815faa42010-10-29 12:34:44 +08001886echo ""
1887echo " GLU: $enable_glu"
1888echo " GLw: $enable_glw (Motif: $enable_motif)"
1889echo " glut: $enable_glut"
1890
1891dnl EGL
1892echo ""
1893echo " EGL: $enable_egl"
1894if test "$enable_egl" = yes; then
1895 echo " EGL platforms: $EGL_PLATFORMS"
Chia-I Wu12300502010-10-31 21:01:54 +08001896
1897 egl_drivers=""
1898 for d in $EGL_DRIVERS_DIRS; do
Chia-I Wuc98ea262011-01-07 16:30:08 +08001899 egl_drivers="$egl_drivers builtin:egl_$d"
Chia-I Wu12300502010-10-31 21:01:54 +08001900 done
1901
Chia-I Wu815faa42010-10-29 12:34:44 +08001902 if test "$enable_gallium" = yes -a "$HAVE_ST_EGL" = yes; then
Chia-I Wu12300502010-10-31 21:01:54 +08001903 echo " EGL drivers: ${egl_drivers} egl_gallium"
1904 echo " EGL Gallium STs:$EGL_CLIENT_APIS"
Chia-I Wu815faa42010-10-29 12:34:44 +08001905 else
Chia-I Wu12300502010-10-31 21:01:54 +08001906 echo " EGL drivers: $egl_drivers"
Chia-I Wu815faa42010-10-29 12:34:44 +08001907 fi
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001908fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001909
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001910echo ""
Eric Anholt1a8b1272010-05-21 12:17:24 -07001911if test "x$MESA_LLVM" = x1; then
Jakob Bornecrantzfe0fe672010-04-28 13:38:58 +01001912 echo " llvm: yes"
1913 echo " llvm-config: $LLVM_CONFIG"
1914 echo " llvm-version: $LLVM_VERSION"
1915else
1916 echo " llvm: no"
1917fi
1918
1919echo ""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001920if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1921 echo " Gallium: yes"
1922 echo " Gallium dirs: $GALLIUM_DIRS"
Keith Whitwell51bff092010-03-11 14:43:00 +00001923 echo " Target dirs: $GALLIUM_TARGET_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001924 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001925 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001926 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1927else
1928 echo " Gallium: no"
1929fi
1930
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001931dnl Libraries
1932echo ""
1933echo " Shared libs: $enable_shared"
1934echo " Static libs: $enable_static"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001935
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001936dnl Compiler options
1937# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1938cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1939 $SED 's/^ *//;s/ */ /;s/ *$//'`
1940cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1941 $SED 's/^ *//;s/ */ /;s/ *$//'`
1942defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1943echo ""
1944echo " CFLAGS: $cflags"
1945echo " CXXFLAGS: $cxxflags"
1946echo " Macros: $defines"
Kenneth Graunke3acc8262010-10-25 13:52:58 -07001947echo ""
1948echo " PYTHON2: $PYTHON2"
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001949
Dan Nicholsondca1b792007-10-23 09:25:58 -07001950echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07001951echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001952echo ""