blob: cf2e200db3f8688a224c6085ad91b57be465e068 [file] [log] [blame]
Dan Nicholsondca1b792007-10-23 09:25:58 -07001dnl Process this file with autoconf to create configure.
2
Dan Nicholson297e16c2008-05-05 15:42:53 -07003AC_PREREQ([2.59])
Dan Nicholsondca1b792007-10-23 09:25:58 -07004
Dan Nicholson00994ac2008-04-30 15:06:00 -07005dnl Versioning - scrape the version from configs/default
6m4_define([mesa_version],
Vinson Lee48f8a762010-05-11 12:33:30 -07007 [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n' | tr -d '\r'])])
Dan Nicholson356f3112009-04-29 06:49:27 -07008m4_ifval(mesa_version,,
9 [m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])])
Dan Nicholsondca1b792007-10-23 09:25:58 -070010
Dan Nicholsone97ab722008-07-01 08:55:42 -070011dnl Tell the user about autoconf.html in the --help output
12m4_divert_once([HELP_END], [
13See docs/autoconf.html for more details on the options for Mesa.])
14
Dan Nicholson00994ac2008-04-30 15:06:00 -070015AC_INIT([Mesa],[mesa_version],
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -080016 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
Dan Nicholson297e16c2008-05-05 15:42:53 -070017AC_CONFIG_AUX_DIR([bin])
Dan Nicholsondca1b792007-10-23 09:25:58 -070018AC_CANONICAL_HOST
19
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -070020dnl Versions for external dependencies
Eric Anholt859828c2009-10-08 17:18:12 -070021LIBDRM_REQUIRED=2.4.15
Fabio Pedrettiae1c0a02009-12-22 10:43:35 +100022LIBDRM_RADEON_REQUIRED=2.4.17
Kristian Høgsbergaa0cd702010-02-15 10:44:05 -050023DRI2PROTO_REQUIRED=2.1
Jesse Barnesf2f83d92010-01-11 17:28:10 -050024GLPROTO_REQUIRED=1.4.11
Jakob Bornecrantz683a0992010-03-11 19:23:15 +000025LIBDRM_XORG_REQUIRED=2.4.17
26LIBKMS_XORG_REQUIRED=1.0.0
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -070027
Dan Nicholsondca1b792007-10-23 09:25:58 -070028dnl Check for progs
29AC_PROG_CPP
30AC_PROG_CC
31AC_PROG_CXX
Dan Nicholson297e16c2008-05-05 15:42:53 -070032AC_CHECK_PROGS([MAKE], [gmake make])
33AC_PATH_PROG([MKDEP], [makedepend])
34AC_PATH_PROG([SED], [sed])
Dan Nicholson41b00702007-12-12 08:48:30 -080035
Dan Nicholsonbc302b22009-05-22 09:39:02 -070036dnl Our fallback install-sh is a symlink to minstall. Use the existing
37dnl configuration in that case.
38AC_PROG_INSTALL
39test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
40
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070041dnl We need a POSIX shell for parts of the build. Assume we have one
42dnl in most cases.
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070043case "$host_os" in
44solaris*)
45 # Solaris /bin/sh is too old/non-POSIX compliant
46 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070047 SHELL="$POSIX_SHELL"
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070048 ;;
49esac
50
nobled2a501872010-08-29 20:03:37 -040051dnl clang is mostly GCC-compatible, but its version is much lower,
52dnl so we have to check for it.
53AC_MSG_CHECKING([if compiling with clang])
54
55AC_COMPILE_IFELSE(
56[AC_LANG_PROGRAM([], [[
57#ifndef __clang__
58 not clang
59#endif
60]])],
61[CLANG=yes], [CLANG=no])
62
63AC_MSG_RESULT([$CLANG])
64
Ian Romanick9aa3aa72010-03-03 15:59:37 -080065dnl If we're using GCC, make sure that it is at least version 3.3.0. Older
66dnl versions are explictly not supported.
nobled2a501872010-08-29 20:03:37 -040067if test "x$GCC" = xyes -a "x$CLANG" = xno; then
Ian Romanick9aa3aa72010-03-03 15:59:37 -080068 AC_MSG_CHECKING([whether gcc version is sufficient])
69 major=0
70 minor=0
71
72 GCC_VERSION=`$CC -dumpversion`
73 if test $? -eq 0; then
74 major=`echo $GCC_VERSION | cut -d. -f1`
75 minor=`echo $GCC_VERSION | cut -d. -f1`
76 fi
77
78 if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
79 AC_MSG_RESULT([no])
80 AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
81 else
82 AC_MSG_RESULT([yes])
83 fi
84fi
85
86
Dan Nicholsondb7fc632008-03-07 11:48:09 -080087MKDEP_OPTIONS=-fdepend
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050088dnl Ask gcc where it's keeping its secret headers
89if test "x$GCC" = xyes; then
Dan Nicholsona3d223f2009-01-30 10:52:09 -080090 for dir in include include-fixed; do
91 GCC_INCLUDES=`$CC -print-file-name=$dir`
92 if test "x$GCC_INCLUDES" != x && \
93 test "$GCC_INCLUDES" != "$dir" && \
94 test -d "$GCC_INCLUDES"; then
95 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
96 fi
97 done
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050098fi
Dan Nicholson297e16c2008-05-05 15:42:53 -070099AC_SUBST([MKDEP_OPTIONS])
Kristian Høgsbergbcecea62008-02-25 18:50:26 -0500100
Dan Nicholson41b00702007-12-12 08:48:30 -0800101dnl Make sure the pkg-config macros are defined
Dan Nicholson356f3112009-04-29 06:49:27 -0700102m4_ifndef([PKG_PROG_PKG_CONFIG],
103 [m4_fatal([Could not locate the pkg-config autoconf macros.
104 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
105 are in a different location, try setting the environment variable
106 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700107PKG_PROG_PKG_CONFIG()
108
109dnl LIB_DIR - library basename
110LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
Dan Nicholson297e16c2008-05-05 15:42:53 -0700111AC_SUBST([LIB_DIR])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700112
113dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
114_SAVE_LDFLAGS="$LDFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700115AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
116AC_SUBST([EXTRA_LIB_PATH])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700117
118dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
119_SAVE_CPPFLAGS="$CPPFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700120AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
121AC_SUBST([X11_INCLUDES])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700122
123dnl Compiler macros
124DEFINES=""
Dan Nicholson297e16c2008-05-05 15:42:53 -0700125AC_SUBST([DEFINES])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700126case "$host_os" in
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700127linux*|*-gnu*|gnu*)
Dan Nicholson29f603a2009-01-12 11:10:31 -0800128 DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700129 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700130solaris*)
131 DEFINES="$DEFINES -DPTHREADS -DSVR4"
132 ;;
Brian Paul97988902010-02-18 12:46:12 -0700133cygwin*)
134 DEFINES="$DEFINES -DPTHREADS"
135 ;;
Dan Nicholsondca1b792007-10-23 09:25:58 -0700136esac
137
138dnl Add flags for gcc and g++
139if test "x$GCC" = xyes; then
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800140 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
141
142 # Enable -fvisibility=hidden if using a gcc that supports it
143 save_CFLAGS="$CFLAGS"
Alan Coopersmithf8107a42010-01-21 16:42:58 -0800144 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800145 CFLAGS="$CFLAGS -fvisibility=hidden"
146 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
147 [CFLAGS="$save_CFLAGS" ; AC_MSG_RESULT([no])]);
Dan Nicholson0c275b62008-01-15 22:52:25 -0800148
149 # Work around aliasing bugs - developers should comment this out
150 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700151fi
152if test "x$GXX" = xyes; then
153 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -0800154
155 # Work around aliasing bugs - developers should comment this out
156 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700157fi
158
159dnl These should be unnecessary, but let the user set them if they want
Dan Nicholson297e16c2008-05-05 15:42:53 -0700160AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700161 Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700162AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
Dan Nicholsondca1b792007-10-23 09:25:58 -0700163 compiler. Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700164AC_SUBST([OPT_FLAGS])
165AC_SUBST([ARCH_FLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700166
167dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600168dnl Hacks to enable 32 or 64 bit build
169dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700170AC_ARG_ENABLE([32-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600171 [AS_HELP_STRING([--enable-32-bit],
172 [build 32-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700173 [enable_32bit="$enableval"],
174 [enable_32bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600175)
176if test "x$enable_32bit" = xyes; then
177 if test "x$GCC" = xyes; then
178 CFLAGS="$CFLAGS -m32"
Marc Dietrichc705e722009-08-31 08:56:33 -0700179 ARCH_FLAGS="$ARCH_FLAGS -m32"
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600180 fi
181 if test "x$GXX" = xyes; then
182 CXXFLAGS="$CXXFLAGS -m32"
183 fi
184fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700185AC_ARG_ENABLE([64-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600186 [AS_HELP_STRING([--enable-64-bit],
187 [build 64-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700188 [enable_64bit="$enableval"],
189 [enable_64bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600190)
191if test "x$enable_64bit" = xyes; then
192 if test "x$GCC" = xyes; then
193 CFLAGS="$CFLAGS -m64"
194 fi
195 if test "x$GXX" = xyes; then
196 CXXFLAGS="$CXXFLAGS -m64"
197 fi
198fi
199
200dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800201dnl shared/static libraries, mimic libtool options
202dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700203AC_ARG_ENABLE([static],
Dan Nicholson88586332007-11-15 08:59:57 -0800204 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800205 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700206 [enable_static="$enableval"],
207 [enable_static=no]
Dan Nicholson88586332007-11-15 08:59:57 -0800208)
209case "x$enable_static" in
210xyes|xno ) ;;
211x ) enable_static=no ;;
212* )
213 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
214 ;;
215esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700216AC_ARG_ENABLE([shared],
Dan Nicholson88586332007-11-15 08:59:57 -0800217 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800218 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700219 [enable_shared="$enableval"],
220 [enable_shared=yes]
Dan Nicholson88586332007-11-15 08:59:57 -0800221)
222case "x$enable_shared" in
223xyes|xno ) ;;
224x ) enable_shared=yes ;;
225* )
226 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
227 ;;
228esac
229
230dnl Can't have static and shared libraries, default to static if user
231dnl explicitly requested. If both disabled, set to static since shared
232dnl was explicitly requirested.
233case "x$enable_static$enable_shared" in
234xyesyes )
235 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
236 enable_shared=no
237 ;;
238xnono )
239 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
240 enable_static=yes
241 ;;
242esac
243
244dnl
245dnl mklib options
246dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700247AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
Dan Nicholson88586332007-11-15 08:59:57 -0800248if test "$enable_static" = yes; then
249 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
250fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700251AC_SUBST([MKLIB_OPTIONS])
Dan Nicholson88586332007-11-15 08:59:57 -0800252
Dan Nicholson23656c42007-12-12 09:02:31 -0800253dnl
254dnl other compiler options
255dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700256AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800257 [AS_HELP_STRING([--enable-debug],
258 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700259 [enable_debug="$enableval"],
260 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800261)
262if test "x$enable_debug" = xyes; then
263 DEFINES="$DEFINES -DDEBUG"
264 if test "x$GCC" = xyes; then
265 CFLAGS="$CFLAGS -g"
266 fi
267 if test "x$GXX" = xyes; then
268 CXXFLAGS="$CXXFLAGS -g"
269 fi
270fi
Dan Nicholson88586332007-11-15 08:59:57 -0800271
272dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700273dnl library names
274dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800275if test "$enable_static" = yes; then
Dan Nicholson8217f242009-02-11 15:16:00 -0800276 LIB_EXTENSION='a'
Dan Nicholson88586332007-11-15 08:59:57 -0800277else
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700278 case "$host_os" in
279 darwin* )
280 LIB_EXTENSION='dylib' ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +0100281 cygwin* )
Chia-I Wu70ae8bf2010-05-18 10:22:57 -0600282 LIB_EXTENSION='dll.a' ;;
Tom Fogal9282edf2009-10-13 10:55:33 -0700283 aix* )
284 LIB_EXTENSION='a' ;;
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700285 * )
286 LIB_EXTENSION='so' ;;
287 esac
Dan Nicholson88586332007-11-15 08:59:57 -0800288fi
Dan Nicholson8217f242009-02-11 15:16:00 -0800289
290GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
291GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
292GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
293GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
294OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800295EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500296GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
297GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
Chia-I Wu874ccd52010-05-04 22:43:05 +0800298VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
Dan Nicholson8217f242009-02-11 15:16:00 -0800299
300GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
301GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
302GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
303GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
304OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800305EGL_LIB_GLOB='lib$(EGL_LIB).*'${LIB_EXTENSION}'*'
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500306GLESv1_CM_LIB_GLOB='lib$(GLESv1_CM_LIB).*'${LIB_EXTENSION}'*'
307GLESv2_LIB_GLOB='lib$(GLESv2_LIB).*'${LIB_EXTENSION}'*'
Chia-I Wu874ccd52010-05-04 22:43:05 +0800308VG_LIB_GLOB='lib$(VG_LIB).*'${LIB_EXTENSION}'*'
Dan Nicholson8217f242009-02-11 15:16:00 -0800309
Dan Nicholson297e16c2008-05-05 15:42:53 -0700310AC_SUBST([GL_LIB_NAME])
311AC_SUBST([GLU_LIB_NAME])
312AC_SUBST([GLUT_LIB_NAME])
313AC_SUBST([GLW_LIB_NAME])
314AC_SUBST([OSMESA_LIB_NAME])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800315AC_SUBST([EGL_LIB_NAME])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500316AC_SUBST([GLESv1_CM_LIB_NAME])
317AC_SUBST([GLESv2_LIB_NAME])
Chia-I Wu874ccd52010-05-04 22:43:05 +0800318AC_SUBST([VG_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700319
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700320AC_SUBST([GL_LIB_GLOB])
321AC_SUBST([GLU_LIB_GLOB])
322AC_SUBST([GLUT_LIB_GLOB])
323AC_SUBST([GLW_LIB_GLOB])
324AC_SUBST([OSMESA_LIB_GLOB])
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800325AC_SUBST([EGL_LIB_GLOB])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500326AC_SUBST([GLESv1_CM_LIB_GLOB])
327AC_SUBST([GLESv2_LIB_GLOB])
Chia-I Wu874ccd52010-05-04 22:43:05 +0800328AC_SUBST([VG_LIB_GLOB])
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700329
Dan Nicholsondca1b792007-10-23 09:25:58 -0700330dnl
Dan Nicholson871125a2008-06-04 13:00:35 -0700331dnl Arch/platform-specific settings
332dnl
333AC_ARG_ENABLE([asm],
334 [AS_HELP_STRING([--disable-asm],
335 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
336 [enable_asm="$enableval"],
337 [enable_asm=yes]
338)
339asm_arch=""
340ASM_FLAGS=""
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800341MESA_ASM_SOURCES=""
342GLAPI_ASM_SOURCES=""
Dan Nicholson871125a2008-06-04 13:00:35 -0700343AC_MSG_CHECKING([whether to enable assembly])
344test "x$enable_asm" = xno && AC_MSG_RESULT([no])
345# disable if cross compiling on x86/x86_64 since we must run gen_matypes
346if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
347 case "$host_cpu" in
348 i?86 | x86_64)
349 enable_asm=no
350 AC_MSG_RESULT([no, cross compiling])
351 ;;
352 esac
353fi
354# check for supported arches
355if test "x$enable_asm" = xyes; then
356 case "$host_cpu" in
357 i?86)
358 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100359 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700360 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
361 ;;
362 esac
363 ;;
364 x86_64)
365 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100366 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700367 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
368 ;;
369 esac
370 ;;
371 powerpc)
372 case "$host_os" in
373 linux*)
374 asm_arch=ppc
375 ;;
376 esac
377 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800378 sparc*)
379 case "$host_os" in
380 linux*)
381 asm_arch=sparc
382 ;;
383 esac
384 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700385 esac
386
387 case "$asm_arch" in
388 x86)
Dan Nicholson61e925f2009-02-11 10:42:34 -0800389 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800390 MESA_ASM_SOURCES='$(X86_SOURCES)'
391 GLAPI_ASM_SOURCES='$(X86_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700392 AC_MSG_RESULT([yes, x86])
393 ;;
394 x86_64)
395 ASM_FLAGS="-DUSE_X86_64_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800396 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
397 GLAPI_ASM_SOURCES='$(X86-64_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700398 AC_MSG_RESULT([yes, x86_64])
399 ;;
400 ppc)
401 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800402 MESA_ASM_SOURCES='$(PPC_SOURCES)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700403 AC_MSG_RESULT([yes, ppc])
404 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800405 sparc)
406 ASM_FLAGS="-DUSE_SPARC_ASM"
407 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
408 GLAPI_ASM_SOURCES='$(SPARC_API)'
409 AC_MSG_RESULT([yes, sparc])
410 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700411 *)
412 AC_MSG_RESULT([no, platform not supported])
413 ;;
414 esac
415fi
416AC_SUBST([ASM_FLAGS])
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800417AC_SUBST([MESA_ASM_SOURCES])
418AC_SUBST([GLAPI_ASM_SOURCES])
Dan Nicholson871125a2008-06-04 13:00:35 -0700419
420dnl PIC code macro
421MESA_PIC_FLAGS
422
423dnl Check to see if dlopen is in default libraries (like Solaris, which
424dnl has it in libc), or if libdl is needed to get it.
425AC_CHECK_FUNC([dlopen], [],
426 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
Chia-I Wu08f4bc02010-07-16 20:09:29 +0800427AC_SUBST([DLOPEN_LIBS])
Dan Nicholson871125a2008-06-04 13:00:35 -0700428
Dan Nicholson985e1cd2008-06-04 13:17:06 -0700429dnl See if posix_memalign is available
430AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
431
Dan Nicholson871125a2008-06-04 13:00:35 -0700432dnl SELinux awareness.
433AC_ARG_ENABLE([selinux],
434 [AS_HELP_STRING([--enable-selinux],
435 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
436 [MESA_SELINUX="$enableval"],
437 [MESA_SELINUX=no])
438if test "x$enable_selinux" = "xyes"; then
439 AC_CHECK_HEADER([selinux/selinux.h],[],
440 [AC_MSG_ERROR([SELinux headers not found])])
441 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
442 [AC_MSG_ERROR([SELinux library not found])])
443 SELINUX_LIBS="-lselinux"
444 DEFINES="$DEFINES -DMESA_SELINUX"
445fi
446
Dan Nicholson871125a2008-06-04 13:00:35 -0700447dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800448dnl Driver configuration. Options are xlib, dri and osmesa right now.
Kristian Høgsberg43875802010-02-25 15:49:18 -0500449dnl More later: fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800450dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700451default_driver="xlib"
452
453case "$host_os" in
454linux*)
455 case "$host_cpu" in
David S. Miller32dc28a2009-02-24 20:06:05 -0700456 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700457 esac
458 ;;
Julien Cristau98fcdf32008-10-28 18:56:05 +0100459*freebsd* | dragonfly*)
Eric Anholt711222b2008-04-18 15:03:01 -0700460 case "$host_cpu" in
Robert Noland48f05432009-04-10 11:41:27 -0500461 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700462 esac
463 ;;
464esac
465
Dan Nicholson297e16c2008-05-05 15:42:53 -0700466AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800467 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700468 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700469 [mesa_driver="$withval"],
470 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800471dnl Check for valid option
472case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800473xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800474 ;;
475*)
476 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
477 ;;
478esac
479
Eric Anholt0a1b54d2010-06-21 11:29:15 -0700480PKG_CHECK_MODULES([TALLOC], [talloc])
Eric Anholt639cdd32010-08-22 17:34:18 -0700481AC_SUBST([TALLOC_LIBS])
482AC_SUBST([TALLOC_CFLAGS])
Eric Anholt0a1b54d2010-06-21 11:29:15 -0700483
Dan Nicholson44d99142007-12-05 18:47:01 -0800484dnl
485dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700486dnl
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800487
488dnl this variable will be prepended to SRC_DIRS and is not exported
Chia-I Wu296adbd2010-04-26 12:56:44 +0800489CORE_DIRS="mapi/glapi glsl mesa"
Chia-I Wu99a37ed2010-01-05 17:39:05 +0800490
Jakob Bornecrantz05281062010-06-05 13:33:58 +0200491SRC_DIRS=""
Dan Nicholsondca1b792007-10-23 09:25:58 -0700492GLU_DIRS="sgi"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100493GALLIUM_DIRS="auxiliary drivers state_trackers"
Keith Whitwell51bff092010-03-11 14:43:00 +0000494GALLIUM_TARGET_DIRS=""
Jakob Bornecrantzc9f98672010-03-16 13:54:18 +0000495GALLIUM_WINSYS_DIRS="sw"
Corbin Simpson25609782010-06-22 22:00:43 -0700496GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug identity"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100497GALLIUM_STATE_TRACKERS_DIRS=""
498
Dan Nicholson44d99142007-12-05 18:47:01 -0800499case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800500xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800501 DRIVER_DIRS="x11"
Jakob Bornecrantzc9f98672010-03-16 13:54:18 +0000502 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
Keith Whitwell51bff092010-03-11 14:43:00 +0000503 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
Dan Nicholson44d99142007-12-05 18:47:01 -0800504 ;;
505dri)
Kristian Høgsberg6e8897f2010-02-09 09:58:36 -0500506 SRC_DIRS="$SRC_DIRS glx"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100507 DRIVER_DIRS="dri"
Jakob Bornecrantz23a915e2010-06-23 03:31:18 +0200508 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri"
Dan Nicholson44d99142007-12-05 18:47:01 -0800509 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800510osmesa)
511 DRIVER_DIRS="osmesa"
512 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800513esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700514AC_SUBST([SRC_DIRS])
515AC_SUBST([GLU_DIRS])
516AC_SUBST([DRIVER_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100517AC_SUBST([GALLIUM_DIRS])
Keith Whitwell51bff092010-03-11 14:43:00 +0000518AC_SUBST([GALLIUM_TARGET_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100519AC_SUBST([GALLIUM_WINSYS_DIRS])
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +0000520AC_SUBST([GALLIUM_DRIVERS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100521AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
Dave Airlie81fe1982010-04-22 14:59:29 +1000522AC_SUBST([MESA_LLVM])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700523
524dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700525dnl Find out if X is available. The variable have_x is set if libX11 is
Dan Nicholson99803a42008-07-01 09:03:15 -0700526dnl found to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700527dnl
528if test -n "$PKG_CONFIG"; then
529 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700530 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700531 x11_pkgconfig=yes
532 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700533 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700534 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700535 ])
536 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700537else
538 x11_pkgconfig=no
539fi
540dnl Use the autoconf macro if no pkg-config files
Jeff Smith8d86d392010-03-12 18:55:09 -0600541if test "$x11_pkgconfig" = yes; then
Dan Nicholsone725ef12010-03-15 20:53:56 -0700542 PKG_CHECK_MODULES([X11], [x11])
Jeff Smith8d86d392010-03-12 18:55:09 -0600543else
Dan Nicholsondca1b792007-10-23 09:25:58 -0700544 AC_PATH_XTRA
Dan Nicholsone725ef12010-03-15 20:53:56 -0700545 test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
546 test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
547 AC_SUBST([X11_CFLAGS])
548 AC_SUBST([X11_LIBS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700549fi
550
Dan Nicholson99803a42008-07-01 09:03:15 -0700551dnl Try to tell the user that the --x-* options are only used when
552dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
553m4_divert_once([HELP_BEGIN],
554[These options are only used when the X libraries cannot be found by the
555pkg-config utility.])
556
Dan Nicholson44d99142007-12-05 18:47:01 -0800557dnl We need X for xlib and dri, so bomb now if it's not found
558case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800559xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800560 if test "$no_x" = yes; then
561 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
562 fi
563 ;;
564esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700565
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700566dnl XCB - this is only used for GLX right now
567AC_ARG_ENABLE([xcb],
568 [AS_HELP_STRING([--enable-xcb],
569 [use XCB for GLX @<:@default=disabled@:>@])],
570 [enable_xcb="$enableval"],
571 [enable_xcb=no])
572if test "x$enable_xcb" = xyes; then
573 DEFINES="$DEFINES -DUSE_XCB"
574else
575 enable_xcb=no
576fi
577
Dan Nicholson44d99142007-12-05 18:47:01 -0800578dnl
579dnl libGL configuration per driver
580dnl
581case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800582xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800583 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700584 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800585 GL_PC_REQ_PRIV="x11 xext"
Dan Nicholsona1307182007-12-12 17:49:49 -0800586 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
587 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800588 else
589 # should check these...
590 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
591 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800592 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
593 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson44d99142007-12-05 18:47:01 -0800594 fi
Jon TURNEY63563032010-08-30 12:41:15 +0100595 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS"
596 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $TALLOC_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800597
598 # if static, move the external libraries to the programs
599 # and empty the libraries for libGL
600 if test "$enable_static" = yes; then
601 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
602 GL_LIB_DEPS=""
603 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800604 ;;
605dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800606 # DRI must be shared, I think
607 if test "$enable_static" = yes; then
608 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
609 fi
610
Dan Nicholson44d99142007-12-05 18:47:01 -0800611 # Check for libdrm
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -0700612 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
613 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
Jesse Barnesf2f83d92010-01-11 17:28:10 -0500614 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
Jesse Barnesed59b132010-01-13 15:48:14 -0500615 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
616 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
Dan Nicholson44d99142007-12-05 18:47:01 -0800617
618 # find the DRI deps for libGL
619 if test "$x11_pkgconfig" = yes; then
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700620 # add xcb modules if necessary
621 dri_modules="x11 xext xxf86vm xdamage xfixes"
622 if test "$enable_xcb" = yes; then
623 dri_modules="$dri_modules x11-xcb xcb-glx"
624 fi
625
626 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800627 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Dan Nicholson44d99142007-12-05 18:47:01 -0800628 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
629 GL_LIB_DEPS="$DRIGL_LIBS"
630 else
631 # should check these...
632 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
633 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800634 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
635 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700636
637 # XCB can only be used from pkg-config
638 if test "$enable_xcb" = yes; then
639 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800640 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700641 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
642 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
643 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800644 fi
645
646 # need DRM libs, -lpthread, etc.
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700647 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
648 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500649 GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg74399d42010-05-02 09:51:13 -0400650 GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500651 GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Kristian Høgsberg74399d42010-05-02 09:51:13 -0400652 GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800653 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800654osmesa)
655 # No libGL for osmesa
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700656 GL_LIB_DEPS=""
Dan Nicholson979ff512007-12-05 18:47:01 -0800657 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800658esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700659AC_SUBST([GL_LIB_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800660AC_SUBST([GL_PC_REQ_PRIV])
661AC_SUBST([GL_PC_LIB_PRIV])
662AC_SUBST([GL_PC_CFLAGS])
663AC_SUBST([DRI_PC_REQ_PRIV])
Li Pengc33c1912010-07-30 12:26:15 +0800664AC_SUBST([GLESv1_CM_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -0400665AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500666AC_SUBST([GLESv2_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -0400667AC_SUBST([GLESv2_PC_LIB_PRIV])
668
Dan Nicholsondca1b792007-10-23 09:25:58 -0700669
670dnl
671dnl More X11 setup
672dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800673if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700674 DEFINES="$DEFINES -DUSE_XSHM"
675fi
676
677dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800678dnl More DRI setup
679dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700680AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800681 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800682 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700683 [GLX_USE_TLS="$enableval"],
684 [GLX_USE_TLS=no])
Dan Nicholson44d99142007-12-05 18:47:01 -0800685dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700686AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800687 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700688 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700689 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700690 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700691AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Chow Loong Jin35506de2009-10-28 14:34:14 +0800692dnl Extra search path for DRI drivers
693AC_ARG_WITH([dri-searchpath],
694 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
695 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
696 [DRI_DRIVER_SEARCH_DIR="$withval"],
697 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
698AC_SUBST([DRI_DRIVER_SEARCH_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800699dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700700AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800701 [AS_HELP_STRING([--disable-driglx-direct],
Chia-I Wucf588ab2010-07-06 14:34:43 +0800702 [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700703 [driglx_direct="$enableval"],
704 [driglx_direct="yes"])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800705dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700706AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800707 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholson5cae1b72008-06-30 10:28:02 -0700708 [comma delimited DRI drivers list, e.g.
Michel Dänzercade0712009-07-10 14:49:46 +0200709 "swrast,i965,radeon" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700710 [with_dri_drivers="$withval"],
711 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800712if test "x$with_dri_drivers" = x; then
713 with_dri_drivers=no
714fi
715
Kristian Høgsberg0f680322010-04-27 13:42:33 -0400716dnl Determine which APIs to support
717AC_ARG_ENABLE([opengl],
718 [AS_HELP_STRING([--disable-opengl],
719 [disable support for standard OpenGL API @<:@default=no@:>@])],
720 [enable_opengl="$enableval"],
721 [enable_opengl=yes])
722AC_ARG_ENABLE([gles1],
723 [AS_HELP_STRING([--enable-gles1],
724 [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
725 [enable_gles1="$enableval"],
726 [enable_gles1=no])
727AC_ARG_ENABLE([gles2],
728 [AS_HELP_STRING([--enable-gles2],
729 [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
730 [enable_gles2="$enableval"],
731 [enable_gles2=no])
Chia-I Wu63ab2502010-05-05 15:38:02 +0800732AC_ARG_ENABLE([gles-overlay],
733 [AS_HELP_STRING([--enable-gles-overlay],
734 [build separate OpenGL ES only libraries @<:@default=no@:>@])],
735 [enable_gles_overlay="$enableval"],
736 [enable_gles_overlay=no])
Kristian Høgsberg0f680322010-04-27 13:42:33 -0400737
738API_DEFINES=""
Chia-I Wu87cc2da2010-05-12 14:17:17 +0800739GLES_OVERLAY=0
Kristian Høgsberg0f680322010-04-27 13:42:33 -0400740if test "x$enable_opengl" = xno; then
741 API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
742else
743 API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
744fi
745if test "x$enable_gles1" = xyes; then
746 API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
747fi
748if test "x$enable_gles2" = xyes; then
749 API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
750fi
Chia-I Wu63ab2502010-05-05 15:38:02 +0800751if test "x$enable_gles_overlay" = xyes -o \
752 "x$enable_gles1" = xyes -o "x$enable_gles2" = xyes; then
Chia-I Wu296adbd2010-04-26 12:56:44 +0800753 CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
Chia-I Wu63ab2502010-05-05 15:38:02 +0800754 if test "x$enable_gles_overlay" = xyes; then
Chia-I Wu87cc2da2010-05-12 14:17:17 +0800755 GLES_OVERLAY=1
Chia-I Wu63ab2502010-05-05 15:38:02 +0800756 fi
Kristian Høgsberg9339c122010-03-05 19:01:43 -0500757fi
Kristian Høgsberg0f680322010-04-27 13:42:33 -0400758AC_SUBST([API_DEFINES])
Chia-I Wu87cc2da2010-05-12 14:17:17 +0800759AC_SUBST([GLES_OVERLAY])
Kristian Høgsberg0f680322010-04-27 13:42:33 -0400760
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800761dnl If $with_dri_drivers is yes, directories will be added through
762dnl platform checks
763DRI_DIRS=""
764case "$with_dri_drivers" in
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100765no) ;;
766yes)
767 DRI_DIRS="yes"
768 ;;
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800769*)
770 # verify the requested driver directories exist
Dan Nicholsone6e4f252008-07-06 14:17:39 -0700771 dri_drivers=`IFS=', '; echo $with_dri_drivers`
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800772 for driver in $dri_drivers; do
773 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
774 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
775 done
776 DRI_DIRS="$dri_drivers"
777 ;;
778esac
779
Dan Nicholson44d99142007-12-05 18:47:01 -0800780dnl Set DRI_DIRS, DEFINES and LIB_DEPS
781if test "$mesa_driver" = dri; then
782 # Use TLS in GLX?
783 if test "x$GLX_USE_TLS" = xyes; then
784 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
785 fi
786
Dan Nicholson44d99142007-12-05 18:47:01 -0800787 # Platform specific settings and drivers to build
788 case "$host_os" in
789 linux*)
790 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
Dan Nicholson44d99142007-12-05 18:47:01 -0800791 if test "x$driglx_direct" = xyes; then
792 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
793 fi
Jerome Glisse14f79d42008-12-18 13:36:07 +0100794 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800795
796 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800797 x86_64)
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -0500798 # sis is missing because they have not be converted to use
799 # the new interface. i810 are missing because there is no
800 # x86-64 system where they could *ever* be used.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100801 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400802 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +0300803 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800804 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800805 ;;
806 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800807 # Build only the drivers for cards that exist on PowerPC.
808 # At some point MGA will be added, but not yet.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100809 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400810 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800811 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800812 ;;
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000813 sparc*)
814 # Build only the drivers for cards that exist on sparc`
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100815 if test "x$DRI_DIRS" = "xyes"; then
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -0500816 DRI_DIRS="mach64 r128 r200 r300 r600 radeon swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000817 fi
818 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800819 esac
820 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700821 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800822 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
823 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
824 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
825 if test "x$driglx_direct" = xyes; then
826 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
827 fi
828 if test "x$GXX" = xyes; then
829 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
830 fi
831
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100832 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400833 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +0300834 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800835 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800836 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700837 gnu*)
838 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
839 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
840 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700841 solaris*)
842 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
843 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
844 if test "x$driglx_direct" = xyes; then
845 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
846 fi
847 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800848 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800849
850 # default drivers
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100851 if test "x$DRI_DIRS" = "xyes"; then
Corbin Simpson8e4657a2009-10-22 12:29:30 -0700852 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
Kristian Høgsberg79aeafd2010-02-25 16:12:58 -0500853 savage sis tdfx unichrome swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -0800854 fi
855
Dan Nicholson44d99142007-12-05 18:47:01 -0800856 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
857
858 # Check for expat
859 EXPAT_INCLUDES=""
860 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700861 AC_ARG_WITH([expat],
862 [AS_HELP_STRING([--with-expat=DIR],
863 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800864 EXPAT_INCLUDES="-I$withval/include"
865 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
866 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
867 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
868 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700869 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
870 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
871 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800872
873 # put all the necessary libs together
Eric Anholt0a1b54d2010-06-21 11:29:15 -0700874 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS $TALLOC_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800875fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700876AC_SUBST([DRI_DIRS])
877AC_SUBST([EXPAT_INCLUDES])
878AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800879
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500880case $DRI_DIRS in
881*i915*|*i965*)
Eric Anholt73de09f2010-06-07 09:25:10 -0700882 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= 2.4.21])
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500883 ;;
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -0500884esac
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500885
Kristian Høgsberg27fe7a72010-01-07 10:29:29 -0500886case $DRI_DIRS in
Kristian Høgsberg8616cec2010-01-01 17:03:33 -0500887*radeon*|*r200*|*r300*|*r600*)
888 PKG_CHECK_MODULES([LIBDRM_RADEON],
889 [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
890 HAVE_LIBDRM_RADEON=yes,
891 HAVE_LIBDRM_RADEON=no)
892
893 if test "$HAVE_LIBDRM_RADEON" = yes; then
894 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
895 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
896 fi
897 ;;
898esac
899AC_SUBST([RADEON_CFLAGS])
900AC_SUBST([RADEON_LDFLAGS])
901
902
Dan Nicholson44d99142007-12-05 18:47:01 -0800903dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700904dnl OSMesa configuration
905dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800906if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800907 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800908else
Dan Nicholson544ab202007-12-30 08:41:53 -0800909 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800910fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700911AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800912 [AS_HELP_STRING([--enable-gl-osmesa],
Dan Nicholsoncbf30fc2010-06-16 09:23:17 -0700913 [enable OSMesa with libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700914 [gl_osmesa="$enableval"],
915 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800916if test "x$gl_osmesa" = xyes; then
917 if test "$mesa_driver" = osmesa; then
918 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800919 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800920 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800921 fi
922fi
923
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800924dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700925AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800926 [AS_HELP_STRING([--with-osmesa-bits=BITS],
927 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700928 [osmesa_bits="$withval"],
929 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800930if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
931 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
932 osmesa_bits=8
933fi
934case "x$osmesa_bits" in
935x8)
936 OSMESA_LIB=OSMesa
937 ;;
938x16|x32)
939 OSMESA_LIB="OSMesa$osmesa_bits"
940 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
941 ;;
942*)
943 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
944 ;;
945esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700946AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800947
Dan Nicholsoncbf30fc2010-06-16 09:23:17 -0700948case "$DRIVER_DIRS" in
949*osmesa*)
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700950 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800951 if test "$enable_static" = no; then
Jon TURNEYe637f8b2010-08-30 12:41:16 +0100952 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800953 else
954 OSMESA_LIB_DEPS=""
955 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800956 OSMESA_MESA_DEPS=""
Jon TURNEYe637f8b2010-08-30 12:41:16 +0100957 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS $TALLOC_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -0800958 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800959esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700960AC_SUBST([OSMESA_LIB_DEPS])
961AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800962AC_SUBST([OSMESA_PC_REQ])
963AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700964
965dnl
Dan Nicholson53b37342009-02-25 17:45:34 -0800966dnl EGL configuration
967dnl
Dan Nicholson66f97862009-04-29 12:11:43 -0700968AC_ARG_ENABLE([egl],
969 [AS_HELP_STRING([--disable-egl],
970 [disable EGL library @<:@default=enabled@:>@])],
971 [enable_egl="$enableval"],
972 [enable_egl=yes])
973if test "x$enable_egl" = xyes; then
974 SRC_DIRS="$SRC_DIRS egl"
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800975 EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
976 EGL_DRIVERS_DIRS=""
Chia-I Wu2eb7a2f2010-02-05 10:46:11 +0800977 if test "$enable_static" != yes; then
Chia-I Wud4c1ee02009-12-21 11:13:18 +0800978 # build egl_glx when libGL is built
Chia-I Wu2eb7a2f2010-02-05 10:46:11 +0800979 if test "$mesa_driver" != osmesa; then
980 EGL_DRIVERS_DIRS="glx"
981 fi
982
Chia-I Wu39ae9652010-07-16 19:48:52 +0800983 if test "$mesa_driver" = dri; then
984 # build egl_dri2 when xcb-dri2 is available
985 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
986 [have_xcb_dri2=yes],[have_xcb_dri2=no])
987 PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
988 [have_libudev=yes],[have_libudev=no])
989
990 if test "$have_xcb_dri2" = yes; then
991 EGL_DRIVER_DRI2=dri2
992 DEFINES="$DEFINES -DHAVE_XCB_DRI2"
993 if test "$have_libudev" = yes; then
994 DEFINES="$DEFINES -DHAVE_LIBUDEV"
995 fi
996 fi
997 fi
Kristian Høgsberg2168b872010-06-02 22:48:06 -0400998
999 EGL_DRIVERS_DIRS="$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2"
Kristian Høgsberg42fa0092010-02-03 10:18:28 -05001000 fi
Dan Nicholson53b37342009-02-25 17:45:34 -08001001fi
Dan Nicholson53b37342009-02-25 17:45:34 -08001002AC_SUBST([EGL_LIB_DEPS])
Chia-I Wud4c1ee02009-12-21 11:13:18 +08001003AC_SUBST([EGL_DRIVERS_DIRS])
Dan Nicholson53b37342009-02-25 17:45:34 -08001004
1005dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -07001006dnl GLU configuration
1007dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -07001008AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001009 [AS_HELP_STRING([--disable-glu],
1010 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001011 [enable_glu="$enableval"],
1012 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001013if test "x$enable_glu" = xyes; then
1014 SRC_DIRS="$SRC_DIRS glu"
1015
Dan Nicholson979ff512007-12-05 18:47:01 -08001016 case "$mesa_driver" in
1017 osmesa)
Dan Nicholson979ff512007-12-05 18:47:01 -08001018 # Link libGLU to libOSMesa instead of libGL
1019 GLU_LIB_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -08001020 GLU_PC_REQ="osmesa"
Dan Nicholson88586332007-11-15 08:59:57 -08001021 if test "$enable_static" = no; then
1022 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
1023 else
1024 GLU_MESA_DEPS=""
1025 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001026 ;;
1027 *)
Dan Nicholson88586332007-11-15 08:59:57 -08001028 # If static, empty GLU_LIB_DEPS and add libs for programs to link
Dan Nicholson71e208b2008-11-24 11:01:57 -08001029 GLU_PC_REQ="gl"
1030 GLU_PC_LIB_PRIV="-lm"
Dan Nicholson88586332007-11-15 08:59:57 -08001031 if test "$enable_static" = no; then
1032 GLU_LIB_DEPS="-lm"
1033 GLU_MESA_DEPS='-l$(GL_LIB)'
1034 else
1035 GLU_LIB_DEPS=""
1036 GLU_MESA_DEPS=""
1037 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
1038 fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001039 ;;
1040 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001041fi
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001042if test "$enable_static" = no; then
1043 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
1044fi
Dan Nicholson71e208b2008-11-24 11:01:57 -08001045GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
Dan Nicholson297e16c2008-05-05 15:42:53 -07001046AC_SUBST([GLU_LIB_DEPS])
1047AC_SUBST([GLU_MESA_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001048AC_SUBST([GLU_PC_REQ])
1049AC_SUBST([GLU_PC_REQ_PRIV])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001050AC_SUBST([GLU_PC_LIB_PRIV])
1051AC_SUBST([GLU_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001052
1053dnl
1054dnl GLw configuration
1055dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -07001056AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001057 [AS_HELP_STRING([--disable-glw],
1058 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001059 [enable_glw="$enableval"],
1060 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -08001061dnl Don't build GLw on osmesa
1062if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
1063 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
1064 enable_glw=no
1065fi
Dan Nicholson776c60d2008-07-18 07:40:41 -07001066AC_ARG_ENABLE([motif],
1067 [AS_HELP_STRING([--enable-motif],
1068 [use Motif widgets in GLw @<:@default=disabled@:>@])],
1069 [enable_motif="$enableval"],
1070 [enable_motif=no])
1071
Dan Nicholsondca1b792007-10-23 09:25:58 -07001072if test "x$enable_glw" = xyes; then
1073 SRC_DIRS="$SRC_DIRS glw"
1074 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001075 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001076 GLW_PC_REQ_PRIV="x11 xt"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001077 GLW_LIB_DEPS="$GLW_LIBS"
1078 else
1079 # should check these...
Dan Nicholson776c60d2008-07-18 07:40:41 -07001080 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001081 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
1082 GLW_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001083 fi
1084
1085 GLW_SOURCES="GLwDrawA.c"
1086 MOTIF_CFLAGS=
1087 if test "x$enable_motif" = xyes; then
1088 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
1089 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
1090 if test "x$MOTIF_CONFIG" != xno; then
1091 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
1092 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
1093 else
1094 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
1095 [AC_MSG_ERROR([Can't locate Motif headers])])
1096 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
1097 [AC_MSG_ERROR([Can't locate Motif Xm library])])
1098 fi
1099 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
1100 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001101 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
1102 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001103 fi
1104
Dan Nicholson88586332007-11-15 08:59:57 -08001105 # If static, empty GLW_LIB_DEPS and add libs for programs to link
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001106 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
Dan Nicholson88586332007-11-15 08:59:57 -08001107 if test "$enable_static" = no; then
1108 GLW_MESA_DEPS='-l$(GL_LIB)'
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001109 GLW_LIB_DEPS="$GLW_LIB_DEPS"
Dan Nicholson88586332007-11-15 08:59:57 -08001110 else
1111 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1112 GLW_LIB_DEPS=""
1113 GLW_MESA_DEPS=""
1114 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001115fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001116AC_SUBST([GLW_LIB_DEPS])
1117AC_SUBST([GLW_MESA_DEPS])
Dan Nicholson776c60d2008-07-18 07:40:41 -07001118AC_SUBST([GLW_SOURCES])
1119AC_SUBST([MOTIF_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001120AC_SUBST([GLW_PC_REQ_PRIV])
1121AC_SUBST([GLW_PC_LIB_PRIV])
1122AC_SUBST([GLW_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001123
1124dnl
1125dnl GLUT configuration
1126dnl
1127if test -f "$srcdir/include/GL/glut.h"; then
1128 default_glut=yes
1129else
1130 default_glut=no
1131fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001132AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001133 [AS_HELP_STRING([--disable-glut],
1134 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001135 [enable_glut="$enableval"],
1136 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001137
1138dnl Can't build glut if GLU not available
1139if test "x$enable_glu$enable_glut" = xnoyes; then
1140 AC_MSG_WARN([Disabling glut since GLU is disabled])
1141 enable_glut=no
1142fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001143dnl Don't build glut on osmesa
1144if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1145 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1146 enable_glut=no
1147fi
1148
Dan Nicholsondca1b792007-10-23 09:25:58 -07001149if test "x$enable_glut" = xyes; then
1150 SRC_DIRS="$SRC_DIRS glut/glx"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001151 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001152 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001153 GLUT_PC_REQ_PRIV="x11 xmu xi"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001154 GLUT_LIB_DEPS="$GLUT_LIBS"
1155 else
1156 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -08001157 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001158 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1159 GLUT_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001160 fi
John Hein96172542010-07-01 12:53:28 -07001161 if test "x$GCC" = xyes; then
1162 GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
1163 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001164 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1165 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001166
Dan Nicholson88586332007-11-15 08:59:57 -08001167 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1168 if test "$enable_static" = no; then
1169 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1170 else
1171 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1172 GLUT_LIB_DEPS=""
1173 GLUT_MESA_DEPS=""
1174 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001175fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001176AC_SUBST([GLUT_LIB_DEPS])
1177AC_SUBST([GLUT_MESA_DEPS])
1178AC_SUBST([GLUT_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001179AC_SUBST([GLUT_PC_REQ_PRIV])
1180AC_SUBST([GLUT_PC_LIB_PRIV])
1181AC_SUBST([GLUT_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001182
1183dnl
1184dnl Program library dependencies
1185dnl Only libm is added here if necessary as the libraries should
1186dnl be pulled in by the linker
1187dnl
1188if test "x$APP_LIB_DEPS" = x; then
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001189 case "$host_os" in
1190 solaris*)
1191 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1192 ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +01001193 cygwin*)
1194 APP_LIB_DEPS="-lX11"
1195 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001196 *)
1197 APP_LIB_DEPS="-lm"
1198 ;;
1199 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001200fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001201AC_SUBST([APP_LIB_DEPS])
1202AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001203
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001204dnl
1205dnl Gallium configuration
1206dnl
1207AC_ARG_ENABLE([gallium],
1208 [AS_HELP_STRING([--disable-gallium],
1209 [build gallium @<:@default=enabled@:>@])],
1210 [enable_gallium="$enableval"],
1211 [enable_gallium=yes])
1212if test "x$enable_gallium" = xyes; then
Jakob Bornecrantzbe38b322010-03-23 13:23:26 +00001213 SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
Dave Airlie81fe1982010-04-22 14:59:29 +10001214 AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
1215 [HAS_UDIS86="no"])
1216 AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001217fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001218
Dave Airlie81fe1982010-04-22 14:59:29 +10001219AC_SUBST([LLVM_CFLAGS])
1220AC_SUBST([LLVM_LIBS])
1221AC_SUBST([LLVM_LDFLAGS])
1222AC_SUBST([LLVM_VERSION])
1223
Chia-I Wu874ccd52010-05-04 22:43:05 +08001224VG_LIB_DEPS=""
Chia-I Wu63ab2502010-05-05 15:38:02 +08001225EGL_CLIENT_APIS='$(GL_LIB)'
1226if test "x$enable_gles_overlay" = xyes; then
1227 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
1228fi
Chia-I Wu874ccd52010-05-04 22:43:05 +08001229
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001230dnl
1231dnl Gallium state trackers configuration
1232dnl
1233AC_ARG_WITH([state-trackers],
1234 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1235 [comma delimited state_trackers list, e.g.
1236 "egl,glx" @<:@default=auto@:>@])],
1237 [with_state_trackers="$withval"],
1238 [with_state_trackers=yes])
1239
1240case "$with_state_trackers" in
1241no)
1242 GALLIUM_STATE_TRACKERS_DIRS=""
1243 ;;
1244yes)
1245 # look at what else is built
1246 case "$mesa_driver" in
Jakob Bornecrantz373e6712009-04-18 23:13:56 +01001247 xlib)
1248 GALLIUM_STATE_TRACKERS_DIRS=glx
1249 ;;
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001250 dri)
Jakob Bornecrantz5b1fc142010-03-25 18:29:51 +01001251 GALLIUM_STATE_TRACKERS_DIRS="dri"
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001252 HAVE_ST_DRI="yes"
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001253 if test "x$enable_egl" = xyes; then
Chia-I Wu3c967a92010-01-22 16:31:43 +08001254 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001255 HAVE_ST_EGL="yes"
Jakob Bornecrantzbc0532b2009-12-04 18:50:29 +00001256 fi
1257 # Have only tested st/xorg on 1.6.0 servers
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001258 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001259 HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
1260 HAVE_ST_XORG="no")
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001261 ;;
1262 esac
1263 ;;
1264*)
1265 # verify the requested state tracker exist
Chia-I Wu63ab2502010-05-05 15:38:02 +08001266 state_trackers=""
1267 _state_trackers=`IFS=', '; echo $with_state_trackers`
1268 for tracker in $_state_trackers; do
Chia-I Wue5d351d2009-12-23 11:18:00 +08001269 case "$tracker" in
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001270 dri)
1271 if test "x$mesa_driver" != xdri; then
1272 AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
1273 fi
1274 HAVE_ST_DRI="yes"
1275 ;;
Chia-I Wu3c967a92010-01-22 16:31:43 +08001276 egl)
Chia-I Wue5d351d2009-12-23 11:18:00 +08001277 if test "x$enable_egl" != xyes; then
Chia-I Wu3c967a92010-01-22 16:31:43 +08001278 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
Chia-I Wue5d351d2009-12-23 11:18:00 +08001279 fi
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001280 HAVE_ST_EGL="yes"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001281 ;;
1282 xorg)
Jakob Bornecrantz4f956882010-07-13 07:40:47 -07001283 PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001284 PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1285 PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001286 HAVE_ST_XORG="yes"
Chia-I Wue5d351d2009-12-23 11:18:00 +08001287 ;;
1288 es)
Chia-I Wu63ab2502010-05-05 15:38:02 +08001289 AC_MSG_WARN([state tracker 'es' has been replaced by --enable-gles-overlay])
1290
1291 if test "x$enable_gles_overlay" != xyes; then
1292 if test "x$enable_gles1" != xyes -a "x$enable_gles2" != xyes; then
1293 CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
1294 fi
Chia-I Wu87cc2da2010-05-12 14:17:17 +08001295 GLES_OVERLAY=1
Chia-I Wu63ab2502010-05-05 15:38:02 +08001296 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
Chia-I Wu296adbd2010-04-26 12:56:44 +08001297 fi
Chia-I Wu63ab2502010-05-05 15:38:02 +08001298 tracker=""
Chia-I Wue5d351d2009-12-23 11:18:00 +08001299 ;;
Chia-I Wu75143ef2010-04-16 18:12:37 +08001300 vega)
1301 CORE_DIRS="$CORE_DIRS mapi/vgapi"
Chia-I Wu874ccd52010-05-04 22:43:05 +08001302 VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
Chia-I Wu63ab2502010-05-05 15:38:02 +08001303 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
Chia-I Wu75143ef2010-04-16 18:12:37 +08001304 ;;
Chia-I Wue5d351d2009-12-23 11:18:00 +08001305 esac
Chia-I Wu63ab2502010-05-05 15:38:02 +08001306
1307 if test -n "$tracker"; then
1308 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1309 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
1310 if test -n "$state_trackers"; then
1311 state_trackers="$state_trackers $tracker"
1312 else
1313 state_trackers="$tracker"
1314 fi
1315 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001316 done
1317 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1318 ;;
1319esac
1320
Chia-I Wu874ccd52010-05-04 22:43:05 +08001321AC_SUBST([VG_LIB_DEPS])
Chia-I Wu63ab2502010-05-05 15:38:02 +08001322AC_SUBST([EGL_CLIENT_APIS])
1323
1324if test "x$HAVE_ST_EGL" = xyes; then
Chia-I Wud8e0e112010-06-29 14:04:27 +08001325 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
Chia-I Wucf588ab2010-07-06 14:34:43 +08001326 # define GLX_DIRECT_RENDERING even when the driver is not dri
1327 if test "x$mesa_driver" != xdri -a "x$driglx_direct" = xyes; then
1328 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1329 fi
Chia-I Wu63ab2502010-05-05 15:38:02 +08001330fi
Chia-I Wu874ccd52010-05-04 22:43:05 +08001331
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001332if test "x$HAVE_ST_XORG" = xyes; then
Jakob Bornecrantz683a0992010-03-11 19:23:15 +00001333 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1334 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1335 HAVE_XEXTPROTO_71="no")
1336fi
1337
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001338AC_ARG_WITH([egl-platforms],
1339 [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1340 [comma delimited native platforms libEGL supports, e.g.
1341 "x11,kms" @<:@default=auto@:>@])],
1342 [with_egl_platforms="$withval"],
1343 [with_egl_platforms=yes])
Chia-I Wu49381d62010-01-11 01:23:01 +08001344AC_ARG_WITH([egl-displays],
1345 [AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001346 [DEPRECATED. Use --with-egl-platforms instead])],
1347 [with_egl_platforms="$withval"])
Chia-I Wu49381d62010-01-11 01:23:01 +08001348
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001349EGL_PLATFORMS=""
1350case "$with_egl_platforms" in
Chia-I Wu49381d62010-01-11 01:23:01 +08001351yes)
1352 if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001353 EGL_PLATFORMS="x11"
Chia-I Wu49381d62010-01-11 01:23:01 +08001354 fi
1355 ;;
1356*)
1357 if test "x$enable_egl" != xyes; then
1358 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1359 fi
1360 # verify the requested driver directories exist
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001361 egl_platforms=`IFS=', '; echo $with_egl_platforms`
1362 for plat in $egl_platforms; do
1363 test -d "$srcdir/src/gallium/state_trackers/egl/$plat" || \
1364 AC_MSG_ERROR([EGL platform '$plat' does't exist])
1365 if test "$plat" = "fbdev"; then
Chia-I Wu8f3e48e2010-06-17 14:10:53 +08001366 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
1367 fi
Chia-I Wu49381d62010-01-11 01:23:01 +08001368 done
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001369 EGL_PLATFORMS="$egl_platforms"
Chia-I Wu49381d62010-01-11 01:23:01 +08001370 ;;
1371esac
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001372AC_SUBST([EGL_PLATFORMS])
Chia-I Wu49381d62010-01-11 01:23:01 +08001373
Chia-I Wu28c3e572010-01-23 20:18:43 +08001374AC_ARG_WITH([egl-driver-dir],
1375 [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1376 [directory for EGL drivers [[default=${libdir}/egl]]])],
1377 [EGL_DRIVER_INSTALL_DIR="$withval"],
1378 [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1379AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1380
Joel Bosveld8acca482009-03-06 08:46:08 +09001381AC_ARG_WITH([xorg-driver-dir],
1382 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1383 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1384 [XORG_DRIVER_INSTALL_DIR="$withval"],
1385 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1386AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1387
Tom Fogal7085dce2009-08-13 19:40:30 -06001388AC_ARG_WITH([max-width],
1389 [AS_HELP_STRING([--with-max-width=N],
1390 [Maximum framebuffer width (4096)])],
1391 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1392 AS_IF([test "${withval}" -gt "4096"],
1393 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1394)
1395AC_ARG_WITH([max-height],
1396 [AS_HELP_STRING([--with-max-height=N],
1397 [Maximum framebuffer height (4096)])],
1398 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1399 AS_IF([test "${withval}" -gt "4096"],
1400 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1401)
1402
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001403dnl
Dave Airlie81fe1982010-04-22 14:59:29 +10001404dnl Gallium LLVM
1405dnl
1406AC_ARG_ENABLE([gallium-llvm],
1407 [AS_HELP_STRING([--enable-gallium-llvm],
1408 [build gallium LLVM support @<:@default=disabled@:>@])],
1409 [enable_gallium_llvm="$enableval"],
1410 [enable_gallium_llvm=auto])
1411if test "x$enable_gallium_llvm" = xyes; then
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001412 if test "x$LLVM_CONFIG" != xno; then
1413 LLVM_VERSION=`$LLVM_CONFIG --version`
1414 LLVM_CFLAGS=`$LLVM_CONFIG --cflags`
1415 LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
1416
1417 if test "x$HAS_UDIS86" != xno; then
1418 LLVM_LIBS="$LLVM_LIBS -ludis86"
1419 DEFINES="$DEFINES -DHAVE_UDIS86"
Dave Airlie81fe1982010-04-22 14:59:29 +10001420 fi
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001421 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1422 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
Chia-I Wu3ecb8c22010-05-11 12:36:49 +08001423 DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001424 MESA_LLVM=1
1425 else
Dave Airlie81fe1982010-04-22 14:59:29 +10001426 MESA_LLVM=0
Dave Airlie22e8ddc2010-04-25 07:48:48 +10001427 fi
1428else
1429 MESA_LLVM=0
Dave Airlie81fe1982010-04-22 14:59:29 +10001430fi
1431
1432dnl
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001433dnl Gallium helper functions
1434dnl
1435gallium_check_st() {
Chia-I Wud8e0e112010-06-29 14:04:27 +08001436 if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001437 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1438 fi
1439 if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
1440 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1441 fi
Chia-I Wud8e0e112010-06-29 14:04:27 +08001442 if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001443 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1444 fi
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01001445}
1446
1447
1448dnl
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001449dnl Gallium SVGA configuration
1450dnl
1451AC_ARG_ENABLE([gallium-svga],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001452 [AS_HELP_STRING([--enable-gallium-svga],
1453 [build gallium SVGA @<:@default=disabled@:>@])],
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001454 [enable_gallium_svga="$enableval"],
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001455 [enable_gallium_svga=auto])
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001456if test "x$enable_gallium_svga" = xyes; then
Xavier Chantryff0987a2010-03-26 11:02:03 +01001457 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001458 gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx"
Jakob Bornecrantz5e6fff72009-07-19 09:22:31 +02001459elif test "x$enable_gallium_svga" = xauto; then
1460 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
Jakob Bornecrantz60769b22009-11-12 01:28:26 +01001461fi
1462
1463dnl
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001464dnl Gallium i915 configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001465dnl
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001466AC_ARG_ENABLE([gallium-i915],
1467 [AS_HELP_STRING([--enable-gallium-i915],
1468 [build gallium i915 @<:@default=disabled@:>@])],
1469 [enable_gallium_i915="$enableval"],
1470 [enable_gallium_i915=auto])
1471if test "x$enable_gallium_i915" = xyes; then
Jakob Bornecrantz44bafca2010-04-17 15:17:33 +01001472 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001473 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001474 gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001475elif test "x$enable_gallium_i915" = xauto; then
Jakob Bornecrantz44bafca2010-04-17 15:17:33 +01001476 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001477 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
1478fi
1479
1480dnl
1481dnl Gallium i965 configuration
1482dnl
1483AC_ARG_ENABLE([gallium-i965],
1484 [AS_HELP_STRING([--enable-gallium-i965],
1485 [build gallium i965 @<:@default=disabled@:>@])],
1486 [enable_gallium_i965="$enableval"],
1487 [enable_gallium_i965=auto])
1488if test "x$enable_gallium_i965" = xyes; then
1489 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001490 gallium_check_st "i965/drm" "dri-i965" "xorg-i965"
Jakob Bornecrantz7dce4f32010-06-11 13:00:16 +02001491elif test "x$enable_gallium_i965" = xauto; then
1492 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i965"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001493fi
1494
1495dnl
1496dnl Gallium Radeon configuration
1497dnl
1498AC_ARG_ENABLE([gallium-radeon],
1499 [AS_HELP_STRING([--enable-gallium-radeon],
1500 [build gallium radeon @<:@default=disabled@:>@])],
1501 [enable_gallium_radeon="$enableval"],
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001502 [enable_gallium_radeon=auto])
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001503if test "x$enable_gallium_radeon" = xyes; then
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001504 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Dave Airlie37f06542010-08-22 17:28:20 +10001505 gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
Jakob Bornecrantz877cadb2010-01-14 22:51:25 +00001506elif test "x$enable_gallium_radeon" = xauto; then
1507 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001508fi
1509
1510dnl
Jakob Bornecrantzaeee5262010-05-13 20:29:18 +01001511dnl Gallium Radeon r600g configuration
1512dnl
1513AC_ARG_ENABLE([gallium-r600],
1514 [AS_HELP_STRING([--enable-gallium-r600],
1515 [build gallium radeon @<:@default=disabled@:>@])],
1516 [enable_gallium_r600="$enableval"],
1517 [enable_gallium_r600=auto])
1518if test "x$enable_gallium_r600" = xyes; then
1519 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1520 gallium_check_st "r600/drm" "dri-r600"
1521fi
1522
1523dnl
Thierry Vignaud1402ea82009-09-14 11:48:51 -06001524dnl Gallium Nouveau configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001525dnl
1526AC_ARG_ENABLE([gallium-nouveau],
1527 [AS_HELP_STRING([--enable-gallium-nouveau],
1528 [build gallium nouveau @<:@default=disabled@:>@])],
1529 [enable_gallium_nouveau="$enableval"],
1530 [enable_gallium_nouveau=no])
1531if test "x$enable_gallium_nouveau" = xyes; then
Luca Barbierif9d09a22010-02-21 15:13:12 +01001532 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50"
Chia-I Wud8e0e112010-06-29 14:04:27 +08001533 gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001534fi
1535
Chia-I Wua1306f42010-01-22 15:51:51 +08001536dnl
1537dnl Gallium swrast configuration
1538dnl
1539AC_ARG_ENABLE([gallium-swrast],
1540 [AS_HELP_STRING([--enable-gallium-swrast],
Jakob Bornecrantzf5ba2cd2010-03-24 10:58:45 +01001541 [build gallium swrast @<:@default=auto@:>@])],
Chia-I Wua1306f42010-01-22 15:51:51 +08001542 [enable_gallium_swrast="$enableval"],
1543 [enable_gallium_swrast=auto])
George Sapountzis7b333292010-03-25 17:01:54 +02001544if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
Jakob Bornecrantz5b1fc142010-03-25 18:29:51 +01001545 if test "x$HAVE_ST_DRI" = xyes; then
George Sapountzis7b333292010-03-25 17:01:54 +02001546 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
Jakob Bornecrantzf5ba2cd2010-03-24 10:58:45 +01001547 fi
Chia-I Wua1306f42010-01-22 15:51:51 +08001548fi
1549
Chia-I Wu99a37ed2010-01-05 17:39:05 +08001550dnl prepend CORE_DIRS to SRC_DIRS
1551SRC_DIRS="$CORE_DIRS $SRC_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001552
Dan Nicholsondca1b792007-10-23 09:25:58 -07001553dnl Restore LDFLAGS and CPPFLAGS
1554LDFLAGS="$_SAVE_LDFLAGS"
1555CPPFLAGS="$_SAVE_CPPFLAGS"
1556
1557dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -08001558AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001559
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001560dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001561AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001562if test -f configs/current || test -L configs/current; then
1563 rm -f configs/current
1564fi
1565ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001566])
1567
1568AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001569
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001570dnl
1571dnl Output some configuration info for the user
1572dnl
1573echo ""
1574echo " prefix: $prefix"
1575echo " exec_prefix: $exec_prefix"
1576echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07001577echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001578
1579dnl Driver info
1580echo ""
1581echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -08001582if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1583 echo " OSMesa: lib$OSMESA_LIB"
1584else
1585 echo " OSMesa: no"
1586fi
1587if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001588 # cleanup the drivers var
1589 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001590if test "x$DRI_DIRS" = x; then
1591 echo " DRI drivers: no"
1592else
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001593 echo " DRI drivers: $dri_dirs"
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001594fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001595 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -08001596fi
RALOVICH, Kristóf5f19f5c2008-11-04 11:53:32 +01001597echo " Use XCB: $enable_xcb"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001598
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001599echo ""
Eric Anholt1a8b1272010-05-21 12:17:24 -07001600if test "x$MESA_LLVM" = x1; then
Jakob Bornecrantzfe0fe672010-04-28 13:38:58 +01001601 echo " llvm: yes"
1602 echo " llvm-config: $LLVM_CONFIG"
1603 echo " llvm-version: $LLVM_VERSION"
1604else
1605 echo " llvm: no"
1606fi
1607
1608echo ""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001609if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1610 echo " Gallium: yes"
1611 echo " Gallium dirs: $GALLIUM_DIRS"
Keith Whitwell51bff092010-03-11 14:43:00 +00001612 echo " Target dirs: $GALLIUM_TARGET_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001613 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001614 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001615 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
Chia-I Wu63ab2502010-05-05 15:38:02 +08001616 if test "x$HAVE_ST_EGL" = xyes; then
1617 echo " EGL client APIs: $EGL_CLIENT_APIS"
1618 fi
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001619else
1620 echo " Gallium: no"
1621fi
1622
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001623dnl Libraries
1624echo ""
1625echo " Shared libs: $enable_shared"
1626echo " Static libs: $enable_static"
Kristian Høgsberg42fa0092010-02-03 10:18:28 -05001627if test "$enable_egl" = yes; then
1628 echo " EGL: $EGL_DRIVERS_DIRS"
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001629 echo " EGL platforms: $EGL_PLATFORMS"
Kristian Høgsberg42fa0092010-02-03 10:18:28 -05001630else
1631 echo " EGL: no"
1632fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001633echo " GLU: $enable_glu"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001634echo " GLw: $enable_glw (Motif: $enable_motif)"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001635echo " glut: $enable_glut"
1636
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001637dnl Compiler options
1638# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1639cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1640 $SED 's/^ *//;s/ */ /;s/ *$//'`
1641cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1642 $SED 's/^ *//;s/ */ /;s/ *$//'`
1643defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1644echo ""
1645echo " CFLAGS: $cflags"
1646echo " CXXFLAGS: $cxxflags"
1647echo " Macros: $defines"
1648
Dan Nicholsondca1b792007-10-23 09:25:58 -07001649echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07001650echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001651echo ""