blob: b55473ffec98a6b9a08d0081894df62f0de9da48 [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
Dave Airliedc4a3ed2011-05-05 16:23:46 +100024DRI2PROTO_REQUIRED=2.1
25GLPROTO_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
Brian Paulde1df262011-05-18 07:50:21 -060042AC_PATH_PROG([FLEX], [flex])
43test "x$FLEX" = "x" && AC_MSG_ERROR([flex is needed to build Mesa])
44
45AC_PATH_PROG([BISON], [bison])
46test "x$BISON" = "x" && AC_MSG_ERROR([bison is needed to build Mesa])
47
Dan Nicholsonbc302b22009-05-22 09:39:02 -070048dnl Our fallback install-sh is a symlink to minstall. Use the existing
49dnl configuration in that case.
50AC_PROG_INSTALL
51test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
52
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070053dnl We need a POSIX shell for parts of the build. Assume we have one
54dnl in most cases.
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070055case "$host_os" in
56solaris*)
57 # Solaris /bin/sh is too old/non-POSIX compliant
58 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070059 SHELL="$POSIX_SHELL"
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070060 ;;
61esac
62
nobled2a501872010-08-29 20:03:37 -040063dnl clang is mostly GCC-compatible, but its version is much lower,
64dnl so we have to check for it.
65AC_MSG_CHECKING([if compiling with clang])
66
67AC_COMPILE_IFELSE(
68[AC_LANG_PROGRAM([], [[
69#ifndef __clang__
70 not clang
71#endif
72]])],
73[CLANG=yes], [CLANG=no])
74
75AC_MSG_RESULT([$CLANG])
76
Ian Romanick9aa3aa72010-03-03 15:59:37 -080077dnl If we're using GCC, make sure that it is at least version 3.3.0. Older
78dnl versions are explictly not supported.
nobled2a501872010-08-29 20:03:37 -040079if test "x$GCC" = xyes -a "x$CLANG" = xno; then
Ian Romanick9aa3aa72010-03-03 15:59:37 -080080 AC_MSG_CHECKING([whether gcc version is sufficient])
81 major=0
82 minor=0
83
84 GCC_VERSION=`$CC -dumpversion`
85 if test $? -eq 0; then
86 major=`echo $GCC_VERSION | cut -d. -f1`
87 minor=`echo $GCC_VERSION | cut -d. -f1`
88 fi
89
90 if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
91 AC_MSG_RESULT([no])
92 AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
93 else
94 AC_MSG_RESULT([yes])
95 fi
96fi
97
98
Dan Nicholsondb7fc632008-03-07 11:48:09 -080099MKDEP_OPTIONS=-fdepend
Kristian Høgsbergbcecea62008-02-25 18:50:26 -0500100dnl Ask gcc where it's keeping its secret headers
101if test "x$GCC" = xyes; then
Dan Nicholsona3d223f2009-01-30 10:52:09 -0800102 for dir in include include-fixed; do
103 GCC_INCLUDES=`$CC -print-file-name=$dir`
104 if test "x$GCC_INCLUDES" != x && \
105 test "$GCC_INCLUDES" != "$dir" && \
106 test -d "$GCC_INCLUDES"; then
107 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
108 fi
109 done
Kristian Høgsbergbcecea62008-02-25 18:50:26 -0500110fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700111AC_SUBST([MKDEP_OPTIONS])
Kristian Høgsbergbcecea62008-02-25 18:50:26 -0500112
Dan Nicholson41b00702007-12-12 08:48:30 -0800113dnl Make sure the pkg-config macros are defined
Dan Nicholson356f3112009-04-29 06:49:27 -0700114m4_ifndef([PKG_PROG_PKG_CONFIG],
115 [m4_fatal([Could not locate the pkg-config autoconf macros.
116 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
117 are in a different location, try setting the environment variable
118 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700119PKG_PROG_PKG_CONFIG()
120
121dnl LIB_DIR - library basename
122LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
Dan Nicholson297e16c2008-05-05 15:42:53 -0700123AC_SUBST([LIB_DIR])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700124
125dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
126_SAVE_LDFLAGS="$LDFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700127AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
128AC_SUBST([EXTRA_LIB_PATH])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700129
130dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
131_SAVE_CPPFLAGS="$CPPFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700132AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
133AC_SUBST([X11_INCLUDES])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700134
135dnl Compiler macros
136DEFINES=""
Dan Nicholson297e16c2008-05-05 15:42:53 -0700137AC_SUBST([DEFINES])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700138case "$host_os" in
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700139linux*|*-gnu*|gnu*)
Dan Nicholson29f603a2009-01-12 11:10:31 -0800140 DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700141 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700142solaris*)
143 DEFINES="$DEFINES -DPTHREADS -DSVR4"
144 ;;
Brian Paul97988902010-02-18 12:46:12 -0700145cygwin*)
146 DEFINES="$DEFINES -DPTHREADS"
147 ;;
Dan Nicholsondca1b792007-10-23 09:25:58 -0700148esac
149
150dnl Add flags for gcc and g++
151if test "x$GCC" = xyes; then
Eric Anholta3c2bd42010-08-30 14:19:23 -0700152 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99"
153 if test "x$CLANG" = "xno"; then
154 CFLAGS="$CFLAGS -ffast-math"
155 fi
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800156
157 # Enable -fvisibility=hidden if using a gcc that supports it
158 save_CFLAGS="$CFLAGS"
Alan Coopersmithf8107a42010-01-21 16:42:58 -0800159 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100160 VISIBILITY_CFLAGS="-fvisibility=hidden"
161 CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800162 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100163 [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
164
165 # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
166 CFLAGS=$save_CFLAGS
Dan Nicholson0c275b62008-01-15 22:52:25 -0800167
168 # Work around aliasing bugs - developers should comment this out
169 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700170fi
171if test "x$GXX" = xyes; then
172 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -0800173
Kristian Høgsberg7b34fcc2010-09-08 20:34:07 -0400174 # Enable -fvisibility=hidden if using a gcc that supports it
175 save_CXXFLAGS="$CXXFLAGS"
176 AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100177 VISIBILITY_CXXFLAGS="-fvisibility=hidden"
178 CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
Kristian Høgsberg7b34fcc2010-09-08 20:34:07 -0400179 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100180 [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
181
182 # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
183 CXXFLAGS=$save_CXXFLAGS
Kristian Høgsberg7b34fcc2010-09-08 20:34:07 -0400184
Dan Nicholson0c275b62008-01-15 22:52:25 -0800185 # Work around aliasing bugs - developers should comment this out
186 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700187fi
188
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100189AC_SUBST([VISIBILITY_CFLAGS])
190AC_SUBST([VISIBILITY_CXXFLAGS])
191
Dan Nicholsondca1b792007-10-23 09:25:58 -0700192dnl These should be unnecessary, but let the user set them if they want
Dan Nicholson297e16c2008-05-05 15:42:53 -0700193AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700194 Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700195AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
Dan Nicholsondca1b792007-10-23 09:25:58 -0700196 compiler. Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700197AC_SUBST([OPT_FLAGS])
198AC_SUBST([ARCH_FLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700199
200dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600201dnl Hacks to enable 32 or 64 bit build
202dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700203AC_ARG_ENABLE([32-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600204 [AS_HELP_STRING([--enable-32-bit],
205 [build 32-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700206 [enable_32bit="$enableval"],
207 [enable_32bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600208)
209if test "x$enable_32bit" = xyes; then
210 if test "x$GCC" = xyes; then
211 CFLAGS="$CFLAGS -m32"
Marc Dietrichc705e722009-08-31 08:56:33 -0700212 ARCH_FLAGS="$ARCH_FLAGS -m32"
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600213 fi
214 if test "x$GXX" = xyes; then
215 CXXFLAGS="$CXXFLAGS -m32"
216 fi
217fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700218AC_ARG_ENABLE([64-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600219 [AS_HELP_STRING([--enable-64-bit],
220 [build 64-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700221 [enable_64bit="$enableval"],
222 [enable_64bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600223)
224if test "x$enable_64bit" = xyes; then
225 if test "x$GCC" = xyes; then
226 CFLAGS="$CFLAGS -m64"
227 fi
228 if test "x$GXX" = xyes; then
229 CXXFLAGS="$CXXFLAGS -m64"
230 fi
231fi
232
233dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800234dnl shared/static libraries, mimic libtool options
235dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700236AC_ARG_ENABLE([static],
Dan Nicholson88586332007-11-15 08:59:57 -0800237 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800238 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700239 [enable_static="$enableval"],
240 [enable_static=no]
Dan Nicholson88586332007-11-15 08:59:57 -0800241)
242case "x$enable_static" in
243xyes|xno ) ;;
244x ) enable_static=no ;;
245* )
246 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
247 ;;
248esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700249AC_ARG_ENABLE([shared],
Dan Nicholson88586332007-11-15 08:59:57 -0800250 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800251 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700252 [enable_shared="$enableval"],
253 [enable_shared=yes]
Dan Nicholson88586332007-11-15 08:59:57 -0800254)
255case "x$enable_shared" in
256xyes|xno ) ;;
257x ) enable_shared=yes ;;
258* )
259 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
260 ;;
261esac
262
263dnl Can't have static and shared libraries, default to static if user
264dnl explicitly requested. If both disabled, set to static since shared
265dnl was explicitly requirested.
266case "x$enable_static$enable_shared" in
267xyesyes )
268 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
269 enable_shared=no
270 ;;
271xnono )
272 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
273 enable_static=yes
274 ;;
275esac
276
277dnl
278dnl mklib options
279dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700280AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
Dan Nicholson88586332007-11-15 08:59:57 -0800281if test "$enable_static" = yes; then
282 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
283fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700284AC_SUBST([MKLIB_OPTIONS])
Dan Nicholson88586332007-11-15 08:59:57 -0800285
Dan Nicholson23656c42007-12-12 09:02:31 -0800286dnl
287dnl other compiler options
288dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700289AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800290 [AS_HELP_STRING([--enable-debug],
291 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700292 [enable_debug="$enableval"],
293 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800294)
295if test "x$enable_debug" = xyes; then
296 DEFINES="$DEFINES -DDEBUG"
297 if test "x$GCC" = xyes; then
298 CFLAGS="$CFLAGS -g"
299 fi
300 if test "x$GXX" = xyes; then
301 CXXFLAGS="$CXXFLAGS -g"
302 fi
303fi
Dan Nicholson88586332007-11-15 08:59:57 -0800304
305dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700306dnl library names
307dnl
Jon TURNEYc55a8a72010-07-24 12:05:34 +0100308LIB_PREFIX_GLOB='lib'
309LIB_VERSION_SEPARATOR='.'
Dan Nicholson88586332007-11-15 08:59:57 -0800310if test "$enable_static" = yes; then
Dan Nicholson8217f242009-02-11 15:16:00 -0800311 LIB_EXTENSION='a'
Dan Nicholson88586332007-11-15 08:59:57 -0800312else
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700313 case "$host_os" in
314 darwin* )
315 LIB_EXTENSION='dylib' ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +0100316 cygwin* )
Jon TURNEYc55a8a72010-07-24 12:05:34 +0100317 dnl prefix can be 'cyg' or 'lib'
318 LIB_PREFIX_GLOB='???'
319 LIB_VERSION_SEPARATOR='-'
320 LIB_EXTENSION='dll' ;;
Tom Fogal9282edf2009-10-13 10:55:33 -0700321 aix* )
322 LIB_EXTENSION='a' ;;
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700323 * )
324 LIB_EXTENSION='so' ;;
325 esac
Dan Nicholson88586332007-11-15 08:59:57 -0800326fi
Dan Nicholson8217f242009-02-11 15:16:00 -0800327
Marek Olšák848f7d32011-04-01 01:12:41 +0200328dnl
329dnl potentially-infringing-but-nobody-knows-for-sure stuff
330dnl
331AC_ARG_ENABLE([texture-float],
332 [AS_HELP_STRING([--enable-texture-float],
333 [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
334 [enable_texture_float="$enableval"],
335 [enable_texture_float=no]
336)
337if test "x$enable_texture_float" = xyes; then
338 AC_MSG_WARN([Floating-point textures enabled.])
339 AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
340 DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
341fi
342
Dan Nicholson8217f242009-02-11 15:16:00 -0800343GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
344GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
345GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
346GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
347OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800348EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500349GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
350GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
Chia-I Wu874ccd52010-05-04 22:43:05 +0800351VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800352GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100353WAYLAND_EGL_LIB_NAME='lib$(WAYLAND_EGL_LIB).'${LIB_EXTENSION}
Dan Nicholson8217f242009-02-11 15:16:00 -0800354
Jon TURNEYc55a8a72010-07-24 12:05:34 +0100355GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
356GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
357GLUT_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLUT_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
358GLW_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLW_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
359OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
360EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
361EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
362GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
363GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
364VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800365GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100366WAYLAND_EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(WAYLAND_EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
Dan Nicholson8217f242009-02-11 15:16:00 -0800367
Dan Nicholson297e16c2008-05-05 15:42:53 -0700368AC_SUBST([GL_LIB_NAME])
369AC_SUBST([GLU_LIB_NAME])
370AC_SUBST([GLUT_LIB_NAME])
371AC_SUBST([GLW_LIB_NAME])
372AC_SUBST([OSMESA_LIB_NAME])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800373AC_SUBST([EGL_LIB_NAME])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500374AC_SUBST([GLESv1_CM_LIB_NAME])
375AC_SUBST([GLESv2_LIB_NAME])
Chia-I Wu874ccd52010-05-04 22:43:05 +0800376AC_SUBST([VG_LIB_NAME])
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800377AC_SUBST([GLAPI_LIB_NAME])
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100378AC_SUBST([WAYLAND_EGL_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700379
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700380AC_SUBST([GL_LIB_GLOB])
381AC_SUBST([GLU_LIB_GLOB])
382AC_SUBST([GLUT_LIB_GLOB])
383AC_SUBST([GLW_LIB_GLOB])
384AC_SUBST([OSMESA_LIB_GLOB])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800385AC_SUBST([EGL_LIB_GLOB])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500386AC_SUBST([GLESv1_CM_LIB_GLOB])
387AC_SUBST([GLESv2_LIB_GLOB])
Chia-I Wu874ccd52010-05-04 22:43:05 +0800388AC_SUBST([VG_LIB_GLOB])
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800389AC_SUBST([GLAPI_LIB_GLOB])
Benjamin Franzke214fc6e2011-02-04 12:24:08 +0100390AC_SUBST([WAYLAND_EGL_LIB_GLOB])
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700391
Dan Nicholsondca1b792007-10-23 09:25:58 -0700392dnl
Dan Nicholson871125a2008-06-04 13:00:35 -0700393dnl Arch/platform-specific settings
394dnl
395AC_ARG_ENABLE([asm],
396 [AS_HELP_STRING([--disable-asm],
397 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
398 [enable_asm="$enableval"],
399 [enable_asm=yes]
400)
401asm_arch=""
402ASM_FLAGS=""
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800403MESA_ASM_SOURCES=""
404GLAPI_ASM_SOURCES=""
Dan Nicholson871125a2008-06-04 13:00:35 -0700405AC_MSG_CHECKING([whether to enable assembly])
406test "x$enable_asm" = xno && AC_MSG_RESULT([no])
407# disable if cross compiling on x86/x86_64 since we must run gen_matypes
408if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
409 case "$host_cpu" in
410 i?86 | x86_64)
411 enable_asm=no
412 AC_MSG_RESULT([no, cross compiling])
413 ;;
414 esac
415fi
416# check for supported arches
417if test "x$enable_asm" = xyes; then
418 case "$host_cpu" in
419 i?86)
420 case "$host_os" in
Pierre Allegraud8fd8de32011-01-06 07:58:57 -0700421 linux* | *freebsd* | dragonfly* | *netbsd*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700422 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
423 ;;
424 esac
425 ;;
426 x86_64)
427 case "$host_os" in
Pierre Allegraud8fd8de32011-01-06 07:58:57 -0700428 linux* | *freebsd* | dragonfly* | *netbsd*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700429 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
430 ;;
431 esac
432 ;;
433 powerpc)
434 case "$host_os" in
435 linux*)
436 asm_arch=ppc
437 ;;
438 esac
439 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800440 sparc*)
441 case "$host_os" in
442 linux*)
443 asm_arch=sparc
444 ;;
445 esac
446 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700447 esac
448
449 case "$asm_arch" in
450 x86)
Dan Nicholson61e925f2009-02-11 10:42:34 -0800451 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800452 MESA_ASM_SOURCES='$(X86_SOURCES)'
453 GLAPI_ASM_SOURCES='$(X86_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700454 AC_MSG_RESULT([yes, x86])
455 ;;
456 x86_64)
457 ASM_FLAGS="-DUSE_X86_64_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800458 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
459 GLAPI_ASM_SOURCES='$(X86-64_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700460 AC_MSG_RESULT([yes, x86_64])
461 ;;
462 ppc)
463 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800464 MESA_ASM_SOURCES='$(PPC_SOURCES)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700465 AC_MSG_RESULT([yes, ppc])
466 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800467 sparc)
468 ASM_FLAGS="-DUSE_SPARC_ASM"
469 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
470 GLAPI_ASM_SOURCES='$(SPARC_API)'
471 AC_MSG_RESULT([yes, sparc])
472 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700473 *)
474 AC_MSG_RESULT([no, platform not supported])
475 ;;
476 esac
477fi
478AC_SUBST([ASM_FLAGS])
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800479AC_SUBST([MESA_ASM_SOURCES])
480AC_SUBST([GLAPI_ASM_SOURCES])
Dan Nicholson871125a2008-06-04 13:00:35 -0700481
482dnl PIC code macro
483MESA_PIC_FLAGS
484
485dnl Check to see if dlopen is in default libraries (like Solaris, which
486dnl has it in libc), or if libdl is needed to get it.
487AC_CHECK_FUNC([dlopen], [],
488 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
Chia-I Wu08f4bc02010-07-16 20:09:29 +0800489AC_SUBST([DLOPEN_LIBS])
Dan Nicholson871125a2008-06-04 13:00:35 -0700490
Dan Nicholson985e1cd2008-06-04 13:17:06 -0700491dnl See if posix_memalign is available
492AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
493
Dan Nicholson871125a2008-06-04 13:00:35 -0700494dnl SELinux awareness.
495AC_ARG_ENABLE([selinux],
496 [AS_HELP_STRING([--enable-selinux],
497 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
498 [MESA_SELINUX="$enableval"],
499 [MESA_SELINUX=no])
500if test "x$enable_selinux" = "xyes"; then
501 AC_CHECK_HEADER([selinux/selinux.h],[],
502 [AC_MSG_ERROR([SELinux headers not found])])
503 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
504 [AC_MSG_ERROR([SELinux library not found])])
505 SELINUX_LIBS="-lselinux"
506 DEFINES="$DEFINES -DMESA_SELINUX"
507fi
508
Chia-I Wube5f34a2010-10-27 16:14:27 +0800509dnl Determine which APIs to support
510AC_ARG_ENABLE([opengl],
511 [AS_HELP_STRING([--disable-opengl],
512 [disable support for standard OpenGL API @<:@default=no@:>@])],
513 [enable_opengl="$enableval"],
514 [enable_opengl=yes])
515AC_ARG_ENABLE([gles1],
516 [AS_HELP_STRING([--enable-gles1],
517 [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
518 [enable_gles1="$enableval"],
519 [enable_gles1=no])
520AC_ARG_ENABLE([gles2],
521 [AS_HELP_STRING([--enable-gles2],
522 [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
523 [enable_gles2="$enableval"],
524 [enable_gles2=no])
525AC_ARG_ENABLE([gles-overlay],
526 [AS_HELP_STRING([--enable-gles-overlay],
Chia-I Wu12583172011-01-07 17:24:16 +0800527 [DEPRECATED. Same as --enable-gles1 and --enable-gles2])],
528 [enable_gles1="$enableval"; enable_gles2="$enableval"],
529 [])
Chia-I Wube5f34a2010-10-27 16:14:27 +0800530
531AC_ARG_ENABLE([openvg],
532 [AS_HELP_STRING([--enable-openvg],
533 [enable support for OpenVG API @<:@default=no@:>@])],
534 [enable_openvg="$enableval"],
535 [enable_openvg=no])
536
Chia-I Wu156e9552010-10-30 14:26:01 +0800537dnl smooth the transition; should be removed eventually
538if test "x$enable_openvg" = xno; then
539 case "x$with_state_trackers" in
540 x*vega*)
541 AC_MSG_WARN([vega state tracker is enabled without --enable-openvg])
542 enable_openvg=yes
543 ;;
544 esac
545fi
546
Chia-I Wube5f34a2010-10-27 16:14:27 +0800547if test "x$enable_opengl" = xno -a \
548 "x$enable_gles1" = xno -a \
549 "x$enable_gles2" = xno -a \
Chia-I Wube5f34a2010-10-27 16:14:27 +0800550 "x$enable_openvg" = xno; then
551 AC_MSG_ERROR([at least one API should be enabled])
552fi
553
554API_DEFINES=""
Chia-I Wube5f34a2010-10-27 16:14:27 +0800555if test "x$enable_opengl" = xno; then
556 API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
557else
558 API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
559fi
560if test "x$enable_gles1" = xyes; then
561 API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
562fi
563if test "x$enable_gles2" = xyes; then
564 API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
565fi
Chia-I Wube5f34a2010-10-27 16:14:27 +0800566AC_SUBST([API_DEFINES])
Chia-I Wube5f34a2010-10-27 16:14:27 +0800567
Chia-I Wue8c7d752010-12-26 18:24:13 +0800568AC_ARG_ENABLE([shared-glapi],
569 [AS_HELP_STRING([--enable-shared-glapi],
570 [EXPERIMENTAL. Enable shared glapi for OpenGL @<:@default=no@:>@])],
571 [enable_shared_glapi="$enableval"],
572 [enable_shared_glapi=no])
573
574SHARED_GLAPI="0"
575if test "x$enable_shared_glapi" = xyes; then
576 SHARED_GLAPI="1"
577fi
578AC_SUBST([SHARED_GLAPI])
579
Dan Nicholson871125a2008-06-04 13:00:35 -0700580dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800581dnl Driver configuration. Options are xlib, dri and osmesa right now.
Kristian Høgsberg43875802010-02-25 15:49:18 -0500582dnl More later: fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800583dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700584default_driver="xlib"
585
586case "$host_os" in
587linux*)
588 case "$host_cpu" in
David S. Miller32dc28a2009-02-24 20:06:05 -0700589 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700590 esac
591 ;;
Pierre Allegraud8fd8de32011-01-06 07:58:57 -0700592*freebsd* | dragonfly* | *netbsd*)
Eric Anholt711222b2008-04-18 15:03:01 -0700593 case "$host_cpu" in
Robert Noland48f05432009-04-10 11:41:27 -0500594 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700595 esac
596 ;;
597esac
598
Chia-I Wube5f34a2010-10-27 16:14:27 +0800599if test "x$enable_opengl" = xno; then
600 default_driver="no"
601fi
602
Dan Nicholson297e16c2008-05-05 15:42:53 -0700603AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800604 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700605 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700606 [mesa_driver="$withval"],
607 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800608dnl Check for valid option
609case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800610xxlib|xdri|xosmesa)
Chia-I Wube5f34a2010-10-27 16:14:27 +0800611 if test "x$enable_opengl" = xno; then
612 AC_MSG_ERROR([Driver '$mesa_driver' requires OpenGL enabled])
613 fi
614 ;;
615xno)
Dan Nicholson44d99142007-12-05 18:47:01 -0800616 ;;
617*)
618 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
619 ;;
620esac
621
622dnl
623dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700624dnl
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800625
626dnl this variable will be prepended to SRC_DIRS and is not exported
Chia-I Wube5f34a2010-10-27 16:14:27 +0800627CORE_DIRS=""
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800628
Jakob Bornecrantz05281062010-06-05 13:33:58 +0200629SRC_DIRS=""
Dan Nicholsondca1b792007-10-23 09:25:58 -0700630GLU_DIRS="sgi"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100631GALLIUM_DIRS="auxiliary drivers state_trackers"
Keith Whitwell51bff092010-03-11 14:43:00 +0000632GALLIUM_TARGET_DIRS=""
Jakob Bornecrantzc9f98672010-03-16 13:54:18 +0000633GALLIUM_WINSYS_DIRS="sw"
Jerome Glisse33495172011-01-09 21:04:41 -0500634GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug noop identity"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100635GALLIUM_STATE_TRACKERS_DIRS=""
636
Chia-I Wue8c7d752010-12-26 18:24:13 +0800637# build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled
Jon TURNEYaa6a5cf2011-02-16 13:37:57 +0000638case "x$enable_shared_glapi$enable_gles1$enable_gles2" in
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800639x*yes*)
640 CORE_DIRS="$CORE_DIRS mapi/shared-glapi"
641 ;;
642esac
643
Chia-I Wube5f34a2010-10-27 16:14:27 +0800644# build glapi if OpenGL is enabled
645if test "x$enable_opengl" = xyes; then
646 CORE_DIRS="$CORE_DIRS mapi/glapi"
647fi
648
Chia-I Wu12583172011-01-07 17:24:16 +0800649# build es1api if OpenGL ES 1.x is enabled
650if test "x$enable_gles1" = xyes; then
651 CORE_DIRS="$CORE_DIRS mapi/es1api"
652fi
653
654# build es2api if OpenGL ES 2.x is enabled
655if test "x$enable_gles2" = xyes; then
656 CORE_DIRS="$CORE_DIRS mapi/es2api"
657fi
Chia-I Wube5f34a2010-10-27 16:14:27 +0800658
659# build vgapi if OpenVG is enabled
660if test "x$enable_openvg" = xyes; then
661 CORE_DIRS="$CORE_DIRS mapi/vgapi"
662fi
663
664# build glsl and mesa if OpenGL or OpenGL ES is enabled
Chia-I Wu12583172011-01-07 17:24:16 +0800665case "x$enable_opengl$enable_gles1$enable_gles2" in
Chia-I Wube5f34a2010-10-27 16:14:27 +0800666x*yes*)
667 CORE_DIRS="$CORE_DIRS glsl mesa"
668 ;;
669esac
670
Dan Nicholson44d99142007-12-05 18:47:01 -0800671case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800672xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800673 DRIVER_DIRS="x11"
Jakob Bornecrantzc9f98672010-03-16 13:54:18 +0000674 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
Keith Whitwell51bff092010-03-11 14:43:00 +0000675 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
Dan Nicholson44d99142007-12-05 18:47:01 -0800676 ;;
677dri)
Kristian Høgsberg6e8897f2010-02-09 09:58:36 -0500678 SRC_DIRS="$SRC_DIRS glx"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100679 DRIVER_DIRS="dri"
Jakob Bornecrantz23a915e2010-06-23 03:31:18 +0200680 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri"
Dan Nicholson44d99142007-12-05 18:47:01 -0800681 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800682osmesa)
683 DRIVER_DIRS="osmesa"
684 ;;
Chia-I Wube5f34a2010-10-27 16:14:27 +0800685no)
686 DRIVER_DRIS=""
687 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800688esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700689AC_SUBST([SRC_DIRS])
690AC_SUBST([GLU_DIRS])
691AC_SUBST([DRIVER_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100692AC_SUBST([GALLIUM_DIRS])
Keith Whitwell51bff092010-03-11 14:43:00 +0000693AC_SUBST([GALLIUM_TARGET_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100694AC_SUBST([GALLIUM_WINSYS_DIRS])
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +0000695AC_SUBST([GALLIUM_DRIVERS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100696AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
Dave Airlie81fe1982010-04-22 14:59:29 +1000697AC_SUBST([MESA_LLVM])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700698
699dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700700dnl Find out if X is available. The variable have_x is set if libX11 is
Dan Nicholson99803a42008-07-01 09:03:15 -0700701dnl found to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700702dnl
703if test -n "$PKG_CONFIG"; then
704 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700705 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700706 x11_pkgconfig=yes
707 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700708 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700709 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700710 ])
711 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700712else
713 x11_pkgconfig=no
714fi
715dnl Use the autoconf macro if no pkg-config files
Jeff Smith8d86d392010-03-12 18:55:09 -0600716if test "$x11_pkgconfig" = yes; then
Dan Nicholsone725ef12010-03-15 20:53:56 -0700717 PKG_CHECK_MODULES([X11], [x11])
Jeff Smith8d86d392010-03-12 18:55:09 -0600718else
Dan Nicholsondca1b792007-10-23 09:25:58 -0700719 AC_PATH_XTRA
Dan Nicholsone725ef12010-03-15 20:53:56 -0700720 test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
721 test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
722 AC_SUBST([X11_CFLAGS])
723 AC_SUBST([X11_LIBS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700724fi
725
Dan Nicholson99803a42008-07-01 09:03:15 -0700726dnl Try to tell the user that the --x-* options are only used when
727dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
728m4_divert_once([HELP_BEGIN],
729[These options are only used when the X libraries cannot be found by the
730pkg-config utility.])
731
Dan Nicholson44d99142007-12-05 18:47:01 -0800732dnl We need X for xlib and dri, so bomb now if it's not found
733case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800734xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800735 if test "$no_x" = yes; then
736 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
737 fi
738 ;;
739esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700740
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700741dnl XCB - this is only used for GLX right now
742AC_ARG_ENABLE([xcb],
743 [AS_HELP_STRING([--enable-xcb],
744 [use XCB for GLX @<:@default=disabled@:>@])],
745 [enable_xcb="$enableval"],
746 [enable_xcb=no])
747if test "x$enable_xcb" = xyes; then
748 DEFINES="$DEFINES -DUSE_XCB"
749else
750 enable_xcb=no
751fi
752
Samuel Thibault75856172011-03-14 22:08:21 +0000753dnl Direct rendering or just indirect rendering
noblede7d18ed2011-03-14 22:08:22 +0000754case "$host_os" in
755gnu*)
756 dnl Disable by default on GNU/Hurd
757 driglx_direct_default="no"
758 ;;
Jon TURNEYc6e33ca2011-03-14 22:08:23 +0000759cygwin*)
760 dnl Disable by default on cygwin
761 driglx_direct_default="no"
762 ;;
noblede7d18ed2011-03-14 22:08:22 +0000763*)
764 driglx_direct_default="yes"
765 ;;
766esac
Samuel Thibault75856172011-03-14 22:08:21 +0000767AC_ARG_ENABLE([driglx-direct],
768 [AS_HELP_STRING([--disable-driglx-direct],
769 [enable direct rendering in GLX and EGL for DRI \
noblede7d18ed2011-03-14 22:08:22 +0000770 @<:@default=auto@:>@])],
Samuel Thibault75856172011-03-14 22:08:21 +0000771 [driglx_direct="$enableval"],
noblede7d18ed2011-03-14 22:08:22 +0000772 [driglx_direct="$driglx_direct_default"])
Samuel Thibault75856172011-03-14 22:08:21 +0000773
Dan Nicholson44d99142007-12-05 18:47:01 -0800774dnl
775dnl libGL configuration per driver
776dnl
777case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800778xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800779 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700780 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800781 GL_PC_REQ_PRIV="x11 xext"
Dan Nicholsona1307182007-12-12 17:49:49 -0800782 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
783 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800784 else
785 # should check these...
786 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
787 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800788 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
789 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson44d99142007-12-05 18:47:01 -0800790 fi
Kenneth Graunked1d812052011-01-16 16:01:54 -0800791 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
792 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800793
794 # if static, move the external libraries to the programs
795 # and empty the libraries for libGL
796 if test "$enable_static" = yes; then
797 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
798 GL_LIB_DEPS=""
799 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800800 ;;
Chia-I Wube5f34a2010-10-27 16:14:27 +0800801dri|no) # these checks are still desired when there is no mesa_driver
Dan Nicholson88586332007-11-15 08:59:57 -0800802 # DRI must be shared, I think
803 if test "$enable_static" = yes; then
804 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
805 fi
806
Jesse Barnesf2f83d92010-01-11 17:28:10 -0500807 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
Samuel Thibault75856172011-03-14 22:08:21 +0000808 GL_PC_REQ_PRIV="glproto >= $GLPROTO_REQUIRED"
809 DRI_PC_REQ_PRIV=""
810
811 if test x"$driglx_direct" = xyes; then
812 # Check for libdrm
813 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
814 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
815 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
816 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
817 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800818
819 # find the DRI deps for libGL
820 if test "$x11_pkgconfig" = yes; then
Jon TURNEY2b9dac32010-04-21 12:58:54 +0100821 dri_modules="x11 xext xdamage xfixes"
822
823 # add xf86vidmode if available
824 PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
825 if test "$HAVE_XF86VIDMODE" = yes ; then
826 dri_modules="$dri_modules xxf86vm"
827 fi
828
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700829 # add xcb modules if necessary
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700830 if test "$enable_xcb" = yes; then
831 dri_modules="$dri_modules x11-xcb xcb-glx"
832 fi
833
834 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800835 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Dan Nicholson44d99142007-12-05 18:47:01 -0800836 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
837 GL_LIB_DEPS="$DRIGL_LIBS"
838 else
839 # should check these...
840 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
841 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800842 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
843 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700844
845 # XCB can only be used from pkg-config
846 if test "$enable_xcb" = yes; then
847 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800848 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700849 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
850 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
851 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800852 fi
853
854 # need DRM libs, -lpthread, etc.
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700855 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
856 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500857 GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg74399d42010-05-02 09:51:13 -0400858 GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500859 GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg74399d42010-05-02 09:51:13 -0400860 GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800861 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800862osmesa)
863 # No libGL for osmesa
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700864 GL_LIB_DEPS=""
Dan Nicholson979ff512007-12-05 18:47:01 -0800865 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800866esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700867AC_SUBST([GL_LIB_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800868AC_SUBST([GL_PC_REQ_PRIV])
869AC_SUBST([GL_PC_LIB_PRIV])
870AC_SUBST([GL_PC_CFLAGS])
871AC_SUBST([DRI_PC_REQ_PRIV])
Li Pengc33c1912010-07-30 12:26:15 +0800872AC_SUBST([GLESv1_CM_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -0400873AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500874AC_SUBST([GLESv2_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -0400875AC_SUBST([GLESv2_PC_LIB_PRIV])
876
Chia-I Wu9767d3b2010-12-26 18:02:59 +0800877GLAPI_LIB_DEPS="-lpthread"
878AC_SUBST([GLAPI_LIB_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700879
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100880
881dnl Setup default DRI CFLAGS
882DRI_CFLAGS='$(CFLAGS)'
883DRI_CXXFLAGS='$(CXXFLAGS)'
884DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.a'
885MESA_MODULES='$(TOP)/src/mesa/libmesa.a'
886
887AC_ARG_ENABLE([shared-dricore],
888 [AS_HELP_STRING([--enable-shared-dricore],
889 [link DRI modules with shared core DRI routines @<:@default=disabled@:>@])],
890 [enable_dricore="$enableval"],
891 [enable_dricore=no])
892if test "$mesa_driver" = dri ; then
893 if test "$enable_dricore" = yes ; then
894 if test "$GCC$GXX" != yesyes ; then
895 AC_MSG_WARN([Shared dricore requires GCC-compatible rpath handling. Disabling shared dricore])
896 enable_dricore=no
897 else
898 DRICORE_GLSL_LIBS='$(TOP)/$(LIB_DIR)/libglsl.so'
899 DRICORE_LIBS='$(TOP)/$(LIB_DIR)/libdricore.so'
900 DRICORE_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) -lglsl'
901 DRI_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) -ldricore -lglsl'
902 DRI_CFLAGS='$(CFLAGS_NOVISIBILITY) -DUSE_DRICORE'
903 DRI_CXXFLAGS='$(CXXFLAGS_NOVISIBILITY) -DUSE_DRICORE'
904 MESA_MODULES='$(DRICORE_LIBS) $(DRICORE_GLSL_LIBS)'
905 fi
906 fi
907fi
908AC_SUBST([DRICORE_LIBS])
909AC_SUBST([DRICORE_GLSL_LIBS])
910AC_SUBST([DRICORE_LIB_DEPS])
911AC_SUBST([DRI_CXXFLAGS])
912AC_SUBST([DRI_CFLAGS])
913AC_SUBST([MESA_MODULES])
914
Jon TURNEY2b9dac32010-04-21 12:58:54 +0100915AC_SUBST([HAVE_XF86VIDMODE])
916
Marek Olšáka1aec2e2010-09-26 17:52:58 +0200917PKG_CHECK_MODULES([LIBDRM_RADEON],
Marek Olšákec96b0e2011-02-06 15:42:55 +0100918 [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED],
Marek Olšáka1aec2e2010-09-26 17:52:58 +0200919 HAVE_LIBDRM_RADEON=yes,
920 HAVE_LIBDRM_RADEON=no)
921
Dan Nicholsondca1b792007-10-23 09:25:58 -0700922dnl
923dnl More X11 setup
924dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800925if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700926 DEFINES="$DEFINES -DUSE_XSHM"
927fi
928
929dnl
Tom Fogal31351dc2010-12-05 17:58:32 -0700930dnl TLS detection
Dan Nicholson44d99142007-12-05 18:47:01 -0800931dnl
Tom Fogal31351dc2010-12-05 17:58:32 -0700932
Dan Nicholson297e16c2008-05-05 15:42:53 -0700933AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800934 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800935 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700936 [GLX_USE_TLS="$enableval"],
937 [GLX_USE_TLS=no])
Tom Fogal31351dc2010-12-05 17:58:32 -0700938AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
939
Tom Fogal44842972011-02-21 22:32:18 -0700940AS_IF([test "x$GLX_USE_TLS" = xyes],
941 [DEFINES="${DEFINES} -DGLX_USE_TLS -DPTHREADS"])
942
Tom Fogal31351dc2010-12-05 17:58:32 -0700943dnl
944dnl More DRI setup
945dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800946dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700947AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800948 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700949 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700950 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700951 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700952AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Chow Loong Jin35506de2009-10-28 14:34:14 +0800953dnl Extra search path for DRI drivers
954AC_ARG_WITH([dri-searchpath],
955 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
956 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
957 [DRI_DRIVER_SEARCH_DIR="$withval"],
958 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
959AC_SUBST([DRI_DRIVER_SEARCH_DIR])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800960dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700961AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800962 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholson5cae1b72008-06-30 10:28:02 -0700963 [comma delimited DRI drivers list, e.g.
Michel Dänzercade0712009-07-10 14:49:46 +0200964 "swrast,i965,radeon" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700965 [with_dri_drivers="$withval"],
966 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800967if test "x$with_dri_drivers" = x; then
968 with_dri_drivers=no
969fi
970
971dnl If $with_dri_drivers is yes, directories will be added through
972dnl platform checks
973DRI_DIRS=""
974case "$with_dri_drivers" in
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100975no) ;;
976yes)
977 DRI_DIRS="yes"
978 ;;
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800979*)
980 # verify the requested driver directories exist
Dan Nicholsone6e4f252008-07-06 14:17:39 -0700981 dri_drivers=`IFS=', '; echo $with_dri_drivers`
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800982 for driver in $dri_drivers; do
983 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
984 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
985 done
986 DRI_DIRS="$dri_drivers"
987 ;;
988esac
989
Dan Nicholson44d99142007-12-05 18:47:01 -0800990dnl Set DRI_DIRS, DEFINES and LIB_DEPS
Chia-I Wube5f34a2010-10-27 16:14:27 +0800991if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
Dan Nicholson44d99142007-12-05 18:47:01 -0800992 # Platform specific settings and drivers to build
993 case "$host_os" in
994 linux*)
995 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
Dan Nicholson44d99142007-12-05 18:47:01 -0800996 if test "x$driglx_direct" = xyes; then
997 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
998 fi
Jerome Glisse14f79d42008-12-18 13:36:07 +0100999 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -08001000
1001 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -08001002 x86_64)
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -05001003 # sis is missing because they have not be converted to use
1004 # the new interface. i810 are missing because there is no
1005 # x86-64 system where they could *ever* be used.
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001006 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -04001007 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +03001008 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -08001009 fi
Dan Nicholson44d99142007-12-05 18:47:01 -08001010 ;;
1011 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -08001012 # Build only the drivers for cards that exist on PowerPC.
1013 # At some point MGA will be added, but not yet.
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001014 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -04001015 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -08001016 fi
Dan Nicholson44d99142007-12-05 18:47:01 -08001017 ;;
Dave Airlie2b0e75e2008-06-12 12:06:50 +10001018 sparc*)
1019 # Build only the drivers for cards that exist on sparc`
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001020 if test "x$DRI_DIRS" = "xyes"; then
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -05001021 DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +10001022 fi
1023 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -08001024 esac
1025 ;;
Pierre Allegraud8fd8de32011-01-06 07:58:57 -07001026 freebsd* | dragonfly* | *netbsd*)
Dan Nicholson44d99142007-12-05 18:47:01 -08001027 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
1028 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
1029 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
1030 if test "x$driglx_direct" = xyes; then
1031 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1032 fi
Dan Nicholson44d99142007-12-05 18:47:01 -08001033
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001034 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -04001035 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +03001036 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -08001037 fi
Dan Nicholson44d99142007-12-05 18:47:01 -08001038 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -07001039 gnu*)
1040 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
1041 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
1042 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001043 solaris*)
1044 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
1045 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
1046 if test "x$driglx_direct" = xyes; then
1047 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1048 fi
1049 ;;
Jon TURNEYc6e33ca2011-03-14 22:08:23 +00001050 cygwin*)
1051 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
1052 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
1053 if test "x$driglx_direct" = xyes; then
1054 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1055 fi
1056 if test "x$DRI_DIRS" = "xyes"; then
1057 DRI_DIRS="swrast"
1058 fi
1059 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -08001060 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -08001061
1062 # default drivers
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001063 if test "x$DRI_DIRS" = "xyes"; then
Corbin Simpson8e4657a2009-10-22 12:29:30 -07001064 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -05001065 savage sis tdfx unichrome swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -08001066 fi
1067
Dan Nicholson44d99142007-12-05 18:47:01 -08001068 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
1069
1070 # Check for expat
Chia-I Wube5f34a2010-10-27 16:14:27 +08001071 if test "$mesa_driver" = dri; then
1072 EXPAT_INCLUDES=""
1073 EXPAT_LIB=-lexpat
1074 AC_ARG_WITH([expat],
1075 [AS_HELP_STRING([--with-expat=DIR],
1076 [expat install directory])],[
1077 EXPAT_INCLUDES="-I$withval/include"
1078 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
1079 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
1080 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
1081 ])
1082 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
1083 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
1084 [AC_MSG_ERROR([Expat required for DRI.])])
1085 fi
Dan Nicholson44d99142007-12-05 18:47:01 -08001086
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +11001087 # put all the necessary libs together, including possibly libdricore
1088 DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -08001089fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001090AC_SUBST([DRI_DIRS])
1091AC_SUBST([EXPAT_INCLUDES])
1092AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -08001093
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001094case $DRI_DIRS in
1095*i915*|*i965*)
Tormod Volden903185b2011-01-25 13:25:18 -08001096 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001097 ;;
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -05001098esac
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001099
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -05001100case $DRI_DIRS in
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001101*radeon*|*r200*|*r300*|*r600*)
Marek Olšáka1aec2e2010-09-26 17:52:58 +02001102 if test "x$HAVE_LIBDRM_RADEON" = xyes; then
Kristian Høgsberg8616cec2010-01-01 17:03:33 -05001103 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
1104 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
1105 fi
1106 ;;
1107esac
1108AC_SUBST([RADEON_CFLAGS])
1109AC_SUBST([RADEON_LDFLAGS])
1110
1111
Dan Nicholson44d99142007-12-05 18:47:01 -08001112dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -07001113dnl OSMesa configuration
1114dnl
Dan Nicholsona1307182007-12-12 17:49:49 -08001115if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -08001116 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -08001117else
Dan Nicholson544ab202007-12-30 08:41:53 -08001118 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -08001119fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001120AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -08001121 [AS_HELP_STRING([--enable-gl-osmesa],
Dan Nicholsoncbf30fc2010-06-16 09:23:17 -07001122 [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001123 [gl_osmesa="$enableval"],
1124 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -08001125if test "x$gl_osmesa" = xyes; then
Chia-I Wube5f34a2010-10-27 16:14:27 +08001126 if test "x$enable_opengl" = xno; then
1127 AC_MSG_ERROR([OpenGL is not available for OSMesa driver])
1128 fi
Dan Nicholson544ab202007-12-30 08:41:53 -08001129 if test "$mesa_driver" = osmesa; then
1130 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -08001131 else
Dan Nicholson544ab202007-12-30 08:41:53 -08001132 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -08001133 fi
1134fi
1135
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001136dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -07001137AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001138 [AS_HELP_STRING([--with-osmesa-bits=BITS],
1139 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001140 [osmesa_bits="$withval"],
1141 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001142if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
1143 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
1144 osmesa_bits=8
1145fi
1146case "x$osmesa_bits" in
1147x8)
1148 OSMESA_LIB=OSMesa
1149 ;;
1150x16|x32)
1151 OSMESA_LIB="OSMesa$osmesa_bits"
1152 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
1153 ;;
1154*)
1155 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
1156 ;;
1157esac
Dan Nicholson297e16c2008-05-05 15:42:53 -07001158AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001159
Dan Nicholsoncbf30fc2010-06-16 09:23:17 -07001160case "$DRIVER_DIRS" in
1161*osmesa*)
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001162 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -08001163 if test "$enable_static" = no; then
Kenneth Graunked1d812052011-01-16 16:01:54 -08001164 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -08001165 else
1166 OSMESA_LIB_DEPS=""
1167 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001168 OSMESA_MESA_DEPS=""
Kenneth Graunked1d812052011-01-16 16:01:54 -08001169 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -08001170 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -08001171esac
Dan Nicholson297e16c2008-05-05 15:42:53 -07001172AC_SUBST([OSMESA_LIB_DEPS])
1173AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholson8be02fc2008-12-14 09:35:29 -08001174AC_SUBST([OSMESA_PC_REQ])
1175AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001176
1177dnl
Dan Nicholson53b37342009-02-25 17:45:34 -08001178dnl EGL configuration
1179dnl
Dan Nicholson66f97862009-04-29 12:11:43 -07001180AC_ARG_ENABLE([egl],
1181 [AS_HELP_STRING([--disable-egl],
1182 [disable EGL library @<:@default=enabled@:>@])],
1183 [enable_egl="$enableval"],
1184 [enable_egl=yes])
Chia-I Wube5f34a2010-10-27 16:14:27 +08001185if test "x$enable_egl" = xno; then
1186 if test "x$mesa_driver" = xno; then
1187 AC_MSG_ERROR([cannot disable EGL when there is no mesa driver])
1188 fi
1189 if test "x$enable_openvg" = xyes; then
1190 AC_MSG_ERROR([cannot enable OpenVG without EGL])
1191 fi
1192fi
Dan Nicholson66f97862009-04-29 12:11:43 -07001193if test "x$enable_egl" = xyes; then
1194 SRC_DIRS="$SRC_DIRS egl"
Tapani Pälli2758e652011-05-16 16:56:43 +03001195 EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS -lpthread"
Chia-I Wud4c1ee02009-12-21 11:13:18 +08001196 EGL_DRIVERS_DIRS=""
Chia-I Wu2eb7a2f2010-02-05 10:46:11 +08001197 if test "$enable_static" != yes; then
Chia-I Wud4c1ee02009-12-21 11:13:18 +08001198 # build egl_glx when libGL is built
Chia-I Wube5f34a2010-10-27 16:14:27 +08001199 if test "$mesa_driver" = xlib -o "$mesa_driver" = dri; then
Chia-I Wu2eb7a2f2010-02-05 10:46:11 +08001200 EGL_DRIVERS_DIRS="glx"
1201 fi
1202
Benjamin Franzke184bb092011-04-30 11:18:23 +02001203 PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
1204 [have_libudev=yes],[have_libudev=no])
Chia-I Wu39ae9652010-07-16 19:48:52 +08001205 if test "$mesa_driver" = dri; then
1206 # build egl_dri2 when xcb-dri2 is available
1207 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
1208 [have_xcb_dri2=yes],[have_xcb_dri2=no])
Chia-I Wu39ae9652010-07-16 19:48:52 +08001209
1210 if test "$have_xcb_dri2" = yes; then
1211 EGL_DRIVER_DRI2=dri2
1212 DEFINES="$DEFINES -DHAVE_XCB_DRI2"
1213 if test "$have_libudev" = yes; then
1214 DEFINES="$DEFINES -DHAVE_LIBUDEV"
1215 fi
Benjamin Franzke4ca075a2011-03-02 21:23:04 +01001216 # workaround a bug in xcb-dri2 generated by xcb-proto 1.6
1217 AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [],
1218 [DEFINES="$DEFINES -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN"])
Chia-I Wu39ae9652010-07-16 19:48:52 +08001219 fi
1220 fi
Kristian Høgsberg2168b872010-06-02 22:48:06 -04001221
1222 EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
Kristian Høgsberg42fa0092010-02-03 10:18:28 -05001223 fi
Dan Nicholson53b37342009-02-25 17:45:34 -08001224fi
Dan Nicholson53b37342009-02-25 17:45:34 -08001225AC_SUBST([EGL_LIB_DEPS])
Chia-I Wud4c1ee02009-12-21 11:13:18 +08001226AC_SUBST([EGL_DRIVERS_DIRS])
Dan Nicholson53b37342009-02-25 17:45:34 -08001227
1228dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -07001229dnl GLU configuration
1230dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -07001231AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001232 [AS_HELP_STRING([--disable-glu],
1233 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001234 [enable_glu="$enableval"],
1235 [enable_glu=yes])
Chia-I Wube5f34a2010-10-27 16:14:27 +08001236
1237if test "x$enable_glu" = xyes -a "x$mesa_driver" = xno; then
1238 AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver])
1239 enable_glu=no
1240fi
1241
Dan Nicholsondca1b792007-10-23 09:25:58 -07001242if test "x$enable_glu" = xyes; then
1243 SRC_DIRS="$SRC_DIRS glu"
1244
Dan Nicholson979ff512007-12-05 18:47:01 -08001245 case "$mesa_driver" in
1246 osmesa)
Dan Nicholson979ff512007-12-05 18:47:01 -08001247 # Link libGLU to libOSMesa instead of libGL
1248 GLU_LIB_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -08001249 GLU_PC_REQ="osmesa"
Dan Nicholson88586332007-11-15 08:59:57 -08001250 if test "$enable_static" = no; then
1251 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
1252 else
1253 GLU_MESA_DEPS=""
1254 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001255 ;;
1256 *)
Dan Nicholson88586332007-11-15 08:59:57 -08001257 # If static, empty GLU_LIB_DEPS and add libs for programs to link
Dan Nicholson71e208b2008-11-24 11:01:57 -08001258 GLU_PC_REQ="gl"
1259 GLU_PC_LIB_PRIV="-lm"
Dan Nicholson88586332007-11-15 08:59:57 -08001260 if test "$enable_static" = no; then
1261 GLU_LIB_DEPS="-lm"
1262 GLU_MESA_DEPS='-l$(GL_LIB)'
1263 else
1264 GLU_LIB_DEPS=""
1265 GLU_MESA_DEPS=""
1266 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
1267 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001268 ;;
1269 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001270fi
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001271if test "$enable_static" = no; then
1272 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
1273fi
Dan Nicholson71e208b2008-11-24 11:01:57 -08001274GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
Dan Nicholson297e16c2008-05-05 15:42:53 -07001275AC_SUBST([GLU_LIB_DEPS])
1276AC_SUBST([GLU_MESA_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001277AC_SUBST([GLU_PC_REQ])
1278AC_SUBST([GLU_PC_REQ_PRIV])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001279AC_SUBST([GLU_PC_LIB_PRIV])
1280AC_SUBST([GLU_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001281
1282dnl
1283dnl GLw configuration
1284dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -07001285AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001286 [AS_HELP_STRING([--disable-glw],
1287 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001288 [enable_glw="$enableval"],
1289 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -08001290dnl Don't build GLw on osmesa
Chia-I Wube5f34a2010-10-27 16:14:27 +08001291if test "x$enable_glw" = xyes; then
1292 case "$mesa_driver" in
1293 osmesa|no)
1294 AC_MSG_NOTICE([Disabling GLw since there is no OpenGL driver])
1295 enable_glw=no
1296 ;;
1297 esac
Dan Nicholson979ff512007-12-05 18:47:01 -08001298fi
Dan Nicholson776c60d2008-07-18 07:40:41 -07001299AC_ARG_ENABLE([motif],
1300 [AS_HELP_STRING([--enable-motif],
1301 [use Motif widgets in GLw @<:@default=disabled@:>@])],
1302 [enable_motif="$enableval"],
1303 [enable_motif=no])
1304
Dan Nicholsondca1b792007-10-23 09:25:58 -07001305if test "x$enable_glw" = xyes; then
1306 SRC_DIRS="$SRC_DIRS glw"
1307 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001308 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001309 GLW_PC_REQ_PRIV="x11 xt"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001310 GLW_LIB_DEPS="$GLW_LIBS"
1311 else
1312 # should check these...
Dan Nicholson776c60d2008-07-18 07:40:41 -07001313 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001314 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1315 GLW_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001316 fi
1317
1318 GLW_SOURCES="GLwDrawA.c"
1319 MOTIF_CFLAGS=
1320 if test "x$enable_motif" = xyes; then
1321 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1322 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1323 if test "x$MOTIF_CONFIG" != xno; then
1324 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1325 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1326 else
1327 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1328 [AC_MSG_ERROR([Can't locate Motif headers])])
1329 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1330 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1331 fi
1332 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1333 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001334 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1335 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001336 fi
1337
Dan Nicholson88586332007-11-15 08:59:57 -08001338 # If static, empty GLW_LIB_DEPS and add libs for programs to link
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001339 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
Dan Nicholson88586332007-11-15 08:59:57 -08001340 if test "$enable_static" = no; then
1341 GLW_MESA_DEPS='-l$(GL_LIB)'
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001342 GLW_LIB_DEPS="$GLW_LIB_DEPS"
Dan Nicholson88586332007-11-15 08:59:57 -08001343 else
1344 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1345 GLW_LIB_DEPS=""
1346 GLW_MESA_DEPS=""
1347 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001348fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001349AC_SUBST([GLW_LIB_DEPS])
1350AC_SUBST([GLW_MESA_DEPS])
Dan Nicholson776c60d2008-07-18 07:40:41 -07001351AC_SUBST([GLW_SOURCES])
1352AC_SUBST([MOTIF_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001353AC_SUBST([GLW_PC_REQ_PRIV])
1354AC_SUBST([GLW_PC_LIB_PRIV])
1355AC_SUBST([GLW_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001356
1357dnl
1358dnl GLUT configuration
1359dnl
1360if test -f "$srcdir/include/GL/glut.h"; then
1361 default_glut=yes
1362else
1363 default_glut=no
1364fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001365AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001366 [AS_HELP_STRING([--disable-glut],
1367 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001368 [enable_glut="$enableval"],
1369 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001370
Chia-I Wube5f34a2010-10-27 16:14:27 +08001371dnl Don't build glut on osmesa
1372if test "x$enable_glut" = xyes; then
1373 case "$mesa_driver" in
1374 osmesa|no)
1375 AC_MSG_NOTICE([Disabling glut since there is no OpenGL driver])
1376 enable_glut=no
1377 ;;
1378 esac
1379fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001380dnl Can't build glut if GLU not available
1381if test "x$enable_glu$enable_glut" = xnoyes; then
1382 AC_MSG_WARN([Disabling glut since GLU is disabled])
1383 enable_glut=no
1384fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001385
Dan Nicholsondca1b792007-10-23 09:25:58 -07001386if test "x$enable_glut" = xyes; then
1387 SRC_DIRS="$SRC_DIRS glut/glx"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001388 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001389 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001390 GLUT_PC_REQ_PRIV="x11 xmu xi"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001391 GLUT_LIB_DEPS="$GLUT_LIBS"
1392 else
1393 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -08001394 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001395 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1396 GLUT_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001397 fi
John Hein96172542010-07-01 12:53:28 -07001398 if test "x$GCC" = xyes; then
1399 GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
1400 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001401 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1402 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001403
Dan Nicholson88586332007-11-15 08:59:57 -08001404 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1405 if test "$enable_static" = no; then
1406 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1407 else
1408 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1409 GLUT_LIB_DEPS=""
1410 GLUT_MESA_DEPS=""
1411 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001412fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001413AC_SUBST([GLUT_LIB_DEPS])
1414AC_SUBST([GLUT_MESA_DEPS])
1415AC_SUBST([GLUT_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001416AC_SUBST([GLUT_PC_REQ_PRIV])
1417AC_SUBST([GLUT_PC_LIB_PRIV])
1418AC_SUBST([GLUT_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001419
1420dnl
1421dnl Program library dependencies
1422dnl Only libm is added here if necessary as the libraries should
1423dnl be pulled in by the linker
1424dnl
1425if test "x$APP_LIB_DEPS" = x; then
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001426 case "$host_os" in
1427 solaris*)
1428 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1429 ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +01001430 cygwin*)
1431 APP_LIB_DEPS="-lX11"
1432 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001433 *)
1434 APP_LIB_DEPS="-lm"
1435 ;;
1436 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001437fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001438AC_SUBST([APP_LIB_DEPS])
1439AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001440
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001441dnl
1442dnl Gallium configuration
1443dnl
1444AC_ARG_ENABLE([gallium],
1445 [AS_HELP_STRING([--disable-gallium],
1446 [build gallium @<:@default=enabled@:>@])],
1447 [enable_gallium="$enableval"],
1448 [enable_gallium=yes])
Chia-I Wube5f34a2010-10-27 16:14:27 +08001449if test "x$enable_gallium" = xno -a "x$enable_openvg" = xyes; then
1450 AC_MSG_ERROR([cannot enable OpenVG without Gallium])
1451fi
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001452if test "x$enable_gallium" = xyes; then
Jakob Bornecrantzbe38b322010-03-23 13:23:26 +00001453 SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
Dave Airlie81fe1982010-04-22 14:59:29 +10001454 AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001455fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001456
Dave Airlie81fe1982010-04-22 14:59:29 +10001457AC_SUBST([LLVM_CFLAGS])
1458AC_SUBST([LLVM_LIBS])
1459AC_SUBST([LLVM_LDFLAGS])
1460AC_SUBST([LLVM_VERSION])
1461
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001462dnl
1463dnl Gallium state trackers configuration
1464dnl
Chia-I Wudbacbb82010-11-02 02:00:36 +08001465
1466AC_ARG_ENABLE([gallium-egl],
1467 [AS_HELP_STRING([--enable-gallium-egl],
1468 [enable gallium EGL state tracker @<:@default=auto@:>@])],
1469 [enable_gallium_egl="$enableval"],
1470 [enable_gallium_egl=auto])
1471if test "x$enable_gallium_egl" = xauto; then
1472 case "$mesa_driver" in
1473 dri|no)
1474 enable_gallium_egl=$enable_egl
1475 ;;
1476 *)
Chia-I Wuada9c782011-01-04 01:05:22 +08001477 enable_gallium_egl=$enable_openvg
Chia-I Wudbacbb82010-11-02 02:00:36 +08001478 ;;
1479 esac
1480fi
1481case "x$enable_egl$enable_gallium_egl" in
1482xnoyes)
1483 AC_MSG_ERROR([cannot build Gallium EGL state tracker without EGL])
1484esac
1485
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001486AC_ARG_WITH([state-trackers],
1487 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1488 [comma delimited state_trackers list, e.g.
1489 "egl,glx" @<:@default=auto@:>@])],
1490 [with_state_trackers="$withval"],
1491 [with_state_trackers=yes])
1492
1493case "$with_state_trackers" in
1494no)
1495 GALLIUM_STATE_TRACKERS_DIRS=""
1496 ;;
1497yes)
1498 # look at what else is built
1499 case "$mesa_driver" in
Jakob Bornecrantz373e6712009-04-18 23:13:56 +01001500 xlib)
1501 GALLIUM_STATE_TRACKERS_DIRS=glx
1502 ;;
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001503 dri)
Jakob Bornecrantz5b1fc142010-03-25 18:29:51 +01001504 GALLIUM_STATE_TRACKERS_DIRS="dri"
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001505 HAVE_ST_DRI="yes"
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001506 # Have only tested st/xorg on 1.6.0 servers
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001507 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001508 HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1509 HAVE_ST_XORG="no")
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001510 ;;
1511 esac
Chia-I Wube5f34a2010-10-27 16:14:27 +08001512
1513 if test "x$enable_egl" = xyes; then
1514 if test "$enable_openvg" = yes; then
1515 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vega"
1516 st_egl="yes"
1517 fi
1518
Chia-I Wudbacbb82010-11-02 02:00:36 +08001519 if test "$enable_gallium_egl" = yes; then
Chia-I Wube5f34a2010-10-27 16:14:27 +08001520 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
1521 HAVE_ST_EGL="yes"
1522 fi
1523 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001524 ;;
1525*)
1526 # verify the requested state tracker exist
Chia-I Wu63ab2502010-05-05 15:38:02 +08001527 state_trackers=""
1528 _state_trackers=`IFS=', '; echo $with_state_trackers`
1529 for tracker in $_state_trackers; do
Chia-I Wue5d351d2009-12-23 11:18:00 +08001530 case "$tracker" in
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001531 dri)
1532 if test "x$mesa_driver" != xdri; then
1533 AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
1534 fi
1535 HAVE_ST_DRI="yes"
1536 ;;
Chia-I Wu3c967a92010-01-22 16:31:43 +08001537 egl)
Chia-I Wue5d351d2009-12-23 11:18:00 +08001538 if test "x$enable_egl" != xyes; then
Chia-I Wu3c967a92010-01-22 16:31:43 +08001539 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
Chia-I Wue5d351d2009-12-23 11:18:00 +08001540 fi
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001541 HAVE_ST_EGL="yes"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001542 ;;
1543 xorg)
Jakob Bornecrantz4f956882010-07-13 07:40:47 -07001544 PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001545 PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1546 PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001547 HAVE_ST_XORG="yes"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001548 ;;
Chia-I Wu156e9552010-10-30 14:26:01 +08001549 vega)
1550 if test "x$enable_openvg" != xyes; then
1551 AC_MSG_ERROR([cannot build vega state tracker without --enable-openvg])
1552 fi
Chia-I Wuc116a0e2011-01-20 14:19:13 +08001553 have_st_vega="yes"
Chia-I Wu156e9552010-10-30 14:26:01 +08001554 ;;
Chia-I Wue5d351d2009-12-23 11:18:00 +08001555 esac
Chia-I Wu63ab2502010-05-05 15:38:02 +08001556
1557 if test -n "$tracker"; then
1558 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1559 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
1560 if test -n "$state_trackers"; then
1561 state_trackers="$state_trackers $tracker"
1562 else
1563 state_trackers="$tracker"
1564 fi
1565 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001566 done
1567 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
Chia-I Wuc116a0e2011-01-20 14:19:13 +08001568
1569 # append --enable-openvg/--enable-gallium-egl to --with-state-trackers
1570 if test "x$have_st_vega" != xyes -a "x$enable_openvg" = xyes; then
1571 AC_MSG_ERROR([--with-state-trackers specified but vega is missing])
1572 fi
1573 if test "x$HAVE_ST_EGL" != xyes -a "x$enable_gallium_egl" = xyes; then
1574 AC_MSG_ERROR([--with-state-trackers specified but egl is missing])
1575 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001576 ;;
1577esac
1578
Chia-I Wube5f34a2010-10-27 16:14:27 +08001579
1580EGL_CLIENT_APIS=""
1581VG_LIB_DEPS=""
1582
1583case "x$enable_opengl$enable_gles1$enable_gles2" in
1584x*yes*)
1585 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
1586 ;;
1587esac
Chia-I Wube5f34a2010-10-27 16:14:27 +08001588if test "x$enable_openvg" = xyes; then
1589 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
Tapani Pälli2758e652011-05-16 16:56:43 +03001590 VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS -lpthread"
Chia-I Wube5f34a2010-10-27 16:14:27 +08001591fi
1592
Chia-I Wu874ccd52010-05-04 22:43:05 +08001593AC_SUBST([VG_LIB_DEPS])
Chia-I Wu63ab2502010-05-05 15:38:02 +08001594AC_SUBST([EGL_CLIENT_APIS])
1595
1596if test "x$HAVE_ST_EGL" = xyes; then
Chia-I Wud8e0e112010-06-29 14:04:27 +08001597 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
Chia-I Wu63ab2502010-05-05 15:38:02 +08001598fi
Chia-I Wu874ccd52010-05-04 22:43:05 +08001599
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001600if test "x$HAVE_ST_XORG" = xyes; then
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001601 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1602 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1603 HAVE_XEXTPROTO_71="no")
1604fi
1605
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001606AC_ARG_WITH([egl-platforms],
1607 [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1608 [comma delimited native platforms libEGL supports, e.g.
Chia-I Wue7424d72010-09-19 16:54:39 +08001609 "x11,drm" @<:@default=auto@:>@])],
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001610 [with_egl_platforms="$withval"],
1611 [with_egl_platforms=yes])
Chia-I Wu49381d62010-01-11 01:23:01 +08001612AC_ARG_WITH([egl-displays],
1613 [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001614 [DEPRECATED. Use --with-egl-platforms instead])],
1615 [with_egl_platforms="$withval"])
Chia-I Wu49381d62010-01-11 01:23:01 +08001616
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001617EGL_PLATFORMS=""
Benjamin Franzke214fc6e2011-02-04 12:24:08 +01001618WAYLAND_EGL_LIB_DEPS=""
1619
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001620case "$with_egl_platforms" in
Chia-I Wu49381d62010-01-11 01:23:01 +08001621yes)
1622 if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001623 EGL_PLATFORMS="x11"
Chia-I Wu2a910b32010-09-19 17:31:34 +08001624 if test "$mesa_driver" = dri; then
1625 EGL_PLATFORMS="$EGL_PLATFORMS drm"
1626 fi
Chia-I Wu49381d62010-01-11 01:23:01 +08001627 fi
1628 ;;
1629*)
1630 if test "x$enable_egl" != xyes; then
1631 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1632 fi
1633 # verify the requested driver directories exist
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001634 egl_platforms=`IFS=', '; echo $with_egl_platforms`
1635 for plat in $egl_platforms; do
1636 test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
Kristian Høgsberg1a8899d2011-02-10 10:45:06 -05001637 AC_MSG_ERROR([EGL platform '$plat' doesn't exist])
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001638 if test "$plat" = "fbdev"; then
Chia-I Wu8f3e48e2010-06-17 14:10:53 +08001639 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
1640 fi
Benjamin Franzkee586c4b2011-02-04 12:22:58 +01001641 if test "$plat" = "wayland"; then
Benjamin Franzke6b369c42011-02-21 16:22:34 +01001642 PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server],, \
Benjamin Franzkee586c4b2011-02-04 12:22:58 +01001643 [AC_MSG_ERROR([cannot find libwayland-client])])
Benjamin Franzke214fc6e2011-02-04 12:24:08 +01001644 WAYLAND_EGL_LIB_DEPS="$WAYLAND_LIBS $LIBDRM_LIBS"
Benjamin Franzkeaaa3c0d2011-04-23 14:14:29 +02001645 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
Benjamin Franzkee586c4b2011-02-04 12:22:58 +01001646 fi
Chia-I Wu49381d62010-01-11 01:23:01 +08001647 done
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001648 EGL_PLATFORMS="$egl_platforms"
Chia-I Wu49381d62010-01-11 01:23:01 +08001649 ;;
1650esac
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001651AC_SUBST([EGL_PLATFORMS])
Chia-I Wu49381d62010-01-11 01:23:01 +08001652
Benjamin Franzke214fc6e2011-02-04 12:24:08 +01001653AC_SUBST([WAYLAND_EGL_LIB_DEPS])
1654WAYLAND_EGL_PC_REQ_PRIV="wayland-client libdrm"
1655WAYLAND_EGL_PC_LIB_PRIV=
1656WAYLAND_EGL_PC_CFLAGS=
1657
1658AC_SUBST([WAYLAND_EGL_PC_REQ_PRIV])
1659AC_SUBST([WAYLAND_EGL_PC_LIB_PRIV])
1660AC_SUBST([WAYLAND_EGL_PC_CFLAGS])
1661
1662
Chia-I Wu28c3e572010-01-23 20:18:43 +08001663AC_ARG_WITH([egl-driver-dir],
1664 [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1665 [directory for EGL drivers [[default=${libdir}/egl]]])],
1666 [EGL_DRIVER_INSTALL_DIR="$withval"],
1667 [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1668AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1669
Joel Bosveld8acca482009-03-06 08:46:08 +09001670AC_ARG_WITH([xorg-driver-dir],
1671 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1672 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1673 [XORG_DRIVER_INSTALL_DIR="$withval"],
1674 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1675AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1676
Tom Fogal7085dce2009-08-13 19:40:30 -06001677AC_ARG_WITH([max-width],
1678 [AS_HELP_STRING([--with-max-width=N],
1679 [Maximum framebuffer width (4096)])],
1680 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1681 AS_IF([test "${withval}" -gt "4096"],
1682 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1683)
1684AC_ARG_WITH([max-height],
1685 [AS_HELP_STRING([--with-max-height=N],
1686 [Maximum framebuffer height (4096)])],
1687 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1688 AS_IF([test "${withval}" -gt "4096"],
1689 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1690)
1691
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001692dnl
Dave Airlie81fe1982010-04-22 14:59:29 +10001693dnl Gallium LLVM
1694dnl
1695AC_ARG_ENABLE([gallium-llvm],
1696 [AS_HELP_STRING([--enable-gallium-llvm],
Marek Olšáka86fc712011-04-21 13:27:55 +02001697 [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
Dave Airlie81fe1982010-04-22 14:59:29 +10001698 [enable_gallium_llvm="$enableval"],
1699 [enable_gallium_llvm=auto])
Marek Olšáka86fc712011-04-21 13:27:55 +02001700if test "x$enable_gallium_llvm" = xauto; then
1701 case "$host_cpu" in
1702 i*86|x86_64) enable_gallium_llvm=yes;;
1703 esac
1704fi
Dave Airlie81fe1982010-04-22 14:59:29 +10001705if test "x$enable_gallium_llvm" = xyes; then
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001706 if test "x$LLVM_CONFIG" != xno; then
1707 LLVM_VERSION=`$LLVM_CONFIG --version`
Brian Paul7da704e2010-12-08 06:44:42 -07001708 LLVM_CFLAGS=`$LLVM_CONFIG --cppflags`
José Fonseca202c3452011-03-14 19:58:22 +00001709 LLVM_LIBS="`$LLVM_CONFIG --libs` -lstdc++"
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001710
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001711 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1712 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
Chia-I Wu3ecb8c22010-05-11 12:36:49 +08001713 DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001714 MESA_LLVM=1
1715 else
Dave Airlie81fe1982010-04-22 14:59:29 +10001716 MESA_LLVM=0
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001717 fi
1718else
1719 MESA_LLVM=0
Dave Airlie81fe1982010-04-22 14:59:29 +10001720fi
1721
1722dnl
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001723dnl Gallium helper functions
1724dnl
1725gallium_check_st() {
Chia-I Wud8e0e112010-06-29 14:04:27 +08001726 if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001727 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1728 fi
1729 if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
1730 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1731 fi
Chia-I Wud8e0e112010-06-29 14:04:27 +08001732 if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001733 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1734 fi
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001735}
1736
1737
1738dnl
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001739dnl Gallium SVGA configuration
1740dnl
1741AC_ARG_ENABLE([gallium-svga],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001742 [AS_HELP_STRING([--enable-gallium-svga],
1743 [build gallium SVGA @<:@default=disabled@:>@])],
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001744 [enable_gallium_svga="$enableval"],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001745 [enable_gallium_svga=auto])
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001746if test "x$enable_gallium_svga" = xyes; then
Xavier Chantryff0987a2010-03-26 11:02:03 +01001747 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001748 gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001749elif test "x$enable_gallium_svga" = xauto; then
1750 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001751fi
1752
1753dnl
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001754dnl Gallium i915 configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001755dnl
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001756AC_ARG_ENABLE([gallium-i915],
1757 [AS_HELP_STRING([--enable-gallium-i915],
1758 [build gallium i915 @<:@default=disabled@:>@])],
1759 [enable_gallium_i915="$enableval"],
1760 [enable_gallium_i915=auto])
1761if test "x$enable_gallium_i915" = xyes; then
Jakob Bornecrantz44bafca2010-04-17 15:17:33 +01001762 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001763 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001764 gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001765elif test "x$enable_gallium_i915" = xauto; then
Jakob Bornecrantz44bafca2010-04-17 15:17:33 +01001766 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001767 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1768fi
1769
1770dnl
1771dnl Gallium i965 configuration
1772dnl
1773AC_ARG_ENABLE([gallium-i965],
1774 [AS_HELP_STRING([--enable-gallium-i965],
1775 [build gallium i965 @<:@default=disabled@:>@])],
1776 [enable_gallium_i965="$enableval"],
1777 [enable_gallium_i965=auto])
1778if test "x$enable_gallium_i965" = xyes; then
1779 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001780 gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001781elif test "x$enable_gallium_i965" = xauto; then
1782 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001783fi
1784
1785dnl
Marek Olšák85a45dc2010-09-23 21:50:43 +02001786dnl Gallium Radeon r300g configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001787dnl
Marek Olšák57222862011-04-19 12:28:51 +02001788AC_ARG_ENABLE([gallium-r300],
1789 [AS_HELP_STRING([--enable-gallium-r300],
Marek Olšák0fecb922011-04-21 13:33:29 +02001790 [build gallium r300 @<:@default=build DRI driver only@:>@])],
Marek Olšák57222862011-04-19 12:28:51 +02001791 [enable_gallium_r300="$enableval"],
1792 [enable_gallium_r300=auto])
Jon TURNEY9cb800a2011-04-29 12:52:10 +01001793
1794if test "$mesa_driver" != dri ; then
1795 if test "x$enable_gallium_r300" = xauto; then
1796 enable_gallium_r300=no
1797 fi
1798fi
1799
Marek Olšák0fecb922011-04-21 13:33:29 +02001800if test "x$enable_gallium_r300" != xno; then
1801 if test "x$MESA_LLVM" = x0; then
1802 case "$host_cpu" in
1803 i*86|x86_64) AC_MSG_ERROR([LLVM is required to build Gallium R300 on x86 and x86_64]);;
1804 esac
1805 fi
1806fi
Marek Olšák57222862011-04-19 12:28:51 +02001807if test "x$enable_gallium_r300" = xauto; then
Marek Olšák7da51052011-02-11 01:16:06 +01001808 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1809 gallium_check_st "radeon/drm" "dri-r300"
Marek Olšák57222862011-04-19 12:28:51 +02001810elif test "x$enable_gallium_r300" = xyes; then
Marek Olšák7da51052011-02-11 01:16:06 +01001811 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1812 gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001813fi
1814
1815dnl
Jakob Bornecrantzaeee5262010-05-13 20:29:18 +01001816dnl Gallium Radeon r600g configuration
1817dnl
1818AC_ARG_ENABLE([gallium-r600],
1819 [AS_HELP_STRING([--enable-gallium-r600],
Marek Olšák57222862011-04-19 12:28:51 +02001820 [build gallium r600 @<:@default=disabled@:>@])],
Jakob Bornecrantzaeee5262010-05-13 20:29:18 +01001821 [enable_gallium_r600="$enableval"],
1822 [enable_gallium_r600=auto])
1823if test "x$enable_gallium_r600" = xyes; then
Marek Olšák7da51052011-02-11 01:16:06 +01001824 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1825 gallium_check_st "r600/drm" "dri-r600"
Jakob Bornecrantzaeee5262010-05-13 20:29:18 +01001826fi
1827
1828dnl
Thierry Vignaud1402ea82009-09-14 11:48:51 -06001829dnl Gallium Nouveau configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001830dnl
1831AC_ARG_ENABLE([gallium-nouveau],
1832 [AS_HELP_STRING([--enable-gallium-nouveau],
1833 [build gallium nouveau @<:@default=disabled@:>@])],
1834 [enable_gallium_nouveau="$enableval"],
1835 [enable_gallium_nouveau=no])
1836if test "x$enable_gallium_nouveau" = xyes; then
Christoph Bumiller4c224752010-11-12 15:17:40 +01001837 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001838 gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001839fi
1840
Chia-I Wua1306f42010-01-22 15:51:51 +08001841dnl
1842dnl Gallium swrast configuration
1843dnl
1844AC_ARG_ENABLE([gallium-swrast],
1845 [AS_HELP_STRING([--enable-gallium-swrast],
Jakob Bornecrantzf5ba2cd2010-03-24 10:58:45 +01001846 [build gallium swrast @<:@default=auto@:>@])],
Chia-I Wua1306f42010-01-22 15:51:51 +08001847 [enable_gallium_swrast="$enableval"],
1848 [enable_gallium_swrast=auto])
George Sapountzis7b333292010-03-25 17:01:54 +02001849if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
Jakob Bornecrantz5b1fc142010-03-25 18:29:51 +01001850 if test "x$HAVE_ST_DRI" = xyes; then
George Sapountzis7b333292010-03-25 17:01:54 +02001851 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
Jakob Bornecrantzf5ba2cd2010-03-24 10:58:45 +01001852 fi
Chia-I Wua1306f42010-01-22 15:51:51 +08001853fi
1854
Chia-I Wu99a37ed2010-01-05 17:39:05 +08001855dnl prepend CORE_DIRS to SRC_DIRS
1856SRC_DIRS="$CORE_DIRS $SRC_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001857
Dan Nicholsondca1b792007-10-23 09:25:58 -07001858dnl Restore LDFLAGS and CPPFLAGS
1859LDFLAGS="$_SAVE_LDFLAGS"
1860CPPFLAGS="$_SAVE_CPPFLAGS"
1861
1862dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -08001863AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001864
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001865dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001866AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001867if test -f configs/current || test -L configs/current; then
1868 rm -f configs/current
1869fi
1870ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001871])
1872
1873AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001874
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001875dnl
1876dnl Output some configuration info for the user
1877dnl
1878echo ""
1879echo " prefix: $prefix"
1880echo " exec_prefix: $exec_prefix"
1881echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07001882echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001883
Chia-I Wu815faa42010-10-29 12:34:44 +08001884dnl API info
1885echo ""
1886echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
Chia-I Wu815faa42010-10-29 12:34:44 +08001887echo " OpenVG: $enable_openvg"
1888
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001889dnl Driver info
1890echo ""
1891echo " Driver: $mesa_driver"
Chia-I Wu815faa42010-10-29 12:34:44 +08001892if test "$mesa_driver" != no; then
1893 if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1894 echo " OSMesa: lib$OSMESA_LIB"
1895 else
1896 echo " OSMesa: no"
1897 fi
1898 if test "$mesa_driver" = dri; then
1899 # cleanup the drivers var
1900 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1901 if test "x$DRI_DIRS" = x; then
1902 echo " DRI drivers: no"
1903 else
1904 echo " DRI drivers: $dri_dirs"
1905 fi
1906 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
1907 echo " Use XCB: $enable_xcb"
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +11001908 echo " Shared dricore: $enable_dricore"
Chia-I Wu815faa42010-10-29 12:34:44 +08001909 fi
Dan Nicholson544ab202007-12-30 08:41:53 -08001910fi
Chia-I Wu815faa42010-10-29 12:34:44 +08001911echo ""
1912echo " GLU: $enable_glu"
1913echo " GLw: $enable_glw (Motif: $enable_motif)"
1914echo " glut: $enable_glut"
1915
1916dnl EGL
1917echo ""
1918echo " EGL: $enable_egl"
1919if test "$enable_egl" = yes; then
1920 echo " EGL platforms: $EGL_PLATFORMS"
Chia-I Wu12300502010-10-31 21:01:54 +08001921
1922 egl_drivers=""
1923 for d in $EGL_DRIVERS_DIRS; do
Chia-I Wuc98ea262011-01-07 16:30:08 +08001924 egl_drivers="$egl_drivers builtin:egl_$d"
Chia-I Wu12300502010-10-31 21:01:54 +08001925 done
1926
Chia-I Wu815faa42010-10-29 12:34:44 +08001927 if test "$enable_gallium" = yes -a "$HAVE_ST_EGL" = yes; then
Chia-I Wu12300502010-10-31 21:01:54 +08001928 echo " EGL drivers: ${egl_drivers} egl_gallium"
1929 echo " EGL Gallium STs:$EGL_CLIENT_APIS"
Chia-I Wu815faa42010-10-29 12:34:44 +08001930 else
Chia-I Wu12300502010-10-31 21:01:54 +08001931 echo " EGL drivers: $egl_drivers"
Chia-I Wu815faa42010-10-29 12:34:44 +08001932 fi
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001933fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001934
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001935echo ""
Eric Anholt1a8b1272010-05-21 12:17:24 -07001936if test "x$MESA_LLVM" = x1; then
Jakob Bornecrantzfe0fe672010-04-28 13:38:58 +01001937 echo " llvm: yes"
1938 echo " llvm-config: $LLVM_CONFIG"
1939 echo " llvm-version: $LLVM_VERSION"
1940else
1941 echo " llvm: no"
1942fi
1943
1944echo ""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001945if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1946 echo " Gallium: yes"
1947 echo " Gallium dirs: $GALLIUM_DIRS"
Keith Whitwell51bff092010-03-11 14:43:00 +00001948 echo " Target dirs: $GALLIUM_TARGET_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001949 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001950 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001951 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1952else
1953 echo " Gallium: no"
1954fi
1955
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001956dnl Libraries
1957echo ""
1958echo " Shared libs: $enable_shared"
1959echo " Static libs: $enable_static"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001960
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001961dnl Compiler options
1962# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1963cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1964 $SED 's/^ *//;s/ */ /;s/ *$//'`
1965cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1966 $SED 's/^ *//;s/ */ /;s/ *$//'`
1967defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1968echo ""
1969echo " CFLAGS: $cflags"
1970echo " CXXFLAGS: $cxxflags"
1971echo " Macros: $defines"
Kenneth Graunke3acc8262010-10-25 13:52:58 -07001972echo ""
1973echo " PYTHON2: $PYTHON2"
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001974
Dan Nicholsondca1b792007-10-23 09:25:58 -07001975echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07001976echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001977echo ""